@e4779/pi-fabric 0.105.0-fork.22 → 0.109.4-fork.24

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 (295) hide show
  1. package/README.md +3 -1
  2. package/THIRD_PARTY_NOTICES.md +2 -2
  3. package/dist/actors/global-registry.d.ts.map +1 -1
  4. package/dist/agents/manager.d.ts.map +1 -1
  5. package/dist/agents/result.d.ts.map +1 -1
  6. package/dist/agents/result.js +1 -1
  7. package/dist/agents/runner-registry.d.ts +1 -1
  8. package/dist/agents/runner-registry.d.ts.map +1 -1
  9. package/dist/agents.js +7 -7
  10. package/dist/chunks/{chunk-X2TRSE7D.js → chunk-2YG4ZA2K.js} +2 -2
  11. package/dist/chunks/{chunk-5MNLVHF5.js → chunk-3DUKKQHN.js} +28 -13
  12. package/dist/chunks/chunk-3DUKKQHN.js.map +7 -0
  13. package/dist/chunks/{chunk-M5IN6DMF.js → chunk-56RFFBBO.js} +6 -6
  14. package/dist/chunks/{chunk-R5F6CHW2.js → chunk-67RXNJLG.js} +18 -13
  15. package/dist/chunks/chunk-67RXNJLG.js.map +7 -0
  16. package/dist/chunks/{chunk-TFFZVLR2.js → chunk-7OFAO4HK.js} +55 -4
  17. package/dist/chunks/chunk-7OFAO4HK.js.map +7 -0
  18. package/dist/chunks/{chunk-EXWS4ZS3.js → chunk-ACGEYOXM.js} +104 -26
  19. package/dist/chunks/chunk-ACGEYOXM.js.map +7 -0
  20. package/dist/chunks/{chunk-W7X4XEQU.js → chunk-COQPGIBO.js} +2 -2
  21. package/dist/chunks/{chunk-VON4TSO3.js → chunk-CZPQTISQ.js} +27 -2
  22. package/dist/chunks/chunk-CZPQTISQ.js.map +7 -0
  23. package/dist/chunks/{chunk-ABJCSNZO.js → chunk-D3IONBBJ.js} +2 -2
  24. package/dist/chunks/{chunk-7JU7Z4XQ.js → chunk-D3W6CBJZ.js} +2 -2
  25. package/dist/chunks/{chunk-QLFDPXK7.js → chunk-DV2JZSCI.js} +153 -27
  26. package/dist/chunks/chunk-DV2JZSCI.js.map +7 -0
  27. package/dist/chunks/{chunk-FB24AOIJ.js → chunk-H3SGA7G7.js} +5 -5
  28. package/dist/chunks/{chunk-ZXKYU6CH.js → chunk-HCNHKJDA.js} +2 -2
  29. package/dist/chunks/{chunk-YYSZBD7S.js → chunk-HQ5YW2OJ.js} +2 -2
  30. package/dist/chunks/{chunk-WREA4RNR.js → chunk-I2TK65VR.js} +3 -3
  31. package/dist/chunks/{chunk-T5CU2GPZ.js → chunk-I5ENWRUJ.js} +4 -4
  32. package/dist/chunks/{chunk-GJVPP3NN.js → chunk-JJQECUUA.js} +5 -5
  33. package/dist/chunks/chunk-JJQECUUA.js.map +7 -0
  34. package/dist/chunks/{chunk-DZ4WN5XJ.js → chunk-JV4JR6TT.js} +3 -3
  35. package/dist/chunks/chunk-K6QXUGS5.js +30 -0
  36. package/dist/chunks/chunk-K6QXUGS5.js.map +7 -0
  37. package/dist/chunks/{chunk-WLLXKS6I.js → chunk-K7LQIEJY.js} +5 -5
  38. package/dist/chunks/{chunk-3GJJG2FV.js → chunk-KBYSGB7E.js} +2 -2
  39. package/dist/chunks/chunk-KBYSGB7E.js.map +7 -0
  40. package/dist/chunks/{chunk-C7EEG6SM.js → chunk-LQSICKDK.js} +2 -2
  41. package/dist/chunks/{chunk-OVBKQCYL.js → chunk-N2VKKA7O.js} +2 -2
  42. package/dist/chunks/{chunk-LOLCTWJF.js → chunk-OTHMEDN6.js} +4 -4
  43. package/dist/chunks/{chunk-N5GUXC6F.js → chunk-P4KH4S4S.js} +2 -1
  44. package/dist/chunks/chunk-P4KH4S4S.js.map +7 -0
  45. package/dist/chunks/{chunk-M6IRQ3QT.js → chunk-PH4PT6R4.js} +2 -2
  46. package/dist/chunks/{chunk-CGL7QP4A.js → chunk-PK4NIJEV.js} +10 -1
  47. package/dist/chunks/{chunk-CGL7QP4A.js.map → chunk-PK4NIJEV.js.map} +2 -2
  48. package/dist/chunks/{chunk-7XRUMDV7.js → chunk-QQ7D6UAM.js} +2 -2
  49. package/dist/chunks/{chunk-VPRJOD4Y.js → chunk-QSL5UXNW.js} +4 -4
  50. package/dist/chunks/{chunk-3KDUMDPZ.js → chunk-QSXZPS7F.js} +6 -6
  51. package/dist/chunks/{chunk-PYQM7KPL.js → chunk-R2MMPHR2.js} +2 -2
  52. package/dist/chunks/{chunk-S3IRPDSO.js → chunk-RFOQPXKN.js} +2 -2
  53. package/dist/chunks/{chunk-KQ6R5EWR.js → chunk-RG2VFKR3.js} +26 -24
  54. package/dist/chunks/chunk-RG2VFKR3.js.map +7 -0
  55. package/dist/chunks/{chunk-YRDCJZZW.js → chunk-RUO6L7RM.js} +1 -1
  56. package/dist/chunks/{chunk-YRDCJZZW.js.map → chunk-RUO6L7RM.js.map} +1 -1
  57. package/dist/chunks/{chunk-4RTHQGES.js → chunk-ST36EYHN.js} +4 -4
  58. package/dist/chunks/chunk-ST36EYHN.js.map +7 -0
  59. package/dist/chunks/{chunk-SGFH5PYA.js → chunk-V2SKDVQX.js} +10 -9
  60. package/dist/chunks/chunk-V2SKDVQX.js.map +7 -0
  61. package/dist/chunks/{chunk-QY7YK7M6.js → chunk-VR2LV4CA.js} +2 -2
  62. package/dist/chunks/{chunk-KYXZJNV6.js → chunk-VTK2FEH7.js} +3 -1
  63. package/dist/chunks/{chunk-KYXZJNV6.js.map → chunk-VTK2FEH7.js.map} +2 -2
  64. package/dist/chunks/{chunk-3QECYQGA.js → chunk-VYQV5JRT.js} +13 -1
  65. package/dist/chunks/chunk-VYQV5JRT.js.map +7 -0
  66. package/dist/chunks/{chunk-CYMDX3XP.js → chunk-WTLH5RY4.js} +2 -2
  67. package/dist/chunks/chunk-WTLH5RY4.js.map +7 -0
  68. package/dist/chunks/{chunk-WYUV6WL3.js → chunk-YKT5VLLQ.js} +2 -2
  69. package/dist/chunks/{chunk-BVJBYFHD.js → chunk-ZPI4QTOX.js} +2 -2
  70. package/dist/cli/decisions.js +1 -1
  71. package/dist/cli/mesh.js +2 -2
  72. package/dist/compaction/hook.js +6 -6
  73. package/dist/compaction/owner.js +7 -7
  74. package/dist/components/configuration.js +2 -2
  75. package/dist/config.d.ts +16 -1
  76. package/dist/config.d.ts.map +1 -1
  77. package/dist/core/action-registry.d.ts +1 -1
  78. package/dist/core/action-registry.d.ts.map +1 -1
  79. package/dist/core/action-registry.js +7 -7
  80. package/dist/core/media-sanitize.d.ts.map +1 -1
  81. package/dist/core/native-tool-names.d.ts +9 -0
  82. package/dist/core/native-tool-names.d.ts.map +1 -0
  83. package/dist/core/native-tool-result.d.ts +11 -0
  84. package/dist/core/native-tool-result.d.ts.map +1 -0
  85. package/dist/core/provider-operations.js +1 -1
  86. package/dist/core/provider-operations.js.map +2 -2
  87. package/dist/core/system-guidance.d.ts +3 -3
  88. package/dist/core/system-guidance.d.ts.map +1 -1
  89. package/dist/durable/agent.d.ts +77 -0
  90. package/dist/durable/agent.d.ts.map +1 -0
  91. package/dist/durable/session.d.ts +19 -0
  92. package/dist/durable/session.d.ts.map +1 -0
  93. package/dist/durable/storage.d.ts +7 -0
  94. package/dist/durable/storage.d.ts.map +1 -0
  95. package/dist/durable/worker-host.d.ts +13 -0
  96. package/dist/durable/worker-host.d.ts.map +1 -0
  97. package/dist/durable/worker-host.js +1149 -0
  98. package/dist/durable/worker-host.js.map +7 -0
  99. package/dist/durable/worker-options.d.ts +17 -0
  100. package/dist/durable/worker-options.d.ts.map +1 -0
  101. package/dist/durable/worker.d.ts +3 -0
  102. package/dist/durable/worker.d.ts.map +1 -0
  103. package/dist/durable/worker.js +110 -0
  104. package/dist/durable/worker.js.map +7 -0
  105. package/dist/durable-controls.d.ts +27 -0
  106. package/dist/durable-controls.d.ts.map +1 -0
  107. package/dist/durable-input.d.ts +13 -0
  108. package/dist/durable-input.d.ts.map +1 -0
  109. package/dist/durable.d.ts +6 -0
  110. package/dist/durable.d.ts.map +1 -1
  111. package/dist/durable.js +194 -24
  112. package/dist/durable.js.map +4 -4
  113. package/dist/entropy/index.js +8 -8
  114. package/dist/execution-service.d.ts +4 -0
  115. package/dist/execution-service.d.ts.map +1 -1
  116. package/dist/extension-bootstrap.js +13 -13
  117. package/dist/extension.d.ts.map +1 -1
  118. package/dist/fabric-exec-arguments.d.ts.map +1 -1
  119. package/dist/fabric-exec-tool.d.ts.map +1 -1
  120. package/dist/fabric-runtime-state.d.ts.map +1 -1
  121. package/dist/fabric-runtime-state.js +623 -302
  122. package/dist/fabric-runtime-state.js.map +4 -4
  123. package/dist/index.js +17 -17
  124. package/dist/jev/observation.js +6 -6
  125. package/dist/jev.js +9 -9
  126. package/dist/mcp.js +1 -1
  127. package/dist/memory/digest.js +2 -2
  128. package/dist/memory/discovery.js +6 -6
  129. package/dist/memory/extractive-history.d.ts +29 -0
  130. package/dist/memory/extractive-history.d.ts.map +1 -0
  131. package/dist/memory/extractive-history.js +340 -0
  132. package/dist/memory/extractive-history.js.map +7 -0
  133. package/dist/memory/extractive-index.d.ts +46 -0
  134. package/dist/memory/extractive-index.d.ts.map +1 -0
  135. package/dist/memory/file-worker.js +9 -9
  136. package/dist/memory/normalize.js +5 -5
  137. package/dist/memory/search.js +7 -7
  138. package/dist/memory/worker-provider.js +10 -10
  139. package/dist/memory.js +10 -10
  140. package/dist/native-codemode.d.ts +34 -0
  141. package/dist/native-codemode.d.ts.map +1 -0
  142. package/dist/native-discovery.d.ts +16 -0
  143. package/dist/native-discovery.d.ts.map +1 -0
  144. package/dist/native-discovery.js +19 -0
  145. package/dist/native-discovery.js.map +7 -0
  146. package/dist/native-image-artifacts.d.ts +4 -0
  147. package/dist/native-image-artifacts.d.ts.map +1 -0
  148. package/dist/native-image-artifacts.js +18 -0
  149. package/dist/native-image-artifacts.js.map +7 -0
  150. package/dist/native-tool-catalog.d.ts +21 -0
  151. package/dist/native-tool-catalog.d.ts.map +1 -0
  152. package/dist/native-tool-catalog.js +71 -0
  153. package/dist/native-tool-catalog.js.map +7 -0
  154. package/dist/protocol.d.ts +2 -0
  155. package/dist/protocol.d.ts.map +1 -1
  156. package/dist/protocol.js +1 -1
  157. package/dist/providers/agents-provider.d.ts.map +1 -1
  158. package/dist/providers/captured-tools-provider.d.ts +1 -1
  159. package/dist/providers/captured-tools-provider.d.ts.map +1 -1
  160. package/dist/providers/jev-provider.js +9 -9
  161. package/dist/providers/mcp-provider.d.ts +1 -1
  162. package/dist/providers/mcp-provider.d.ts.map +1 -1
  163. package/dist/providers/memory-provider.js +9 -9
  164. package/dist/providers/pi-native-mcp.d.ts.map +1 -1
  165. package/dist/providers/pi-tools-provider.d.ts.map +1 -1
  166. package/dist/residency/host.js +14 -14
  167. package/dist/residency/pi-entry.js +14 -14
  168. package/dist/runners.js +1 -1
  169. package/dist/runtime/core-override-guest-types.js +2 -2
  170. package/dist/runtime/dynamic-guest-types.d.ts +2 -0
  171. package/dist/runtime/dynamic-guest-types.d.ts.map +1 -1
  172. package/dist/runtime/dynamic-guest-types.js +5 -3
  173. package/dist/runtime/guest-types.d.ts +1 -1
  174. package/dist/runtime/guest-types.d.ts.map +1 -1
  175. package/dist/runtime/guest-types.js +1 -1
  176. package/dist/runtime/kernel.d.ts +5 -0
  177. package/dist/runtime/kernel.d.ts.map +1 -1
  178. package/dist/runtime/monty-runtime.js +1 -1
  179. package/dist/runtime/native-codemode-guest.d.ts +2 -0
  180. package/dist/runtime/native-codemode-guest.d.ts.map +1 -0
  181. package/dist/runtime/native-codemode-types.d.ts +2 -0
  182. package/dist/runtime/native-codemode-types.d.ts.map +1 -0
  183. package/dist/runtime/node-process-child-source.d.ts.map +1 -1
  184. package/dist/runtime/node-process-runtime.d.ts.map +1 -1
  185. package/dist/runtime/node-process-runtime.js +3 -3
  186. package/dist/runtime/quickjs-runtime.d.ts +1 -1
  187. package/dist/runtime/quickjs-runtime.d.ts.map +1 -1
  188. package/dist/runtime/quickjs-runtime.js +3 -2
  189. package/dist/runtime/type-checker.d.ts +2 -0
  190. package/dist/runtime/type-checker.d.ts.map +1 -1
  191. package/dist/runtime/type-checker.js +5 -3
  192. package/dist/runtime/typescript-kernel.d.ts +1 -1
  193. package/dist/runtime/typescript-kernel.d.ts.map +1 -1
  194. package/dist/runtime/typescript-kernel.js +13 -11
  195. package/dist/runtime/typescript-kernel.js.map +2 -2
  196. package/dist/runtime-state-speculation.d.ts +4 -1
  197. package/dist/runtime-state-speculation.d.ts.map +1 -1
  198. package/dist/speculation/python-scanner.js +1 -1
  199. package/dist/speculation/python-scanner.js.map +2 -2
  200. package/dist/speculation/scanner.d.ts +2 -0
  201. package/dist/speculation/scanner.d.ts.map +1 -1
  202. package/dist/speculation/scanner.js +18 -4
  203. package/dist/speculation/scanner.js.map +2 -2
  204. package/dist/speculation/types.d.ts +1 -0
  205. package/dist/speculation/types.d.ts.map +1 -1
  206. package/dist/type-error-guidance.js +1 -1
  207. package/dist/ui/border-status-editor.d.ts +3 -0
  208. package/dist/ui/border-status-editor.d.ts.map +1 -1
  209. package/dist/ui/controller.d.ts.map +1 -1
  210. package/dist/ui/conversation.d.ts +1 -0
  211. package/dist/ui/conversation.d.ts.map +1 -1
  212. package/dist/ui/conversation.js +28 -5
  213. package/dist/ui/conversation.js.map +2 -2
  214. package/dist/ui/dashboard.d.ts +2 -0
  215. package/dist/ui/dashboard.d.ts.map +1 -1
  216. package/dist/ui/dashboard.js +20 -7
  217. package/dist/ui/dashboard.js.map +2 -2
  218. package/dist/ui/settings-section-context.d.ts +2 -0
  219. package/dist/ui/settings-section-context.d.ts.map +1 -1
  220. package/dist/ui/settings-sections-execution.d.ts.map +1 -1
  221. package/dist/ui/settings-sections-lifecycle.d.ts +1 -0
  222. package/dist/ui/settings-sections-lifecycle.d.ts.map +1 -1
  223. package/dist/ui/settings-sections.d.ts +2 -0
  224. package/dist/ui/settings-sections.d.ts.map +1 -1
  225. package/dist/ui/settings-values.d.ts +4 -1
  226. package/dist/ui/settings-values.d.ts.map +1 -1
  227. package/dist/ui/settings.d.ts.map +1 -1
  228. package/dist/ui/settings.js +61 -2
  229. package/dist/ui/settings.js.map +2 -2
  230. package/dist/verified/generated/authority-kernel.js +2 -2
  231. package/dist/verified/generated/kernel.js +2 -2
  232. package/dist/verified/generated/lifecycle-kernel.js +2 -2
  233. package/dist/verified/generated/manifest.json +7 -7
  234. package/dist/verified/generated/provider-kernel.js +2 -2
  235. package/dist/verified/generated/storage-kernel.js +2 -2
  236. package/dist/worker/model-control.d.ts.map +1 -1
  237. package/dist/worker/model-control.js.map +2 -2
  238. package/dist/worker/options.d.ts.map +1 -1
  239. package/dist/worker/options.js +4 -3
  240. package/dist/worker/options.js.map +2 -2
  241. package/dist/worker/result.js +12 -0
  242. package/dist/worker/result.js.map +2 -2
  243. package/dist/worker.js +95 -8
  244. package/dist/worker.js.map +2 -2
  245. package/docs/agents.md +5 -5
  246. package/docs/codemode-parity.md +99 -0
  247. package/docs/configuration.md +31 -2
  248. package/docs/durable-pi.md +166 -38
  249. package/docs/extractive-history.md +171 -0
  250. package/docs/interface.md +1 -1
  251. package/docs/provider-capabilities.md +1 -1
  252. package/docs/speculation.md +12 -3
  253. package/docs/verified-kernels.md +1 -1
  254. package/package.json +14 -20
  255. package/scripts/test-verified-kernels.mjs +1 -1
  256. package/scripts/verified-kernels.mjs +1 -1
  257. package/skillsets/typescript/fabric-exec/SKILL.md +4 -4
  258. package/dist/chunks/chunk-3GJJG2FV.js.map +0 -7
  259. package/dist/chunks/chunk-3QECYQGA.js.map +0 -7
  260. package/dist/chunks/chunk-4RTHQGES.js.map +0 -7
  261. package/dist/chunks/chunk-5MNLVHF5.js.map +0 -7
  262. package/dist/chunks/chunk-CYMDX3XP.js.map +0 -7
  263. package/dist/chunks/chunk-EXWS4ZS3.js.map +0 -7
  264. package/dist/chunks/chunk-GJVPP3NN.js.map +0 -7
  265. package/dist/chunks/chunk-KQ6R5EWR.js.map +0 -7
  266. package/dist/chunks/chunk-N5GUXC6F.js.map +0 -7
  267. package/dist/chunks/chunk-QLFDPXK7.js.map +0 -7
  268. package/dist/chunks/chunk-R5F6CHW2.js.map +0 -7
  269. package/dist/chunks/chunk-SGFH5PYA.js.map +0 -7
  270. package/dist/chunks/chunk-TFFZVLR2.js.map +0 -7
  271. package/dist/chunks/chunk-VON4TSO3.js.map +0 -7
  272. /package/dist/chunks/{chunk-X2TRSE7D.js.map → chunk-2YG4ZA2K.js.map} +0 -0
  273. /package/dist/chunks/{chunk-M5IN6DMF.js.map → chunk-56RFFBBO.js.map} +0 -0
  274. /package/dist/chunks/{chunk-W7X4XEQU.js.map → chunk-COQPGIBO.js.map} +0 -0
  275. /package/dist/chunks/{chunk-ABJCSNZO.js.map → chunk-D3IONBBJ.js.map} +0 -0
  276. /package/dist/chunks/{chunk-7JU7Z4XQ.js.map → chunk-D3W6CBJZ.js.map} +0 -0
  277. /package/dist/chunks/{chunk-FB24AOIJ.js.map → chunk-H3SGA7G7.js.map} +0 -0
  278. /package/dist/chunks/{chunk-ZXKYU6CH.js.map → chunk-HCNHKJDA.js.map} +0 -0
  279. /package/dist/chunks/{chunk-YYSZBD7S.js.map → chunk-HQ5YW2OJ.js.map} +0 -0
  280. /package/dist/chunks/{chunk-WREA4RNR.js.map → chunk-I2TK65VR.js.map} +0 -0
  281. /package/dist/chunks/{chunk-T5CU2GPZ.js.map → chunk-I5ENWRUJ.js.map} +0 -0
  282. /package/dist/chunks/{chunk-DZ4WN5XJ.js.map → chunk-JV4JR6TT.js.map} +0 -0
  283. /package/dist/chunks/{chunk-WLLXKS6I.js.map → chunk-K7LQIEJY.js.map} +0 -0
  284. /package/dist/chunks/{chunk-C7EEG6SM.js.map → chunk-LQSICKDK.js.map} +0 -0
  285. /package/dist/chunks/{chunk-OVBKQCYL.js.map → chunk-N2VKKA7O.js.map} +0 -0
  286. /package/dist/chunks/{chunk-LOLCTWJF.js.map → chunk-OTHMEDN6.js.map} +0 -0
  287. /package/dist/chunks/{chunk-M6IRQ3QT.js.map → chunk-PH4PT6R4.js.map} +0 -0
  288. /package/dist/chunks/{chunk-7XRUMDV7.js.map → chunk-QQ7D6UAM.js.map} +0 -0
  289. /package/dist/chunks/{chunk-VPRJOD4Y.js.map → chunk-QSL5UXNW.js.map} +0 -0
  290. /package/dist/chunks/{chunk-3KDUMDPZ.js.map → chunk-QSXZPS7F.js.map} +0 -0
  291. /package/dist/chunks/{chunk-PYQM7KPL.js.map → chunk-R2MMPHR2.js.map} +0 -0
  292. /package/dist/chunks/{chunk-S3IRPDSO.js.map → chunk-RFOQPXKN.js.map} +0 -0
  293. /package/dist/chunks/{chunk-QY7YK7M6.js.map → chunk-VR2LV4CA.js.map} +0 -0
  294. /package/dist/chunks/{chunk-WYUV6WL3.js.map → chunk-YKT5VLLQ.js.map} +0 -0
  295. /package/dist/chunks/{chunk-BVJBYFHD.js.map → chunk-ZPI4QTOX.js.map} +0 -0
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/runtime/native-codemode-types.ts", "../../src/jev/guest-types.ts", "../../src/runtime/guest-types.ts"],
4
+ "sourcesContent": ["export const NATIVE_CODEMODE_TYPES = `\ntype NativeModelType = \"chat\" | \"image\" | \"classifier\";\ninterface NativeModelInfo { type?: NativeModelType; provider: string; id: string; name: string; api: string; input: (\"text\" | \"image\")[]; contextWindow?: number; [key: string]: unknown }\ntype NativeModelSelector = { provider: string; id: string };\ntype NativeClassifierQuestion =\n | { type: \"choice\"; instructions: string; criteria: Record<string, string> }\n | { type: \"score\"; instructions: string; criteria: string[] }\n | { type: \"bool\"; instructions: string; criteria: { true: string; false: string } };\ntype NativeClassifierAnswer =\n | { type: \"choice\"; choice: string; probabilities: Record<string, number>; confidence: number }\n | { type: \"score\"; score: number; confidence: number }\n | { type: \"bool\"; probability: number };\ninterface NativeClassifierContext { state: Record<string, unknown>; questions: Record<string, NativeClassifierQuestion>; images?: NativeImageBlock[] }\ninterface NativeModelUsage { input: number; output: number; totalTokens: number; cost: { total: number } }\ninterface NativeClassifierResult { provider: string; model: string; answers: Record<string, NativeClassifierAnswer>; usage?: NativeModelUsage; stopReason: \"stop\" | \"error\" | \"aborted\"; errorMessage?: string }\ntype NativeImageBlock = { type: \"image\"; data: string; mimeType: string };\ntype NativeTextBlock = { type: \"text\"; text: string };\ninterface NativeImagesContext { input: (NativeImageBlock | NativeTextBlock)[] }\ninterface NativeImagesResult { provider: string; model: string; output: (NativeImageBlock | NativeTextBlock)[]; usage?: NativeModelUsage; stopReason: \"stop\" | \"error\" | \"aborted\"; errorMessage?: string }\ninterface FabricNativeModels {\n (): Promise<FabricModelInfo[]>;\n getModelsOfType(type: NativeModelType, provider?: string): Promise<NativeModelInfo[]>;\n getAvailableOfType(type: NativeModelType, provider?: string): Promise<NativeModelInfo[]>;\n getModelOfType(type: NativeModelType, provider: string, id: string): Promise<NativeModelInfo | undefined>;\n classify(model: NativeModelSelector, context: NativeClassifierContext): Promise<NativeClassifierResult>;\n generateImages(model: NativeModelSelector, context: NativeImagesContext): Promise<NativeImagesResult>;\n}\ninterface NativeToolInfo { name: string; description: string }\ndeclare const ALL_TOOLS: readonly NativeToolInfo[];\ndeclare function searchTools(query: string, options?: { limit?: number; namespace?: string }): Promise<NativeToolInfo[]>;\ndeclare function describeTool(name: string): Promise<(NativeToolInfo & { declaration: string }) | undefined>;\ndeclare function describeNamespace(name: string): Promise<{ name: string; description?: string; instructions?: string; tools: NativeToolInfo[] } | undefined>;\ndeclare const nativeDiscovery: {\n readonly ALL_TOOLS: readonly NativeToolInfo[];\n searchTools(query: string, options?: {limit?: number; namespace?: string}): Promise<NativeToolInfo[]>;\n describeTool(name: string): Promise<string | undefined>;\n describeNamespace(name: string): Promise<{name: string; description?: string; instructions?: string; tools: string[]} | undefined>;\n};\ndeclare const models: FabricNativeModels;\ndeclare function store(key: string, value: unknown): void;\ndeclare function load<T = unknown>(key: string): T | undefined;\ndeclare function text(value: unknown): void;\ndeclare function image(value: NativeImageBlock | string | { image_url: string | { url: string } }): void;\ndeclare function exit(): never;\n`;\n", "export const JEV_GUEST_DECLARATIONS = `\ntype FabricJevJson = null | boolean | number | string | FabricJevJson[] | { [key: string]: FabricJevJson };\ntype FabricJevDescription = string | FabricJevJson[] | { [key: string]: FabricJevJson };\ntype FabricJevQuestion =\n | { type: \"noul\"; instructions: FabricJevDescription; criteria?: { true?: FabricJevDescription; false?: FabricJevDescription } }\n | { type: \"choice\"; instructions: FabricJevDescription; criteria: Record<string, FabricJevDescription | null> }\n | { type: \"score\"; instructions: FabricJevDescription; criteria: FabricJevDescription[] };\ntype FabricJevAnswer<Q extends FabricJevQuestion> = Q extends { type: \"noul\" }\n ? { type: \"noul\"; noul: number }\n : Q extends { type: \"choice\"; criteria: infer C }\n ? { type: \"choice\"; choice: Extract<keyof C, string>; confidence: number; probabilities: Record<Extract<keyof C, string>, number> }\n : { type: \"score\"; score: number; confidence: number; probabilities: Record<string, number>; legend: Record<string, FabricJevJson> };\ninterface FabricJevProgram {\n name: string;\n code: string;\n inputSchema: Record<string, unknown>;\n outputSchema: Record<string, unknown>;\n requires: string[];\n limits?: { timeoutMs?: number; maxEvaluations?: number; maxToolCalls?: number; maxTokens?: number };\n}\ntype FabricJevHostEventName = \"input\" | \"turn_end\" | \"tool_error\" | \"agent_end\" | \"agent_settled\";\ninterface FabricJevObserve {\n events: FabricJevHostEventName[];\n include?: Array<\"inputText\" | \"assistantText\" | \"toolResults\">;\n maxChars?: number; queueSize?: number; maxEventAgeMs?: number;\n delivery?: \"steer\" | \"followUp\"; triggerTurn?: boolean; maxAdvice?: number;\n}\ninterface FabricJevHostEvent {\n id: string; sequence: number; event: FabricJevHostEventName; source: \"main\";\n sessionId: string; revision: number; at: number; payload: FabricJevJson; truncated: boolean;\n}\ninterface FabricJevObservationStats {\n events: FabricJevHostEventName[]; received: number; consumed: number; dropped: number; queued: number;\n adviceDelivered: number; adviceSuppressed: number;\n}\ninterface FabricJevAdviceResult {\n delivered: boolean;\n reason?: \"disabled\" | \"stale\" | \"duplicate\" | \"budget\" | \"feedback\" | \"delivery_failed\";\n}\ninterface FabricJevRun<T = unknown> {\n id: string; name: string; state: \"running\" | \"completed\" | \"failed\" | \"cancelled\" | \"timed_out\";\n background: boolean; startedAt: number; endedAt?: number; result?: T; error?: string;\n evaluations: number; toolCalls: number; usage: { input_tokens: number; output_tokens: number };\n events: Array<{ sequence: number; at: number; value: FabricJevJson }>; nextSequence: number; logs: string[];\n observation?: FabricJevObservationStats;\n}\ninterface FabricJevApi {\n evaluate<Q extends Record<string, FabricJevQuestion>>(args: {\n state: string | FabricJevJson[] | { [key: string]: FabricJevJson }; questions: Q; model?: string;\n }): Promise<{ model: string; answers: { [K in keyof Q]: FabricJevAnswer<Q[K]> }; usage: { input_tokens: number; output_tokens: number } }>;\n run<T = unknown>(args: { program: FabricJevProgram; input: FabricJevJson }): Promise<FabricJevRun<T>>;\n spawn(args: { program: FabricJevProgram; input: FabricJevJson; observe?: FabricJevObserve }): Promise<FabricJevRun>;\n status(args?: { id?: never; after?: never }): Promise<{ credentials: { configured: boolean; source: \"pi\" | \"environment\" | \"command\" | \"missing\"; verified: boolean }; model: string; runs: Array<{ id: string; name: string; state: string; background: boolean; startedAt: number; evaluations: number; toolCalls: number; observation?: FabricJevObservationStats }> }>;\n status<T = unknown>(args: { id: string; after?: number }): Promise<FabricJevRun<T>>;\n wait<T = unknown>(args: { id: string }): Promise<FabricJevRun<T>>;\n /** Alias for wait. */\n join<T = unknown>(args: { id: string }): Promise<FabricJevRun<T>>;\n advise(args: { id: string; eventId: string; message: string }): Promise<FabricJevAdviceResult>;\n stop(args: { id: string }): Promise<FabricJevRun>;\n}\ndeclare const jev: FabricJevApi;\n`;\n", "import type { FabricDynamicGuestDeclarations } from \"../protocol.js\";\nimport { NATIVE_CODEMODE_TYPES } from \"./native-codemode-types.js\";\nimport { JEV_GUEST_DECLARATIONS } from \"../jev/guest-types.js\";\n\n// These names and compatibility fields are the single source of truth for\n// generated core-override overloads. Keep them beside PiToolsApi below so an\n// override extends the same guest contract rather than copying its signatures.\n// Numeric fields widen to `number | string` in generated overloads too,\n// mirroring built-in runtime normalization; a strict override schema still\n// rejects the string form at validation time, and the registry error wins.\nexport const PI_CORE_COMPATIBILITY_ARGUMENT_TYPE_NAMES = {\n read: \"PiReadCompatibilityArgument\",\n bash: \"PiBashCompatibilityArgument\",\n powershell: \"PiPowerShellCompatibilityArgument\",\n edit: \"PiEditCompatibilityArgument\",\n write: \"PiWriteCompatibilityArgument\",\n grep: \"PiGrepCompatibilityArgument\",\n find: \"PiFindCompatibilityArgument\",\n ls: \"PiLsCompatibilityArgument\",\n} as const;\n\nexport const PI_CORE_NUMERIC_FIELDS = {\n read: [\"offset\", \"limit\"],\n bash: [\"timeout\"],\n powershell: [\"timeout\"],\n edit: [],\n write: [],\n grep: [\"context\", \"limit\"],\n find: [\"limit\"],\n ls: [\"limit\"],\n} as const;\n\nexport const GUEST_TYPE_DECLARATIONS = `\n${NATIVE_CODEMODE_TYPES}\ntype JsonPrimitive = string | number | boolean | null;\ntype JsonValue = JsonPrimitive | JsonValue[] | { [key: string]: JsonValue };\ntype FabricTransport = \"auto\" | \"process\" | \"tmux\" | \"screen\" | \"localterm\" | \"herdr\";\ntype FabricAgentRunner = \"pi-durable\" | \"pi\" | \"claude\" | \"veda\" | (string & {});\ntype FabricKernel = \"typescript\" | \"python\";\ntype FabricThinking = \"off\" | \"minimal\" | \"low\" | \"medium\" | \"high\" | \"xhigh\" | \"max\";\ninterface FabricActionEffect {\n kind: \"none\" | \"scoped\" | \"transactional\" | \"emission\";\n resources?: string[];\n ordering?: \"commutative\" | \"ordered\" | \"unknown\";\n}\ninterface FabricAction {\n ref: string;\n provider: string;\n name: string;\n description: string;\n inputSchema: Record<string, unknown>;\n outputSchema?: Record<string, unknown>;\n risk: \"read\" | \"write\" | \"execute\" | \"network\" | \"agent\";\n namespace?: string;\n effect?: FabricActionEffect;\n}\ninterface FabricAgentRequest {\n /** Omitted/inherit uses caller executor.kernel; concrete choices require Pi with extensions. */\n kernel?: FabricKernel | \"inherit\";\n task: string;\n name?: string;\n runner?: FabricAgentRunner;\n transport?: FabricTransport;\n model?: string;\n persona?: string;\n thinking?: FabricThinking;\n /** Child thinking bounds; must lie inside this session's bounds. Levels outside are clamped. */\n thinkingBounds?: FabricThinkingBounds;\n tools?: string[];\n timeoutMs?: number;\n extensions?: boolean;\n recursive?: boolean;\n /** Filesystem execution directory; relative paths resolve from the parent agent cwd. */\n cwd?: string;\n worktree?: boolean;\n /** Shell command run in the new worktree before launch. */\n worktreeSetup?: string;\n /** Pi only. branch: fork this conversation (last completed turn); snippet: prefix recent messages. */\n seed?: \"task\" | \"branch\" | \"snippet\";\n seedMessages?: number;\n /** Pi only write confinement; bash needs shell: \"unconfined\". */\n readOnly?: boolean;\n writableRoots?: string[];\n shell?: \"deny\" | \"unconfined\";\n /** Narrow the host-issued scope; omitted inherits it. Refused when this session is unscoped. */\n scope?: { grants: { resource: string; actions: (\"read\" | \"write\" | \"execute\")[] }[] };\n schema?: Record<string, unknown>;\n prompt?: string;\n instructions?: string;\n timeout_ms?: number;\n residency?: FabricParticipantResidency;\n /** Opt in to session persistence for hook-based observability and external trace ingestion. */\n persistSession?: boolean;\n}\ninterface FabricHandoffCall {\n readonly ref: string;\n}\ninterface FabricHandoffFacts {\n readonly calls: readonly FabricHandoffCall[];\n count(ref?: string | readonly string[]): number;\n}\ntype FabricHandoffPredicate = (facts: Readonly<FabricHandoffFacts>) => boolean;\ninterface FabricHandoffRequest {\n kernel?: FabricKernel | \"inherit\";\n model: string;\n task?: string;\n when?: FabricHandoffPredicate;\n name?: string;\n transport?: FabricTransport;\n thinking?: FabricThinking;\n tools?: string[];\n timeoutMs?: number;\n extensions?: boolean;\n recursive?: boolean;\n schema?: Record<string, unknown>;\n prompt?: string;\n instructions?: string;\n timeout_ms?: number;\n}\ninterface FabricHandoffResult {\n scheduled: true;\n status: \"deferred\";\n boundary: \"fabric_exec_end\";\n}\ninterface FabricMainAgentInfo {\n id: string;\n name: \"Main\";\n kind: \"main\";\n status: \"idle\" | \"running\" | \"remote\";\n runner: \"pi\";\n transport: \"host\";\n cwd?: string;\n sessionId?: string;\n model?: string;\n thinking?: string;\n startedAt?: number;\n updatedAt: number;\n pendingMessages: boolean;\n local: boolean;\n}\ninterface FabricPeerInfo {\n id: string;\n name: string;\n kind: \"peer\";\n status: \"idle\" | \"running\";\n runner: \"pi\";\n transport: \"host\";\n cwd: string;\n sessionId: string;\n model?: string;\n thinking?: string;\n startedAt: number;\n updatedAt: number;\n pendingMessages: boolean;\n local: false;\n}\ntype FabricParticipantKind = \"root\" | \"agent\" | \"actor\";\ntype FabricParticipantResidency = \"session\" | \"durable\";\ntype FabricParticipantScope = \"local\" | \"lineage\" | \"project\";\ntype FabricParticipantCapability = \"steer\" | \"followUp\" | \"stop\" | \"ask\" | \"actor-bindings\" | \"attach\" | \"fabric\";\ninterface FabricParticipantInfo {\n format: 1;\n id: string;\n kind: FabricParticipantKind | \"provider\";\n rootId: string;\n ownerHostId: string;\n ownerIdentityId: string;\n ownerIncarnation?: string;\n parentId?: string;\n name: string;\n status: string;\n runner?: FabricAgentRunner;\n provider?: string;\n transport: FabricTransport | \"host\";\n capabilities: FabricParticipantCapability[];\n cwd?: string;\n sessionId?: string;\n model?: string;\n thinking?: string;\n startedAt: number;\n updatedAt: number;\n finishedAt?: number;\n pendingMessages?: boolean;\n currentTool?: string;\n turns?: number;\n toolCalls?: number;\n usage?: { input: number; output: number; cacheRead: number; cacheWrite: number; cost: number };\n actorQueued?: number;\n actorMessages?: number;\n controlProtocol: \"v1\" | \"legacy\";\n residency: FabricParticipantResidency;\n local: boolean;\n stale: boolean;\n}\ntype FabricLifecycleEventType =\n | \"pi.input\"\n | \"pi.agent_start\"\n | \"pi.agent_end\"\n | \"pi.turn_end\"\n | \"pi.agent_settled\"\n | \"pi.tool_error\"\n | \"pi.session_compact\"\n | \"run.completed\"\n | \"run.failed\"\n | \"run.stopped\"\n | \"run.timed_out\"\n | \"run.resumed\"\n | \"run.detached\"\n | \"tokens.usage\"\n | \"component.state\";\ntype FabricLifecycleDelivery = \"steer\" | \"followUp\";\ninterface FabricLifecycleSource {\n id: string;\n name: string;\n kind: FabricParticipantKind;\n rootId: string;\n runner: FabricAgentRunner;\n ownerHostId?: string;\n ownerIdentityId?: string;\n}\ninterface FabricLifecycleEvent {\n version: 1;\n id: string;\n sequence: number;\n event: FabricLifecycleEventType;\n source: FabricLifecycleSource;\n occurredAt: number;\n publishedAt: number;\n runId?: string;\n status?: string;\n data?: unknown;\n}\ninterface FabricLifecycleSubscription {\n format: 1;\n id: string;\n from: string;\n events: FabricLifecycleEventType[];\n to: string;\n delivery: FabricLifecycleDelivery;\n triggerTurn: boolean;\n once: boolean;\n afterSequence: number;\n createdAt: number;\n updatedAt: number;\n createdBy: { id: string; name: string; kind: \"main\" | \"agent\" | \"actor\"; sessionId?: string };\n lastDeliveredAt?: number;\n lastEventId?: string;\n lastError?: string;\n}\ninterface FabricAgentHandle {\n /** Resolved Fabric kernel, absent for non-Fabric runners. */\n kernel?: FabricKernel;\n id: string;\n name: string;\n status: string;\n runner: FabricAgentRunner;\n /** Local execution metadata is absent for hosted participants. */\n transport?: FabricTransport;\n cwd?: string;\n rootId?: string;\n parentId?: string;\n depth?: number;\n generation?: number;\n model?: string;\n thinking?: FabricThinking;\n /** Present only when the requested level was clamped into thinking bounds. */\n requestedThinking?: FabricThinking;\n actorId?: string;\n actorName?: string;\n sessionId?: string;\n runnerSessionId?: string;\n attachCommand?: string;\n branch?: string;\n worktree?: string;\n text?: string;\n value?: unknown;\n error?: string;\n logFile?: string;\n residency?: FabricParticipantResidency;\n}\ninterface FabricRemoteControlResult {\n queued: true;\n messageId: string;\n routed: \"mesh\";\n acknowledged: true;\n}\ninterface FabricAgentResult extends FabricAgentHandle {\n task: string;\n startedAt: number;\n finishedAt?: number;\n turns: number;\n toolCalls: number;\n text: string;\n value?: unknown;\n error?: string;\n usage: { input: number; output: number; cacheRead: number; cacheWrite: number; cost: number };\n pendingMessages?: { steering: string[]; followUp: string[] };\n /** worktree: true runs; worktree stays the path. */\n worktreeResult?: {\n path: string; branch?: string; baseRef?: string; changedFiles: string[];\n diffstat: { files: number; insertions: number; deletions: number }; kept: boolean; diffError?: string;\n };\n}\ninterface FabricModelInfo {\n runner?: FabricAgentRunner;\n provider: string;\n id: string;\n name: string;\n key: string;\n value?: string;\n resolvedModel?: string;\n displayName?: string;\n description?: string;\n supportsEffort?: boolean;\n supportedEffortLevels?: string[];\n supportsAdaptiveThinking?: boolean;\n supportsFastMode?: boolean;\n supportsAutoMode?: boolean;\n}\ninterface FabricLogLine {\n index?: number;\n offset: number;\n raw: string;\n parsed?: unknown;\n}\ninterface FabricAgentLog {\n id: string;\n runDirectory: string;\n logFile: string;\n status?: FabricAgentResult;\n events: FabricLogLine[];\n hasMore: boolean;\n before?: number;\n}\ninterface FabricActorLog {\n actorId: string;\n actorName: string;\n sessionFile: string;\n logDir: string;\n session: FabricLogLine[];\n sessionHasMore: boolean;\n sessionBefore?: number;\n run?: {\n runId: string;\n eventsFile: string;\n status?: FabricAgentResult;\n events: FabricLogLine[];\n hasMore: boolean;\n before?: number;\n };\n retainedRuns: string[];\n}\ninterface FabricCapabilityActionHead {\n key: string;\n parentKey: string;\n ref: string;\n name: string;\n description: string;\n descriptorHash: string;\n risk: \"read\" | \"write\" | \"execute\" | \"network\" | \"agent\";\n namespace?: string;\n effect?: FabricActionEffect;\n}\ninterface FabricCapabilityProviderHead {\n key: string;\n parentKey: string;\n name: string;\n description: string;\n descriptorHash: string;\n actions: FabricCapabilityActionHead[];\n}\ninterface FabricCapabilityCatalog {\n kind: \"pi-fabric.capability-catalog\";\n version: 1;\n root: {\n key: \"capability:fabric\";\n name: \"Fabric capabilities\";\n description: string;\n descriptorHash: string;\n };\n providers: FabricCapabilityProviderHead[];\n totalActions: number;\n indexedActions: number;\n complete: boolean;\n reasons: string[];\n}\ninterface FabricToolsApi {\ninterface FabricActionListEnvelope {\n kind: \"pi-fabric.action-list\";\n version: 1;\n actions: FabricAction[];\n /** Full visible-action count before paging. */\n total: number;\n /** True when total exceeds the returned page: more actions exist. */\n truncated: boolean;\n limit: number;\n}\ninterface FabricActionSearchBackend {\n requested: \"semantic\";\n used: \"semantic\" | \"lexical\";\n degraded: boolean;\n model?: string;\n usage?: { inputTokens: number; outputTokens: number };\n abstained?: boolean;\n reason?: \"timeout\" | \"rate_limited\" | \"service_unavailable\";\n}\ninterface FabricActionSearchEnvelope {\n kind: \"pi-fabric.action-search\";\n version: 1;\n actions: FabricAction[];\n backend: FabricActionSearchBackend;\n}\ninterface FabricToolsApi {\n [name: string]: any;\n providers(): Promise<Array<{ name: string; description: string }>>;\n catalog(args?: { provider?: string; limit?: number }): Promise<FabricCapabilityCatalog>;\n /**\n * Capped discovery page: default 100 entries, silently truncated (hard cap\n * 1000). A short result never proves an action is absent \u2014 confirm with\n * search() or pass envelope: true to get totals and a truncated flag.\n */\n list(args?: { provider?: string; namespace?: string; query?: string; limit?: number; envelope?: boolean }): Promise<FabricAction[] | FabricActionListEnvelope>;\n search(args: { query: string; limit?: number; searchMode?: \"lexical\" | \"semantic\" }): Promise<FabricAction[] | FabricActionSearchEnvelope>;\n describe(args: { ref: string }): Promise<FabricAction>;\n call(args: { ref: string; args?: Record<string, unknown> }): Promise<unknown>;\n progress(args: { message: string }): Promise<void>;\n models: FabricNativeModels;\n}\ninterface FabricCapturedToolResult {\n content: Array<{ type: string; text?: string; [key: string]: unknown }>;\n text: string;\n details?: unknown;\n isError: boolean;\n terminate?: boolean;\n source: { path: string; source: string; scope: string; origin: string; baseDir?: string };\n}\ninterface FabricCapturedTool {\n (args?: Record<string, unknown>): Promise<FabricCapturedToolResult>;\n}\ntype FabricExtensionsApi = Record<string, FabricCapturedTool>;\n// String-primary tools (read/bash/powershell/grep/find/ls) accept a bare string; the\n// runtime proxy coerces it to { <primaryField>: string }. Lets the model write\n// the natural form (pi.bash(\"ls\")) instead of pi.bash({ command: \"ls\" }).\n// Return shapes differ by tool: read/grep/find/ls return their text as a bare\n// string (e.g. const src: string = await pi.read({ path })); shell/edit/write\n// return { ok, output, details } (e.g. const { output } = await pi.bash(...)).\n// Common alias keys (cmd\u2192command, query\u2192pattern, file\u2192path, dir\u2192path) and a\n// flat edit shape ({ path, oldText, newText }) are also accepted; the runtime\n// proxy normalizes them to the canonical form before the host validates args.\n// Bash timeout is measured in seconds; timeoutMs is converted from milliseconds.\n// After executor.shellHangMs the await still resolves ok: true with a still-running\n// notice, pid, and live output path in details; background: true (alias\n// run_in_background) detaches immediately. The process keeps writing that file.\n// Extended near-miss repairs: find's name/filename/glob \u2192 pattern, write's\n// data \u2192 content, ls's folder \u2192 path, bash's script \u2192 command; numeric option\n// fields (limit/offset/context/timeout) also accept numeric strings, coerced\n// at runtime (2322 diagnostics are suppressed by the type-checker by design).\n// String-primary tools also take a two-arg (primary, options) form \u2014\n// pi.read(\"index.ts\", { limit: 120 }) merges to { path, ...options } at\n// runtime, the positional string winning the primary field on conflict.\n// shell/edit/write envelopes are proxy-guarded so string-method access\n// (.trim(), .split(), iteration) fails with an actionable TypeError pointing\n// at .output instead of QuickJS's context-free \"not a function\" \u2014 property-\n// miss (2339) checks are suppressed by design, so the runtime gives the hint.\ntype PiPathArgument = {\n path?: string;\n file?: string;\n absolutePath?: string;\n file_path?: string;\n filePath?: string;\n filepath?: string;\n pathname?: string;\n target_file?: string;\n targetFile?: string;\n absolute_path?: string;\n fileAbsolutePath?: string;\n};\ntype PiOptionalPathArgument = {\n path?: string;\n file?: string;\n absolutePath?: string;\n file_path?: string;\n filePath?: string;\n filepath?: string;\n pathname?: string;\n target_file?: string;\n targetFile?: string;\n absolute_path?: string;\n fileAbsolutePath?: string;\n dir?: string;\n folder?: string;\n directory?: string;\n directoryPath?: string;\n};\ntype PiOldTextArgument = {\n oldText?: string;\n old?: string;\n old_string?: string;\n oldString?: string;\n old_str?: string;\n oldStr?: string;\n from?: string;\n old_value?: string;\n old_text?: string;\n oldContent?: string;\n old_content?: string;\n};\ntype PiNewTextArgument = {\n newText?: string;\n new?: string;\n replacement?: string;\n new_string?: string;\n newString?: string;\n new_str?: string;\n newStr?: string;\n to?: string;\n new_value?: string;\n new_text?: string;\n newContent?: string;\n new_content?: string;\n};\ntype PiEditOperation = PiOldTextArgument & PiNewTextArgument & { all?: boolean };\ntype PiCommandArgument = { command?: string; cmd?: string; shell?: string; cmdline?: string; script?: string; commandLine?: string };\ntype PiContentArgument = { content?: string; contents?: string; body?: string; text?: string; data?: string; fileContent?: string };\ntype PiGrepPatternArgument = { pattern?: string; query?: string; regex?: string; search?: string; q?: string; expression?: string; text?: string };\ntype PiFindPatternArgument = { pattern?: string; query?: string; regex?: string; search?: string; name?: string; filename?: string; glob?: string; expression?: string; include?: string };\n// Two-arg (primary, options) bags for the string-primary tools. Only option\n// aliases belong here (max/start/ctx/ic/...), never primary-field aliases \u2014\n// the primary field comes from the positional string.\ntype PiReadOptions = { offset?: number; limit?: number; start?: number; max?: number };\n// cwd is honored per call by the pi provider, which binds the command to a\n// shell definition rooted there; relative paths resolve from the session cwd.\n// The alias spellings mirror the shell entries in __piArgAliases: the\n// runtime repairs them, so the checker has to accept the same spellings or a\n// repairable call is rejected before it ever reaches the sandbox.\ntype PiShellOptions = {\n timeout?: number; timeoutMs?: number; settle?: boolean;\n background?: boolean; run_in_background?: boolean;\n description?: string;\n /** Opt-in line events; implies background. ui never wakes the model; wake may start an owning-agent turn. */\n monitor?: { delivery: \"ui\" | \"wake\"; timeoutMs?: number; intervalMs?: number; match?: string };\n cwd?: string; workdir?: string; directory?: string; workingDirectory?: string;\n};\ntype PiBashOptions = PiShellOptions & {\n /** Owned by an external jev-fabric store (macOS/Linux): keeps running if Pi exits and reattaches on resume. Implies background. */\n durable?: boolean;\n /** Durable only: on exit publish {kind ?? \"task.completed\", data:{taskId, exitCode, description?}}. */\n notify?: { topic: string; kind?: string };\n};\ntype PiPowerShellOptions = PiShellOptions;\ntype PiGrepOptions = { path?: string; glob?: string; globPattern?: string; ignoreCase?: boolean; ic?: boolean; caseInsensitive?: boolean; literal?: boolean; context?: number; ctx?: number; limit?: number; max?: number };\ntype PiFindOptions = { path?: string; limit?: number; max?: number };\ntype PiLsOptions = { limit?: number; max?: number };\ntype PiReadArgument = string | (PiPathArgument & PiReadOptions);\ntype PiBashArgument = string | (PiCommandArgument & PiBashOptions);\ntype PiPowerShellArgument = string | (PiCommandArgument & PiPowerShellOptions);\ntype PiEditFlatArgument = PiPathArgument & PiOldTextArgument & PiNewTextArgument & { all?: boolean };\ntype PiEditArgument = PiPathArgument & ({ edits: PiEditOperation[]; all?: boolean } | PiEditFlatArgument);\ntype PiWriteArgument = string | (PiPathArgument & PiContentArgument);\ntype PiGrepArgument = string | (PiGrepPatternArgument & PiGrepOptions);\ntype PiFindArgument = string | (PiFindPatternArgument & PiFindOptions);\ntype PiLsArgument = string | (PiOptionalPathArgument & PiLsOptions);\ntype PiNumericString<T> = T extends number ? T | string : T;\ntype PiNumericStringOptions<T> = { [K in keyof T]: PiNumericString<T[K]> };\ntype PiReadCompatibilityArgument = string | (PiPathArgument & PiNumericStringOptions<PiReadOptions>);\ntype PiBashCompatibilityArgument = string | (PiCommandArgument & PiNumericStringOptions<PiBashOptions>);\ntype PiPowerShellCompatibilityArgument = string | (PiCommandArgument & PiNumericStringOptions<PiPowerShellOptions>);\ntype PiEditCompatibilityArgument = PiEditFlatArgument;\ntype PiWriteCompatibilityArgument = PiWriteArgument;\ntype PiGrepCompatibilityArgument = string | (PiGrepPatternArgument & PiNumericStringOptions<PiGrepOptions>);\ntype PiFindCompatibilityArgument = string | (PiFindPatternArgument & PiNumericStringOptions<PiFindOptions>);\ntype PiLsCompatibilityArgument = string | (PiOptionalPathArgument & PiNumericStringOptions<PiLsOptions>);\ninterface PiToolsApi {\n read(args: PiReadArgument, options?: PiReadOptions): Promise<string>;\n bash(args: PiBashArgument, options?: PiBashOptions): Promise<{ ok: true; output: string; details: unknown } | { ok: false; output: string; details: null; exitCode: number; error: string }>;\n powershell(args: PiPowerShellArgument, options?: PiPowerShellOptions): Promise<{ ok: true; output: string; details: unknown } | { ok: false; output: string; details: null; exitCode: number; error: string }>;\n edit(args: PiEditArgument): Promise<{ ok: true; output: string; details: unknown }>;\n edit(path: string, oldText: string, newText: string): Promise<{ ok: true; output: string; details: unknown }>;\n write(args: PiWriteArgument): Promise<{ ok: true; output: string; details: unknown }>;\n write(path: string, content: string): Promise<{ ok: true; output: string; details: unknown }>;\n grep(args: PiGrepArgument): Promise<string>;\n grep(pattern: string, path?: string | PiGrepOptions, limit?: number): Promise<string>;\n find(args: PiFindArgument): Promise<string>;\n find(pattern: string, path?: string | PiFindOptions, limit?: number): Promise<string>;\n ls(args?: PiLsArgument, options?: PiLsOptions): Promise<string>;\n}\ntype FabricActorHostEvent =\n | \"resources_discover\"\n | \"session_start\"\n | \"session_info_changed\"\n | \"session_before_switch\"\n | \"session_before_fork\"\n | \"session_before_compact\"\n | \"session_compact\"\n | \"session_shutdown\"\n | \"session_before_tree\"\n | \"session_tree\"\n | \"input\"\n | \"before_agent_start\"\n | \"agent_start\"\n | \"agent_end\"\n | \"agent_settled\"\n | \"turn_start\"\n | \"turn_end\"\n | \"message_start\"\n | \"message_update\"\n | \"message_end\"\n | \"context\"\n | \"before_provider_headers\"\n | \"before_provider_request\"\n | \"after_provider_response\"\n | \"tool_execution_start\"\n | \"tool_call\"\n | \"tool_execution_update\"\n | \"tool_result\"\n | \"tool_execution_end\"\n | \"model_select\"\n | \"thinking_level_select\"\n | \"user_bash\"\n | \"tool_error\";\ntype FabricActorDelivery = \"mailbox\" | \"steer\" | \"followUp\" | \"nextTurn\";\ninterface FabricActorHostMediaDescriptor {\n readonly type: \"image\";\n readonly mediaIndex: number;\n readonly mimeType: string;\n}\ninterface FabricActorHostSignal {\n readonly payload: unknown;\n readonly media?: readonly FabricActorHostMediaDescriptor[];\n readonly idle: boolean;\n readonly observedAt: number;\n}\ntype FabricActorActivation =\n | { readonly kind: \"hostEvent\"; readonly id: string; readonly source: string; readonly sequence: number; readonly createdAt: number; readonly event: FabricActorHostEvent; readonly mainRevision: number; readonly taskRevision: number; readonly signal?: FabricActorHostSignal }\n | { readonly kind: \"direct\"; readonly id: string; readonly source: string; readonly sequence: number; readonly createdAt: number }\n | { readonly kind: \"mesh\"; readonly id: string; readonly source: string; readonly sequence: number; readonly createdAt: number; readonly topic: string };\ninterface FabricActorValidityFacts {\n readonly activation: Readonly<FabricActorActivation>;\n readonly current: Readonly<{ latestActivationSequence: number; mainRevision: number; taskRevision: number; idle: boolean; now: number }>;\n}\ntype FabricActorValidityDecision = boolean | { valid: boolean; reason?: string };\ntype FabricActorBindingScope = \"session\" | \"project\";\ninterface FabricActorRunBinding { model?: string; thinking?: FabricThinking }\ntype FabricActorValidWhile = (facts: Readonly<FabricActorValidityFacts>) => FabricActorValidityDecision;\ninterface FabricActorRequestBase {\n /** Fixed at creation; ask/tell cannot change language. Global templates resolve inheritance on import. */\n kernel?: FabricKernel | \"inherit\";\n scope?: \"session\" | \"project\" | \"global\";\n name: string;\n instructions: string;\n events?: FabricActorHostEvent[];\n topics?: string[];\n responseMode?: \"text\" | \"directive\";\n coalesce?: boolean;\n runner?: FabricAgentRunner;\n model?: string;\n thinking?: FabricThinking;\n tools?: string[];\n transport?: FabricTransport;\n timeoutMs?: number;\n timeout_ms?: number;\n extensions?: boolean;\n requires?: Array<string | { ref: string; optional?: boolean }>;\n validWhile?: FabricActorValidWhile;\n residency?: FabricParticipantResidency;\n}\ntype FabricActorRequest = FabricActorRequestBase & (\n | { delivery?: \"mailbox\"; triggerTurn?: false }\n | { delivery: \"nextTurn\"; triggerTurn?: false }\n | { delivery: \"steer\" | \"followUp\"; triggerTurn: boolean }\n);\ninterface FabricActorInfo {\n kernel?: FabricKernel;\n pythonRuntime?: \"cpython\" | \"monty\";\n id: string;\n scope: \"session\" | \"project\";\n name: string;\n status: \"idle\" | \"queued\" | \"running\" | \"stopped\";\n runner: FabricAgentRunner;\n events: FabricActorHostEvent[];\n topics: string[];\n delivery: FabricActorDelivery;\n responseMode: \"text\" | \"directive\";\n triggerTurn: boolean;\n coalesce: boolean;\n model?: string;\n thinking?: FabricThinking;\n binding?: FabricActorRunBinding & { scope: \"session\"; sessionId: string; updatedAt?: number };\n projectDefaults?: FabricActorRunBinding & { scope: \"project\" };\n tools?: string[];\n timeoutMs?: number;\n extensions?: boolean;\n requirements?: Array<{ ref: string; optional?: boolean }>;\n capabilityDigest?: string;\n missingCapabilities?: string[];\n validWhile?: { version: 1; source: string };\n residency: FabricParticipantResidency;\n queued: number;\n messages: number;\n createdAt: number;\n updatedAt: number;\n lastRunId?: string;\n lastError?: string;\n sessionFile?: string;\n logDir?: string;\n}\ninterface FabricModelSwitchRequest {\n /** provider/id, a models.aliases name, or a search term; resolution tries aliases first, then exact matches, then the closest fuzzy match (recency from pi-model-sort breaks ties) against authenticated models. */\n model: string;\n /** Optional provider filter applied before matching (e.g. \"anthropic\"). */\n provider?: string;\n}\ninterface FabricModelSwitchResult {\n switched: boolean;\n /** Active model as provider/id after the call (unchanged when reason is \"already-active\"). */\n model: string;\n name?: string;\n /** Previously active provider/id when known. Absent for already-active results. */\n previous?: string;\n /** Set when the selector resolved through a configured models.aliases name. */\n alias?: string;\n /** How the selector resolved: the alias name, or one of closest/recent/latest for inexact picks. Absent for exact provider/id or bare-id matches. */\n via?: string;\n reason?: \"already-active\";\n}\ninterface FabricActorMessage {\n id: string;\n actorId: string;\n actorName: string;\n direction: \"in\" | \"out\";\n source: string;\n createdAt: number;\n text?: string;\n data?: unknown;\n action?: \"silent\" | \"message\" | \"stop\";\n runId?: string;\n error?: string;\n stale?: boolean;\n reason?: string;\n}\n// agentId/agent_id spellings repair to id during agent arg normalization.\ntype FabricAgentTargetArgs = { id: string; agentId?: string; agent_id?: string };\ninterface FabricAgentsApi {\n run(args: FabricAgentRequest): Promise<FabricAgentResult>;\n /** Hosted capability only; resumes a paused direct child without exposing its checkpoint. */\n resume(args: FabricAgentTargetArgs & { task?: string }): Promise<FabricAgentResult>;\n handoff(args: FabricHandoffRequest): Promise<FabricHandoffResult>;\n spawn(args: FabricAgentRequest): Promise<FabricAgentHandle>;\n wait(args: FabricAgentTargetArgs): Promise<FabricAgentResult>;\n /** Alias for wait. */\n join(args: FabricAgentTargetArgs): Promise<FabricAgentResult>;\n status(args: FabricAgentTargetArgs): Promise<FabricAgentResult | FabricAgentHandle | FabricMainAgentInfo | FabricActorInfo | FabricParticipantInfo>;\n list(args?: { scope?: FabricParticipantScope }): Promise<Array<FabricAgentResult | FabricAgentHandle | FabricParticipantInfo>>;\n members(args?: { scope?: FabricParticipantScope; kinds?: FabricParticipantKind[]; includeStale?: boolean }): Promise<FabricParticipantInfo[]>;\n /** lineage mirrors PI_FABRIC_LINEAGE in child workers. */\n self(): Promise<FabricParticipantInfo & { lineage?: {\n version: 1; rootSessionId: string; parentSessionId?: string; parentRunId?: string;\n runId: string; depth: number; childIndex: number; worker: true;\n } }>;\n main(): Promise<FabricMainAgentInfo>;\n sessions(): Promise<FabricParticipantInfo[]>;\n peers(): Promise<FabricPeerInfo[]>;\n subscribe(args: {\n from: string;\n events: FabricLifecycleEventType[];\n to?: string;\n delivery: FabricLifecycleDelivery;\n triggerTurn: boolean;\n once?: boolean;\n }): Promise<FabricLifecycleSubscription>;\n subscriptions(args?: { from?: string; to?: string }): Promise<FabricLifecycleSubscription[]>;\n unsubscribe(args: FabricAgentTargetArgs): Promise<{ removed: boolean }>;\n models(args?: { runner?: FabricAgentRunner; refresh?: boolean }): Promise<FabricModelInfo[]>;\n stop(args: FabricAgentTargetArgs): Promise<FabricAgentResult | FabricActorInfo | FabricRemoteControlResult>;\n cleanup(args: FabricAgentTargetArgs & { deleteBranch?: boolean; delete_branch?: boolean }): Promise<{ cleaned: boolean }>;\n create(args: FabricActorRequest): Promise<FabricActorInfo>;\n setModel(args: { id: string; model?: string; scope?: FabricActorBindingScope }): Promise<FabricActorInfo>;\n switchModel(args: FabricModelSwitchRequest): Promise<FabricModelSwitchResult>;\n setThinking(args: { id: string; thinking?: FabricThinking; scope?: FabricActorBindingScope }): Promise<FabricActorInfo>;\n setTools(args: { id: string; tools: string[]; scope?: \"project\" | \"global\" }): Promise<FabricActorInfo>;\n setEvents(args: { id: string; events: FabricActorHostEvent[] }): Promise<FabricActorInfo>;\n setDeliveryPolicy(args: {\n id: string;\n delivery: FabricActorDelivery;\n triggerTurn: boolean;\n scope?: \"project\" | \"global\";\n }): Promise<FabricActorInfo>;\n setInstructions(args: {\n id: string;\n instructions: string;\n scope?: \"project\" | \"global\";\n }): Promise<FabricActorInfo>;\n ask(args: { id: string; message: string; data?: unknown; model?: string; thinking?: FabricThinking }): Promise<FabricActorMessage>;\n tell(args: { id: string; message: string; data?: unknown; model?: string; thinking?: FabricThinking }): Promise<{ queued: true; messageId: string }>;\n steer(args: { id: string; message: string; data?: unknown }): Promise<{ queued: true; messageId: string; routed?: \"local\" | \"main\" | \"mesh\"; acknowledged?: boolean }>;\n followUp(args: { id: string; message: string; data?: unknown }): Promise<{ queued: true; messageId: string; routed?: \"local\" | \"main\" | \"mesh\"; acknowledged?: boolean }>;\n setSteeringMode(args: { id: string; mode: \"all\" | \"one-at-a-time\" }): Promise<{ queued: true; messageId: string }>;\n setFollowUpMode(args: { id: string; mode: \"all\" | \"one-at-a-time\" }): Promise<{ queued: true; messageId: string }>;\n /** Advisory compaction of a running Pi-runner child at its next safe turn boundary. */\n compact(args: { id: string; instructions?: string }): Promise<{ queued: true; messageId: string }>;\n actorStatus(args: FabricAgentTargetArgs): Promise<FabricActorInfo>;\n actors(): Promise<FabricActorInfo[]>;\n messages(args: { id: string; limit?: number }): Promise<FabricActorMessage[]>;\n remove(args: { id: string }): Promise<{ removed: boolean }>;\n /** Drop an actor's mailbox history without stopping the actor. */\n clearMessages(args: { id: string }): Promise<FabricActorInfo>;\n /** Stamp a global template into the current project as a fresh live actor with no inherited history. */\n \"import\"(args: { id?: string; name?: string; as?: string }): Promise<FabricActorInfo>;\n /** Export a live project actor's definition to the global registry as a project-independent template. */\n \"export\"(args: { id: string; overwrite?: boolean }): Promise<FabricActorRequest & { id: string; createdAt: number; updatedAt: number }>;\n log(args: {\n id: string;\n type?: \"session\" | \"run\" | \"all\";\n lines?: number;\n before?: number;\n runId?: string;\n }): Promise<FabricActorLog | FabricAgentLog>;\n}\ninterface FabricMcpResult {\n text: string;\n content: unknown[];\n structuredContent: unknown;\n}\ninterface FabricMcpTool {\n (args?: Record<string, unknown>): Promise<FabricMcpResult | unknown>;\n}\ninterface FabricMcpServer {\n [tool: string]: FabricMcpTool;\n}\n// Management verbs stay members of mcp even when the declare line below is\n// replaced by generated per-server declarations (see the dynamic option on\n// guestTypeDeclarations), so generated surfaces intersect with this type\n// rather than re-declaring them.\ninterface FabricMcpManagement {\n servers(): Promise<Array<{ name: string; description: string | null; transport: \"http\" | \"stdio\" }>>;\n reload(): Promise<{ servers: string[] }>;\n register(args: {\n name: string;\n description?: string;\n command?: string;\n args?: string[];\n cwd?: string;\n baseUrl?: string;\n headers?: Record<string, string>;\n env?: Record<string, string>;\n overwrite?: boolean;\n }): Promise<{ registered: string }>;\n call(args: { server: string; tool: string; args?: Record<string, unknown> }): Promise<unknown>;\n}\n// Loose static surface: any server/tool name compiles and argument shapes are\n// enforced at dispatch by the registry. With descriptor data available the\n// execution service replaces the declare-const-mcp line below with a\n// schema-typed rendering of the live cache (runtime/dynamic-guest-types.ts).\ntype FabricMcpApi = Record<string, FabricMcpServer> & FabricMcpManagement;\ninterface FabricCouncilRunOptions extends FabricAgentRequest {\n roles: string[];\n}\ninterface FabricCouncilApi {\n run(args: FabricCouncilRunOptions & { synthesize?: true }): Promise<FabricAgentResult>;\n run(args: FabricCouncilRunOptions & { synthesize: false }): Promise<FabricAgentResult[]>;\n}\ninterface FabricMeshIdentity {\n id: string;\n name: string;\n kind: \"main\" | \"actor\" | \"agent\";\n sessionId?: string;\n}\ninterface FabricMeshEvent {\n id: string;\n sequence: number;\n topic: string;\n kind: string;\n from: FabricMeshIdentity;\n to?: string;\n text?: string;\n data?: unknown;\n createdAt: number;\n /** External grant post: untrusted data. */\n origin?: \"external\"; untrusted?: true; grantId?: string;\n scheduled?: { dueAt: number; key?: string };\n /** Host-stamped publisher authority: unscoped \"host\" or a scope principal. */\n sender?: { authority: \"host\" } | { authority: \"scope\"; principalId: string; digest: string };\n}\ntype FabricMeshSchedule = Omit<FabricMeshEvent, \"sequence\" | \"origin\" | \"untrusted\" | \"grantId\" | \"scheduled\"> & { key?: string; dueAt: number };\ninterface FabricMeshGrant { grantId: string; topic: string; kind?: string; createdAt: number; expiresAt: number; uses: number; maxUses: number; createdBy: FabricMeshIdentity }\ninterface FabricMeshStateEntry<T = unknown> {\n key: string;\n value: T;\n version: number;\n updatedAt: number;\n updatedBy: FabricMeshIdentity;\n}\ninterface FabricMeshApi {\n self(): Promise<FabricMeshIdentity>;\n publish(args: { topic: string; kind?: string; to?: string; text?: string; data?: unknown; message?: string; body?: string }): Promise<FabricMeshEvent>;\n /** Schedules instead: notBefore (epoch ms/ISO) or afterMs, \u2264366 days; key replaces. */\n publish(args: { topic: string; kind?: string; to?: string; text?: string; data?: unknown; notBefore?: number | string; afterMs?: number; key?: string }): Promise<FabricMeshSchedule & { scheduled: true }>;\n scheduled(args?: { topic?: string; limit?: number }): Promise<FabricMeshSchedule[]>;\n unschedule(args: { key: string }): Promise<{ removed: boolean }>;\n /** External post token, shown once. ttlMs 1 min..30 days; uses 1..10000, default 1. */\n grant(args: { topic: string; ttlMs: number; uses?: number; kind?: string }): Promise<FabricMeshGrant & { token: string; command: string }>;\n revoke(args: { grantId: string }): Promise<{ revoked: boolean }>;\n grants(): Promise<FabricMeshGrant[]>;\n read(args?: { after?: number; topic?: string; to?: string; limit?: number; max?: number }): Promise<FabricMeshEvent[]>;\n members(args?: { scope?: FabricParticipantScope; kinds?: FabricParticipantKind[]; includeStale?: boolean; limit?: number; max?: number; include_stale?: boolean }): Promise<FabricParticipantInfo[]>;\n get<T = unknown>(args: { key: string }): Promise<FabricMeshStateEntry<T> | null>;\n list<T = unknown>(args?: { prefix?: string; limit?: number; max?: number }): Promise<Array<FabricMeshStateEntry<T>>>;\n put<T = unknown>(args: { key: string; value: T; ifVersion?: number; if_version?: number; version?: number }): Promise<FabricMeshStateEntry<T>>;\n delete(args: { key: string; ifVersion?: number; if_version?: number; version?: number }): Promise<{ deleted: boolean; version?: number }>;\n}\n// Stable-provider argument bags declare the canonical keys plus the\n// near-miss spellings repaired during argument normalization\n// (providers/arg-normalization.ts and each provider's per-action table). The\n// registry's prepare stage repairs aliases before schema validation, so a\n// call spelled with an alias typechecks instead of tripping the\n// excess-property check; the canonical key wins on conflict, and anything\n// else fails additionalProperties:false validation with the offending\n// property path named. Keep these spillover fields in sync with the provider\n// normalization tables.\ntype FabricMemoryBranches = \"active\" | \"all\";\ntype FabricMemoryQueryMode = \"literal\" | \"phrase\" | \"regex\";\ntype FabricMemoryQueryMatch = \"all\" | \"any\";\ninterface FabricMemoryEntryRange {\n first: number;\n last: number;\n}\ninterface FabricMemoryRecallArgs {\n source?: string;\n query?: string;\n queryMode?: FabricMemoryQueryMode;\n queryMatch?: FabricMemoryQueryMatch;\n expectedSourceHash?: string;\n expectedLineageFingerprint?: string;\n branches?: FabricMemoryBranches;\n scope?: string;\n offset?: number;\n pageSize?: number;\n snippetChars?: number;\n role?: string;\n tool?: string;\n ref?: string;\n provider?: string;\n action?: string;\n outcome?: \"succeeded\" | \"failed\" | \"aborted\" | \"timed_out\";\n since?: number;\n until?: number;\n entryRange?: FabricMemoryEntryRange;\n q?: string;\n limit?: number;\n max?: number;\n page_size?: number;\n snippet_chars?: number;\n query_mode?: FabricMemoryQueryMode;\n query_match?: FabricMemoryQueryMatch;\n entry_range?: FabricMemoryEntryRange;\n}\ninterface FabricMemoryExpandArgs {\n source?: string;\n session: string;\n expectedSourceHash?: string;\n expectedLineageFingerprint?: string;\n branches?: FabricMemoryBranches;\n indices?: number[];\n entryIds?: string[];\n operationAddresses?: string[];\n entryRange?: FabricMemoryEntryRange;\n before?: number;\n after?: number;\n entryOffset?: number;\n textOffset?: number;\n maxChars?: number;\n maxEntries?: number;\n id?: string;\n file?: string;\n path?: string;\n session_id?: string;\n index?: number;\n entry_ids?: string[];\n operation_addresses?: string[];\n entry_range?: FabricMemoryEntryRange;\n entry_offset?: number;\n text_offset?: number;\n max_chars?: number;\n max_entries?: number;\n}\ninterface FabricMemoryCall<Ref extends string, Args> {\n ref: Ref;\n args: Args;\n}\ninterface FabricMemoryRecallEntryHit {\n kind: \"entry\";\n sessionId: string;\n tier: \"hot\" | \"cold\";\n index: number;\n entryId: string | null;\n parentId: string | null;\n operationAddress: string | null;\n type: string;\n role: string | null;\n tool: string | null;\n ref: string | null;\n provider: string | null;\n action: string | null;\n timestamp: number | null;\n isError: boolean;\n outcome?: \"succeeded\" | \"failed\" | \"aborted\" | \"timed_out\";\n score: number;\n snippet: string;\n truncated: boolean;\n follow: FabricMemoryCall<\"memory.expand\", FabricMemoryExpandArgs>;\n}\ninterface FabricMemoryRecallSessionHit {\n kind: \"session\";\n sessionId: string;\n tier: \"cold\";\n cwd: string;\n lastTimestamp: number | null;\n score: number;\n matchedTerms: number;\n matchedStructuralEntries: number;\n follow: FabricMemoryCall<\"memory.recall\", FabricMemoryRecallArgs>;\n}\ntype FabricMemoryRecallHit = FabricMemoryRecallEntryHit | FabricMemoryRecallSessionHit;\ninterface FabricMemoryError {\n code: string;\n message: string;\n [key: string]: unknown;\n}\ninterface FabricMemoryCoverage {\n complete: boolean;\n indexedSessions: number;\n eligibleSessions: number;\n staleSessions: number;\n incompleteSessions: number;\n reasons: string[];\n error?: FabricMemoryError;\n}\ninterface FabricMemoryRecallResult {\n total: number;\n hits: FabricMemoryRecallHit[];\n next: FabricMemoryCall<\"memory.recall\", FabricMemoryRecallArgs> | null;\n coverage: FabricMemoryCoverage;\n error?: FabricMemoryError;\n}\ninterface FabricMemoryExpandedEntry {\n index: number;\n entryId: string | null;\n parentId: string | null;\n type: string | null;\n role: string | null;\n timestamp: number | null;\n isError: boolean;\n anchor?: boolean;\n text: string;\n textRange: { start: number; end: number; total: number; complete: boolean };\n parentEntryId?: string | null;\n operationAddress?: string | null;\n tool?: string | null;\n ref?: string | null;\n provider?: string | null;\n action?: string | null;\n outcome?: \"succeeded\" | \"failed\" | \"aborted\" | \"timed_out\";\n filesTouched?: Array<string | null>;\n operation?: unknown;\n branchFact?: unknown;\n structuredTruncated?: boolean;\n factAddress?: string | null;\n carrierEntryId?: string | null;\n carrierParentId?: string | null;\n carrierFromId?: string | null;\n}\ninterface FabricMemoryExpandResult {\n session?: string;\n sourceHash?: string;\n branches?: FabricMemoryBranches;\n lineageFingerprint?: string;\n entryCount?: number;\n entries: FabricMemoryExpandedEntry[];\n next?: FabricMemoryCall<\"memory.expand\", FabricMemoryExpandArgs> | null;\n error?: FabricMemoryError;\n}\ninterface FabricMemoryWalkResult {\n visited: number;\n stopped: boolean;\n error?: FabricMemoryError;\n}\ninterface FabricMemorySessionInfo {\n id: string;\n file: string;\n cwd: string;\n mtime: number;\n entryCount: number;\n tier: \"hot\" | \"cold\";\n branches: FabricMemoryBranches;\n lineageFingerprint: string | null;\n}\ninterface FabricMemoryApi {\n recall(args?: FabricMemoryRecallArgs): Promise<FabricMemoryRecallResult>;\n expand(args: FabricMemoryExpandArgs): Promise<FabricMemoryExpandResult>;\n walk(\n args: FabricMemoryExpandArgs,\n visitor: (\n entry: FabricMemoryExpandedEntry,\n index: number,\n ) => boolean | void | Promise<boolean | void>,\n ): Promise<FabricMemoryWalkResult>;\n sessions(args?: {\n source?: string;\n scope?: string;\n branches?: FabricMemoryBranches;\n limit?: number;\n max?: number;\n }): Promise<{\n scope?: string;\n branches?: FabricMemoryBranches;\n sessions?: FabricMemorySessionInfo[];\n error?: FabricMemoryError;\n }>;\n}\ninterface FabricStateTransitionArgs {\n label: string;\n from?: string;\n to: string;\n summary: string;\n evidence?: string[];\n tags?: string[];\n kind?: \"state\" | \"representation\";\n complexity?: { files: string[] };\n force?: boolean;\n name?: string;\n description?: string;\n}\ninterface FabricStateComplexityFile {\n file: string;\n supported: boolean;\n language?: string;\n current?: number;\n recorded?: number;\n delta?: number;\n recordedDelta?: number;\n}\ninterface FabricStateVerificationResult {\n certified: boolean;\n violated: boolean;\n certificationStatus: \"certified\" | \"failed\";\n results: unknown[];\n failures: unknown[];\n certificate?: unknown;\n reportingError?: string;\n evidenceDigest: string;\n resultDigest: string;\n binding?: Record<string, string>;\n observed?: { commit?: string; dirty?: boolean };\n requestedBy?: \"program\" | \"host\";\n}\ninterface FabricStateApi {\n transition(args: FabricStateTransitionArgs): Promise<{ event: FabricMeshEvent; head: unknown }>;\n get(): Promise<{\n head: unknown | null;\n goal: { check: string; description?: string } | null;\n complexity: { files: number; decisionPoints: number; lastNetDelta: number };\n certification: { current: unknown | null; recent: unknown[] };\n recentLabels: string[];\n }>;\n history(args?: { label?: string; limit?: number; includeArchived?: boolean; name?: string; max?: number }): Promise<{\n transitions: unknown[];\n labels: string[];\n certifications: unknown[];\n }>;\n complexity(args?: { files?: string[]; paths?: string[] }): Promise<{ files: FabricStateComplexityFile[]; netDelta: number }>;\n verify(args?: { labels?: string[]; includeArchived?: boolean; timeoutMs?: number; label?: string; binding?: Record<string, string> }): Promise<FabricStateVerificationResult>;\n goal(args: { check: string; description?: string; command?: string; cmd?: string; predicate?: string }): Promise<FabricMeshStateEntry<{ check: string; description?: string }>>;\n checkGoal(args?: { timeoutMs?: number }): Promise<{\n passed: boolean;\n output: string;\n exitCode: number | null;\n error?: string;\n }>;\n}\ntype FabricSchemaEvidence =\n | { kind: \"file_exists\"; path: string }\n | { kind: \"file_absent\"; path: string }\n | { kind: \"file_contains\"; path: string; literal: string }\n | { kind: \"file_sha256\"; path: string; sha256: string }\n | { kind: \"trusted_command\"; name: string };\ntype FabricSchemaFileOperation =\n | { kind: \"write\"; path: string; content: string; expected: { absent: true } | { sha256: string } }\n | { kind: \"edit\"; path: string; oldText: string; newText: string; expectedSha256: string }\n | { kind: \"delete\"; path: string; expectedSha256: string };\ninterface FabricSchemaEvidenceResult {\n evidence: FabricSchemaEvidence;\n status: \"confirmed\" | \"nonconfirmed\" | \"error\";\n detail: string;\n exitCode?: number | null;\n output?: string;\n observedSha256?: string;\n}\ninterface FabricSchemaStatus {\n mode: \"off\" | \"audit\" | \"enforce\";\n certificateTtlMs: number;\n maxFiles: number;\n maxBytes: number;\n trustedCommands: string[];\n generation: number;\n lastOutcome: \"committed\" | \"rolled_back\" | \"quarantined\" | null;\n hypotheses: Array<{\n id: string;\n label: string;\n status: string;\n generation: number;\n updatedAt: number;\n }>;\n}\ninterface FabricSchemaVerificationResult {\n verified: boolean;\n hypothesisId: string;\n certificate?: string;\n issuedAt?: number;\n expiresAt?: number;\n reason?: string;\n results: FabricSchemaEvidenceResult[];\n}\ninterface FabricSchemaCommitResult {\n outcome: \"committed\" | \"rolled_back\" | \"quarantined\";\n transactionId: string;\n generation?: number;\n paths?: string[];\n postconditions?: FabricSchemaEvidenceResult[];\n complexityReductionCertified?: boolean;\n stateTransition?: unknown;\n error?: string;\n rollbackError?: string;\n}\ninterface FabricSchemaApi {\n status(): Promise<FabricSchemaStatus>;\n hypothesize(args: {\n label: string;\n summary: string;\n evidence: FabricSchemaEvidence[];\n complexityReduction?: boolean;\n name?: string;\n description?: string;\n complexity_reduction?: boolean;\n }): Promise<{\n hypothesisId: string;\n status: string;\n state: unknown;\n fingerprint: string;\n generation: number;\n }>;\n verify(args: { hypothesisId: string; id?: string; hypothesis_id?: string }): Promise<FabricSchemaVerificationResult>;\n commit(args: {\n hypothesisId: string;\n certificate: string;\n operations: FabricSchemaFileOperation[];\n postconditions: FabricSchemaEvidence[];\n id?: string;\n hypothesis_id?: string;\n }): Promise<FabricSchemaCommitResult>;\n abort(args: { hypothesisId: string; certificate?: string; id?: string; hypothesis_id?: string }): Promise<{\n aborted: true;\n hypothesisId: string;\n }>;\n}\ninterface FabricCompactPendingIntent {\n reason?: string;\n instructions?: string;\n preserve?: string[];\n requestedBy: string;\n requestedAt: number;\n}\ntype FabricCompactionOwner = \"fabric\" | \"pi\" | \"external\" | \"none\";\ninterface FabricCompactLastCommit {\n at: number;\n requestedBy: string;\n status: \"committed\" | \"cancelled\" | \"failed\";\n summary?: string;\n tokensBefore?: number;\n estimatedTokensAfter?: number;\n error?: string;\n}\ntype FabricComponentState = \"waiting\" | \"loading\" | \"active\" | \"unloading\" | \"failed\" | \"quarantined\" | \"disposed\";\ninterface FabricComponentEffectInfo {\n label: string;\n kind: \"none\" | \"scoped\" | \"transactional\" | \"emission\";\n resources: string[];\n ordering: \"commutative\" | \"ordered\" | \"unknown\";\n}\ninterface FabricComponentEffectConflict {\n withComponent: string;\n resources: string[];\n reason: \"shared_resource\" | \"unknown_resource\";\n}\ninterface FabricComponentInfo {\n id: string;\n component: string;\n parentId?: string;\n state: FabricComponentState;\n guarantee: \"managed\" | \"revertible\";\n requirements: string[];\n provisions: string[];\n missing: string[];\n optionalMissing: string[];\n effects?: FabricComponentEffectInfo[];\n effectConflicts?: FabricComponentEffectConflict[];\n targetDigest?: string;\n error?: string;\n cleanupErrors?: string[];\n revision: number;\n createdAt: number;\n updatedAt: number;\n}\ninterface FabricComponentEntry {\n id: string;\n component: string;\n config?: unknown;\n disabled?: boolean;\n}\ninterface FabricComponentDefinitionInfo {\n name: string;\n description?: string;\n revision: number;\n configSchema?: Record<string, unknown>;\n requirements: string[];\n provisions: string[];\n}\ninterface FabricComponentConfigSource {\n scope: \"global\" | \"project\";\n path: string;\n trusted: boolean;\n present: boolean;\n selected: boolean;\n}\ninterface FabricComponentConfigurationInfo {\n sources: FabricComponentConfigSource[];\n warnings: string[];\n sessionOverrides: string[];\n removalPolicy: \"drain\";\n error?: string;\n}\ninterface FabricComponentChangeRequest {\n scope?: \"session\" | \"global\" | \"project\";\n entries?: FabricComponentEntry[];\n remove?: string[];\n reset?: string[];\n}\ninterface FabricComponentChangePlan {\n revision: string;\n request: Required<FabricComponentChangeRequest>;\n changes: Array<{ id: string; operation: \"add\" | \"replace\" | \"remove\"; component: string; requirements: string[]; provisions: string[] }>;\n warnings: string[];\n sources: FabricComponentConfigSource[];\n}\ninterface FabricComponentsApi {\n list(): Promise<{\n definitions: FabricComponentDefinitionInfo[];\n components: FabricComponentInfo[];\n configuration: FabricComponentConfigurationInfo;\n }>;\n describe(args: { component: string }): Promise<FabricComponentDefinitionInfo & { instances: FabricComponentInfo[] }>;\n plan(args: FabricComponentChangeRequest): Promise<FabricComponentChangePlan>;\n apply(args: FabricComponentChangeRequest & { expectedRevision: string }): Promise<{ components: FabricComponentInfo[]; configuration: FabricComponentConfigurationInfo; scope: \"session\" | \"global\" | \"project\" }>;\n reconcile(): Promise<{ components: FabricComponentInfo[]; configuration: FabricComponentConfigurationInfo }>;\n status(args: { id: string }): Promise<FabricComponentInfo>;\n graph(): Promise<{\n components: FabricComponentInfo[];\n edges: Array<{ from: string; to: string; ref: string; kind?: \"dependency\" | \"ownership\" }>;\n cycles: string[][];\n }>;\n reload(args?: { id?: string }): Promise<{ components: FabricComponentInfo[] }>;\n}\n\ninterface FabricCacheHoldOptions {\n target?: \"self\" | \"main\";\n durationMs: number;\n /** Currently unsupported: requesting this bound rejects acquisition. */\n maxRefreshes?: number;\n /** Currently unsupported: requesting this bound rejects acquisition. */\n maxCostUsd?: number;\n}\ninterface FabricCacheLease {\n id: string; scope: \"session\" | \"component\"; sessionId: string; model: string; expiresAt: number;\n}\ntype FabricCacheHoldResult = ({ status: \"held\" } & FabricCacheLease)\n | { status: \"unsupported\" | \"unavailable\"; reason: string };\ninterface FabricCacheSample {\n entryId: string; observedAt: number; input: number; cacheRead: number; cacheWrite: number;\n output: number; totalInput: number; cacheReadShare: number; reportedCostUsd: number | null;\n}\ninterface FabricCacheObservation {\n lastRequest: FabricCacheSample | null; lastRefresh: FabricCacheSample | null;\n maintenance: { requests: number; tokens: number; reportedCostUsd: number; unknownCostRequests: number; unknownTokenRequests: number };\n window: { entries: number; limit: number; truncated: boolean; stoppedAt: string | null };\n}\ninterface FabricCacheStatus {\n target: \"self\"; sessionId: string; model: string | null; supported: boolean; reason: string | null;\n limits: { durationMs: true; maxRefreshes: false; maxCostUsd: false };\n leases: FabricCacheLease[]; scheduled: null; cleanupError: string | null; observation: FabricCacheObservation;\n}\ninterface FabricCacheApi {\n status(args?: { target?: \"self\" | \"main\" }): Promise<FabricCacheStatus>;\n hold(args: FabricCacheHoldOptions): Promise<FabricCacheHoldResult>;\n release(args: { id: string }): Promise<{ released: boolean; cleanupError: string | null }>;\n}\n\ninterface FabricThinkingBounds { min?: FabricThinking; max?: FabricThinking }\ninterface FabricThinkingOverride {\n level: FabricThinking;\n scope: \"turn\" | \"turns\" | \"session\";\n remainingTurns?: number;\n reason?: string;\n setAt: number;\n}\ninterface FabricThinkingStatus {\n level: FabricThinking;\n available: FabricThinking[];\n bounds: { min: FabricThinking; max: FabricThinking };\n baseline: FabricThinking;\n override?: FabricThinkingOverride;\n}\ninterface FabricThinkingApi {\n status(): Promise<FabricThinkingStatus>;\n set(args: { level: FabricThinking; scope?: \"turn\" | \"turns\" | \"session\"; turns?: number; reason?: string }): Promise<FabricThinkingStatus & { clamped?: true; requested?: FabricThinking }>;\n reset(): Promise<FabricThinkingStatus>;\n}\n\ninterface FabricDecision {\n id: string; kind: \"approval\" | \"question\" | \"escalation\"; title: string; body?: string;\n options?: Array<{ id: string; label: string }>; input: \"text\" | \"confirm\" | \"select\" | \"editor\";\n raisedBy: { participantId: string; runId?: string; sessionId?: string };\n holder: string; createdAt: number; deadline?: number; onExpire: \"cancel\" | \"default\" | \"escalate\"; defaultOptionId?: string;\n escalation?: { chain: string[]; hop: number; hopTimeoutMs: number; onFinal: \"cancel\" | \"default\" };\n history?: Array<{ holder: string; until: number; reason: \"expired\" | \"escalated\"; text?: string; by?: string }>;\n status: \"open\" | \"answered\" | \"expired\" | \"cancelled\";\n answer?: { optionId?: string; text?: string; answeredBy: string; via: string; at: number };\n}\ninterface FabricDecisionsApi {\n raise(args: { title: string; kind?: FabricDecision[\"kind\"]; body?: string; options?: Array<{ id: string; label: string }>; input?: FabricDecision[\"input\"]; holder?: string; deadline?: number; timeoutMs?: number; onExpire?: \"cancel\" | \"default\" | \"escalate\"; defaultOptionId?: string; escalation?: { chain?: string[]; hopTimeoutMs?: number; onFinal?: \"cancel\" | \"default\" } }): Promise<{ id: string }>;\n wait(args: { id: string; timeoutMs?: number }): Promise<FabricDecision>;\n list(args?: { status?: FabricDecision[\"status\"]; holder?: string; limit?: number }): Promise<FabricDecision[]>;\n answer(args: { id: string; optionId?: string; text?: string }): Promise<FabricDecision>;\n escalate(args: { id: string; reason?: string }): Promise<FabricDecision>;\n cancel(args: { id: string }): Promise<FabricDecision>;\n}\n\ntype FabricProgramStatus = \"candidate\" | \"promoted\" | \"retired\";\ninterface FabricProgramSummary {\n /** name@digest12 */\n ref: string; name: string; digest: string; kind: \"fabric\" | \"jev\"; kernel?: \"typescript\" | \"python\";\n description?: string; createdAt: number; status: FabricProgramStatus;\n}\ninterface FabricProgramRecord extends FabricProgramSummary {\n version: 1; code?: string; jevProgram?: Record<string, unknown>; inputSchema?: Record<string, unknown>; trial?: unknown;\n}\ninterface FabricProgramsApi {\n /** Always saved as a candidate; identical content returns the same ref. */\n save(args: { name: string; kind?: \"fabric\" | \"jev\"; kernel?: \"typescript\" | \"python\"; code?: string; jevProgram?: Record<string, unknown>; description?: string; inputSchema?: Record<string, unknown> }): Promise<{ ref: string; digest: string }>;\n list(args?: { name?: string; status?: FabricProgramStatus }): Promise<FabricProgramSummary[]>;\n /** ref: name (latest promoted, else latest candidate), name@<digest prefix >= 12>, or a full digest. */\n get(args: { ref: string }): Promise<FabricProgramRecord>;\n /** Runs nested with this program's capabilities; args.input becomes the saved program's input global. */\n run<T = unknown>(args: { ref: string; input?: unknown; requirePromoted?: boolean }): Promise<T>;\n}\n\ninterface FabricCompactApi {\n request(args?: {\n reason?: string;\n instructions?: string;\n preserve?: string[];\n requestedBy?: string;\n instruction?: string;\n requested_by?: string;\n }): Promise<{ requested: true; intent: FabricCompactPendingIntent }>;\n status(): Promise<{\n pending?: FabricCompactPendingIntent;\n last?: FabricCompactLastCommit;\n lastAuto?: { at: number; trigger: \"headroom\" | \"tokens\" | \"ratio\"; committed: boolean };\n owner: FabricCompactionOwner;\n outputReserveTokens: number;\n }>;\n /** Read-only context pressure; never compacts. */\n pressure(): Promise<{\n tokens: number | null;\n contextWindow: number | null;\n fraction: number | null;\n headroomTokens: number | null;\n band: \"ok\" | \"warn\" | \"urgent\" | \"unknown\";\n outputReserveTokens: number;\n thresholdFraction?: number;\n thresholdTokens?: number;\n owner: FabricCompactionOwner;\n }>;\n /** Persistent carry-forward focus rendered in every Fabric summary until cleared; no args reads. */\n carry(args?: { items?: string[]; add?: string[]; remove?: string[]; clear?: boolean }): Promise<{ items: string[] }>;\n cancel(): Promise<{ cancelled: true }>;\n}\n\ninterface FabricPrewalkFileIdentityStatus {\n path: string;\n loadedSha256: string;\n diskSha256: string;\n stale: boolean;\n}\ninterface FabricPrewalkApi {\n /** Only when Fabric's armed advisory or checkpoint requests an executor handoff plan.\n * Not a task planner, checklist, or acceptance-ledger store; unavailable otherwise. */\n plan(args: {\n outcome: string;\n steps: string[];\n verification: string[];\n risks: string;\n }): Promise<{ recorded: true; readiness: \"ready\"; plan: string }>;\n status(): Promise<{\n state: \"idle\" | \"armed\" | \"handing_off\" | \"continuation_pending\";\n planRequired: boolean;\n planReady: boolean;\n planPrompts: number;\n claimedReadiness: \"planned\" | \"disabled\" | \"unplanned\" | null;\n runtime?: {\n entry: FabricPrewalkFileIdentityStatus | null;\n lazyRuntime: FabricPrewalkFileIdentityStatus | null;\n };\n }>;\n}\n\ninterface FabricWorkflowAgentOptions extends Omit<FabricAgentRequest, \"task\"> {\n label?: string;\n}\ntype FabricActivityStatus = \"pending\" | \"running\" | \"completed\" | \"failed\" | \"blocked\" | \"stopped\";\ntype FabricActivityKind = \"agent\" | \"actor\" | \"tool\" | \"extension\" | \"mcp\" | \"mesh\" | \"task\" | \"custom\";\ninterface FabricWorkflowDisplay {\n name?: string;\n description?: string;\n}\ninterface FabricWorkflowPhaseOptions {\n id?: string;\n description?: string;\n total?: number;\n}\ninterface FabricWorkflowPhaseInput extends FabricWorkflowPhaseOptions {\n name: string;\n}\ninterface FabricWorkflowItem {\n /** Stable id, 1-128 chars of [A-Za-z0-9._:/-]; omitted ids become item-<n> per invocation. */\n id?: string;\n label: string;\n status?: FabricActivityStatus;\n phase?: string;\n detail?: string;\n kind?: FabricActivityKind;\n current?: string;\n total?: number;\n completed?: number;\n data?: unknown;\n /** Plain JSON object (<= 2 KiB) carried only on the host pi-fabric:workflow-item:v1 event. */\n meta?: Record<string, unknown>;\n}\ninterface FabricWorkflowApi {\n agent<T = string>(prompt: string, options?: FabricWorkflowAgentOptions): Promise<T>;\n parallel<T, R>(items: T[], mapper: (item: T, index: number) => Promise<R> | R, concurrency?: number | { concurrency?: number }): Promise<R[]>;\n parallel<T>(thunks: Array<() => Promise<T> | T>, concurrency?: number | { concurrency?: number }): Promise<T[]>;\n pipeline<T>(items: T[], ...stages: Array<(value: unknown, original: T, index: number) => Promise<unknown> | unknown>): Promise<unknown[]>;\n configure(display: FabricWorkflowDisplay): Promise<FabricWorkflowDisplay>;\n phase(name: string, options?: FabricWorkflowPhaseOptions): Promise<{ name: string; index: number; id?: string }>;\n phase(input: FabricWorkflowPhaseInput): Promise<{ name: string; index: number; id?: string }>;\n item(item: FabricWorkflowItem): Promise<FabricWorkflowItem>;\n event(event: { message: string; level?: \"info\" | \"success\" | \"warning\" | \"error\"; data?: unknown }): Promise<void>;\n log(...values: unknown[]): void;\n budget: { total: number; spent(): number; remaining(): number };\n}\ndeclare const tools: FabricToolsApi;\ndeclare const nativeTools: Record<string, (args?: Record<string, unknown>) => Promise<any>>;\ndeclare const fabric: { readonly tools: FabricToolsApi };\ndeclare const pi: PiToolsApi;\ndeclare const extensions: FabricExtensionsApi;\ndeclare const agents: FabricAgentsApi;\ndeclare const mesh: FabricMeshApi;\ndeclare const mcp: FabricMcpApi;\ndeclare const memory: FabricMemoryApi;\ndeclare const state: FabricStateApi;\ndeclare const schema: FabricSchemaApi;\ndeclare const components: FabricComponentsApi;\ndeclare const compact: FabricCompactApi;\ndeclare const cache: FabricCacheApi;\ndeclare const thinking: FabricThinkingApi;\ndeclare const decisions: FabricDecisionsApi;\ndeclare const programs: FabricProgramsApi;\ndeclare const prewalk: FabricPrewalkApi;\n${JEV_GUEST_DECLARATIONS}\ndeclare const council: FabricCouncilApi;\ndeclare const workflow: FabricWorkflowApi;\ndeclare function agent<T = string>(prompt: string, options?: FabricWorkflowAgentOptions): Promise<T>;\ndeclare function parallel<T, R>(items: T[], mapper: (item: T, index: number) => Promise<R> | R, concurrency?: number | { concurrency?: number }): Promise<R[]>;\ndeclare function parallel<T>(thunks: Array<() => Promise<T> | T>, concurrency?: number | { concurrency?: number }): Promise<T[]>;\ndeclare function pipeline<T>(items: T[], ...stages: Array<(value: unknown, original: T, index: number) => Promise<unknown> | unknown>): Promise<unknown[]>;\ndeclare function phase(name: string, options?: FabricWorkflowPhaseOptions): Promise<{ name: string; index: number; id?: string }>;\ndeclare function phase(input: FabricWorkflowPhaseInput): Promise<{ name: string; index: number; id?: string }>;\ndeclare function log(...values: unknown[]): void;\ndeclare const budget: FabricWorkflowApi[\"budget\"];\ntype FabricRlmRequest = Omit<FabricAgentRequest, \"runner\" | \"recursive\"> & { runner?: \"pi\" | \"pi-durable\" };\ndeclare const rlm: { query(args: FabricRlmRequest): Promise<FabricAgentResult> };\ninterface FabricConsole {\n log(...args: unknown[]): void;\n info(...args: unknown[]): void;\n warn(...args: unknown[]): void;\n error(...args: unknown[]): void;\n}\ndeclare const console: FabricConsole;\ndeclare const \u03C0: Readonly<Record<string, string>>;\n// Process runtimes only: node/bun children bridge native-module imports;\n// quickjs has no module loader and rejects __fabricImport at runtime.\ndeclare function __fabricImport(specifier: string): Promise<any>;\ndeclare function print(...args: unknown[]): void;\ndeclare function setTimeout(handler: (...args: any[]) => void, timeout?: number): number;\ndeclare function clearTimeout(handle: number): void;\ndeclare function setInterval(handler: (...args: any[]) => void, timeout?: number): number;\ndeclare function clearInterval(handle: number): void;\n// Process runtimes only: the bun-process child binds the host's real Bun\n// module namespace as __bun; undefined under node-process and quickjs.\ndeclare const __bun: any;\n`;\n\nconst FULL_CODE_GLOBAL_DECLARATIONS = [\n \"declare const pi: PiToolsApi;\\n\",\n \"declare const extensions: FabricExtensionsApi;\\n\",\n];\n\nconst PI_LOOSE_DECLARATION = \"declare const pi: PiToolsApi;\\n\";\nconst MCP_LOOSE_DECLARATION = \"declare const mcp: FabricMcpApi;\\n\";\nconst EXTENSIONS_LOOSE_DECLARATION = \"declare const extensions: FabricExtensionsApi;\\n\";\n\nexport interface FabricGuestDeclarationOptions {\n /** Global names to omit (for example providers disabled by configuration). */\n excludeGlobals?: readonly string[];\n /**\n * Pre-rendered replacement blocks from buildDynamicGuestDeclarations().\n * Applied only when the loose anchor line is still present \u2014 excluded\n * globals (or orchestration-only mode, for extensions) keep nothing to\n * replace, and missing/undefined sections keep the loose surface.\n */\n dynamic?: FabricDynamicGuestDeclarations;\n /**\n * Additive overloads for the current captured exact-name core overrides.\n * The block is applied only to the full-code `pi` declaration.\n */\n coreOverrides?: string;\n}\n\nconst globalDeclarationLine = (name: string): RegExp =>\n new RegExp(`^declare const ${name}: [^\\\\n]*;\\\\n`, \"m\");\n\nconst terminatedDeclaration = (block: string): string =>\n block.endsWith(\"\\n\") ? block : `${block}\\n`;\n\nexport const guestTypeDeclarations = (\n fullCodeMode: boolean,\n options: FabricGuestDeclarationOptions = {},\n): string => {\n const base = fullCodeMode\n ? GUEST_TYPE_DECLARATIONS\n : FULL_CODE_GLOBAL_DECLARATIONS.reduce(\n (declarations, declaration) => declarations.replace(declaration, \"\"),\n GUEST_TYPE_DECLARATIONS,\n );\n let result = (options.excludeGlobals ?? []).reduce(\n (declarations, name) => declarations.replace(globalDeclarationLine(name), \"\"),\n base,\n );\n if (fullCodeMode && options.coreOverrides && result.includes(PI_LOOSE_DECLARATION)) {\n result = result.replace(\n PI_LOOSE_DECLARATION,\n terminatedDeclaration(options.coreOverrides),\n );\n }\n if (options.dynamic?.mcp && result.includes(MCP_LOOSE_DECLARATION)) {\n result = result.replace(\n MCP_LOOSE_DECLARATION,\n terminatedDeclaration(options.dynamic.mcp),\n );\n }\n if (options.dynamic?.extensions && result.includes(EXTENSIONS_LOOSE_DECLARATION)) {\n result = result.replace(\n EXTENSIONS_LOOSE_DECLARATION,\n terminatedDeclaration(options.dynamic.extensions),\n );\n }\n return result;\n};\n"],
5
+ "mappings": ";AAAO,IAAM,wBAAwB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACA9B,IAAM,yBAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACU/B,IAAM,4CAA4C;AAAA,EACvD,MAAM;AAAA,EACN,MAAM;AAAA,EACN,YAAY;AAAA,EACZ,MAAM;AAAA,EACN,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AAAA,EACN,IAAI;AACN;AAEO,IAAM,yBAAyB;AAAA,EACpC,MAAM,CAAC,UAAU,OAAO;AAAA,EACxB,MAAM,CAAC,SAAS;AAAA,EAChB,YAAY,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AAC9B,IAAM,+BAA+B;AAmBrC,IAAM,wBAAwB,CAAC,SAC7B,IAAI,OAAO,kBAAkB,IAAI,iBAAiB,GAAG;AAEvD,IAAM,wBAAwB,CAAC,UAC7B,MAAM,SAAS,IAAI,IAAI,QAAQ,GAAG,KAAK;AAAA;AAElC,IAAM,wBAAwB,CACnC,cACA,UAAyC,CAAC,MAC/B;AACX,QAAM,OAAO,eACT,0BACA,8BAA8B;AAAA,IAC5B,CAAC,cAAc,gBAAgB,aAAa,QAAQ,aAAa,EAAE;AAAA,IACnE;AAAA,EACF;AACJ,MAAI,UAAU,QAAQ,kBAAkB,CAAC,GAAG;AAAA,IAC1C,CAAC,cAAc,SAAS,aAAa,QAAQ,sBAAsB,IAAI,GAAG,EAAE;AAAA,IAC5E;AAAA,EACF;AACA,MAAI,gBAAgB,QAAQ,iBAAiB,OAAO,SAAS,oBAAoB,GAAG;AAClF,aAAS,OAAO;AAAA,MACd;AAAA,MACA,sBAAsB,QAAQ,aAAa;AAAA,IAC7C;AAAA,EACF;AACA,MAAI,QAAQ,SAAS,OAAO,OAAO,SAAS,qBAAqB,GAAG;AAClE,aAAS,OAAO;AAAA,MACd;AAAA,MACA,sBAAsB,QAAQ,QAAQ,GAAG;AAAA,IAC3C;AAAA,EACF;AACA,MAAI,QAAQ,SAAS,cAAc,OAAO,SAAS,4BAA4B,GAAG;AAChF,aAAS,OAAO;AAAA,MACd;AAAA,MACA,sBAAsB,QAAQ,QAAQ,UAAU;AAAA,IAClD;AAAA,EACF;AACA,SAAO;AACT;",
6
+ "names": []
7
+ }
@@ -28,9 +28,6 @@ import {
28
28
  safeTerminalText,
29
29
  singleCallProgressLine
30
30
  } from "./chunk-U2UBUKNQ.js";
31
- import {
32
- FabricModelSelector
33
- } from "./chunk-J7ZQERKA.js";
34
31
  import {
35
32
  configureHighlighting,
36
33
  highlightCode,
@@ -41,6 +38,9 @@ import {
41
38
  isActiveStatus,
42
39
  orderAgentsByCreation
43
40
  } from "./chunk-UTOBAZ5T.js";
41
+ import {
42
+ FabricModelSelector
43
+ } from "./chunk-J7ZQERKA.js";
44
44
  import {
45
45
  buildModelSource
46
46
  } from "./chunk-CQFP2RCP.js";
@@ -107,19 +107,19 @@ import {
107
107
  readFabricPrewalkRequestV1,
108
108
  readFabricProviderWithdrawalV1,
109
109
  readFabricToolPlacementRequestV1
110
- } from "./chunk-YRDCJZZW.js";
110
+ } from "./chunk-RUO6L7RM.js";
111
111
  import {
112
112
  awaitPeerSettle,
113
113
  buildPeerCards,
114
114
  readChildToolAllowlist
115
115
  } from "./chunk-PYFJW3HC.js";
116
- import {
117
- resolveAgentDir
118
- } from "./chunk-PXAICAUT.js";
119
116
  import {
120
117
  closeScratch,
121
118
  createScratch
122
119
  } from "./chunk-5XBYFSI5.js";
120
+ import {
121
+ resolveAgentDir
122
+ } from "./chunk-PXAICAUT.js";
123
123
  import {
124
124
  DEFAULT_FABRIC_CONFIG,
125
125
  NO_FOREGROUND,
@@ -129,7 +129,7 @@ import {
129
129
  loadFabricConfigForScope,
130
130
  resolveForegroundTools,
131
131
  saveFabricConfig
132
- } from "./chunk-VON4TSO3.js";
132
+ } from "./chunk-CZPQTISQ.js";
133
133
  import {
134
134
  defaultCodePreviewSettings
135
135
  } from "./chunk-OKOHRXGF.js";
@@ -138,7 +138,7 @@ import {
138
138
  fabricExecTitleHintCached,
139
139
  normalizeRunDisplay,
140
140
  registerCompactionHook
141
- } from "./chunk-T5CU2GPZ.js";
141
+ } from "./chunk-I5ENWRUJ.js";
142
142
  import {
143
143
  fabricWriteBindings
144
144
  } from "./chunk-SZUXWOO7.js";
@@ -160,15 +160,15 @@ import {
160
160
  ApprovalController,
161
161
  FabricAutoApprovalClassifier,
162
162
  FabricSessionApprovals
163
- } from "./chunk-WYUV6WL3.js";
163
+ } from "./chunk-YKT5VLLQ.js";
164
164
  import {
165
165
  getActiveRepairCompiler,
166
166
  setActiveCompiledSurface
167
- } from "./chunk-QY7YK7M6.js";
167
+ } from "./chunk-VR2LV4CA.js";
168
168
  import {
169
169
  isFabricExecutionTraceV1,
170
170
  readFabricExecutionTraceV1
171
- } from "./chunk-ZXKYU6CH.js";
171
+ } from "./chunk-HCNHKJDA.js";
172
172
  import {
173
173
  PI_CORE_TOOL_NAMES,
174
174
  PI_CORE_TOOL_NAME_SET
@@ -2001,7 +2001,7 @@ Inspect LLM I/O: /fabric log ${shortId} \xB7 Export: /fabric export-log ${actor.
2001
2001
  }
2002
2002
 
2003
2003
  // src/agents/runner-notice.ts
2004
- var BUILT_IN_RUNNERS = ["pi", "claude", "veda"];
2004
+ var BUILT_IN_RUNNERS = ["pi", "pi-durable", "claude", "veda"];
2005
2005
  var editDistance = (left, right) => {
2006
2006
  const row = Array.from({ length: right.length + 1 }, (_, index) => index);
2007
2007
  for (let i = 1; i <= left.length; i += 1) {
@@ -2169,8 +2169,8 @@ ${sections.join("\n")}` : "";
2169
2169
  import { existsSync as existsSync2, readFileSync as readFileSync2 } from "node:fs";
2170
2170
  import * as path4 from "node:path";
2171
2171
  var SHELL_COMPOSITION_GUIDANCE = " tasks.read (byte offset/next, waitMs long-poll) and tasks.watch with {id, match} read or filter any background task without a monitor." + (process.platform === "win32" ? "" : " With jev-fabric (see tasks/sessions via tools.describe): pi.bash durable:true outlives Pi and reattaches on resume; sessions.open/write/read/stop drive interactive children (a Jev program's end with it).");
2172
- var fabricExecutionKernelGuidance = (fullCodeMode, kernel = "typescript", pythonRuntime = "monty") => [
2173
- kernel === "python" ? `Configured fabric_exec kernel: Python (${pythonRuntime === "monty" ? "Monty sandboxed subset" : "CPython"}). Write Python only in \`code\`: top-level await/return, dicts, True/False/None, and asyncio.gather. There is no per-call language switch.` : "Configured fabric_exec kernel: TypeScript. Write TypeScript only in `code`; top-level await and return are supported.",
2172
+ var fabricExecutionKernelGuidance = (fullCodeMode, kernel = "typescript", pythonRuntime = "monty", profile = "additive") => [
2173
+ kernel === "python" ? `Configured fabric_exec kernel: Python (${pythonRuntime === "monty" ? "Monty sandboxed subset" : "CPython"}). Write Python only in \`code\`: top-level await/return, dicts, True/False/None, and asyncio.gather. There is no per-call language switch.` : profile === "native" ? "Configured fabric_exec kernel: TypeScript with native Pi codemode API. Write JavaScript async function bodies; top-level await and return work. Native source is not type-checked or repaired." : "Configured fabric_exec kernel: TypeScript. Write TypeScript only in `code`; top-level await and return are supported.",
2174
2174
  "The configured kernel is exclusive for Fabric orchestration, including when skills or earlier messages show another language. Do not invoke another interpreter through shell tools or native subprocesses merely to run Fabric orchestration in a different language. Project builds, tests, and explicitly requested interpreter work remain legitimate shell commands.",
2175
2175
  fullCodeMode ? "Pi Fabric full code mode: `fabric_exec` is the only way to call Pi core tools \u2014 use them as `pi.*` inside `code`." : "Pi Fabric is in orchestration-only mode. Pi core and registered extension tools stay on their native direct execution path; inside fabric_exec, `pi.*` and `extensions.*` are unavailable.",
2176
2176
  // Files the model has not opened (images in particular) must be read before
@@ -2178,7 +2178,7 @@ var fabricExecutionKernelGuidance = (fullCodeMode, kernel = "typescript", python
2178
2178
  // caches stay warm.
2179
2179
  `Read every file the user provides (images, screenshots, code, text) with the ${fullCodeMode ? "`pi.read`" : "`read`"} tool before responding \u2014 never assume its contents.`
2180
2180
  ].join(" ");
2181
- 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. Detached results include details.taskId; completion notifies this session. Use tools.call(ref='tasks.list', args={}), tasks.get or tasks.stop with {'id': taskId}; pi.read can read the bounded log. Bounded controllers can await tasks.wait or tasks.watch (monitor batches, after cursor) without polling; timeout/cancellation affects only the observation. Opt-in monitor={'delivery':'wake','match':'literal','timeoutMs':300000,'intervalMs':5000} (choose delivery 'ui' or 'wake') also detaches: UI-only never wakes the agent, wake sends coalesced line events. Monitors expire and are not automatically renewed.` + SHELL_COMPOSITION_GUIDANCE + " 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. Detached results include `details.taskId`; completion notifies this session, without polling. Use `tools.call({ref:'tasks.list',args:{}})` or `tasks.get`/`tasks.stop` with `{id: taskId}`; `pi.read` can read the bounded log. Bounded controllers can await `tasks.wait` or `tasks.watch` (monitor batches, `after` cursor) without polling; timeout/cancellation affects only the observation. Opt-in `monitor:{delivery:'ui'|'wake',match:'literal',timeoutMs:300000,intervalMs:5000}` also detaches: UI-only never wakes the agent, wake sends coalesced line events. Monitors expire and are not automatically renewed." + SHELL_COMPOSITION_GUIDANCE + "\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.";
2181
+ var defaultFabricExecutionGuidance = (fullCodeMode, kernel = "typescript", pythonRuntime = "monty", profile = "additive") => kernel === "typescript" && profile === "native" ? "Native Pi codemode profile: tools.<name>(args) and nativeTools.<name>(args) use native results, including schema-backed error envelopes. searchTools/ALL_TOOLS return callable identifiers; describeTool returns a declaration string. image() emits images and saves host-side temporary artifacts. store/load share Pi codemode-store entries on this branch. Fabric discovery remains fabric.tools; pi.*, mcp.* and extensions.* keep Fabric result semantics. Policies and limits are unchanged. " + defaultFabricExecutionGuidance(fullCodeMode, kernel, pythonRuntime).replaceAll("tools.", "fabric.tools.").replaceAll("`tools`", "`fabric.tools`") : 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. Detached results include details.taskId; completion notifies this session. Use tools.call(ref='tasks.list', args={}), tasks.get or tasks.stop with {'id': taskId}; pi.read can read the bounded log. Bounded controllers can await tasks.wait or tasks.watch (monitor batches, after cursor) without polling; timeout/cancellation affects only the observation. Opt-in monitor={'delivery':'wake','match':'literal','timeoutMs':300000,'intervalMs':5000} (choose delivery 'ui' or 'wake') also detaches: UI-only never wakes the agent, wake sends coalesced line events. Monitors expire and are not automatically renewed.` + SHELL_COMPOSITION_GUIDANCE + " 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. Detached results include `details.taskId`; completion notifies this session, without polling. Use `tools.call({ref:'tasks.list',args:{}})` or `tasks.get`/`tasks.stop` with `{id: taskId}`; `pi.read` can read the bounded log. Bounded controllers can await `tasks.wait` or `tasks.watch` (monitor batches, `after` cursor) without polling; timeout/cancellation affects only the observation. Opt-in `monitor:{delivery:'ui'|'wake',match:'literal',timeoutMs:300000,intervalMs:5000}` also detaches: UI-only never wakes the agent, wake sends coalesced line events. Monitors expire and are not automatically renewed." + SHELL_COMPOSITION_GUIDANCE + "\n`tools` exposes discovery/generic calls (`providers`/`catalog`/`list`/`search`/`describe`/`call`) plus the native `models` namespace. `models === tools.models`; `tools.models()` retains legacy model listing. Use `await models.getAvailableOfType('classifier')` (or `'image'`), then `models.classify(model,{state,questions})` or `models.generateImages(model,{input})`. Check native `stopReason`/`errorMessage`; classifier yes/no questions use `type:'bool'` and return `probability`. 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.";
2182
2182
  var manifestNameCache = /* @__PURE__ */ new Map();
2183
2183
  var packageNameFromManifest = (startPath) => {
2184
2184
  if (!startPath) return void 0;
@@ -2201,7 +2201,7 @@ var packageNameFromManifest = (startPath) => {
2201
2201
  directory = parent;
2202
2202
  }
2203
2203
  };
2204
- var extensionToolRosterGuidance = (tools, coreToolNames) => {
2204
+ var extensionToolRosterGuidance = (tools, coreToolNames, nativeProfile = false) => {
2205
2205
  const extensionTools = tools.filter((tool) => !coreToolNames.has(tool.name));
2206
2206
  if (extensionTools.length === 0) return void 0;
2207
2207
  const namespaceLabel = (tool) => {
@@ -2223,7 +2223,7 @@ var extensionToolRosterGuidance = (tools, coreToolNames) => {
2223
2223
  else groups.set(label, [tool.name]);
2224
2224
  }
2225
2225
  return [
2226
- "Registered extension tools are callable inside fabric_exec as `extensions.<name>(args)`; run `tools.list` for full descriptions and schemas before re-implementing an effect with pi.bash.",
2226
+ `Registered extension tools are callable inside fabric_exec as \`extensions.<name>(args)\`; run \`${nativeProfile ? "fabric.tools" : "tools"}.list\` for full descriptions and schemas before re-implementing an effect with pi.bash.`,
2227
2227
  ...[...groups.entries()].sort(([left], [right]) => left.localeCompare(right)).map(([label, names]) => "- " + label + ": " + names.join(", "))
2228
2228
  ].join("\n");
2229
2229
  };
@@ -2472,6 +2472,9 @@ var OPTIONAL_FABRIC_EXEC_KEYS = [
2472
2472
  "tokenBudget",
2473
2473
  "agentBudget",
2474
2474
  "timeoutMs",
2475
+ "timeout_ms",
2476
+ "maxOutputTokens",
2477
+ "max_output_tokens",
2475
2478
  "display"
2476
2479
  ];
2477
2480
  var isRecord4 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
@@ -2504,7 +2507,7 @@ var normalizeFabricExecStrings = (input) => {
2504
2507
  };
2505
2508
  var resolveFabricExecPayloads = (params) => normalizeFabricExecStrings(params.payloads) ?? normalizeFabricExecStrings(params.strings);
2506
2509
  var prepareFabricExecArguments = (input, kernel = "typescript") => {
2507
- if (typeof input === "string") return { code: kernel === "python" ? input : repairFabricGuestCode(input) };
2510
+ if (typeof input === "string") return prepareFabricExecArguments({ code: input }, kernel);
2508
2511
  if (!isRecord4(input)) return input;
2509
2512
  let prepared = input;
2510
2513
  const writable = () => {
@@ -2518,6 +2521,24 @@ var prepareFabricExecArguments = (input, kernel = "typescript") => {
2518
2521
  const repaired = repairFabricGuestCode(prepared.code);
2519
2522
  if (repaired !== prepared.code) writable().code = repaired;
2520
2523
  }
2524
+ if (kernel === "typescript" && typeof prepared.code === "string") {
2525
+ const match = /^\s*\/\/\s*@options:\s*([^\r\n]*)/.exec(prepared.code);
2526
+ if (match) {
2527
+ const options = JSON.parse(match[1]);
2528
+ if (!isRecord4(options)) throw new Error("@options must be a JSON object");
2529
+ for (const [key, value] of Object.entries(options)) {
2530
+ if (key !== "timeout_ms" && key !== "max_output_tokens") throw new Error(`Unsupported @options key: ${key}`);
2531
+ if (!Number.isSafeInteger(value) || value < 1) throw new Error(`${key} must be a positive integer`);
2532
+ if (prepared[key] !== void 0 && prepared[key] !== value) throw new Error(`Conflicting ${key} options`);
2533
+ writable()[key] = value;
2534
+ }
2535
+ }
2536
+ }
2537
+ if (prepared.max_output_tokens != null) {
2538
+ if (prepared.maxOutputTokens != null && prepared.maxOutputTokens !== prepared.max_output_tokens) throw new Error("Conflicting maxOutputTokens and max_output_tokens");
2539
+ writable().maxOutputTokens = prepared.max_output_tokens;
2540
+ delete writable().max_output_tokens;
2541
+ }
2521
2542
  for (const key of OPTIONAL_FABRIC_EXEC_KEYS) {
2522
2543
  if (!Object.hasOwn(prepared, key)) continue;
2523
2544
  if (prepared[key] === null || prepared[key] === void 0) delete writable()[key];
@@ -2726,7 +2747,7 @@ var createFabricExecTool = (state, codePreviewSettings, pendingHandoffs, decorat
2726
2747
  );
2727
2748
  },
2728
2749
  label: "Fabric",
2729
- description: python ? monty ? "Execute Python through Fabric's configured Monty sandbox. Monty runs a Python subset with VM resource limits, no native filesystem/network/environment access, and only host-mediated tools. Each invocation starts fresh. This is the exclusive model tool path in full code mode and Schema enforce mode." : "Execute Python through Fabric\u2019s configured CPython kernel for Pi core tools, MCP, providers, discovery, and extensions. Each call uses a fresh process. Native execution is trusted code; Schema enforce requires OS isolation. This is the exclusive model tool path in full code mode and Schema enforce mode." : "Execute type-checked TypeScript through Fabric's configured executor for Pi core tools, MCP, Fabric providers, discovery, and extensions. QuickJS is isolated by default; the optional Node/Bun process is an unsafe trusted-code escape hatch. In full code mode, and always in Schema enforce mode, this is the exclusive model tool path.",
2750
+ description: python ? monty ? "Execute Python through Fabric's configured Monty sandbox. Monty runs a Python subset with VM resource limits, no native filesystem/network/environment access, and only host-mediated tools. Each invocation starts fresh. This is the exclusive model tool path in full code mode and Schema enforce mode." : "Execute Python through Fabric\u2019s configured CPython kernel for Pi core tools, MCP, providers, discovery, and extensions. Each call uses a fresh process. Native execution is trusted code; Schema enforce requires OS isolation. This is the exclusive model tool path in full code mode and Schema enforce mode." : "Execute code through Fabric's TypeScript kernel: type-checked TypeScript by default, unmodified JavaScript with executor.codemodeProfile native. Both support nativeTools; native mode places Pi-compatible calls on tools and Fabric discovery on fabric.tools. Compose Pi core tools, MCP, Fabric providers, discovery, and extensions. QuickJS is isolated by default; the optional Node/Bun process is an unsafe trusted-code escape hatch. In full code mode, and always in Schema enforce mode, this is the exclusive model tool path.",
2730
2751
  promptSnippet: "Pi core tools, MCP, Fabric providers, discovery, and extensions",
2731
2752
  promptGuidelines: [
2732
2753
  python ? "Batch independent operations in one `fabric_exec` Python program with `asyncio.gather`; await dependent/conditional steps sequentially. Coalesce independent replacements into one `await pi.edit(path=..., edits=[...])`. Return only the compact final JSON-compatible value." : "Batch independent operations in one `fabric_exec` program (`Promise.all` for parallel, sequential `await` for ordered), not one call per tool; keep dependent/conditional steps sequential. Coalesce non-dependent replacements from one file snapshot into one `pi.edit({path, edits:[...]})`; use `all:true` only for intentional repeated exact anchors. Return only the compact final value; intermediate results stay in the sandbox.",
@@ -2782,6 +2803,9 @@ var createFabricExecTool = (state, codePreviewSettings, pendingHandoffs, decorat
2782
2803
  description: "Optional whole-program deadline in ms for this invocation; raises (never lowers) the configured executor.timeoutMs, capped by executor.maxTimeoutMs"
2783
2804
  })
2784
2805
  ),
2806
+ timeout_ms: Type.Optional(Type.Integer({ minimum: 1, description: "Hard whole-script deadline in milliseconds; cannot be extended or paused, capped by executor.maxTimeoutMs." })),
2807
+ maxOutputTokens: Type.Optional(Type.Integer({ minimum: 1, description: "Per-call output token budget (estimated at four characters per token), capped by executor.maxOutputChars." })),
2808
+ max_output_tokens: Type.Optional(Type.Integer({ minimum: 1, description: "Alias of maxOutputTokens." })),
2785
2809
  display: Type.Optional(
2786
2810
  Type.Union([
2787
2811
  Type.Object(
@@ -2803,7 +2827,7 @@ var createFabricExecTool = (state, codePreviewSettings, pendingHandoffs, decorat
2803
2827
  })
2804
2828
  ])
2805
2829
  )
2806
- }),
2830
+ }, { additionalProperties: false }),
2807
2831
  // Pi validates custom-tool arguments before `tool_call` and `execute`, so
2808
2832
  // compatibility coercions for the model-facing boundary must live in the
2809
2833
  // official prepareArguments hook rather than execute-time fallbacks.
@@ -3320,6 +3344,7 @@ ${preview}` : ""}${hiddenHint}`,
3320
3344
  ...tokenBudget !== void 0 ? { tokenBudget } : {},
3321
3345
  ...params.agentBudget !== void 0 ? { maxAgentCalls: params.agentBudget } : {},
3322
3346
  ...params.timeoutMs !== void 0 ? { requestedTimeoutMs: params.timeoutMs } : {},
3347
+ ...params.timeout_ms !== void 0 ? { hardTimeoutMs: params.timeout_ms } : {},
3323
3348
  ...runDisplay ? {
3324
3349
  display: {
3325
3350
  ...runDisplay.name !== void 0 && { name: runDisplay.name },
@@ -3373,7 +3398,7 @@ ${preview}` : ""}${hiddenHint}`,
3373
3398
  if (repeat.warn) fullSections.push(fabricRepeatWarnText(repeat.count, FABRIC_REPEAT_BLOCK));
3374
3399
  const fullRawOutput = fullSections.join("\n\n");
3375
3400
  const outputBudget = modelOutputBudget(
3376
- state.config.executor.maxOutputChars,
3401
+ Math.min(state.config.executor.maxOutputChars, (params.maxOutputTokens ?? params.max_output_tokens ?? Infinity) * 4),
3377
3402
  result.success
3378
3403
  );
3379
3404
  const outputWillTruncate = fullRawOutput.length > outputBudget;
@@ -5234,6 +5259,15 @@ var FabricUiController = class {
5234
5259
  context.ui.notify(error instanceof Error ? error.message : String(error), "error");
5235
5260
  }
5236
5261
  };
5262
+ const onGlobalEvents = (globalActorId, events) => {
5263
+ try {
5264
+ this.state.globalActors.update(globalActorId, { events });
5265
+ context.ui.notify("Global actor event subscriptions updated", "info");
5266
+ this.#refresh();
5267
+ } catch (error) {
5268
+ context.ui.notify(error instanceof Error ? error.message : String(error), "error");
5269
+ }
5270
+ };
5237
5271
  const onActorTools = (actorId, tools) => {
5238
5272
  reportUpdate("Actor tools updated", this.state.actors.setTools(actorId, tools));
5239
5273
  };
@@ -5313,6 +5347,7 @@ var FabricUiController = class {
5313
5347
  onActorEvents,
5314
5348
  onActorDeliveryPolicy,
5315
5349
  onGlobalDeliveryPolicy,
5350
+ onGlobalEvents,
5316
5351
  onActorTools,
5317
5352
  actorDefaultTools: this.state.config.agents?.defaultTools ?? [],
5318
5353
  onClearMessages,
@@ -6281,6 +6316,34 @@ function createFabricExtension(entryUrl) {
6281
6316
  compactionYieldPending = true;
6282
6317
  }
6283
6318
  });
6319
+ let extractiveHistory;
6320
+ let extractiveEpoch = 0;
6321
+ const invalidateExtractive = (clear = false) => {
6322
+ extractiveEpoch++;
6323
+ extractiveHistory?.invalidate(clear);
6324
+ };
6325
+ const extractiveConfig = () => state.bootstrapped && state.config.memory.enabled ? state.config.memory.extractive : void 0;
6326
+ const unsubscribeExtractiveConfig = pi.events.on("pi-fabric:extractive-config-changed", () => invalidateExtractive(true));
6327
+ pi.on("session_start", () => invalidateExtractive(true));
6328
+ pi.on("session_tree", () => invalidateExtractive(true));
6329
+ pi.on("agent_end", () => invalidateExtractive());
6330
+ pi.on("session_shutdown", () => {
6331
+ invalidateExtractive(true);
6332
+ unsubscribeExtractiveConfig();
6333
+ });
6334
+ pi.on("before_agent_start", async (event, context) => {
6335
+ if (!extractiveConfig()?.enabled) {
6336
+ invalidateExtractive(true);
6337
+ return;
6338
+ }
6339
+ const epoch = ++extractiveEpoch;
6340
+ const sessionId = context.sessionManager.getSessionId();
6341
+ const leaf = context.sessionManager.getLeafId();
6342
+ const { ExtractiveHistory } = await import("../memory/extractive-history.js");
6343
+ if (epoch !== extractiveEpoch || !extractiveConfig()?.enabled || context.signal?.aborted || context.sessionManager.getSessionId() !== sessionId || context.sessionManager.getLeafId() !== leaf) return;
6344
+ extractiveHistory ??= new ExtractiveHistory(extractiveConfig);
6345
+ await extractiveHistory.prepare(context, event.prompt);
6346
+ });
6284
6347
  pi.on("context", async (event, context) => {
6285
6348
  const sessionId = context.sessionManager.getSessionId();
6286
6349
  const pendingContinuation = state.initialized ? state.prewalk.pendingContinuationMessage(sessionId) : void 0;
@@ -6321,6 +6384,21 @@ function createFabricExtension(entryUrl) {
6321
6384
  if (repaired.messages !== messages) return { messages: repaired.messages };
6322
6385
  return changed ? { messages } : void 0;
6323
6386
  });
6387
+ pi.on("context", (event, context) => {
6388
+ const customType = "fabric-extractive-history";
6389
+ const messages = event.messages.filter((message) => !(message.role === "custom" && message.customType === customType));
6390
+ if (!extractiveConfig()?.enabled) invalidateExtractive(true);
6391
+ const view = extractiveHistory?.view(context);
6392
+ if (!view) return messages.length !== event.messages.length ? { messages } : void 0;
6393
+ return { messages: [{
6394
+ role: "custom",
6395
+ customType,
6396
+ content: view.text,
6397
+ display: false,
6398
+ timestamp: 0,
6399
+ details: { advisory: true, ...view.usage ? { classifierUsage: view.usage } : {} }
6400
+ }, ...messages] };
6401
+ });
6324
6402
  pi.on("before_agent_start", async (event, context) => {
6325
6403
  const config = state.bootstrapped ? state.config : DEFAULT_FABRIC_CONFIG;
6326
6404
  const fullCodeMode = config.fullCodeMode;
@@ -6337,15 +6415,15 @@ function createFabricExtension(entryUrl) {
6337
6415
  target: process.env.PI_FABRIC_PARENT_RUN ? "participant" : "main",
6338
6416
  defaults: [{
6339
6417
  slot: FABRIC_EXECUTION_GUIDANCE_SLOT,
6340
- content: defaultFabricExecutionGuidance(effectiveFullCodeMode, config.executor.kernel, config.executor.pythonRuntime)
6418
+ content: defaultFabricExecutionGuidance(effectiveFullCodeMode, config.executor.kernel, config.executor.pythonRuntime, config.executor.codemodeProfile)
6341
6419
  }]
6342
6420
  });
6343
6421
  const overrideGuidance = effectiveFullCodeMode ? coreOverridePromptGuidance(capturedTools).trim() : void 0;
6344
6422
  const extensionRoster = effectiveFullCodeMode ? extensionToolRosterGuidance(capturedTools.list().filter(
6345
6423
  (entry) => !state.config.mcp.enabled || !isSelectedNativeMcpTool(entry.definition, state.config.mcp.nativeServers)
6346
- ), new Set(PI_CORE_TOOL_NAMES)) : void 0;
6424
+ ), new Set(PI_CORE_TOOL_NAMES), config.executor.kernel === "typescript" && config.executor.codemodeProfile === "native") : void 0;
6347
6425
  const guidance = [
6348
- fabricExecutionKernelGuidance(effectiveFullCodeMode, config.executor.kernel, config.executor.pythonRuntime),
6426
+ fabricExecutionKernelGuidance(effectiveFullCodeMode, config.executor.kernel, config.executor.pythonRuntime, config.executor.codemodeProfile),
6349
6427
  resolvedGuidance.slotText,
6350
6428
  fabricSchemaGuidance(schemaMode),
6351
6429
  overrideGuidance,
@@ -6487,4 +6565,4 @@ export {
6487
6565
  FABRIC_MANAGED_HOST_VERSION,
6488
6566
  createFabricExtension
6489
6567
  };
6490
- //# sourceMappingURL=chunk-EXWS4ZS3.js.map
6568
+ //# sourceMappingURL=chunk-ACGEYOXM.js.map