@e4779/pi-fabric 0.92.24-fork.4 → 0.92.41-fork.6

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 (271) hide show
  1. package/README.md +2 -1
  2. package/dist/actors/host-event-payload.d.ts.map +1 -1
  3. package/dist/actors/types.d.ts +1 -1
  4. package/dist/actors/types.d.ts.map +1 -1
  5. package/dist/agents/completion-inbox.d.ts +15 -0
  6. package/dist/agents/completion-inbox.d.ts.map +1 -0
  7. package/dist/agents/handoff.d.ts.map +1 -1
  8. package/dist/agents/manager.d.ts +1 -0
  9. package/dist/agents/manager.d.ts.map +1 -1
  10. package/dist/agents/request.d.ts +4 -0
  11. package/dist/agents/request.d.ts.map +1 -1
  12. package/dist/agents/thinking-transfer.d.ts.map +1 -1
  13. package/dist/agents/transports/process-utils.d.ts.map +1 -1
  14. package/dist/agents.js +3 -2
  15. package/dist/agents.js.map +1 -1
  16. package/dist/build-identity.d.ts +21 -0
  17. package/dist/build-identity.d.ts.map +1 -0
  18. package/dist/chunks/{chunk-RERA6YWA.js → chunk-2A2NWQ36.js} +13 -5
  19. package/dist/chunks/chunk-2A2NWQ36.js.map +7 -0
  20. package/dist/chunks/{chunk-OTCASLY2.js → chunk-2QAOC3BO.js} +1 -1
  21. package/dist/chunks/chunk-2QAOC3BO.js.map +7 -0
  22. package/dist/chunks/{chunk-2PZWDVJB.js → chunk-2SWRVIYJ.js} +21 -9
  23. package/dist/chunks/chunk-2SWRVIYJ.js.map +7 -0
  24. package/dist/chunks/{chunk-4JETKRFE.js → chunk-36B4AIRT.js} +2 -2
  25. package/dist/chunks/{chunk-KFZYTGF5.js → chunk-3TXOQ5MG.js} +60 -46
  26. package/dist/chunks/chunk-3TXOQ5MG.js.map +7 -0
  27. package/dist/chunks/{chunk-VWSXAEX6.js → chunk-4NUTVNS2.js} +44 -202
  28. package/dist/chunks/chunk-4NUTVNS2.js.map +7 -0
  29. package/dist/chunks/{chunk-VYXFSUWU.js → chunk-77PDIBK2.js} +12 -1
  30. package/dist/chunks/{chunk-VYXFSUWU.js.map → chunk-77PDIBK2.js.map} +2 -2
  31. package/dist/chunks/{chunk-X7G62ZGH.js → chunk-7BG5COXB.js} +8 -3
  32. package/dist/chunks/{chunk-X7G62ZGH.js.map → chunk-7BG5COXB.js.map} +2 -2
  33. package/dist/chunks/{chunk-IYQ5MNCW.js → chunk-7VAZ4N43.js} +42 -24
  34. package/dist/chunks/chunk-7VAZ4N43.js.map +7 -0
  35. package/dist/chunks/chunk-A4VP7HDF.js +226 -0
  36. package/dist/chunks/chunk-A4VP7HDF.js.map +7 -0
  37. package/dist/chunks/chunk-B54Z662X.js +127 -0
  38. package/dist/chunks/chunk-B54Z662X.js.map +7 -0
  39. package/dist/chunks/{chunk-4SSMGBF4.js → chunk-CGL7QP4A.js} +58 -8
  40. package/dist/chunks/chunk-CGL7QP4A.js.map +7 -0
  41. package/dist/chunks/{chunk-32BNQ75J.js → chunk-FLKGJPCN.js} +99 -3
  42. package/dist/chunks/chunk-FLKGJPCN.js.map +7 -0
  43. package/dist/chunks/{chunk-QX3TUAWO.js → chunk-GGETIGM5.js} +487 -707
  44. package/dist/chunks/chunk-GGETIGM5.js.map +7 -0
  45. package/dist/chunks/{chunk-WVH324VF.js → chunk-IJL3QK3J.js} +3 -1
  46. package/dist/chunks/chunk-IJL3QK3J.js.map +7 -0
  47. package/dist/chunks/{chunk-3CPWRPCE.js → chunk-IK6PPFWG.js} +17 -6
  48. package/dist/chunks/chunk-IK6PPFWG.js.map +7 -0
  49. package/dist/chunks/{chunk-ZMIJ6AT4.js → chunk-IUCVOZRX.js} +3 -3
  50. package/dist/chunks/{chunk-3ZX76BVU.js → chunk-K6DHXXF5.js} +12 -10
  51. package/dist/chunks/chunk-K6DHXXF5.js.map +7 -0
  52. package/dist/chunks/{chunk-NPHCGLGH.js → chunk-MW5VI7IW.js} +135 -31
  53. package/dist/chunks/chunk-MW5VI7IW.js.map +7 -0
  54. package/dist/chunks/{chunk-BOTRGFQQ.js → chunk-NHMICIEU.js} +26 -19
  55. package/dist/chunks/chunk-NHMICIEU.js.map +7 -0
  56. package/dist/chunks/{chunk-Y7KNRAFL.js → chunk-PMSIZLV6.js} +29 -3
  57. package/dist/chunks/chunk-PMSIZLV6.js.map +7 -0
  58. package/dist/chunks/{chunk-7OH6DD3S.js → chunk-Q4XJ4PYL.js} +529 -168
  59. package/dist/chunks/chunk-Q4XJ4PYL.js.map +7 -0
  60. package/dist/chunks/chunk-RKRVOBVO.js +134 -0
  61. package/dist/chunks/chunk-RKRVOBVO.js.map +7 -0
  62. package/dist/chunks/{chunk-M3S7XITB.js → chunk-TGAVMUOS.js} +29 -13
  63. package/dist/chunks/chunk-TGAVMUOS.js.map +7 -0
  64. package/dist/chunks/chunk-TX6E5W7H.js +50 -0
  65. package/dist/chunks/chunk-TX6E5W7H.js.map +7 -0
  66. package/dist/chunks/{chunk-X3OD47CL.js → chunk-UR2K6WK6.js} +8 -11
  67. package/dist/chunks/chunk-UR2K6WK6.js.map +7 -0
  68. package/dist/chunks/{chunk-Z63R5GVN.js → chunk-WHBJDTCR.js} +6 -2
  69. package/dist/chunks/chunk-WHBJDTCR.js.map +7 -0
  70. package/dist/chunks/{chunk-RRGTKHXZ.js → chunk-X7XFT57O.js} +9 -140
  71. package/dist/chunks/{chunk-RRGTKHXZ.js.map → chunk-X7XFT57O.js.map} +4 -4
  72. package/dist/chunks/chunk-YV2PHCDB.js +108 -0
  73. package/dist/chunks/chunk-YV2PHCDB.js.map +7 -0
  74. package/dist/chunks/chunk-Z64PRP7A.js +156 -0
  75. package/dist/chunks/chunk-Z64PRP7A.js.map +7 -0
  76. package/dist/components/configuration.d.ts +42 -0
  77. package/dist/components/configuration.d.ts.map +1 -0
  78. package/dist/components/configuration.js +19 -0
  79. package/dist/components/configuration.js.map +7 -0
  80. package/dist/components/control.d.ts +76 -0
  81. package/dist/components/control.d.ts.map +1 -0
  82. package/dist/components/loader.d.ts +12 -0
  83. package/dist/components/loader.d.ts.map +1 -1
  84. package/dist/components/provider-component.d.ts +1 -1
  85. package/dist/components/provider-component.d.ts.map +1 -1
  86. package/dist/components/supervisor.d.ts.map +1 -1
  87. package/dist/components/types.d.ts +2 -0
  88. package/dist/components/types.d.ts.map +1 -1
  89. package/dist/components/validation.d.ts +6 -0
  90. package/dist/components/validation.d.ts.map +1 -0
  91. package/dist/config.d.ts +14 -2
  92. package/dist/config.d.ts.map +1 -1
  93. package/dist/core/action-registry.d.ts +9 -0
  94. package/dist/core/action-registry.d.ts.map +1 -1
  95. package/dist/core/action-registry.js +6 -4
  96. package/dist/core/approval-controller.d.ts +5 -1
  97. package/dist/core/approval-controller.d.ts.map +1 -1
  98. package/dist/core/auto-approval-classifier.d.ts +11 -0
  99. package/dist/core/auto-approval-classifier.d.ts.map +1 -1
  100. package/dist/core/compact-controller.d.ts.map +1 -1
  101. package/dist/core/fabric-state-paths.d.ts +2 -0
  102. package/dist/core/fabric-state-paths.d.ts.map +1 -0
  103. package/dist/core/media-sanitize.d.ts +46 -0
  104. package/dist/core/media-sanitize.d.ts.map +1 -0
  105. package/dist/core/model-resolution.d.ts +23 -5
  106. package/dist/core/model-resolution.d.ts.map +1 -1
  107. package/dist/core/semantic-search.d.ts +56 -0
  108. package/dist/core/semantic-search.d.ts.map +1 -0
  109. package/dist/core/shell-jobs.d.ts.map +1 -1
  110. package/dist/core/shell-middleware.d.ts +4 -0
  111. package/dist/core/shell-middleware.d.ts.map +1 -0
  112. package/dist/execution-service.d.ts +3 -1
  113. package/dist/execution-service.d.ts.map +1 -1
  114. package/dist/fabric-exec-tool.d.ts.map +1 -1
  115. package/dist/fabric-runtime-state.d.ts +2 -0
  116. package/dist/fabric-runtime-state.d.ts.map +1 -1
  117. package/dist/fabric-runtime-state.js +1595 -239
  118. package/dist/fabric-runtime-state.js.map +4 -4
  119. package/dist/fabric-state.d.ts +2 -0
  120. package/dist/fabric-state.d.ts.map +1 -1
  121. package/dist/index.d.ts.map +1 -1
  122. package/dist/index.js +284 -60
  123. package/dist/index.js.map +4 -4
  124. package/dist/jev/browser.d.ts.map +1 -1
  125. package/dist/jev/browser.js +1 -1
  126. package/dist/jev/client.d.ts +8 -2
  127. package/dist/jev/client.d.ts.map +1 -1
  128. package/dist/jev/client.js +3 -2
  129. package/dist/jev/config.d.ts.map +1 -1
  130. package/dist/jev/model-key.d.ts +9 -2
  131. package/dist/jev/model-key.d.ts.map +1 -1
  132. package/dist/jev/observation.js +4 -3
  133. package/dist/jev/routes.d.ts +69 -0
  134. package/dist/jev/routes.d.ts.map +1 -0
  135. package/dist/jev/validation.d.ts.map +1 -1
  136. package/dist/jev.d.ts +1 -0
  137. package/dist/jev.d.ts.map +1 -1
  138. package/dist/jev.js +35 -9
  139. package/dist/mcp.d.ts.map +1 -1
  140. package/dist/mcp.js +9 -2
  141. package/dist/mcp.js.map +2 -2
  142. package/dist/output-budget.d.ts.map +1 -1
  143. package/dist/prewalk/arm.d.ts.map +1 -1
  144. package/dist/prewalk/controller.d.ts +57 -6
  145. package/dist/prewalk/controller.d.ts.map +1 -1
  146. package/dist/prewalk/fs-drift.d.ts.map +1 -1
  147. package/dist/prewalk/handoff.d.ts +5 -25
  148. package/dist/prewalk/handoff.d.ts.map +1 -1
  149. package/dist/prewalk/messages.d.ts +24 -0
  150. package/dist/prewalk/messages.d.ts.map +1 -0
  151. package/dist/prewalk/model-switch.d.ts +3 -0
  152. package/dist/prewalk/model-switch.d.ts.map +1 -0
  153. package/dist/prewalk/plan.d.ts +46 -0
  154. package/dist/prewalk/plan.d.ts.map +1 -0
  155. package/dist/prewalk/return.d.ts +16 -0
  156. package/dist/prewalk/return.d.ts.map +1 -0
  157. package/dist/protocol.d.ts +11 -1
  158. package/dist/protocol.d.ts.map +1 -1
  159. package/dist/protocol.js +3 -1
  160. package/dist/providers/agents-actions.d.ts.map +1 -1
  161. package/dist/providers/agents-provider.d.ts.map +1 -1
  162. package/dist/providers/captured-tools-provider.d.ts.map +1 -1
  163. package/dist/providers/components-provider.d.ts +5 -3
  164. package/dist/providers/components-provider.d.ts.map +1 -1
  165. package/dist/providers/jev-provider.d.ts +2 -0
  166. package/dist/providers/jev-provider.d.ts.map +1 -1
  167. package/dist/providers/jev-provider.js +8 -7
  168. package/dist/providers/mcp-descriptor-cache.d.ts +2 -0
  169. package/dist/providers/mcp-descriptor-cache.d.ts.map +1 -1
  170. package/dist/providers/pi-tools-provider.d.ts.map +1 -1
  171. package/dist/providers/prewalk-provider.d.ts +19 -0
  172. package/dist/providers/prewalk-provider.d.ts.map +1 -0
  173. package/dist/repeat-guard.d.ts +4 -0
  174. package/dist/repeat-guard.d.ts.map +1 -1
  175. package/dist/residency/actor-client.d.ts +2 -2
  176. package/dist/residency/actor-client.d.ts.map +1 -1
  177. package/dist/residency/actor-client.js +2 -2
  178. package/dist/residency/client.d.ts +3 -0
  179. package/dist/residency/client.d.ts.map +1 -1
  180. package/dist/residency/host.d.ts.map +1 -1
  181. package/dist/residency/host.js +10 -8
  182. package/dist/residency/pi-entry.js +10 -8
  183. package/dist/residency/pi-entry.js.map +1 -1
  184. package/dist/residency/protocol.d.ts +15 -2
  185. package/dist/residency/protocol.d.ts.map +1 -1
  186. package/dist/runtime/core-override-guest-types.js +2 -2
  187. package/dist/runtime/cpython-runtime.d.ts +2 -0
  188. package/dist/runtime/cpython-runtime.d.ts.map +1 -1
  189. package/dist/runtime/cpython-runtime.js +7 -3
  190. package/dist/runtime/cpython-runtime.js.map +2 -2
  191. package/dist/runtime/guest-types.d.ts +1 -1
  192. package/dist/runtime/guest-types.d.ts.map +1 -1
  193. package/dist/runtime/guest-types.js +1 -1
  194. package/dist/runtime/monty-runtime.js +5 -3
  195. package/dist/runtime/monty-runtime.js.map +2 -2
  196. package/dist/runtime/node-process-runtime.d.ts.map +1 -1
  197. package/dist/runtime/node-process-runtime.js +3 -3
  198. package/dist/runtime/quickjs-runtime.d.ts.map +1 -1
  199. package/dist/runtime/quickjs-runtime.js +1 -1
  200. package/dist/runtime/typescript-kernel.js +8 -8
  201. package/dist/runtime-state-builtins.d.ts.map +1 -1
  202. package/dist/schema/policy.d.ts.map +1 -1
  203. package/dist/ui/code-preview-shell.d.ts.map +1 -1
  204. package/dist/ui/controller.d.ts.map +1 -1
  205. package/dist/ui/conversation-native-reader.d.ts.map +1 -1
  206. package/dist/ui/conversation-native-reader.js.map +2 -2
  207. package/dist/ui/dashboard.js +2 -2
  208. package/dist/ui/settings-section-context.d.ts +1 -0
  209. package/dist/ui/settings-section-context.d.ts.map +1 -1
  210. package/dist/ui/settings-sections-agents.d.ts.map +1 -1
  211. package/dist/ui/settings-sections-execution.d.ts +1 -1
  212. package/dist/ui/settings-sections-execution.d.ts.map +1 -1
  213. package/dist/ui/settings-sections.d.ts +1 -0
  214. package/dist/ui/settings-sections.d.ts.map +1 -1
  215. package/dist/ui/settings-values.d.ts +1 -0
  216. package/dist/ui/settings-values.d.ts.map +1 -1
  217. package/dist/ui/settings.d.ts.map +1 -1
  218. package/dist/ui/settings.js +57 -17
  219. package/dist/ui/settings.js.map +2 -2
  220. package/dist/ui/spinner.d.ts +8 -1
  221. package/dist/ui/spinner.d.ts.map +1 -1
  222. package/dist/ui/widget.d.ts +12 -1
  223. package/dist/ui/widget.d.ts.map +1 -1
  224. package/dist/worker.js +1 -3
  225. package/dist/worker.js.map +2 -2
  226. package/docs/agents.md +35 -11
  227. package/docs/architecture.md +1 -1
  228. package/docs/components.md +30 -1
  229. package/docs/configuration.md +23 -15
  230. package/docs/foreman.md +65 -0
  231. package/docs/jev.md +77 -4
  232. package/docs/programmatic-compaction.md +12 -7
  233. package/docs/shell-middleware.md +61 -0
  234. package/docs/skills.md +2 -1
  235. package/package.json +5 -4
  236. package/skillsets/python/fabric-exec/SKILL.md +1 -1
  237. package/skillsets/python/fabric-exec/references/agents.md +1 -1
  238. package/skillsets/python/fabric-exec/references/mcp.md +1 -1
  239. package/skillsets/python/fabric-foreman/SKILL.md +249 -0
  240. package/skillsets/python/fabric-guide/SKILL.md +2 -1
  241. package/skillsets/python/fabric-jev/SKILL.md +2 -2
  242. package/skillsets/typescript/fabric-exec/SKILL.md +9 -3
  243. package/skillsets/typescript/fabric-exec/references/agents.md +5 -3
  244. package/skillsets/typescript/fabric-foreman/SKILL.md +240 -0
  245. package/skillsets/typescript/fabric-guide/SKILL.md +2 -1
  246. package/skillsets/typescript/fabric-jev/SKILL.md +2 -2
  247. package/dist/chunks/chunk-2IAVP4O2.js +0 -447
  248. package/dist/chunks/chunk-2IAVP4O2.js.map +0 -7
  249. package/dist/chunks/chunk-2PZWDVJB.js.map +0 -7
  250. package/dist/chunks/chunk-32BNQ75J.js.map +0 -7
  251. package/dist/chunks/chunk-3CPWRPCE.js.map +0 -7
  252. package/dist/chunks/chunk-3ZX76BVU.js.map +0 -7
  253. package/dist/chunks/chunk-4SSMGBF4.js.map +0 -7
  254. package/dist/chunks/chunk-7OH6DD3S.js.map +0 -7
  255. package/dist/chunks/chunk-BOTRGFQQ.js.map +0 -7
  256. package/dist/chunks/chunk-IYQ5MNCW.js.map +0 -7
  257. package/dist/chunks/chunk-KFZYTGF5.js.map +0 -7
  258. package/dist/chunks/chunk-M3S7XITB.js.map +0 -7
  259. package/dist/chunks/chunk-NPHCGLGH.js.map +0 -7
  260. package/dist/chunks/chunk-OTCASLY2.js.map +0 -7
  261. package/dist/chunks/chunk-QX3TUAWO.js.map +0 -7
  262. package/dist/chunks/chunk-RERA6YWA.js.map +0 -7
  263. package/dist/chunks/chunk-TSRKCXNI.js +0 -17
  264. package/dist/chunks/chunk-TSRKCXNI.js.map +0 -7
  265. package/dist/chunks/chunk-VWSXAEX6.js.map +0 -7
  266. package/dist/chunks/chunk-WVH324VF.js.map +0 -7
  267. package/dist/chunks/chunk-X3OD47CL.js.map +0 -7
  268. package/dist/chunks/chunk-Y7KNRAFL.js.map +0 -7
  269. package/dist/chunks/chunk-Z63R5GVN.js.map +0 -7
  270. /package/dist/chunks/{chunk-4JETKRFE.js.map → chunk-36B4AIRT.js.map} +0 -0
  271. /package/dist/chunks/{chunk-ZMIJ6AT4.js.map → chunk-IUCVOZRX.js.map} +0 -0
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import {
2
+ animationFitsViewport,
2
3
  arcItemStyled,
3
4
  captureFabricAgentPreviews,
4
5
  captureFabricCallHeadlinePreviews,
@@ -15,6 +16,7 @@ import {
15
16
  modelReadHint,
16
17
  nestedCallBody,
17
18
  nestedCallTitle,
19
+ observeAnimationRows,
18
20
  renderAgentToolPreviewLines,
19
21
  renderBoundedLines,
20
22
  renderCoreToolBody,
@@ -29,7 +31,7 @@ import {
29
31
  singleCallProgressLine,
30
32
  spinnerFrame,
31
33
  updateSpinner
32
- } from "./chunks/chunk-IYQ5MNCW.js";
34
+ } from "./chunks/chunk-7VAZ4N43.js";
33
35
  import {
34
36
  configureHighlighting,
35
37
  highlightCode,
@@ -56,20 +58,22 @@ import {
56
58
  FabricActivityStore,
57
59
  HANDOFF_COMPLETION_MESSAGE_TYPE,
58
60
  PREWALK_ARMED_MESSAGE_TYPE,
61
+ PREWALK_CONTINUE_MESSAGE_TYPE,
59
62
  PrewalkController,
60
63
  PrewalkDriftTracker,
64
+ captureLoadedFileIdentity,
61
65
  createProviderComponent,
62
66
  expandSkillDirMarkersForRead,
63
67
  expandSkillDirMarkersInSkillBlock,
64
68
  filterPrewalkContinuationMessages,
69
+ filterPrewalkPlanningDirectives,
65
70
  formatSkillsForPrompt,
66
71
  hasPrewalkArmedPrompt,
67
72
  prewalkArmedPrompt,
68
73
  resolveFabricIdentity,
69
- restoreBorrowedInPlaceMain,
70
- settleInPlacePrewalk,
74
+ setModelSafely,
71
75
  withTrajectoryRearmDirective
72
- } from "./chunks/chunk-QX3TUAWO.js";
76
+ } from "./chunks/chunk-GGETIGM5.js";
73
77
  import {
74
78
  AgentTranscriptReader,
75
79
  countNewlines,
@@ -79,10 +83,10 @@ import "./chunks/chunk-DLXPTBPL.js";
79
83
  import {
80
84
  GUEST_TYPE_DECLARATIONS,
81
85
  PI_CORE_COMPATIBILITY_ARGUMENT_TYPE_NAMES
82
- } from "./chunks/chunk-32BNQ75J.js";
86
+ } from "./chunks/chunk-FLKGJPCN.js";
83
87
  import {
84
88
  NESTED_TOOL_CALL_ID_PREFIX
85
- } from "./chunks/chunk-KFZYTGF5.js";
89
+ } from "./chunks/chunk-3TXOQ5MG.js";
86
90
  import "./chunks/chunk-LMAVZN7J.js";
87
91
  import {
88
92
  AUTO_APPLY_PROPOSAL_KINDS,
@@ -174,7 +178,7 @@ import {
174
178
  ApprovalController,
175
179
  FabricAutoApprovalClassifier,
176
180
  FabricSessionApprovals
177
- } from "./chunks/chunk-NPHCGLGH.js";
181
+ } from "./chunks/chunk-MW5VI7IW.js";
178
182
  import "./chunks/chunk-XB3RJVT4.js";
179
183
  import "./chunks/chunk-7TB7NXSL.js";
180
184
  import {
@@ -182,6 +186,7 @@ import {
182
186
  setActiveCompiledSurface
183
187
  } from "./chunks/chunk-PSNXUZMY.js";
184
188
  import {
189
+ FABRIC_BASH_MIDDLEWARE,
185
190
  FABRIC_COMPONENT_DISCOVER_EVENT,
186
191
  FABRIC_COMPONENT_REGISTER_EVENT,
187
192
  FABRIC_NESTED_TOOL_CALL_ID_PREFIX,
@@ -195,11 +200,11 @@ import {
195
200
  readFabricPeerCardsRequestV1,
196
201
  readFabricPrewalkRequestV1,
197
202
  readFabricToolResultProxyDetailsV1
198
- } from "./chunks/chunk-WVH324VF.js";
203
+ } from "./chunks/chunk-IJL3QK3J.js";
199
204
  import {
200
205
  awaitPeerSettle,
201
206
  buildPeerCards
202
- } from "./chunks/chunk-2IAVP4O2.js";
207
+ } from "./chunks/chunk-YV2PHCDB.js";
203
208
  import {
204
209
  resolveAgentDir
205
210
  } from "./chunks/chunk-PXAICAUT.js";
@@ -210,7 +215,7 @@ import {
210
215
  loadFabricConfig,
211
216
  loadFabricConfigForScope,
212
217
  saveFabricConfig
213
- } from "./chunks/chunk-VWSXAEX6.js";
218
+ } from "./chunks/chunk-4NUTVNS2.js";
214
219
  import {
215
220
  defaultCodePreviewSettings
216
221
  } from "./chunks/chunk-OKOHRXGF.js";
@@ -231,10 +236,12 @@ import "./chunks/chunk-KAD7UWT2.js";
231
236
  import "./chunks/chunk-ZDNGXLEC.js";
232
237
  import {
233
238
  FABRIC_ACTOR_PI_HOST_EVENTS
234
- } from "./chunks/chunk-OTCASLY2.js";
239
+ } from "./chunks/chunk-2QAOC3BO.js";
240
+ import "./chunks/chunk-A4VP7HDF.js";
235
241
  import "./chunks/chunk-MGWQOKBV.js";
236
242
  import "./chunks/chunk-3H7SDWZI.js";
237
- import "./chunks/chunk-X3OD47CL.js";
243
+ import "./chunks/chunk-UR2K6WK6.js";
244
+ import "./chunks/chunk-B54Z662X.js";
238
245
  import {
239
246
  FABRIC_EXECUTION_TRACE_KIND,
240
247
  FABRIC_EXECUTION_TRACE_MAX_BYTES,
@@ -299,6 +306,7 @@ var clearTimingInterval = (state) => {
299
306
  };
300
307
  var ensureTimingInterval = (state, invalidate) => {
301
308
  state.codePreviewTimingInterval ??= setInterval(() => {
309
+ if (!animationFitsViewport(state.codePreviewTimingViewport)) return;
302
310
  const token = (state.codePreviewTimingOnlyRenderToken ?? 0) + 1;
303
311
  state.codePreviewTimingOnlyRenderToken = token;
304
312
  try {
@@ -343,10 +351,15 @@ var updateTiming = (context, enabled, options = {}) => {
343
351
  }
344
352
  if (options.formatLabel === false) return void 0;
345
353
  const running = context.isPartial;
354
+ if (running && !animationFitsViewport(state.codePreviewTimingViewport)) {
355
+ return state.codePreviewTimingLabel;
356
+ }
346
357
  const endedAt = running ? Date.now() : state.codePreviewTimingEndedAt ?? Date.now();
347
358
  const durationMs = endedAt - startedAt;
348
359
  if (!Number.isFinite(durationMs) || Math.round(durationMs) <= 0) return void 0;
349
- return `${running ? "Elapsed" : "Took"} ${formatDuration2(durationMs)}`;
360
+ const label = `${running ? "Elapsed" : "Took"} ${formatDuration2(durationMs)}`;
361
+ state.codePreviewTimingLabel = label;
362
+ return label;
350
363
  };
351
364
  var TimingPreservedComponent = class {
352
365
  constructor(component, state) {
@@ -445,6 +458,7 @@ var BorderedToolCall = class {
445
458
  ...this.callComponent?.render(Math.max(1, width - 4)) ?? [],
446
459
  ...this.resultComponent?.render(Math.max(1, width - 4)) ?? []
447
460
  ];
461
+ (this.state.codePreviewTimingViewport ??= {}).renderedRows = body.length + (width < 4 ? 0 : 2);
448
462
  if (width < 4) return body;
449
463
  const innerWidth = width - 4;
450
464
  const border = (value) => this.theme.fg(this.color, value);
@@ -745,12 +759,13 @@ var armFabricPrewalkSession = async (state, context, pi, input) => {
745
759
  sessionId,
746
760
  ...input.task ? { task: input.task } : {},
747
761
  ...prewalk.thinking ? { thinking: prewalk.thinking } : {},
748
- alwaysRearm: prewalk.alwaysRearm
762
+ alwaysRearm: prewalk.alwaysRearm,
763
+ requirePlan: prewalk.requirePlan
749
764
  });
750
765
  if (prewalk.detectShellWrites) {
751
766
  await state.prewalkDrift.captureBaseline(sessionId, context.cwd);
752
767
  }
753
- const armedPrompt = prewalkArmedPrompt(prewalk.mode, input.model);
768
+ const armedPrompt = prewalkArmedPrompt(prewalk.mode, input.model, prewalk.requirePlan);
754
769
  if (!hasPrewalkArmedPrompt(context.sessionManager.getBranch(), armedPrompt)) {
755
770
  pi.sendMessage(
756
771
  {
@@ -771,6 +786,10 @@ var autoArmFabricPrewalk = async (state, context, pi) => {
771
786
  return void 0;
772
787
  }
773
788
  if (state.prewalk.status().state !== "idle") return void 0;
789
+ const borrowed = state.prewalk.borrowedReturn();
790
+ if (borrowed && context.model && `${context.model.provider}/${context.model.id}` === borrowed.executorModel) {
791
+ return "Fabric prewalk auto-arm skipped: Main is still on the executor after a failed in-place return. Restart the session or run /fabric reload to retry the return, or arm prewalk explicitly.";
792
+ }
774
793
  if (!state.config.fullCodeMode || state.config.schema.mode === "enforce") {
775
794
  return "Fabric prewalk auto-arm skipped: requires full code mode with Schema enforce mode disabled.";
776
795
  }
@@ -785,6 +804,128 @@ var autoArmFabricPrewalk = async (state, context, pi) => {
785
804
  return void 0;
786
805
  };
787
806
 
807
+ // src/prewalk/return.ts
808
+ var modelForReturnKey = (key, context) => {
809
+ const separator = key.indexOf("/");
810
+ if (separator <= 0 || separator === key.length - 1) return void 0;
811
+ return context.modelRegistry.find(key.slice(0, separator), key.slice(separator + 1));
812
+ };
813
+ var PREWALK_RETURN_COMPACTION_INSTRUCTIONS = [
814
+ "Compact before Main returns to its boundary model after an in-place prewalk continuation.",
815
+ "Preserve the executor's final report and verification results; summarize implementation scratch work, file reads, and command output."
816
+ ].join(" ");
817
+ var prewalkRecoveryCandidate = (branch) => {
818
+ let continuationIndex = -1;
819
+ let details;
820
+ for (let index = branch.length - 1; index >= 0; index -= 1) {
821
+ const entry = branch[index];
822
+ if (entry?.type !== "custom_message" || entry.customType !== PREWALK_CONTINUE_MESSAGE_TYPE) {
823
+ continue;
824
+ }
825
+ if (typeof entry.details !== "object" || entry.details === null) continue;
826
+ if (entry.details.mode !== "in-place") continue;
827
+ continuationIndex = index;
828
+ details = entry.details;
829
+ break;
830
+ }
831
+ if (continuationIndex < 0 || !details) return void 0;
832
+ const continuationId = typeof details.continuationId === "string" ? details.continuationId : "";
833
+ const executorModel = typeof details.model === "string" ? details.model.trim() : "";
834
+ const returnModel = typeof details.returnModel === "string" ? details.returnModel.trim() : "";
835
+ if (!continuationId || !executorModel || !returnModel || returnModel === executorModel) {
836
+ return void 0;
837
+ }
838
+ let recordedExecutor;
839
+ for (let index = 0; index < branch.length; index += 1) {
840
+ const entry = branch[index];
841
+ if (entry?.type !== "model_change") continue;
842
+ if (index > continuationIndex) return void 0;
843
+ recordedExecutor = `${String(entry.provider)}/${String(entry.modelId)}`;
844
+ }
845
+ return recordedExecutor === executorModel ? { returnModel, executorModel } : void 0;
846
+ };
847
+ var restoreBorrowedInPlaceMain = async (controller, extension, context) => {
848
+ let borrowed = controller?.borrowedReturn?.();
849
+ let recovered = false;
850
+ if (!borrowed) {
851
+ const candidate = prewalkRecoveryCandidate(context.sessionManager?.getBranch?.() ?? []);
852
+ if (!candidate || !controller.hydrateBorrowedMain(candidate)) return false;
853
+ borrowed = candidate;
854
+ recovered = true;
855
+ }
856
+ const currentKey = context.model ? `${context.model.provider}/${context.model.id}` : void 0;
857
+ if (currentKey !== void 0 && currentKey !== borrowed.executorModel) return false;
858
+ if (currentKey === borrowed.returnModel) return false;
859
+ const model = modelForReturnKey(borrowed.returnModel, context);
860
+ if (!model) {
861
+ context.ui.setStatus("fabric-prewalk", `return failed \u2192 ${borrowed.returnModel}`);
862
+ context.ui.notify(
863
+ `Prewalk left Main on the executor; could not restore unavailable model ${borrowed.returnModel}.`,
864
+ "error"
865
+ );
866
+ return false;
867
+ }
868
+ const restored = await setModelSafely(extension, model);
869
+ if (!restored) {
870
+ context.ui.setStatus("fabric-prewalk", `return failed \u2192 ${borrowed.returnModel}`);
871
+ context.ui.notify(
872
+ `Prewalk left Main on the executor; could not return to ${borrowed.returnModel}. Check model authentication.`,
873
+ "error"
874
+ );
875
+ return false;
876
+ }
877
+ if (recovered) controller.clearBorrowed();
878
+ context.ui.notify(`Restored Main to ${borrowed.returnModel} after in-place prewalk.`, "info");
879
+ return true;
880
+ };
881
+ var settleInPlacePrewalk = async (controller, extension, context, options) => {
882
+ const sessionId = context.sessionManager.getSessionId();
883
+ const settlement = controller.takeContinuationSettlement(sessionId);
884
+ if (!settlement) return false;
885
+ const model = modelForReturnKey(settlement.returnModel, context);
886
+ if (!model) {
887
+ controller.cancel();
888
+ context.ui.setStatus("fabric-prewalk", `return failed \u2192 ${settlement.returnModel}`);
889
+ context.ui.notify(
890
+ `Prewalk completed, but Main could not return to unavailable model ${settlement.returnModel}.`,
891
+ "error"
892
+ );
893
+ return false;
894
+ }
895
+ context.ui.setStatus("fabric-prewalk", `returning Main \u2192 ${settlement.returnModel}`);
896
+ if (options?.compact && options.compactOnReturn !== false) {
897
+ if (!options.compact.status?.().pending) {
898
+ options.compact.request({
899
+ reason: "in-place prewalk return",
900
+ instructions: PREWALK_RETURN_COMPACTION_INSTRUCTIONS,
901
+ requestedBy: "prewalk"
902
+ });
903
+ }
904
+ await options.compact.maybeCommit(context);
905
+ }
906
+ const restored = await setModelSafely(extension, model);
907
+ if (!restored) {
908
+ controller.cancel();
909
+ context.ui.setStatus("fabric-prewalk", `return failed \u2192 ${settlement.returnModel}`);
910
+ context.ui.notify(
911
+ `Prewalk completed, but Main could not return to ${settlement.returnModel}. Check model authentication.`,
912
+ "error"
913
+ );
914
+ return false;
915
+ }
916
+ controller.finishContinuation(sessionId, settlement.continuationId);
917
+ const status = controller.status();
918
+ context.ui.setStatus(
919
+ "fabric-prewalk",
920
+ status.state === "armed" ? `armed \u2192 ${status.model}` : void 0
921
+ );
922
+ context.ui.notify(
923
+ status.state === "armed" ? `Prewalk complete. Main returned to ${settlement.returnModel} and re-armed for the next task.` : `Prewalk complete. Main returned to ${settlement.returnModel}.`,
924
+ "info"
925
+ );
926
+ return true;
927
+ };
928
+
788
929
  // src/ui/conversation-shortcut.ts
789
930
  var FABRIC_CONVERSATION_SHORTCUT = "ctrl+shift+a";
790
931
  var FABRIC_CONVERSATION_HINT = "ctrl+shift+a chat";
@@ -2051,7 +2192,7 @@ var fabricExecutionKernelGuidance = (fullCodeMode, kernel = "typescript", python
2051
2192
  // caches stay warm.
2052
2193
  `Read every file the user provides (images, screenshots, code, text) with the ${fullCodeMode ? "`pi.read`" : "`read`"} tool before responding \u2014 never assume its contents.`
2053
2194
  ].join(" ");
2054
- var defaultFabricExecutionGuidance = (fullCodeMode, kernel = "typescript", pythonRuntime = "monty") => kernel === "python" ? (pythonRuntime === "monty" ? "Python backend: Monty sandboxed subset, not CPython. Native filesystem/network/environment access and arbitrary imports are unavailable; use host tools for effects. Supply acyclic JSON host arguments; recursive containers are unsupported. Underscore-prefixed direct capability attributes are unavailable: use tools.call with the exact discovered ref instead. \u03C0 is an attribute object; payloads is a dict, not the same identity. " : "Python backend: CPython; native standard-library imports are available. ") + 'Python fabric_exec: write an async function body with `await` and `return`; each invocation starts fresh. Use imports supported by the configured backend, such as `import asyncio`. Host methods accept one dict or keyword arguments: `await tools.search(query="example")`, `await tools.call(ref="provider.action", args={"key": "value"})`; discover schemas with tools.list/describe. Known actions use mcp.<server>.<tool>, memory.*, state.*, schema.*, compact.*, components.*, agents.*, or mesh.*. Responses are native Python dicts/lists, not attribute objects. Use `asyncio.gather` for independent calls. `\u03C0.key` and `payloads["key"]` contain only the exact top-level payload keys. Return JSON-compatible data (convert sets, bytes, paths, and datetimes explicitly); print output is bounded. JavaScript callback helpers (workflow, memory.walk, and predicate callbacks) are not Python APIs; page with ordinary await/loops instead. Provider argument validation and approvals remain host-enforced. Schema enforce retains host gates and requires the selected runtime\u2019s isolation; no unrestricted fallback.' + (fullCodeMode ? ' `await pi.read("/x")`, `await pi.grep(pattern="TODO", path="src")`, `await pi.find(pattern="*.py", path="src")`, and `await pi.ls("src")` return strings. `await pi.bash(command="ls")`, `await pi.edit(path="/x", oldText="a", newText="b")`, and `await pi.write(path="/y", content=\u03C0.body)` return dicts; read `r["output"]`. Shell nonzero exits raise; `settle=True` returns a failure dict instead. Cancellation, timeout, approval and security errors still raise. A nested shell that exceeds executor.shellHangMs still resolves ok with a still-running notice, pid, and live output path; background=True detaches immediately. Inspect with pi.read and stop with kill <pid> through pi.bash. Captured tools are `await extensions.<name>(...)`.' : " Pi core and extensions are unavailable inside fabric_exec in orchestration-only mode.") : fullCodeMode ? "Examples and returns: `pi.read('/x')`, `pi.grep('TODO','src')` / `pi.grep({pattern:'TODO', path:'src', ignoreCase:true, context:2})`, `pi.find({pattern:'*.ts', path:'src', limit:20})`, and `pi.ls('src')` return strings; `pi.bash({cmd:'ls'})` (or `pi.powershell` on Windows), `pi.edit({path:'/x', old:'a', new:'b'})`, and `pi.write({path:'/y', text:'z'})` return `{ok, output, details}` (read `.output`); failed core calls reject, including shell tools on an ordinary nonzero exit; pass `settle: true` to `pi.bash` or `pi.powershell` to get `{ ok: false, exitCode, output, error }` instead. Timeout, cancellation, approval, and security failures still reject. A nested shell that exceeds `executor.shellHangMs` still resolves `ok: true` with a still-running notice, pid, and live output path; `background: true` detaches immediately. Inspect with `pi.read` and stop with `kill <pid>` through `pi.bash`.\n`tools` is discovery + generic calls only (`providers`/`catalog`/`list`/`search`/`describe`/`call`/`models`). Call known MCP tools as `mcp.<sanitized_server>.<sanitized_tool>(args)`, captured tools as `extensions.<tool>(args)`, and stable providers as `memory.*`, `state.*`, `schema.*`, or `compact.*`. Use `tools.call({ref,args})` for computed refs. `pi` is the core tools; `\u03C0.<key>` reads named `strings` (not a tool)." : "Call known actions through `mcp.<sanitized_server>.<sanitized_tool>(args)`, `memory.*`, `state.*`, `schema.*`, `components.*`, `compact.*`, `agents.*`, or `mesh.*`; use `tools.catalog`/`search`/`describe`/`list` for discovery and `tools.call({ref,args})` for computed refs. Other surfaces are opt-in via user-loaded skills.";
2195
+ var defaultFabricExecutionGuidance = (fullCodeMode, kernel = "typescript", pythonRuntime = "monty") => kernel === "python" ? (pythonRuntime === "monty" ? "Python backend: Monty sandboxed subset, not CPython. Native filesystem/network/environment access and arbitrary imports are unavailable; use host tools for effects. Supply acyclic JSON host arguments; recursive containers are unsupported. Underscore-prefixed direct capability attributes are unavailable: use tools.call with the exact discovered ref instead. \u03C0 is an attribute object; payloads is a dict, not the same identity. " : "Python backend: CPython; native standard-library imports are available. ") + 'Python fabric_exec: write an async function body with `await` and `return`; each invocation starts fresh. Use imports supported by the configured backend, such as `import asyncio`. Host methods accept one dict or keyword arguments: `await tools.search(query="example")`, `await tools.call(ref="provider.action", args={"key": "value"})`; discover with tools.search instead of enumerating: tools.list is a capped page (default 100, hard cap 1000) with no truncation marker, so a short result never proves an action is absent (tools.list(envelope=True) reports totals). Known actions use mcp.<server>.<tool>, memory.*, state.*, schema.*, compact.*, components.*, agents.*, or mesh.*. Responses are native Python dicts/lists, not attribute objects. Use `asyncio.gather` for independent calls. `\u03C0.key` and `payloads["key"]` contain only the exact top-level payload keys. Return JSON-compatible data (convert sets, bytes, paths, and datetimes explicitly); print output is bounded. JavaScript callback helpers (workflow, memory.walk, and predicate callbacks) are not Python APIs; page with ordinary await/loops instead. Provider argument validation and approvals remain host-enforced. Schema enforce retains host gates and requires the selected runtime\u2019s isolation; no unrestricted fallback.' + (fullCodeMode ? ' `await pi.read("/x")`, `await pi.grep(pattern="TODO", path="src")`, `await pi.find(pattern="*.py", path="src")`, and `await pi.ls("src")` return strings. `await pi.bash(command="ls")`, `await pi.edit(path="/x", oldText="a", newText="b")`, and `await pi.write(path="/y", content=\u03C0.body)` return dicts; read `r["output"]`. Shell nonzero exits raise; `settle=True` returns a failure dict instead. Cancellation, timeout, approval and security errors still raise. A nested shell that exceeds executor.shellHangMs still resolves ok with a still-running notice, pid, and live output path; background=True detaches immediately. Inspect with pi.read and stop with kill <pid> through pi.bash. Captured tools are `await extensions.<name>(...)`.' : " Pi core and extensions are unavailable inside fabric_exec in orchestration-only mode.") : fullCodeMode ? "Examples and returns: `pi.read('/x')`, `pi.grep('TODO','src')` / `pi.grep({pattern:'TODO', path:'src', ignoreCase:true, context:2})`, `pi.find({pattern:'*.ts', path:'src', limit:20})`, and `pi.ls('src')` return strings; `pi.bash({cmd:'ls'})` (or `pi.powershell` on Windows), `pi.edit({path:'/x', old:'a', new:'b'})`, and `pi.write({path:'/y', text:'z'})` return `{ok, output, details}` (read `.output`); failed core calls reject, including shell tools on an ordinary nonzero exit; pass `settle: true` to `pi.bash` or `pi.powershell` to get `{ ok: false, exitCode, output, error }` instead. Timeout, cancellation, approval, and security failures still reject. A nested shell that exceeds `executor.shellHangMs` still resolves `ok: true` with a still-running notice, pid, and live output path; `background: true` detaches immediately. Inspect with `pi.read` and stop with `kill <pid>` through `pi.bash`.\n`tools` is discovery + generic calls only (`providers`/`catalog`/`list`/`search`/`describe`/`call`/`models`). Call known MCP tools as `mcp.<sanitized_server>.<sanitized_tool>(args)`, captured tools as `extensions.<tool>(args)`, and stable providers as `memory.*`, `state.*`, `schema.*`, or `compact.*`. Use `tools.call({ref,args})` for computed refs. `pi` is the core tools; `\u03C0.<key>` reads named `strings` (not a tool)." : "Call known actions through `mcp.<sanitized_server>.<sanitized_tool>(args)`, `memory.*`, `state.*`, `schema.*`, `components.*`, `compact.*`, `agents.*`, or `mesh.*`; use `tools.catalog`/`search`/`describe`/`list` for discovery and `tools.call({ref,args})` for computed refs. Other surfaces are opt-in via user-loaded skills.";
2055
2196
  var manifestNameCache = /* @__PURE__ */ new Map();
2056
2197
  var packageNameFromManifest = (startPath) => {
2057
2198
  if (!startPath) return void 0;
@@ -2312,21 +2453,6 @@ var buildSkillReferenceGuidance = (prompt, skills) => {
2312
2453
  import { Container as Container2, Text as Text2 } from "@earendil-works/pi-tui";
2313
2454
  import { Type } from "typebox";
2314
2455
 
2315
- // src/repeat-guard.ts
2316
- var FabricRepeatGuard = class {
2317
- constructor(warnAt, blockAt) {
2318
- this.warnAt = warnAt;
2319
- this.blockAt = blockAt;
2320
- }
2321
- #code;
2322
- #count = 0;
2323
- observe(code) {
2324
- this.#count = code === this.#code ? this.#count + 1 : 1;
2325
- this.#code = code;
2326
- return { count: this.#count, blocked: this.#count >= this.blockAt, warn: this.#count >= this.warnAt };
2327
- }
2328
- };
2329
-
2330
2456
  // src/failure-progress.ts
2331
2457
  var MAX_COMPLETED_CALLS = 8;
2332
2458
  var MAX_PATH_CHARS = 100;
@@ -2431,6 +2557,25 @@ var prepareFabricExecArguments = (input, kernel = "typescript") => {
2431
2557
  return prepared;
2432
2558
  };
2433
2559
 
2560
+ // src/repeat-guard.ts
2561
+ var FABRIC_REPEAT_WARN = 3;
2562
+ var FABRIC_REPEAT_BLOCK = 6;
2563
+ var fabricRepeatWarnText = (count, blockAt) => `[circuit-breaker] identical fabric_exec code has now run ${count} times in a row; at ${blockAt} identical runs will be blocked. Change the approach or finish your turn.`;
2564
+ var fabricRepeatBlockText = (count) => `Circuit breaker: this exact fabric_exec code has now executed ${count} times in a row and was blocked. Re-running identical code adds no information. Summarize what you already know and finish your turn; if the call is genuinely required, change the code materially.`;
2565
+ var FabricRepeatGuard = class {
2566
+ constructor(warnAt, blockAt) {
2567
+ this.warnAt = warnAt;
2568
+ this.blockAt = blockAt;
2569
+ }
2570
+ #code;
2571
+ #count = 0;
2572
+ observe(code) {
2573
+ this.#count = code === this.#code ? this.#count + 1 : 1;
2574
+ this.#code = code;
2575
+ return { count: this.#count, blocked: this.#count >= this.blockAt, warn: this.#count >= this.warnAt };
2576
+ }
2577
+ };
2578
+
2434
2579
  // src/runtime/core-tool-properties.ts
2435
2580
  var CORE_TOOL_NAMES = Object.keys(
2436
2581
  PI_CORE_COMPATIBILITY_ARGUMENT_TYPE_NAMES
@@ -2705,9 +2850,19 @@ var boundModelOutput = async (visible, maxChars, fullOutput = visible, writeArti
2705
2850
 
2706
2851
  [Full output (${fullOutput.length} chars) saved to: ${artifactPath}]` : "";
2707
2852
  const bodyBudget = Math.max(1, maxChars - suffix.length);
2708
- const text = `${truncateMiddle(visible, bodyBudget)}${suffix}`;
2853
+ const body = truncateMiddle(visible, bodyBudget);
2854
+ let text = `${body}${suffix}`;
2855
+ if (text.length > maxChars) {
2856
+ const rebudget = maxChars - suffix.length;
2857
+ if (rebudget <= 0) {
2858
+ text = suffix.slice(-Math.max(1, maxChars));
2859
+ } else {
2860
+ const shrunk = truncateMiddle(body, rebudget);
2861
+ text = shrunk.length + suffix.length <= maxChars ? `${shrunk}${suffix}` : suffix;
2862
+ }
2863
+ }
2709
2864
  return {
2710
- text: text.length <= maxChars ? text : truncateMiddle(text, maxChars),
2865
+ text,
2711
2866
  ...artifactPath ? { artifactPath } : {},
2712
2867
  originalChars: fullOutput.length,
2713
2868
  omittedChars: Math.max(0, fullOutput.length - Math.min(fullOutput.length, bodyBudget))
@@ -2729,8 +2884,6 @@ var compactResultHeader = (theme, audits, failed) => {
2729
2884
  );
2730
2885
  };
2731
2886
  var countLabel = (count, singular) => `${count} ${count === 1 ? singular : `${singular}s`}`;
2732
- var FABRIC_REPEAT_WARN = 3;
2733
- var FABRIC_REPEAT_BLOCK = 6;
2734
2887
  var createFabricExecTool = (state, codePreviewSettings, pendingHandoffs, decorateShell = withCodePreviewShell, toolDisplay) => {
2735
2888
  const python = toolKernel(state) === "python";
2736
2889
  const monty = python && state.config.executor.pythonRuntime === "monty";
@@ -2868,7 +3021,7 @@ var createFabricExecTool = (state, codePreviewSettings, pendingHandoffs, decorat
2868
3021
  composite2.addChild(header);
2869
3022
  composite2.addChild(new Text2("\n", 0, 0));
2870
3023
  composite2.addChild(writePreview);
2871
- return composite2;
3024
+ return observeAnimationRows(composite2, rendererState.fabricSpinner ??= {});
2872
3025
  }
2873
3026
  const lines = safeTerminalText(code).split("\n");
2874
3027
  const runDisplay = normalizeRunDisplay(params.display);
@@ -2905,7 +3058,7 @@ ${preview}` : ""}${hiddenHint}`,
2905
3058
  composite.addChild(codePreview);
2906
3059
  composite.addChild(new Text2("\n", 0, 0));
2907
3060
  composite.addChild(writePreview);
2908
- return composite;
3061
+ return observeAnimationRows(composite, rendererState.fabricSpinner ??= {});
2909
3062
  },
2910
3063
  renderResult(result, { expanded, isPartial }, theme, context) {
2911
3064
  observePiTheme(theme);
@@ -2930,7 +3083,7 @@ ${preview}` : ""}${hiddenHint}`,
2930
3083
  );
2931
3084
  const rowBalance = rendererState.fabricResultRowBalance ??= {};
2932
3085
  const trackRows = (component) => observeResultRows(
2933
- inheritComponentBackground(component),
3086
+ observeAnimationRows(inheritComponentBackground(component), rendererState.fabricSpinner ??= {}),
2934
3087
  rowBalance,
2935
3088
  { expanded, isPartial }
2936
3089
  );
@@ -3316,11 +3469,12 @@ ${preview}` : ""}${hiddenHint}`,
3316
3469
  const repeat = repeatGuard.observe(code);
3317
3470
  if (repeat.blocked) {
3318
3471
  return {
3319
- content: [{ type: "text", text: `Circuit breaker: this exact fabric_exec code has now executed ${repeat.count} times in a row and was blocked. Re-running identical code adds no information. Summarize what you already know and finish your turn; if the call is genuinely required, change the code materially.` }],
3472
+ content: [{ type: "text", text: fabricRepeatBlockText(repeat.count) }],
3320
3473
  isError: true,
3321
3474
  details: void 0
3322
3475
  };
3323
3476
  }
3477
+ const runDisplay = normalizeRunDisplay(params.display);
3324
3478
  const strings = resolveFabricExecPayloads(params);
3325
3479
  const tokenBudget = "tokenBudget" in params && typeof params.tokenBudget === "number" ? params.tokenBudget : void 0;
3326
3480
  const result = await state.execution.execute({
@@ -3332,6 +3486,12 @@ ${preview}` : ""}${hiddenHint}`,
3332
3486
  ...tokenBudget !== void 0 ? { tokenBudget } : {},
3333
3487
  ...params.agentBudget !== void 0 ? { maxAgentCalls: params.agentBudget } : {},
3334
3488
  ...params.timeoutMs !== void 0 ? { requestedTimeoutMs: params.timeoutMs } : {},
3489
+ ...runDisplay ? {
3490
+ display: {
3491
+ ...runDisplay.name !== void 0 && { name: runDisplay.name },
3492
+ ...runDisplay.description !== void 0 && { description: runDisplay.description }
3493
+ }
3494
+ } : {},
3335
3495
  onPartial(snapshot) {
3336
3496
  onUpdate?.({
3337
3497
  content: [{ type: "text", text: snapshot.progress ?? "" }],
@@ -3344,9 +3504,10 @@ ${preview}` : ""}${hiddenHint}`,
3344
3504
  }
3345
3505
  });
3346
3506
  const selectedResultFormat = params.resultFormat ?? state.config.executor.resultFormat;
3507
+ const boundarySessionId = context.sessionManager.getSessionId();
3347
3508
  const pendingHandoff = await state.claimHandoff(
3348
3509
  result,
3349
- context.sessionManager.getSessionId(),
3510
+ boundarySessionId,
3350
3511
  selectedResultFormat,
3351
3512
  toolCallId
3352
3513
  );
@@ -3356,6 +3517,18 @@ ${preview}` : ""}${hiddenHint}`,
3356
3517
  "fabric-prewalk",
3357
3518
  `waiting for fabric_exec boundary \u2192 ${String(pendingHandoff.args.model ?? "executor")}`
3358
3519
  );
3520
+ if (pendingHandoff.readiness?.kind === "unplanned") {
3521
+ context.ui.notify(
3522
+ `Prewalk: handing off without a recorded plan after ${pendingHandoff.readiness.prompts} reminders.`,
3523
+ "warning"
3524
+ );
3525
+ }
3526
+ } else if (state.prewalk.planRequired(boundarySessionId)) {
3527
+ const prewalkStatus = state.prewalk.status();
3528
+ context.ui.setStatus(
3529
+ "fabric-prewalk",
3530
+ prewalkStatus.state === "armed" ? `plan awaited \u2192 ${prewalkStatus.model}` : void 0
3531
+ );
3359
3532
  }
3360
3533
  const fullFormattedValue = formatFabricValue(result.value, selectedResultFormat);
3361
3534
  const failureProgress = formatFailureProgress(result.trace);
@@ -3363,9 +3536,7 @@ ${preview}` : ""}${hiddenHint}`,
3363
3536
  if (fullFormattedValue.text) fullSections.push(fullFormattedValue.text);
3364
3537
  if (result.error) fullSections.push(`Runtime error: ${result.error}`);
3365
3538
  if (failureProgress) fullSections.push(failureProgress);
3366
- if (repeat.warn) {
3367
- fullSections.push(`[circuit-breaker] identical fabric_exec code has now run ${repeat.count} times in a row; at ${FABRIC_REPEAT_BLOCK} identical runs will be blocked. Change the approach or finish your turn.`);
3368
- }
3539
+ if (repeat.warn) fullSections.push(fabricRepeatWarnText(repeat.count, FABRIC_REPEAT_BLOCK));
3369
3540
  const fullRawOutput = fullSections.join("\n\n");
3370
3541
  const outputBudget = modelOutputBudget(
3371
3542
  state.config.executor.maxOutputChars,
@@ -3382,6 +3553,7 @@ ${preview}` : ""}${hiddenHint}`,
3382
3553
  if (formattedValue.text) sections.push(formattedValue.text);
3383
3554
  if (result.error) sections.push(`Runtime error: ${result.error}`);
3384
3555
  if (failureProgress) sections.push(failureProgress);
3556
+ if (repeat.warn) sections.push(fabricRepeatWarnText(repeat.count, FABRIC_REPEAT_BLOCK));
3385
3557
  const rawOutput = sections.join("\n\n");
3386
3558
  const outputFormat = formattedValue.language && formattedValue.text && (result.logs.length === 0 || !outputWillTruncate) ? formattedValue.language : void 0;
3387
3559
  const outputFormatStartLine = result.logs.length > 0 ? countNewlines(logPrefix) + 2 : 0;
@@ -3415,8 +3587,10 @@ ${recoveryHint}` : ""}`,
3415
3587
  outputBudget,
3416
3588
  fullRawOutput || "(no output)"
3417
3589
  )).text;
3418
- const terminate = pendingHandoff !== void 0 || result.success && typeof result.value === "object" && result.value !== null && "terminate" in result.value && result.value.terminate === true;
3590
+ const inPlaceContinuation = pendingHandoff?.kind === "prewalk-in-place";
3591
+ const terminate = !inPlaceContinuation && (pendingHandoff !== void 0 || result.success && typeof result.value === "object" && result.value !== null && "terminate" in result.value && result.value.terminate === true);
3419
3592
  const mediaBlocks = [];
3593
+ for (const block of result.media ?? []) mediaBlocks.push(block);
3420
3594
  for (const audit of result.audits) {
3421
3595
  if (audit.media) mediaBlocks.push(...audit.media);
3422
3596
  }
@@ -3548,6 +3722,7 @@ var FabricState = class {
3548
3722
  this.capturedTools = capturedTools;
3549
3723
  this.#options = options;
3550
3724
  this.#managedHost = options.managedHost ? new FabricManagedHost(options.managedHost) : void 0;
3725
+ this.#entryIdentity = options.entryIdentity;
3551
3726
  }
3552
3727
  #runtime;
3553
3728
  #activatingRuntime;
@@ -3564,6 +3739,7 @@ var FabricState = class {
3564
3739
  #externalComponents = /* @__PURE__ */ new Map();
3565
3740
  #options;
3566
3741
  #managedHost;
3742
+ #entryIdentity;
3567
3743
  activity = new FabricActivityStore();
3568
3744
  prewalk = new PrewalkController();
3569
3745
  prewalkDrift = new PrewalkDriftTracker();
@@ -3888,6 +4064,18 @@ var FabricState = class {
3888
4064
  candidate.registerExternalComponent(component, { overwrite: true });
3889
4065
  }
3890
4066
  }
4067
+ if (!this.#managedHost && !reinitialize) {
4068
+ const { FabricComponentConfiguration } = await import("./components/configuration.js");
4069
+ try {
4070
+ config.components = new FabricComponentConfiguration({
4071
+ cwd: context.cwd,
4072
+ agentDir: resolveAgentDir(),
4073
+ projectTrusted: () => context.isProjectTrusted()
4074
+ }).read().entries;
4075
+ } catch (error) {
4076
+ if (context.hasUI) context.ui.notify(`Pi Fabric component configuration not applied: ${error instanceof Error ? error.message : String(error)}`, "error");
4077
+ }
4078
+ }
3891
4079
  await candidate.initialize(context, config);
3892
4080
  assertCurrent();
3893
4081
  for (const provider of this.#externalProviders.values()) {
@@ -3935,7 +4123,8 @@ var FabricState = class {
3935
4123
  prewalk: this.prewalk,
3936
4124
  prewalkDrift: this.prewalkDrift,
3937
4125
  sessionApprovals: this.sessionApprovals,
3938
- ...this.#options.paths ? { paths: this.#options.paths } : {}
4126
+ ...this.#options.paths ? { paths: this.#options.paths } : {},
4127
+ ...this.#entryIdentity ? { entryIdentity: this.#entryIdentity } : {}
3939
4128
  }
3940
4129
  );
3941
4130
  }
@@ -4485,22 +4674,38 @@ var shouldShowFabricWidget = (snapshot, mode) => {
4485
4674
  const finishedAt = run.finishedAt ?? run.updatedAt;
4486
4675
  return finishedAt > (snapshot.widgetDismissedAt ?? 0);
4487
4676
  };
4677
+ var WIDGET_TERMINAL_ROW_SHARE = 0.5;
4678
+ var widgetRowLimit = (maxRows, terminalRows) => {
4679
+ const configured = Math.max(1, maxRows);
4680
+ if (terminalRows === void 0 || !Number.isFinite(terminalRows) || terminalRows <= 0) {
4681
+ return configured;
4682
+ }
4683
+ const paneShare = Math.floor(terminalRows * WIDGET_TERMINAL_ROW_SHARE);
4684
+ return Math.max(1, Math.min(configured, paneShare));
4685
+ };
4488
4686
  var FabricWidget = class {
4489
- constructor(theme, snapshot, maxRows) {
4687
+ constructor(theme, snapshot, maxRows, terminalRows) {
4490
4688
  this.theme = theme;
4491
4689
  this.snapshot = snapshot;
4492
4690
  this.maxRows = maxRows;
4691
+ this.terminalRows = terminalRows;
4692
+ }
4693
+ #rowLimit() {
4694
+ return widgetRowLimit(this.maxRows, this.terminalRows?.());
4493
4695
  }
4494
4696
  #lastWidth;
4697
+ #lastLimit;
4495
4698
  #lastSnapshot;
4496
4699
  #lastLines;
4497
4700
  #pending;
4498
4701
  render(width) {
4499
4702
  if (width <= 0) return [];
4500
4703
  const snapshot = this.snapshot();
4501
- const lines = this.#pending?.width === width && this.#pending.snapshot === snapshot ? this.#pending.lines : this.#lastWidth === width && this.#lastSnapshot === snapshot && this.#lastLines ? this.#lastLines : this.#renderLines(snapshot, width);
4704
+ const limit = this.#rowLimit();
4705
+ const lines = this.#pending?.width === width && this.#pending.limit === limit && this.#pending.snapshot === snapshot ? this.#pending.lines : this.#lastWidth === width && this.#lastLimit === limit && this.#lastSnapshot === snapshot && this.#lastLines ? this.#lastLines : this.#renderLines(snapshot, width, limit);
4502
4706
  this.#pending = void 0;
4503
4707
  this.#lastWidth = width;
4708
+ this.#lastLimit = limit;
4504
4709
  this.#lastSnapshot = snapshot;
4505
4710
  this.#lastLines = lines;
4506
4711
  return lines;
@@ -4508,18 +4713,20 @@ var FabricWidget = class {
4508
4713
  hasChanged() {
4509
4714
  if (this.#lastWidth === void 0 || this.#lastLines === void 0) return true;
4510
4715
  const snapshot = this.snapshot();
4511
- const lines = this.#renderLines(snapshot, this.#lastWidth);
4512
- this.#pending = { width: this.#lastWidth, snapshot, lines };
4716
+ const limit = this.#rowLimit();
4717
+ const lines = this.#renderLines(snapshot, this.#lastWidth, limit);
4718
+ this.#pending = { width: this.#lastWidth, limit, snapshot, lines };
4513
4719
  return lines.length !== this.#lastLines.length || lines.some((line, index) => line !== this.#lastLines?.[index]);
4514
4720
  }
4515
4721
  invalidate() {
4516
4722
  this.#pending = void 0;
4517
4723
  this.#lastWidth = void 0;
4724
+ this.#lastLimit = void 0;
4518
4725
  this.#lastSnapshot = void 0;
4519
4726
  this.#lastLines = void 0;
4520
4727
  }
4521
- #renderLines(snapshot, width) {
4522
- return this.#boundContent(this.#buildContent(snapshot), width);
4728
+ #renderLines(snapshot, width, limit) {
4729
+ return this.#boundContent(this.#buildContent(snapshot), width, limit);
4523
4730
  }
4524
4731
  #buildContent(snapshot) {
4525
4732
  const candidateRun = snapshot.runs[0];
@@ -4582,8 +4789,8 @@ var FabricWidget = class {
4582
4789
  );
4583
4790
  return lines;
4584
4791
  }
4585
- #boundContent(content, width) {
4586
- const bounded = content.slice(0, Math.max(1, this.maxRows));
4792
+ #boundContent(content, width, limit) {
4793
+ const bounded = content.slice(0, limit);
4587
4794
  if (content.length > bounded.length && bounded.length > 0) {
4588
4795
  const marker = this.theme.fg("dim", `+${content.length - bounded.length}`);
4589
4796
  const available = Math.max(0, width - visibleWidth2(marker) - 1);
@@ -5218,7 +5425,12 @@ var FabricUiController = class {
5218
5425
  WIDGET_ID,
5219
5426
  (tui, theme) => {
5220
5427
  this.#widgetTui = tui;
5221
- this.#widget = new FabricWidget(theme, () => this.#snapshot, config.maxRows);
5428
+ this.#widget = new FabricWidget(
5429
+ theme,
5430
+ () => this.#snapshot,
5431
+ config.maxRows,
5432
+ () => tui.terminal?.rows ?? process.stdout.rows
5433
+ );
5222
5434
  return this.#widget;
5223
5435
  },
5224
5436
  { placement: "aboveEditor" }
@@ -5385,6 +5597,7 @@ var FABRIC_RUNTIME_PATHS = {
5385
5597
  skills: path10.resolve(FABRIC_ENTRY_DIR, "..", "skillsets")
5386
5598
  };
5387
5599
  var FABRIC_SKILLS_DIR = FABRIC_RUNTIME_PATHS.skills;
5600
+ var FABRIC_ENTRY_IDENTITY = captureLoadedFileIdentity(import.meta.url);
5388
5601
  var componentRegistrationFrom = (value) => {
5389
5602
  if (typeof value !== "object" || value === null || Array.isArray(value)) return void 0;
5390
5603
  const registration = value;
@@ -5416,7 +5629,11 @@ async function piFabric(pi, options = {}) {
5416
5629
  );
5417
5630
  const capturedTools = new CapturedToolCatalog();
5418
5631
  const proxyContract = new ProxyContractLedger();
5419
- const state = new FabricState(pi, capturedTools, { paths: FABRIC_RUNTIME_PATHS, ...options.managedHost ? { managedHost: options.managedHost } : {} });
5632
+ const state = new FabricState(pi, capturedTools, {
5633
+ paths: FABRIC_RUNTIME_PATHS,
5634
+ ...FABRIC_ENTRY_IDENTITY ? { entryIdentity: FABRIC_ENTRY_IDENTITY } : {},
5635
+ ...options.managedHost ? { managedHost: options.managedHost } : {}
5636
+ });
5420
5637
  const directToolApproval = new FabricDirectToolApproval(
5421
5638
  pi,
5422
5639
  () => state.config,
@@ -5819,8 +6036,8 @@ async function piFabric(pi, options = {}) {
5819
6036
  message: {
5820
6037
  ...event.message,
5821
6038
  content: [{ type: "text", text }],
5822
- details,
5823
- isError: !boundarySucceeded
6039
+ isError: !boundarySucceeded,
6040
+ ...details === void 0 ? {} : { details }
5824
6041
  }
5825
6042
  };
5826
6043
  });
@@ -5854,12 +6071,18 @@ async function piFabric(pi, options = {}) {
5854
6071
  });
5855
6072
  pi.on("context", (event, context) => {
5856
6073
  const sessionId = context.sessionManager.getSessionId();
6074
+ const pendingContinuation = state.initialized ? state.prewalk.pendingContinuationMessage(sessionId) : void 0;
5857
6075
  const continuation = filterPrewalkContinuationMessages(
5858
6076
  event.messages,
5859
- (continuationId) => state.initialized && state.prewalk.acceptContinuation(sessionId, continuationId)
6077
+ (continuationId) => state.initialized && state.prewalk.acceptContinuation(sessionId, continuationId),
6078
+ pendingContinuation
6079
+ );
6080
+ const planning = filterPrewalkPlanningDirectives(
6081
+ continuation.messages,
6082
+ state.initialized && state.prewalk.isArmed(sessionId)
5860
6083
  );
5861
- let changed = continuation.changed;
5862
- const messages = continuation.messages.map((message) => {
6084
+ let changed = continuation.changed || planning.changed;
6085
+ const messages = planning.messages.map((message) => {
5863
6086
  if (message.role !== "user") return message;
5864
6087
  if (typeof message.content === "string") {
5865
6088
  const content2 = expandSkillDirMarkersInSkillBlock(message.content);
@@ -6002,6 +6225,7 @@ export {
6002
6225
  ENTROPY_INVOCATION_STAGES,
6003
6226
  ENTROPY_METRIC_VERSION,
6004
6227
  ENTROPY_WEIGHTS,
6228
+ FABRIC_BASH_MIDDLEWARE,
6005
6229
  FABRIC_COMPONENT_DISCOVER_EVENT,
6006
6230
  FABRIC_COMPONENT_REGISTER_EVENT,
6007
6231
  FABRIC_EXECUTION_DETAILS_MAX_BYTES,