@e4779/pi-fabric 0.92.17-fork.3 → 0.92.28-fork.5

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 (233) hide show
  1. package/dist/actors/host-event-payload.d.ts.map +1 -1
  2. package/dist/agents/budget-ledger.d.ts.map +1 -1
  3. package/dist/agents/handoff-continuation.d.ts +4 -0
  4. package/dist/agents/handoff-continuation.d.ts.map +1 -0
  5. package/dist/agents/manager.d.ts.map +1 -1
  6. package/dist/agents/request.d.ts +4 -0
  7. package/dist/agents/request.d.ts.map +1 -1
  8. package/dist/agents.js +5 -4
  9. package/dist/agents.js.map +1 -1
  10. package/dist/chunks/{chunk-GXNR6NRU.js → chunk-2IAVP4O2.js} +2 -2
  11. package/dist/chunks/{chunk-TPLMVELH.js → chunk-77PDIBK2.js} +15 -4
  12. package/dist/chunks/{chunk-TPLMVELH.js.map → chunk-77PDIBK2.js.map} +2 -2
  13. package/dist/chunks/chunk-7TX532EG.js +134 -0
  14. package/dist/chunks/chunk-7TX532EG.js.map +7 -0
  15. package/dist/chunks/chunk-BJOJX2UW.js +59 -0
  16. package/dist/chunks/chunk-BJOJX2UW.js.map +7 -0
  17. package/dist/chunks/{chunk-2PZWDVJB.js → chunk-BYOGRJME.js} +13 -4
  18. package/dist/chunks/chunk-BYOGRJME.js.map +7 -0
  19. package/dist/chunks/{chunk-RERA6YWA.js → chunk-CIODQX77.js} +12 -4
  20. package/dist/chunks/chunk-CIODQX77.js.map +7 -0
  21. package/dist/chunks/{chunk-OP2KTYQB.js → chunk-D6YSBP3R.js} +4 -4
  22. package/dist/chunks/chunk-EDL4JDW7.js +184 -0
  23. package/dist/chunks/chunk-EDL4JDW7.js.map +7 -0
  24. package/dist/chunks/{chunk-WVH324VF.js → chunk-FAMBJFFF.js} +1 -1
  25. package/dist/chunks/{chunk-WVH324VF.js.map → chunk-FAMBJFFF.js.map} +1 -1
  26. package/dist/chunks/{chunk-UDFDF7IY.js → chunk-G7UJLM33.js} +148 -251
  27. package/dist/chunks/chunk-G7UJLM33.js.map +7 -0
  28. package/dist/chunks/{chunk-RNOPHITP.js → chunk-H6DDV6E2.js} +180 -24
  29. package/dist/chunks/chunk-H6DDV6E2.js.map +7 -0
  30. package/dist/chunks/{chunk-ARLYAW2A.js → chunk-IR3PIHJM.js} +2 -1
  31. package/dist/chunks/chunk-IR3PIHJM.js.map +7 -0
  32. package/dist/chunks/{chunk-VRZNFNPB.js → chunk-IYQ5MNCW.js} +20 -17
  33. package/dist/chunks/chunk-IYQ5MNCW.js.map +7 -0
  34. package/dist/chunks/chunk-JNMTTJMQ.js +50 -0
  35. package/dist/chunks/chunk-JNMTTJMQ.js.map +7 -0
  36. package/dist/chunks/{chunk-CPSW2GW4.js → chunk-JOEFBOFN.js} +11 -7
  37. package/dist/chunks/chunk-JOEFBOFN.js.map +7 -0
  38. package/dist/chunks/chunk-KI277YNS.js +218 -0
  39. package/dist/chunks/chunk-KI277YNS.js.map +7 -0
  40. package/dist/chunks/{chunk-Y7KNRAFL.js → chunk-M3ZNZ6EZ.js} +28 -3
  41. package/dist/chunks/chunk-M3ZNZ6EZ.js.map +7 -0
  42. package/dist/chunks/{chunk-2DMJ7MEI.js → chunk-M7W57BRC.js} +172 -141
  43. package/dist/chunks/chunk-M7W57BRC.js.map +7 -0
  44. package/dist/chunks/{chunk-U6CTHPZC.js → chunk-MQG5QKGI.js} +2 -2
  45. package/dist/chunks/{chunk-CI56CW53.js → chunk-NPHCGLGH.js} +16 -10
  46. package/dist/chunks/chunk-NPHCGLGH.js.map +7 -0
  47. package/dist/chunks/{chunk-4SSMGBF4.js → chunk-QLV2IZ3F.js} +6 -7
  48. package/dist/chunks/chunk-QLV2IZ3F.js.map +7 -0
  49. package/dist/chunks/{chunk-PH7ZJ27F.js → chunk-RAEGNBRA.js} +210 -118
  50. package/dist/chunks/chunk-RAEGNBRA.js.map +7 -0
  51. package/dist/chunks/chunk-RAO6TQFP.js +187 -0
  52. package/dist/chunks/chunk-RAO6TQFP.js.map +7 -0
  53. package/dist/chunks/{chunk-ZZ4LHQYJ.js → chunk-RTXZHKMS.js} +22 -13
  54. package/dist/chunks/chunk-RTXZHKMS.js.map +7 -0
  55. package/dist/chunks/{chunk-BOTRGFQQ.js → chunk-RWDKJ24D.js} +26 -19
  56. package/dist/chunks/chunk-RWDKJ24D.js.map +7 -0
  57. package/dist/chunks/{chunk-2UQV52II.js → chunk-RZKN534S.js} +6 -6
  58. package/dist/chunks/{chunk-656HWVFU.js → chunk-SZUXWOO7.js} +5 -3
  59. package/dist/chunks/chunk-SZUXWOO7.js.map +7 -0
  60. package/dist/chunks/{chunk-YK5AZ7CZ.js → chunk-ULLIZPBH.js} +7 -7
  61. package/dist/chunks/{chunk-UTR3I23Z.js → chunk-W63E3WEO.js} +2 -2
  62. package/dist/chunks/{chunk-32BNQ75J.js → chunk-WG24VI7K.js} +56 -2
  63. package/dist/chunks/{chunk-32BNQ75J.js.map → chunk-WG24VI7K.js.map} +2 -2
  64. package/dist/chunks/{chunk-3MEHEH6B.js → chunk-X3OD47CL.js} +12 -2
  65. package/dist/chunks/chunk-X3OD47CL.js.map +7 -0
  66. package/dist/chunks/{chunk-4JETKRFE.js → chunk-ZHJNWM6A.js} +2 -2
  67. package/dist/compaction/hook.js +2 -2
  68. package/dist/components/configuration.d.ts +42 -0
  69. package/dist/components/configuration.d.ts.map +1 -0
  70. package/dist/components/configuration.js +18 -0
  71. package/dist/components/configuration.js.map +7 -0
  72. package/dist/components/control.d.ts +76 -0
  73. package/dist/components/control.d.ts.map +1 -0
  74. package/dist/components/loader.d.ts +12 -0
  75. package/dist/components/loader.d.ts.map +1 -1
  76. package/dist/components/supervisor.d.ts.map +1 -1
  77. package/dist/components/types.d.ts +2 -0
  78. package/dist/components/types.d.ts.map +1 -1
  79. package/dist/components/validation.d.ts +6 -0
  80. package/dist/components/validation.d.ts.map +1 -0
  81. package/dist/config.d.ts +4 -2
  82. package/dist/config.d.ts.map +1 -1
  83. package/dist/core/action-registry.d.ts +1 -0
  84. package/dist/core/action-registry.d.ts.map +1 -1
  85. package/dist/core/action-registry.js +3 -3
  86. package/dist/core/auto-approval-classifier.d.ts.map +1 -1
  87. package/dist/core/media-sanitize.d.ts +45 -0
  88. package/dist/core/media-sanitize.d.ts.map +1 -0
  89. package/dist/core/model-resolution.d.ts +20 -3
  90. package/dist/core/model-resolution.d.ts.map +1 -1
  91. package/dist/core/shell-jobs.d.ts +7 -1
  92. package/dist/core/shell-jobs.d.ts.map +1 -1
  93. package/dist/entropy/compiler.d.ts +8 -0
  94. package/dist/entropy/compiler.d.ts.map +1 -1
  95. package/dist/entropy/index.js +9 -1
  96. package/dist/entropy/meter.d.ts +10 -0
  97. package/dist/entropy/meter.d.ts.map +1 -1
  98. package/dist/entropy/pool.d.ts +5 -0
  99. package/dist/entropy/pool.d.ts.map +1 -1
  100. package/dist/entropy/sessions.d.ts +12 -1
  101. package/dist/entropy/sessions.d.ts.map +1 -1
  102. package/dist/execution-service.d.ts +3 -1
  103. package/dist/execution-service.d.ts.map +1 -1
  104. package/dist/fabric-exec-tool.d.ts.map +1 -1
  105. package/dist/fabric-runtime-state.d.ts.map +1 -1
  106. package/dist/fabric-runtime-state.js +424 -65
  107. package/dist/fabric-runtime-state.js.map +4 -4
  108. package/dist/fabric-state.d.ts.map +1 -1
  109. package/dist/index.d.ts.map +1 -1
  110. package/dist/index.js +130 -51
  111. package/dist/index.js.map +3 -3
  112. package/dist/jev/browser.d.ts.map +1 -1
  113. package/dist/jev/browser.js +2 -2
  114. package/dist/jev/config.d.ts +2 -0
  115. package/dist/jev/config.d.ts.map +1 -1
  116. package/dist/jev/model-key.d.ts +6 -0
  117. package/dist/jev/model-key.d.ts.map +1 -0
  118. package/dist/jev/observation.js +3 -2
  119. package/dist/jev.js +8 -7
  120. package/dist/memory/file-worker.d.ts +15 -0
  121. package/dist/memory/file-worker.d.ts.map +1 -0
  122. package/dist/memory/file-worker.js +44 -0
  123. package/dist/memory/file-worker.js.map +7 -0
  124. package/dist/memory/worker-provider.d.ts +24 -0
  125. package/dist/memory/worker-provider.d.ts.map +1 -0
  126. package/dist/memory/worker-provider.js +18 -0
  127. package/dist/memory/worker-provider.js.map +7 -0
  128. package/dist/output-budget.d.ts.map +1 -1
  129. package/dist/prewalk/arm.d.ts.map +1 -1
  130. package/dist/prewalk/handoff.d.ts.map +1 -1
  131. package/dist/protocol.d.ts +1 -0
  132. package/dist/protocol.d.ts.map +1 -1
  133. package/dist/protocol.js +1 -1
  134. package/dist/providers/agents-actions.d.ts.map +1 -1
  135. package/dist/providers/captured-tools-provider.d.ts.map +1 -1
  136. package/dist/providers/components-provider.d.ts +5 -3
  137. package/dist/providers/components-provider.d.ts.map +1 -1
  138. package/dist/providers/jev-provider.js +7 -6
  139. package/dist/residency/actor-client.d.ts +2 -2
  140. package/dist/residency/actor-client.d.ts.map +1 -1
  141. package/dist/residency/actor-client.js +2 -2
  142. package/dist/residency/client.d.ts.map +1 -1
  143. package/dist/residency/host.js +11 -9
  144. package/dist/residency/pi-entry.js +11 -9
  145. package/dist/residency/pi-entry.js.map +1 -1
  146. package/dist/residency/protocol.d.ts +11 -2
  147. package/dist/residency/protocol.d.ts.map +1 -1
  148. package/dist/runtime/core-override-guest-types.js +2 -2
  149. package/dist/runtime/guest-types.d.ts +1 -1
  150. package/dist/runtime/guest-types.d.ts.map +1 -1
  151. package/dist/runtime/guest-types.js +1 -1
  152. package/dist/runtime/monty-runtime.js +4 -2
  153. package/dist/runtime/monty-runtime.js.map +1 -1
  154. package/dist/runtime/node-process-runtime.d.ts.map +1 -1
  155. package/dist/runtime/node-process-runtime.js +2 -2
  156. package/dist/runtime/quickjs-runtime.d.ts.map +1 -1
  157. package/dist/runtime/quickjs-runtime.js +1 -1
  158. package/dist/runtime/typescript-kernel.js +6 -6
  159. package/dist/runtime-state-builtins.d.ts.map +1 -1
  160. package/dist/schema/policy.d.ts.map +1 -1
  161. package/dist/speculation/stream-tap.d.ts.map +1 -1
  162. package/dist/storage/retention.d.ts +3 -1
  163. package/dist/storage/retention.d.ts.map +1 -1
  164. package/dist/storage/scratch.d.ts +33 -0
  165. package/dist/storage/scratch.d.ts.map +1 -0
  166. package/dist/ui/code-preview-shell.d.ts.map +1 -1
  167. package/dist/ui/controller.d.ts.map +1 -1
  168. package/dist/ui/conversation-chrome.js +2 -2
  169. package/dist/ui/conversation-native-reader.js +4 -2
  170. package/dist/ui/conversation-native-reader.js.map +2 -2
  171. package/dist/ui/conversation.js +3 -3
  172. package/dist/ui/dashboard-presentation.d.ts.map +1 -1
  173. package/dist/ui/dashboard.js +13 -9
  174. package/dist/ui/dashboard.js.map +2 -2
  175. package/dist/ui/fabric-code-parser.d.ts.map +1 -1
  176. package/dist/ui/format.d.ts +1 -0
  177. package/dist/ui/format.d.ts.map +1 -1
  178. package/dist/ui/highlight.d.ts.map +1 -1
  179. package/dist/ui/settings-rpc.d.ts.map +1 -1
  180. package/dist/ui/settings-sections-execution.d.ts.map +1 -1
  181. package/dist/ui/settings-submenus.d.ts +12 -4
  182. package/dist/ui/settings-submenus.d.ts.map +1 -1
  183. package/dist/ui/settings.js +79 -31
  184. package/dist/ui/settings.js.map +2 -2
  185. package/dist/ui/shiki-catalog.d.ts +3 -0
  186. package/dist/ui/shiki-catalog.d.ts.map +1 -0
  187. package/dist/ui/structured.d.ts.map +1 -1
  188. package/dist/ui/tool-call-timing.d.ts.map +1 -1
  189. package/dist/ui/widget.d.ts +12 -1
  190. package/dist/ui/widget.d.ts.map +1 -1
  191. package/dist/worker/model-control.d.ts.map +1 -1
  192. package/dist/worker/model-control.js +0 -1
  193. package/dist/worker/model-control.js.map +2 -2
  194. package/dist/worker.js +14 -12
  195. package/dist/worker.js.map +2 -2
  196. package/docs/agents.md +7 -3
  197. package/docs/architecture.md +1 -1
  198. package/docs/components.md +30 -1
  199. package/docs/configuration.md +24 -10
  200. package/docs/entropy.md +17 -1
  201. package/docs/jev.md +68 -3
  202. package/docs/memory-recall.md +21 -0
  203. package/package.json +5 -2
  204. package/skillsets/python/fabric-exec/references/agents.md +2 -0
  205. package/skillsets/python/fabric-jev/SKILL.md +1 -1
  206. package/skillsets/typescript/fabric-exec/SKILL.md +5 -1
  207. package/skillsets/typescript/fabric-exec/references/agents.md +4 -0
  208. package/skillsets/typescript/fabric-jev/SKILL.md +1 -1
  209. package/dist/chunks/chunk-2DMJ7MEI.js.map +0 -7
  210. package/dist/chunks/chunk-2PZWDVJB.js.map +0 -7
  211. package/dist/chunks/chunk-3MEHEH6B.js.map +0 -7
  212. package/dist/chunks/chunk-4SSMGBF4.js.map +0 -7
  213. package/dist/chunks/chunk-656HWVFU.js.map +0 -7
  214. package/dist/chunks/chunk-ARLYAW2A.js.map +0 -7
  215. package/dist/chunks/chunk-BOTRGFQQ.js.map +0 -7
  216. package/dist/chunks/chunk-CI56CW53.js.map +0 -7
  217. package/dist/chunks/chunk-CPSW2GW4.js.map +0 -7
  218. package/dist/chunks/chunk-PH7ZJ27F.js.map +0 -7
  219. package/dist/chunks/chunk-RERA6YWA.js.map +0 -7
  220. package/dist/chunks/chunk-RNOPHITP.js.map +0 -7
  221. package/dist/chunks/chunk-TSRKCXNI.js +0 -17
  222. package/dist/chunks/chunk-TSRKCXNI.js.map +0 -7
  223. package/dist/chunks/chunk-UDFDF7IY.js.map +0 -7
  224. package/dist/chunks/chunk-VRZNFNPB.js.map +0 -7
  225. package/dist/chunks/chunk-Y7KNRAFL.js.map +0 -7
  226. package/dist/chunks/chunk-ZZ4LHQYJ.js.map +0 -7
  227. /package/dist/chunks/{chunk-GXNR6NRU.js.map → chunk-2IAVP4O2.js.map} +0 -0
  228. /package/dist/chunks/{chunk-OP2KTYQB.js.map → chunk-D6YSBP3R.js.map} +0 -0
  229. /package/dist/chunks/{chunk-U6CTHPZC.js.map → chunk-MQG5QKGI.js.map} +0 -0
  230. /package/dist/chunks/{chunk-2UQV52II.js.map → chunk-RZKN534S.js.map} +0 -0
  231. /package/dist/chunks/{chunk-YK5AZ7CZ.js.map → chunk-ULLIZPBH.js.map} +0 -0
  232. /package/dist/chunks/{chunk-UTR3I23Z.js.map → chunk-W63E3WEO.js.map} +0 -0
  233. /package/dist/chunks/{chunk-4JETKRFE.js.map → chunk-ZHJNWM6A.js.map} +0 -0
@@ -6,9 +6,19 @@ import {
6
6
  piBashExitMetadata,
7
7
  piBashResultError
8
8
  } from "./chunks/chunk-PAN6C3JM.js";
9
+ import {
10
+ COMPONENT_ID_PATTERN,
11
+ FabricComponentConfiguration,
12
+ componentEntries,
13
+ validateComponentConfig,
14
+ watchComponentConfiguration
15
+ } from "./chunks/chunk-7TX532EG.js";
16
+ import {
17
+ WorkerMemoryProvider
18
+ } from "./chunks/chunk-EDL4JDW7.js";
9
19
  import {
10
20
  ResidentActorClient
11
- } from "./chunks/chunk-BOTRGFQQ.js";
21
+ } from "./chunks/chunk-RWDKJ24D.js";
12
22
  import {
13
23
  FABRIC_COMPONENT_PROVIDER_NAMES,
14
24
  FABRIC_PROVIDER_COMPONENT_PREFIX,
@@ -23,7 +33,7 @@ import {
23
33
  expandSkillDirMarkersForRead,
24
34
  resolveFabricIdentity,
25
35
  runFabricHandoffAtBoundary
26
- } from "./chunks/chunk-2DMJ7MEI.js";
36
+ } from "./chunks/chunk-M7W57BRC.js";
27
37
  import {
28
38
  AgentTranscriptReader,
29
39
  MAX_WRITE_DIFF_BYTES,
@@ -36,7 +46,7 @@ import {
36
46
  ActionRegistry,
37
47
  fabricActionListLimit,
38
48
  repairActionName
39
- } from "./chunks/chunk-CPSW2GW4.js";
49
+ } from "./chunks/chunk-JOEFBOFN.js";
40
50
  import {
41
51
  formatFabricEffectConflict
42
52
  } from "./chunks/chunk-LMAVZN7J.js";
@@ -44,9 +54,7 @@ import {
44
54
  loadCompiledSurface,
45
55
  withExclusiveFileLockAsync
46
56
  } from "./chunks/chunk-3WIGAX56.js";
47
- import {
48
- MemoryProvider
49
- } from "./chunks/chunk-UQ4LTUH4.js";
57
+ import "./chunks/chunk-UQ4LTUH4.js";
50
58
  import "./chunks/chunk-7A6NVHB5.js";
51
59
  import "./chunks/chunk-U5FYOMG5.js";
52
60
  import "./chunks/chunk-MGDLRV2R.js";
@@ -59,20 +67,24 @@ import "./chunks/chunk-IGVDD2HT.js";
59
67
  import {
60
68
  AGENTS_ACTION_DESCRIPTORS,
61
69
  normalizeAgentRunRequest
62
- } from "./chunks/chunk-2PZWDVJB.js";
70
+ } from "./chunks/chunk-BYOGRJME.js";
63
71
  import {
64
72
  actionArgNormalizer,
65
73
  uniqueDeclaredKeyForSpelling
66
74
  } from "./chunks/chunk-NQOEHX62.js";
67
75
  import {
68
76
  prepareFabricActorHostPayload
69
- } from "./chunks/chunk-4SSMGBF4.js";
77
+ } from "./chunks/chunk-QLV2IZ3F.js";
70
78
  import {
71
79
  ApprovalController,
72
80
  FabricAutoApprovalClassifier,
73
81
  FabricSessionApprovals
74
- } from "./chunks/chunk-CI56CW53.js";
82
+ } from "./chunks/chunk-NPHCGLGH.js";
75
83
  import "./chunks/chunk-XB3RJVT4.js";
84
+ import {
85
+ runAbortable,
86
+ throwIfAborted
87
+ } from "./chunks/chunk-7TB7NXSL.js";
76
88
  import {
77
89
  clearActiveCompiledSurface,
78
90
  clearActiveRepairCompiler,
@@ -80,16 +92,16 @@ import {
80
92
  setActiveRepairCompiler,
81
93
  validationMessage
82
94
  } from "./chunks/chunk-PSNXUZMY.js";
83
- import {
84
- runAbortable,
85
- throwIfAborted
86
- } from "./chunks/chunk-7TB7NXSL.js";
87
95
  import {
88
96
  FABRIC_COMPONENT_DISCOVER_EVENT,
89
97
  FABRIC_PROVIDER_DISCOVER_EVENT,
90
98
  FABRIC_TOOL_RESULT_PROXY_KIND,
91
99
  readFabricToolResultProxyDetailsV1
92
- } from "./chunks/chunk-WVH324VF.js";
100
+ } from "./chunks/chunk-FAMBJFFF.js";
101
+ import {
102
+ sanitizeFabricMediaText,
103
+ sanitizeFabricMediaValue
104
+ } from "./chunks/chunk-BJOJX2UW.js";
93
105
  import {
94
106
  ActorDirectory,
95
107
  ActorRegistryOwnershipError,
@@ -111,30 +123,34 @@ import {
111
123
  resolveInheritedSessionPins,
112
124
  resolvePiBinary,
113
125
  withInheritedSessionPins
114
- } from "./chunks/chunk-PH7ZJ27F.js";
126
+ } from "./chunks/chunk-RAEGNBRA.js";
115
127
  import {
116
128
  executeFile,
117
129
  processIsAlive,
118
130
  spawnDetached
119
131
  } from "./chunks/chunk-X7G62ZGH.js";
120
- import "./chunks/chunk-PM5I335G.js";
121
132
  import "./chunks/chunk-VPPIJRNZ.js";
133
+ import "./chunks/chunk-PM5I335G.js";
122
134
  import {
123
135
  RESIDENT_HOST_FORMAT,
136
+ abandonResidentRequest,
124
137
  residentDeliveryPrefix,
125
138
  residentHostId,
126
- residentRoot
127
- } from "./chunks/chunk-TSRKCXNI.js";
139
+ residentRoot,
140
+ sleepUnlessAborted
141
+ } from "./chunks/chunk-JNMTTJMQ.js";
128
142
  import {
129
143
  checkedHandoffCompaction
130
- } from "./chunks/chunk-GXNR6NRU.js";
144
+ } from "./chunks/chunk-2IAVP4O2.js";
131
145
  import {
132
146
  resolveAgentDir
133
147
  } from "./chunks/chunk-PXAICAUT.js";
148
+ import {
149
+ readJsonlPage
150
+ } from "./chunks/chunk-CGPK5WHX.js";
134
151
  import {
135
152
  DEFAULT_FABRIC_CONFIG,
136
153
  DEFAULT_SHELL_HANG_MS,
137
- FUZZY_RESOLUTION_MARKERS,
138
154
  FabricShellJobStore,
139
155
  MAX_AGENT_TIMEOUT_MS,
140
156
  MIN_AGENT_TIMEOUT_MS,
@@ -142,18 +158,14 @@ import {
142
158
  formatShellHangNotice,
143
159
  loadFabricConfig,
144
160
  raceShellHang,
145
- resolveAvailablePiModel,
146
- resolveFabricModel,
147
161
  trackShellOperations
148
- } from "./chunks/chunk-UDFDF7IY.js";
149
- import {
150
- readJsonlPage
151
- } from "./chunks/chunk-CGPK5WHX.js";
162
+ } from "./chunks/chunk-G7UJLM33.js";
152
163
  import "./chunks/chunk-OKOHRXGF.js";
164
+ import "./chunks/chunk-RAO6TQFP.js";
153
165
  import {
154
166
  fabricExecTitleHintCached
155
- } from "./chunks/chunk-U6CTHPZC.js";
156
- import "./chunks/chunk-656HWVFU.js";
167
+ } from "./chunks/chunk-MQG5QKGI.js";
168
+ import "./chunks/chunk-SZUXWOO7.js";
157
169
  import {
158
170
  writeJsonAtomic,
159
171
  writeJsonAtomicAsync
@@ -168,6 +180,11 @@ import {
168
180
  FABRIC_ACTOR_HOST_EVENTS,
169
181
  isFabricActorHostEvent
170
182
  } from "./chunks/chunk-OTCASLY2.js";
183
+ import {
184
+ FUZZY_RESOLUTION_MARKERS,
185
+ resolveAvailablePiModel,
186
+ resolveFabricModel
187
+ } from "./chunks/chunk-KI277YNS.js";
171
188
  import {
172
189
  isFabricThinking
173
190
  } from "./chunks/chunk-MGWQOKBV.js";
@@ -178,7 +195,7 @@ import {
178
195
  compactionRequestBoundsError,
179
196
  encodeCompactionRequest
180
197
  } from "./chunks/chunk-3H7SDWZI.js";
181
- import "./chunks/chunk-3MEHEH6B.js";
198
+ import "./chunks/chunk-X3OD47CL.js";
182
199
  import {
183
200
  FabricExecutionTraceRecorder,
184
201
  FabricTraceSafeError,
@@ -1066,7 +1083,7 @@ var FabricEffectScope = class {
1066
1083
  };
1067
1084
 
1068
1085
  // src/components/supervisor.ts
1069
- var COMPONENT_ID_PATTERN = /^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$/;
1086
+ var COMPONENT_ID_PATTERN2 = /^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$/;
1070
1087
  var PROVIDER_NAME_PATTERN = /^[a-z][a-z0-9_-]*$/;
1071
1088
  var MAX_COMPONENT_EFFECTS = 256;
1072
1089
  var MAX_SUPERVISED_COMPONENTS = 1024;
@@ -1405,7 +1422,7 @@ var FabricComponentSupervisor = class {
1405
1422
  const sequence = ++parent.childSequence;
1406
1423
  const rawLocalId = options.id ?? `${definition.name}-${sequence}`;
1407
1424
  const localId = options.id ? rawLocalId : rawLocalId.replace(/[^a-zA-Z0-9._-]/g, "-").replace(/^[^a-zA-Z0-9]+/, "") || `child-${sequence}`;
1408
- if (!COMPONENT_ID_PATTERN.test(localId)) {
1425
+ if (!COMPONENT_ID_PATTERN2.test(localId)) {
1409
1426
  throw new Error(`Invalid Fabric child component id: ${rawLocalId}`);
1410
1427
  }
1411
1428
  const joined = `${parent.entry.id}.${localId}`;
@@ -1453,7 +1470,8 @@ var FabricComponentSupervisor = class {
1453
1470
  };
1454
1471
  }
1455
1472
  #validateEntry(entry, definition) {
1456
- if (!COMPONENT_ID_PATTERN.test(entry.id)) {
1473
+ validateComponentConfig(entry, definition);
1474
+ if (!COMPONENT_ID_PATTERN2.test(entry.id)) {
1457
1475
  throw new Error(`Invalid Fabric component id: ${entry.id}`);
1458
1476
  }
1459
1477
  if (entry.component !== definition.name) {
@@ -2231,7 +2249,6 @@ var FabricComponentSupervisor = class {
2231
2249
  };
2232
2250
 
2233
2251
  // src/components/loader.ts
2234
- var ID_PATTERN = /^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$/;
2235
2252
  var message = (error) => error instanceof Error ? error.message : String(error);
2236
2253
  var cloneEntry = (entry) => structuredClone(entry);
2237
2254
  var entryHash = (entry) => stableJsonHash(entry);
@@ -2268,6 +2285,7 @@ var FabricComponentLoader = class {
2268
2285
  name: definition.name,
2269
2286
  ...definition.description ? { description: definition.description } : {},
2270
2287
  revision,
2288
+ ...definition.configSchema ? { configSchema: structuredClone(definition.configSchema) } : {},
2271
2289
  requirements: (definition.requires ?? []).map(
2272
2290
  (requirement) => typeof requirement === "string" ? requirement : requirement.ref
2273
2291
  ),
@@ -2276,6 +2294,36 @@ var FabricComponentLoader = class {
2276
2294
  )
2277
2295
  }));
2278
2296
  }
2297
+ describe(name) {
2298
+ const definition = this.definitions().find((candidate) => candidate.name === name);
2299
+ if (!definition) throw new Error(`Unknown Fabric component definition: ${name}`);
2300
+ return { ...definition, instances: this.list().filter((instance) => instance.component === name) };
2301
+ }
2302
+ validateEntries(entries) {
2303
+ const next = this.#entryMap(entries);
2304
+ for (const id of next.keys()) {
2305
+ if (this.#pinned.has(id)) throw new Error(`Fabric component entry id is reserved by a pinned component: ${id}`);
2306
+ }
2307
+ const provisions = /* @__PURE__ */ new Map();
2308
+ for (const entry of [...this.#pinned.values(), ...next.values()]) {
2309
+ if (entry.disabled) continue;
2310
+ for (const provision of this.catalog.get(entry.component)?.definition.provides ?? []) {
2311
+ const name = typeof provision === "string" ? provision : provision.provider;
2312
+ const owner = provisions.get(name);
2313
+ if (owner) throw new Error(`Fabric components ${owner} and ${entry.id} declare the same provider: ${name}`);
2314
+ provisions.set(name, entry.id);
2315
+ }
2316
+ }
2317
+ }
2318
+ unavailableProviderMessage(provider) {
2319
+ const definitions = this.definitions().filter((definition) => definition.provisions.includes(provider));
2320
+ if (!definitions.length) return void 0;
2321
+ const names = definitions.map((definition) => definition.name);
2322
+ const entries = [...this.#targetEntries().values()].filter((entry) => names.includes(entry.component));
2323
+ if (entries.length) return `Component instances ${entries.map((entry) => entry.id).join(", ")} provide ${provider}, but none is active. Inspect components.status and components.list configuration diagnostics; use components.reconcile after correcting configuration.`;
2324
+ const name = names[0];
2325
+ return `Component definition ${name} is registered, but no instance provides ${provider}. Call components.describe({component:${JSON.stringify(name)}}), then components.plan({entries:[{id:${JSON.stringify(provider)},component:${JSON.stringify(name)},config:{...}}]}) and components.apply with that plan's request and revision. Session scope needs no file edit or /fabric reload.`;
2326
+ }
2279
2327
  list() {
2280
2328
  const live = new Map(
2281
2329
  this.supervisor.list().map((info) => [
@@ -2404,13 +2452,9 @@ var FabricComponentLoader = class {
2404
2452
  }
2405
2453
  #entryMap(entries) {
2406
2454
  const next = /* @__PURE__ */ new Map();
2407
- for (const rawEntry of entries) {
2408
- const entry = cloneEntry(rawEntry);
2409
- if (!ID_PATTERN.test(entry.id)) throw new Error(`Invalid Fabric component id: ${entry.id}`);
2410
- if (!entry.component.trim()) {
2411
- throw new Error(`Fabric component entry ${entry.id} has an empty component name`);
2412
- }
2413
- if (next.has(entry.id)) throw new Error(`Duplicate Fabric component entry id: ${entry.id}`);
2455
+ for (const entry of componentEntries(entries)) {
2456
+ const definition = this.catalog.get(entry.component)?.definition;
2457
+ if (definition) validateComponentConfig(entry, definition);
2414
2458
  next.set(entry.id, entry);
2415
2459
  }
2416
2460
  return next;
@@ -2430,6 +2474,7 @@ var FabricComponentLoader = class {
2430
2474
  if (entry.disabled) continue;
2431
2475
  const catalogEntry = this.catalog.get(entry.component);
2432
2476
  if (!catalogEntry) continue;
2477
+ validateComponentConfig(entry, catalogEntry.definition);
2433
2478
  targets.set(entry.id, {
2434
2479
  entry: cloneEntry(entry),
2435
2480
  definition: catalogEntry.definition,
@@ -2512,6 +2557,198 @@ var FabricComponentLoader = class {
2512
2557
  }
2513
2558
  };
2514
2559
 
2560
+ // src/components/control.ts
2561
+ var hash = (value) => stableJsonHash(value);
2562
+ var FabricComponentControl = class {
2563
+ constructor(loader, options = {}) {
2564
+ this.loader = loader;
2565
+ this.options = options;
2566
+ this.#base = structuredClone(options.initialEntries ?? loader.entries());
2567
+ try {
2568
+ this.#snapshot = options.store?.read();
2569
+ } catch (error) {
2570
+ this.#error = error instanceof Error ? error.message : String(error);
2571
+ }
2572
+ }
2573
+ #base;
2574
+ #overrides = /* @__PURE__ */ new Map();
2575
+ #snapshot;
2576
+ #tail = Promise.resolve();
2577
+ #epoch = 0;
2578
+ #closed = false;
2579
+ #error;
2580
+ configuration() {
2581
+ return {
2582
+ sessionOverrides: [...this.#overrides.keys()].sort(),
2583
+ sources: structuredClone(this.#snapshot?.sources ?? []),
2584
+ warnings: [...this.#snapshot?.warnings ?? []],
2585
+ ...this.#error ? { error: this.#error } : {},
2586
+ removalPolicy: "drain"
2587
+ };
2588
+ }
2589
+ plan(request) {
2590
+ return this.#enqueue(() => this.#prepare(request).plan);
2591
+ }
2592
+ apply(request, signal) {
2593
+ return this.#enqueue(async () => {
2594
+ this.options.assertMutable?.();
2595
+ signal?.throwIfAborted();
2596
+ await this.loader.settle();
2597
+ signal?.throwIfAborted();
2598
+ const prepared = this.#prepare(request);
2599
+ if (request.expectedRevision !== prepared.plan.revision) throw new Error("Component plan is stale; call components.plan again");
2600
+ const previous = this.loader.entries();
2601
+ await this.loader.reconcile(prepared.effective);
2602
+ let snapshot = prepared.snapshot;
2603
+ try {
2604
+ if (prepared.persisted) {
2605
+ snapshot = this.options.store.write(prepared.plan.request.scope, prepared.persisted, snapshot.revision);
2606
+ } else if (snapshot && this.options.store.read().revision !== snapshot.revision) {
2607
+ throw new Error("Component configuration changed during activation; plan again");
2608
+ }
2609
+ } catch (error) {
2610
+ try {
2611
+ await this.loader.reconcile(previous);
2612
+ } catch (rollback) {
2613
+ throw new AggregateError([error, rollback], "Component apply and rollback failed");
2614
+ }
2615
+ throw error;
2616
+ }
2617
+ this.#base = prepared.base;
2618
+ this.#overrides = prepared.overrides;
2619
+ this.#snapshot = snapshot;
2620
+ this.#epoch++;
2621
+ this.#error = void 0;
2622
+ this.options.applied?.(structuredClone(prepared.effective));
2623
+ return { components: this.loader.list(), configuration: this.configuration(), scope: prepared.plan.request.scope };
2624
+ });
2625
+ }
2626
+ reconcile(entries) {
2627
+ return this.#enqueue(async () => {
2628
+ this.options.assertMutable?.();
2629
+ const snapshot = this.options.store?.read();
2630
+ if (!entries && !snapshot) throw new Error("No host configuration source is available for components.reconcile");
2631
+ if (!entries && snapshot?.revision === this.#snapshot?.revision && hash(snapshot?.entries) === hash(this.#base)) {
2632
+ this.#snapshot = snapshot;
2633
+ this.#error = void 0;
2634
+ return { components: this.loader.list(), configuration: this.configuration() };
2635
+ }
2636
+ const base = componentEntries(entries ?? snapshot.entries);
2637
+ const effective = this.#effective(base, this.#overrides);
2638
+ this.loader.validateEntries(effective);
2639
+ await this.loader.reconcile(effective);
2640
+ this.#base = base;
2641
+ this.#snapshot = snapshot;
2642
+ this.#epoch++;
2643
+ this.#error = void 0;
2644
+ this.options.applied?.(structuredClone(effective));
2645
+ return { components: this.loader.list(), configuration: this.configuration() };
2646
+ });
2647
+ }
2648
+ reload(id) {
2649
+ return this.#enqueue(async () => {
2650
+ const components = await this.loader.reload(id);
2651
+ this.#epoch++;
2652
+ this.#error = void 0;
2653
+ return { components };
2654
+ });
2655
+ }
2656
+ async settle() {
2657
+ await this.#tail;
2658
+ }
2659
+ async close() {
2660
+ this.#closed = true;
2661
+ await this.#tail;
2662
+ }
2663
+ #prepare(input) {
2664
+ const scope = input.scope ?? "session";
2665
+ if (!["session", "global", "project"].includes(scope)) throw new Error("Invalid component configuration scope");
2666
+ const entries = componentEntries(input.entries ?? []);
2667
+ const ids = (values) => {
2668
+ if (!Array.isArray(values) || values.length > 256 || values.some((id) => typeof id !== "string" || !COMPONENT_ID_PATTERN.test(id))) throw new Error("Invalid component change IDs");
2669
+ return [...values];
2670
+ };
2671
+ const remove = ids(input.remove ?? []);
2672
+ const reset = ids(input.reset ?? []);
2673
+ const changed = [...entries.map((entry) => entry.id), ...remove, ...reset];
2674
+ if (!changed.length) throw new Error("Component plan needs entries, remove, or reset");
2675
+ if (new Set(changed).size !== changed.length) throw new Error("A component may appear only once in a change request");
2676
+ const pinned = new Set(this.loader.pinnedEntries().map((entry) => entry.id));
2677
+ if (changed.some((id) => pinned.has(id) || id.startsWith("fabric.provider.")) || entries.some((entry) => entry.component.startsWith("fabric.provider."))) throw new Error("Live component changes cannot modify reserved built-in components");
2678
+ if (scope !== "session" && reset.length) throw new Error("reset is available only for session overrides");
2679
+ const snapshot = this.options.store?.read();
2680
+ if (scope !== "session" && !snapshot) throw new Error("Persistent component configuration is unavailable in this host");
2681
+ if (scope === "project" && !snapshot.sources.find((source) => source.scope === "project")?.trusted) throw new Error("Cannot write project components in an untrusted project");
2682
+ const base = structuredClone(snapshot?.entries ?? this.#base);
2683
+ const overrides = new Map(this.#overrides);
2684
+ let nextBase = base;
2685
+ let persisted;
2686
+ if (scope === "session") {
2687
+ for (const entry of entries) overrides.set(entry.id, entry);
2688
+ for (const id of remove) overrides.set(id, null);
2689
+ for (const id of reset) overrides.delete(id);
2690
+ } else {
2691
+ const layer = scope === "global" ? snapshot.layers.global : snapshot.layers.project ?? snapshot.layers.global;
2692
+ const patched = new Map(layer.map((entry) => [entry.id, entry]));
2693
+ for (const entry of entries) patched.set(entry.id, entry);
2694
+ for (const id of remove) patched.delete(id);
2695
+ persisted = [...patched.values()];
2696
+ this.loader.validateEntries(persisted);
2697
+ nextBase = scope === "global" ? snapshot.layers.project ?? persisted : persisted;
2698
+ }
2699
+ if (overrides.size > 256) throw new Error("Fabric supports at most 256 session component overrides, including removal masks");
2700
+ const effective = this.#effective(nextBase, overrides);
2701
+ this.loader.validateEntries(effective);
2702
+ const before = new Map(this.loader.entries().map((entry) => [entry.id, entry]));
2703
+ const after = new Map(effective.map((entry) => [entry.id, entry]));
2704
+ const definitions = this.loader.definitions();
2705
+ const changes = [];
2706
+ for (const id of [.../* @__PURE__ */ new Set([...before.keys(), ...after.keys()])].sort()) {
2707
+ const old = before.get(id), next = after.get(id);
2708
+ if (hash(old ?? null) === hash(next ?? null)) continue;
2709
+ const entry = next ?? old;
2710
+ const definition = definitions.find((candidate) => candidate.name === entry.component);
2711
+ changes.push({ id, operation: !next ? "remove" : old ? "replace" : "add", component: entry.component, requirements: definition?.requirements ?? [], provisions: definition?.provisions ?? [] });
2712
+ }
2713
+ const warnings = [...snapshot?.warnings ?? []];
2714
+ if (scope === "global" && snapshot?.layers.project) warnings.push("The project's components array shadows the global array; this write may not change live instances.");
2715
+ if (scope !== "session" && changed.some((id) => overrides.has(id))) warnings.push("Session overrides remain in effect; reset those IDs in session scope to use persisted values.");
2716
+ for (const entry of effective) {
2717
+ if (!entry.disabled && !this.loader.catalog.get(entry.component)) warnings.push(`Definition ${entry.component} is unavailable; ${entry.id} will wait for registration.`);
2718
+ }
2719
+ if (changes.some((change) => change.operation !== "add")) warnings.push("Replacement/removal retires the old generation; existing committed views may drain. This is not immediate revocation or rollback of issued effects.");
2720
+ const revision = hash({ epoch: this.#epoch, source: snapshot?.revision, entries: this.loader.entries(), definitions, instances: this.loader.list().map(({ id, revision: revision2 }) => ({ id, revision: revision2 })) });
2721
+ return {
2722
+ plan: { revision, request: { scope, entries, remove, reset }, changes, warnings, sources: structuredClone(snapshot?.sources ?? []) },
2723
+ snapshot,
2724
+ base: structuredClone(nextBase),
2725
+ overrides,
2726
+ effective,
2727
+ persisted
2728
+ };
2729
+ }
2730
+ #effective(base, overrides) {
2731
+ const effective = new Map(base.map((entry) => [entry.id, entry]));
2732
+ for (const [id, entry] of overrides) {
2733
+ if (entry) effective.set(id, entry);
2734
+ else effective.delete(id);
2735
+ }
2736
+ return componentEntries([...effective.values()]);
2737
+ }
2738
+ #enqueue(operation) {
2739
+ this.loader.supervisor.assertLifecycleEntryAllowed("change component configuration");
2740
+ if (this.#closed) return Promise.reject(new Error("Component control is closed"));
2741
+ const task = this.#tail.then(() => {
2742
+ if (this.#closed) throw new Error("Component control is closed");
2743
+ return operation();
2744
+ });
2745
+ this.#tail = task.then(() => void 0, (error) => {
2746
+ this.#error = error instanceof Error ? error.message : String(error);
2747
+ });
2748
+ return task;
2749
+ }
2750
+ };
2751
+
2515
2752
  // src/core/compact-controller.ts
2516
2753
  var DEFAULT_REQUESTED_BY = "model";
2517
2754
  var isString = (value) => typeof value === "string" && value.length > 0;
@@ -3376,18 +3613,20 @@ Recovery hint: ${hint}`;
3376
3613
  const runOutcome = executionOutcomeFromTermination(sandboxResult.terminationReason);
3377
3614
  const succeeded = runOutcome === "succeeded";
3378
3615
  this.activity?.finish(options.parentToolCallId, succeeded, sandboxResult.error);
3616
+ const sanitizedValue = sanitizeFabricMediaValue(sandboxResult.value);
3379
3617
  return {
3380
3618
  success: succeeded,
3381
3619
  kernel: python ? "python" : "typescript",
3382
- value: sandboxResult.value,
3383
- logs: sandboxResult.logs,
3620
+ value: sanitizedValue.value,
3621
+ logs: sandboxResult.logs.map(sanitizeFabricMediaText),
3622
+ ...sanitizedValue.images.length > 0 ? { media: sanitizedValue.images } : {},
3384
3623
  audits,
3385
3624
  phases,
3386
3625
  // Guest and provider error text may embed tool output or source
3387
3626
  // literals, so the durable trace records only safe causes.
3388
3627
  trace: traceRecorder.seal(runOutcome, phases),
3389
3628
  elapsedMs: performance.now() - startedAt,
3390
- ...sandboxResult.error ? { error: sandboxResult.error } : {},
3629
+ ...sandboxResult.error ? { error: sanitizeFabricMediaText(sandboxResult.error) } : {},
3391
3630
  ...handoffRequest ? { handoffRequest } : {},
3392
3631
  ...classifierUsages.length > 0 ? { usage: aggregateUsage(classifierUsages) } : {}
3393
3632
  };
@@ -4138,6 +4377,7 @@ var toolCallBlock = (partial, contentIndex) => {
4138
4377
  };
4139
4378
  };
4140
4379
  var PARSE_INTERVAL_MS = 50;
4380
+ var EAGER_PARSE_CHARS = 1024;
4141
4381
  var FabricSpeculationStreamTap = class {
4142
4382
  #options;
4143
4383
  #streams = /* @__PURE__ */ new Map();
@@ -4162,6 +4402,7 @@ var FabricSpeculationStreamTap = class {
4162
4402
  const code = stream.extractor.code;
4163
4403
  if (!stream.isFabricExec || code === void 0) continue;
4164
4404
  try {
4405
+ stream.scannedLength = code.length;
4165
4406
  for (const candidate of stream.scanner.push(code)) {
4166
4407
  if (this.#options.isEligible(candidate.ref)) {
4167
4408
  this.#pendingCatchUp.push({ stream, candidate });
@@ -4203,6 +4444,7 @@ var FabricSpeculationStreamTap = class {
4203
4444
  toolCallId: block.id ?? `index-${assistantEvent.contentIndex}`,
4204
4445
  isFabricExec: block.name !== void 0 ? block.name === "fabric_exec" : true,
4205
4446
  extractor: new PartialCodeFieldExtractor(this.#options.maxBufferBytes()),
4447
+ scannedLength: 0,
4206
4448
  ...this.#createScanner ? { scanner: this.#createScanner() } : {}
4207
4449
  });
4208
4450
  return;
@@ -4213,6 +4455,7 @@ var FabricSpeculationStreamTap = class {
4213
4455
  const block = toolCallBlock(assistantEvent.partial, assistantEvent.contentIndex);
4214
4456
  if (block.id) stream.toolCallId = block.id;
4215
4457
  if (block.name !== void 0) stream.isFabricExec = block.name === "fabric_exec";
4458
+ if (!stream.isFabricExec) return;
4216
4459
  stream.extractor.push(assistantEvent.delta);
4217
4460
  const code = stream.extractor.code;
4218
4461
  if (!stream.isFabricExec || code === void 0) return;
@@ -4237,8 +4480,10 @@ var FabricSpeculationStreamTap = class {
4237
4480
  #scan(stream, code, context, force) {
4238
4481
  const now = Date.now();
4239
4482
  if (!force && now - this.#lastParseAt < PARSE_INTERVAL_MS) return;
4240
- this.#lastParseAt = now;
4241
4483
  if (!stream.scanner) return;
4484
+ if (!force && stream.scannedLength >= EAGER_PARSE_CHARS && code.length >= stream.scannedLength && code.length < Math.ceil(stream.scannedLength * 1.25)) return;
4485
+ this.#lastParseAt = now;
4486
+ stream.scannedLength = code.length;
4242
4487
  const candidates = stream.scanner.push(code);
4243
4488
  for (const candidate of candidates) {
4244
4489
  if (this.#options.isEligible(candidate.ref)) {
@@ -4349,6 +4594,7 @@ var allowedEnforceRefs = /* @__PURE__ */ new Set([
4349
4594
  "mesh.list",
4350
4595
  "compact.status",
4351
4596
  "components.list",
4597
+ "components.describe",
4352
4598
  "components.status",
4353
4599
  "components.graph",
4354
4600
  "schema.status",
@@ -4670,7 +4916,7 @@ var ResidencyClient = class {
4670
4916
  if (signal?.aborted) throw new Error(`Waiting for durable Fabric agent ${id} was aborted`);
4671
4917
  const status = this.statusAgent(id);
4672
4918
  if (terminal(status.status) && "startedAt" in status) return status;
4673
- await delay(STATUS_POLL_MS);
4919
+ await sleepUnlessAborted(STATUS_POLL_MS, signal).catch(() => void 0);
4674
4920
  }
4675
4921
  }
4676
4922
  readAgentLog(id, options = {}) {
@@ -4756,19 +5002,24 @@ var ResidencyClient = class {
4756
5002
  const responsePath = path4.join(this.#responsesPath, `${command.requestId}.json`);
4757
5003
  atomicWrite2(path4.join(this.#requestsPath, `${command.requestId}.json`), command);
4758
5004
  const deadline = Date.now() + COMMAND_TIMEOUT_MS;
4759
- while (Date.now() < deadline) {
4760
- if (signal?.aborted) throw new Error("Fabric residency request was aborted");
4761
- const response = readJson(responsePath);
4762
- if (response?.format === RESIDENT_HOST_FORMAT && response.requestId === command.requestId) {
4763
- fs4.rmSync(responsePath, { force: true });
4764
- if (!response.ok) throw new Error(response.error ?? "Fabric resident host rejected request");
4765
- return response;
5005
+ try {
5006
+ while (Date.now() < deadline) {
5007
+ if (signal?.aborted) throw new Error("Fabric residency request was aborted");
5008
+ const response = readJson(responsePath);
5009
+ if (response?.format === RESIDENT_HOST_FORMAT && response.requestId === command.requestId) {
5010
+ fs4.rmSync(responsePath, { force: true });
5011
+ if (!response.ok) throw new Error(response.error ?? "Fabric resident host rejected request");
5012
+ return response;
5013
+ }
5014
+ const owner = this.#liveOwner();
5015
+ if (!owner) throw new Error("Fabric resident host exited while processing a request");
5016
+ await sleepUnlessAborted(STATUS_POLL_MS, signal).catch(() => void 0);
4766
5017
  }
4767
- const owner = this.#liveOwner();
4768
- if (!owner) throw new Error("Fabric resident host exited while processing a request");
4769
- await delay(STATUS_POLL_MS);
5018
+ throw new Error(`Timed out waiting for Fabric residency request ${command.requestId}`);
5019
+ } catch (error) {
5020
+ abandonResidentRequest(this.#requestsPath, this.#responsesPath, command.requestId);
5021
+ throw error;
4770
5022
  }
4771
- throw new Error(`Timed out waiting for Fabric residency request ${command.requestId}`);
4772
5023
  }
4773
5024
  async #waitForParticipant(id, kind) {
4774
5025
  const deadline = Date.now() + STARTUP_TIMEOUT_MS;
@@ -6300,6 +6551,23 @@ var CompactProvider = class {
6300
6551
  };
6301
6552
 
6302
6553
  // src/providers/components-provider.ts
6554
+ var entrySchema = {
6555
+ type: "object",
6556
+ properties: {
6557
+ id: { type: "string", minLength: 1, maxLength: 128 },
6558
+ component: { type: "string", minLength: 1, maxLength: 128 },
6559
+ config: {},
6560
+ disabled: { type: "boolean" }
6561
+ },
6562
+ required: ["id", "component"],
6563
+ additionalProperties: false
6564
+ };
6565
+ var changeProperties = {
6566
+ scope: { type: "string", enum: ["session", "global", "project"], description: "Defaults to session: no file writes. Persistent scope must be explicit." },
6567
+ entries: { type: "array", items: entrySchema, maxItems: 256, description: "Upsert complete entries by id; other entries are preserved." },
6568
+ remove: { type: "array", items: { type: "string" }, maxItems: 256 },
6569
+ reset: { type: "array", items: { type: "string" }, maxItems: 256, description: "Session only: remove overlays and use trusted file configuration for these IDs." }
6570
+ };
6303
6571
  var descriptors2 = [
6304
6572
  {
6305
6573
  name: "list",
@@ -6327,6 +6595,34 @@ var descriptors2 = [
6327
6595
  risk: "read",
6328
6596
  effect: { kind: "none", resources: ["fabric:components"], ordering: "commutative" }
6329
6597
  },
6598
+ {
6599
+ name: "describe",
6600
+ description: "Inspect a registered component definition, its config JSON Schema, declared requirements/provisions, and instances, even before activation.",
6601
+ inputSchema: { type: "object", properties: { component: { type: "string", minLength: 1 } }, required: ["component"], additionalProperties: false },
6602
+ risk: "read",
6603
+ effect: { kind: "none", resources: ["fabric:components"], ordering: "commutative" }
6604
+ },
6605
+ {
6606
+ name: "plan",
6607
+ description: "Validate a component configuration change without activation or file writes. Returns a request and revision for apply, changes, trust provenance, and warnings. A plan is not approval or a connectivity check.",
6608
+ inputSchema: { type: "object", properties: changeProperties, additionalProperties: false },
6609
+ risk: "read",
6610
+ effect: { kind: "none", resources: ["fabric:components"], ordering: "commutative" }
6611
+ },
6612
+ {
6613
+ name: "apply",
6614
+ description: "Apply a validated component change without reloading Fabric. Pass the planned request plus expectedRevision. Session scope is ephemeral; global/project scopes write only components atomically. Runs pinned to retired generations may drain; this is not immediate revocation. Trusted host code may execute during activation. Unavailable to committed guest views.",
6615
+ inputSchema: { type: "object", properties: { ...changeProperties, expectedRevision: { type: "string", minLength: 1 } }, required: ["expectedRevision"], additionalProperties: false },
6616
+ risk: "execute",
6617
+ effect: { kind: "emission", resources: ["fabric:components", "fabric:configuration"], ordering: "ordered" }
6618
+ },
6619
+ {
6620
+ name: "reconcile",
6621
+ description: "Re-read trusted component configuration and reconcile changed instances without restarting unrelated providers. Session overrides remain. Invalid edits retain the last applied state. Unavailable to committed guest views.",
6622
+ inputSchema: { type: "object", additionalProperties: false },
6623
+ risk: "execute",
6624
+ effect: { kind: "transactional", resources: ["fabric:components"], ordering: "ordered" }
6625
+ },
6330
6626
  {
6331
6627
  name: "reload",
6332
6628
  description: "Restart one component, or all loaded components, with rollback to the previous revision on activation failure.",
@@ -6340,8 +6636,9 @@ var descriptors2 = [
6340
6636
  }
6341
6637
  ];
6342
6638
  var ComponentsProvider = class {
6343
- constructor(loader) {
6639
+ constructor(loader, control = new FabricComponentControl(loader)) {
6344
6640
  this.loader = loader;
6641
+ this.control = control;
6345
6642
  }
6346
6643
  name = "components";
6347
6644
  description = "Supervised component lifecycle, exact capability dependencies, effect cleanup, and reload diagnostics.";
@@ -6355,13 +6652,31 @@ var ComponentsProvider = class {
6355
6652
  async describe(actionName, _context) {
6356
6653
  return descriptors2.find((descriptor) => descriptor.name === actionName);
6357
6654
  }
6358
- async invoke(actionName, args, _context) {
6655
+ async invoke(actionName, args, context) {
6656
+ const descriptor = descriptors2.find((action) => action.name === actionName);
6657
+ if (descriptor) {
6658
+ const invalid = validationMessage(descriptor.inputSchema, args);
6659
+ if (invalid) throw new Error(`Invalid components.${actionName} arguments: ${invalid}`);
6660
+ }
6661
+ if (["apply", "reconcile"].includes(actionName) && context.capabilityView) {
6662
+ throw new Error("Component configuration changes require an unrestricted host caller, not a committed guest capability view");
6663
+ }
6664
+ context.signal?.throwIfAborted();
6359
6665
  switch (actionName) {
6360
6666
  case "list":
6361
6667
  return {
6362
6668
  definitions: this.loader.definitions(),
6363
- components: this.loader.list()
6669
+ components: this.loader.list(),
6670
+ configuration: this.control.configuration()
6364
6671
  };
6672
+ case "describe":
6673
+ return this.loader.describe(args.component);
6674
+ case "plan":
6675
+ return this.control.plan(args);
6676
+ case "apply":
6677
+ return this.control.apply({ ...args, expectedRevision: args.expectedRevision }, context.signal);
6678
+ case "reconcile":
6679
+ return this.control.reconcile();
6365
6680
  case "status": {
6366
6681
  const id = args.id;
6367
6682
  if (typeof id !== "string" || !id.trim()) throw new Error("components.status requires id");
@@ -6374,9 +6689,7 @@ var ComponentsProvider = class {
6374
6689
  if (id !== void 0 && (typeof id !== "string" || !id.trim())) {
6375
6690
  throw new Error("components.reload id must be a non-empty string");
6376
6691
  }
6377
- return {
6378
- components: await this.loader.reload(typeof id === "string" ? id : void 0)
6379
- };
6692
+ return this.control.reload(typeof id === "string" ? id : void 0);
6380
6693
  }
6381
6694
  default:
6382
6695
  throw new Error(`Unknown components action: ${actionName}`);
@@ -6564,6 +6877,8 @@ var CapturedToolsProvider = class {
6564
6877
  result,
6565
6878
  isError
6566
6879
  }));
6880
+ const images = result.content.filter((part) => part.type === "image");
6881
+ if (images.length > 0) context.attachMedia?.(images);
6567
6882
  if (isError) {
6568
6883
  if (isPiShellToolName(entry.name)) {
6569
6884
  throw piBashResultError(thrown, textFromContent2(result.content));
@@ -9625,7 +9940,7 @@ var RuntimeStateBuiltins = class {
9625
9940
  await this.install(createProviderComponent({
9626
9941
  provider: "memory",
9627
9942
  description: "Session memory index and source hydration",
9628
- create: () => new MemoryProvider(memoryContext)
9943
+ create: () => new WorkerMemoryProvider(memoryContext)
9629
9944
  }));
9630
9945
  } else {
9631
9946
  this.registry.markUnavailable(
@@ -10838,6 +11153,9 @@ var FabricRuntimeState = class {
10838
11153
  #schema;
10839
11154
  #componentSupervisor;
10840
11155
  #componentLoader;
11156
+ #componentControl;
11157
+ #componentConfiguration;
11158
+ #stopComponentWatch;
10841
11159
  #componentTransitionSignatures = /* @__PURE__ */ new Map();
10842
11160
  #componentTransitionPublications = /* @__PURE__ */ new Set();
10843
11161
  #sessionCapabilityLease;
@@ -11009,7 +11327,25 @@ var FabricRuntimeState = class {
11009
11327
  this.componentCatalog,
11010
11328
  this.#componentSupervisor
11011
11329
  );
11012
- this.#registry.register(this.#managedHost?.provider("components") ?? new ComponentsProvider(this.#componentLoader));
11330
+ if (!this.#managedHost && this.#config.schema.mode !== "enforce") {
11331
+ this.#componentConfiguration = new FabricComponentConfiguration({
11332
+ cwd: context.cwd,
11333
+ agentDir: resolveAgentDir(),
11334
+ projectTrusted: () => context.isProjectTrusted()
11335
+ });
11336
+ }
11337
+ this.#componentControl = new FabricComponentControl(this.#componentLoader, {
11338
+ ...this.#componentConfiguration ? { store: this.#componentConfiguration } : {},
11339
+ initialEntries: this.#config.schema.mode === "enforce" ? [] : this.#config.components,
11340
+ assertMutable: () => {
11341
+ if (this.#managedHost || this.#config?.schema.mode === "enforce") throw new Error("Live component configuration is unavailable in managed hosts and Schema enforce mode");
11342
+ },
11343
+ applied: (entries) => {
11344
+ if (this.#config) this.#config.components = entries;
11345
+ }
11346
+ });
11347
+ this.#registry.setUnavailableResolver((name) => this.#componentLoader?.unavailableProviderMessage(name));
11348
+ this.#registry.register(this.#managedHost?.provider("components") ?? new ComponentsProvider(this.#componentLoader, this.#componentControl));
11013
11349
  const builtinManifest = new FabricProviderComponentManifest(
11014
11350
  this.componentCatalog,
11015
11351
  this.#componentLoader
@@ -11492,6 +11828,18 @@ ${escapeXmlText(advice.message)}
11492
11828
  };
11493
11829
  this.pi.events.emit(FABRIC_COMPONENT_DISCOVER_EVENT, componentDiscovery);
11494
11830
  await this.components.reconcile(enforceSchema ? [] : this.config.components);
11831
+ const configuration = this.#componentConfiguration;
11832
+ const control = this.#componentControl;
11833
+ if (configuration && control) {
11834
+ this.#stopComponentWatch = watchComponentConfiguration(configuration.paths, () => {
11835
+ void control.reconcile().catch((error) => {
11836
+ if (context.hasUI) context.ui.notify(`Pi Fabric component configuration not applied: ${error instanceof Error ? error.message : String(error)}`, "error");
11837
+ });
11838
+ });
11839
+ for (const warning of control.configuration().warnings) {
11840
+ if (context.hasUI) context.ui.notify(warning, "warning");
11841
+ }
11842
+ }
11495
11843
  }
11496
11844
  async ensure(context) {
11497
11845
  if (!this.initialized || this.#cwd !== context.cwd) await this.initialize(context);
@@ -11525,7 +11873,7 @@ ${escapeXmlText(advice.message)}
11525
11873
  this.prewalkDrift.drop(context.sessionManager.getSessionId());
11526
11874
  if (context.hasUI) context.ui.setStatus("fabric-prewalk", void 0);
11527
11875
  }
11528
- void this.#componentLoader?.reconcile(next.components).catch((error) => {
11876
+ void (this.#componentControl?.reconcile(next.components) ?? this.#componentLoader?.reconcile(next.components))?.catch((error) => {
11529
11877
  if (this.#config) this.#config.components = previousComponents;
11530
11878
  const detail = error instanceof Error ? error.message : String(error);
11531
11879
  if (context.hasUI) context.ui.notify(`Pi Fabric component reload failed: ${detail}`, "error");
@@ -11741,6 +12089,7 @@ ${escapeXmlText(advice.message)}
11741
12089
  this.componentCatalog.register(component, options);
11742
12090
  }
11743
12091
  async settleComponents() {
12092
+ await this.#componentControl?.settle();
11744
12093
  await this.#componentLoader?.settle();
11745
12094
  }
11746
12095
  async shutdown() {
@@ -11748,6 +12097,11 @@ ${escapeXmlText(advice.message)}
11748
12097
  await this.#deactivateRepairs();
11749
12098
  clearActiveCompiledSurface();
11750
12099
  await this.#participants?.quiesce().catch(() => void 0);
12100
+ this.#stopComponentWatch?.();
12101
+ this.#stopComponentWatch = void 0;
12102
+ await this.#componentControl?.close();
12103
+ this.#componentControl = void 0;
12104
+ this.#componentConfiguration = void 0;
11751
12105
  await this.#componentLoader?.close();
11752
12106
  await Promise.allSettled([...this.#componentTransitionPublications]);
11753
12107
  await this.#sessionCapabilityLease?.release().catch(() => void 0);
@@ -11828,6 +12182,11 @@ ${escapeXmlText(advice.message)}
11828
12182
  await this.#deactivateRepairs();
11829
12183
  if (!this.#registry) return;
11830
12184
  await this.#participants?.quiesce().catch(() => void 0);
12185
+ this.#stopComponentWatch?.();
12186
+ this.#stopComponentWatch = void 0;
12187
+ await this.#componentControl?.close();
12188
+ this.#componentControl = void 0;
12189
+ this.#componentConfiguration = void 0;
11831
12190
  await this.#componentLoader?.close();
11832
12191
  await Promise.allSettled([...this.#componentTransitionPublications]);
11833
12192
  await this.#sessionCapabilityLease?.release().catch(() => void 0);