Wire plugins/ai into the shared runtime-registry codegen so netscript generate emits static _registry.ts maps for user-authored tools, agents, and skills, the same way plugins/workers and plugins/triggers already do.
Context
Part of epic #238 · cluster plugin-ai · wave v1-min · depends-on P2
This is the codegen-wiring slice for the plugins/ai thin manifest: it only exists once P2 has scaffolded the plugins/ai package shape and the userland ai/tools|agents|skills directories with their type contracts. It must land before any FA/FB fresh-ui or fresh/ai consumer slice can rely on a generated ai registry existing in a scaffolded project.
Problem / motivation
plugin-file-collector.ts and generate-runtime-registries.ts already run a shared generateRuntimeRegistries engine driven purely by a per-plugin scaffold.runtime.json manifest (see plugins/workers/scaffold.runtime.json for workers-job targets and plugins/triggers/scaffold.runtime.json for a map target). plugins/ai has no such manifest, so netscript generate does not discover user tool/agent/skill files or produce a typed lookup map for them. Without this, any runtime that needs to resolve a tool/agent/skill by id (chat backend, fresh/ai client, orchestration primitives) has to hand-roll discovery — the same anti-pattern eis-chat used before this stack existed, which this epic exists to retire.
Scope
Ships
plugins/ai/scaffold.runtime.json with:
runtimeRegistryGenerator.command: "src/cli/generate-runtime-registries.ts" (or a thin re-export delegating to the shared engine — no forked copy)
runtimeRegistries: three "kind": "map" targets, one each for ai/tools, ai/agents, ai/skills, each with fileSuffixes: [".ts"], an exclude list covering _registry.ts/mod.ts/types.ts, a registryKey (id), a varPrefix, and a typeImport pointing at the contract types P2 exports (e.g. ToolDefinition, AgentDefinition, SkillDefinition)
- default
registryPath per target (i.e. ai/tools/_registry.ts, ai/agents/_registry.ts, ai/skills/_registry.ts), matching the triggers precedent rather than a .netscript/generated/... path
- Any thin CLI entry file under
plugins/ai/src/cli/ needed only to invoke the shared generateRuntimeRegistries(options) engine with this plugin's manifest path
Out of scope
- The shared
generateRuntimeRegistries engine itself, or any change to runtime-registry-generator.ts — P3 only supplies a manifest and consumes the existing engine
- The
plugins/ai package scaffold, directory layout, and the ToolDefinition/AgentDefinition/SkillDefinition contract types the manifest imports — owned by P2
SkillLoaderPort and Agent Skills management (blessed SKILL.md loading) — separate slice per the ratified Agent Skills decision
- Orchestration wiring that consumes the generated registries at runtime — owned by the ENGINE-cluster orchestration-primitives slice
Public surface
- New file:
plugins/ai/scaffold.runtime.json
- Generated artifacts (build output, not hand-authored):
ai/tools/_registry.ts, ai/agents/_registry.ts, ai/skills/_registry.ts, each exporting registry: Map<string, <ContractType>>
- No new package exports, no new subpaths
Acceptance & fitness gates
Dependencies
Size
S
Wire
plugins/aiinto the shared runtime-registry codegen sonetscript generateemits static_registry.tsmaps for user-authored tools, agents, and skills, the same wayplugins/workersandplugins/triggersalready do.Context
Part of epic #238 · cluster plugin-ai · wave v1-min · depends-on P2
This is the codegen-wiring slice for the
plugins/aithin manifest: it only exists once P2 has scaffolded theplugins/aipackage shape and the userlandai/tools|agents|skillsdirectories with their type contracts. It must land before any FA/FB fresh-ui or fresh/ai consumer slice can rely on a generatedairegistry existing in a scaffolded project.Problem / motivation
plugin-file-collector.tsandgenerate-runtime-registries.tsalready run a sharedgenerateRuntimeRegistriesengine driven purely by a per-pluginscaffold.runtime.jsonmanifest (seeplugins/workers/scaffold.runtime.jsonforworkers-jobtargets andplugins/triggers/scaffold.runtime.jsonfor amaptarget).plugins/aihas no such manifest, sonetscript generatedoes not discover user tool/agent/skill files or produce a typed lookup map for them. Without this, any runtime that needs to resolve a tool/agent/skill by id (chat backend, fresh/ai client, orchestration primitives) has to hand-roll discovery — the same anti-pattern eis-chat used before this stack existed, which this epic exists to retire.Scope
Ships
plugins/ai/scaffold.runtime.jsonwith:runtimeRegistryGenerator.command: "src/cli/generate-runtime-registries.ts"(or a thin re-export delegating to the shared engine — no forked copy)runtimeRegistries: three"kind": "map"targets, one each forai/tools,ai/agents,ai/skills, each withfileSuffixes: [".ts"], anexcludelist covering_registry.ts/mod.ts/types.ts, aregistryKey(id), avarPrefix, and atypeImportpointing at the contract types P2 exports (e.g.ToolDefinition,AgentDefinition,SkillDefinition)registryPathper target (i.e.ai/tools/_registry.ts,ai/agents/_registry.ts,ai/skills/_registry.ts), matching thetriggersprecedent rather than a.netscript/generated/...pathplugins/ai/src/cli/needed only to invoke the sharedgenerateRuntimeRegistries(options)engine with this plugin's manifest pathOut of scope
generateRuntimeRegistriesengine itself, or any change toruntime-registry-generator.ts— P3 only supplies a manifest and consumes the existing engineplugins/aipackage scaffold, directory layout, and theToolDefinition/AgentDefinition/SkillDefinitioncontract types the manifest imports — owned by P2SkillLoaderPortand Agent Skills management (blessedSKILL.mdloading) — separate slice per the ratified Agent Skills decisionPublic surface
plugins/ai/scaffold.runtime.jsonai/tools/_registry.ts,ai/agents/_registry.ts,ai/skills/_registry.ts, each exportingregistry: Map<string, <ContractType>>Acceptance & fitness gates
deno task checkpasses forplugins/aiwith--unstable-kvai/tools,ai/agents,ai/skillsproduces all three_registry.tsfiles with correct imports and a non-emptyMapai/*directory produces no output for that target (matches existingdiscoverRegistryFilesshort-circuit — no crash)deno task arch:checkcleanscaffold.runtimeE2E coversaiplugin add + generate the same way it already asserts workers/triggers/sagas/streams registry generation, confirmingai/tools|agents|skills_registry.tsfiles exist and type-check in the generated workspaceDependencies
plugins/aiscaffold and the tool/agent/skill contract types this manifest'stypeImportentries reference.Size
S