pi-fabric 0.92.13 → 0.92.15

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.
Files changed (162) hide show
  1. package/README.md +2 -0
  2. package/dist/agents/service-provider.d.ts.map +1 -1
  3. package/dist/agents/service-types.d.ts +3 -1
  4. package/dist/agents/service-types.d.ts.map +1 -1
  5. package/dist/agents/service.d.ts +2 -0
  6. package/dist/agents/service.d.ts.map +1 -1
  7. package/dist/agents.js +8 -2
  8. package/dist/agents.js.map +2 -2
  9. package/dist/audit/projection.d.ts.map +1 -1
  10. package/dist/chunks/{chunk-OAXSWVOB.js → chunk-2PZWDVJB.js} +7 -1
  11. package/dist/chunks/chunk-2PZWDVJB.js.map +7 -0
  12. package/dist/chunks/chunk-3MEHEH6B.js +41 -0
  13. package/dist/chunks/chunk-3MEHEH6B.js.map +7 -0
  14. package/dist/chunks/{chunk-BSGA3KSB.js → chunk-3WIGAX56.js} +2 -2
  15. package/dist/chunks/{chunk-FRONVGLX.js → chunk-7A6NVHB5.js} +2 -2
  16. package/dist/chunks/{chunk-T3UYWHLT.js → chunk-D5WKZONW.js} +10 -289
  17. package/dist/chunks/chunk-D5WKZONW.js.map +7 -0
  18. package/dist/chunks/chunk-G4LADAYY.js +287 -0
  19. package/dist/chunks/chunk-G4LADAYY.js.map +7 -0
  20. package/dist/chunks/{chunk-CQLOEDQZ.js → chunk-IWH6PCMK.js} +2 -2
  21. package/dist/chunks/chunk-LUX7VAM2.js +373 -0
  22. package/dist/chunks/chunk-LUX7VAM2.js.map +7 -0
  23. package/dist/chunks/{chunk-KNBPIZF7.js → chunk-MGDLRV2R.js} +2 -2
  24. package/dist/chunks/{chunk-WBDM7CH4.js → chunk-N5GUXC6F.js} +4 -4
  25. package/dist/chunks/{chunk-WBDM7CH4.js.map → chunk-N5GUXC6F.js.map} +2 -2
  26. package/dist/chunks/{chunk-WTGFGQ2K.js → chunk-NIUOPHLB.js} +5 -373
  27. package/dist/chunks/chunk-NIUOPHLB.js.map +7 -0
  28. package/dist/chunks/chunk-OX7BU3RX.js +590 -0
  29. package/dist/chunks/chunk-OX7BU3RX.js.map +7 -0
  30. package/dist/chunks/{chunk-UNN5OJQB.js → chunk-P7UQ5TWL.js} +3 -3
  31. package/dist/chunks/chunk-PSNXUZMY.js +218 -0
  32. package/dist/chunks/chunk-PSNXUZMY.js.map +7 -0
  33. package/dist/chunks/{chunk-RLFQHZ7K.js → chunk-QLJ5P7HV.js} +2 -2
  34. package/dist/chunks/{chunk-6ELA5OWI.js → chunk-RNOPHITP.js} +7 -5
  35. package/dist/chunks/{chunk-6ELA5OWI.js.map → chunk-RNOPHITP.js.map} +1 -1
  36. package/dist/chunks/chunk-T3A5GNCW.js +19 -0
  37. package/dist/chunks/chunk-T3A5GNCW.js.map +7 -0
  38. package/dist/chunks/chunk-TPLMVELH.js +118 -0
  39. package/dist/chunks/chunk-TPLMVELH.js.map +7 -0
  40. package/dist/chunks/{chunk-HUCNOAKK.js → chunk-U4NSXDRO.js} +2 -2
  41. package/dist/chunks/{chunk-EZ7YLET5.js → chunk-UDFDF7IY.js} +10 -4
  42. package/dist/chunks/chunk-UDFDF7IY.js.map +7 -0
  43. package/dist/chunks/{chunk-6GT4YJT2.js → chunk-UQ4LTUH4.js} +4 -4
  44. package/dist/chunks/{chunk-QJUDWDPL.js → chunk-VHEO26TE.js} +24 -204
  45. package/dist/chunks/chunk-VHEO26TE.js.map +7 -0
  46. package/dist/chunks/{chunk-DLYYHK6Z.js → chunk-VQMPHVLC.js} +6 -6
  47. package/dist/chunks/{chunk-R4AZTYXC.js → chunk-WMS5SDKD.js} +3 -3
  48. package/dist/chunks/{chunk-VJJFD42F.js → chunk-XT4346N7.js} +2 -2
  49. package/dist/chunks/{chunk-YVPUATQT.js → chunk-Y7KNRAFL.js} +36 -15
  50. package/dist/chunks/chunk-Y7KNRAFL.js.map +7 -0
  51. package/dist/chunks/{chunk-4VVD63BA.js → chunk-YSXGVO2N.js} +2 -1
  52. package/dist/chunks/{chunk-4VVD63BA.js.map → chunk-YSXGVO2N.js.map} +2 -2
  53. package/dist/chunks/{chunk-X45GMLON.js → chunk-ZDNGXLEC.js} +2 -2
  54. package/dist/chunks/{chunk-FN6Q4R4M.js → chunk-ZG3ELJHX.js} +47 -1
  55. package/dist/chunks/chunk-ZG3ELJHX.js.map +7 -0
  56. package/dist/compaction/hook.js +5 -4
  57. package/dist/components/provider-component.d.ts +1 -1
  58. package/dist/components/provider-component.d.ts.map +1 -1
  59. package/dist/config.d.ts +3 -1
  60. package/dist/config.d.ts.map +1 -1
  61. package/dist/core/action-registry.js +4 -2
  62. package/dist/entropy/index.js +7 -6
  63. package/dist/fabric-runtime-state.d.ts.map +1 -1
  64. package/dist/fabric-runtime-state.js +96 -43
  65. package/dist/fabric-runtime-state.js.map +2 -2
  66. package/dist/index.d.ts.map +1 -1
  67. package/dist/index.js +47 -36
  68. package/dist/index.js.map +2 -2
  69. package/dist/jev/auth.d.ts +5 -0
  70. package/dist/jev/auth.d.ts.map +1 -0
  71. package/dist/jev/browser.d.ts +37 -0
  72. package/dist/jev/browser.d.ts.map +1 -0
  73. package/dist/jev/browser.js +13 -0
  74. package/dist/jev/browser.js.map +7 -0
  75. package/dist/jev/client.d.ts +29 -0
  76. package/dist/jev/client.d.ts.map +1 -0
  77. package/dist/jev/config.d.ts +17 -0
  78. package/dist/jev/config.d.ts.map +1 -0
  79. package/dist/jev/guest-types.d.ts +2 -0
  80. package/dist/jev/guest-types.d.ts.map +1 -0
  81. package/dist/jev/manager.d.ts +32 -0
  82. package/dist/jev/manager.d.ts.map +1 -0
  83. package/dist/jev/types.d.ts +95 -0
  84. package/dist/jev/types.d.ts.map +1 -0
  85. package/dist/jev/validation.d.ts +8 -0
  86. package/dist/jev/validation.d.ts.map +1 -0
  87. package/dist/jev.d.ts +8 -0
  88. package/dist/jev.d.ts.map +1 -0
  89. package/dist/jev.js +39 -0
  90. package/dist/jev.js.map +7 -0
  91. package/dist/memory/discovery.js +5 -4
  92. package/dist/memory/normalize.js +4 -3
  93. package/dist/memory/search.js +5 -4
  94. package/dist/memory.js +7 -6
  95. package/dist/memory.js.map +1 -1
  96. package/dist/providers/agents-actions.d.ts.map +1 -1
  97. package/dist/providers/agents-provider.d.ts.map +1 -1
  98. package/dist/providers/jev-provider.d.ts +55 -0
  99. package/dist/providers/jev-provider.d.ts.map +1 -0
  100. package/dist/providers/jev-provider.js +21 -0
  101. package/dist/providers/jev-provider.js.map +7 -0
  102. package/dist/providers/memory-provider.js +7 -6
  103. package/dist/residency/host.js +10 -8
  104. package/dist/residency/pi-entry.js +10 -8
  105. package/dist/residency/pi-entry.js.map +1 -1
  106. package/dist/runtime/core-override-guest-types.js +2 -2
  107. package/dist/runtime/guest-types.d.ts +1 -1
  108. package/dist/runtime/guest-types.d.ts.map +1 -1
  109. package/dist/runtime/guest-types.js +1 -1
  110. package/dist/runtime/kernel.d.ts +3 -0
  111. package/dist/runtime/kernel.d.ts.map +1 -1
  112. package/dist/runtime/monty-runtime.js +3 -2
  113. package/dist/runtime/monty-runtime.js.map +1 -1
  114. package/dist/runtime/node-process-runtime.js +3 -3
  115. package/dist/runtime/orchestration.d.ts.map +1 -1
  116. package/dist/runtime/quickjs-runtime.d.ts.map +1 -1
  117. package/dist/runtime/quickjs-runtime.js +2 -2
  118. package/dist/runtime/type-checker.d.ts +1 -1
  119. package/dist/runtime/type-checker.d.ts.map +1 -1
  120. package/dist/runtime/type-checker.js +1 -1
  121. package/dist/runtime/typescript-kernel.d.ts +1 -1
  122. package/dist/runtime/typescript-kernel.d.ts.map +1 -1
  123. package/dist/runtime/typescript-kernel.js +10 -10
  124. package/dist/runtime/typescript-kernel.js.map +2 -2
  125. package/dist/runtime-state-builtins.d.ts.map +1 -1
  126. package/dist/ui/dashboard.js +1 -1
  127. package/dist/ui/fabric-render.d.ts.map +1 -1
  128. package/dist/ui/settings.js +3 -2
  129. package/dist/ui/settings.js.map +1 -1
  130. package/docs/agents.md +2 -0
  131. package/docs/components.md +1 -0
  132. package/docs/configuration.md +6 -0
  133. package/docs/jev.md +212 -0
  134. package/docs/skills.md +3 -2
  135. package/package.json +8 -2
  136. package/skillsets/python/fabric-exec/SKILL.md +10 -0
  137. package/skillsets/python/fabric-exec/references/agents.md +2 -0
  138. package/skillsets/python/fabric-guide/SKILL.md +3 -2
  139. package/skillsets/python/fabric-jev/SKILL.md +107 -0
  140. package/skillsets/typescript/fabric-exec/SKILL.md +15 -0
  141. package/skillsets/typescript/fabric-exec/references/agents.md +2 -0
  142. package/skillsets/typescript/fabric-guide/SKILL.md +3 -2
  143. package/skillsets/typescript/fabric-jev/SKILL.md +107 -0
  144. package/dist/chunks/chunk-EZ7YLET5.js.map +0 -7
  145. package/dist/chunks/chunk-FN6Q4R4M.js.map +0 -7
  146. package/dist/chunks/chunk-OAXSWVOB.js.map +0 -7
  147. package/dist/chunks/chunk-QJUDWDPL.js.map +0 -7
  148. package/dist/chunks/chunk-T3UYWHLT.js.map +0 -7
  149. package/dist/chunks/chunk-WTGFGQ2K.js.map +0 -7
  150. package/dist/chunks/chunk-YVPUATQT.js.map +0 -7
  151. /package/dist/chunks/{chunk-BSGA3KSB.js.map → chunk-3WIGAX56.js.map} +0 -0
  152. /package/dist/chunks/{chunk-FRONVGLX.js.map → chunk-7A6NVHB5.js.map} +0 -0
  153. /package/dist/chunks/{chunk-CQLOEDQZ.js.map → chunk-IWH6PCMK.js.map} +0 -0
  154. /package/dist/chunks/{chunk-KNBPIZF7.js.map → chunk-MGDLRV2R.js.map} +0 -0
  155. /package/dist/chunks/{chunk-UNN5OJQB.js.map → chunk-P7UQ5TWL.js.map} +0 -0
  156. /package/dist/chunks/{chunk-RLFQHZ7K.js.map → chunk-QLJ5P7HV.js.map} +0 -0
  157. /package/dist/chunks/{chunk-HUCNOAKK.js.map → chunk-U4NSXDRO.js.map} +0 -0
  158. /package/dist/chunks/{chunk-6GT4YJT2.js.map → chunk-UQ4LTUH4.js.map} +0 -0
  159. /package/dist/chunks/{chunk-DLYYHK6Z.js.map → chunk-VQMPHVLC.js.map} +0 -0
  160. /package/dist/chunks/{chunk-R4AZTYXC.js.map → chunk-WMS5SDKD.js.map} +0 -0
  161. /package/dist/chunks/{chunk-VJJFD42F.js.map → chunk-XT4346N7.js.map} +0 -0
  162. /package/dist/chunks/{chunk-X45GMLON.js.map → chunk-ZDNGXLEC.js.map} +0 -0
package/README.md CHANGED
@@ -117,6 +117,7 @@ Pi loads advanced patterns after direct user invocation. Run `/skill:fabric-guid
117
117
  | One command that chooses advisor or supervisor | `/skill:fabric-ambient advisor Focus on migration correctness.` |
118
118
  | A durable team coordinating through versioned tasks | `/skill:fabric-swarm Coordinate this migration across owned task partitions.` |
119
119
  | Evidence-gated edits with postconditions | `/skill:fabric-schema Make this parser change only if focused tests stay green.` |
120
+ | Typed semantic judgments or bounded reactive loops | `/skill:fabric-jev Build a ticket triage loop with an explicit review path and evaluation budget.` |
120
121
 
121
122
  Execution references stay progressive: the model loads the selected kernel's skill after argument-shape errors or when exact advanced contracts are needed. Kernel changes reload Pi so execution and the selected physical skill tree switch together; see [kernel-specific skills](docs/kernels.md#kernel-specific-skills-and-guidance).
122
123
 
@@ -143,6 +144,7 @@ See the [interface & commands reference](docs/interface.md) for every view, keyb
143
144
  - [Interface & commands](docs/interface.md): dashboard, settings, keybindings, slash commands, and headless runs.
144
145
  - [Agents, actors & mesh](docs/agents.md): model handoff, `/fabric prewalk`, runners, transports, actors, councils, recursive queries, and durable coordination.
145
146
  - [Durable residency through Pi](docs/residency-runtime.md): background host lifecycle and the Pi-runtime launcher boundary.
147
+ - [Jev System One programs](docs/jev.md): typed judgments, `/login jev`, foreground/background loops, budgets, and optional Browser Harness CDP integration.
146
148
  - [Components & committed capabilities](docs/components.md): supervised effects, exact requirements, external per-model guidance and execution-profile replacement, rolling provider generations, actor commitments, and both formal calculi.
147
149
  - [External providers](docs/providers.md): the versioned provider protocol for extensions.
148
150
  - [Architecture & security](docs/architecture.md): the host bridge, sandboxing, tool-call robustness, and limits.
@@ -1 +1 @@
1
- {"version":3,"file":"service-provider.d.ts","sourceRoot":"","sources":["../../src/agents/service-provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,KAAK,EAAsB,wBAAwB,EAAE,kBAAkB,EAAE,sBAAsB,EAA8D,MAAM,oBAAoB,CAAC;AAE/L,0FAA0F;AAC1F,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,GAAG,sBAAsB,CAuBzG;AAED,uFAAuF;AACvF,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,sBAAsB,EAAE,YAAY,GAAE,wBAA6B,GAAG,kBAAkB,CAqB1I;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,kBAAkB,GAAG,cAAc,CAc/E"}
1
+ {"version":3,"file":"service-provider.d.ts","sourceRoot":"","sources":["../../src/agents/service-provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,KAAK,EAAsB,wBAAwB,EAAE,kBAAkB,EAAE,sBAAsB,EAA8D,MAAM,oBAAoB,CAAC;AAE/L,0FAA0F;AAC1F,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,GAAG,sBAAsB,CAwBzG;AAED,uFAAuF;AACvF,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,sBAAsB,EAAE,YAAY,GAAE,wBAA6B,GAAG,kBAAkB,CAsB1I;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,kBAAkB,GAAG,cAAc,CAc/E"}
@@ -120,7 +120,7 @@ export interface AgentTopologyPort {
120
120
  remove?(request: AgentTopologyRemoveRequest): Promise<AgentSessionRecord>;
121
121
  dispatch?(request: AgentTopologyDispatchRequest): Promise<AgentSessionRecord>;
122
122
  }
123
- export type AgentServiceAction = "run" | "spawn" | "wait" | "status" | "list" | "stop" | "steer" | "compact" | "resume" | "followUp" | "sessions" | "peers" | "self" | "members" | "create" | "remove";
123
+ export type AgentServiceAction = "run" | "spawn" | "wait" | "join" | "status" | "list" | "stop" | "steer" | "compact" | "resume" | "followUp" | "sessions" | "peers" | "self" | "members" | "create" | "remove";
124
124
  export interface AgentServiceCapabilities {
125
125
  steer?: boolean;
126
126
  compact?: boolean;
@@ -169,6 +169,8 @@ export interface AgentServiceClient {
169
169
  run(request: AgentServiceRequest, signal?: AbortSignal): Promise<AgentPublicRecord>;
170
170
  spawn(request: AgentServiceRequest, signal?: AbortSignal): Promise<AgentPublicRecord>;
171
171
  wait(id: string, signal?: AbortSignal): Promise<AgentPublicRecord>;
172
+ /** Alias for wait. */
173
+ join(id: string, signal?: AbortSignal): Promise<AgentPublicRecord>;
172
174
  status(id: string): Promise<AgentPublicRecord>;
173
175
  list(): Promise<AgentPublicRecord[]>;
174
176
  stop(id: string): Promise<AgentPublicRecord>;
@@ -1 +1 @@
1
- {"version":3,"file":"service-types.d.ts","sourceRoot":"","sources":["../../src/agents/service-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE9E,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,eAAe,EACpD,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,UAAU,GAAG,OAAO,GAAG,WAAW,GAAG,QAAQ,GAAG,QAAQ,GAAG,cAAc,GAAG,WAAW,GAAG,KAAK,CAC5H,GAAG;IAAE,MAAM,CAAC,EAAE,IAAI,CAAC;IAAC,MAAM,CAAC,EAAE,YAAY,GAAG,SAAS,CAAC;IAAC,UAAU,CAAC,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,EAAE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AAC,kBAAkB,CAAC,CAAC;IACpC,OAAO,IAAI,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAC;IACzC,MAAM,CAAC,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAC3H,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;CACtF"}
@@ -8,6 +8,8 @@ export declare class AgentService {
8
8
  run(callerId: string, request: AgentServiceRequest, signal?: AbortSignal): Promise<AgentPublicRecord>;
9
9
  spawn(callerId: string, request: AgentServiceRequest, signal?: AbortSignal): Promise<AgentPublicRecord | AgentSessionRecord>;
10
10
  wait(callerId: string, id: string, signal?: AbortSignal): Promise<AgentPublicRecord>;
11
+ /** Alias for wait; authorization and cancellation semantics are identical. */
12
+ join(callerId: string, id: string, signal?: AbortSignal): Promise<AgentPublicRecord>;
11
13
  status(callerId: string, id: string): Promise<AgentPublicRecord>;
12
14
  list(callerId: string): Promise<AgentPublicRecord[]>;
13
15
  stop(callerId: string, id: string): Promise<AgentPublicRecord>;
@@ -1 +1 @@
1
- {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../src/agents/service.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAA0B,iBAAiB,EAAoE,wBAAwB,EAAqB,mBAAmB,EAAsB,mBAAmB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAyB3S,gGAAgG;AAChG,qBAAa,YAAY;;IAWvB,QAAQ,CAAC,YAAY,EAAE,wBAAwB,CAAC;gBAEpC,OAAO,EAAE,mBAAmB;IAiBxC,QAAQ,IAAI,oBAAoB;IAK1B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kBAAkB,CAAC;IAanD,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAU5I,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAUtG,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAkBxD,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAKxF,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAa3G,iGAAiG;IAC3F,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAW5B,8FAA8F;IAC9F,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAqCxB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAwSvB"}
package/dist/agents.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  AGENTS_ACTION_DESCRIPTORS,
6
6
  normalizeAgentRunRequest
7
- } from "./chunks/chunk-OAXSWVOB.js";
7
+ } from "./chunks/chunk-2PZWDVJB.js";
8
8
  import {
9
9
  actionArgNormalizer
10
10
  } from "./chunks/chunk-NQOEHX62.js";
@@ -49,7 +49,7 @@ function agentServiceDescriptors(capabilities = {}) {
49
49
  const descriptors2 = [
50
50
  { ...run, description: "Run one host-authorized Pi child and wait for its result or pause", inputSchema: runSchema },
51
51
  { ...native("spawn"), description: "Admit one host-authorized Pi child, or residency durable for an independent host worker", inputSchema: spawnSchema },
52
- ...["wait", "status", "stop"].map((name) => ({ ...native(name), inputSchema: object({ id }, ["id"]) })),
52
+ ...["wait", "join", "status", "stop"].map((name) => ({ ...native(name), inputSchema: object({ id }, ["id"]) })),
53
53
  { ...native("list"), description: "List only the authenticated caller's direct children", inputSchema: object({}) }
54
54
  ];
55
55
  if (capabilities.steer) descriptors2.push({ ...native("steer"), inputSchema: object({ id, message: { type: "string", minLength: 1 } }, ["id", "message"]) });
@@ -161,6 +161,10 @@ var AgentService = class {
161
161
  await this.#authorize(callerId);
162
162
  return publicRecord(record);
163
163
  }
164
+ /** Alias for wait; authorization and cancellation semantics are identical. */
165
+ join(callerId, id2, signal) {
166
+ return this.wait(callerId, id2, signal);
167
+ }
164
168
  async status(callerId, id2) {
165
169
  await this.#authorize(callerId);
166
170
  return publicRecord(this.#child(callerId, id2).record);
@@ -669,6 +673,7 @@ function createAgentServiceHandler(service, callerId) {
669
673
  return service.run(callerId, args, signal);
670
674
  case "spawn":
671
675
  return service.spawn(callerId, args, signal);
676
+ case "join":
672
677
  case "wait":
673
678
  return service.wait(callerId, args.id, signal);
674
679
  case "status":
@@ -710,6 +715,7 @@ function createAgentServiceClient(dispatch, capabilities = {}) {
710
715
  run: (request, signal) => record("run", request, signal),
711
716
  spawn: (request, signal) => record("spawn", request, signal),
712
717
  wait: (id2, signal) => record("wait", { id: id2 }, signal),
718
+ join: (id2, signal) => record("wait", { id: id2 }, signal),
713
719
  status: (id2) => record("status", { id: id2 }),
714
720
  list: () => dispatch("list", {}),
715
721
  stop: (id2) => record("stop", { id: id2 }),
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/agents/service-schema.ts", "../src/agents/service.ts", "../src/agents/service-provider.ts", "../src/agents.ts"],
4
- "sourcesContent": ["import { Value } from \"typebox/value\";\nimport { AGENTS_ACTION_DESCRIPTORS } from \"../providers/agents-actions.js\";\nimport { actionArgNormalizer } from \"../providers/arg-normalization.js\";\nimport type { FabricActionDescriptor } from \"../protocol.js\";\nimport { assertAgentTask } from \"./lifecycle.js\";\nimport { normalizeAgentRunRequest } from \"./request.js\";\nimport type { AgentServiceAction, AgentServiceCapabilities, AgentServiceRequest } from \"./service-types.js\";\n\nconst native = (name: string): FabricActionDescriptor => {\n const descriptor = AGENTS_ACTION_DESCRIPTORS.find((entry) => entry.name === name);\n if (!descriptor) throw new Error(`Missing native agent descriptor: ${name}`);\n return structuredClone(descriptor);\n};\nconst run = native(\"run\");\nconst properties = { ...(run.inputSchema as {properties: Record<string, unknown>}).properties };\nfor (const key of [\"transport\", \"persona\"]) delete properties[key];\nObject.assign(properties, {\n runner: {type: \"string\", enum: [\"pi\"]},\n kernel: {type: \"string\", enum: [\"typescript\", \"inherit\"]},\n extensions: {type: \"boolean\", const: true},\n worktree: {type: \"boolean\", const: false},\n timeoutMs: {type: \"number\", minimum: 1},\n cwd: {type: \"string\", description: \"Host-authorized placement selector; never resolved by Fabric\"},\n images: {type: \"array\", items: {type: \"object\", properties: {type: {const: \"image\"}, data: {type: \"string\"}, mimeType: {type: \"string\"}}, required: [\"type\", \"data\", \"mimeType\"], additionalProperties: false}},\n systemPrompt: {type: \"string\"},\n});\nconst runSchema = {type: \"object\", properties, required: [\"task\"], additionalProperties: false};\nconst spawnSchema = {type: \"object\", properties: {...properties, residency: {type: \"string\", enum: [\"session\", \"durable\"]}}, required: [\"task\"], additionalProperties: false};\nconst id = {type: \"string\", minLength: 1};\nconst object = (properties: Record<string, unknown>, required: string[] = []): Record<string, unknown> => ({type: \"object\", properties, required, additionalProperties: false});\n\nexport function agentServiceDescriptors(capabilities: AgentServiceCapabilities = {}): FabricActionDescriptor[] {\n const descriptors: FabricActionDescriptor[] = [\n {...run, description: \"Run one host-authorized Pi child and wait for its result or pause\", inputSchema: runSchema},\n {...native(\"spawn\"), description: \"Admit one host-authorized Pi child, or residency durable for an independent host worker\", inputSchema: spawnSchema},\n ...[\"wait\", \"status\", \"stop\"].map((name) => ({...native(name), inputSchema: object({id}, [\"id\"])})),\n {...native(\"list\"), description: \"List only the authenticated caller's direct children\", inputSchema: object({})},\n ];\n if (capabilities.steer) descriptors.push({...native(\"steer\"), inputSchema: object({id, message: {type: \"string\", minLength: 1}}, [\"id\", \"message\"])});\n if (capabilities.followUp) descriptors.push({...native(\"followUp\"), inputSchema: object({id, message: {type: \"string\", minLength: 1}}, [\"id\", \"message\"])});\n if (capabilities.compact) descriptors.push({...native(\"compact\"), inputSchema: object({id, instructions: {type: \"string\"}}, [\"id\"])});\n if (capabilities.resume) descriptors.push({name: \"resume\", description: \"Continue a paused, completed or failed direct child from its host checkpoint and wait for result or pause\", risk: \"agent\", inputSchema: object({id, task: {type: \"string\", minLength: 1}}, [\"id\"])});\n if (capabilities.topology) {\n descriptors.push(\n {...native(\"sessions\"), inputSchema: object({})},\n {...native(\"peers\"), inputSchema: object({})},\n {...native(\"self\"), inputSchema: object({})},\n {...native(\"members\"), inputSchema: object({})},\n {...native(\"create\"), description: \"Create a lasting session peer in this project\", inputSchema: object({name: {type: \"string\", minLength: 1}, instructions: {type: \"string\"}, task: {type: \"string\"}}, [\"name\"])},\n {...native(\"remove\"), description: \"Stop and remove a lasting session peer created in this project\", inputSchema: object({id: {type: \"string\", minLength: 1}, name: {type: \"string\"}}, [\"id\"])},\n );\n }\n return descriptors;\n}\n\nconst descriptors = agentServiceDescriptors({steer: true, compact: true, resume: true});\nconst normalize = actionArgNormalizer(() => descriptors);\nexport function agentServiceArgs(action: AgentServiceAction, input: Record<string, unknown>): Record<string, unknown> {\n const descriptor = descriptors.find((entry) => entry.name === action);\n if (!descriptor) throw new Error(`Unsupported hosted agents action: ${action}`);\n const args = normalize(action, input);\n if (!Value.Check(descriptor.inputSchema, args)) {\n const reasons = [...Value.Errors(descriptor.inputSchema, args)].slice(0, 5).map((error) => `${error.instancePath}: ${error.message}`);\n throw new Error(`Invalid hosted agents.${action} arguments: ${reasons.join(\"; \")}`);\n }\n return args;\n}\n\nexport function normalizeAgentServiceRequest(input: AgentServiceRequest): AgentServiceRequest {\n const {residency, ...rest} = input;\n const args = agentServiceArgs(\"run\", rest as unknown as Record<string, unknown>);\n const request = normalizeAgentRunRequest(args, {runner: \"pi\", timeoutMs: 0}) as AgentServiceRequest;\n if (args.images !== undefined) request.images = structuredClone(args.images) as NonNullable<AgentServiceRequest[\"images\"]>;\n if (args.systemPrompt !== undefined) request.systemPrompt = args.systemPrompt as string;\n if (residency === \"session\" || residency === \"durable\") request.residency = residency;\n assertAgentTask(request);\n return structuredClone(request);\n}\n", "import { AgentAdmission, beginAgentSettlement, createAgentLifecycle, finishAgentSettlement, terminalAgentStatuses, waitForAgent, type AgentLifecycleState } from \"./lifecycle.js\";\nimport { validateAgentResult } from \"./result.js\";\nimport { normalizeAgentServiceRequest } from \"./service-schema.js\";\nimport type { AgentAuthorityBoundary, AgentPublicRecord, AgentControlRequest, AgentExecutionEvent, AgentExecutionResponse, AgentServiceCapabilities, AgentServiceEvent, AgentServiceOptions, AgentServiceRecord, AgentServiceRequest, AgentSessionRecord, AgentServiceSnapshot } from \"./service-types.js\";\n\ntype Entry = {\n request: AgentServiceRequest;\n record: AgentServiceRecord;\n lifecycle: AgentLifecycleState<AgentServiceRecord>;\n controller: AbortController;\n done?: Promise<void>;\n stopping?: Promise<AgentPublicRecord>;\n resuming?: boolean;\n stopAck?: Promise<void>;\n pauseAck?: Promise<void>;\n suspendRequested?: boolean;\n executing?: boolean;\n stopReason?: \"stop\" | \"close\";\n controls?: Set<Promise<unknown>>;\n};\nconst copy = <T>(value: T): T => structuredClone(value);\nconst publicRecord = (record: AgentServiceRecord): AgentPublicRecord => {\n const keys = [\"id\", \"rootId\", \"parentId\", \"depth\", \"generation\", \"name\", \"task\", \"status\", \"runner\", \"kernel\", \"cwd\", \"model\", \"thinking\", \"recursive\", \"startedAt\", \"updatedAt\", \"finishedAt\", \"currentTool\", \"turns\", \"toolCalls\", \"text\", \"value\", \"error\", \"usage\", \"sessionId\"] as const;\n return copy(Object.fromEntries(keys.filter((key) => record[key] !== undefined).map((key) => [key, record[key]]))) as AgentPublicRecord;\n};\nconst errorText = (error: unknown): string => error instanceof Error ? error.message : String(error);\nconst idle = (): AgentLifecycleState<AgentServiceRecord> => ({settled: true, result: undefined, resolve: undefined, release() {}, abortSignal: undefined, abortHandler: undefined});\n\n/** Portable one-shot agent authority. The execution port runs one participant, never a tree. */\nexport class AgentService {\n readonly #options: AgentServiceOptions;\n readonly #entries = new Map<string, Entry>();\n readonly #admission: AgentAdmission;\n readonly #pending = new Map<AbortController, Promise<unknown>>();\n readonly #closing = new AbortController();\n #close: Promise<void> | undefined;\n #suspend: Promise<void> | undefined;\n #suspended = false;\n #sequence = 0;\n #publication: Promise<void> = Promise.resolve();\n readonly capabilities: AgentServiceCapabilities;\n\n constructor(options: AgentServiceOptions) {\n if (!options.rootId) throw new Error(\"Agent service requires a trusted rootId\");\n for (const [key, value] of Object.entries({maxStarts: options.maxStarts ?? 8, maxDepth: options.maxDepth ?? 3, maxConcurrent: options.maxConcurrent ?? 4})) {\n if (!Number.isSafeInteger(value) || value < 1) throw new Error(`${key} must be a positive integer`);\n }\n this.#options = {...options, port: options.port};\n this.#admission = new AgentAdmission(options.maxConcurrent ?? 4, options.maxStarts ?? 8, options.maxDepth ?? 3);\n this.capabilities = Object.freeze({\n steer: Boolean(options.port.steer || options.topology),\n compact: Boolean(options.port.compact),\n resume: Boolean(options.port.resume),\n followUp: Boolean(options.port.followUp || options.topology),\n topology: Boolean(options.topology),\n });\n if (options.snapshot) this.#restore(options.snapshot);\n }\n\n snapshot(): AgentServiceSnapshot {\n return copy({version: 1, rootId: this.#options.rootId, starts: this.#admission.starts, sequence: this.#sequence,\n records: [...this.#entries.values()].map(({request, record}) => ({request, record}))});\n }\n\n async run(callerId: string, request: AgentServiceRequest, signal?: AbortSignal): Promise<AgentPublicRecord> {\n const handle = await this.spawn(callerId, request, signal);\n return this.wait(callerId, handle.id, signal);\n }\n\n async spawn(callerId: string, request: AgentServiceRequest, signal?: AbortSignal): Promise<AgentPublicRecord | AgentSessionRecord> {\n const normalized = normalizeAgentServiceRequest(request);\n if (normalized.residency === \"durable\") {\n await this.#authorize(callerId);\n const dispatch = this.#topology().dispatch;\n if (!dispatch) throw new Error(\"Durable hosted spawn is unavailable\");\n const record = await dispatch({callerId, request: normalized, ...(signal ? {signal} : {})});\n await this.#authorize(callerId);\n return copy(record);\n }\n return this.#start(callerId, normalized, undefined, signal);\n }\n\n async wait(callerId: string, id: string, signal?: AbortSignal): Promise<AgentPublicRecord> {\n await this.#authorize(callerId);\n const entry = this.#child(callerId, id);\n const result = entry.lifecycle.result ?? Promise.resolve(copy(entry.record));\n const record = await waitForAgent(result, signal);\n await this.#authorize(callerId);\n return publicRecord(record);\n }\n\n async status(callerId: string, id: string): Promise<AgentPublicRecord> {\n await this.#authorize(callerId);\n return publicRecord(this.#child(callerId, id).record);\n }\n\n async list(callerId: string): Promise<AgentPublicRecord[]> {\n await this.#authorize(callerId);\n return [...this.#entries.values()].filter((entry) => entry.record.parentId === callerId).map((entry) => publicRecord(entry.record));\n }\n\n async stop(callerId: string, id: string): Promise<AgentPublicRecord> {\n await this.#authorize(callerId);\n const result = await this.#stop(this.#child(callerId, id));\n await this.#authorize(callerId);\n return publicRecord(result);\n }\n\n async steer(callerId: string, id: string, message: string): Promise<AgentPublicRecord | AgentSessionRecord> {\n if (!message.trim()) throw new Error(\"Steering message must not be empty\");\n const child = this.#ownedChild(callerId, id);\n if (child) {\n if (!this.#options.port.steer) throw new Error(\"Hosted agents.steer is unsupported\");\n return this.#control(callerId, child.record.id, \"steer\", (request) => this.#options.port.steer!({...request, message}));\n }\n return this.#deliver(callerId, id, \"steer\", message);\n }\n\n async followUp(callerId: string, id: string, message: string): Promise<AgentPublicRecord | AgentSessionRecord> {\n if (!message.trim()) throw new Error(\"Follow-up message must not be empty\");\n const child = this.#ownedChild(callerId, id);\n if (child) {\n if (!this.#options.port.followUp) throw new Error(\"Hosted agents.followUp is unsupported\");\n if (child.record.status === \"running\" && !child.stopping) {\n return this.#control(callerId, child.record.id, \"followUp\", (request) => this.#options.port.followUp!({...request, message}));\n }\n await this.#authorize(callerId);\n await this.#options.port.followUp({...this.#identity(child), message});\n await this.#authorize(callerId);\n return publicRecord(child.record);\n }\n return this.#deliver(callerId, id, \"followUp\", message);\n }\n\n async sessions(callerId: string): Promise<AgentSessionRecord[]> {\n await this.#authorize(callerId);\n return copy(await this.#topology().sessions());\n }\n\n async peers(callerId: string): Promise<AgentSessionRecord[]> {\n await this.#authorize(callerId);\n return copy(await this.#topology().peers(callerId));\n }\n\n async self(callerId: string): Promise<AgentSessionRecord> {\n await this.#authorize(callerId);\n if (this.#options.topology) return copy(await this.#options.topology.self(callerId));\n const child = callerId === this.#options.rootId ? undefined : this.#entries.get(callerId);\n return {\n id: callerId,\n name: child?.record.name ?? \"main\",\n kind: callerId === this.#options.rootId ? \"root\" : \"agent\",\n status: child?.record.status ?? \"running\",\n capabilities: callerId === this.#options.rootId ? [\"steer\", \"followUp\", \"stop\"] : [\"steer\", \"followUp\", \"stop\"],\n };\n }\n\n async create(callerId: string, request: { name: string; instructions?: string; task?: string }, signal?: AbortSignal): Promise<AgentSessionRecord> {\n if (!request.name.trim()) throw new Error(\"Peer name is required\");\n await this.#authorize(callerId);\n const create = this.#topology().create;\n if (!create) throw new Error(\"Hosted agents.create is unavailable\");\n const record = await create({callerId, name: request.name.trim(), ...(request.instructions ? {instructions: request.instructions} : {}), ...(request.task ? {task: request.task} : {}), ...(signal ? {signal} : {})});\n await this.#authorize(callerId);\n return copy(record);\n }\n\n async remove(callerId: string, id: string, name?: string, signal?: AbortSignal): Promise<AgentSessionRecord> {\n if (!id.trim()) throw new Error(\"Peer id is required\");\n await this.#authorize(callerId);\n const remove = this.#topology().remove;\n if (!remove) throw new Error(\"Hosted agents.remove is unavailable\");\n const record = await remove({callerId, id, ...(name ? {name} : {}), ...(signal ? {signal} : {})});\n await this.#authorize(callerId);\n return copy(record);\n }\n\n async members(callerId: string): Promise<AgentSessionRecord[]> {\n await this.#authorize(callerId);\n const sessions = this.#options.topology ? copy(await this.#options.topology.sessions()) : [];\n const seen = new Set(sessions.map((item) => item.id));\n const children: AgentSessionRecord[] = [];\n for (const entry of this.#entries.values()) {\n if (seen.has(entry.record.id)) continue;\n children.push({\n id: entry.record.id,\n name: entry.record.name,\n kind: \"agent\",\n status: entry.record.status,\n capabilities: [\"steer\", \"followUp\", \"stop\"],\n });\n }\n return [...sessions, ...children];\n }\n\n async compact(callerId: string, id: string, instructions?: string): Promise<AgentPublicRecord> {\n if (!this.#options.port.compact) throw new Error(\"Hosted agents.compact is unsupported\");\n return this.#control(callerId, id, \"compact\", (request) => this.#options.port.compact!({...request, ...(instructions !== undefined ? {instructions} : {})}));\n }\n\n async resume(callerId: string, id: string, task?: string, signal?: AbortSignal): Promise<AgentPublicRecord> {\n if (!this.#options.port.resume) throw new Error(\"Hosted agents.resume is unsupported\");\n await this.#authorize(callerId);\n const entry = this.#child(callerId, id);\n if (![\"paused\", \"completed\", \"failed\"].includes(entry.record.status) || !entry.lifecycle.settled || entry.resuming || entry.stopping) throw new Error(\"Only an idle paused, completed or failed agent can resume\");\n entry.resuming = true;\n try {\n const request = normalizeAgentServiceRequest({...entry.request, ...(task !== undefined ? {task} : {})});\n await this.#start(callerId, request, entry, signal);\n return await this.wait(callerId, id, signal);\n } finally { entry.resuming = false; }\n }\n\n /** Natural root completion waits for all background descendants without fencing live parents. */\n async drain(): Promise<void> {\n for (;;) {\n const work: Promise<unknown>[] = [...this.#pending.values()];\n for (const entry of this.#entries.values()) {\n if (entry.lifecycle.result && entry.done) work.push(entry.done);\n }\n if (work.length === 0) return;\n await Promise.allSettled(work);\n }\n }\n\n /** Host-only graceful pause. The port, not the owner signal, quiesces participant effects. */\n suspend(): Promise<void> {\n if (this.#suspend) return this.#suspend;\n if (this.#closing.signal.aborted) return Promise.reject(new Error(\"Agent service is closed\"));\n if (!this.#options.port.pause && [...this.#entries.values()].some((entry) => !entry.lifecycle.settled)) {\n return Promise.reject(new Error(\"Hosted agent suspension requires port.pause\"));\n }\n this.#suspended = true;\n for (const entry of this.#entries.values()) {\n if (!entry.lifecycle.settled && !terminalAgentStatuses.has(entry.record.status)) entry.suspendRequested = true;\n }\n for (const controller of this.#pending.keys()) controller.abort();\n this.#suspend = (async () => {\n const roots = [...this.#entries.values()].filter((entry) => entry.record.parentId === this.#options.rootId);\n const paused = await Promise.allSettled(roots.map((entry) => this.#pause(entry)));\n await Promise.allSettled([...this.#pending.values()]);\n const errors = paused.filter((result): result is PromiseRejectedResult => result.status === \"rejected\");\n if (errors.length) throw new AggregateError(errors.map((result) => result.reason), \"Agent suspension failed\");\n await this.drain();\n })();\n return this.#suspend;\n }\n\n async #pause(entry: Entry): Promise<void> {\n const children = [...this.#entries.values()].filter((child) => child.record.parentId === entry.record.id);\n const paused = await Promise.allSettled(children.map((child) => this.#pause(child)));\n const errors = paused.filter((result): result is PromiseRejectedResult => result.status === \"rejected\").map((result) => result.reason);\n if (errors.length) throw new AggregateError(errors, \"Agent descendant suspension failed\");\n if (entry.executing && !entry.stopping) {\n entry.pauseAck = Promise.resolve().then(async () => {\n if (entry.executing && !entry.stopping) await this.#options.port.pause!(this.#identity(entry));\n });\n try { await entry.pauseAck; }\n catch (error) { throw new AggregateError([...errors, error], \"Agent pause acknowledgment failed\"); }\n }\n await entry.done;\n }\n\n close(): Promise<void> {\n if (this.#close) return this.#close;\n this.#closing.abort();\n for (const controller of this.#pending.keys()) controller.abort();\n this.#close = (async () => {\n const errors: unknown[] = [];\n const stopped = await Promise.allSettled([...this.#entries.values()].map((entry) => this.#stop(entry, true)));\n for (const result of stopped) if (result.status === \"rejected\") errors.push(result.reason);\n await Promise.allSettled([...this.#pending.values()]);\n if (errors.length) throw new AggregateError(errors, \"Agent shutdown failed\");\n })();\n return this.#close;\n }\n\n #start(callerId: string, request: AgentServiceRequest, previous?: Entry, signal?: AbortSignal): Promise<AgentPublicRecord> {\n const controller = new AbortController();\n const abort = () => controller.abort();\n signal?.addEventListener(\"abort\", abort, {once: true});\n if (signal?.aborted || this.#closing.signal.aborted || this.#suspended) controller.abort();\n const operation = (async () => {\n let release: (() => void) | undefined;\n try {\n await this.#authorize(callerId);\n const depth = this.#depth(callerId);\n if (controller.signal.aborted) throw new Error(\"Operation aborted\");\n if (depth > this.#admission.maxDepth) throw new Error(`Fabric agent depth limit reached (${this.#admission.maxDepth})`);\n const id = previous?.record.id ?? crypto.randomUUID().replaceAll(\"-\", \"\");\n const generation = (previous?.record.generation ?? 0) + 1;\n const prepare = {id, generation, rootId: this.#options.rootId, parentId: callerId, depth, request: copy(request), signal: controller.signal};\n const binding = await this.#options.port.prepare?.(prepare);\n release = await this.#admission.acquire(callerId, controller.signal);\n await this.#authorize(callerId);\n this.#depth(callerId);\n if (controller.signal.aborted || this.#closing.signal.aborted || previous?.stopping) throw new Error(\"Agent admission aborted\");\n // No await between the final authority/parent check and the root-wide charge.\n this.#admission.admit(depth);\n const now = Date.now();\n const record: AgentServiceRecord = previous ? {\n ...previous.record, task: request.task, status: \"queued\", generation: previous.record.generation + 1,\n text: \"\", turns: 0, toolCalls: 0, updatedAt: now,\n } : {\n id, rootId: this.#options.rootId, parentId: callerId, depth, generation: 1,\n name: (request.name ?? request.task.split(\"\\n\", 1)[0] ?? \"Fabric agent\").replace(/[\\r\\n\\t]+/g, \" \").trim().slice(0, 60) || \"Fabric agent\",\n task: request.task, status: \"queued\", runner: \"pi\", kernel: \"typescript\", startedAt: now, updatedAt: now,\n turns: 0, toolCalls: 0, text: \"\", usage: {input: 0, output: 0, cacheRead: 0, cacheWrite: 0, cost: 0},\n ...(request.model ? {model: request.model} : {}), ...(request.thinking ? {thinking: request.thinking} : {}),\n ...(request.cwd !== undefined ? {cwd: request.cwd} : {}), ...(request.recursive !== undefined ? {recursive: request.recursive} : {}),\n };\n delete record.finishedAt; delete record.error; delete record.value; delete record.currentTool;\n const entry: Entry = previous ?? {request, record, lifecycle: idle(), controller};\n entry.request = copy(request); entry.record = record; entry.controller = controller;\n entry.lifecycle = createAgentLifecycle<AgentServiceRecord>(release);\n release = undefined;\n this.#entries.set(record.id, entry);\n this.#pending.delete(controller);\n // Admission cancellation detaches here. Background execution has a distinct owner signal.\n signal?.removeEventListener(\"abort\", abort);\n let acknowledge!: () => void;\n const admitted = new Promise<void>((resolve) => { acknowledge = resolve; });\n entry.done = this.#drive(entry, binding, Boolean(previous), acknowledge);\n await admitted;\n await this.#authorize(callerId);\n return publicRecord(record);\n } finally {\n release?.();\n signal?.removeEventListener(\"abort\", abort);\n }\n })();\n this.#pending.set(controller, operation);\n void operation.finally(() => this.#pending.delete(controller)).catch(() => {});\n return operation;\n }\n\n async #drive(entry: Entry, binding: unknown, resume: boolean, admitted: () => void): Promise<void> {\n const generation = entry.record.generation;\n let timer: ReturnType<typeof setTimeout> | undefined;\n let timeout = false;\n let responded = false;\n try {\n await this.#publish(\"admitted\", entry);\n admitted();\n await this.#authorize(entry.record.parentId);\n if (entry.controller.signal.aborted) throw new Error(\"Agent start aborted\");\n entry.record.status = \"running\";\n await this.#publish(\"running\", entry);\n await this.#authorize(entry.record.parentId);\n if (entry.controller.signal.aborted) throw new Error(\"Agent start aborted\");\n const request = {\n ...this.#identity(entry), depth: entry.record.depth, request: copy(entry.request), signal: entry.controller.signal,\n binding, ...(entry.record.checkpoint !== undefined ? {checkpoint: copy(entry.record.checkpoint)} : {}),\n emit: async (event: AgentExecutionEvent) => {\n const assertCurrent = () => {\n if (!entry.executing || entry.lifecycle.settled || entry.controller.signal.aborted || entry.record.generation !== generation || entry.record.status !== \"running\") throw new Error(\"Stale agent execution event\");\n };\n assertCurrent();\n if (event.type !== \"checkpoint\" && event.type !== \"progress\") throw new Error(\"Unsupported agent execution event\");\n const saved = copy(event);\n await this.#publish(saved.type, entry, undefined, () => {\n if (saved.type === \"checkpoint\") entry.record.checkpoint = saved.checkpoint;\n else {\n for (const key of [\"text\", \"turns\", \"toolCalls\", \"currentTool\", \"usage\"] as const) {\n if (saved[key] !== undefined) Object.assign(entry.record, {[key]: saved[key]});\n }\n }\n }, assertCurrent);\n },\n };\n if (entry.request.timeoutMs) timer = setTimeout(() => {\n if (entry.suspendRequested) return;\n timeout = true;\n void this.#stop(entry).catch(() => {});\n }, entry.request.timeoutMs);\n const execute = resume ? this.#options.port.resume! : this.#options.port.execute;\n entry.executing = true;\n let response: AgentExecutionResponse;\n try { response = await execute.call(this.#options.port, request); }\n finally { entry.executing = false; }\n if (![\"completed\", \"failed\", \"stopped\", \"timed_out\", \"paused\"].includes(response.status)) throw new Error(\"Invalid agent execution response status\");\n await this.#authorize(entry.record.parentId, response.status === \"paused\" ? {checkpoint: true} : undefined);\n if (entry.record.generation !== generation || entry.lifecycle.settled) throw new Error(\"Stale agent execution response\");\n this.#applyResponse(entry, response);\n responded = true;\n } catch (error) {\n entry.record.status = \"failed\";\n entry.record.error = errorText(error);\n } finally {\n admitted();\n if (timer) clearTimeout(timer);\n await Promise.allSettled([...(entry.controls ?? []), ...(entry.stopAck ? [entry.stopAck] : []), ...(entry.pauseAck ? [entry.pauseAck] : [])]);\n if (entry.suspendRequested && !entry.controller.signal.aborted) {\n entry.record.status = \"paused\"; delete entry.record.error; delete entry.record.finishedAt;\n }\n if (entry.controller.signal.aborted) {\n if (entry.stopReason === \"close\") {\n if (!responded || ![\"completed\", \"failed\"].includes(entry.record.status)) { entry.record.status = \"paused\"; delete entry.record.error; }\n } else entry.record.status = timeout ? \"timed_out\" : \"stopped\";\n }\n try { await this.#options.port.cleanup?.(this.#identity(entry)); }\n catch (error) { entry.record.status = \"failed\"; entry.record.error = `Agent cleanup failed: ${errorText(error)}`; }\n validateAgentResult(entry.record, entry.request.schema);\n delete entry.record.currentTool;\n if (terminalAgentStatuses.has(entry.record.status)) entry.record.finishedAt = Date.now();\n if (beginAgentSettlement(entry.lifecycle)) {\n try { await this.#publish(\"settled\", entry); }\n catch (error) { entry.record.status = \"failed\"; entry.record.error = `Agent publication failed: ${errorText(error)}`; }\n finishAgentSettlement(entry.lifecycle, copy(entry.record));\n }\n }\n }\n\n #applyResponse(entry: Entry, response: AgentExecutionResponse): void {\n // Port output cannot overwrite host-owned identifiers, lineage or admission metadata.\n entry.record.status = response.status;\n for (const key of [\"text\", \"value\", \"error\", \"usage\", \"checkpoint\", \"sessionId\"] as const) {\n if (response[key] !== undefined) Object.assign(entry.record, {[key]: copy(response[key])});\n }\n }\n\n #stop(entry: Entry, preservePaused = false): Promise<AgentPublicRecord> {\n if (entry.stopping) return entry.stopping;\n entry.stopReason = preservePaused ? \"close\" : \"stop\";\n const work = (async () => {\n const active = !entry.lifecycle.settled;\n entry.controller.abort();\n const descendants = [...this.#entries.values()].filter((child) => child.record.parentId === entry.record.id);\n const operations: Promise<unknown>[] = descendants.map((child) => this.#stop(child, preservePaused));\n if (active && this.#options.port.stop) {\n entry.stopAck = Promise.resolve().then(() => this.#options.port.stop!(this.#identity(entry)));\n operations.push(entry.stopAck);\n }\n if (entry.done) operations.push(entry.done);\n const settled = await Promise.allSettled(operations);\n if (entry.record.status === \"paused\" && !preservePaused) {\n entry.record.status = \"stopped\"; entry.record.finishedAt = Date.now();\n await this.#publish(\"settled\", entry);\n }\n const errors = settled.filter((result): result is PromiseRejectedResult => result.status === \"rejected\");\n if (errors.length) throw new AggregateError(errors.map((result) => result.reason), \"Agent stop failed\");\n return publicRecord(entry.record);\n })();\n entry.stopping = work;\n return work;\n }\n\n async #control(callerId: string, id: string, control: \"steer\" | \"compact\" | \"followUp\", invoke: (request: AgentControlRequest) => Promise<void>): Promise<AgentPublicRecord> {\n await this.#authorize(callerId);\n const entry = this.#child(callerId, id);\n if (entry.record.status !== \"running\" || entry.stopping) throw new Error(\"Agent is not running\");\n const generation = entry.record.generation;\n const pending = Promise.resolve().then(async () => {\n await this.#authorize(callerId);\n if (entry.record.generation !== generation || entry.controller.signal.aborted || entry.lifecycle.settled) throw new Error(\"Stale agent control\");\n await invoke(this.#identity(entry));\n });\n (entry.controls ??= new Set()).add(pending);\n try { await pending; } finally { entry.controls.delete(pending); }\n await this.#authorize(callerId);\n if (entry.record.generation !== generation || entry.controller.signal.aborted) throw new Error(\"Stale agent control acknowledgment\");\n await this.#publish(\"control\", entry, control);\n return publicRecord(entry.record);\n }\n\n #identity(entry: Entry): AgentControlRequest {\n const {id, rootId, parentId, generation} = entry.record;\n return {id, rootId, parentId, generation};\n }\n\n async #authorize(callerId: string, boundary?: AgentAuthorityBoundary): Promise<void> {\n if (callerId !== this.#options.rootId && !this.#entries.has(callerId)) throw new Error(\"Unknown agent caller\");\n if (this.#suspended && !boundary?.checkpoint) throw new Error(\"Agent service is paused\");\n await this.#options.assertAuthority?.(callerId, boundary);\n if (this.#suspended && !boundary?.checkpoint) throw new Error(\"Agent service is paused\");\n }\n\n #child(callerId: string, id: string): Entry {\n const entry = this.#ownedChild(callerId, id);\n if (!entry) throw new Error(`Unknown direct child agent: ${id}`);\n return entry;\n }\n\n #ownedChild(callerId: string, id: string): Entry | undefined {\n const entry = this.#entries.get(id);\n return entry && entry.record.parentId === callerId ? entry : undefined;\n }\n\n #topology(): NonNullable<AgentServiceOptions[\"topology\"]> {\n if (!this.#options.topology) throw new Error(\"Hosted agent topology is unavailable\");\n return this.#options.topology;\n }\n\n async #deliver(callerId: string, id: string, operation: \"steer\" | \"followUp\", message: string): Promise<AgentSessionRecord> {\n const topology = this.#topology();\n await this.#authorize(callerId);\n const target = id === \"main\" ? this.#options.rootId : id;\n const record = await topology.deliver({callerId, id: target, operation, message});\n await this.#authorize(callerId);\n return copy(record);\n }\n\n #depth(callerId: string): number {\n if (this.#closing.signal.aborted) throw new Error(\"Agent service is closed\");\n if (this.#suspended) throw new Error(\"Agent service is paused\");\n if (callerId === this.#options.rootId) return 1;\n const parent = this.#entries.get(callerId);\n if (!parent || parent.record.status !== \"running\" || parent.stopping || parent.controller.signal.aborted || parent.request.recursive === false) throw new Error(\"Agent parent cannot admit children\");\n return parent.record.depth + 1;\n }\n\n async #publish(type: AgentServiceEvent[\"type\"], entry: Entry, control?: AgentServiceEvent[\"control\"], update?: () => void, assertCurrent?: () => void): Promise<void> {\n const boundary = type === \"checkpoint\" || type === \"settled\" ? {checkpoint: true} : undefined;\n const generation = entry.record.generation;\n await this.#authorize(entry.record.parentId, boundary);\n const publication = this.#publication.then(async () => {\n await this.#authorize(entry.record.parentId, boundary);\n if (entry.record.generation !== generation) throw new Error(\"Stale agent publication\");\n assertCurrent?.();\n // Commit event mutations only after serialized, phase-matched lease authorization.\n update?.();\n entry.record.updatedAt = Date.now();\n const event: AgentServiceEvent = {version: 1, sequence: ++this.#sequence, type, record: copy(entry.record), ...(control ? {control} : {})};\n await this.#options.onEvent?.(event);\n });\n this.#publication = publication.catch(() => {});\n await publication;\n }\n\n #restore(snapshot: AgentServiceSnapshot): void {\n const saved = copy(snapshot);\n const newRoot = this.#options.restorePolicy === \"new-root\";\n if (newRoot && saved.rootId !== this.#options.rootId) {\n const oldRoot = saved.rootId;\n saved.rootId = this.#options.rootId;\n for (const {record} of saved.records) {\n if (record.rootId !== oldRoot) throw new Error(\"Invalid agent snapshot root\");\n record.rootId = saved.rootId;\n if (record.parentId === oldRoot) record.parentId = saved.rootId;\n }\n }\n if (saved.version !== 1 || saved.rootId !== this.#options.rootId || !Number.isSafeInteger(saved.starts) || saved.starts < 0 || (!newRoot && saved.starts > this.#admission.maxStarts) || !Number.isSafeInteger(saved.sequence) || saved.sequence < 0 || !Array.isArray(saved.records)) throw new Error(\"Invalid agent service snapshot\");\n let generations = 0;\n for (const item of saved.records) {\n const request = normalizeAgentServiceRequest(item.request);\n const record = item.record;\n if (!record.id || record.id === saved.rootId || this.#entries.has(record.id) || record.rootId !== saved.rootId || !Number.isSafeInteger(record.depth) || record.depth < 1 || record.depth > this.#admission.maxDepth || !Number.isSafeInteger(record.generation) || record.generation < 1 || ![\"queued\", \"running\", \"paused\", ...terminalAgentStatuses].includes(record.status)) throw new Error(\"Invalid agent snapshot record\");\n generations += record.generation;\n if (record.status === \"running\" || record.status === \"queued\") { record.status = \"paused\"; delete record.finishedAt; }\n this.#entries.set(record.id, {request, record, lifecycle: idle(), controller: new AbortController()});\n }\n for (const {record} of this.#entries.values()) {\n const parent = this.#entries.get(record.parentId);\n if (record.parentId === saved.rootId ? record.depth !== 1 : !parent || parent.record.depth + 1 !== record.depth) throw new Error(\"Invalid agent snapshot lineage\");\n }\n if (saved.starts > generations) throw new Error(\"Invalid agent snapshot admission count\");\n this.#admission.starts = newRoot ? 0 : saved.starts;\n this.#sequence = saved.sequence;\n }\n}\n", "import type { FabricProvider } from \"../protocol.js\";\nimport { AgentService } from \"./service.js\";\nimport { agentServiceArgs, agentServiceDescriptors } from \"./service-schema.js\";\nimport type { AgentServiceAction, AgentServiceCapabilities, AgentServiceClient, AgentServiceDispatcher, AgentPublicRecord, AgentServiceRequest, AgentSessionRecord } from \"./service-types.js\";\n\n/** Bind only authenticated host identity here. Guest arguments never carry the caller. */\nexport function createAgentServiceHandler(service: AgentService, callerId: string): AgentServiceDispatcher {\n return async (action, input, signal) => {\n const args = agentServiceArgs(action, input);\n switch (action) {\n case \"run\": return service.run(callerId, args as unknown as AgentServiceRequest, signal);\n case \"spawn\": return service.spawn(callerId, args as unknown as AgentServiceRequest, signal);\n case \"wait\": return service.wait(callerId, args.id as string, signal);\n case \"status\": return service.status(callerId, args.id as string);\n case \"list\": return service.list(callerId);\n case \"stop\": return service.stop(callerId, args.id as string);\n case \"steer\": return service.steer(callerId, args.id as string, args.message as string);\n case \"followUp\": return service.followUp(callerId, args.id as string, args.message as string);\n case \"compact\": return service.compact(callerId, args.id as string, args.instructions as string | undefined);\n case \"resume\": return service.resume(callerId, args.id as string, args.task as string | undefined, signal);\n case \"sessions\": return service.sessions(callerId);\n case \"peers\": return service.peers(callerId);\n case \"self\": return service.self(callerId);\n case \"members\": return service.members(callerId);\n case \"create\": return service.create(callerId, args as {name: string; instructions?: string; task?: string}, signal);\n case \"remove\": return service.remove(callerId, args.id as string, args.name as string | undefined, signal);\n default: throw new Error(`Unsupported hosted agents action: ${String(action)}`);\n }\n };\n}\n\n/** A transport client only; all admission and lifecycle remain in the root service. */\nexport function createAgentServiceClient(dispatch: AgentServiceDispatcher, capabilities: AgentServiceCapabilities = {}): AgentServiceClient {\n const record = (action: AgentServiceAction, args: Record<string, unknown>, signal?: AbortSignal) => dispatch(action, args, signal) as Promise<AgentPublicRecord>;\n return {\n capabilities: Object.freeze({...capabilities}), dispatch,\n run: (request, signal) => record(\"run\", request as unknown as Record<string, unknown>, signal),\n spawn: (request, signal) => record(\"spawn\", request as unknown as Record<string, unknown>, signal),\n wait: (id, signal) => record(\"wait\", {id}, signal),\n status: (id) => record(\"status\", {id}),\n list: () => dispatch(\"list\", {}) as Promise<AgentPublicRecord[]>,\n stop: (id) => record(\"stop\", {id}),\n steer: (id, message) => record(\"steer\", {id, message}),\n compact: (id, instructions) => record(\"compact\", {id, ...(instructions !== undefined ? {instructions} : {})}),\n resume: (id, task, signal) => record(\"resume\", {id, ...(task !== undefined ? {task} : {})}, signal),\n followUp: (id, message) => record(\"followUp\", {id, message}),\n sessions: () => dispatch(\"sessions\", {}) as Promise<AgentSessionRecord[]>,\n peers: () => dispatch(\"peers\", {}) as Promise<AgentSessionRecord[]>,\n self: () => dispatch(\"self\", {}) as Promise<AgentSessionRecord>,\n members: () => dispatch(\"members\", {}) as Promise<AgentSessionRecord[]>,\n create: (request, signal) => dispatch(\"create\", request as unknown as Record<string, unknown>, signal) as Promise<AgentSessionRecord>,\n remove: (id, name, signal) => dispatch(\"remove\", {id, ...(name !== undefined ? {name} : {})}, signal) as Promise<AgentSessionRecord>,\n };\n}\n\nexport function createAgentsProvider(client: AgentServiceClient): FabricProvider {\n const descriptors = agentServiceDescriptors(client.capabilities);\n const allowed = new Set(descriptors.map((descriptor) => descriptor.name));\n const validate = (action: string, args: Record<string, unknown>) => {\n if (!allowed.has(action)) throw new Error(`Unsupported hosted agents action: ${action}`);\n return agentServiceArgs(action as AgentServiceAction, args);\n };\n return {\n name: \"agents\", description: \"Fabric host-authorized Pi agents\",\n list: async () => structuredClone(descriptors),\n describe: async (name) => structuredClone(descriptors.find((descriptor) => descriptor.name === name)),\n prepareArguments: (action, args) => validate(action, args),\n invoke: async (action, args, context) => client.dispatch(action as AgentServiceAction, validate(action, args), context.signal),\n };\n}\n", "/** Portable hosted agents: no local manager, filesystem, model registry or ambient configuration. */\nexport { AgentService } from \"./agents/service.js\";\nexport { createAgentsProvider, createAgentServiceClient, createAgentServiceHandler } from \"./agents/service-provider.js\";\nexport { agentServiceDescriptors } from \"./agents/service-schema.js\";\nexport type * from \"./agents/service-types.js\";\nexport type { AgentRunRequest, AgentRunRecord, AgentRunResult, AgentHandleInfo, AgentUsage } from \"./agents/types.js\";\nexport const HOSTED_AGENTS_PROTOCOL_VERSION = 1 as const;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,aAAa;AAQtB,IAAM,SAAS,CAAC,SAAyC;AACvD,QAAM,aAAa,0BAA0B,KAAK,CAAC,UAAU,MAAM,SAAS,IAAI;AAChF,MAAI,CAAC,WAAY,OAAM,IAAI,MAAM,oCAAoC,IAAI,EAAE;AAC3E,SAAO,gBAAgB,UAAU;AACnC;AACA,IAAM,MAAM,OAAO,KAAK;AACxB,IAAM,aAAa,EAAE,GAAI,IAAI,YAAsD,WAAW;AAC9F,WAAW,OAAO,CAAC,aAAa,SAAS,EAAG,QAAO,WAAW,GAAG;AACjE,OAAO,OAAO,YAAY;AAAA,EACxB,QAAQ,EAAC,MAAM,UAAU,MAAM,CAAC,IAAI,EAAC;AAAA,EACrC,QAAQ,EAAC,MAAM,UAAU,MAAM,CAAC,cAAc,SAAS,EAAC;AAAA,EACxD,YAAY,EAAC,MAAM,WAAW,OAAO,KAAI;AAAA,EACzC,UAAU,EAAC,MAAM,WAAW,OAAO,MAAK;AA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C;AAAA,IAC/B,SAAS,MAAM,SAAS,WAAW,CAAC,CAAC;AAAA,IACrC,QAAQ,CAAC,SAAS,WAAW,SAAS,UAAU,SAA+C,MAAM;AAAA,IACrG,QAAQ,CAACA,KAAI,MAAM,WAAW,SAAS,UAAU,EAAC,IAAAA,KAAI,GAAI,SAAS,SAAY,EAAC,KAAI,IAAI,CAAC,EAAE,GAAG,MAAM;AAAA,EACtG;AACF;AAEO,SAAS,qBAAqB,QAA4C;AAC/E,QAAMC,eAAc,wBAAwB,OAAO,YAAY;AAC/D,QAAM,UAAU,IAAI,IAAIA,aAAY,IAAI,CAAC,eAAe,WAAW,IAAI,CAAC;AACxE,QAAM,WAAW,CAAC,QAAgB,SAAkC;AAClE,QAAI,CAAC,QAAQ,IAAI,MAAM,EAAG,OAAM,IAAI,MAAM,qCAAqC,MAAM,EAAE;AACvF,WAAO,iBAAiB,QAA8B,IAAI;AAAA,EAC5D;AACA,SAAO;AAAA,IACL,MAAM;AAAA,IAAU,aAAa;AAAA,IAC7B,MAAM,YAAY,gBAAgBA,YAAW;AAAA,IAC7C,UAAU,OAAO,SAAS,gBAAgBA,aAAY,KAAK,CAAC,eAAe,WAAW,SAAS,IAAI,CAAC;AAAA,IACpG,kBAAkB,CAAC,QAAQ,SAAS,SAAS,QAAQ,IAAI;AAAA,IACzD,QAAQ,OAAO,QAAQ,MAAM,YAAY,OAAO,SAAS,QAA8B,SAAS,QAAQ,IAAI,GAAG,QAAQ,MAAM;AAAA,EAC/H;AACF;;;AC/DO,IAAM,iCAAiC;",
4
+ "sourcesContent": ["import { Value } from \"typebox/value\";\nimport { AGENTS_ACTION_DESCRIPTORS } from \"../providers/agents-actions.js\";\nimport { actionArgNormalizer } from \"../providers/arg-normalization.js\";\nimport type { FabricActionDescriptor } from \"../protocol.js\";\nimport { assertAgentTask } from \"./lifecycle.js\";\nimport { normalizeAgentRunRequest } from \"./request.js\";\nimport type { AgentServiceAction, AgentServiceCapabilities, AgentServiceRequest } from \"./service-types.js\";\n\nconst native = (name: string): FabricActionDescriptor => {\n const descriptor = AGENTS_ACTION_DESCRIPTORS.find((entry) => entry.name === name);\n if (!descriptor) throw new Error(`Missing native agent descriptor: ${name}`);\n return structuredClone(descriptor);\n};\nconst run = native(\"run\");\nconst properties = { ...(run.inputSchema as {properties: Record<string, unknown>}).properties };\nfor (const key of [\"transport\", \"persona\"]) delete properties[key];\nObject.assign(properties, {\n runner: {type: \"string\", enum: [\"pi\"]},\n kernel: {type: \"string\", enum: [\"typescript\", \"inherit\"]},\n extensions: {type: \"boolean\", const: true},\n worktree: {type: \"boolean\", const: false},\n timeoutMs: {type: \"number\", minimum: 1},\n cwd: {type: \"string\", description: \"Host-authorized placement selector; never resolved by Fabric\"},\n images: {type: \"array\", items: {type: \"object\", properties: {type: {const: \"image\"}, data: {type: \"string\"}, mimeType: {type: \"string\"}}, required: [\"type\", \"data\", \"mimeType\"], additionalProperties: false}},\n systemPrompt: {type: \"string\"},\n});\nconst runSchema = {type: \"object\", properties, required: [\"task\"], additionalProperties: false};\nconst spawnSchema = {type: \"object\", properties: {...properties, residency: {type: \"string\", enum: [\"session\", \"durable\"]}}, required: [\"task\"], additionalProperties: false};\nconst id = {type: \"string\", minLength: 1};\nconst object = (properties: Record<string, unknown>, required: string[] = []): Record<string, unknown> => ({type: \"object\", properties, required, additionalProperties: false});\n\nexport function agentServiceDescriptors(capabilities: AgentServiceCapabilities = {}): FabricActionDescriptor[] {\n const descriptors: FabricActionDescriptor[] = [\n {...run, description: \"Run one host-authorized Pi child and wait for its result or pause\", inputSchema: runSchema},\n {...native(\"spawn\"), description: \"Admit one host-authorized Pi child, or residency durable for an independent host worker\", inputSchema: spawnSchema},\n ...[\"wait\", \"join\", \"status\", \"stop\"].map((name) => ({...native(name), inputSchema: object({id}, [\"id\"])})),\n {...native(\"list\"), description: \"List only the authenticated caller's direct children\", inputSchema: object({})},\n ];\n if (capabilities.steer) descriptors.push({...native(\"steer\"), inputSchema: object({id, message: {type: \"string\", minLength: 1}}, [\"id\", \"message\"])});\n if (capabilities.followUp) descriptors.push({...native(\"followUp\"), inputSchema: object({id, message: {type: \"string\", minLength: 1}}, [\"id\", \"message\"])});\n if (capabilities.compact) descriptors.push({...native(\"compact\"), inputSchema: object({id, instructions: {type: \"string\"}}, [\"id\"])});\n if (capabilities.resume) descriptors.push({name: \"resume\", description: \"Continue a paused, completed or failed direct child from its host checkpoint and wait for result or pause\", risk: \"agent\", inputSchema: object({id, task: {type: \"string\", minLength: 1}}, [\"id\"])});\n if (capabilities.topology) {\n descriptors.push(\n {...native(\"sessions\"), inputSchema: object({})},\n {...native(\"peers\"), inputSchema: object({})},\n {...native(\"self\"), inputSchema: object({})},\n {...native(\"members\"), inputSchema: object({})},\n {...native(\"create\"), description: \"Create a lasting session peer in this project\", inputSchema: object({name: {type: \"string\", minLength: 1}, instructions: {type: \"string\"}, task: {type: \"string\"}}, [\"name\"])},\n {...native(\"remove\"), description: \"Stop and remove a lasting session peer created in this project\", inputSchema: object({id: {type: \"string\", minLength: 1}, name: {type: \"string\"}}, [\"id\"])},\n );\n }\n return descriptors;\n}\n\nconst descriptors = agentServiceDescriptors({steer: true, compact: true, resume: true});\nconst normalize = actionArgNormalizer(() => descriptors);\nexport function agentServiceArgs(action: AgentServiceAction, input: Record<string, unknown>): Record<string, unknown> {\n const descriptor = descriptors.find((entry) => entry.name === action);\n if (!descriptor) throw new Error(`Unsupported hosted agents action: ${action}`);\n const args = normalize(action, input);\n if (!Value.Check(descriptor.inputSchema, args)) {\n const reasons = [...Value.Errors(descriptor.inputSchema, args)].slice(0, 5).map((error) => `${error.instancePath}: ${error.message}`);\n throw new Error(`Invalid hosted agents.${action} arguments: ${reasons.join(\"; \")}`);\n }\n return args;\n}\n\nexport function normalizeAgentServiceRequest(input: AgentServiceRequest): AgentServiceRequest {\n const {residency, ...rest} = input;\n const args = agentServiceArgs(\"run\", rest as unknown as Record<string, unknown>);\n const request = normalizeAgentRunRequest(args, {runner: \"pi\", timeoutMs: 0}) as AgentServiceRequest;\n if (args.images !== undefined) request.images = structuredClone(args.images) as NonNullable<AgentServiceRequest[\"images\"]>;\n if (args.systemPrompt !== undefined) request.systemPrompt = args.systemPrompt as string;\n if (residency === \"session\" || residency === \"durable\") request.residency = residency;\n assertAgentTask(request);\n return structuredClone(request);\n}\n", "import { AgentAdmission, beginAgentSettlement, createAgentLifecycle, finishAgentSettlement, terminalAgentStatuses, waitForAgent, type AgentLifecycleState } from \"./lifecycle.js\";\nimport { validateAgentResult } from \"./result.js\";\nimport { normalizeAgentServiceRequest } from \"./service-schema.js\";\nimport type { AgentAuthorityBoundary, AgentPublicRecord, AgentControlRequest, AgentExecutionEvent, AgentExecutionResponse, AgentServiceCapabilities, AgentServiceEvent, AgentServiceOptions, AgentServiceRecord, AgentServiceRequest, AgentSessionRecord, AgentServiceSnapshot } from \"./service-types.js\";\n\ntype Entry = {\n request: AgentServiceRequest;\n record: AgentServiceRecord;\n lifecycle: AgentLifecycleState<AgentServiceRecord>;\n controller: AbortController;\n done?: Promise<void>;\n stopping?: Promise<AgentPublicRecord>;\n resuming?: boolean;\n stopAck?: Promise<void>;\n pauseAck?: Promise<void>;\n suspendRequested?: boolean;\n executing?: boolean;\n stopReason?: \"stop\" | \"close\";\n controls?: Set<Promise<unknown>>;\n};\nconst copy = <T>(value: T): T => structuredClone(value);\nconst publicRecord = (record: AgentServiceRecord): AgentPublicRecord => {\n const keys = [\"id\", \"rootId\", \"parentId\", \"depth\", \"generation\", \"name\", \"task\", \"status\", \"runner\", \"kernel\", \"cwd\", \"model\", \"thinking\", \"recursive\", \"startedAt\", \"updatedAt\", \"finishedAt\", \"currentTool\", \"turns\", \"toolCalls\", \"text\", \"value\", \"error\", \"usage\", \"sessionId\"] as const;\n return copy(Object.fromEntries(keys.filter((key) => record[key] !== undefined).map((key) => [key, record[key]]))) as AgentPublicRecord;\n};\nconst errorText = (error: unknown): string => error instanceof Error ? error.message : String(error);\nconst idle = (): AgentLifecycleState<AgentServiceRecord> => ({settled: true, result: undefined, resolve: undefined, release() {}, abortSignal: undefined, abortHandler: undefined});\n\n/** Portable one-shot agent authority. The execution port runs one participant, never a tree. */\nexport class AgentService {\n readonly #options: AgentServiceOptions;\n readonly #entries = new Map<string, Entry>();\n readonly #admission: AgentAdmission;\n readonly #pending = new Map<AbortController, Promise<unknown>>();\n readonly #closing = new AbortController();\n #close: Promise<void> | undefined;\n #suspend: Promise<void> | undefined;\n #suspended = false;\n #sequence = 0;\n #publication: Promise<void> = Promise.resolve();\n readonly capabilities: AgentServiceCapabilities;\n\n constructor(options: AgentServiceOptions) {\n if (!options.rootId) throw new Error(\"Agent service requires a trusted rootId\");\n for (const [key, value] of Object.entries({maxStarts: options.maxStarts ?? 8, maxDepth: options.maxDepth ?? 3, maxConcurrent: options.maxConcurrent ?? 4})) {\n if (!Number.isSafeInteger(value) || value < 1) throw new Error(`${key} must be a positive integer`);\n }\n this.#options = {...options, port: options.port};\n this.#admission = new AgentAdmission(options.maxConcurrent ?? 4, options.maxStarts ?? 8, options.maxDepth ?? 3);\n this.capabilities = Object.freeze({\n steer: Boolean(options.port.steer || options.topology),\n compact: Boolean(options.port.compact),\n resume: Boolean(options.port.resume),\n followUp: Boolean(options.port.followUp || options.topology),\n topology: Boolean(options.topology),\n });\n if (options.snapshot) this.#restore(options.snapshot);\n }\n\n snapshot(): AgentServiceSnapshot {\n return copy({version: 1, rootId: this.#options.rootId, starts: this.#admission.starts, sequence: this.#sequence,\n records: [...this.#entries.values()].map(({request, record}) => ({request, record}))});\n }\n\n async run(callerId: string, request: AgentServiceRequest, signal?: AbortSignal): Promise<AgentPublicRecord> {\n const handle = await this.spawn(callerId, request, signal);\n return this.wait(callerId, handle.id, signal);\n }\n\n async spawn(callerId: string, request: AgentServiceRequest, signal?: AbortSignal): Promise<AgentPublicRecord | AgentSessionRecord> {\n const normalized = normalizeAgentServiceRequest(request);\n if (normalized.residency === \"durable\") {\n await this.#authorize(callerId);\n const dispatch = this.#topology().dispatch;\n if (!dispatch) throw new Error(\"Durable hosted spawn is unavailable\");\n const record = await dispatch({callerId, request: normalized, ...(signal ? {signal} : {})});\n await this.#authorize(callerId);\n return copy(record);\n }\n return this.#start(callerId, normalized, undefined, signal);\n }\n\n async wait(callerId: string, id: string, signal?: AbortSignal): Promise<AgentPublicRecord> {\n await this.#authorize(callerId);\n const entry = this.#child(callerId, id);\n const result = entry.lifecycle.result ?? Promise.resolve(copy(entry.record));\n const record = await waitForAgent(result, signal);\n await this.#authorize(callerId);\n return publicRecord(record);\n }\n\n /** Alias for wait; authorization and cancellation semantics are identical. */\n join(callerId: string, id: string, signal?: AbortSignal): Promise<AgentPublicRecord> {\n return this.wait(callerId, id, signal);\n }\n\n async status(callerId: string, id: string): Promise<AgentPublicRecord> {\n await this.#authorize(callerId);\n return publicRecord(this.#child(callerId, id).record);\n }\n\n async list(callerId: string): Promise<AgentPublicRecord[]> {\n await this.#authorize(callerId);\n return [...this.#entries.values()].filter((entry) => entry.record.parentId === callerId).map((entry) => publicRecord(entry.record));\n }\n\n async stop(callerId: string, id: string): Promise<AgentPublicRecord> {\n await this.#authorize(callerId);\n const result = await this.#stop(this.#child(callerId, id));\n await this.#authorize(callerId);\n return publicRecord(result);\n }\n\n async steer(callerId: string, id: string, message: string): Promise<AgentPublicRecord | AgentSessionRecord> {\n if (!message.trim()) throw new Error(\"Steering message must not be empty\");\n const child = this.#ownedChild(callerId, id);\n if (child) {\n if (!this.#options.port.steer) throw new Error(\"Hosted agents.steer is unsupported\");\n return this.#control(callerId, child.record.id, \"steer\", (request) => this.#options.port.steer!({...request, message}));\n }\n return this.#deliver(callerId, id, \"steer\", message);\n }\n\n async followUp(callerId: string, id: string, message: string): Promise<AgentPublicRecord | AgentSessionRecord> {\n if (!message.trim()) throw new Error(\"Follow-up message must not be empty\");\n const child = this.#ownedChild(callerId, id);\n if (child) {\n if (!this.#options.port.followUp) throw new Error(\"Hosted agents.followUp is unsupported\");\n if (child.record.status === \"running\" && !child.stopping) {\n return this.#control(callerId, child.record.id, \"followUp\", (request) => this.#options.port.followUp!({...request, message}));\n }\n await this.#authorize(callerId);\n await this.#options.port.followUp({...this.#identity(child), message});\n await this.#authorize(callerId);\n return publicRecord(child.record);\n }\n return this.#deliver(callerId, id, \"followUp\", message);\n }\n\n async sessions(callerId: string): Promise<AgentSessionRecord[]> {\n await this.#authorize(callerId);\n return copy(await this.#topology().sessions());\n }\n\n async peers(callerId: string): Promise<AgentSessionRecord[]> {\n await this.#authorize(callerId);\n return copy(await this.#topology().peers(callerId));\n }\n\n async self(callerId: string): Promise<AgentSessionRecord> {\n await this.#authorize(callerId);\n if (this.#options.topology) return copy(await this.#options.topology.self(callerId));\n const child = callerId === this.#options.rootId ? undefined : this.#entries.get(callerId);\n return {\n id: callerId,\n name: child?.record.name ?? \"main\",\n kind: callerId === this.#options.rootId ? \"root\" : \"agent\",\n status: child?.record.status ?? \"running\",\n capabilities: callerId === this.#options.rootId ? [\"steer\", \"followUp\", \"stop\"] : [\"steer\", \"followUp\", \"stop\"],\n };\n }\n\n async create(callerId: string, request: { name: string; instructions?: string; task?: string }, signal?: AbortSignal): Promise<AgentSessionRecord> {\n if (!request.name.trim()) throw new Error(\"Peer name is required\");\n await this.#authorize(callerId);\n const create = this.#topology().create;\n if (!create) throw new Error(\"Hosted agents.create is unavailable\");\n const record = await create({callerId, name: request.name.trim(), ...(request.instructions ? {instructions: request.instructions} : {}), ...(request.task ? {task: request.task} : {}), ...(signal ? {signal} : {})});\n await this.#authorize(callerId);\n return copy(record);\n }\n\n async remove(callerId: string, id: string, name?: string, signal?: AbortSignal): Promise<AgentSessionRecord> {\n if (!id.trim()) throw new Error(\"Peer id is required\");\n await this.#authorize(callerId);\n const remove = this.#topology().remove;\n if (!remove) throw new Error(\"Hosted agents.remove is unavailable\");\n const record = await remove({callerId, id, ...(name ? {name} : {}), ...(signal ? {signal} : {})});\n await this.#authorize(callerId);\n return copy(record);\n }\n\n async members(callerId: string): Promise<AgentSessionRecord[]> {\n await this.#authorize(callerId);\n const sessions = this.#options.topology ? copy(await this.#options.topology.sessions()) : [];\n const seen = new Set(sessions.map((item) => item.id));\n const children: AgentSessionRecord[] = [];\n for (const entry of this.#entries.values()) {\n if (seen.has(entry.record.id)) continue;\n children.push({\n id: entry.record.id,\n name: entry.record.name,\n kind: \"agent\",\n status: entry.record.status,\n capabilities: [\"steer\", \"followUp\", \"stop\"],\n });\n }\n return [...sessions, ...children];\n }\n\n async compact(callerId: string, id: string, instructions?: string): Promise<AgentPublicRecord> {\n if (!this.#options.port.compact) throw new Error(\"Hosted agents.compact is unsupported\");\n return this.#control(callerId, id, \"compact\", (request) => this.#options.port.compact!({...request, ...(instructions !== undefined ? {instructions} : {})}));\n }\n\n async resume(callerId: string, id: string, task?: string, signal?: AbortSignal): Promise<AgentPublicRecord> {\n if (!this.#options.port.resume) throw new Error(\"Hosted agents.resume is unsupported\");\n await this.#authorize(callerId);\n const entry = this.#child(callerId, id);\n if (![\"paused\", \"completed\", \"failed\"].includes(entry.record.status) || !entry.lifecycle.settled || entry.resuming || entry.stopping) throw new Error(\"Only an idle paused, completed or failed agent can resume\");\n entry.resuming = true;\n try {\n const request = normalizeAgentServiceRequest({...entry.request, ...(task !== undefined ? {task} : {})});\n await this.#start(callerId, request, entry, signal);\n return await this.wait(callerId, id, signal);\n } finally { entry.resuming = false; }\n }\n\n /** Natural root completion waits for all background descendants without fencing live parents. */\n async drain(): Promise<void> {\n for (;;) {\n const work: Promise<unknown>[] = [...this.#pending.values()];\n for (const entry of this.#entries.values()) {\n if (entry.lifecycle.result && entry.done) work.push(entry.done);\n }\n if (work.length === 0) return;\n await Promise.allSettled(work);\n }\n }\n\n /** Host-only graceful pause. The port, not the owner signal, quiesces participant effects. */\n suspend(): Promise<void> {\n if (this.#suspend) return this.#suspend;\n if (this.#closing.signal.aborted) return Promise.reject(new Error(\"Agent service is closed\"));\n if (!this.#options.port.pause && [...this.#entries.values()].some((entry) => !entry.lifecycle.settled)) {\n return Promise.reject(new Error(\"Hosted agent suspension requires port.pause\"));\n }\n this.#suspended = true;\n for (const entry of this.#entries.values()) {\n if (!entry.lifecycle.settled && !terminalAgentStatuses.has(entry.record.status)) entry.suspendRequested = true;\n }\n for (const controller of this.#pending.keys()) controller.abort();\n this.#suspend = (async () => {\n const roots = [...this.#entries.values()].filter((entry) => entry.record.parentId === this.#options.rootId);\n const paused = await Promise.allSettled(roots.map((entry) => this.#pause(entry)));\n await Promise.allSettled([...this.#pending.values()]);\n const errors = paused.filter((result): result is PromiseRejectedResult => result.status === \"rejected\");\n if (errors.length) throw new AggregateError(errors.map((result) => result.reason), \"Agent suspension failed\");\n await this.drain();\n })();\n return this.#suspend;\n }\n\n async #pause(entry: Entry): Promise<void> {\n const children = [...this.#entries.values()].filter((child) => child.record.parentId === entry.record.id);\n const paused = await Promise.allSettled(children.map((child) => this.#pause(child)));\n const errors = paused.filter((result): result is PromiseRejectedResult => result.status === \"rejected\").map((result) => result.reason);\n if (errors.length) throw new AggregateError(errors, \"Agent descendant suspension failed\");\n if (entry.executing && !entry.stopping) {\n entry.pauseAck = Promise.resolve().then(async () => {\n if (entry.executing && !entry.stopping) await this.#options.port.pause!(this.#identity(entry));\n });\n try { await entry.pauseAck; }\n catch (error) { throw new AggregateError([...errors, error], \"Agent pause acknowledgment failed\"); }\n }\n await entry.done;\n }\n\n close(): Promise<void> {\n if (this.#close) return this.#close;\n this.#closing.abort();\n for (const controller of this.#pending.keys()) controller.abort();\n this.#close = (async () => {\n const errors: unknown[] = [];\n const stopped = await Promise.allSettled([...this.#entries.values()].map((entry) => this.#stop(entry, true)));\n for (const result of stopped) if (result.status === \"rejected\") errors.push(result.reason);\n await Promise.allSettled([...this.#pending.values()]);\n if (errors.length) throw new AggregateError(errors, \"Agent shutdown failed\");\n })();\n return this.#close;\n }\n\n #start(callerId: string, request: AgentServiceRequest, previous?: Entry, signal?: AbortSignal): Promise<AgentPublicRecord> {\n const controller = new AbortController();\n const abort = () => controller.abort();\n signal?.addEventListener(\"abort\", abort, {once: true});\n if (signal?.aborted || this.#closing.signal.aborted || this.#suspended) controller.abort();\n const operation = (async () => {\n let release: (() => void) | undefined;\n try {\n await this.#authorize(callerId);\n const depth = this.#depth(callerId);\n if (controller.signal.aborted) throw new Error(\"Operation aborted\");\n if (depth > this.#admission.maxDepth) throw new Error(`Fabric agent depth limit reached (${this.#admission.maxDepth})`);\n const id = previous?.record.id ?? crypto.randomUUID().replaceAll(\"-\", \"\");\n const generation = (previous?.record.generation ?? 0) + 1;\n const prepare = {id, generation, rootId: this.#options.rootId, parentId: callerId, depth, request: copy(request), signal: controller.signal};\n const binding = await this.#options.port.prepare?.(prepare);\n release = await this.#admission.acquire(callerId, controller.signal);\n await this.#authorize(callerId);\n this.#depth(callerId);\n if (controller.signal.aborted || this.#closing.signal.aborted || previous?.stopping) throw new Error(\"Agent admission aborted\");\n // No await between the final authority/parent check and the root-wide charge.\n this.#admission.admit(depth);\n const now = Date.now();\n const record: AgentServiceRecord = previous ? {\n ...previous.record, task: request.task, status: \"queued\", generation: previous.record.generation + 1,\n text: \"\", turns: 0, toolCalls: 0, updatedAt: now,\n } : {\n id, rootId: this.#options.rootId, parentId: callerId, depth, generation: 1,\n name: (request.name ?? request.task.split(\"\\n\", 1)[0] ?? \"Fabric agent\").replace(/[\\r\\n\\t]+/g, \" \").trim().slice(0, 60) || \"Fabric agent\",\n task: request.task, status: \"queued\", runner: \"pi\", kernel: \"typescript\", startedAt: now, updatedAt: now,\n turns: 0, toolCalls: 0, text: \"\", usage: {input: 0, output: 0, cacheRead: 0, cacheWrite: 0, cost: 0},\n ...(request.model ? {model: request.model} : {}), ...(request.thinking ? {thinking: request.thinking} : {}),\n ...(request.cwd !== undefined ? {cwd: request.cwd} : {}), ...(request.recursive !== undefined ? {recursive: request.recursive} : {}),\n };\n delete record.finishedAt; delete record.error; delete record.value; delete record.currentTool;\n const entry: Entry = previous ?? {request, record, lifecycle: idle(), controller};\n entry.request = copy(request); entry.record = record; entry.controller = controller;\n entry.lifecycle = createAgentLifecycle<AgentServiceRecord>(release);\n release = undefined;\n this.#entries.set(record.id, entry);\n this.#pending.delete(controller);\n // Admission cancellation detaches here. Background execution has a distinct owner signal.\n signal?.removeEventListener(\"abort\", abort);\n let acknowledge!: () => void;\n const admitted = new Promise<void>((resolve) => { acknowledge = resolve; });\n entry.done = this.#drive(entry, binding, Boolean(previous), acknowledge);\n await admitted;\n await this.#authorize(callerId);\n return publicRecord(record);\n } finally {\n release?.();\n signal?.removeEventListener(\"abort\", abort);\n }\n })();\n this.#pending.set(controller, operation);\n void operation.finally(() => this.#pending.delete(controller)).catch(() => {});\n return operation;\n }\n\n async #drive(entry: Entry, binding: unknown, resume: boolean, admitted: () => void): Promise<void> {\n const generation = entry.record.generation;\n let timer: ReturnType<typeof setTimeout> | undefined;\n let timeout = false;\n let responded = false;\n try {\n await this.#publish(\"admitted\", entry);\n admitted();\n await this.#authorize(entry.record.parentId);\n if (entry.controller.signal.aborted) throw new Error(\"Agent start aborted\");\n entry.record.status = \"running\";\n await this.#publish(\"running\", entry);\n await this.#authorize(entry.record.parentId);\n if (entry.controller.signal.aborted) throw new Error(\"Agent start aborted\");\n const request = {\n ...this.#identity(entry), depth: entry.record.depth, request: copy(entry.request), signal: entry.controller.signal,\n binding, ...(entry.record.checkpoint !== undefined ? {checkpoint: copy(entry.record.checkpoint)} : {}),\n emit: async (event: AgentExecutionEvent) => {\n const assertCurrent = () => {\n if (!entry.executing || entry.lifecycle.settled || entry.controller.signal.aborted || entry.record.generation !== generation || entry.record.status !== \"running\") throw new Error(\"Stale agent execution event\");\n };\n assertCurrent();\n if (event.type !== \"checkpoint\" && event.type !== \"progress\") throw new Error(\"Unsupported agent execution event\");\n const saved = copy(event);\n await this.#publish(saved.type, entry, undefined, () => {\n if (saved.type === \"checkpoint\") entry.record.checkpoint = saved.checkpoint;\n else {\n for (const key of [\"text\", \"turns\", \"toolCalls\", \"currentTool\", \"usage\"] as const) {\n if (saved[key] !== undefined) Object.assign(entry.record, {[key]: saved[key]});\n }\n }\n }, assertCurrent);\n },\n };\n if (entry.request.timeoutMs) timer = setTimeout(() => {\n if (entry.suspendRequested) return;\n timeout = true;\n void this.#stop(entry).catch(() => {});\n }, entry.request.timeoutMs);\n const execute = resume ? this.#options.port.resume! : this.#options.port.execute;\n entry.executing = true;\n let response: AgentExecutionResponse;\n try { response = await execute.call(this.#options.port, request); }\n finally { entry.executing = false; }\n if (![\"completed\", \"failed\", \"stopped\", \"timed_out\", \"paused\"].includes(response.status)) throw new Error(\"Invalid agent execution response status\");\n await this.#authorize(entry.record.parentId, response.status === \"paused\" ? {checkpoint: true} : undefined);\n if (entry.record.generation !== generation || entry.lifecycle.settled) throw new Error(\"Stale agent execution response\");\n this.#applyResponse(entry, response);\n responded = true;\n } catch (error) {\n entry.record.status = \"failed\";\n entry.record.error = errorText(error);\n } finally {\n admitted();\n if (timer) clearTimeout(timer);\n await Promise.allSettled([...(entry.controls ?? []), ...(entry.stopAck ? [entry.stopAck] : []), ...(entry.pauseAck ? [entry.pauseAck] : [])]);\n if (entry.suspendRequested && !entry.controller.signal.aborted) {\n entry.record.status = \"paused\"; delete entry.record.error; delete entry.record.finishedAt;\n }\n if (entry.controller.signal.aborted) {\n if (entry.stopReason === \"close\") {\n if (!responded || ![\"completed\", \"failed\"].includes(entry.record.status)) { entry.record.status = \"paused\"; delete entry.record.error; }\n } else entry.record.status = timeout ? \"timed_out\" : \"stopped\";\n }\n try { await this.#options.port.cleanup?.(this.#identity(entry)); }\n catch (error) { entry.record.status = \"failed\"; entry.record.error = `Agent cleanup failed: ${errorText(error)}`; }\n validateAgentResult(entry.record, entry.request.schema);\n delete entry.record.currentTool;\n if (terminalAgentStatuses.has(entry.record.status)) entry.record.finishedAt = Date.now();\n if (beginAgentSettlement(entry.lifecycle)) {\n try { await this.#publish(\"settled\", entry); }\n catch (error) { entry.record.status = \"failed\"; entry.record.error = `Agent publication failed: ${errorText(error)}`; }\n finishAgentSettlement(entry.lifecycle, copy(entry.record));\n }\n }\n }\n\n #applyResponse(entry: Entry, response: AgentExecutionResponse): void {\n // Port output cannot overwrite host-owned identifiers, lineage or admission metadata.\n entry.record.status = response.status;\n for (const key of [\"text\", \"value\", \"error\", \"usage\", \"checkpoint\", \"sessionId\"] as const) {\n if (response[key] !== undefined) Object.assign(entry.record, {[key]: copy(response[key])});\n }\n }\n\n #stop(entry: Entry, preservePaused = false): Promise<AgentPublicRecord> {\n if (entry.stopping) return entry.stopping;\n entry.stopReason = preservePaused ? \"close\" : \"stop\";\n const work = (async () => {\n const active = !entry.lifecycle.settled;\n entry.controller.abort();\n const descendants = [...this.#entries.values()].filter((child) => child.record.parentId === entry.record.id);\n const operations: Promise<unknown>[] = descendants.map((child) => this.#stop(child, preservePaused));\n if (active && this.#options.port.stop) {\n entry.stopAck = Promise.resolve().then(() => this.#options.port.stop!(this.#identity(entry)));\n operations.push(entry.stopAck);\n }\n if (entry.done) operations.push(entry.done);\n const settled = await Promise.allSettled(operations);\n if (entry.record.status === \"paused\" && !preservePaused) {\n entry.record.status = \"stopped\"; entry.record.finishedAt = Date.now();\n await this.#publish(\"settled\", entry);\n }\n const errors = settled.filter((result): result is PromiseRejectedResult => result.status === \"rejected\");\n if (errors.length) throw new AggregateError(errors.map((result) => result.reason), \"Agent stop failed\");\n return publicRecord(entry.record);\n })();\n entry.stopping = work;\n return work;\n }\n\n async #control(callerId: string, id: string, control: \"steer\" | \"compact\" | \"followUp\", invoke: (request: AgentControlRequest) => Promise<void>): Promise<AgentPublicRecord> {\n await this.#authorize(callerId);\n const entry = this.#child(callerId, id);\n if (entry.record.status !== \"running\" || entry.stopping) throw new Error(\"Agent is not running\");\n const generation = entry.record.generation;\n const pending = Promise.resolve().then(async () => {\n await this.#authorize(callerId);\n if (entry.record.generation !== generation || entry.controller.signal.aborted || entry.lifecycle.settled) throw new Error(\"Stale agent control\");\n await invoke(this.#identity(entry));\n });\n (entry.controls ??= new Set()).add(pending);\n try { await pending; } finally { entry.controls.delete(pending); }\n await this.#authorize(callerId);\n if (entry.record.generation !== generation || entry.controller.signal.aborted) throw new Error(\"Stale agent control acknowledgment\");\n await this.#publish(\"control\", entry, control);\n return publicRecord(entry.record);\n }\n\n #identity(entry: Entry): AgentControlRequest {\n const {id, rootId, parentId, generation} = entry.record;\n return {id, rootId, parentId, generation};\n }\n\n async #authorize(callerId: string, boundary?: AgentAuthorityBoundary): Promise<void> {\n if (callerId !== this.#options.rootId && !this.#entries.has(callerId)) throw new Error(\"Unknown agent caller\");\n if (this.#suspended && !boundary?.checkpoint) throw new Error(\"Agent service is paused\");\n await this.#options.assertAuthority?.(callerId, boundary);\n if (this.#suspended && !boundary?.checkpoint) throw new Error(\"Agent service is paused\");\n }\n\n #child(callerId: string, id: string): Entry {\n const entry = this.#ownedChild(callerId, id);\n if (!entry) throw new Error(`Unknown direct child agent: ${id}`);\n return entry;\n }\n\n #ownedChild(callerId: string, id: string): Entry | undefined {\n const entry = this.#entries.get(id);\n return entry && entry.record.parentId === callerId ? entry : undefined;\n }\n\n #topology(): NonNullable<AgentServiceOptions[\"topology\"]> {\n if (!this.#options.topology) throw new Error(\"Hosted agent topology is unavailable\");\n return this.#options.topology;\n }\n\n async #deliver(callerId: string, id: string, operation: \"steer\" | \"followUp\", message: string): Promise<AgentSessionRecord> {\n const topology = this.#topology();\n await this.#authorize(callerId);\n const target = id === \"main\" ? this.#options.rootId : id;\n const record = await topology.deliver({callerId, id: target, operation, message});\n await this.#authorize(callerId);\n return copy(record);\n }\n\n #depth(callerId: string): number {\n if (this.#closing.signal.aborted) throw new Error(\"Agent service is closed\");\n if (this.#suspended) throw new Error(\"Agent service is paused\");\n if (callerId === this.#options.rootId) return 1;\n const parent = this.#entries.get(callerId);\n if (!parent || parent.record.status !== \"running\" || parent.stopping || parent.controller.signal.aborted || parent.request.recursive === false) throw new Error(\"Agent parent cannot admit children\");\n return parent.record.depth + 1;\n }\n\n async #publish(type: AgentServiceEvent[\"type\"], entry: Entry, control?: AgentServiceEvent[\"control\"], update?: () => void, assertCurrent?: () => void): Promise<void> {\n const boundary = type === \"checkpoint\" || type === \"settled\" ? {checkpoint: true} : undefined;\n const generation = entry.record.generation;\n await this.#authorize(entry.record.parentId, boundary);\n const publication = this.#publication.then(async () => {\n await this.#authorize(entry.record.parentId, boundary);\n if (entry.record.generation !== generation) throw new Error(\"Stale agent publication\");\n assertCurrent?.();\n // Commit event mutations only after serialized, phase-matched lease authorization.\n update?.();\n entry.record.updatedAt = Date.now();\n const event: AgentServiceEvent = {version: 1, sequence: ++this.#sequence, type, record: copy(entry.record), ...(control ? {control} : {})};\n await this.#options.onEvent?.(event);\n });\n this.#publication = publication.catch(() => {});\n await publication;\n }\n\n #restore(snapshot: AgentServiceSnapshot): void {\n const saved = copy(snapshot);\n const newRoot = this.#options.restorePolicy === \"new-root\";\n if (newRoot && saved.rootId !== this.#options.rootId) {\n const oldRoot = saved.rootId;\n saved.rootId = this.#options.rootId;\n for (const {record} of saved.records) {\n if (record.rootId !== oldRoot) throw new Error(\"Invalid agent snapshot root\");\n record.rootId = saved.rootId;\n if (record.parentId === oldRoot) record.parentId = saved.rootId;\n }\n }\n if (saved.version !== 1 || saved.rootId !== this.#options.rootId || !Number.isSafeInteger(saved.starts) || saved.starts < 0 || (!newRoot && saved.starts > this.#admission.maxStarts) || !Number.isSafeInteger(saved.sequence) || saved.sequence < 0 || !Array.isArray(saved.records)) throw new Error(\"Invalid agent service snapshot\");\n let generations = 0;\n for (const item of saved.records) {\n const request = normalizeAgentServiceRequest(item.request);\n const record = item.record;\n if (!record.id || record.id === saved.rootId || this.#entries.has(record.id) || record.rootId !== saved.rootId || !Number.isSafeInteger(record.depth) || record.depth < 1 || record.depth > this.#admission.maxDepth || !Number.isSafeInteger(record.generation) || record.generation < 1 || ![\"queued\", \"running\", \"paused\", ...terminalAgentStatuses].includes(record.status)) throw new Error(\"Invalid agent snapshot record\");\n generations += record.generation;\n if (record.status === \"running\" || record.status === \"queued\") { record.status = \"paused\"; delete record.finishedAt; }\n this.#entries.set(record.id, {request, record, lifecycle: idle(), controller: new AbortController()});\n }\n for (const {record} of this.#entries.values()) {\n const parent = this.#entries.get(record.parentId);\n if (record.parentId === saved.rootId ? record.depth !== 1 : !parent || parent.record.depth + 1 !== record.depth) throw new Error(\"Invalid agent snapshot lineage\");\n }\n if (saved.starts > generations) throw new Error(\"Invalid agent snapshot admission count\");\n this.#admission.starts = newRoot ? 0 : saved.starts;\n this.#sequence = saved.sequence;\n }\n}\n", "import type { FabricProvider } from \"../protocol.js\";\nimport { AgentService } from \"./service.js\";\nimport { agentServiceArgs, agentServiceDescriptors } from \"./service-schema.js\";\nimport type { AgentServiceAction, AgentServiceCapabilities, AgentServiceClient, AgentServiceDispatcher, AgentPublicRecord, AgentServiceRequest, AgentSessionRecord } from \"./service-types.js\";\n\n/** Bind only authenticated host identity here. Guest arguments never carry the caller. */\nexport function createAgentServiceHandler(service: AgentService, callerId: string): AgentServiceDispatcher {\n return async (action, input, signal) => {\n const args = agentServiceArgs(action, input);\n switch (action) {\n case \"run\": return service.run(callerId, args as unknown as AgentServiceRequest, signal);\n case \"spawn\": return service.spawn(callerId, args as unknown as AgentServiceRequest, signal);\n case \"join\":\n case \"wait\": return service.wait(callerId, args.id as string, signal);\n case \"status\": return service.status(callerId, args.id as string);\n case \"list\": return service.list(callerId);\n case \"stop\": return service.stop(callerId, args.id as string);\n case \"steer\": return service.steer(callerId, args.id as string, args.message as string);\n case \"followUp\": return service.followUp(callerId, args.id as string, args.message as string);\n case \"compact\": return service.compact(callerId, args.id as string, args.instructions as string | undefined);\n case \"resume\": return service.resume(callerId, args.id as string, args.task as string | undefined, signal);\n case \"sessions\": return service.sessions(callerId);\n case \"peers\": return service.peers(callerId);\n case \"self\": return service.self(callerId);\n case \"members\": return service.members(callerId);\n case \"create\": return service.create(callerId, args as {name: string; instructions?: string; task?: string}, signal);\n case \"remove\": return service.remove(callerId, args.id as string, args.name as string | undefined, signal);\n default: throw new Error(`Unsupported hosted agents action: ${String(action)}`);\n }\n };\n}\n\n/** A transport client only; all admission and lifecycle remain in the root service. */\nexport function createAgentServiceClient(dispatch: AgentServiceDispatcher, capabilities: AgentServiceCapabilities = {}): AgentServiceClient {\n const record = (action: AgentServiceAction, args: Record<string, unknown>, signal?: AbortSignal) => dispatch(action, args, signal) as Promise<AgentPublicRecord>;\n return {\n capabilities: Object.freeze({...capabilities}), dispatch,\n run: (request, signal) => record(\"run\", request as unknown as Record<string, unknown>, signal),\n spawn: (request, signal) => record(\"spawn\", request as unknown as Record<string, unknown>, signal),\n wait: (id, signal) => record(\"wait\", {id}, signal),\n join: (id, signal) => record(\"wait\", {id}, signal),\n status: (id) => record(\"status\", {id}),\n list: () => dispatch(\"list\", {}) as Promise<AgentPublicRecord[]>,\n stop: (id) => record(\"stop\", {id}),\n steer: (id, message) => record(\"steer\", {id, message}),\n compact: (id, instructions) => record(\"compact\", {id, ...(instructions !== undefined ? {instructions} : {})}),\n resume: (id, task, signal) => record(\"resume\", {id, ...(task !== undefined ? {task} : {})}, signal),\n followUp: (id, message) => record(\"followUp\", {id, message}),\n sessions: () => dispatch(\"sessions\", {}) as Promise<AgentSessionRecord[]>,\n peers: () => dispatch(\"peers\", {}) as Promise<AgentSessionRecord[]>,\n self: () => dispatch(\"self\", {}) as Promise<AgentSessionRecord>,\n members: () => dispatch(\"members\", {}) as Promise<AgentSessionRecord[]>,\n create: (request, signal) => dispatch(\"create\", request as unknown as Record<string, unknown>, signal) as Promise<AgentSessionRecord>,\n remove: (id, name, signal) => dispatch(\"remove\", {id, ...(name !== undefined ? {name} : {})}, signal) as Promise<AgentSessionRecord>,\n };\n}\n\nexport function createAgentsProvider(client: AgentServiceClient): FabricProvider {\n const descriptors = agentServiceDescriptors(client.capabilities);\n const allowed = new Set(descriptors.map((descriptor) => descriptor.name));\n const validate = (action: string, args: Record<string, unknown>) => {\n if (!allowed.has(action)) throw new Error(`Unsupported hosted agents action: ${action}`);\n return agentServiceArgs(action as AgentServiceAction, args);\n };\n return {\n name: \"agents\", description: \"Fabric host-authorized Pi agents\",\n list: async () => structuredClone(descriptors),\n describe: async (name) => structuredClone(descriptors.find((descriptor) => descriptor.name === name)),\n prepareArguments: (action, args) => validate(action, args),\n invoke: async (action, args, context) => client.dispatch(action as AgentServiceAction, validate(action, args), context.signal),\n };\n}\n", "/** Portable hosted agents: no local manager, filesystem, model registry or ambient configuration. */\nexport { AgentService } from \"./agents/service.js\";\nexport { createAgentsProvider, createAgentServiceClient, createAgentServiceHandler } from \"./agents/service-provider.js\";\nexport { agentServiceDescriptors } from \"./agents/service-schema.js\";\nexport type * from \"./agents/service-types.js\";\nexport type { AgentRunRequest, AgentRunRecord, AgentRunResult, AgentHandleInfo, AgentUsage } from \"./agents/types.js\";\nexport const HOSTED_AGENTS_PROTOCOL_VERSION = 1 as const;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,aAAa;AAQtB,IAAM,SAAS,CAAC,SAAyC;AACvD,QAAM,aAAa,0BAA0B,KAAK,CAAC,UAAU,MAAM,SAAS,IAAI;AAChF,MAAI,CAAC,WAAY,OAAM,IAAI,MAAM,oCAAoC,IAAI,EAAE;AAC3E,SAAO,gBAAgB,UAAU;AACnC;AACA,IAAM,MAAM,OAAO,KAAK;AACxB,IAAM,aAAa,EAAE,GAAI,IAAI,YAAsD,WAAW;AAC9F,WAAW,OAAO,CAAC,aAAa,SAAS,EAAG,QAAO,WAAW,GAAG;AACjE,OAAO,OAAO,YAAY;AAAA,EACxB,QAAQ,EAAC,MAAM,UAAU,MAAM,CAAC,IAAI,EAAC;AAAA,EACrC,QAAQ,EAAC,MAAM,UAAU,MAAM,CAAC,cAAc,SAAS,EAAC;AAAA,EACxD,YAAY,EAAC,MAAM,WAAW,OAAO,KAAI;AAAA,EACzC,UAAU,EAAC,MAAM,WAAW,OAAO,MAAK;AAAA,EACxC,WAAW,EAAC,MAAM,UAAU,SAAS,EAAC;AAAA,EACtC,KAAK,EAAC,MAAM,UAAU,aAAa,+DAA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S,YAAY,CAAC,CAAC;AAAA,IACvC,OAAO,MAAM,SAAS,SAAS,CAAC,CAAC;AAAA,IACjC,MAAM,MAAM,SAAS,QAAQ,CAAC,CAAC;AAAA,IAC/B,SAAS,MAAM,SAAS,WAAW,CAAC,CAAC;AAAA,IACrC,QAAQ,CAAC,SAAS,WAAW,SAAS,UAAU,SAA+C,MAAM;AAAA,IACrG,QAAQ,CAACA,KAAI,MAAM,WAAW,SAAS,UAAU,EAAC,IAAAA,KAAI,GAAI,SAAS,SAAY,EAAC,KAAI,IAAI,CAAC,EAAE,GAAG,MAAM;AAAA,EACtG;AACF;AAEO,SAAS,qBAAqB,QAA4C;AAC/E,QAAMC,eAAc,wBAAwB,OAAO,YAAY;AAC/D,QAAM,UAAU,IAAI,IAAIA,aAAY,IAAI,CAAC,eAAe,WAAW,IAAI,CAAC;AACxE,QAAM,WAAW,CAAC,QAAgB,SAAkC;AAClE,QAAI,CAAC,QAAQ,IAAI,MAAM,EAAG,OAAM,IAAI,MAAM,qCAAqC,MAAM,EAAE;AACvF,WAAO,iBAAiB,QAA8B,IAAI;AAAA,EAC5D;AACA,SAAO;AAAA,IACL,MAAM;AAAA,IAAU,aAAa;AAAA,IAC7B,MAAM,YAAY,gBAAgBA,YAAW;AAAA,IAC7C,UAAU,OAAO,SAAS,gBAAgBA,aAAY,KAAK,CAAC,eAAe,WAAW,SAAS,IAAI,CAAC;AAAA,IACpG,kBAAkB,CAAC,QAAQ,SAAS,SAAS,QAAQ,IAAI;AAAA,IACzD,QAAQ,OAAO,QAAQ,MAAM,YAAY,OAAO,SAAS,QAA8B,SAAS,QAAQ,IAAI,GAAG,QAAQ,MAAM;AAAA,EAC/H;AACF;;;ACjEO,IAAM,iCAAiC;",
6
6
  "names": ["properties", "descriptors", "id", "id", "descriptors"]
7
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"projection.d.ts","sourceRoot":"","sources":["../../src/audit/projection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEvD,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,oBAAoB,CAAA;KAAE,CAAC;IAC/C,aAAa,EAAE,MAAM,CAAC;CACvB;AAwJD;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,GACjC,KAAK,MAAM,EACX,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC5B,qBA6GF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,wBAAwB,GACnC,KAAK,MAAM,EACX,QAAQ,OAAO,KACd,qBAAqB,GAAG,SAwB1B,CAAC"}
1
+ {"version":3,"file":"projection.d.ts","sourceRoot":"","sources":["../../src/audit/projection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEvD,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,oBAAoB,CAAA;KAAE,CAAC;IAC/C,aAAa,EAAE,MAAM,CAAC;CACvB;AAyJD;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,GACjC,KAAK,MAAM,EACX,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC5B,qBA6GF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,wBAAwB,GACnC,KAAK,MAAM,EACX,QAAQ,OAAO,KACd,qBAAqB,GAAG,SAwB1B,CAAC"}
@@ -170,6 +170,12 @@ var AGENTS_ACTION_DESCRIPTORS = [
170
170
  inputSchema: idSchema,
171
171
  risk: "read"
172
172
  },
173
+ {
174
+ name: "join",
175
+ description: "Alias for agents.wait: wait for a previously spawned child agent with the same progress and completion-notification behavior",
176
+ inputSchema: idSchema,
177
+ risk: "read"
178
+ },
173
179
  {
174
180
  name: "status",
175
181
  description: "Get the latest status of any known project participant",
@@ -729,4 +735,4 @@ export {
729
735
  AGENTS_ACTION_DESCRIPTORS,
730
736
  normalizeAgentRunRequest
731
737
  };
732
- //# sourceMappingURL=chunk-OAXSWVOB.js.map
738
+ //# sourceMappingURL=chunk-2PZWDVJB.js.map