pi-fabric 0.131.3 → 0.131.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actors/feedback.d.ts +5 -0
- package/dist/actors/feedback.d.ts.map +1 -0
- package/dist/agents/completion-inbox.d.ts.map +1 -1
- package/dist/agents.js +1 -1
- package/dist/chunks/{chunk-UTPA2PBN.js → chunk-DGUXJSYA.js} +36 -15
- package/dist/chunks/chunk-DGUXJSYA.js.map +7 -0
- package/dist/chunks/{chunk-SQRDHUD2.js → chunk-G2DZJ5LK.js} +2 -2
- package/dist/chunks/{chunk-HKGHRPX7.js → chunk-LZ2ZXOCU.js} +2 -2
- package/dist/chunks/{chunk-HKGHRPX7.js.map → chunk-LZ2ZXOCU.js.map} +1 -1
- package/dist/chunks/{chunk-QYBALDEM.js → chunk-U6Y6TKJL.js} +2 -2
- package/dist/chunks/{chunk-QYBALDEM.js.map → chunk-U6Y6TKJL.js.map} +1 -1
- package/dist/extension-bootstrap.js +2 -2
- package/dist/fabric-runtime-state.d.ts.map +1 -1
- package/dist/fabric-runtime-state.js +41 -31
- package/dist/fabric-runtime-state.js.map +4 -4
- package/dist/feedback.d.ts +5 -0
- package/dist/feedback.d.ts.map +1 -0
- package/dist/index.js +2 -2
- package/dist/main-agent.d.ts +2 -1
- package/dist/main-agent.d.ts.map +1 -1
- package/dist/residency/host.js +1 -1
- package/dist/residency/pi-entry.js +1 -1
- package/dist/ui/dashboard.js +2 -2
- package/dist/ui/dashboard.js.map +2 -2
- package/docs/agents.md +5 -5
- package/docs/jev.md +1 -1
- package/package.json +1 -1
- package/skillsets/typescript/fabric-exec/references/agents.md +4 -4
- package/dist/chunks/chunk-UTPA2PBN.js.map +0 -7
- /package/dist/chunks/{chunk-SQRDHUD2.js.map → chunk-G2DZJ5LK.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/providers/agents-actions.ts", "../../src/agents/request.ts"],
|
|
4
|
-
"sourcesContent": ["import { FABRIC_ACTOR_HOST_EVENTS } from \"../actors/types.js\";\nimport {\n MAX_COMPACTION_INSTRUCTIONS_CHARS,\n MAX_PRESERVE_ITEM_CHARS,\n MAX_PRESERVE_ITEMS,\n} from \"../compaction/instructions.js\";\nimport { FABRIC_LIFECYCLE_EVENTS } from \"../lifecycle/types.js\";\nimport type { FabricActionDescriptor } from \"../protocol.js\";\n\n// RUNNER_ID_PATTERN (src/agents/runner-registry.ts) as source text; kept in sync by a test.\nconst RUNNER_ID_SOURCE = \"^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$\";\n\nconst runProperties = {\n task: { type: \"string\", description: \"A self-contained task for the child agent\" },\n agent: {\n type: \"string\",\n minLength: 1,\n description: \"Name of an agent file (see agents.definitions()) whose instructions, model, tools, thinking and runtimes.fabric settings fill this request. Any field passed here wins over the file. An unknown name fails before the child starts.\",\n },\n name: { type: \"string\" },\n runner: {\n type: \"string\",\n pattern: RUNNER_ID_SOURCE,\n maxLength: 64,\n description: \"Execution harness: pi-durable (default), pi, claude, veda, or a runner registered through pi-fabric/runners. Defaults to agents.runner.\",\n },\n kernel: {\n type: \"string\",\n enum: [\"typescript\", \"python\", \"inherit\"],\n description: \"Fabric execution language. Omitted/inherit uses the caller executor.kernel; concrete choices require Pi with extensions enabled. Python uses the configured backend; CPython is native execution.\",\n },\n transport: {\n type: \"string\",\n enum: [\"auto\", \"process\", \"tmux\", \"screen\", \"localterm\", \"herdr\", \"herdr-core\"],\n },\n model: {\n type: \"string\",\n description:\n \"Pi provider/id copied from agents.models({ runner: \\\"pi\\\" }), a configured models.aliases name, or a search term resolved to the closest authenticated model (recency from pi-model-sort breaks ties). Reuse returned keys; never infer version numbers from agent names. Exact keys win; near-miss IDs resolve to the closest visible model on the same provider. Handles report the canonical model. Claude runtime value or Veda backend model/alias are forwarded verbatim. Set modelMatch: \\\"exact\\\" to turn off aliases and near-miss resolution.\",\n },\n modelMatch: {\n type: \"string\",\n enum: [\"exact\"],\n description:\n \"Pi runners only (pi, pi-durable). \\\"exact\\\" selects a listed provider/id without aliases, closest or fuzzy matching, or alias thinking; invalid selectors and other runners are refused before launch. Admission is strict and a child guard detects model switches and some payload rewrites. This is not a security guarantee or final-dispatch enforcement: later hooks, unknown API payloads, providers and extension-made calls can route data elsewhere; attribution checks may detect drift only after a call. Do not rely on it to prevent data disclosure. Omit for default resolution.\",\n },\n persona: {\n type: \"string\",\n description: \"Veda persona name for this run, such as frontend, reviewer, worker, or a custom persona.\",\n },\n holdQuestions: {\n type: \"boolean\",\n const: true,\n description:\n \"Hold this run's routed questions for a person. Each question becomes a root-held Fabric decision with a 30-day deadline (the longest allowed); only this run waits until it is answered (/fabric decisions, pi-fabric decisions answer, or decisions.answer from the main session). Needs agents.childQuestions \\\"route\\\" and a runner that declares questions; refused otherwise. The run's timeoutMs still applies.\",\n },\n thinking: {\n type: \"string\",\n enum: [\"off\", \"minimal\", \"low\", \"medium\", \"high\", \"xhigh\", \"max\"],\n },\n thinkingBounds: {\n type: \"object\",\n properties: {\n min: { type: \"string\", enum: [\"off\", \"minimal\", \"low\", \"medium\", \"high\", \"xhigh\", \"max\"] },\n max: { type: \"string\", enum: [\"off\", \"minimal\", \"low\", \"medium\", \"high\", \"xhigh\", \"max\"] },\n },\n additionalProperties: false,\n description: \"Optional child thinking bounds; must lie inside this session's bounds (omitted ends inherit). Child Fabric sessions never widen them. thinking outside the effective bounds is clamped and reported as requestedThinking.\",\n },\n tools: { type: \"array\", items: { type: \"string\" } },\n timeoutMs: {\n type: \"number\",\n description:\n \"Optional longer wall-clock limit in milliseconds. Omit to use agents.timeoutMs (60 minutes by default); values below the configured default are ignored.\",\n },\n extensions: { type: \"boolean\" },\n recursive: { type: \"boolean\" },\n cwd: {\n type: \"string\",\n description: \"Filesystem execution directory for leaf or recursive Pi runs; relative paths resolve from the caller cwd. Does not change project/mesh ownership or grant target project trust.\",\n },\n worktree: { type: \"boolean\" },\n worktreeSetup: {\n type: \"string\",\n maxLength: 8192,\n description: \"Shell command run in a new worktree before the child starts; overrides agents.worktree.setup. Non-zero exit fails the run.\",\n },\n seed: {\n type: \"string\",\n enum: [\"task\", \"branch\", \"snippet\"],\n description: \"Child context (Pi only). task (default): the task alone. branch: a non-blocking fork of this conversation up to its last completed turn, then the task. snippet: the last seedMessages user/assistant texts prefixed to the task.\",\n },\n seedMessages: { type: \"integer\", minimum: 1, maximum: 50, description: \"snippet only; default 12\" },\n readOnly: { type: \"boolean\", description: \"Pi only: refuse write/edit (and shell unless shell: \\\"unconfined\\\") in the child\" },\n writableRoots: {\n type: \"array\",\n items: { type: \"string\", maxLength: 4096 },\n maxItems: 32,\n description: \"Pi only: confine write/edit to these directories (relative to the child cwd; default the cwd). Shell is refused unless shell: \\\"unconfined\\\".\",\n },\n scope: {\n type: \"object\",\n properties: {\n grants: {\n type: \"array\",\n maxItems: 64,\n items: {\n type: \"object\",\n properties: {\n resource: { type: \"string\", minLength: 3, maxLength: 512 },\n actions: { type: \"array\", minItems: 1, maxItems: 3, items: { type: \"string\", enum: [\"read\", \"write\", \"execute\"] } },\n },\n required: [\"resource\", \"actions\"],\n additionalProperties: false,\n },\n },\n },\n required: [\"grants\"],\n additionalProperties: false,\n description: \"Narrow this session's host-issued scope for the child (each grant must be covered by a parent grant; resource <ns>:<path>, <ns>:<path>/*, <ns>:<path>/**, <ns>:*). Omit to inherit it; refused in an unscoped session.\",\n },\n shell: {\n type: \"string\",\n enum: [\"deny\", \"unconfined\"],\n description: \"With a write policy, bash is refused by default; unconfined allows it and is not a sandbox\",\n },\n schema: { type: \"object\", description: \"Optional JSON Schema for validated structured output\" },\n systemPrompt: {\n type: \"string\",\n description: \"Optional extra system prompt body for this child run. Fabric places it ahead of any component guidance. Pi and Claude runners append the result with --append-system-prompt, and Veda receives it as a <system_instructions> block in its prompt. Useful for reliability-focused prompt rules on models with weak behavioral defaults.\",\n },\n skills: {\n anyOf: [\n { type: \"boolean\", const: false },\n { type: \"array\", items: { type: \"string\", minLength: 1, maxLength: 128, pattern: \"^[^/\\\\\\\\]+$\" }, maxItems: 64 },\n {\n type: \"object\",\n properties: {\n preload: { type: \"array\", items: { type: \"string\", minLength: 1, maxLength: 128, pattern: \"^[^/\\\\\\\\]+$\" }, maxItems: 64 },\n inherit: { type: \"boolean\" },\n },\n additionalProperties: false,\n },\n ],\n description: \"Pi runners only: the child's skills, by name, resolved against this session's skills. false: no skills. A list: those skills preloaded in full, plus this session's other skills. { preload, inherit: false }: only the preloaded skills. Omit to keep the child's own skill discovery. An unknown name fails before launch.\",\n },\n persistSession: {\n type: \"boolean\",\n description: \"Claude runner only: persist the Claude Code transcript for hook-based observability. Defaults to false.\",\n },\n};\n\nconst runSchema = {\n type: \"object\",\n properties: runProperties,\n required: [\"task\"],\n additionalProperties: false,\n};\n\nconst residencySchema = {\n type: \"string\",\n enum: [\"session\", \"durable\"],\n description: \"session stops with the current Pi host; durable transfers execution to Fabric's hidden resident host.\",\n};\n\nconst actorBindingScopeSchema = {\n type: \"string\",\n enum: [\"session\", \"project\"],\n description: \"session (default) changes only this Pi session; project pins the shared actor default and requires ownership.\",\n};\n\nconst actorInvocationProperties = {\n id: { type: \"string\" },\n message: { type: \"string\" },\n data: {},\n model: {\n ...runProperties.model,\n description: \"Optional model pinned only for this actor activation.\",\n },\n thinking: runProperties.thinking,\n};\n\nconst spawnSchema = {\n ...runSchema,\n properties: {\n ...runProperties,\n residency: residencySchema,\n queue: {\n type: \"boolean\",\n description:\n \"Return a handle with status \\\"queued\\\" at once instead of waiting inside this call for a free agents.maxConcurrent slot. The run starts when a slot frees, even after this program ends; wait, status, list, and stop accept the id meanwhile, and stop cancels it without launching. Validation errors still reject the call. Omitted or false keeps the default: spawn waits for a slot.\",\n },\n },\n};\n\nconst handoffCompactionSchema = {\n anyOf: [\n { type: \"boolean\" },\n {\n type: \"object\",\n properties: {\n instructions: {\n type: \"string\",\n maxLength: MAX_COMPACTION_INSTRUCTIONS_CHARS,\n description: \"Custom compaction instructions for the inherited trajectory\",\n },\n preserve: {\n type: \"array\",\n items: { type: \"string\", maxLength: MAX_PRESERVE_ITEM_CHARS },\n maxItems: MAX_PRESERVE_ITEMS,\n description: \"Explicit bounded facts the trajectory summary must preserve\",\n },\n },\n additionalProperties: false,\n },\n ],\n description:\n \"Compact the inherited trajectory with Fabric's deterministic compactor before the executor resumes it. `true` applies the default summary; an object customizes instructions and bounded preserve facts. Omitted keeps the full raw trajectory.\",\n};\n\nconst handoffSchema = {\n type: \"object\",\n properties: {\n task: {\n type: \"string\",\n description: \"Optional instructions for the executor in addition to the inherited trajectory\",\n },\n name: runProperties.name,\n kernel: runProperties.kernel,\n transport: runProperties.transport,\n model: {\n ...runProperties.model,\n description: \"Explicit Pi provider/id target that will continue the inherited trajectory\",\n },\n thinking: runProperties.thinking,\n tools: runProperties.tools,\n timeoutMs: runProperties.timeoutMs,\n extensions: runProperties.extensions,\n recursive: runProperties.recursive,\n schema: runProperties.schema,\n compact: handoffCompactionSchema,\n },\n required: [\"model\"],\n additionalProperties: false,\n};\n\nconst idSchema = {\n type: \"object\",\n properties: { id: { type: \"string\" } },\n required: [\"id\"],\n additionalProperties: false,\n};\n\nconst parkResultSchema = (requested: \"sleep\" | \"wake\") => ({\n type: \"object\",\n properties: { id: { type: \"string\" }, requested: { const: requested } },\n required: [\"id\", \"requested\"],\n additionalProperties: false,\n});\n\nconst lifecycleEventSchema = {\n type: \"string\",\n enum: [...FABRIC_LIFECYCLE_EVENTS],\n};\n\nexport const AGENTS_ACTION_DESCRIPTORS: FabricActionDescriptor[] = [\n {\n name: \"run\",\n description: \"Run a child agent through Pi or Claude Code and wait for its final result\",\n inputSchema: runSchema,\n risk: \"agent\",\n },\n {\n name: \"handoff\",\n description:\n \"Schedule a Pi trajectory handoff after the current outer fabric_exec result, then wait for implementation at that boundary\",\n inputSchema: handoffSchema,\n risk: \"agent\",\n },\n {\n name: \"spawn\",\n description:\n \"Start a child agent through Pi or Claude Code and return a handle immediately. For independent launches, await Promise.allSettled and inspect every result so one rejection does not abort pending sibling calls at program exit. Unread detached results are batched at the next safe turn boundary (or wake idle Main) when agents.notifyOnComplete is enabled. wait/join and terminal status acknowledge results and retract pending notifications. Use wait when this program needs the result; do not poll status in a loop.\",\n inputSchema: spawnSchema,\n risk: \"agent\",\n },\n {\n name: \"wait\",\n description: \"Wait for a previously spawned child agent and acknowledge its result, suppressing a duplicate completion notification\",\n effect: { kind: \"emission\", ordering: \"commutative\", resources: [\"agents.completions\"] },\n inputSchema: idSchema,\n risk: \"read\",\n },\n {\n name: \"join\",\n description: \"Alias for agents.wait: wait for a previously spawned child agent with the same progress and completion-notification behavior\",\n effect: { kind: \"emission\", ordering: \"commutative\", resources: [\"agents.completions\"] },\n inputSchema: idSchema,\n risk: \"read\",\n },\n {\n name: \"status\",\n description: \"Get the latest status of any known project participant. A terminal child-agent result acknowledges its pending completion notification; running status does not.\",\n effect: { kind: \"emission\", ordering: \"commutative\", resources: [\"agents.completions\"] },\n inputSchema: idSchema,\n risk: \"read\",\n },\n {\n name: \"list\",\n description: \"List agent participants locally, across the current lineage, or across the project\",\n inputSchema: {\n type: \"object\",\n properties: { scope: { type: \"string\", enum: [\"local\", \"lineage\", \"project\"] } },\n additionalProperties: false,\n },\n risk: \"read\",\n },\n {\n name: \"members\",\n description: \"List the unified project topology of roots, agents, and actors\",\n inputSchema: {\n type: \"object\",\n properties: {\n scope: { type: \"string\", enum: [\"local\", \"lineage\", \"project\"] },\n kinds: {\n type: \"array\",\n items: { type: \"string\", enum: [\"root\", \"agent\", \"actor\"] },\n },\n includeStale: { type: \"boolean\" },\n },\n additionalProperties: false,\n },\n risk: \"read\",\n },\n {\n name: \"self\",\n description: \"Return this caller's intrinsic participant identity in the unified topology\",\n inputSchema: { type: \"object\", properties: {}, additionalProperties: false },\n risk: \"read\",\n },\n {\n name: \"main\",\n description:\n \"Return the root user-facing Main Pi agent target. The stable alias main is also accepted by agents.steer and agents.followUp.\",\n inputSchema: { type: \"object\", properties: {}, additionalProperties: false },\n risk: \"read\",\n },\n {\n name: \"sessions\",\n description: \"List all live root Pi session agents in the project, including the current lineage root and peers, with symmetric participant identities.\",\n inputSchema: { type: \"object\", properties: {}, additionalProperties: false },\n risk: \"read\",\n },\n {\n name: \"departed\",\n description: \"List root Pi sessions that are no longer live, newest first: status stopped (closed cleanly) or lost (lease expired without closing), with sessionId, cwd, label and lastSeenAt. Live sessions are never included.\",\n inputSchema: {\n type: \"object\",\n properties: { limit: { type: \"number\", minimum: 1 } },\n additionalProperties: false,\n },\n risk: \"read\",\n },\n {\n name: \"definitions\",\n description: \"List the named agent files that agents.run and agents.spawn accept in agent: name, description, path, scope (user or project), the file it shadows, and warnings for ignored fields. A file that cannot be read appears with an error.\",\n inputSchema: { type: \"object\", properties: {}, additionalProperties: false },\n risk: \"read\",\n },\n {\n name: \"peers\",\n description: \"List other live root Pi sessions sharing this project mesh. The dashboard-owning session remains Main; these targets are named peers.\",\n inputSchema: { type: \"object\", properties: {}, additionalProperties: false },\n risk: \"read\",\n },\n {\n name: \"subscribe\",\n description:\n \"Create a durable source-qualified participant lifecycle subscription. Events are delivered to Main by default or to another participant through steer/follow-up routing.\",\n inputSchema: {\n type: \"object\",\n properties: {\n from: { type: \"string\", description: \"Exact source participant id; main means this lineage root\" },\n events: { type: \"array\", minItems: 1, items: lifecycleEventSchema },\n to: { type: \"string\", description: \"Target participant id; defaults to main\" },\n delivery: { type: \"string\", enum: [\"steer\", \"followUp\"] },\n triggerTurn: { type: \"boolean\" },\n once: { type: \"boolean\" },\n },\n required: [\"from\", \"events\", \"delivery\", \"triggerTurn\"],\n additionalProperties: false,\n },\n risk: \"agent\",\n },\n {\n name: \"subscriptions\",\n description: \"List durable participant lifecycle subscriptions, optionally filtered by source or target\",\n inputSchema: {\n type: \"object\",\n properties: { from: { type: \"string\" }, to: { type: \"string\" } },\n additionalProperties: false,\n },\n risk: \"read\",\n },\n {\n name: \"unsubscribe\",\n description: \"Remove a participant lifecycle subscription\",\n inputSchema: idSchema,\n risk: \"agent\",\n },\n {\n name: \"models\",\n description:\n \"List models exposed by the selected runner. Claude models are enumerated from the installed Claude Code runtime, not hard-coded. Pass model to look up one exact key instead of reading the whole list. Veda returns an empty list: pass its backend model or alias directly as model.\",\n inputSchema: {\n type: \"object\",\n properties: {\n runner: { type: \"string\", pattern: RUNNER_ID_SOURCE, maxLength: 64 },\n refresh: { type: \"boolean\" },\n model: {\n type: \"string\",\n minLength: 1,\n maxLength: 256,\n description:\n \"Exact model key (the key field of an unfiltered entry, e.g. provider/id or claude/<value>). Returns only the entries whose key matches exactly and case-sensitively, with no alias or fuzzy resolution; an unknown key returns [].\",\n },\n },\n additionalProperties: false,\n },\n risk: \"execute\",\n },\n {\n name: \"switchModel\",\n description:\n \"Switch Main's live Pi session model in place. The model selector accepts an exact provider/id, a configured models.aliases name (alias chains try each target in order until one is authenticated), an exact model id, or a search term; inexact terms resolve to the closest match, preferring recently used models (via pi-model-sort usage, when present).\",\n inputSchema: {\n type: \"object\",\n properties: {\n model: {\n type: \"string\",\n description: \"provider/id, alias name, or search term\",\n },\n provider: { type: \"string\" },\n },\n required: [\"model\"],\n additionalProperties: false,\n },\n risk: \"agent\",\n },\n {\n name: \"stop\",\n description: \"Stop a local or remotely owned agent or actor that advertises the stop capability\",\n inputSchema: idSchema,\n risk: \"agent\",\n },\n {\n name: \"sleep\",\n description:\n \"Park an idle hosted run in this session. Only runners that declare the sleep capability accept it. The run stays running and status shows sleeping: true once the runner reports it.\",\n inputSchema: idSchema,\n outputSchema: parkResultSchema(\"sleep\"),\n risk: \"agent\",\n },\n {\n name: \"wake\",\n description: \"Resume a hosted run in this session that agents.sleep parked. Needs the runner's sleep capability.\",\n inputSchema: idSchema,\n outputSchema: parkResultSchema(\"wake\"),\n risk: \"agent\",\n },\n {\n name: \"cleanup\",\n description: \"Remove a completed agent's run files and optional Git worktree\",\n inputSchema: {\n type: \"object\",\n properties: {\n id: { type: \"string\" },\n deleteBranch: { type: \"boolean\" },\n },\n required: [\"id\"],\n additionalProperties: false,\n },\n risk: \"write\",\n },\n {\n name: \"create\",\n description:\n 'Create a persistent actor with independently selected session or project storage. A stopped live actor with the same name must be explicitly removed first. Use scope \"global\" to save a reusable project-independent template instead of a live actor.',\n inputSchema: {\n type: \"object\",\n properties: {\n name: { type: \"string\" },\n instructions: { type: \"string\" },\n events: {\n type: \"array\",\n items: {\n type: \"string\",\n enum: [...FABRIC_ACTOR_HOST_EVENTS],\n },\n },\n topics: { type: \"array\", items: { type: \"string\" } },\n delivery: {\n type: \"string\",\n enum: [\"mailbox\", \"steer\", \"followUp\", \"nextTurn\"],\n },\n responseMode: { type: \"string\", enum: [\"text\", \"directive\"] },\n triggerTurn: { type: \"boolean\" },\n coalesce: { type: \"boolean\" },\n residency: residencySchema,\n runner: runProperties.runner,\n kernel: runProperties.kernel,\n model: runProperties.model,\n thinking: runProperties.thinking,\n tools: runProperties.tools,\n transport: runProperties.transport,\n timeoutMs: runProperties.timeoutMs,\n extensions: runProperties.extensions,\n requires: {\n type: \"array\",\n maxItems: 128,\n description: \"Exact Fabric provider.action refs committed before every actor run. Object entries may be optional.\",\n items: {\n oneOf: [\n { type: \"string\", minLength: 3, maxLength: 256 },\n {\n type: \"object\",\n properties: {\n ref: { type: \"string\", minLength: 3, maxLength: 256 },\n optional: { type: \"boolean\" },\n },\n required: [\"ref\"],\n additionalProperties: false,\n },\n ],\n },\n },\n validWhile: {\n type: \"object\",\n properties: { version: { const: 1 }, source: { type: \"string\" } },\n required: [\"version\", \"source\"],\n additionalProperties: false,\n },\n scope: {\n type: \"string\",\n enum: [\"session\", \"project\", \"global\"],\n description: \"session isolates the actor to the root Pi session; project shares it across sessions; global creates a non-live template.\",\n },\n },\n required: [\"name\", \"instructions\"],\n oneOf: [\n {\n properties: {\n delivery: { const: \"mailbox\" },\n triggerTurn: { const: false },\n },\n },\n {\n properties: {\n delivery: { const: \"nextTurn\" },\n triggerTurn: { const: false },\n },\n required: [\"delivery\"],\n },\n {\n properties: { delivery: { enum: [\"steer\", \"followUp\"] } },\n required: [\"delivery\", \"triggerTurn\"],\n },\n ],\n additionalProperties: false,\n },\n risk: \"agent\",\n },\n {\n name: \"ask\",\n description: \"Send a message to a persistent actor through its live owner and wait for its next response. Optional model/thinking values apply only to this activation.\",\n inputSchema: {\n type: \"object\",\n properties: actorInvocationProperties,\n required: [\"id\", \"message\"],\n additionalProperties: false,\n },\n risk: \"agent\",\n },\n {\n name: \"tell\",\n description: \"Queue a message through a persistent actor's live owner without waiting. Optional model/thinking values apply only to this activation.\",\n inputSchema: {\n type: \"object\",\n properties: actorInvocationProperties,\n required: [\"id\", \"message\"],\n additionalProperties: false,\n },\n risk: \"agent\",\n },\n {\n name: \"steer\",\n description:\n \"Steer Main, a running one-shot agent between turns, or a persistent actor through its mailbox. The stable id alias main targets the root user-facing Pi session. Non-local targets route over the project mesh.\",\n inputSchema: {\n type: \"object\",\n properties: { id: { type: \"string\" }, message: { type: \"string\" }, data: {} },\n required: [\"id\", \"message\"],\n additionalProperties: false,\n },\n risk: \"agent\",\n },\n {\n name: \"followUp\",\n description:\n \"Queue a follow-up for Main or a running one-shot agent, or enqueue a persistent actor mailbox message. The stable id alias main targets the root user-facing Pi session. Non-local targets route over the project mesh.\",\n inputSchema: {\n type: \"object\",\n properties: { id: { type: \"string\" }, message: { type: \"string\" }, data: {} },\n required: [\"id\", \"message\"],\n additionalProperties: false,\n },\n risk: \"agent\",\n },\n {\n name: \"setSteeringMode\",\n description:\n \"Set how queued steer messages are delivered to a running one-shot agent: all at once after the current turn, or one per turn (default). Local agent only.\",\n inputSchema: {\n type: \"object\",\n properties: {\n id: { type: \"string\" },\n mode: { type: \"string\", enum: [\"all\", \"one-at-a-time\"] },\n },\n required: [\"id\", \"mode\"],\n additionalProperties: false,\n },\n risk: \"agent\",\n },\n {\n name: \"setFollowUpMode\",\n description:\n \"Set how queued follow-up messages are delivered to a one-shot agent: all when it finishes, or one per completion (default). Local agent only.\",\n inputSchema: {\n type: \"object\",\n properties: {\n id: { type: \"string\" },\n mode: { type: \"string\", enum: [\"all\", \"one-at-a-time\"] },\n },\n required: [\"id\", \"mode\"],\n additionalProperties: false,\n },\n risk: \"agent\",\n },\n {\n name: \"compact\",\n description:\n \"Request an advisory compaction of a running Pi-runner child agent's context at its next safe boundary (between its own turns), preserving the child's accumulated context. Rejected for Claude and Veda children and for registered runners without the compaction capability. The child pi core applies the compaction; Fabric only forwards the intent.\",\n inputSchema: {\n type: \"object\",\n properties: {\n id: { type: \"string\" },\n instructions: {\n type: \"string\",\n description: \"Optional custom compaction instructions forwarded to the child pi\",\n },\n },\n required: [\"id\"],\n additionalProperties: false,\n },\n risk: \"agent\",\n },\n {\n name: \"actorStatus\",\n description: \"Read one persistent actor's status\",\n inputSchema: idSchema,\n risk: \"read\",\n },\n {\n name: \"actors\",\n description:\n 'List persistent actors. Default scope \"project\" lists live actors in this Fabric session; scope \"global\" lists project-independent templates in the global registry.',\n inputSchema: {\n type: \"object\",\n properties: { scope: { type: \"string\", enum: [\"project\", \"global\"] } },\n additionalProperties: false,\n },\n risk: \"read\",\n },\n {\n name: \"messages\",\n description: \"Read a persistent actor's bounded inbox and outbox history\",\n inputSchema: {\n type: \"object\",\n properties: { id: { type: \"string\" }, limit: { type: \"number\", minimum: 1 } },\n required: [\"id\"],\n additionalProperties: false,\n },\n risk: \"read\",\n },\n {\n name: \"setModel\",\n description:\n \"Change or clear a persistent actor model binding. Session scope is the default; project scope explicitly pins the shared definition default.\",\n inputSchema: {\n type: \"object\",\n properties: {\n id: { type: \"string\" },\n model: { type: \"string\" },\n scope: actorBindingScopeSchema,\n },\n required: [\"id\"],\n additionalProperties: false,\n },\n risk: \"agent\",\n },\n {\n name: \"setThinking\",\n description:\n \"Change or clear a persistent actor reasoning-effort binding. Session scope is the default; project scope explicitly pins the shared definition default.\",\n inputSchema: {\n type: \"object\",\n properties: {\n id: { type: \"string\" },\n thinking: runProperties.thinking,\n scope: actorBindingScopeSchema,\n },\n required: [\"id\"],\n additionalProperties: false,\n },\n risk: \"agent\",\n },\n {\n name: \"setTools\",\n description:\n \"Replace a persistent actor's tool allowlist. Takes effect on its next queued message; an empty list disables optional tools.\",\n inputSchema: {\n type: \"object\",\n properties: {\n id: { type: \"string\" },\n tools: runProperties.tools,\n scope: { type: \"string\", enum: [\"project\", \"global\"] },\n },\n required: [\"id\", \"tools\"],\n additionalProperties: false,\n },\n risk: \"agent\",\n },\n {\n name: \"setEvents\",\n description: \"Replace a persistent actor's session-bound Pi and synthetic tool_error event subscriptions\",\n inputSchema: {\n type: \"object\",\n properties: {\n id: { type: \"string\" },\n events: {\n type: \"array\",\n items: {\n type: \"string\",\n enum: [...FABRIC_ACTOR_HOST_EVENTS],\n },\n },\n },\n required: [\"id\", \"events\"],\n additionalProperties: false,\n },\n risk: \"agent\",\n },\n {\n name: \"setDeliveryPolicy\",\n description:\n \"Replace a project actor or global template delivery policy. steer/followUp require an explicit triggerTurn choice; mailbox/nextTurn require false.\",\n inputSchema: {\n type: \"object\",\n properties: {\n id: { type: \"string\" },\n delivery: {\n type: \"string\",\n enum: [\"mailbox\", \"steer\", \"followUp\", \"nextTurn\"],\n },\n triggerTurn: { type: \"boolean\" },\n scope: { type: \"string\", enum: [\"project\", \"global\"] },\n },\n required: [\"id\", \"delivery\", \"triggerTurn\"],\n additionalProperties: false,\n },\n risk: \"agent\",\n },\n {\n name: \"clearMessages\",\n description: \"Clear a persistent actor's recorded message history\",\n inputSchema: idSchema,\n risk: \"write\",\n },\n {\n name: \"remove\",\n description:\n 'Stop and remove a persistent actor. Default scope \"project\" removes a live project actor; scope \"global\" removes a project-independent template from the global registry.',\n inputSchema: {\n type: \"object\",\n properties: {\n id: { type: \"string\" },\n scope: { type: \"string\", enum: [\"project\", \"global\"] },\n },\n required: [\"id\"],\n additionalProperties: false,\n },\n risk: \"agent\",\n },\n {\n name: \"setInstructions\",\n description:\n 'Replace an actor\\'s default instruction (its persona / system-prompt body). Default scope \"project\" edits a live project actor; scope \"global\" edits a project-independent template. Takes effect on the actor\\'s next queued message.',\n inputSchema: {\n type: \"object\",\n properties: {\n id: { type: \"string\" },\n instructions: { type: \"string\" },\n scope: { type: \"string\", enum: [\"project\", \"global\"] },\n },\n required: [\"id\", \"instructions\"],\n additionalProperties: false,\n },\n risk: \"agent\",\n },\n {\n name: \"import\",\n description:\n \"Import a project-independent template from the global registry into the current project as a fresh live actor with no inherited history (no messages, session, or run logs). Identify the template by id or name; optionally rename the imported actor with \\\"as\\\" to avoid colliding with a live actor.\",\n inputSchema: {\n type: \"object\",\n properties: {\n id: { type: \"string\", description: \"Template id or name (one of id/name required)\" },\n name: { type: \"string\", description: \"Template name (one of id/name required)\" },\n as: { type: \"string\", description: \"Optional new name for the imported live actor\" },\n },\n additionalProperties: false,\n },\n risk: \"agent\",\n },\n {\n name: \"export\",\n description:\n \"Export a live project actor's definition to the global registry as a project-independent template, without any history (no messages, session, or run logs). Throws on a name collision unless overwrite is true.\",\n inputSchema: {\n type: \"object\",\n properties: {\n id: { type: \"string\" },\n overwrite: { type: \"boolean\" },\n },\n required: [\"id\"],\n additionalProperties: false,\n },\n risk: \"write\",\n },\n {\n name: \"log\",\n description:\n \"Read an actor or agent run's LLM/agent log: the actor's session transcript (session.jsonl) and/or a retained run's event stream (events.jsonl: tool calls, model responses, usage). Actors retain their last runs so logs survive after success.\",\n inputSchema: {\n type: \"object\",\n properties: {\n id: { type: \"string\", description: \"Actor ID/name or agent run ID\" },\n type: {\n type: \"string\",\n enum: [\"session\", \"run\", \"all\"],\n description:\n \"session = actor session transcript (default for actors); run = last retained run's events; all = both\",\n },\n lines: { type: \"number\", minimum: 1, description: \"Page line limit (default 200)\" },\n before: {\n type: \"number\",\n minimum: 0,\n description: \"Exclusive line cursor returned by a previous page to load older entries\",\n },\n runId: { type: \"string\", description: \"Specific retained run (default: actor's last run)\" },\n },\n required: [\"id\"],\n additionalProperties: false,\n },\n risk: \"read\",\n },\n];\n", "import type { AgentRunRequest } from \"./types.js\";\nimport { isFabricThinking, normalizeThinkingBounds } from \"../thinking.js\";\nimport { aliasThinking, assertExactModelRequest, type FabricModelAliases } from \"../core/model-resolution.js\";\nimport { isFabricRunnerId } from \"./runner-registry.js\";\n\nconst stringArray = (value: unknown): string[] | undefined => {\n if (value === undefined) return undefined;\n if (!Array.isArray(value) || !value.every((entry) => typeof entry === \"string\")) {\n throw new Error(\"Agent tools must be an array of strings\");\n }\n return [...value];\n};\nconst checkedKernel = (value: unknown): AgentRunRequest[\"kernel\"] => {\n if (value === undefined || value === \"inherit\" || value === \"typescript\" || value === \"python\") return value;\n throw new Error(`Invalid Fabric agent kernel: ${String(value)}`);\n};\n\nexport const normalizeAgentRunRequest = (\n args: Record<string, unknown>,\n defaults: {runner: NonNullable<AgentRunRequest[\"runner\"]>; model?: string; timeoutMs: number; inheritedModel?: {provider: string; id: string}; models?: {aliases?: FabricModelAliases}},\n options: {allowCwd?: boolean} = {},\n): AgentRunRequest => {\n const transport =\n args.transport === \"auto\" ||\n args.transport === \"process\" ||\n args.transport === \"tmux\" ||\n args.transport === \"screen\" ||\n args.transport === \"localterm\" ||\n args.transport === \"herdr\" ||\n args.transport === \"herdr-core\"\n ? args.transport\n : undefined;\n // An explicit call or actor level always wins; otherwise an alias can carry\n // the intended effort for the model it selects (e.g. a \"cheap\" alias that is\n // both cheaper and shallower), and the global agents.thinking default applies\n // last, inside the manager.\n const requestedModel =\n typeof args.model === \"string\"\n ? args.model\n : typeof defaults.model === \"string\"\n ? defaults.model\n : undefined;\n // An exact-match request never consults aliases, so no alias level applies either.\n const thinking = isFabricThinking(args.thinking)\n ? args.thinking\n : args.modelMatch === undefined\n ? aliasThinking(defaults.models?.aliases, requestedModel ?? \"\")\n : undefined;\n const tools = stringArray(args.tools);\n const timeoutMs = typeof args.timeoutMs === \"number\" && Number.isFinite(args.timeoutMs) && args.timeoutMs > defaults.timeoutMs ? args.timeoutMs : undefined;\n if (args.runner !== undefined && !isFabricRunnerId(args.runner)) {\n throw new Error(`Invalid Fabric agent runner: ${JSON.stringify(args.runner)}`);\n }\n const runner = args.runner ?? defaults.runner;\n assertExactModelRequest({ modelMatch: args.modelMatch, runner, model: args.model });\n const inheritedModel =\n (runner === \"pi\" || runner === \"pi-durable\") && !defaults.model && defaults.inheritedModel\n ? `${defaults.inheritedModel.provider}/${defaults.inheritedModel.id}`\n : undefined;\n const kernel = checkedKernel(args.kernel);\n const thinkingBounds = args.thinkingBounds === undefined\n ? undefined\n : normalizeThinkingBounds(args.thinkingBounds, \"thinkingBounds\");\n if (args.recursive === true && args.extensions === false) {\n throw new Error(\"Recursive Fabric requires extensions enabled; omit recursive or extensions: false\");\n }\n return {\n task: String(args.task),\n runner,\n ...(kernel !== undefined ? { kernel } : {}),\n ...(typeof args.name === \"string\" ? { name: args.name } : {}),\n ...(transport ? { transport } : {}),\n ...(typeof args.model === \"string\"\n ? { model: args.model }\n : inheritedModel\n ? { model: inheritedModel }\n : {}),\n ...(args.modelMatch === \"exact\" ? { modelMatch: \"exact\" as const } : {}),\n // Shape is checked fail-closed by the manager; only a literal true holds.\n ...(args.holdQuestions !== undefined && args.holdQuestions !== false\n ? { holdQuestions: args.holdQuestions as true }\n : {}),\n ...(args.queue === true ? { queue: true as const } : {}),\n ...(typeof args.persona === \"string\" && args.persona.trim()\n ? { persona: args.persona.trim() }\n : {}),\n ...(thinking ? { thinking } : {}),\n ...(thinkingBounds ? { thinkingBounds } : {}),\n ...(tools ? { tools } : {}),\n ...(timeoutMs !== undefined ? { timeoutMs } : {}),\n ...(typeof args.extensions === \"boolean\"\n ? { extensions: args.extensions }\n : args.recursive === true ? { extensions: true } : {}),\n ...(typeof args.recursive === \"boolean\" ? { recursive: args.recursive } : {}),\n ...(options.allowCwd !== false && typeof args.cwd === \"string\" ? { cwd: args.cwd } : {}),\n ...(typeof args.worktree === \"boolean\" ? { worktree: args.worktree } : {}),\n ...(args.worktreeSetup !== undefined ? { worktreeSetup: args.worktreeSetup as string } : {}),\n // Shapes are checked fail-closed by the manager before launch.\n ...(args.readOnly !== undefined ? { readOnly: args.readOnly as boolean } : {}),\n ...(args.writableRoots !== undefined ? { writableRoots: args.writableRoots as string[] } : {}),\n ...(args.shell !== undefined ? { shell: args.shell as \"deny\" | \"unconfined\" } : {}),\n ...(args.scope !== undefined ? { scope: args.scope as NonNullable<AgentRunRequest[\"scope\"]> } : {}),\n ...(args.residency === \"session\" || args.residency === \"durable\"\n ? { residency: args.residency }\n : {}),\n ...(typeof args.persistSession === \"boolean\"\n ? { persistSession: args.persistSession }\n : {}),\n ...(typeof args.schema === \"object\" && args.schema !== null && !Array.isArray(args.schema)\n ? { schema: args.schema as Record<string, unknown> }\n : {}),\n ...(typeof args.systemPrompt === \"string\" && args.systemPrompt.trim()\n ? { systemPrompt: args.systemPrompt }\n : {}),\n };\n};\n"],
|
|
4
|
+
"sourcesContent": ["import { FABRIC_ACTOR_HOST_EVENTS } from \"../actors/types.js\";\nimport {\n MAX_COMPACTION_INSTRUCTIONS_CHARS,\n MAX_PRESERVE_ITEM_CHARS,\n MAX_PRESERVE_ITEMS,\n} from \"../compaction/instructions.js\";\nimport { FABRIC_LIFECYCLE_EVENTS } from \"../lifecycle/types.js\";\nimport type { FabricActionDescriptor } from \"../protocol.js\";\n\n// RUNNER_ID_PATTERN (src/agents/runner-registry.ts) as source text; kept in sync by a test.\nconst RUNNER_ID_SOURCE = \"^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$\";\n\nconst runProperties = {\n task: { type: \"string\", description: \"A self-contained task for the child agent\" },\n agent: {\n type: \"string\",\n minLength: 1,\n description: \"Name of an agent file (see agents.definitions()) whose instructions, model, tools, thinking and runtimes.fabric settings fill this request. Any field passed here wins over the file. An unknown name fails before the child starts.\",\n },\n name: { type: \"string\" },\n runner: {\n type: \"string\",\n pattern: RUNNER_ID_SOURCE,\n maxLength: 64,\n description: \"Execution harness: pi-durable (default), pi, claude, veda, or a runner registered through pi-fabric/runners. Defaults to agents.runner.\",\n },\n kernel: {\n type: \"string\",\n enum: [\"typescript\", \"python\", \"inherit\"],\n description: \"Fabric execution language. Omitted/inherit uses the caller executor.kernel; concrete choices require Pi with extensions enabled. Python uses the configured backend; CPython is native execution.\",\n },\n transport: {\n type: \"string\",\n enum: [\"auto\", \"process\", \"tmux\", \"screen\", \"localterm\", \"herdr\", \"herdr-core\"],\n },\n model: {\n type: \"string\",\n description:\n \"Pi provider/id copied from agents.models({ runner: \\\"pi\\\" }), a configured models.aliases name, or a search term resolved to the closest authenticated model (recency from pi-model-sort breaks ties). Reuse returned keys; never infer version numbers from agent names. Exact keys win; near-miss IDs resolve to the closest visible model on the same provider. Handles report the canonical model. Claude runtime value or Veda backend model/alias are forwarded verbatim. Set modelMatch: \\\"exact\\\" to turn off aliases and near-miss resolution.\",\n },\n modelMatch: {\n type: \"string\",\n enum: [\"exact\"],\n description:\n \"Pi runners only (pi, pi-durable). \\\"exact\\\" selects a listed provider/id without aliases, closest or fuzzy matching, or alias thinking; invalid selectors and other runners are refused before launch. Admission is strict and a child guard detects model switches and some payload rewrites. This is not a security guarantee or final-dispatch enforcement: later hooks, unknown API payloads, providers and extension-made calls can route data elsewhere; attribution checks may detect drift only after a call. Do not rely on it to prevent data disclosure. Omit for default resolution.\",\n },\n persona: {\n type: \"string\",\n description: \"Veda persona name for this run, such as frontend, reviewer, worker, or a custom persona.\",\n },\n holdQuestions: {\n type: \"boolean\",\n const: true,\n description:\n \"Hold this run's routed questions for a person. Each question becomes a root-held Fabric decision with a 30-day deadline (the longest allowed); only this run waits until it is answered (/fabric decisions, pi-fabric decisions answer, or decisions.answer from the main session). Needs agents.childQuestions \\\"route\\\" and a runner that declares questions; refused otherwise. The run's timeoutMs still applies.\",\n },\n thinking: {\n type: \"string\",\n enum: [\"off\", \"minimal\", \"low\", \"medium\", \"high\", \"xhigh\", \"max\"],\n },\n thinkingBounds: {\n type: \"object\",\n properties: {\n min: { type: \"string\", enum: [\"off\", \"minimal\", \"low\", \"medium\", \"high\", \"xhigh\", \"max\"] },\n max: { type: \"string\", enum: [\"off\", \"minimal\", \"low\", \"medium\", \"high\", \"xhigh\", \"max\"] },\n },\n additionalProperties: false,\n description: \"Optional child thinking bounds; must lie inside this session's bounds (omitted ends inherit). Child Fabric sessions never widen them. thinking outside the effective bounds is clamped and reported as requestedThinking.\",\n },\n tools: { type: \"array\", items: { type: \"string\" } },\n timeoutMs: {\n type: \"number\",\n description:\n \"Optional longer wall-clock limit in milliseconds. Omit to use agents.timeoutMs (60 minutes by default); values below the configured default are ignored.\",\n },\n extensions: { type: \"boolean\" },\n recursive: { type: \"boolean\" },\n cwd: {\n type: \"string\",\n description: \"Filesystem execution directory for leaf or recursive Pi runs; relative paths resolve from the caller cwd. Does not change project/mesh ownership or grant target project trust.\",\n },\n worktree: { type: \"boolean\" },\n worktreeSetup: {\n type: \"string\",\n maxLength: 8192,\n description: \"Shell command run in a new worktree before the child starts; overrides agents.worktree.setup. Non-zero exit fails the run.\",\n },\n seed: {\n type: \"string\",\n enum: [\"task\", \"branch\", \"snippet\"],\n description: \"Child context (Pi only). task (default): the task alone. branch: a non-blocking fork of this conversation up to its last completed turn, then the task. snippet: the last seedMessages user/assistant texts prefixed to the task.\",\n },\n seedMessages: { type: \"integer\", minimum: 1, maximum: 50, description: \"snippet only; default 12\" },\n readOnly: { type: \"boolean\", description: \"Pi only: refuse write/edit (and shell unless shell: \\\"unconfined\\\") in the child\" },\n writableRoots: {\n type: \"array\",\n items: { type: \"string\", maxLength: 4096 },\n maxItems: 32,\n description: \"Pi only: confine write/edit to these directories (relative to the child cwd; default the cwd). Shell is refused unless shell: \\\"unconfined\\\".\",\n },\n scope: {\n type: \"object\",\n properties: {\n grants: {\n type: \"array\",\n maxItems: 64,\n items: {\n type: \"object\",\n properties: {\n resource: { type: \"string\", minLength: 3, maxLength: 512 },\n actions: { type: \"array\", minItems: 1, maxItems: 3, items: { type: \"string\", enum: [\"read\", \"write\", \"execute\"] } },\n },\n required: [\"resource\", \"actions\"],\n additionalProperties: false,\n },\n },\n },\n required: [\"grants\"],\n additionalProperties: false,\n description: \"Narrow this session's host-issued scope for the child (each grant must be covered by a parent grant; resource <ns>:<path>, <ns>:<path>/*, <ns>:<path>/**, <ns>:*). Omit to inherit it; refused in an unscoped session.\",\n },\n shell: {\n type: \"string\",\n enum: [\"deny\", \"unconfined\"],\n description: \"With a write policy, bash is refused by default; unconfined allows it and is not a sandbox\",\n },\n schema: { type: \"object\", description: \"Optional JSON Schema for validated structured output\" },\n systemPrompt: {\n type: \"string\",\n description: \"Optional extra system prompt body for this child run. Fabric places it ahead of any component guidance. Pi and Claude runners append the result with --append-system-prompt, and Veda receives it as a <system_instructions> block in its prompt. Useful for reliability-focused prompt rules on models with weak behavioral defaults.\",\n },\n skills: {\n anyOf: [\n { type: \"boolean\", const: false },\n { type: \"array\", items: { type: \"string\", minLength: 1, maxLength: 128, pattern: \"^[^/\\\\\\\\]+$\" }, maxItems: 64 },\n {\n type: \"object\",\n properties: {\n preload: { type: \"array\", items: { type: \"string\", minLength: 1, maxLength: 128, pattern: \"^[^/\\\\\\\\]+$\" }, maxItems: 64 },\n inherit: { type: \"boolean\" },\n },\n additionalProperties: false,\n },\n ],\n description: \"Pi runners only: the child's skills, by name, resolved against this session's skills. false: no skills. A list: those skills preloaded in full, plus this session's other skills. { preload, inherit: false }: only the preloaded skills. Omit to keep the child's own skill discovery. An unknown name fails before launch.\",\n },\n persistSession: {\n type: \"boolean\",\n description: \"Claude runner only: persist the Claude Code transcript for hook-based observability. Defaults to false.\",\n },\n};\n\nconst runSchema = {\n type: \"object\",\n properties: runProperties,\n required: [\"task\"],\n additionalProperties: false,\n};\n\nconst residencySchema = {\n type: \"string\",\n enum: [\"session\", \"durable\"],\n description: \"session stops with the current Pi host; durable transfers execution to Fabric's hidden resident host.\",\n};\n\nconst actorBindingScopeSchema = {\n type: \"string\",\n enum: [\"session\", \"project\"],\n description: \"session (default) changes only this Pi session; project pins the shared actor default and requires ownership.\",\n};\n\nconst actorInvocationProperties = {\n id: { type: \"string\" },\n message: { type: \"string\" },\n data: {},\n model: {\n ...runProperties.model,\n description: \"Optional model pinned only for this actor activation.\",\n },\n thinking: runProperties.thinking,\n};\n\nconst spawnSchema = {\n ...runSchema,\n properties: {\n ...runProperties,\n residency: residencySchema,\n queue: {\n type: \"boolean\",\n description:\n \"Return a handle with status \\\"queued\\\" at once instead of waiting inside this call for a free agents.maxConcurrent slot. The run starts when a slot frees, even after this program ends; wait, status, list, and stop accept the id meanwhile, and stop cancels it without launching. Validation errors still reject the call. Omitted or false keeps the default: spawn waits for a slot.\",\n },\n },\n};\n\nconst handoffCompactionSchema = {\n anyOf: [\n { type: \"boolean\" },\n {\n type: \"object\",\n properties: {\n instructions: {\n type: \"string\",\n maxLength: MAX_COMPACTION_INSTRUCTIONS_CHARS,\n description: \"Custom compaction instructions for the inherited trajectory\",\n },\n preserve: {\n type: \"array\",\n items: { type: \"string\", maxLength: MAX_PRESERVE_ITEM_CHARS },\n maxItems: MAX_PRESERVE_ITEMS,\n description: \"Explicit bounded facts the trajectory summary must preserve\",\n },\n },\n additionalProperties: false,\n },\n ],\n description:\n \"Compact the inherited trajectory with Fabric's deterministic compactor before the executor resumes it. `true` applies the default summary; an object customizes instructions and bounded preserve facts. Omitted keeps the full raw trajectory.\",\n};\n\nconst handoffSchema = {\n type: \"object\",\n properties: {\n task: {\n type: \"string\",\n description: \"Optional instructions for the executor in addition to the inherited trajectory\",\n },\n name: runProperties.name,\n kernel: runProperties.kernel,\n transport: runProperties.transport,\n model: {\n ...runProperties.model,\n description: \"Explicit Pi provider/id target that will continue the inherited trajectory\",\n },\n thinking: runProperties.thinking,\n tools: runProperties.tools,\n timeoutMs: runProperties.timeoutMs,\n extensions: runProperties.extensions,\n recursive: runProperties.recursive,\n schema: runProperties.schema,\n compact: handoffCompactionSchema,\n },\n required: [\"model\"],\n additionalProperties: false,\n};\n\nconst idSchema = {\n type: \"object\",\n properties: { id: { type: \"string\" } },\n required: [\"id\"],\n additionalProperties: false,\n};\n\nconst parkResultSchema = (requested: \"sleep\" | \"wake\") => ({\n type: \"object\",\n properties: { id: { type: \"string\" }, requested: { const: requested } },\n required: [\"id\", \"requested\"],\n additionalProperties: false,\n});\n\nconst lifecycleEventSchema = {\n type: \"string\",\n enum: [...FABRIC_LIFECYCLE_EVENTS],\n};\n\nexport const AGENTS_ACTION_DESCRIPTORS: FabricActionDescriptor[] = [\n {\n name: \"run\",\n description: \"Run a child agent through Pi or Claude Code and wait for its final result\",\n inputSchema: runSchema,\n risk: \"agent\",\n },\n {\n name: \"handoff\",\n description:\n \"Schedule a Pi trajectory handoff after the current outer fabric_exec result, then wait for implementation at that boundary\",\n inputSchema: handoffSchema,\n risk: \"agent\",\n },\n {\n name: \"spawn\",\n description:\n \"Start a child agent through Pi or Claude Code and return a handle immediately. For independent launches, await Promise.allSettled and inspect every result so one rejection does not abort pending sibling calls at program exit. Unread detached results are batched at the next safe turn boundary (or wake idle Main) when agents.notifyOnComplete is enabled. wait/join and terminal status acknowledge results and retract pending notifications. Use wait when this program needs the result; do not poll status in a loop.\",\n inputSchema: spawnSchema,\n risk: \"agent\",\n },\n {\n name: \"wait\",\n description: \"Wait for a previously spawned child agent and acknowledge its result, suppressing a duplicate completion notification\",\n effect: { kind: \"emission\", ordering: \"commutative\", resources: [\"agents.completions\"] },\n inputSchema: idSchema,\n risk: \"read\",\n },\n {\n name: \"join\",\n description: \"Alias for agents.wait: wait for a previously spawned child agent with the same progress and completion-notification behavior\",\n effect: { kind: \"emission\", ordering: \"commutative\", resources: [\"agents.completions\"] },\n inputSchema: idSchema,\n risk: \"read\",\n },\n {\n name: \"status\",\n description: \"Get the latest status of any known project participant. A terminal child-agent result acknowledges its pending completion notification; running status does not.\",\n effect: { kind: \"emission\", ordering: \"commutative\", resources: [\"agents.completions\"] },\n inputSchema: idSchema,\n risk: \"read\",\n },\n {\n name: \"list\",\n description: \"List agent participants locally, across the current lineage, or across the project\",\n inputSchema: {\n type: \"object\",\n properties: { scope: { type: \"string\", enum: [\"local\", \"lineage\", \"project\"] } },\n additionalProperties: false,\n },\n risk: \"read\",\n },\n {\n name: \"members\",\n description: \"List the unified project topology of roots, agents, and actors\",\n inputSchema: {\n type: \"object\",\n properties: {\n scope: { type: \"string\", enum: [\"local\", \"lineage\", \"project\"] },\n kinds: {\n type: \"array\",\n items: { type: \"string\", enum: [\"root\", \"agent\", \"actor\"] },\n },\n includeStale: { type: \"boolean\" },\n },\n additionalProperties: false,\n },\n risk: \"read\",\n },\n {\n name: \"self\",\n description: \"Return this caller's intrinsic participant identity in the unified topology\",\n inputSchema: { type: \"object\", properties: {}, additionalProperties: false },\n risk: \"read\",\n },\n {\n name: \"main\",\n description:\n \"Return the root user-facing Main Pi agent target. The stable alias main is also accepted by agents.steer and agents.followUp.\",\n inputSchema: { type: \"object\", properties: {}, additionalProperties: false },\n risk: \"read\",\n },\n {\n name: \"sessions\",\n description: \"List all live root Pi session agents in the project, including the current lineage root and peers, with symmetric participant identities.\",\n inputSchema: { type: \"object\", properties: {}, additionalProperties: false },\n risk: \"read\",\n },\n {\n name: \"departed\",\n description: \"List root Pi sessions that are no longer live, newest first: status stopped (closed cleanly) or lost (lease expired without closing), with sessionId, cwd, label and lastSeenAt. Live sessions are never included.\",\n inputSchema: {\n type: \"object\",\n properties: { limit: { type: \"number\", minimum: 1 } },\n additionalProperties: false,\n },\n risk: \"read\",\n },\n {\n name: \"definitions\",\n description: \"List the named agent files that agents.run and agents.spawn accept in agent: name, description, path, scope (user or project), the file it shadows, and warnings for ignored fields. A file that cannot be read appears with an error.\",\n inputSchema: { type: \"object\", properties: {}, additionalProperties: false },\n risk: \"read\",\n },\n {\n name: \"peers\",\n description: \"List other live root Pi sessions sharing this project mesh. The dashboard-owning session remains Main; these targets are named peers.\",\n inputSchema: { type: \"object\", properties: {}, additionalProperties: false },\n risk: \"read\",\n },\n {\n name: \"subscribe\",\n description:\n \"Create a durable source-qualified participant lifecycle subscription. Events are delivered to Main by default or to another participant through steer/follow-up routing.\",\n inputSchema: {\n type: \"object\",\n properties: {\n from: { type: \"string\", description: \"Exact source participant id; main means this lineage root\" },\n events: { type: \"array\", minItems: 1, items: lifecycleEventSchema },\n to: { type: \"string\", description: \"Target participant id; defaults to main\" },\n delivery: { type: \"string\", enum: [\"steer\", \"followUp\"] },\n triggerTurn: { type: \"boolean\" },\n once: { type: \"boolean\" },\n },\n required: [\"from\", \"events\", \"delivery\", \"triggerTurn\"],\n additionalProperties: false,\n },\n risk: \"agent\",\n },\n {\n name: \"subscriptions\",\n description: \"List durable participant lifecycle subscriptions, optionally filtered by source or target\",\n inputSchema: {\n type: \"object\",\n properties: { from: { type: \"string\" }, to: { type: \"string\" } },\n additionalProperties: false,\n },\n risk: \"read\",\n },\n {\n name: \"unsubscribe\",\n description: \"Remove a participant lifecycle subscription\",\n inputSchema: idSchema,\n risk: \"agent\",\n },\n {\n name: \"models\",\n description:\n \"List models exposed by the selected runner. Claude models are enumerated from the installed Claude Code runtime, not hard-coded. Pass model to look up one exact key instead of reading the whole list. Veda returns an empty list: pass its backend model or alias directly as model.\",\n inputSchema: {\n type: \"object\",\n properties: {\n runner: { type: \"string\", pattern: RUNNER_ID_SOURCE, maxLength: 64 },\n refresh: { type: \"boolean\" },\n model: {\n type: \"string\",\n minLength: 1,\n maxLength: 256,\n description:\n \"Exact model key (the key field of an unfiltered entry, e.g. provider/id or claude/<value>). Returns only the entries whose key matches exactly and case-sensitively, with no alias or fuzzy resolution; an unknown key returns [].\",\n },\n },\n additionalProperties: false,\n },\n risk: \"execute\",\n },\n {\n name: \"switchModel\",\n description:\n \"Switch Main's live Pi session model in place. The model selector accepts an exact provider/id, a configured models.aliases name (alias chains try each target in order until one is authenticated), an exact model id, or a search term; inexact terms resolve to the closest match, preferring recently used models (via pi-model-sort usage, when present).\",\n inputSchema: {\n type: \"object\",\n properties: {\n model: {\n type: \"string\",\n description: \"provider/id, alias name, or search term\",\n },\n provider: { type: \"string\" },\n },\n required: [\"model\"],\n additionalProperties: false,\n },\n risk: \"agent\",\n },\n {\n name: \"stop\",\n description: \"Stop a local or remotely owned agent or actor that advertises the stop capability\",\n inputSchema: idSchema,\n risk: \"agent\",\n },\n {\n name: \"sleep\",\n description:\n \"Park an idle hosted run in this session. Only runners that declare the sleep capability accept it. The run stays running and status shows sleeping: true once the runner reports it.\",\n inputSchema: idSchema,\n outputSchema: parkResultSchema(\"sleep\"),\n risk: \"agent\",\n },\n {\n name: \"wake\",\n description: \"Resume a hosted run in this session that agents.sleep parked. Needs the runner's sleep capability.\",\n inputSchema: idSchema,\n outputSchema: parkResultSchema(\"wake\"),\n risk: \"agent\",\n },\n {\n name: \"cleanup\",\n description: \"Remove a completed agent's run files and optional Git worktree\",\n inputSchema: {\n type: \"object\",\n properties: {\n id: { type: \"string\" },\n deleteBranch: { type: \"boolean\" },\n },\n required: [\"id\"],\n additionalProperties: false,\n },\n risk: \"write\",\n },\n {\n name: \"create\",\n description:\n 'Create a persistent actor with independently selected session or project storage. A stopped live actor with the same name must be explicitly removed first. Use scope \"global\" to save a reusable project-independent template instead of a live actor.',\n inputSchema: {\n type: \"object\",\n properties: {\n name: { type: \"string\" },\n instructions: { type: \"string\" },\n events: {\n type: \"array\",\n items: {\n type: \"string\",\n enum: [...FABRIC_ACTOR_HOST_EVENTS],\n },\n },\n topics: { type: \"array\", items: { type: \"string\" } },\n delivery: {\n type: \"string\",\n enum: [\"mailbox\", \"steer\", \"followUp\", \"nextTurn\"],\n },\n responseMode: { type: \"string\", enum: [\"text\", \"directive\"] },\n triggerTurn: { type: \"boolean\" },\n coalesce: { type: \"boolean\" },\n residency: residencySchema,\n runner: runProperties.runner,\n kernel: runProperties.kernel,\n model: runProperties.model,\n thinking: runProperties.thinking,\n tools: runProperties.tools,\n transport: runProperties.transport,\n timeoutMs: runProperties.timeoutMs,\n extensions: runProperties.extensions,\n requires: {\n type: \"array\",\n maxItems: 128,\n description: \"Exact Fabric provider.action refs committed before every actor run. Object entries may be optional.\",\n items: {\n oneOf: [\n { type: \"string\", minLength: 3, maxLength: 256 },\n {\n type: \"object\",\n properties: {\n ref: { type: \"string\", minLength: 3, maxLength: 256 },\n optional: { type: \"boolean\" },\n },\n required: [\"ref\"],\n additionalProperties: false,\n },\n ],\n },\n },\n validWhile: {\n type: \"object\",\n properties: { version: { const: 1 }, source: { type: \"string\" } },\n required: [\"version\", \"source\"],\n additionalProperties: false,\n },\n scope: {\n type: \"string\",\n enum: [\"session\", \"project\", \"global\"],\n description: \"session isolates the actor to the root Pi session; project shares it across sessions; global creates a non-live template.\",\n },\n },\n required: [\"name\", \"instructions\"],\n oneOf: [\n {\n properties: {\n delivery: { const: \"mailbox\" },\n triggerTurn: { const: false },\n },\n },\n {\n properties: {\n delivery: { const: \"nextTurn\" },\n triggerTurn: { const: false },\n },\n required: [\"delivery\"],\n },\n {\n properties: { delivery: { enum: [\"steer\", \"followUp\"] } },\n required: [\"delivery\", \"triggerTurn\"],\n },\n ],\n additionalProperties: false,\n },\n risk: \"agent\",\n },\n {\n name: \"ask\",\n description: \"Send a message to a persistent actor through its live owner and wait for its next response. Optional model/thinking values apply only to this activation.\",\n inputSchema: {\n type: \"object\",\n properties: actorInvocationProperties,\n required: [\"id\", \"message\"],\n additionalProperties: false,\n },\n risk: \"agent\",\n },\n {\n name: \"tell\",\n description: \"Queue a message through a persistent actor's live owner without waiting. Optional model/thinking values apply only to this activation.\",\n inputSchema: {\n type: \"object\",\n properties: actorInvocationProperties,\n required: [\"id\", \"message\"],\n additionalProperties: false,\n },\n risk: \"agent\",\n },\n {\n name: \"steer\",\n description:\n \"Steer Main, a running one-shot agent between turns, or a persistent actor through its mailbox. The stable id alias main targets the root user-facing Pi session. Non-local targets route over the project mesh.\",\n inputSchema: {\n type: \"object\",\n properties: { id: { type: \"string\" }, message: { type: \"string\" }, data: {} },\n required: [\"id\", \"message\"],\n additionalProperties: false,\n },\n risk: \"agent\",\n },\n {\n name: \"followUp\",\n description:\n \"Queue a follow-up for a running one-shot agent, or enqueue a persistent actor mailbox message. Incoming Main feedback is delivered as hidden steering with a sender notification, even through this legacy followUp method. The stable id alias main targets the root user-facing Pi session. Non-local targets route over the project mesh.\",\n inputSchema: {\n type: \"object\",\n properties: { id: { type: \"string\" }, message: { type: \"string\" }, data: {} },\n required: [\"id\", \"message\"],\n additionalProperties: false,\n },\n risk: \"agent\",\n },\n {\n name: \"setSteeringMode\",\n description:\n \"Set how queued steer messages are delivered to a running one-shot agent: all at once after the current turn, or one per turn (default). Local agent only.\",\n inputSchema: {\n type: \"object\",\n properties: {\n id: { type: \"string\" },\n mode: { type: \"string\", enum: [\"all\", \"one-at-a-time\"] },\n },\n required: [\"id\", \"mode\"],\n additionalProperties: false,\n },\n risk: \"agent\",\n },\n {\n name: \"setFollowUpMode\",\n description:\n \"Set how queued follow-up messages are delivered to a one-shot agent: all when it finishes, or one per completion (default). Local agent only.\",\n inputSchema: {\n type: \"object\",\n properties: {\n id: { type: \"string\" },\n mode: { type: \"string\", enum: [\"all\", \"one-at-a-time\"] },\n },\n required: [\"id\", \"mode\"],\n additionalProperties: false,\n },\n risk: \"agent\",\n },\n {\n name: \"compact\",\n description:\n \"Request an advisory compaction of a running Pi-runner child agent's context at its next safe boundary (between its own turns), preserving the child's accumulated context. Rejected for Claude and Veda children and for registered runners without the compaction capability. The child pi core applies the compaction; Fabric only forwards the intent.\",\n inputSchema: {\n type: \"object\",\n properties: {\n id: { type: \"string\" },\n instructions: {\n type: \"string\",\n description: \"Optional custom compaction instructions forwarded to the child pi\",\n },\n },\n required: [\"id\"],\n additionalProperties: false,\n },\n risk: \"agent\",\n },\n {\n name: \"actorStatus\",\n description: \"Read one persistent actor's status\",\n inputSchema: idSchema,\n risk: \"read\",\n },\n {\n name: \"actors\",\n description:\n 'List persistent actors. Default scope \"project\" lists live actors in this Fabric session; scope \"global\" lists project-independent templates in the global registry.',\n inputSchema: {\n type: \"object\",\n properties: { scope: { type: \"string\", enum: [\"project\", \"global\"] } },\n additionalProperties: false,\n },\n risk: \"read\",\n },\n {\n name: \"messages\",\n description: \"Read a persistent actor's bounded inbox and outbox history\",\n inputSchema: {\n type: \"object\",\n properties: { id: { type: \"string\" }, limit: { type: \"number\", minimum: 1 } },\n required: [\"id\"],\n additionalProperties: false,\n },\n risk: \"read\",\n },\n {\n name: \"setModel\",\n description:\n \"Change or clear a persistent actor model binding. Session scope is the default; project scope explicitly pins the shared definition default.\",\n inputSchema: {\n type: \"object\",\n properties: {\n id: { type: \"string\" },\n model: { type: \"string\" },\n scope: actorBindingScopeSchema,\n },\n required: [\"id\"],\n additionalProperties: false,\n },\n risk: \"agent\",\n },\n {\n name: \"setThinking\",\n description:\n \"Change or clear a persistent actor reasoning-effort binding. Session scope is the default; project scope explicitly pins the shared definition default.\",\n inputSchema: {\n type: \"object\",\n properties: {\n id: { type: \"string\" },\n thinking: runProperties.thinking,\n scope: actorBindingScopeSchema,\n },\n required: [\"id\"],\n additionalProperties: false,\n },\n risk: \"agent\",\n },\n {\n name: \"setTools\",\n description:\n \"Replace a persistent actor's tool allowlist. Takes effect on its next queued message; an empty list disables optional tools.\",\n inputSchema: {\n type: \"object\",\n properties: {\n id: { type: \"string\" },\n tools: runProperties.tools,\n scope: { type: \"string\", enum: [\"project\", \"global\"] },\n },\n required: [\"id\", \"tools\"],\n additionalProperties: false,\n },\n risk: \"agent\",\n },\n {\n name: \"setEvents\",\n description: \"Replace a persistent actor's session-bound Pi and synthetic tool_error event subscriptions\",\n inputSchema: {\n type: \"object\",\n properties: {\n id: { type: \"string\" },\n events: {\n type: \"array\",\n items: {\n type: \"string\",\n enum: [...FABRIC_ACTOR_HOST_EVENTS],\n },\n },\n },\n required: [\"id\", \"events\"],\n additionalProperties: false,\n },\n risk: \"agent\",\n },\n {\n name: \"setDeliveryPolicy\",\n description:\n \"Replace a project actor or global template delivery policy. steer/followUp require an explicit triggerTurn choice; mailbox/nextTurn require false.\",\n inputSchema: {\n type: \"object\",\n properties: {\n id: { type: \"string\" },\n delivery: {\n type: \"string\",\n enum: [\"mailbox\", \"steer\", \"followUp\", \"nextTurn\"],\n },\n triggerTurn: { type: \"boolean\" },\n scope: { type: \"string\", enum: [\"project\", \"global\"] },\n },\n required: [\"id\", \"delivery\", \"triggerTurn\"],\n additionalProperties: false,\n },\n risk: \"agent\",\n },\n {\n name: \"clearMessages\",\n description: \"Clear a persistent actor's recorded message history\",\n inputSchema: idSchema,\n risk: \"write\",\n },\n {\n name: \"remove\",\n description:\n 'Stop and remove a persistent actor. Default scope \"project\" removes a live project actor; scope \"global\" removes a project-independent template from the global registry.',\n inputSchema: {\n type: \"object\",\n properties: {\n id: { type: \"string\" },\n scope: { type: \"string\", enum: [\"project\", \"global\"] },\n },\n required: [\"id\"],\n additionalProperties: false,\n },\n risk: \"agent\",\n },\n {\n name: \"setInstructions\",\n description:\n 'Replace an actor\\'s default instruction (its persona / system-prompt body). Default scope \"project\" edits a live project actor; scope \"global\" edits a project-independent template. Takes effect on the actor\\'s next queued message.',\n inputSchema: {\n type: \"object\",\n properties: {\n id: { type: \"string\" },\n instructions: { type: \"string\" },\n scope: { type: \"string\", enum: [\"project\", \"global\"] },\n },\n required: [\"id\", \"instructions\"],\n additionalProperties: false,\n },\n risk: \"agent\",\n },\n {\n name: \"import\",\n description:\n \"Import a project-independent template from the global registry into the current project as a fresh live actor with no inherited history (no messages, session, or run logs). Identify the template by id or name; optionally rename the imported actor with \\\"as\\\" to avoid colliding with a live actor.\",\n inputSchema: {\n type: \"object\",\n properties: {\n id: { type: \"string\", description: \"Template id or name (one of id/name required)\" },\n name: { type: \"string\", description: \"Template name (one of id/name required)\" },\n as: { type: \"string\", description: \"Optional new name for the imported live actor\" },\n },\n additionalProperties: false,\n },\n risk: \"agent\",\n },\n {\n name: \"export\",\n description:\n \"Export a live project actor's definition to the global registry as a project-independent template, without any history (no messages, session, or run logs). Throws on a name collision unless overwrite is true.\",\n inputSchema: {\n type: \"object\",\n properties: {\n id: { type: \"string\" },\n overwrite: { type: \"boolean\" },\n },\n required: [\"id\"],\n additionalProperties: false,\n },\n risk: \"write\",\n },\n {\n name: \"log\",\n description:\n \"Read an actor or agent run's LLM/agent log: the actor's session transcript (session.jsonl) and/or a retained run's event stream (events.jsonl: tool calls, model responses, usage). Actors retain their last runs so logs survive after success.\",\n inputSchema: {\n type: \"object\",\n properties: {\n id: { type: \"string\", description: \"Actor ID/name or agent run ID\" },\n type: {\n type: \"string\",\n enum: [\"session\", \"run\", \"all\"],\n description:\n \"session = actor session transcript (default for actors); run = last retained run's events; all = both\",\n },\n lines: { type: \"number\", minimum: 1, description: \"Page line limit (default 200)\" },\n before: {\n type: \"number\",\n minimum: 0,\n description: \"Exclusive line cursor returned by a previous page to load older entries\",\n },\n runId: { type: \"string\", description: \"Specific retained run (default: actor's last run)\" },\n },\n required: [\"id\"],\n additionalProperties: false,\n },\n risk: \"read\",\n },\n];\n", "import type { AgentRunRequest } from \"./types.js\";\nimport { isFabricThinking, normalizeThinkingBounds } from \"../thinking.js\";\nimport { aliasThinking, assertExactModelRequest, type FabricModelAliases } from \"../core/model-resolution.js\";\nimport { isFabricRunnerId } from \"./runner-registry.js\";\n\nconst stringArray = (value: unknown): string[] | undefined => {\n if (value === undefined) return undefined;\n if (!Array.isArray(value) || !value.every((entry) => typeof entry === \"string\")) {\n throw new Error(\"Agent tools must be an array of strings\");\n }\n return [...value];\n};\nconst checkedKernel = (value: unknown): AgentRunRequest[\"kernel\"] => {\n if (value === undefined || value === \"inherit\" || value === \"typescript\" || value === \"python\") return value;\n throw new Error(`Invalid Fabric agent kernel: ${String(value)}`);\n};\n\nexport const normalizeAgentRunRequest = (\n args: Record<string, unknown>,\n defaults: {runner: NonNullable<AgentRunRequest[\"runner\"]>; model?: string; timeoutMs: number; inheritedModel?: {provider: string; id: string}; models?: {aliases?: FabricModelAliases}},\n options: {allowCwd?: boolean} = {},\n): AgentRunRequest => {\n const transport =\n args.transport === \"auto\" ||\n args.transport === \"process\" ||\n args.transport === \"tmux\" ||\n args.transport === \"screen\" ||\n args.transport === \"localterm\" ||\n args.transport === \"herdr\" ||\n args.transport === \"herdr-core\"\n ? args.transport\n : undefined;\n // An explicit call or actor level always wins; otherwise an alias can carry\n // the intended effort for the model it selects (e.g. a \"cheap\" alias that is\n // both cheaper and shallower), and the global agents.thinking default applies\n // last, inside the manager.\n const requestedModel =\n typeof args.model === \"string\"\n ? args.model\n : typeof defaults.model === \"string\"\n ? defaults.model\n : undefined;\n // An exact-match request never consults aliases, so no alias level applies either.\n const thinking = isFabricThinking(args.thinking)\n ? args.thinking\n : args.modelMatch === undefined\n ? aliasThinking(defaults.models?.aliases, requestedModel ?? \"\")\n : undefined;\n const tools = stringArray(args.tools);\n const timeoutMs = typeof args.timeoutMs === \"number\" && Number.isFinite(args.timeoutMs) && args.timeoutMs > defaults.timeoutMs ? args.timeoutMs : undefined;\n if (args.runner !== undefined && !isFabricRunnerId(args.runner)) {\n throw new Error(`Invalid Fabric agent runner: ${JSON.stringify(args.runner)}`);\n }\n const runner = args.runner ?? defaults.runner;\n assertExactModelRequest({ modelMatch: args.modelMatch, runner, model: args.model });\n const inheritedModel =\n (runner === \"pi\" || runner === \"pi-durable\") && !defaults.model && defaults.inheritedModel\n ? `${defaults.inheritedModel.provider}/${defaults.inheritedModel.id}`\n : undefined;\n const kernel = checkedKernel(args.kernel);\n const thinkingBounds = args.thinkingBounds === undefined\n ? undefined\n : normalizeThinkingBounds(args.thinkingBounds, \"thinkingBounds\");\n if (args.recursive === true && args.extensions === false) {\n throw new Error(\"Recursive Fabric requires extensions enabled; omit recursive or extensions: false\");\n }\n return {\n task: String(args.task),\n runner,\n ...(kernel !== undefined ? { kernel } : {}),\n ...(typeof args.name === \"string\" ? { name: args.name } : {}),\n ...(transport ? { transport } : {}),\n ...(typeof args.model === \"string\"\n ? { model: args.model }\n : inheritedModel\n ? { model: inheritedModel }\n : {}),\n ...(args.modelMatch === \"exact\" ? { modelMatch: \"exact\" as const } : {}),\n // Shape is checked fail-closed by the manager; only a literal true holds.\n ...(args.holdQuestions !== undefined && args.holdQuestions !== false\n ? { holdQuestions: args.holdQuestions as true }\n : {}),\n ...(args.queue === true ? { queue: true as const } : {}),\n ...(typeof args.persona === \"string\" && args.persona.trim()\n ? { persona: args.persona.trim() }\n : {}),\n ...(thinking ? { thinking } : {}),\n ...(thinkingBounds ? { thinkingBounds } : {}),\n ...(tools ? { tools } : {}),\n ...(timeoutMs !== undefined ? { timeoutMs } : {}),\n ...(typeof args.extensions === \"boolean\"\n ? { extensions: args.extensions }\n : args.recursive === true ? { extensions: true } : {}),\n ...(typeof args.recursive === \"boolean\" ? { recursive: args.recursive } : {}),\n ...(options.allowCwd !== false && typeof args.cwd === \"string\" ? { cwd: args.cwd } : {}),\n ...(typeof args.worktree === \"boolean\" ? { worktree: args.worktree } : {}),\n ...(args.worktreeSetup !== undefined ? { worktreeSetup: args.worktreeSetup as string } : {}),\n // Shapes are checked fail-closed by the manager before launch.\n ...(args.readOnly !== undefined ? { readOnly: args.readOnly as boolean } : {}),\n ...(args.writableRoots !== undefined ? { writableRoots: args.writableRoots as string[] } : {}),\n ...(args.shell !== undefined ? { shell: args.shell as \"deny\" | \"unconfined\" } : {}),\n ...(args.scope !== undefined ? { scope: args.scope as NonNullable<AgentRunRequest[\"scope\"]> } : {}),\n ...(args.residency === \"session\" || args.residency === \"durable\"\n ? { residency: args.residency }\n : {}),\n ...(typeof args.persistSession === \"boolean\"\n ? { persistSession: args.persistSession }\n : {}),\n ...(typeof args.schema === \"object\" && args.schema !== null && !Array.isArray(args.schema)\n ? { schema: args.schema as Record<string, unknown> }\n : {}),\n ...(typeof args.systemPrompt === \"string\" && args.systemPrompt.trim()\n ? { systemPrompt: args.systemPrompt }\n : {}),\n };\n};\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAUA,IAAM,mBAAmB;AAEzB,IAAM,gBAAgB;AAAA,EACpB,MAAM,EAAE,MAAM,UAAU,aAAa,4CAA4C;AAAA,EACjF,OAAO;AAAA,IACL,MAAM;AAAA,IACN,WAA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,KAAK,WAAW,QAAQ,CAAC,MAAM,QAAQ,KAAK,MAAM,IACrF,EAAE,QAAQ,KAAK,OAAkC,IACjD,CAAC;AAAA,IACL,GAAI,OAAO,KAAK,iBAAiB,YAAY,KAAK,aAAa,KAAK,IAChE,EAAE,cAAc,KAAK,aAAa,IAClC,CAAC;AAAA,EACP;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -219,7 +219,7 @@ var ResidentHost = class {
|
|
|
219
219
|
void this.#queueDelivery(
|
|
220
220
|
{ id: result.id, name: result.name, kind: "agent" },
|
|
221
221
|
`Fabric agent ${result.id.slice(0, 8)} ${result.status} after ${Math.round(durationMs / 1e3)}s: ${summary}`,
|
|
222
|
-
"
|
|
222
|
+
"steer",
|
|
223
223
|
true,
|
|
224
224
|
result,
|
|
225
225
|
result.id
|
|
@@ -840,4 +840,4 @@ export {
|
|
|
840
840
|
residentIdleDecision,
|
|
841
841
|
runResidentHostFromConfigPath
|
|
842
842
|
};
|
|
843
|
-
//# sourceMappingURL=chunk-
|
|
843
|
+
//# sourceMappingURL=chunk-U6Y6TKJL.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/residency/host.ts"],
|
|
4
|
-
"sourcesContent": ["#!/usr/bin/env node\n\nimport { randomUUID } from \"node:crypto\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { fileURLToPath, pathToFileURL } from \"node:url\";\nimport {\n writeJsonAtomic,\n ownerHeartbeatFields,\n recordOwnerLiveness,\n startOwnerHeartbeat,\n} from \"../core/atomic-write.js\";\nimport {\n normalizeModelAliases,\n resolvePiModelSelector,\n type FabricModelCandidate,\n type FabricModelMatch,\n} from \"../core/model-resolution.js\";\nimport { loadModelUsage } from \"../core/model-usage.js\";\nimport {\n parseFabricOwnedModelGuidance,\n resolveFabricModelGuidance,\n} from \"../components/model-guidance.js\";\nimport { ActorDirectory } from \"../actors/directory.js\";\nimport type { FabricActorInfo } from \"../actors/types.js\";\nimport { AgentManager } from \"../agents/manager.js\";\nimport { cancelOrphanedChildQuestions, routeChildQuestion } from \"../decisions/host.js\";\nimport { DecisionStore } from \"../decisions/store.js\";\nimport { launchScope } from \"../scope.js\";\nimport { useBudgetLedger } from \"../agents/budget-ledger.js\";\nimport { LifecycleBroker } from \"../lifecycle/broker.js\";\nimport { lifecycleSourceIdentity, type FabricLifecycleEvent, type FabricLifecycleSubscription } from \"../lifecycle/types.js\";\nimport { MeshStore, type MeshIdentity } from \"../mesh/store.js\";\nimport { FabricControlPlane, type FabricControlAcceptance, type FabricControlCommand } from \"../topology/control-plane.js\";\nimport { ParticipantDirectory } from \"../topology/participant-directory.js\";\nimport { actorParticipantRecord, agentParticipantRecords } from \"../topology/records.js\";\nimport {\n RESIDENT_HOST_FORMAT,\n residentDeliveryPrefix,\n residentHostId,\n type ResidentAgentMetadata,\n type ResidentCommand,\n type ResidentCommandResponse,\n type ResidentDeliveryRecord,\n type ResidentHostConfig,\n type ResidentHostOwner,\n} from \"./protocol.js\";\n\nconst REQUEST_POLL_MS = 50;\nconst IDLE_EXIT_MS = 30_000;\nconst COMPLETION_MAX_CHARS = 8_000;\n\nconst delay = (ms: number): Promise<void> =>\n new Promise((resolve) => setTimeout(resolve, ms));\n\nconst atomicWrite = (filePath: string, value: unknown): void => {\n writeJsonAtomic(filePath, value, { space: 2 });\n};\n\nconst readJson = <T>(filePath: string): T | undefined => {\n try {\n return JSON.parse(fs.readFileSync(filePath, \"utf8\")) as T;\n } catch {\n return undefined;\n }\n};\n\nconst errorMessage = (error: unknown): string =>\n error instanceof Error ? error.message : String(error);\n\nconst processAlive = (pid: number): boolean => {\n if (!Number.isSafeInteger(pid) || pid <= 0) return false;\n try {\n process.kill(pid, 0);\n return true;\n } catch (error) {\n // On Windows, EPERM means the process exists but cannot be opened for\n // signaling; only ESRCH (or other errors) mean it is gone.\n return error instanceof Error && \"code\" in error && (error as NodeJS.ErrnoException).code === \"EPERM\";\n }\n};\n\n// Identity-less (pre-heartbeat) owners keep the plain signal probe; an owner\n// in another PID namespace is judged by its heartbeat, and \"unknown\" is not death.\nconst ownerAlive = (record: unknown): boolean =>\n recordOwnerLiveness(record, { legacyAlive: processAlive }) !== \"dead\";\n\n// The resident host runs Pi with --no-extensions, so a custom runner is only\n// registered here when its residentModule is imported (once per process).\nconst runnerModules = new Map<string, Promise<void>>();\nconst loadRunnerModule = (specifier: string): Promise<void> => {\n if (!/^(?:\\/|[A-Za-z]:[\\\\/]|file:)/.test(specifier)) {\n return Promise.reject(new Error(`Fabric runner module must be absolute: ${specifier}`));\n }\n const url = specifier.startsWith(\"file:\") ? specifier : pathToFileURL(specifier).href;\n let pending = runnerModules.get(url);\n if (!pending) {\n pending = import(url).then(() => undefined);\n runnerModules.set(url, pending);\n pending.catch(() => runnerModules.delete(url));\n }\n return pending;\n};\n\nclass ResidentHostAlreadyRunning extends Error {}\n\nconst parseResidentHostConfigPath = (argv: readonly string[]): string => {\n const index = argv.indexOf(\"--config\");\n const value = index >= 0 ? argv[index + 1] : undefined;\n if (!value) throw new Error(\"Missing resident host argument: --config\");\n return path.resolve(value);\n};\n\nconst validateResidentHostConfig = (value: unknown, configPath: string): ResidentHostConfig => {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n throw new Error(\"Invalid Fabric resident host config\");\n }\n const config = value as Partial<ResidentHostConfig>;\n if (\n config.format !== RESIDENT_HOST_FORMAT ||\n typeof config.rootId !== \"string\" ||\n typeof config.sessionId !== \"string\" ||\n typeof config.cwd !== \"string\" ||\n typeof config.projectRoot !== \"string\" ||\n typeof config.meshRoot !== \"string\" ||\n typeof config.actorRoot !== \"string\" ||\n (config.sessionActorRoot !== undefined && typeof config.sessionActorRoot !== \"string\") ||\n typeof config.residencyRoot !== \"string\" ||\n typeof config.fullCodeMode !== \"boolean\" ||\n (config.kernel !== undefined && config.kernel !== \"typescript\" && config.kernel !== \"python\") ||\n (config.pythonRuntime !== undefined && config.pythonRuntime !== \"cpython\" && config.pythonRuntime !== \"monty\") ||\n typeof config.agents !== \"object\" ||\n config.agents === null ||\n typeof config.mesh !== \"object\" ||\n config.mesh === null ||\n typeof config.retention !== \"object\" ||\n config.retention === null ||\n typeof config.workerPath !== \"string\" ||\n typeof config.fabricExtensionPath !== \"string\" ||\n typeof config.piBinary !== \"string\" ||\n typeof config.claudeBinary !== \"string\" ||\n typeof config.vedaBinary !== \"string\"\n ) {\n throw new Error(\"Fabric resident host config is incomplete\");\n }\n if (path.resolve(config.residencyRoot) !== path.dirname(configPath)) {\n throw new Error(\"Fabric resident host config is outside its residency root\");\n }\n if (!config.mesh.enabled) throw new Error(\"Durable residency requires the Fabric mesh\");\n return config as ResidentHostConfig;\n};\n\n/**\n * The resident host's idle rule. Live durable participants, queued work or a\n * pending request keep it alive; pending mesh schedules do too while at least\n * one durable participant could receive them, and `wakeAt` names the next due\n * time so the host releases it on time. Without durable participants a\n * schedule waits for the next Fabric process that touches the mesh.\n */\nexport const residentIdleDecision = (input: {\n now: number;\n idleSince: number;\n activeActor: boolean;\n activeAgent: boolean;\n pendingRequest: boolean;\n durableParticipants: boolean;\n nextScheduleDueAt: number | undefined;\n idleExitMs?: number;\n}): { busy: boolean; exit: boolean; wakeAt?: number } => {\n const holdsSchedules = input.nextScheduleDueAt !== undefined && input.durableParticipants;\n const wakeAt = holdsSchedules ? input.nextScheduleDueAt : undefined;\n const busy = input.activeActor || input.activeAgent || input.pendingRequest || holdsSchedules;\n const exit = !busy && input.now - input.idleSince >= (input.idleExitMs ?? IDLE_EXIT_MS);\n return { busy, exit, ...(wakeAt !== undefined ? { wakeAt } : {}) };\n};\n\nclass ResidentHost {\n readonly hostId: string;\n readonly identity: MeshIdentity;\n readonly mesh: MeshStore;\n readonly participants: ParticipantDirectory;\n readonly control: FabricControlPlane;\n readonly agents: AgentManager;\n readonly actors: ActorDirectory;\n readonly lifecycle: LifecycleBroker;\n readonly #decisions: DecisionStore;\n readonly #ownerPath: string;\n readonly #lockPath: string;\n readonly #errorPath: string;\n readonly #requestsPath: string;\n readonly #processingPath: string;\n readonly #responsesPath: string;\n readonly #agentsPath: string;\n readonly #deliveryPrefix: string;\n readonly #token = randomUUID();\n #requestTimer: NodeJS.Timeout | undefined;\n #scheduleTimer: NodeJS.Timeout | undefined;\n #scheduleWakeAt: number | undefined;\n #stopHeartbeat: (() => void) | undefined;\n #pollingRequests = false;\n #closed = false;\n #started = false;\n #idleSince = Date.now();\n\n constructor(\n readonly config: ResidentHostConfig,\n readonly onIdle: () => void = () => {},\n ) {\n this.hostId = residentHostId(config.rootId);\n this.identity = { id: this.hostId, name: \"Fabric resident host\", kind: \"agent\" };\n this.#ownerPath = path.join(config.residencyRoot, \"owner.json\");\n this.#lockPath = path.join(config.residencyRoot, \"host.lock\");\n this.#errorPath = path.join(config.residencyRoot, \"error.json\");\n this.#requestsPath = path.join(config.residencyRoot, \"requests\");\n this.#processingPath = path.join(config.residencyRoot, \"processing\");\n this.#responsesPath = path.join(config.residencyRoot, \"responses\");\n this.#agentsPath = path.join(config.residencyRoot, \"agents\");\n this.#deliveryPrefix = residentDeliveryPrefix(config.rootId);\n this.mesh = new MeshStore(config.meshRoot, config.mesh.maxEventBytes, config.mesh.maxReadEvents, {\n durability: config.mesh.durability,\n });\n this.control = new FabricControlPlane(this.mesh, this.identity, {\n enabled: true,\n hostId: this.hostId,\n pollMs: config.mesh.actorPollMs,\n });\n this.participants = new ParticipantDirectory(this.mesh, {\n enabled: true,\n hostId: this.hostId,\n rootId: config.rootId,\n identity: this.identity,\n ownerIncarnation: this.control.incarnation,\n });\n if (config.agents.budgetUsd > 0) {\n const budgetFile = path.join(config.residencyRoot, \"budget.jsonl\");\n fs.mkdirSync(path.dirname(budgetFile), { recursive: true, mode: 0o700 });\n if (!fs.existsSync(budgetFile)) fs.writeFileSync(budgetFile, \"\", { mode: 0o600 });\n useBudgetLedger({\n budget: config.agents.budgetUsd,\n file: budgetFile,\n id: this.hostId,\n });\n }\n const guidanceConfigPath = path.join(config.residencyRoot, \"config.json\");\n const currentConfig = (): Partial<ResidentHostConfig> =>\n readJson<Partial<ResidentHostConfig>>(guidanceConfigPath) ?? config;\n const currentModelGuidance = () =>\n parseFabricOwnedModelGuidance(currentConfig().modelGuidance ?? config.modelGuidance);\n const resolveResidentPiModel = (selector?: string, modelMatch?: FabricModelMatch): string => {\n const state = currentConfig().piModels ?? config.piModels;\n const available: FabricModelCandidate[] = Array.isArray(state?.available)\n ? state.available.flatMap((candidate) =>\n typeof candidate?.provider === \"string\" && typeof candidate.id === \"string\"\n ? [{\n provider: candidate.provider,\n id: candidate.id,\n ...(typeof candidate.name === \"string\" ? { name: candidate.name } : {}),\n }]\n : [],\n )\n : [];\n const query = selector?.trim() || state?.defaultModel?.trim() || \"\";\n const resolved = resolvePiModelSelector(query, {\n aliases: normalizeModelAliases(state?.aliases),\n available,\n lastUsed: loadModelUsage(),\n }, modelMatch);\n return `${resolved.provider}/${resolved.id}`;\n };\n // agents.childQuestions \"route\": this host has no UI, so a durable child's\n // dialog always becomes a root-held decision in the project mesh, answered\n // by a root session or the decisions CLI. The run's settlement cancels it, and\n // so does detaching a durable hosted run at shutdown (see #startOwned for a\n // host that died instead).\n this.#decisions = new DecisionStore(this.mesh, {\n id: this.identity.id,\n name: this.identity.name,\n kind: this.identity.kind,\n sessionId: config.sessionId,\n });\n this.agents = new AgentManager(config.cwd, config.agents, {\n workerPath: config.workerPath,\n fabricExtensionPath: config.fabricExtensionPath,\n piBinary: config.piBinary,\n claudeBinary: config.claudeBinary,\n vedaBinary: config.vedaBinary,\n runRoot: path.join(config.residencyRoot, \"runs\"),\n fullCodeMode: config.fullCodeMode,\n kernel: () => currentConfig().kernel ?? config.kernel ?? \"typescript\",\n pythonRuntime: () => currentConfig().pythonRuntime ?? config.pythonRuntime ?? \"monty\",\n mainAgentId: config.rootId,\n fabricSessionId: config.sessionId,\n meshRoot: config.meshRoot,\n projectRoot: config.projectRoot,\n hostId: this.hostId,\n identityId: this.identity.id,\n retention: config.retention,\n preparePiModel: async (model, options) => resolveResidentPiModel(model, options?.modelMatch),\n resolveParticipantGuidance: ({ model }) => {\n if (!model) return undefined;\n return resolveFabricModelGuidance(currentModelGuidance(), {\n model,\n target: \"participant\",\n includeSlots: false,\n }).appendText || undefined;\n },\n onLifecycle: (event) => void this.lifecycle?.publish(event).catch(() => undefined),\n onChildQuestion: (request) => routeChildQuestion(request, { store: this.#decisions }),\n onBackgroundComplete: (result) => {\n if (!config.agents.notifyOnComplete) return;\n const durationMs = Math.max(0, (result.finishedAt ?? Date.now()) - result.startedAt);\n const summary = (result.text || result.error || \"no result\").slice(0, COMPLETION_MAX_CHARS);\n void this.#queueDelivery(\n { id: result.id, name: result.name, kind: \"agent\" },\n `Fabric agent ${result.id.slice(0, 8)} ${result.status} after ${Math.round(durationMs / 1_000)}s: ${summary}`,\n \"followUp\",\n true,\n result,\n result.id,\n ).catch(() => undefined);\n },\n });\n const canManageActor = (id: string): boolean | undefined => {\n const participant = this.participants.get(id);\n return participant ? participant.ownerHostId === this.hostId : undefined;\n };\n const lineageAlive = (rootId: string): boolean =>\n this.participants.get(rootId) !== undefined;\n const actorRoots = config.sessionActorRoot\n ? { project: config.actorRoot, session: config.sessionActorRoot }\n : config.mesh.actorScope === \"session\"\n ? { project: path.dirname(config.actorRoot), session: config.actorRoot }\n : { project: config.actorRoot, session: path.join(config.actorRoot, config.sessionId) };\n this.actors = new ActorDirectory([\n config.sessionId,\n this.identity,\n this.mesh,\n config.mesh,\n this.agents,\n ({ actor, message, delivery, triggerTurn }) => {\n if (!message.text) return;\n const mode = delivery === \"steer\" ? \"steer\" : \"followUp\";\n const triggers = delivery === \"nextTurn\" ? false : triggerTurn;\n void this.#queueDelivery(\n { id: actor.id, name: actor.name, kind: \"actor\" },\n message.text,\n mode,\n triggers,\n message.data,\n ).catch(() => undefined);\n },\n {\n persistent: true,\n canManageActor,\n lineageAlive,\n claimResidency: \"durable\",\n rootId: config.rootId,\n meshCursorPath: path.join(config.residencyRoot, \"actor-mesh-cursor.json\"),\n retention: config.retention,\n resolvePiModel: resolveResidentPiModel,\n },\n ], actorRoots, config.mesh.actorScope);\n this.lifecycle = new LifecycleBroker(\n this.mesh,\n this.identity,\n this.participants,\n {\n enabled: true,\n pollMs: config.mesh.actorPollMs,\n maxReadEvents: config.mesh.maxReadEvents,\n },\n (subscription, event) => this.#deliverLifecycle(subscription, event),\n );\n }\n\n async start(): Promise<void> {\n if (this.#started) return;\n this.#acquireLock();\n this.#started = true;\n this.#stopHeartbeat = startOwnerHeartbeat((heartbeatAt) => this.#refreshHeartbeat(heartbeatAt));\n try {\n await this.#startOwned();\n } catch (error) {\n this.#stopHeartbeat();\n this.#stopHeartbeat = undefined;\n throw error;\n }\n }\n\n async #startOwned(): Promise<void> {\n fs.mkdirSync(this.#requestsPath, { recursive: true, mode: 0o700 });\n fs.mkdirSync(this.#processingPath, { recursive: true, mode: 0o700 });\n fs.mkdirSync(this.#responsesPath, { recursive: true, mode: 0o700 });\n fs.mkdirSync(this.#agentsPath, { recursive: true, mode: 0o700 });\n this.#recoverInterruptedRequests();\n // An earlier host that died left its routed questions open, and their answers\n // would reach nothing. Cancel them before re-attaching runs, whose runners ask\n // again through this host. A failure must not stop startup, but it leaves those\n // decisions open, so report it on stderr; the launcher keeps it in child-stderr.log.\n await cancelOrphanedChildQuestions(this.#decisions).catch((error: unknown) => {\n process.stderr.write(\n `[pi-fabric] resident host ${this.hostId} could not cancel orphaned child questions at startup: ${errorMessage(error)}\\n`,\n );\n return [];\n });\n await this.#recoverHostedRuns();\n const firstSeenAgents = new Map<string, number>();\n this.participants.registerSource(() =>\n agentParticipantRecords(\n this.agents.listForUi(),\n this.config.rootId,\n this.hostId,\n this.identity.id,\n this.config.rootId,\n firstSeenAgents,\n ),\n );\n this.participants.registerSource(() =>\n this.actors.listOwned().map((actor) =>\n actorParticipantRecord(\n actor,\n this.config.rootId,\n this.hostId,\n this.identity.id,\n this.config.rootId,\n ),\n ),\n );\n this.agents.subscribeUi(() => this.participants.scheduleRefresh());\n this.actors.subscribe(() => this.participants.scheduleRefresh());\n this.control.start((command, from, signal) =>\n this.#acceptControl(command, from, signal));\n await this.participants.start().catch(() => undefined);\n this.lifecycle.start();\n this.#requestTimer = setInterval(\n () => void this.#pollRequests().catch(() => undefined),\n REQUEST_POLL_MS,\n );\n const now = Date.now();\n const owner: ResidentHostOwner = {\n format: RESIDENT_HOST_FORMAT,\n hostId: this.hostId,\n pid: process.pid,\n token: this.#token,\n startedAt: now,\n readyAt: now,\n ...ownerHeartbeatFields(now),\n };\n atomicWrite(this.#ownerPath, owner);\n fs.rmSync(this.#errorPath, { force: true });\n await this.#pollRequests();\n }\n\n async close(): Promise<void> {\n if (this.#closed) return;\n this.#closed = true;\n if (this.#requestTimer) clearInterval(this.#requestTimer);\n this.#requestTimer = undefined;\n if (this.#scheduleTimer) clearTimeout(this.#scheduleTimer);\n this.#scheduleTimer = undefined;\n this.#stopHeartbeat?.();\n this.#stopHeartbeat = undefined;\n while (this.#pollingRequests) await delay(10);\n await this.participants.quiesce().catch(() => undefined);\n await this.lifecycle.close().catch(() => undefined);\n await this.control.close().catch(() => undefined);\n try {\n await this.actors.close();\n } finally {\n await this.agents.close();\n await this.participants.close().catch(() => undefined);\n this.#releaseLock();\n }\n }\n\n async #acceptControl(\n command: FabricControlCommand,\n _from: MeshIdentity,\n signal?: AbortSignal,\n ): Promise<FabricControlAcceptance> {\n if (command.operation === \"cancel\") {\n return { accepted: false, error: \"Cancel commands are handled by the control plane\" };\n }\n if (command.operation === \"stop\") {\n try {\n await this.agents.stop(command.targetId);\n this.participants.scheduleRefresh();\n return { accepted: true, messageId: command.commandId };\n } catch (error) {\n if (!(error instanceof Error && /Unknown Fabric agent/.test(error.message))) {\n return { accepted: false, error: errorMessage(error) };\n }\n }\n try {\n if (!this.actors.owns(command.targetId)) {\n return { accepted: false, error: `Resident host does not own ${command.targetId}` };\n }\n await this.actors.stop(command.targetId);\n this.participants.scheduleRefresh();\n return { accepted: true, messageId: command.commandId };\n } catch (error) {\n return { accepted: false, error: errorMessage(error) };\n }\n }\n const message = command.message?.trim();\n if (!message) return { accepted: false, error: \"Fabric control message must not be empty\" };\n if (command.operation === \"ask\") {\n try {\n if (!this.actors.owns(command.targetId)) {\n return { accepted: false, error: `Resident host does not own ${command.targetId}` };\n }\n const result = await this.actors.ask(\n command.targetId,\n message,\n command.data,\n signal,\n { ...(command.binding !== undefined ? { binding: command.binding } : {}), sender: command.sender ?? null },\n );\n return { accepted: true, messageId: result.id, result };\n } catch (error) {\n return { accepted: false, error: errorMessage(error) };\n }\n }\n try {\n this.agents.status(command.targetId);\n const result = command.operation === \"steer\"\n ? this.agents.steer(command.targetId, message, command.data)\n : this.agents.followUp(command.targetId, message, command.data);\n return { accepted: true, messageId: result.messageId };\n } catch (error) {\n if (!(error instanceof Error && /Unknown Fabric agent/.test(error.message))) {\n return { accepted: false, error: errorMessage(error) };\n }\n }\n try {\n if (!this.actors.owns(command.targetId)) {\n return { accepted: false, error: `Resident host does not own ${command.targetId}` };\n }\n const result = this.actors.tell(\n command.targetId,\n message,\n command.data,\n { ...(command.binding !== undefined ? { binding: command.binding } : {}), sender: command.sender ?? null },\n );\n return { accepted: true, messageId: result.messageId };\n } catch (error) {\n return { accepted: false, error: errorMessage(error) };\n }\n }\n\n async #deliverLifecycle(\n subscription: FabricLifecycleSubscription,\n event: FabricLifecycleEvent,\n ): Promise<void> {\n const message = `Fabric lifecycle ${event.event} from ${event.source.name} (${event.source.id})${event.status ? ` with status ${event.status}` : \"\"}.`;\n if (subscription.to === this.config.rootId) {\n await this.#queueDelivery(\n lifecycleSourceIdentity(event.source),\n message,\n subscription.delivery,\n subscription.triggerTurn,\n event,\n );\n return;\n }\n try {\n this.agents.status(subscription.to);\n if (subscription.delivery === \"steer\") this.agents.steer(subscription.to, message, event);\n else this.agents.followUp(subscription.to, message, event);\n return;\n } catch (error) {\n if (!(error instanceof Error && /Unknown Fabric agent/.test(error.message))) throw error;\n }\n try {\n if (this.actors.owns(subscription.to)) {\n this.actors.tell(subscription.to, message, event);\n return;\n }\n } catch {\n // Route through the current remote owner below.\n }\n const target = this.participants.get(subscription.to);\n if (!target) throw new Error(`Unknown Fabric lifecycle target: ${subscription.to}`);\n await this.control.request(\n target.ownerHostId,\n target.id,\n subscription.delivery,\n {\n message,\n data: event,\n triggerTurn: subscription.triggerTurn,\n ...(target.ownerIncarnation ? { ownerIncarnation: target.ownerIncarnation } : {}),\n },\n target.ownerIdentityId,\n );\n }\n\n async #queueDelivery(\n from: MeshIdentity,\n message: string,\n delivery: \"steer\" | \"followUp\",\n triggerTurn: boolean,\n data?: unknown,\n agentCompletionId?: string,\n ): Promise<void> {\n const id = randomUUID();\n const record: ResidentDeliveryRecord = {\n format: RESIDENT_HOST_FORMAT,\n id,\n rootId: this.config.rootId,\n from,\n delivery,\n triggerTurn,\n message,\n ...(data === undefined ? {} : { data }),\n ...(agentCompletionId ? { agentCompletionId } : {}),\n createdAt: Date.now(),\n };\n try {\n await this.mesh.put({\n key: `${this.#deliveryPrefix}${id}`,\n value: record,\n identity: this.identity,\n ifVersion: 0,\n });\n } catch {\n await this.mesh.put({\n key: `${this.#deliveryPrefix}${id}`,\n value: {\n ...record,\n message: message.slice(0, Math.max(1, this.config.mesh.eventContextChars)),\n data: { fabricTruncated: true },\n },\n identity: this.identity,\n ifVersion: 0,\n });\n }\n }\n\n async #pollRequests(): Promise<void> {\n if (this.#pollingRequests || this.#closed) return;\n this.#pollingRequests = true;\n try {\n let entries: string[];\n try {\n entries = fs.readdirSync(this.#requestsPath).filter((entry) => entry.endsWith(\".json\"));\n } catch {\n return;\n }\n for (const entry of entries.slice(0, 32)) {\n const source = path.join(this.#requestsPath, entry);\n const processing = path.join(this.#processingPath, entry);\n try {\n fs.renameSync(source, processing);\n } catch {\n continue;\n }\n await this.#processRequest(processing);\n }\n } finally {\n this.#pollingRequests = false;\n this.#checkIdle();\n }\n }\n\n #checkIdle(): void {\n const activeActor = this.actors\n .listOwned()\n .some((actor) => actor.residency === \"durable\" && actor.status !== \"stopped\");\n const activeAgent = this.agents\n .listForUi()\n .some((agent) => agent.status === \"queued\" || agent.status === \"running\");\n let pendingRequest = false;\n try {\n pendingRequest = fs.readdirSync(this.#requestsPath).some((entry) => entry.endsWith(\".json\"));\n } catch {\n // Missing request directory is empty.\n }\n let nextScheduleDueAt: number | undefined;\n try {\n nextScheduleDueAt = this.mesh.nextScheduleDueAt();\n } catch {\n // Unreadable schedules neither keep the host alive nor stop it.\n }\n const now = Date.now();\n const decision = residentIdleDecision({\n now,\n idleSince: this.#idleSince,\n activeActor,\n activeAgent,\n pendingRequest,\n durableParticipants: activeActor || activeAgent,\n nextScheduleDueAt,\n });\n this.#armScheduleWake(decision.wakeAt);\n if (decision.busy) {\n this.#idleSince = now;\n return;\n }\n if (decision.exit) this.onIdle();\n }\n\n // Re-armed on every idle check: the due time of the earliest pending\n // schedule, released here even if no actor monitor polls in time.\n #armScheduleWake(wakeAt: number | undefined): void {\n if (wakeAt === this.#scheduleWakeAt) return;\n if (this.#scheduleTimer) clearTimeout(this.#scheduleTimer);\n this.#scheduleTimer = undefined;\n this.#scheduleWakeAt = wakeAt;\n if (wakeAt === undefined || this.#closed) return;\n this.#scheduleTimer = setTimeout(() => {\n this.#scheduleTimer = undefined;\n this.#scheduleWakeAt = undefined;\n void this.mesh.releaseDueSchedules().catch(() => undefined).finally(() => {\n if (!this.#closed) this.#checkIdle();\n });\n }, Math.min(Math.max(0, wakeAt - Date.now()), 2_147_000_000));\n this.#scheduleTimer.unref();\n }\n\n async #processRequest(filePath: string): Promise<void> {\n const command = readJson<ResidentCommand>(filePath);\n const requestId = command?.requestId ?? path.basename(filePath, \".json\");\n let response: ResidentCommandResponse;\n try {\n if (\n command?.format !== RESIDENT_HOST_FORMAT ||\n command.rootId !== this.config.rootId ||\n command.requestId !== requestId\n ) {\n throw new Error(\"Invalid Fabric residency request\");\n }\n if (command.operation === \"spawn\") {\n if (\n command.request.sessionSeed ||\n command.request.forkSeed ||\n command.request.sessionFile ||\n command.request.actorId ||\n command.request.actorName ||\n command.request.meshRoot ||\n command.request.runnerSessionId ||\n command.request.systemPrompt ||\n command.request.images\n ) {\n throw new Error(\"Durable agents.spawn accepts only its public task and run settings\");\n }\n if (command.runnerModule) await loadRunnerModule(command.runnerModule);\n const handle = await this.agents.spawn({ ...command.request, residency: \"durable\" });\n // spawn already validated the forwarded scope; record what the child received.\n const scope = launchScope(command.request.scope, command.request.inheritedScope);\n const runDirectory = this.agents.runDirectory(handle.id);\n if (!runDirectory) throw new Error(`Resident agent ${handle.id} has no run directory`);\n const worktreeGitRoot = this.agents.worktreeGitRoot(handle.id);\n const metadata: ResidentAgentMetadata = {\n format: RESIDENT_HOST_FORMAT,\n rootId: this.config.rootId,\n id: handle.id,\n runDirectory,\n handle: { ...handle, residency: \"durable\" },\n ...(worktreeGitRoot ? { worktreeGitRoot } : {}),\n ...(command.runnerModule ? { runnerModule: command.runnerModule } : {}),\n ...(scope ? { scope } : {}),\n createdAt: Date.now(),\n updatedAt: Date.now(),\n };\n atomicWrite(path.join(this.#agentsPath, `${handle.id}.json`), metadata);\n // Publish ownership before a fast, already-settled spawn can notify Main.\n this.agents.detachSignal(handle.id);\n response = {\n format: RESIDENT_HOST_FORMAT,\n requestId,\n ok: true,\n handle: metadata.handle,\n completedAt: Date.now(),\n };\n } else if (command.operation === \"foreground\") {\n this.agents.markForeground(command.id);\n response = {\n format: RESIDENT_HOST_FORMAT,\n requestId,\n ok: true,\n completedAt: Date.now(),\n };\n } else if (command.operation === \"cleanup\") {\n await this.agents.wait(command.id);\n await this.agents.cleanup(command.id, command.deleteBranch);\n fs.rmSync(path.join(this.#agentsPath, `${command.id}.json`), { force: true });\n response = {\n format: RESIDENT_HOST_FORMAT,\n requestId,\n ok: true,\n completedAt: Date.now(),\n };\n } else if (command.operation === \"createActor\") {\n if (command.request.residency !== \"durable\") {\n throw new Error(\"Resident host createActor only supports durable residency\");\n }\n // This handler already runs inside the authoritative durable host.\n // Keep the new actor locally owned; ceding it here created a needless\n // self-transfer window that blocked the next recruitment request.\n const actor = await this.actors.create(command.request, { asRegistryOwner: true });\n response = {\n format: RESIDENT_HOST_FORMAT,\n requestId,\n ok: true,\n actor: actor as FabricActorInfo,\n completedAt: Date.now(),\n };\n } else {\n if (!this.actors.owns(command.id)) {\n throw new Error(`Resident host does not own ${command.id}`);\n }\n await this.actors.remove(command.id);\n response = {\n format: RESIDENT_HOST_FORMAT,\n requestId,\n ok: true,\n completedAt: Date.now(),\n };\n }\n } catch (error) {\n response = {\n format: RESIDENT_HOST_FORMAT,\n requestId,\n ok: false,\n error: errorMessage(error),\n completedAt: Date.now(),\n };\n }\n atomicWrite(path.join(this.#responsesPath, `${requestId}.json`), response);\n fs.rmSync(filePath, { force: true });\n this.participants.scheduleRefresh();\n }\n\n /**\n * Re-import the runner modules recorded for this host's durable runs, then\n * re-attach their hosted runs from the persisted locators. A run whose\n * runner cannot be loaded settles indeterminate; nothing is re-submitted.\n */\n async #recoverHostedRuns(): Promise<void> {\n let entries: string[];\n try {\n entries = fs.readdirSync(this.#agentsPath).filter((entry) => entry.endsWith(\".json\"));\n } catch {\n entries = [];\n }\n const modules = new Set<string>();\n for (const entry of entries) {\n const metadata = readJson<ResidentAgentMetadata>(path.join(this.#agentsPath, entry));\n if (metadata?.rootId === this.config.rootId && typeof metadata.runnerModule === \"string\") {\n modules.add(metadata.runnerModule);\n }\n }\n for (const module of modules) await loadRunnerModule(module).catch(() => undefined);\n await this.agents.recoverHostedRuns().catch(() => []);\n // Opted-in pi-durable worker runs (agents.durableWorkerRecovery at launch).\n await this.agents.recoverWorkerRuns().catch(() => []);\n }\n\n #recoverInterruptedRequests(): void {\n let entries: string[];\n try {\n entries = fs.readdirSync(this.#processingPath).filter((entry) => entry.endsWith(\".json\"));\n } catch {\n return;\n }\n for (const entry of entries) {\n const requestId = path.basename(entry, \".json\");\n const response: ResidentCommandResponse = {\n format: RESIDENT_HOST_FORMAT,\n requestId,\n ok: false,\n error: \"Fabric residency outcome is indeterminate after resident host restart\",\n outcome: \"indeterminate\",\n completedAt: Date.now(),\n };\n atomicWrite(path.join(this.#responsesPath, entry), response);\n fs.rmSync(path.join(this.#processingPath, entry), { force: true });\n }\n }\n\n #acquireLock(): void {\n fs.mkdirSync(this.config.residencyRoot, { recursive: true, mode: 0o700 });\n const existing = readJson<ResidentHostOwner>(this.#ownerPath);\n if (existing && ownerAlive(existing)) {\n throw new ResidentHostAlreadyRunning(`Fabric resident host is already running (${existing.pid})`);\n }\n try {\n const descriptor = fs.openSync(this.#lockPath, \"wx\", 0o600);\n fs.writeFileSync(descriptor, JSON.stringify({ token: this.#token, pid: process.pid, ...ownerHeartbeatFields() }));\n fs.closeSync(descriptor);\n } catch (error) {\n if (error instanceof Error && \"code\" in error && error.code === \"EEXIST\") {\n const locked = readJson<{ pid?: unknown }>(this.#lockPath);\n if (typeof locked?.pid === \"number\" && ownerAlive(locked)) {\n throw new ResidentHostAlreadyRunning(`Fabric resident host is starting (${locked.pid})`);\n }\n fs.rmSync(this.#lockPath, { force: true });\n const descriptor = fs.openSync(this.#lockPath, \"wx\", 0o600);\n fs.writeFileSync(descriptor, JSON.stringify({ token: this.#token, pid: process.pid, ...ownerHeartbeatFields() }));\n fs.closeSync(descriptor);\n } else {\n throw error;\n }\n }\n }\n\n // Long-lived ownership: refresh both the start lock and owner.json while\n // they are still ours, so readers in other PID namespaces can judge us.\n #refreshHeartbeat(heartbeatAt: number): void {\n const lock = readJson<Record<string, unknown>>(this.#lockPath);\n if (lock?.token === this.#token) atomicWrite(this.#lockPath, { ...lock, heartbeatAt });\n const owner = readJson<ResidentHostOwner>(this.#ownerPath);\n if (owner?.token === this.#token) atomicWrite(this.#ownerPath, { ...owner, heartbeatAt });\n }\n\n #releaseLock(): void {\n const lock = readJson<{ token?: unknown }>(this.#lockPath);\n if (lock?.token === this.#token) fs.rmSync(this.#lockPath, { force: true });\n const owner = readJson<ResidentHostOwner>(this.#ownerPath);\n if (owner?.token === this.#token) fs.rmSync(this.#ownerPath, { force: true });\n }\n}\n\nconst runResidentHost = async (\n config: ResidentHostConfig,\n signal?: AbortSignal,\n): Promise<void> => {\n let finishIdle: (() => void) | undefined;\n const idle = new Promise<void>((resolve) => {\n finishIdle = resolve;\n });\n const host = new ResidentHost(config, () => finishIdle?.());\n await host.start();\n if (signal?.aborted) {\n await host.close();\n return;\n }\n await Promise.race([\n idle,\n new Promise<void>((resolve) => {\n const finish = (): void => resolve();\n signal?.addEventListener(\"abort\", finish, { once: true });\n process.once(\"SIGTERM\", finish);\n process.once(\"SIGINT\", finish);\n }),\n ]);\n await host.close();\n};\n\nexport const runResidentHostFromConfigPath = async (\n configPath: string,\n signal?: AbortSignal,\n): Promise<void> => {\n let config: ResidentHostConfig | undefined;\n try {\n config = validateResidentHostConfig(readJson<unknown>(configPath), configPath);\n await runResidentHost(config, signal);\n } catch (error) {\n if (error instanceof ResidentHostAlreadyRunning) return;\n const residencyRoot = config?.residencyRoot ?? path.dirname(configPath);\n try {\n atomicWrite(path.join(residencyRoot, \"error.json\"), {\n error: errorMessage(error),\n occurredAt: Date.now(),\n });\n } catch {\n // Startup diagnostics are best-effort.\n }\n throw error;\n }\n};\n\nconst isMain = process.argv[1] && path.resolve(process.argv[1]) === path.resolve(fileURLToPath(import.meta.url));\nif (isMain) {\n const configPath = parseResidentHostConfigPath(process.argv);\n try {\n await runResidentHostFromConfigPath(configPath);\n } catch {\n process.exitCode = 1;\n }\n}\n"],
|
|
4
|
+
"sourcesContent": ["#!/usr/bin/env node\n\nimport { randomUUID } from \"node:crypto\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { fileURLToPath, pathToFileURL } from \"node:url\";\nimport {\n writeJsonAtomic,\n ownerHeartbeatFields,\n recordOwnerLiveness,\n startOwnerHeartbeat,\n} from \"../core/atomic-write.js\";\nimport {\n normalizeModelAliases,\n resolvePiModelSelector,\n type FabricModelCandidate,\n type FabricModelMatch,\n} from \"../core/model-resolution.js\";\nimport { loadModelUsage } from \"../core/model-usage.js\";\nimport {\n parseFabricOwnedModelGuidance,\n resolveFabricModelGuidance,\n} from \"../components/model-guidance.js\";\nimport { ActorDirectory } from \"../actors/directory.js\";\nimport type { FabricActorInfo } from \"../actors/types.js\";\nimport { AgentManager } from \"../agents/manager.js\";\nimport { cancelOrphanedChildQuestions, routeChildQuestion } from \"../decisions/host.js\";\nimport { DecisionStore } from \"../decisions/store.js\";\nimport { launchScope } from \"../scope.js\";\nimport { useBudgetLedger } from \"../agents/budget-ledger.js\";\nimport { LifecycleBroker } from \"../lifecycle/broker.js\";\nimport { lifecycleSourceIdentity, type FabricLifecycleEvent, type FabricLifecycleSubscription } from \"../lifecycle/types.js\";\nimport { MeshStore, type MeshIdentity } from \"../mesh/store.js\";\nimport { FabricControlPlane, type FabricControlAcceptance, type FabricControlCommand } from \"../topology/control-plane.js\";\nimport { ParticipantDirectory } from \"../topology/participant-directory.js\";\nimport { actorParticipantRecord, agentParticipantRecords } from \"../topology/records.js\";\nimport {\n RESIDENT_HOST_FORMAT,\n residentDeliveryPrefix,\n residentHostId,\n type ResidentAgentMetadata,\n type ResidentCommand,\n type ResidentCommandResponse,\n type ResidentDeliveryRecord,\n type ResidentHostConfig,\n type ResidentHostOwner,\n} from \"./protocol.js\";\n\nconst REQUEST_POLL_MS = 50;\nconst IDLE_EXIT_MS = 30_000;\nconst COMPLETION_MAX_CHARS = 8_000;\n\nconst delay = (ms: number): Promise<void> =>\n new Promise((resolve) => setTimeout(resolve, ms));\n\nconst atomicWrite = (filePath: string, value: unknown): void => {\n writeJsonAtomic(filePath, value, { space: 2 });\n};\n\nconst readJson = <T>(filePath: string): T | undefined => {\n try {\n return JSON.parse(fs.readFileSync(filePath, \"utf8\")) as T;\n } catch {\n return undefined;\n }\n};\n\nconst errorMessage = (error: unknown): string =>\n error instanceof Error ? error.message : String(error);\n\nconst processAlive = (pid: number): boolean => {\n if (!Number.isSafeInteger(pid) || pid <= 0) return false;\n try {\n process.kill(pid, 0);\n return true;\n } catch (error) {\n // On Windows, EPERM means the process exists but cannot be opened for\n // signaling; only ESRCH (or other errors) mean it is gone.\n return error instanceof Error && \"code\" in error && (error as NodeJS.ErrnoException).code === \"EPERM\";\n }\n};\n\n// Identity-less (pre-heartbeat) owners keep the plain signal probe; an owner\n// in another PID namespace is judged by its heartbeat, and \"unknown\" is not death.\nconst ownerAlive = (record: unknown): boolean =>\n recordOwnerLiveness(record, { legacyAlive: processAlive }) !== \"dead\";\n\n// The resident host runs Pi with --no-extensions, so a custom runner is only\n// registered here when its residentModule is imported (once per process).\nconst runnerModules = new Map<string, Promise<void>>();\nconst loadRunnerModule = (specifier: string): Promise<void> => {\n if (!/^(?:\\/|[A-Za-z]:[\\\\/]|file:)/.test(specifier)) {\n return Promise.reject(new Error(`Fabric runner module must be absolute: ${specifier}`));\n }\n const url = specifier.startsWith(\"file:\") ? specifier : pathToFileURL(specifier).href;\n let pending = runnerModules.get(url);\n if (!pending) {\n pending = import(url).then(() => undefined);\n runnerModules.set(url, pending);\n pending.catch(() => runnerModules.delete(url));\n }\n return pending;\n};\n\nclass ResidentHostAlreadyRunning extends Error {}\n\nconst parseResidentHostConfigPath = (argv: readonly string[]): string => {\n const index = argv.indexOf(\"--config\");\n const value = index >= 0 ? argv[index + 1] : undefined;\n if (!value) throw new Error(\"Missing resident host argument: --config\");\n return path.resolve(value);\n};\n\nconst validateResidentHostConfig = (value: unknown, configPath: string): ResidentHostConfig => {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n throw new Error(\"Invalid Fabric resident host config\");\n }\n const config = value as Partial<ResidentHostConfig>;\n if (\n config.format !== RESIDENT_HOST_FORMAT ||\n typeof config.rootId !== \"string\" ||\n typeof config.sessionId !== \"string\" ||\n typeof config.cwd !== \"string\" ||\n typeof config.projectRoot !== \"string\" ||\n typeof config.meshRoot !== \"string\" ||\n typeof config.actorRoot !== \"string\" ||\n (config.sessionActorRoot !== undefined && typeof config.sessionActorRoot !== \"string\") ||\n typeof config.residencyRoot !== \"string\" ||\n typeof config.fullCodeMode !== \"boolean\" ||\n (config.kernel !== undefined && config.kernel !== \"typescript\" && config.kernel !== \"python\") ||\n (config.pythonRuntime !== undefined && config.pythonRuntime !== \"cpython\" && config.pythonRuntime !== \"monty\") ||\n typeof config.agents !== \"object\" ||\n config.agents === null ||\n typeof config.mesh !== \"object\" ||\n config.mesh === null ||\n typeof config.retention !== \"object\" ||\n config.retention === null ||\n typeof config.workerPath !== \"string\" ||\n typeof config.fabricExtensionPath !== \"string\" ||\n typeof config.piBinary !== \"string\" ||\n typeof config.claudeBinary !== \"string\" ||\n typeof config.vedaBinary !== \"string\"\n ) {\n throw new Error(\"Fabric resident host config is incomplete\");\n }\n if (path.resolve(config.residencyRoot) !== path.dirname(configPath)) {\n throw new Error(\"Fabric resident host config is outside its residency root\");\n }\n if (!config.mesh.enabled) throw new Error(\"Durable residency requires the Fabric mesh\");\n return config as ResidentHostConfig;\n};\n\n/**\n * The resident host's idle rule. Live durable participants, queued work or a\n * pending request keep it alive; pending mesh schedules do too while at least\n * one durable participant could receive them, and `wakeAt` names the next due\n * time so the host releases it on time. Without durable participants a\n * schedule waits for the next Fabric process that touches the mesh.\n */\nexport const residentIdleDecision = (input: {\n now: number;\n idleSince: number;\n activeActor: boolean;\n activeAgent: boolean;\n pendingRequest: boolean;\n durableParticipants: boolean;\n nextScheduleDueAt: number | undefined;\n idleExitMs?: number;\n}): { busy: boolean; exit: boolean; wakeAt?: number } => {\n const holdsSchedules = input.nextScheduleDueAt !== undefined && input.durableParticipants;\n const wakeAt = holdsSchedules ? input.nextScheduleDueAt : undefined;\n const busy = input.activeActor || input.activeAgent || input.pendingRequest || holdsSchedules;\n const exit = !busy && input.now - input.idleSince >= (input.idleExitMs ?? IDLE_EXIT_MS);\n return { busy, exit, ...(wakeAt !== undefined ? { wakeAt } : {}) };\n};\n\nclass ResidentHost {\n readonly hostId: string;\n readonly identity: MeshIdentity;\n readonly mesh: MeshStore;\n readonly participants: ParticipantDirectory;\n readonly control: FabricControlPlane;\n readonly agents: AgentManager;\n readonly actors: ActorDirectory;\n readonly lifecycle: LifecycleBroker;\n readonly #decisions: DecisionStore;\n readonly #ownerPath: string;\n readonly #lockPath: string;\n readonly #errorPath: string;\n readonly #requestsPath: string;\n readonly #processingPath: string;\n readonly #responsesPath: string;\n readonly #agentsPath: string;\n readonly #deliveryPrefix: string;\n readonly #token = randomUUID();\n #requestTimer: NodeJS.Timeout | undefined;\n #scheduleTimer: NodeJS.Timeout | undefined;\n #scheduleWakeAt: number | undefined;\n #stopHeartbeat: (() => void) | undefined;\n #pollingRequests = false;\n #closed = false;\n #started = false;\n #idleSince = Date.now();\n\n constructor(\n readonly config: ResidentHostConfig,\n readonly onIdle: () => void = () => {},\n ) {\n this.hostId = residentHostId(config.rootId);\n this.identity = { id: this.hostId, name: \"Fabric resident host\", kind: \"agent\" };\n this.#ownerPath = path.join(config.residencyRoot, \"owner.json\");\n this.#lockPath = path.join(config.residencyRoot, \"host.lock\");\n this.#errorPath = path.join(config.residencyRoot, \"error.json\");\n this.#requestsPath = path.join(config.residencyRoot, \"requests\");\n this.#processingPath = path.join(config.residencyRoot, \"processing\");\n this.#responsesPath = path.join(config.residencyRoot, \"responses\");\n this.#agentsPath = path.join(config.residencyRoot, \"agents\");\n this.#deliveryPrefix = residentDeliveryPrefix(config.rootId);\n this.mesh = new MeshStore(config.meshRoot, config.mesh.maxEventBytes, config.mesh.maxReadEvents, {\n durability: config.mesh.durability,\n });\n this.control = new FabricControlPlane(this.mesh, this.identity, {\n enabled: true,\n hostId: this.hostId,\n pollMs: config.mesh.actorPollMs,\n });\n this.participants = new ParticipantDirectory(this.mesh, {\n enabled: true,\n hostId: this.hostId,\n rootId: config.rootId,\n identity: this.identity,\n ownerIncarnation: this.control.incarnation,\n });\n if (config.agents.budgetUsd > 0) {\n const budgetFile = path.join(config.residencyRoot, \"budget.jsonl\");\n fs.mkdirSync(path.dirname(budgetFile), { recursive: true, mode: 0o700 });\n if (!fs.existsSync(budgetFile)) fs.writeFileSync(budgetFile, \"\", { mode: 0o600 });\n useBudgetLedger({\n budget: config.agents.budgetUsd,\n file: budgetFile,\n id: this.hostId,\n });\n }\n const guidanceConfigPath = path.join(config.residencyRoot, \"config.json\");\n const currentConfig = (): Partial<ResidentHostConfig> =>\n readJson<Partial<ResidentHostConfig>>(guidanceConfigPath) ?? config;\n const currentModelGuidance = () =>\n parseFabricOwnedModelGuidance(currentConfig().modelGuidance ?? config.modelGuidance);\n const resolveResidentPiModel = (selector?: string, modelMatch?: FabricModelMatch): string => {\n const state = currentConfig().piModels ?? config.piModels;\n const available: FabricModelCandidate[] = Array.isArray(state?.available)\n ? state.available.flatMap((candidate) =>\n typeof candidate?.provider === \"string\" && typeof candidate.id === \"string\"\n ? [{\n provider: candidate.provider,\n id: candidate.id,\n ...(typeof candidate.name === \"string\" ? { name: candidate.name } : {}),\n }]\n : [],\n )\n : [];\n const query = selector?.trim() || state?.defaultModel?.trim() || \"\";\n const resolved = resolvePiModelSelector(query, {\n aliases: normalizeModelAliases(state?.aliases),\n available,\n lastUsed: loadModelUsage(),\n }, modelMatch);\n return `${resolved.provider}/${resolved.id}`;\n };\n // agents.childQuestions \"route\": this host has no UI, so a durable child's\n // dialog always becomes a root-held decision in the project mesh, answered\n // by a root session or the decisions CLI. The run's settlement cancels it, and\n // so does detaching a durable hosted run at shutdown (see #startOwned for a\n // host that died instead).\n this.#decisions = new DecisionStore(this.mesh, {\n id: this.identity.id,\n name: this.identity.name,\n kind: this.identity.kind,\n sessionId: config.sessionId,\n });\n this.agents = new AgentManager(config.cwd, config.agents, {\n workerPath: config.workerPath,\n fabricExtensionPath: config.fabricExtensionPath,\n piBinary: config.piBinary,\n claudeBinary: config.claudeBinary,\n vedaBinary: config.vedaBinary,\n runRoot: path.join(config.residencyRoot, \"runs\"),\n fullCodeMode: config.fullCodeMode,\n kernel: () => currentConfig().kernel ?? config.kernel ?? \"typescript\",\n pythonRuntime: () => currentConfig().pythonRuntime ?? config.pythonRuntime ?? \"monty\",\n mainAgentId: config.rootId,\n fabricSessionId: config.sessionId,\n meshRoot: config.meshRoot,\n projectRoot: config.projectRoot,\n hostId: this.hostId,\n identityId: this.identity.id,\n retention: config.retention,\n preparePiModel: async (model, options) => resolveResidentPiModel(model, options?.modelMatch),\n resolveParticipantGuidance: ({ model }) => {\n if (!model) return undefined;\n return resolveFabricModelGuidance(currentModelGuidance(), {\n model,\n target: \"participant\",\n includeSlots: false,\n }).appendText || undefined;\n },\n onLifecycle: (event) => void this.lifecycle?.publish(event).catch(() => undefined),\n onChildQuestion: (request) => routeChildQuestion(request, { store: this.#decisions }),\n onBackgroundComplete: (result) => {\n if (!config.agents.notifyOnComplete) return;\n const durationMs = Math.max(0, (result.finishedAt ?? Date.now()) - result.startedAt);\n const summary = (result.text || result.error || \"no result\").slice(0, COMPLETION_MAX_CHARS);\n void this.#queueDelivery(\n { id: result.id, name: result.name, kind: \"agent\" },\n `Fabric agent ${result.id.slice(0, 8)} ${result.status} after ${Math.round(durationMs / 1_000)}s: ${summary}`,\n \"steer\",\n true,\n result,\n result.id,\n ).catch(() => undefined);\n },\n });\n const canManageActor = (id: string): boolean | undefined => {\n const participant = this.participants.get(id);\n return participant ? participant.ownerHostId === this.hostId : undefined;\n };\n const lineageAlive = (rootId: string): boolean =>\n this.participants.get(rootId) !== undefined;\n const actorRoots = config.sessionActorRoot\n ? { project: config.actorRoot, session: config.sessionActorRoot }\n : config.mesh.actorScope === \"session\"\n ? { project: path.dirname(config.actorRoot), session: config.actorRoot }\n : { project: config.actorRoot, session: path.join(config.actorRoot, config.sessionId) };\n this.actors = new ActorDirectory([\n config.sessionId,\n this.identity,\n this.mesh,\n config.mesh,\n this.agents,\n ({ actor, message, delivery, triggerTurn }) => {\n if (!message.text) return;\n const mode = delivery === \"steer\" ? \"steer\" : \"followUp\";\n const triggers = delivery === \"nextTurn\" ? false : triggerTurn;\n void this.#queueDelivery(\n { id: actor.id, name: actor.name, kind: \"actor\" },\n message.text,\n mode,\n triggers,\n message.data,\n ).catch(() => undefined);\n },\n {\n persistent: true,\n canManageActor,\n lineageAlive,\n claimResidency: \"durable\",\n rootId: config.rootId,\n meshCursorPath: path.join(config.residencyRoot, \"actor-mesh-cursor.json\"),\n retention: config.retention,\n resolvePiModel: resolveResidentPiModel,\n },\n ], actorRoots, config.mesh.actorScope);\n this.lifecycle = new LifecycleBroker(\n this.mesh,\n this.identity,\n this.participants,\n {\n enabled: true,\n pollMs: config.mesh.actorPollMs,\n maxReadEvents: config.mesh.maxReadEvents,\n },\n (subscription, event) => this.#deliverLifecycle(subscription, event),\n );\n }\n\n async start(): Promise<void> {\n if (this.#started) return;\n this.#acquireLock();\n this.#started = true;\n this.#stopHeartbeat = startOwnerHeartbeat((heartbeatAt) => this.#refreshHeartbeat(heartbeatAt));\n try {\n await this.#startOwned();\n } catch (error) {\n this.#stopHeartbeat();\n this.#stopHeartbeat = undefined;\n throw error;\n }\n }\n\n async #startOwned(): Promise<void> {\n fs.mkdirSync(this.#requestsPath, { recursive: true, mode: 0o700 });\n fs.mkdirSync(this.#processingPath, { recursive: true, mode: 0o700 });\n fs.mkdirSync(this.#responsesPath, { recursive: true, mode: 0o700 });\n fs.mkdirSync(this.#agentsPath, { recursive: true, mode: 0o700 });\n this.#recoverInterruptedRequests();\n // An earlier host that died left its routed questions open, and their answers\n // would reach nothing. Cancel them before re-attaching runs, whose runners ask\n // again through this host. A failure must not stop startup, but it leaves those\n // decisions open, so report it on stderr; the launcher keeps it in child-stderr.log.\n await cancelOrphanedChildQuestions(this.#decisions).catch((error: unknown) => {\n process.stderr.write(\n `[pi-fabric] resident host ${this.hostId} could not cancel orphaned child questions at startup: ${errorMessage(error)}\\n`,\n );\n return [];\n });\n await this.#recoverHostedRuns();\n const firstSeenAgents = new Map<string, number>();\n this.participants.registerSource(() =>\n agentParticipantRecords(\n this.agents.listForUi(),\n this.config.rootId,\n this.hostId,\n this.identity.id,\n this.config.rootId,\n firstSeenAgents,\n ),\n );\n this.participants.registerSource(() =>\n this.actors.listOwned().map((actor) =>\n actorParticipantRecord(\n actor,\n this.config.rootId,\n this.hostId,\n this.identity.id,\n this.config.rootId,\n ),\n ),\n );\n this.agents.subscribeUi(() => this.participants.scheduleRefresh());\n this.actors.subscribe(() => this.participants.scheduleRefresh());\n this.control.start((command, from, signal) =>\n this.#acceptControl(command, from, signal));\n await this.participants.start().catch(() => undefined);\n this.lifecycle.start();\n this.#requestTimer = setInterval(\n () => void this.#pollRequests().catch(() => undefined),\n REQUEST_POLL_MS,\n );\n const now = Date.now();\n const owner: ResidentHostOwner = {\n format: RESIDENT_HOST_FORMAT,\n hostId: this.hostId,\n pid: process.pid,\n token: this.#token,\n startedAt: now,\n readyAt: now,\n ...ownerHeartbeatFields(now),\n };\n atomicWrite(this.#ownerPath, owner);\n fs.rmSync(this.#errorPath, { force: true });\n await this.#pollRequests();\n }\n\n async close(): Promise<void> {\n if (this.#closed) return;\n this.#closed = true;\n if (this.#requestTimer) clearInterval(this.#requestTimer);\n this.#requestTimer = undefined;\n if (this.#scheduleTimer) clearTimeout(this.#scheduleTimer);\n this.#scheduleTimer = undefined;\n this.#stopHeartbeat?.();\n this.#stopHeartbeat = undefined;\n while (this.#pollingRequests) await delay(10);\n await this.participants.quiesce().catch(() => undefined);\n await this.lifecycle.close().catch(() => undefined);\n await this.control.close().catch(() => undefined);\n try {\n await this.actors.close();\n } finally {\n await this.agents.close();\n await this.participants.close().catch(() => undefined);\n this.#releaseLock();\n }\n }\n\n async #acceptControl(\n command: FabricControlCommand,\n _from: MeshIdentity,\n signal?: AbortSignal,\n ): Promise<FabricControlAcceptance> {\n if (command.operation === \"cancel\") {\n return { accepted: false, error: \"Cancel commands are handled by the control plane\" };\n }\n if (command.operation === \"stop\") {\n try {\n await this.agents.stop(command.targetId);\n this.participants.scheduleRefresh();\n return { accepted: true, messageId: command.commandId };\n } catch (error) {\n if (!(error instanceof Error && /Unknown Fabric agent/.test(error.message))) {\n return { accepted: false, error: errorMessage(error) };\n }\n }\n try {\n if (!this.actors.owns(command.targetId)) {\n return { accepted: false, error: `Resident host does not own ${command.targetId}` };\n }\n await this.actors.stop(command.targetId);\n this.participants.scheduleRefresh();\n return { accepted: true, messageId: command.commandId };\n } catch (error) {\n return { accepted: false, error: errorMessage(error) };\n }\n }\n const message = command.message?.trim();\n if (!message) return { accepted: false, error: \"Fabric control message must not be empty\" };\n if (command.operation === \"ask\") {\n try {\n if (!this.actors.owns(command.targetId)) {\n return { accepted: false, error: `Resident host does not own ${command.targetId}` };\n }\n const result = await this.actors.ask(\n command.targetId,\n message,\n command.data,\n signal,\n { ...(command.binding !== undefined ? { binding: command.binding } : {}), sender: command.sender ?? null },\n );\n return { accepted: true, messageId: result.id, result };\n } catch (error) {\n return { accepted: false, error: errorMessage(error) };\n }\n }\n try {\n this.agents.status(command.targetId);\n const result = command.operation === \"steer\"\n ? this.agents.steer(command.targetId, message, command.data)\n : this.agents.followUp(command.targetId, message, command.data);\n return { accepted: true, messageId: result.messageId };\n } catch (error) {\n if (!(error instanceof Error && /Unknown Fabric agent/.test(error.message))) {\n return { accepted: false, error: errorMessage(error) };\n }\n }\n try {\n if (!this.actors.owns(command.targetId)) {\n return { accepted: false, error: `Resident host does not own ${command.targetId}` };\n }\n const result = this.actors.tell(\n command.targetId,\n message,\n command.data,\n { ...(command.binding !== undefined ? { binding: command.binding } : {}), sender: command.sender ?? null },\n );\n return { accepted: true, messageId: result.messageId };\n } catch (error) {\n return { accepted: false, error: errorMessage(error) };\n }\n }\n\n async #deliverLifecycle(\n subscription: FabricLifecycleSubscription,\n event: FabricLifecycleEvent,\n ): Promise<void> {\n const message = `Fabric lifecycle ${event.event} from ${event.source.name} (${event.source.id})${event.status ? ` with status ${event.status}` : \"\"}.`;\n if (subscription.to === this.config.rootId) {\n await this.#queueDelivery(\n lifecycleSourceIdentity(event.source),\n message,\n subscription.delivery,\n subscription.triggerTurn,\n event,\n );\n return;\n }\n try {\n this.agents.status(subscription.to);\n if (subscription.delivery === \"steer\") this.agents.steer(subscription.to, message, event);\n else this.agents.followUp(subscription.to, message, event);\n return;\n } catch (error) {\n if (!(error instanceof Error && /Unknown Fabric agent/.test(error.message))) throw error;\n }\n try {\n if (this.actors.owns(subscription.to)) {\n this.actors.tell(subscription.to, message, event);\n return;\n }\n } catch {\n // Route through the current remote owner below.\n }\n const target = this.participants.get(subscription.to);\n if (!target) throw new Error(`Unknown Fabric lifecycle target: ${subscription.to}`);\n await this.control.request(\n target.ownerHostId,\n target.id,\n subscription.delivery,\n {\n message,\n data: event,\n triggerTurn: subscription.triggerTurn,\n ...(target.ownerIncarnation ? { ownerIncarnation: target.ownerIncarnation } : {}),\n },\n target.ownerIdentityId,\n );\n }\n\n async #queueDelivery(\n from: MeshIdentity,\n message: string,\n delivery: \"steer\" | \"followUp\",\n triggerTurn: boolean,\n data?: unknown,\n agentCompletionId?: string,\n ): Promise<void> {\n const id = randomUUID();\n const record: ResidentDeliveryRecord = {\n format: RESIDENT_HOST_FORMAT,\n id,\n rootId: this.config.rootId,\n from,\n delivery,\n triggerTurn,\n message,\n ...(data === undefined ? {} : { data }),\n ...(agentCompletionId ? { agentCompletionId } : {}),\n createdAt: Date.now(),\n };\n try {\n await this.mesh.put({\n key: `${this.#deliveryPrefix}${id}`,\n value: record,\n identity: this.identity,\n ifVersion: 0,\n });\n } catch {\n await this.mesh.put({\n key: `${this.#deliveryPrefix}${id}`,\n value: {\n ...record,\n message: message.slice(0, Math.max(1, this.config.mesh.eventContextChars)),\n data: { fabricTruncated: true },\n },\n identity: this.identity,\n ifVersion: 0,\n });\n }\n }\n\n async #pollRequests(): Promise<void> {\n if (this.#pollingRequests || this.#closed) return;\n this.#pollingRequests = true;\n try {\n let entries: string[];\n try {\n entries = fs.readdirSync(this.#requestsPath).filter((entry) => entry.endsWith(\".json\"));\n } catch {\n return;\n }\n for (const entry of entries.slice(0, 32)) {\n const source = path.join(this.#requestsPath, entry);\n const processing = path.join(this.#processingPath, entry);\n try {\n fs.renameSync(source, processing);\n } catch {\n continue;\n }\n await this.#processRequest(processing);\n }\n } finally {\n this.#pollingRequests = false;\n this.#checkIdle();\n }\n }\n\n #checkIdle(): void {\n const activeActor = this.actors\n .listOwned()\n .some((actor) => actor.residency === \"durable\" && actor.status !== \"stopped\");\n const activeAgent = this.agents\n .listForUi()\n .some((agent) => agent.status === \"queued\" || agent.status === \"running\");\n let pendingRequest = false;\n try {\n pendingRequest = fs.readdirSync(this.#requestsPath).some((entry) => entry.endsWith(\".json\"));\n } catch {\n // Missing request directory is empty.\n }\n let nextScheduleDueAt: number | undefined;\n try {\n nextScheduleDueAt = this.mesh.nextScheduleDueAt();\n } catch {\n // Unreadable schedules neither keep the host alive nor stop it.\n }\n const now = Date.now();\n const decision = residentIdleDecision({\n now,\n idleSince: this.#idleSince,\n activeActor,\n activeAgent,\n pendingRequest,\n durableParticipants: activeActor || activeAgent,\n nextScheduleDueAt,\n });\n this.#armScheduleWake(decision.wakeAt);\n if (decision.busy) {\n this.#idleSince = now;\n return;\n }\n if (decision.exit) this.onIdle();\n }\n\n // Re-armed on every idle check: the due time of the earliest pending\n // schedule, released here even if no actor monitor polls in time.\n #armScheduleWake(wakeAt: number | undefined): void {\n if (wakeAt === this.#scheduleWakeAt) return;\n if (this.#scheduleTimer) clearTimeout(this.#scheduleTimer);\n this.#scheduleTimer = undefined;\n this.#scheduleWakeAt = wakeAt;\n if (wakeAt === undefined || this.#closed) return;\n this.#scheduleTimer = setTimeout(() => {\n this.#scheduleTimer = undefined;\n this.#scheduleWakeAt = undefined;\n void this.mesh.releaseDueSchedules().catch(() => undefined).finally(() => {\n if (!this.#closed) this.#checkIdle();\n });\n }, Math.min(Math.max(0, wakeAt - Date.now()), 2_147_000_000));\n this.#scheduleTimer.unref();\n }\n\n async #processRequest(filePath: string): Promise<void> {\n const command = readJson<ResidentCommand>(filePath);\n const requestId = command?.requestId ?? path.basename(filePath, \".json\");\n let response: ResidentCommandResponse;\n try {\n if (\n command?.format !== RESIDENT_HOST_FORMAT ||\n command.rootId !== this.config.rootId ||\n command.requestId !== requestId\n ) {\n throw new Error(\"Invalid Fabric residency request\");\n }\n if (command.operation === \"spawn\") {\n if (\n command.request.sessionSeed ||\n command.request.forkSeed ||\n command.request.sessionFile ||\n command.request.actorId ||\n command.request.actorName ||\n command.request.meshRoot ||\n command.request.runnerSessionId ||\n command.request.systemPrompt ||\n command.request.images\n ) {\n throw new Error(\"Durable agents.spawn accepts only its public task and run settings\");\n }\n if (command.runnerModule) await loadRunnerModule(command.runnerModule);\n const handle = await this.agents.spawn({ ...command.request, residency: \"durable\" });\n // spawn already validated the forwarded scope; record what the child received.\n const scope = launchScope(command.request.scope, command.request.inheritedScope);\n const runDirectory = this.agents.runDirectory(handle.id);\n if (!runDirectory) throw new Error(`Resident agent ${handle.id} has no run directory`);\n const worktreeGitRoot = this.agents.worktreeGitRoot(handle.id);\n const metadata: ResidentAgentMetadata = {\n format: RESIDENT_HOST_FORMAT,\n rootId: this.config.rootId,\n id: handle.id,\n runDirectory,\n handle: { ...handle, residency: \"durable\" },\n ...(worktreeGitRoot ? { worktreeGitRoot } : {}),\n ...(command.runnerModule ? { runnerModule: command.runnerModule } : {}),\n ...(scope ? { scope } : {}),\n createdAt: Date.now(),\n updatedAt: Date.now(),\n };\n atomicWrite(path.join(this.#agentsPath, `${handle.id}.json`), metadata);\n // Publish ownership before a fast, already-settled spawn can notify Main.\n this.agents.detachSignal(handle.id);\n response = {\n format: RESIDENT_HOST_FORMAT,\n requestId,\n ok: true,\n handle: metadata.handle,\n completedAt: Date.now(),\n };\n } else if (command.operation === \"foreground\") {\n this.agents.markForeground(command.id);\n response = {\n format: RESIDENT_HOST_FORMAT,\n requestId,\n ok: true,\n completedAt: Date.now(),\n };\n } else if (command.operation === \"cleanup\") {\n await this.agents.wait(command.id);\n await this.agents.cleanup(command.id, command.deleteBranch);\n fs.rmSync(path.join(this.#agentsPath, `${command.id}.json`), { force: true });\n response = {\n format: RESIDENT_HOST_FORMAT,\n requestId,\n ok: true,\n completedAt: Date.now(),\n };\n } else if (command.operation === \"createActor\") {\n if (command.request.residency !== \"durable\") {\n throw new Error(\"Resident host createActor only supports durable residency\");\n }\n // This handler already runs inside the authoritative durable host.\n // Keep the new actor locally owned; ceding it here created a needless\n // self-transfer window that blocked the next recruitment request.\n const actor = await this.actors.create(command.request, { asRegistryOwner: true });\n response = {\n format: RESIDENT_HOST_FORMAT,\n requestId,\n ok: true,\n actor: actor as FabricActorInfo,\n completedAt: Date.now(),\n };\n } else {\n if (!this.actors.owns(command.id)) {\n throw new Error(`Resident host does not own ${command.id}`);\n }\n await this.actors.remove(command.id);\n response = {\n format: RESIDENT_HOST_FORMAT,\n requestId,\n ok: true,\n completedAt: Date.now(),\n };\n }\n } catch (error) {\n response = {\n format: RESIDENT_HOST_FORMAT,\n requestId,\n ok: false,\n error: errorMessage(error),\n completedAt: Date.now(),\n };\n }\n atomicWrite(path.join(this.#responsesPath, `${requestId}.json`), response);\n fs.rmSync(filePath, { force: true });\n this.participants.scheduleRefresh();\n }\n\n /**\n * Re-import the runner modules recorded for this host's durable runs, then\n * re-attach their hosted runs from the persisted locators. A run whose\n * runner cannot be loaded settles indeterminate; nothing is re-submitted.\n */\n async #recoverHostedRuns(): Promise<void> {\n let entries: string[];\n try {\n entries = fs.readdirSync(this.#agentsPath).filter((entry) => entry.endsWith(\".json\"));\n } catch {\n entries = [];\n }\n const modules = new Set<string>();\n for (const entry of entries) {\n const metadata = readJson<ResidentAgentMetadata>(path.join(this.#agentsPath, entry));\n if (metadata?.rootId === this.config.rootId && typeof metadata.runnerModule === \"string\") {\n modules.add(metadata.runnerModule);\n }\n }\n for (const module of modules) await loadRunnerModule(module).catch(() => undefined);\n await this.agents.recoverHostedRuns().catch(() => []);\n // Opted-in pi-durable worker runs (agents.durableWorkerRecovery at launch).\n await this.agents.recoverWorkerRuns().catch(() => []);\n }\n\n #recoverInterruptedRequests(): void {\n let entries: string[];\n try {\n entries = fs.readdirSync(this.#processingPath).filter((entry) => entry.endsWith(\".json\"));\n } catch {\n return;\n }\n for (const entry of entries) {\n const requestId = path.basename(entry, \".json\");\n const response: ResidentCommandResponse = {\n format: RESIDENT_HOST_FORMAT,\n requestId,\n ok: false,\n error: \"Fabric residency outcome is indeterminate after resident host restart\",\n outcome: \"indeterminate\",\n completedAt: Date.now(),\n };\n atomicWrite(path.join(this.#responsesPath, entry), response);\n fs.rmSync(path.join(this.#processingPath, entry), { force: true });\n }\n }\n\n #acquireLock(): void {\n fs.mkdirSync(this.config.residencyRoot, { recursive: true, mode: 0o700 });\n const existing = readJson<ResidentHostOwner>(this.#ownerPath);\n if (existing && ownerAlive(existing)) {\n throw new ResidentHostAlreadyRunning(`Fabric resident host is already running (${existing.pid})`);\n }\n try {\n const descriptor = fs.openSync(this.#lockPath, \"wx\", 0o600);\n fs.writeFileSync(descriptor, JSON.stringify({ token: this.#token, pid: process.pid, ...ownerHeartbeatFields() }));\n fs.closeSync(descriptor);\n } catch (error) {\n if (error instanceof Error && \"code\" in error && error.code === \"EEXIST\") {\n const locked = readJson<{ pid?: unknown }>(this.#lockPath);\n if (typeof locked?.pid === \"number\" && ownerAlive(locked)) {\n throw new ResidentHostAlreadyRunning(`Fabric resident host is starting (${locked.pid})`);\n }\n fs.rmSync(this.#lockPath, { force: true });\n const descriptor = fs.openSync(this.#lockPath, \"wx\", 0o600);\n fs.writeFileSync(descriptor, JSON.stringify({ token: this.#token, pid: process.pid, ...ownerHeartbeatFields() }));\n fs.closeSync(descriptor);\n } else {\n throw error;\n }\n }\n }\n\n // Long-lived ownership: refresh both the start lock and owner.json while\n // they are still ours, so readers in other PID namespaces can judge us.\n #refreshHeartbeat(heartbeatAt: number): void {\n const lock = readJson<Record<string, unknown>>(this.#lockPath);\n if (lock?.token === this.#token) atomicWrite(this.#lockPath, { ...lock, heartbeatAt });\n const owner = readJson<ResidentHostOwner>(this.#ownerPath);\n if (owner?.token === this.#token) atomicWrite(this.#ownerPath, { ...owner, heartbeatAt });\n }\n\n #releaseLock(): void {\n const lock = readJson<{ token?: unknown }>(this.#lockPath);\n if (lock?.token === this.#token) fs.rmSync(this.#lockPath, { force: true });\n const owner = readJson<ResidentHostOwner>(this.#ownerPath);\n if (owner?.token === this.#token) fs.rmSync(this.#ownerPath, { force: true });\n }\n}\n\nconst runResidentHost = async (\n config: ResidentHostConfig,\n signal?: AbortSignal,\n): Promise<void> => {\n let finishIdle: (() => void) | undefined;\n const idle = new Promise<void>((resolve) => {\n finishIdle = resolve;\n });\n const host = new ResidentHost(config, () => finishIdle?.());\n await host.start();\n if (signal?.aborted) {\n await host.close();\n return;\n }\n await Promise.race([\n idle,\n new Promise<void>((resolve) => {\n const finish = (): void => resolve();\n signal?.addEventListener(\"abort\", finish, { once: true });\n process.once(\"SIGTERM\", finish);\n process.once(\"SIGINT\", finish);\n }),\n ]);\n await host.close();\n};\n\nexport const runResidentHostFromConfigPath = async (\n configPath: string,\n signal?: AbortSignal,\n): Promise<void> => {\n let config: ResidentHostConfig | undefined;\n try {\n config = validateResidentHostConfig(readJson<unknown>(configPath), configPath);\n await runResidentHost(config, signal);\n } catch (error) {\n if (error instanceof ResidentHostAlreadyRunning) return;\n const residencyRoot = config?.residencyRoot ?? path.dirname(configPath);\n try {\n atomicWrite(path.join(residencyRoot, \"error.json\"), {\n error: errorMessage(error),\n occurredAt: Date.now(),\n });\n } catch {\n // Startup diagnostics are best-effort.\n }\n throw error;\n }\n};\n\nconst isMain = process.argv[1] && path.resolve(process.argv[1]) === path.resolve(fileURLToPath(import.meta.url));\nif (isMain) {\n const configPath = parseResidentHostConfigPath(process.argv);\n try {\n await runResidentHostFromConfigPath(configPath);\n } catch {\n process.exitCode = 1;\n }\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,SAAS,kBAAkB;AAC3B,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,SAAS,eAAe,qBA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
-
} from "./chunks/chunk-
|
|
4
|
+
} from "./chunks/chunk-G2DZJ5LK.js";
|
|
5
5
|
import "./chunks/chunk-RKJPBTBB.js";
|
|
6
6
|
import "./chunks/chunk-QNMQJNXE.js";
|
|
7
7
|
import "./chunks/chunk-37NIOSVU.js";
|
|
@@ -9,7 +9,7 @@ import "./chunks/chunk-F2LGSRIN.js";
|
|
|
9
9
|
import "./chunks/chunk-O4A5UOXU.js";
|
|
10
10
|
import "./chunks/chunk-FK73YJKV.js";
|
|
11
11
|
import "./chunks/chunk-VXZZJ44D.js";
|
|
12
|
-
import "./chunks/chunk-
|
|
12
|
+
import "./chunks/chunk-DGUXJSYA.js";
|
|
13
13
|
import "./chunks/chunk-TEMKDJJY.js";
|
|
14
14
|
import "./chunks/chunk-AV36PBKH.js";
|
|
15
15
|
import "./chunks/chunk-P3DCXKL3.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fabric-runtime-state.d.ts","sourceRoot":"","sources":["../src/fabric-runtime-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAU9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAGpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAGvD,OAAO,EAAyB,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAClF,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"fabric-runtime-state.d.ts","sourceRoot":"","sources":["../src/fabric-runtime-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAA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