@e4779/pi-fabric 0.131.4-fork.33 → 0.138.1-fork.1

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 (435) hide show
  1. package/README.md +8 -0
  2. package/dist/actors/context.d.ts.map +1 -1
  3. package/dist/agents/clone-first-worktree.d.ts +2 -0
  4. package/dist/agents/clone-first-worktree.d.ts.map +1 -1
  5. package/dist/agents/completion-inbox.d.ts +2 -1
  6. package/dist/agents/completion-inbox.d.ts.map +1 -1
  7. package/dist/agents/handoff.d.ts.map +1 -1
  8. package/dist/agents/manager.d.ts.map +1 -1
  9. package/dist/agents/worktree-manager.d.ts +4 -1
  10. package/dist/agents/worktree-manager.d.ts.map +1 -1
  11. package/dist/agents/worktree-paths.d.ts +8 -3
  12. package/dist/agents/worktree-paths.d.ts.map +1 -1
  13. package/dist/agents.js +6 -1
  14. package/dist/agents.js.map +1 -1
  15. package/dist/async-settlement.d.ts +1 -1
  16. package/dist/async-settlement.d.ts.map +1 -1
  17. package/dist/audit/details.d.ts.map +1 -1
  18. package/dist/capture/catalog.d.ts +2 -0
  19. package/dist/capture/catalog.d.ts.map +1 -1
  20. package/dist/capture/interceptor.d.ts.map +1 -1
  21. package/dist/chunks/{chunk-7N7IC3Z2.js → chunk-2CD7HLVP.js} +3 -84
  22. package/dist/chunks/chunk-2CD7HLVP.js.map +7 -0
  23. package/dist/chunks/{chunk-7YNE4NB2.js → chunk-2MELFQCQ.js} +2 -2
  24. package/dist/chunks/{chunk-HSEZPCL5.js → chunk-2OC4YJOL.js} +3 -3
  25. package/dist/chunks/{chunk-TXCNZCZP.js → chunk-2QJ4MNS6.js} +2 -2
  26. package/dist/chunks/{chunk-F6A6MQ6G.js → chunk-2WPTD6BI.js} +11 -15
  27. package/dist/chunks/chunk-2WPTD6BI.js.map +7 -0
  28. package/dist/chunks/{chunk-QOEOKW2X.js → chunk-3QH6JAE3.js} +2 -2
  29. package/dist/chunks/chunk-4U47NCP2.js +88 -0
  30. package/dist/chunks/chunk-4U47NCP2.js.map +7 -0
  31. package/dist/chunks/{chunk-OJ4HAALD.js → chunk-5VZEAAHD.js} +10 -9
  32. package/dist/chunks/chunk-5VZEAAHD.js.map +7 -0
  33. package/dist/chunks/{chunk-LKYLD5SN.js → chunk-6HM4TX7L.js} +10 -8
  34. package/dist/chunks/chunk-6HM4TX7L.js.map +7 -0
  35. package/dist/chunks/{chunk-L6H46CPY.js → chunk-6NNL5LOG.js} +2 -2
  36. package/dist/chunks/{chunk-7TB7NXSL.js → chunk-7CIQQOOD.js} +11 -3
  37. package/dist/chunks/{chunk-7TB7NXSL.js.map → chunk-7CIQQOOD.js.map} +2 -2
  38. package/dist/chunks/{chunk-RWKQ5SRW.js → chunk-7ZFPVOV2.js} +2 -2
  39. package/dist/chunks/{chunk-PUBHBEYO.js → chunk-B2FIGOPI.js} +2 -2
  40. package/dist/chunks/{chunk-HRDMBGMY.js → chunk-BLT66VHH.js} +331 -22
  41. package/dist/chunks/chunk-BLT66VHH.js.map +7 -0
  42. package/dist/chunks/{chunk-4WKD3YM3.js → chunk-C3UPHOJW.js} +3 -3
  43. package/dist/chunks/{chunk-G2DZJ5LK.js → chunk-CB72SLHB.js} +451 -134
  44. package/dist/chunks/chunk-CB72SLHB.js.map +7 -0
  45. package/dist/chunks/{chunk-B5L3X3ID.js → chunk-CCJ6PUZJ.js} +1 -1
  46. package/dist/chunks/{chunk-B5L3X3ID.js.map → chunk-CCJ6PUZJ.js.map} +1 -1
  47. package/dist/chunks/{chunk-FK73YJKV.js → chunk-DWM63MAJ.js} +21 -9
  48. package/dist/chunks/chunk-DWM63MAJ.js.map +7 -0
  49. package/dist/chunks/{chunk-56NMRVTV.js → chunk-FFJ7TV66.js} +32 -29
  50. package/dist/chunks/chunk-FFJ7TV66.js.map +7 -0
  51. package/dist/chunks/{chunk-LRSZFYUC.js → chunk-FUMALXYQ.js} +15 -15
  52. package/dist/chunks/chunk-FUMALXYQ.js.map +7 -0
  53. package/dist/chunks/{chunk-TJZYM2SP.js → chunk-G3RQ3HUK.js} +8 -3
  54. package/dist/chunks/{chunk-TJZYM2SP.js.map → chunk-G3RQ3HUK.js.map} +2 -2
  55. package/dist/chunks/{chunk-RAA3FAYZ.js → chunk-GNPTDN6K.js} +2 -2
  56. package/dist/chunks/{chunk-XFOSUGLU.js → chunk-JCGEW5OQ.js} +5 -5
  57. package/dist/chunks/{chunk-CXYJJ3HZ.js → chunk-LJ2MG6U2.js} +3 -3
  58. package/dist/chunks/{chunk-3MOY6WIB.js → chunk-LRBDEAKB.js} +3 -3
  59. package/dist/chunks/{chunk-2RWNVCFD.js → chunk-MPFBOVOD.js} +1 -1
  60. package/dist/chunks/{chunk-2RWNVCFD.js.map → chunk-MPFBOVOD.js.map} +1 -1
  61. package/dist/chunks/{chunk-NQ7IWEIF.js → chunk-MQGRQMVM.js} +2 -2
  62. package/dist/chunks/{chunk-3VK6UGAN.js → chunk-O5SHIUIL.js} +6 -1
  63. package/dist/chunks/chunk-O5SHIUIL.js.map +7 -0
  64. package/dist/chunks/{chunk-U6Y6TKJL.js → chunk-OK2EKY3M.js} +15 -11
  65. package/dist/chunks/chunk-OK2EKY3M.js.map +7 -0
  66. package/dist/chunks/{chunk-DGUXJSYA.js → chunk-OR44GYXD.js} +70 -3
  67. package/dist/chunks/chunk-OR44GYXD.js.map +7 -0
  68. package/dist/chunks/{chunk-DGERP4VL.js → chunk-P4TALNLX.js} +11 -10
  69. package/dist/chunks/chunk-P4TALNLX.js.map +7 -0
  70. package/dist/chunks/{chunk-4BYS4ZLY.js → chunk-PHGPOSCP.js} +267 -71
  71. package/dist/chunks/chunk-PHGPOSCP.js.map +7 -0
  72. package/dist/chunks/{chunk-3XT5WHSG.js → chunk-QAGEWWCJ.js} +260 -59
  73. package/dist/chunks/chunk-QAGEWWCJ.js.map +7 -0
  74. package/dist/chunks/{chunk-WKFRGICG.js → chunk-RBYRHS24.js} +2 -2
  75. package/dist/chunks/{chunk-ZHROHNEE.js → chunk-RFNYH7S7.js} +8 -8
  76. package/dist/chunks/{chunk-VGRUWTMG.js → chunk-RPZJVLML.js} +472 -466
  77. package/dist/chunks/chunk-RPZJVLML.js.map +7 -0
  78. package/dist/chunks/{chunk-H57KPL3V.js → chunk-S2JWFXW5.js} +2 -2
  79. package/dist/chunks/{chunk-LZ2ZXOCU.js → chunk-SSB2JN3I.js} +168 -5
  80. package/dist/chunks/chunk-SSB2JN3I.js.map +7 -0
  81. package/dist/chunks/{chunk-RKJPBTBB.js → chunk-SVQ7ZHEQ.js} +33 -16
  82. package/dist/chunks/chunk-SVQ7ZHEQ.js.map +7 -0
  83. package/dist/chunks/{chunk-MPMEK3IQ.js → chunk-TV5NCPPS.js} +6 -5
  84. package/dist/chunks/chunk-TV5NCPPS.js.map +7 -0
  85. package/dist/chunks/{chunk-XOBLUZMB.js → chunk-UIVMSMSQ.js} +10 -1
  86. package/dist/chunks/chunk-UIVMSMSQ.js.map +7 -0
  87. package/dist/chunks/{chunk-QGTD3LAZ.js → chunk-UYS5VZUU.js} +9 -3
  88. package/dist/chunks/chunk-UYS5VZUU.js.map +7 -0
  89. package/dist/chunks/{chunk-HRVYXRWZ.js → chunk-V5RZK45W.js} +37 -3
  90. package/dist/chunks/chunk-V5RZK45W.js.map +7 -0
  91. package/dist/chunks/{chunk-KIFOEBYJ.js → chunk-VEXCD3RA.js} +2 -2
  92. package/dist/chunks/{chunk-GS67KDMV.js → chunk-VN7AE3EY.js} +2 -2
  93. package/dist/chunks/{chunk-HFDJWLMS.js → chunk-WFGJUVTH.js} +106 -65
  94. package/dist/chunks/chunk-WFGJUVTH.js.map +7 -0
  95. package/dist/chunks/chunk-WMULZZER.js +196 -0
  96. package/dist/chunks/chunk-WMULZZER.js.map +7 -0
  97. package/dist/chunks/{chunk-QNMQJNXE.js → chunk-X4HDI7RT.js} +14 -4
  98. package/dist/chunks/chunk-X4HDI7RT.js.map +7 -0
  99. package/dist/chunks/{chunk-MX53BRAC.js → chunk-XBAOTA4U.js} +2 -2
  100. package/dist/chunks/{chunk-MSDL7U6Q.js → chunk-XQCNVH3Y.js} +4 -4
  101. package/dist/chunks/{chunk-4PBW54I2.js → chunk-YC6NV7FK.js} +88 -54
  102. package/dist/chunks/chunk-YC6NV7FK.js.map +7 -0
  103. package/dist/chunks/{chunk-6GWDGTHC.js → chunk-YLO62DWD.js} +4 -4
  104. package/dist/cli/decisions.js +2 -2
  105. package/dist/cli/mesh.js +3 -3
  106. package/dist/commands/fabric-handler.d.ts.map +1 -1
  107. package/dist/commands/fabric-handler.js +18 -4
  108. package/dist/commands/fabric-handler.js.map +2 -2
  109. package/dist/commands/fabric.d.ts.map +1 -1
  110. package/dist/compaction/branch-summary.d.ts.map +1 -1
  111. package/dist/compaction/claim-events.js +9 -9
  112. package/dist/compaction/hook.d.ts.map +1 -1
  113. package/dist/compaction/hook.js +6 -6
  114. package/dist/compaction/normalize.d.ts +9 -0
  115. package/dist/compaction/normalize.d.ts.map +1 -1
  116. package/dist/compaction/owner.js +7 -7
  117. package/dist/compaction/projections.d.ts +18 -2
  118. package/dist/compaction/projections.d.ts.map +1 -1
  119. package/dist/compaction/qa.d.ts +3 -2
  120. package/dist/compaction/qa.d.ts.map +1 -1
  121. package/dist/compaction/render.d.ts +3 -0
  122. package/dist/compaction/render.d.ts.map +1 -1
  123. package/dist/compaction/threshold.d.ts.map +1 -1
  124. package/dist/compaction/user-activity.d.ts +31 -0
  125. package/dist/compaction/user-activity.d.ts.map +1 -0
  126. package/dist/components/configuration.js +4 -4
  127. package/dist/config.d.ts +13 -6
  128. package/dist/config.d.ts.map +1 -1
  129. package/dist/core/action-registry.d.ts +1 -1
  130. package/dist/core/action-registry.d.ts.map +1 -1
  131. package/dist/core/action-registry.js +10 -9
  132. package/dist/core/approval-controller.d.ts +3 -0
  133. package/dist/core/approval-controller.d.ts.map +1 -1
  134. package/dist/core/atomic-write.d.ts +1 -0
  135. package/dist/core/atomic-write.d.ts.map +1 -1
  136. package/dist/core/attached-monitors.d.ts +39 -0
  137. package/dist/core/attached-monitors.d.ts.map +1 -0
  138. package/dist/core/control-abort.d.ts +3 -0
  139. package/dist/core/control-abort.d.ts.map +1 -0
  140. package/dist/core/crash-guard.d.ts +15 -0
  141. package/dist/core/crash-guard.d.ts.map +1 -0
  142. package/dist/core/execution-guidelines.d.ts +6 -0
  143. package/dist/core/execution-guidelines.d.ts.map +1 -0
  144. package/dist/core/guidance-delivery.d.ts +19 -0
  145. package/dist/core/guidance-delivery.d.ts.map +1 -0
  146. package/dist/core/lifecycle-settlement.d.ts +9 -0
  147. package/dist/core/lifecycle-settlement.d.ts.map +1 -0
  148. package/dist/core/observation-actions.d.ts +9 -0
  149. package/dist/core/observation-actions.d.ts.map +1 -0
  150. package/dist/core/pasted-images.d.ts +12 -0
  151. package/dist/core/pasted-images.d.ts.map +1 -0
  152. package/dist/core/pasted-images.js +139 -0
  153. package/dist/core/pasted-images.js.map +7 -0
  154. package/dist/core/permission-queue.d.ts +32 -0
  155. package/dist/core/permission-queue.d.ts.map +1 -0
  156. package/dist/core/permission-queue.js +104 -0
  157. package/dist/core/permission-queue.js.map +7 -0
  158. package/dist/core/prompt-guidance.d.ts +1 -0
  159. package/dist/core/prompt-guidance.d.ts.map +1 -1
  160. package/dist/core/prompt-guidance.js +52 -3
  161. package/dist/core/prompt-guidance.js.map +3 -3
  162. package/dist/core/provider-operations.js +1 -1
  163. package/dist/core/shell-inbox.d.ts +1 -1
  164. package/dist/core/shell-inbox.d.ts.map +1 -1
  165. package/dist/core/shell-jobs.d.ts +28 -1
  166. package/dist/core/shell-jobs.d.ts.map +1 -1
  167. package/dist/core/shell-monitor.d.ts +1 -0
  168. package/dist/core/shell-monitor.d.ts.map +1 -1
  169. package/dist/durable/worker.js +0 -42
  170. package/dist/durable/worker.js.map +3 -3
  171. package/dist/durable-extension.d.ts +2 -2
  172. package/dist/durable-extension.d.ts.map +1 -1
  173. package/dist/durable-extension.js +215 -1
  174. package/dist/durable-extension.js.map +3 -3
  175. package/dist/entropy/index.d.ts +2 -0
  176. package/dist/entropy/index.d.ts.map +1 -1
  177. package/dist/entropy/index.js +23 -13
  178. package/dist/entropy/pool-store.d.ts +8 -1
  179. package/dist/entropy/pool-store.d.ts.map +1 -1
  180. package/dist/entropy/pool-worker.d.ts +18 -0
  181. package/dist/entropy/pool-worker.d.ts.map +1 -0
  182. package/dist/entropy/pool-writer.d.ts +23 -0
  183. package/dist/entropy/pool-writer.d.ts.map +1 -0
  184. package/dist/entropy/pool.d.ts +11 -0
  185. package/dist/entropy/pool.d.ts.map +1 -1
  186. package/dist/entropy/sessions.d.ts +5 -0
  187. package/dist/entropy/sessions.d.ts.map +1 -1
  188. package/dist/execution-service.d.ts.map +1 -1
  189. package/dist/extension-bootstrap.d.ts.map +1 -1
  190. package/dist/extension-bootstrap.js +19 -19
  191. package/dist/extension.d.ts.map +1 -1
  192. package/dist/fabric-exec-tool.d.ts.map +1 -1
  193. package/dist/fabric-runtime-state.d.ts.map +1 -1
  194. package/dist/fabric-runtime-state.js +534 -261
  195. package/dist/fabric-runtime-state.js.map +4 -4
  196. package/dist/fabric-state.d.ts.map +1 -1
  197. package/dist/index.js +40 -30
  198. package/dist/index.js.map +1 -1
  199. package/dist/jev/client.js +2 -2
  200. package/dist/jev/observation.js +7 -6
  201. package/dist/jev.js +12 -11
  202. package/dist/main-agent.d.ts.map +1 -1
  203. package/dist/managed-host.d.ts +4 -0
  204. package/dist/managed-host.d.ts.map +1 -1
  205. package/dist/memory/discovery.js +6 -6
  206. package/dist/memory/expand-service.d.ts.map +1 -1
  207. package/dist/memory/file-worker.js +9 -8
  208. package/dist/memory/file-worker.js.map +1 -1
  209. package/dist/memory/history-paging.d.ts +9 -0
  210. package/dist/memory/history-paging.d.ts.map +1 -0
  211. package/dist/memory/history-paging.js +164 -0
  212. package/dist/memory/history-paging.js.map +7 -0
  213. package/dist/memory/index.d.ts.map +1 -1
  214. package/dist/memory/normalize.js +5 -5
  215. package/dist/memory/outline-service.d.ts +7 -0
  216. package/dist/memory/outline-service.d.ts.map +1 -0
  217. package/dist/memory/request-cache.d.ts +3 -1
  218. package/dist/memory/request-cache.d.ts.map +1 -1
  219. package/dist/memory/request-context.d.ts +1 -0
  220. package/dist/memory/request-context.d.ts.map +1 -1
  221. package/dist/memory/request-limits.d.ts +2 -0
  222. package/dist/memory/request-limits.d.ts.map +1 -1
  223. package/dist/memory/search.js +7 -6
  224. package/dist/memory/worker-provider.d.ts.map +1 -1
  225. package/dist/memory/worker-provider.js +10 -9
  226. package/dist/memory.d.ts +16 -1
  227. package/dist/memory.d.ts.map +1 -1
  228. package/dist/memory.js +64 -12
  229. package/dist/memory.js.map +1 -1
  230. package/dist/mesh/store.d.ts +2 -1
  231. package/dist/mesh/store.d.ts.map +1 -1
  232. package/dist/programs/host.js +2 -2
  233. package/dist/protocol.d.ts +5 -0
  234. package/dist/protocol.d.ts.map +1 -1
  235. package/dist/protocol.js +1 -1
  236. package/dist/providers/agents-actions.d.ts.map +1 -1
  237. package/dist/providers/agents-message-router.d.ts +1 -0
  238. package/dist/providers/agents-message-router.d.ts.map +1 -1
  239. package/dist/providers/agents-provider.d.ts +2 -0
  240. package/dist/providers/agents-provider.d.ts.map +1 -1
  241. package/dist/providers/jev-provider.js +12 -11
  242. package/dist/providers/memory-provider.d.ts +4 -0
  243. package/dist/providers/memory-provider.d.ts.map +1 -1
  244. package/dist/providers/memory-provider.js +9 -8
  245. package/dist/providers/pi-read-operations.d.ts +24 -0
  246. package/dist/providers/pi-read-operations.d.ts.map +1 -0
  247. package/dist/providers/pi-tools-provider.d.ts +7 -0
  248. package/dist/providers/pi-tools-provider.d.ts.map +1 -1
  249. package/dist/providers/sessions-provider.d.ts +1 -1
  250. package/dist/providers/sessions-provider.d.ts.map +1 -1
  251. package/dist/providers/tasks-provider.d.ts +3 -1
  252. package/dist/providers/tasks-provider.d.ts.map +1 -1
  253. package/dist/residency/actor-client.js +3 -3
  254. package/dist/residency/client.d.ts.map +1 -1
  255. package/dist/residency/host.d.ts.map +1 -1
  256. package/dist/residency/host.js +17 -16
  257. package/dist/residency/launcher.js +1 -1
  258. package/dist/residency/pi-entry.js +17 -16
  259. package/dist/residency/pi-entry.js.map +1 -1
  260. package/dist/residency/protocol.d.ts +2 -0
  261. package/dist/residency/protocol.d.ts.map +1 -1
  262. package/dist/runtime/core-override-guest-types.js +2 -2
  263. package/dist/runtime/cpython-runtime.d.ts.map +1 -1
  264. package/dist/runtime/cpython-runtime.js +7 -6
  265. package/dist/runtime/cpython-runtime.js.map +2 -2
  266. package/dist/runtime/guest-types.d.ts +1 -1
  267. package/dist/runtime/guest-types.d.ts.map +1 -1
  268. package/dist/runtime/guest-types.js +1 -1
  269. package/dist/runtime/monty-runtime.d.ts.map +1 -1
  270. package/dist/runtime/monty-runtime.js +7 -6
  271. package/dist/runtime/monty-runtime.js.map +2 -2
  272. package/dist/runtime/node-process-runtime.d.ts.map +1 -1
  273. package/dist/runtime/node-process-runtime.js +6 -6
  274. package/dist/runtime/quickjs-runtime.d.ts.map +1 -1
  275. package/dist/runtime/quickjs-runtime.js +4 -4
  276. package/dist/runtime/type-checker.d.ts.map +1 -1
  277. package/dist/runtime/type-checker.js +1 -1
  278. package/dist/runtime/typescript-kernel.js +10 -10
  279. package/dist/runtime-state-builtins.d.ts +2 -0
  280. package/dist/runtime-state-builtins.d.ts.map +1 -1
  281. package/dist/schema/policy.d.ts.map +1 -1
  282. package/dist/speculation/eligibility.d.ts.map +1 -1
  283. package/dist/speculation/store.d.ts.map +1 -1
  284. package/dist/topology/participant-directory.d.ts +1 -0
  285. package/dist/topology/participant-directory.d.ts.map +1 -1
  286. package/dist/topology/peer-presence.d.ts.map +1 -1
  287. package/dist/topology/provider-participants.d.ts +1 -0
  288. package/dist/topology/provider-participants.d.ts.map +1 -1
  289. package/dist/type-error-guidance.js +1 -1
  290. package/dist/ui/code-preview-shell.d.ts +1 -0
  291. package/dist/ui/code-preview-shell.d.ts.map +1 -1
  292. package/dist/ui/controller.d.ts.map +1 -1
  293. package/dist/ui/conversation-chrome.d.ts.map +1 -1
  294. package/dist/ui/conversation-chrome.js +2 -2
  295. package/dist/ui/conversation-feedback.d.ts +8 -0
  296. package/dist/ui/conversation-feedback.d.ts.map +1 -0
  297. package/dist/ui/conversation-latest.d.ts.map +1 -1
  298. package/dist/ui/conversation-native-reader.d.ts.map +1 -1
  299. package/dist/ui/conversation-native-reader.js +3 -3
  300. package/dist/ui/conversation-native-reader.js.map +2 -2
  301. package/dist/ui/conversation-render.d.ts.map +1 -1
  302. package/dist/ui/conversation.d.ts +1 -0
  303. package/dist/ui/conversation.d.ts.map +1 -1
  304. package/dist/ui/conversation.js +139 -86
  305. package/dist/ui/conversation.js.map +4 -4
  306. package/dist/ui/core-tool-render.d.ts.map +1 -1
  307. package/dist/ui/dashboard-fabric-graph.d.ts.map +1 -1
  308. package/dist/ui/dashboard.js +47 -48
  309. package/dist/ui/dashboard.js.map +3 -3
  310. package/dist/ui/fabric-render.d.ts.map +1 -1
  311. package/dist/ui/format.d.ts.map +1 -1
  312. package/dist/ui/highlight.d.ts.map +1 -1
  313. package/dist/ui/permissions.d.ts +18 -0
  314. package/dist/ui/permissions.d.ts.map +1 -0
  315. package/dist/ui/permissions.js +178 -0
  316. package/dist/ui/permissions.js.map +7 -0
  317. package/dist/ui/row-balance.d.ts +1 -1
  318. package/dist/ui/row-balance.d.ts.map +1 -1
  319. package/dist/ui/settings-sections-execution.d.ts.map +1 -1
  320. package/dist/ui/settings-values.d.ts.map +1 -1
  321. package/dist/ui/settings.js +37 -31
  322. package/dist/ui/settings.js.map +2 -2
  323. package/dist/ui/shell-hang-keys.d.ts.map +1 -1
  324. package/dist/ui/shell-tasks.d.ts.map +1 -1
  325. package/dist/ui/shell-tasks.js +28 -11
  326. package/dist/ui/shell-tasks.js.map +2 -2
  327. package/dist/ui/structured.d.ts.map +1 -1
  328. package/dist/ui/tool-display.d.ts +18 -2
  329. package/dist/ui/tool-display.d.ts.map +1 -1
  330. package/dist/ui/truncate.d.ts +3 -0
  331. package/dist/ui/truncate.d.ts.map +1 -0
  332. package/dist/ui/widget.d.ts +7 -2
  333. package/dist/ui/widget.d.ts.map +1 -1
  334. package/dist/verified/context.d.ts +35 -0
  335. package/dist/verified/context.d.ts.map +1 -0
  336. package/dist/verified/execution.d.ts +7 -0
  337. package/dist/verified/execution.d.ts.map +1 -0
  338. package/dist/verified/generated/context.d.ts +6 -0
  339. package/dist/verified/generated/context.js +51 -0
  340. package/dist/verified/generated/execution.d.ts +5 -0
  341. package/dist/verified/generated/execution.js +32 -0
  342. package/dist/verified/generated/manifest.json +34 -3
  343. package/dist/verified/generated/prompt-guidance.d.ts +4 -0
  344. package/dist/verified/generated/prompt-guidance.js +17 -0
  345. package/dist/worker/recovery-watchdog.d.ts +7 -0
  346. package/dist/worker/recovery-watchdog.d.ts.map +1 -1
  347. package/dist/worker/recovery-watchdog.js +66 -4
  348. package/dist/worker/recovery-watchdog.js.map +2 -2
  349. package/dist/worker.js +22 -3
  350. package/dist/worker.js.map +2 -2
  351. package/docs/agents.md +37 -4
  352. package/docs/architecture.md +13 -0
  353. package/docs/background-tasks.md +81 -5
  354. package/docs/benchmarks/cli-resume-2026-11-09.json +1260 -0
  355. package/docs/benchmarks/interactivity-2026-11-09.json +2280 -0
  356. package/docs/benchmarks/resume-latency-2026-11-09.json +12105 -0
  357. package/docs/benchmarks/resume-startup-fix-2026-11-09.json +5452 -0
  358. package/docs/benchmarks/session-memory-2026-11-09.json +1320 -0
  359. package/docs/benchmarks/session-memory-fix-2026-11-09.json +280 -0
  360. package/docs/compaction.md +59 -23
  361. package/docs/configuration.md +53 -11
  362. package/docs/entropy.md +4 -1
  363. package/docs/history-paging.md +99 -0
  364. package/docs/interactivity-investigation.md +109 -0
  365. package/docs/interface.md +2 -2
  366. package/docs/jev.md +1 -1
  367. package/docs/memory-recall.md +42 -1
  368. package/docs/providers.md +24 -1
  369. package/docs/resume-latency-investigation.md +249 -0
  370. package/docs/session-memory-investigation.md +223 -0
  371. package/docs/verified-kernels.md +56 -0
  372. package/package.json +211 -211
  373. package/proofs/context.ts +139 -0
  374. package/proofs/execution.ts +48 -0
  375. package/proofs/index.ts +6 -0
  376. package/proofs/prompt-guidance.ts +38 -0
  377. package/scripts/verified-kernels.ts +1 -1
  378. package/skillsets/python/fabric-council/SKILL.md +31 -21
  379. package/skillsets/python/fabric-exec/SKILL.md +1 -1
  380. package/skillsets/python/fabric-exec/references/agents.md +2 -0
  381. package/skillsets/python/fabric-guide/SKILL.md +1 -0
  382. package/skillsets/python/fabric-memory/SKILL.md +82 -0
  383. package/skillsets/typescript/fabric-council/SKILL.md +26 -17
  384. package/skillsets/typescript/fabric-exec/SKILL.md +3 -2
  385. package/skillsets/typescript/fabric-exec/references/agents.md +1 -0
  386. package/skillsets/typescript/fabric-guide/SKILL.md +1 -0
  387. package/skillsets/typescript/fabric-memory/SKILL.md +87 -0
  388. package/dist/chunks/chunk-3VK6UGAN.js.map +0 -7
  389. package/dist/chunks/chunk-3XT5WHSG.js.map +0 -7
  390. package/dist/chunks/chunk-4BYS4ZLY.js.map +0 -7
  391. package/dist/chunks/chunk-4PBW54I2.js.map +0 -7
  392. package/dist/chunks/chunk-56NMRVTV.js.map +0 -7
  393. package/dist/chunks/chunk-7N7IC3Z2.js.map +0 -7
  394. package/dist/chunks/chunk-DGERP4VL.js.map +0 -7
  395. package/dist/chunks/chunk-DGUXJSYA.js.map +0 -7
  396. package/dist/chunks/chunk-F6A6MQ6G.js.map +0 -7
  397. package/dist/chunks/chunk-FK73YJKV.js.map +0 -7
  398. package/dist/chunks/chunk-G2DZJ5LK.js.map +0 -7
  399. package/dist/chunks/chunk-HFDJWLMS.js.map +0 -7
  400. package/dist/chunks/chunk-HRDMBGMY.js.map +0 -7
  401. package/dist/chunks/chunk-HRVYXRWZ.js.map +0 -7
  402. package/dist/chunks/chunk-LKYLD5SN.js.map +0 -7
  403. package/dist/chunks/chunk-LRSZFYUC.js.map +0 -7
  404. package/dist/chunks/chunk-LZ2ZXOCU.js.map +0 -7
  405. package/dist/chunks/chunk-MPMEK3IQ.js.map +0 -7
  406. package/dist/chunks/chunk-OJ4HAALD.js.map +0 -7
  407. package/dist/chunks/chunk-QGTD3LAZ.js.map +0 -7
  408. package/dist/chunks/chunk-QNMQJNXE.js.map +0 -7
  409. package/dist/chunks/chunk-RKJPBTBB.js.map +0 -7
  410. package/dist/chunks/chunk-U6Y6TKJL.js.map +0 -7
  411. package/dist/chunks/chunk-VGRUWTMG.js.map +0 -7
  412. package/dist/chunks/chunk-XOBLUZMB.js.map +0 -7
  413. package/dist/durable/openai-sse-patch.d.ts +0 -21
  414. package/dist/durable/openai-sse-patch.d.ts.map +0 -1
  415. /package/dist/chunks/{chunk-7YNE4NB2.js.map → chunk-2MELFQCQ.js.map} +0 -0
  416. /package/dist/chunks/{chunk-HSEZPCL5.js.map → chunk-2OC4YJOL.js.map} +0 -0
  417. /package/dist/chunks/{chunk-TXCNZCZP.js.map → chunk-2QJ4MNS6.js.map} +0 -0
  418. /package/dist/chunks/{chunk-QOEOKW2X.js.map → chunk-3QH6JAE3.js.map} +0 -0
  419. /package/dist/chunks/{chunk-L6H46CPY.js.map → chunk-6NNL5LOG.js.map} +0 -0
  420. /package/dist/chunks/{chunk-RWKQ5SRW.js.map → chunk-7ZFPVOV2.js.map} +0 -0
  421. /package/dist/chunks/{chunk-PUBHBEYO.js.map → chunk-B2FIGOPI.js.map} +0 -0
  422. /package/dist/chunks/{chunk-4WKD3YM3.js.map → chunk-C3UPHOJW.js.map} +0 -0
  423. /package/dist/chunks/{chunk-RAA3FAYZ.js.map → chunk-GNPTDN6K.js.map} +0 -0
  424. /package/dist/chunks/{chunk-XFOSUGLU.js.map → chunk-JCGEW5OQ.js.map} +0 -0
  425. /package/dist/chunks/{chunk-CXYJJ3HZ.js.map → chunk-LJ2MG6U2.js.map} +0 -0
  426. /package/dist/chunks/{chunk-3MOY6WIB.js.map → chunk-LRBDEAKB.js.map} +0 -0
  427. /package/dist/chunks/{chunk-NQ7IWEIF.js.map → chunk-MQGRQMVM.js.map} +0 -0
  428. /package/dist/chunks/{chunk-WKFRGICG.js.map → chunk-RBYRHS24.js.map} +0 -0
  429. /package/dist/chunks/{chunk-ZHROHNEE.js.map → chunk-RFNYH7S7.js.map} +0 -0
  430. /package/dist/chunks/{chunk-H57KPL3V.js.map → chunk-S2JWFXW5.js.map} +0 -0
  431. /package/dist/chunks/{chunk-KIFOEBYJ.js.map → chunk-VEXCD3RA.js.map} +0 -0
  432. /package/dist/chunks/{chunk-GS67KDMV.js.map → chunk-VN7AE3EY.js.map} +0 -0
  433. /package/dist/chunks/{chunk-MX53BRAC.js.map → chunk-XBAOTA4U.js.map} +0 -0
  434. /package/dist/chunks/{chunk-MSDL7U6Q.js.map → chunk-XQCNVH3Y.js.map} +0 -0
  435. /package/dist/chunks/{chunk-6GWDGTHC.js.map → chunk-YLO62DWD.js.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  fabricExecTitleHintCached,
3
3
  modelCompactionKey
4
- } from "./chunk-3VK6UGAN.js";
4
+ } from "./chunk-O5SHIUIL.js";
5
5
  import {
6
6
  normalizeRunDisplay
7
7
  } from "./chunk-OZCJU3PZ.js";
@@ -14,7 +14,7 @@ import {
14
14
  FABRIC_BRANCH_SUMMARY_VERSION,
15
15
  readFabricBranchSummaryDetails,
16
16
  readFabricProjectionTrace
17
- } from "./chunk-QOEOKW2X.js";
17
+ } from "./chunk-3QH6JAE3.js";
18
18
  import {
19
19
  MAX_PRESERVE_ITEMS,
20
20
  MAX_PRESERVE_ITEM_CHARS,
@@ -318,6 +318,11 @@ var isTypedCustomContent = (content) => {
318
318
  return candidate.type === "image";
319
319
  });
320
320
  };
321
+ var isUserSourcedCustomMessage = (entry) => {
322
+ if (!isPiCustomMessageEntry(entry) || entry.display !== true) return false;
323
+ const details = entry.details;
324
+ return details !== null && typeof details === "object" && !Array.isArray(details) && details.source === "user";
325
+ };
321
326
  var isPiCustomMessageEntry = (entry) => {
322
327
  try {
323
328
  if (entry.type !== "custom_message") return false;
@@ -428,6 +433,10 @@ var normalizeEntries = (entries) => {
428
433
  if (entry.type === "custom_message") {
429
434
  try {
430
435
  if (!isPiCustomMessageEntry(entry)) continue;
436
+ if (isUserSourcedCustomMessage(entry)) {
437
+ push({ kind: "user", entryId: entry.id, sourceEntryId: entry.id, text: textOfContent(entry.content) });
438
+ continue;
439
+ }
431
440
  const details = customDetails(entry.details);
432
441
  push({
433
442
  kind: "customMessage",
@@ -486,7 +495,17 @@ var normalizeEntries = (entries) => {
486
495
  ...isError && text ? { error: text } : {}
487
496
  });
488
497
  } else {
489
- push({ kind: "toolResult", entryId, sourceEntryId: entryId, toolCallId, toolName, isError, text });
498
+ const typedError = toolName === "fabric_exec" && isError ? toolResult.details?.error : void 0;
499
+ push({
500
+ kind: "toolResult",
501
+ entryId,
502
+ sourceEntryId: entryId,
503
+ toolCallId,
504
+ toolName,
505
+ isError,
506
+ text,
507
+ ...typeof typedError === "string" && typedError ? { error: typedError } : {}
508
+ });
490
509
  }
491
510
  if (toolName === "fabric_exec") {
492
511
  const nested = readFabricProjectionTrace(toolResult.details);
@@ -574,6 +593,89 @@ var countErasedThinkingBlocks = (entries) => {
574
593
  return count;
575
594
  };
576
595
 
596
+ // src/verified/generated/context.js
597
+ function $n(v, what) {
598
+ if (typeof v !== "number" || !Number.isSafeInteger(v) || v < 0) throw new RangeError(what + " must be a natural below 2^53, not " + v);
599
+ return v;
600
+ }
601
+ function $x(v) {
602
+ if (v > 9007199254740991) throw new RangeError("a value passed 2^53 - 1, past which the proofs over the naturals no longer describe the run");
603
+ return v;
604
+ }
605
+ var summaryAllocation = /* @__PURE__ */ (() => {
606
+ function init(params) {
607
+ const env = {}, s = {};
608
+ return { scalars: { "out.userBytes": 0, "out.operationBytes": 0 }, maps: {} };
609
+ }
610
+ function step(params, state, input) {
611
+ const env = { "limit": $n(input["limit"], "input limit"), "user": $n(input["user"], "input user"), "operations": $n(input["operations"], "input operations") }, s = state.scalars, dft = { ...state.defaults }, maps = state.maps;
612
+ const scalars = { ...s, "out.userBytes": Math.min(env["user"], env["limit"]), "out.operationBytes": Math.min(env["operations"], Math.max(0, env["limit"] - Math.min(env["user"], env["limit"]))) };
613
+ return Object.keys(dft).length ? { scalars, maps: state.maps, defaults: dft } : { scalars, maps: state.maps };
614
+ }
615
+ return { init, step };
616
+ })();
617
+ var userStaleness = /* @__PURE__ */ (() => {
618
+ function init(params) {
619
+ const env = {}, s = {};
620
+ return { scalars: { "seen": 0, "compactions": 0, "background": 0 }, maps: {} };
621
+ }
622
+ function step(params, state, input) {
623
+ const env = { "op": $n(input["op"], "input op") }, s = state.scalars, dft = { ...state.defaults }, maps = state.maps;
624
+ if (!(env["op"] < 4)) throw new RangeError("user staleness: the request fails the rule's assumption, so no proof covers the step it would take");
625
+ const scalars = { ...s, "compactions": env["op"] === 0 ? 0 : env["op"] === 2 && s["seen"] === 1 ? $x(s["compactions"] + 1) : s["compactions"], "background": env["op"] === 0 ? 0 : env["op"] === 1 && s["seen"] === 1 ? $x(s["background"] + 1) : s["background"], "seen": env["op"] === 0 || s["seen"] === 1 ? 1 : 0 };
626
+ return Object.keys(dft).length ? { scalars, maps: state.maps, defaults: dft } : { scalars, maps: state.maps };
627
+ }
628
+ return { init, step };
629
+ })();
630
+ var failureLedger = /* @__PURE__ */ (() => {
631
+ function init(params) {
632
+ const env = { "limit": $n(params["limit"], "param limit") }, s = {};
633
+ return { scalars: { "total": 0, "open": 0, "aged": 0, "settled": 0, "itemized": 0, "skipped": 0 }, maps: {} };
634
+ }
635
+ function step(params, state, input) {
636
+ const env = { "limit": $n(params["limit"], "param limit"), "fresh": $n(input["fresh"], "input fresh"), "resolved": $n(input["resolved"], "input resolved") }, s = state.scalars, dft = { ...state.defaults }, maps = state.maps;
637
+ const flag0 = !(env["resolved"] === 1) && env["fresh"] === 1;
638
+ const flag1 = !(env["resolved"] === 1) && !(env["fresh"] === 1);
639
+ const flag2 = s["itemized"] < env["limit"];
640
+ const flag3 = s["skipped"] === 0;
641
+ if (!(env["fresh"] <= 1 && env["resolved"] <= 1)) throw new RangeError("failure ledger: the request fails the rule's assumption, so no proof covers the step it would take");
642
+ const scalars = { ...s, "total": $x(s["total"] + 1), "open": flag0 ? $x(s["open"] + 1) : s["open"], "aged": flag1 ? $x(s["aged"] + 1) : s["aged"], "settled": env["resolved"] === 1 && !flag0 ? $x(s["settled"] + 1) : s["settled"], "itemized": flag2 && (flag0 || flag1 && flag3) ? $x(s["itemized"] + 1) : s["itemized"], "skipped": flag0 && !flag2 ? $x(s["skipped"] + 1) : s["skipped"] };
643
+ return Object.keys(dft).length ? { scalars, maps: state.maps, defaults: dft } : { scalars, maps: state.maps };
644
+ }
645
+ return { init, step };
646
+ })();
647
+
648
+ // src/verified/context.ts
649
+ var isNatural = (value) => typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
650
+ var natural = (value, what) => {
651
+ if (!isNatural(value)) throw new RangeError(`${what} must be a safe natural, not ${value}`);
652
+ return value;
653
+ };
654
+ var allocateSummaryBytes = (limit, user, operations) => {
655
+ const input = { limit: natural(limit, "limit"), user: natural(user, "user"), operations: natural(operations, "operations") };
656
+ const out = summaryAllocation.step({}, summaryAllocation.init({}), input).scalars;
657
+ return { userBytes: out["out.userBytes"], operationBytes: out["out.operationBytes"] };
658
+ };
659
+ var STALENESS_CODES = { user: 0, background: 1, compaction: 2, other: 3 };
660
+ var foldUserStaleness = (ops) => {
661
+ let state = userStaleness.init({});
662
+ for (const op of ops) state = userStaleness.step({}, state, { op: STALENESS_CODES[op] });
663
+ const { seen, compactions, background } = state.scalars;
664
+ return { anchored: seen === 1, compactions, background };
665
+ };
666
+ var foldFailureLedger = (failures, limit) => {
667
+ const params = { limit: natural(limit, "limit") };
668
+ let state = failureLedger.init(params);
669
+ const itemized = [];
670
+ for (const failure of failures) {
671
+ const before = state.scalars.itemized;
672
+ state = failureLedger.step(params, state, { fresh: failure.fresh ? 1 : 0, resolved: failure.resolved ? 1 : 0 });
673
+ itemized.push(state.scalars.itemized > before);
674
+ }
675
+ const { total, open, aged, settled } = state.scalars;
676
+ return { itemized, total, open, aged, resolved: settled };
677
+ };
678
+
577
679
  // src/compaction/dialogue.ts
578
680
  var MAX_RECENT_EXCHANGES = 3;
579
681
  var MAX_EXCHANGE_BYTES = 3968;
@@ -605,7 +707,7 @@ ${event.text}`;
605
707
  var dialogueExcerpts = (exchange) => {
606
708
  const heading = (role, message) => `${role} [entry ${message.entryId}${message.retained ? "; retained raw" : ""}]:`;
607
709
  const userHeading = heading("User instruction", exchange.user);
608
- const assistantHeading = exchange.assistant ? heading("Historical assistant response (not a verified outcome)", exchange.assistant) : "";
710
+ const assistantHeading = exchange.assistant ? heading("Assistant response (a proposal, not a verified outcome or user instruction)", exchange.assistant) : "";
609
711
  const available = Math.max(0, MAX_EXCHANGE_BYTES - utf8Bytes(userHeading + assistantHeading) - 8);
610
712
  const userText = exchange.user.retained ? "" : exchange.user.text;
611
713
  const assistantBytes = exchange.assistant && !exchange.assistant.retained ? utf8Bytes(exchange.assistant.text) : 0;
@@ -635,7 +737,6 @@ ${excerpt.text}`;
635
737
  var MAX_LINE = 140;
636
738
  var FILE_TOOLS = /* @__PURE__ */ new Set(["read", "edit", "write", "grep", "find", "ls"]);
637
739
  var MODIFYING_TOOLS = /* @__PURE__ */ new Set(["edit", "write"]);
638
- var MAX_USER_ONELINER = 120;
639
740
  var MAX_EARLIER_USER = 80;
640
741
  var MAX_STATUS_LINE = 140;
641
742
  var MAX_TRANSCRIPT_LINE = 100;
@@ -645,12 +746,11 @@ var MAX_FABRIC_RUN_DESCRIPTION = 180;
645
746
  var MAX_FABRIC_RUN_TRANSCRIPT_NAME = 60;
646
747
  var MAX_FABRIC_RUN_EARLIER_NAME = 48;
647
748
  var MAX_FABRIC_RUN_STATUS_NAME = 96;
648
- var MAX_LATER_GOALS = 24;
749
+ var MAX_EARLIER_USERS = 64;
750
+ var MAX_USER_MESSAGE_BYTES = 2048;
649
751
  var MAX_FILES_PER_KIND = 24;
650
- var MAX_OUTSTANDING = 32;
651
752
  var MAX_ACTIVITY = 48;
652
753
  var MAX_UNRESOLVED = 24;
653
- var MAX_RESOLVED = MAX_OUTSTANDING - MAX_UNRESOLVED;
654
754
  var MAX_EARLIER_TURNS = 32;
655
755
  var TRANSCRIPT_WINDOW = 40;
656
756
  var truncate = (text, max) => {
@@ -670,6 +770,8 @@ var customMessageLine = (event, maxText) => {
670
770
  const visibility = event.display ? "visible" : "hidden";
671
771
  return `custom ${quoted(event.customType, 80)} (${visibility}): ${quoted(event.text, maxText)}${customDetailsSuffix(event.details)}`;
672
772
  };
773
+ var ROUTINE_REFS = /* @__PURE__ */ new Set(["native.load", "fabric.discovery.compatibility"]);
774
+ var isRoutineOperation = (event) => event.kind === "fabricOperation" && event.outcome === "succeeded" && ROUTINE_REFS.has(event.ref);
673
775
  var pathOf = (args) => {
674
776
  const value = args.path ?? args.file ?? args.dir;
675
777
  return typeof value === "string" && value.trim() ? value : void 0;
@@ -701,6 +803,7 @@ var collectOperations = (events) => {
701
803
  if (event.kind === "toolResult" && event.toolName !== "bash") {
702
804
  const call = event.toolCallId ? calls.get(event.toolCallId) : void 0;
703
805
  if (!call) continue;
806
+ const error = event.toolName === "fabric_exec" ? event.error : event.text;
704
807
  operations.push({
705
808
  index: event.index,
706
809
  entryId: call.entryId,
@@ -709,7 +812,7 @@ var collectOperations = (events) => {
709
812
  ref: call.name,
710
813
  args: call.args,
711
814
  outcome: event.isError ? "failed" : "succeeded",
712
- ...event.isError && event.text ? { error: event.text } : {},
815
+ ...event.isError && error ? { error } : {},
713
816
  nested: false
714
817
  });
715
818
  continue;
@@ -755,26 +858,26 @@ var commonRoot = (paths) => {
755
858
  return `${first.slice(0, common).join("/")}/`;
756
859
  };
757
860
  var stripRoot = (root, path) => root ? path.replace(root, "") : path;
861
+ var earlierUserItem = (user) => `User [entry ${user.entryId}]:
862
+ ${boundedExcerpt(user.text.trim(), MAX_USER_MESSAGE_BYTES).text}`;
758
863
  var projectGoal = (events, protectedUsers) => {
759
864
  const lines = [];
760
865
  function* historicalUsers() {
761
866
  for (const event of events) {
762
- if (event.kind === "user" && !protectedUsers.has(event.entryId)) yield event;
867
+ if (event.kind === "user" && !protectedUsers.has(event.entryId) && event.text.trim()) yield event;
763
868
  }
764
869
  }
765
- const sampled = sampleAddressedFrom(historicalUsers(), MAX_LATER_GOALS);
870
+ const sampled = sampleAddressedFrom(historicalUsers(), MAX_EARLIER_USERS);
766
871
  for (let index = 0; index < sampled.values.length; index++) {
767
872
  if (sampled.omitted > 0 && index === sampled.splitIndex) {
768
873
  lines.push(omissionLine(
769
874
  sampled.omitted,
770
875
  sampled.omittedFirstEntryId,
771
876
  sampled.omittedLastEntryId,
772
- "user scope changes"
877
+ "user messages"
773
878
  ));
774
879
  }
775
- const user = sampled.values[index];
776
- const line = truncate(firstLine(user.text), MAX_USER_ONELINER);
777
- if (line) lines.push(`- ${line} [entry ${user.entryId}]`);
880
+ lines.push(earlierUserItem(sampled.values[index]));
778
881
  }
779
882
  return { lines, omitted: sampled.omitted };
780
883
  };
@@ -858,6 +961,7 @@ var projectActivity = (events) => {
858
961
  } else if (event.kind === "fabricPhase") {
859
962
  items.push({ entryId: event.address, line: `- Phase: ${truncate(event.phase, MAX_LINE)}` });
860
963
  } else if (event.kind === "fabricOperation") {
964
+ if (isRoutineOperation(event)) continue;
861
965
  if (FILE_TOOLS.has(event.tool) && (event.ref === event.tool || event.ref === `pi.${event.tool}`)) continue;
862
966
  const bash = event.tool === "bash" && (event.ref === "bash" || event.ref === "pi.bash");
863
967
  const primary = bash ? event.args.command : event.args.id ?? event.args.name ?? event.args.query ?? event.args.action;
@@ -884,7 +988,8 @@ var projectActivity = (events) => {
884
988
  }
885
989
  return { lines, omitted: sampled.omitted };
886
990
  };
887
- var projectOutstandingWithMetadata = (events) => {
991
+ var rangeLine = (count, items, noun) => omissionLine(count, items[0]?.entryId, items.at(-1)?.entryId, noun);
992
+ var projectOutstandingWithMetadata = (events, options = {}) => {
888
993
  const operations = collectOperations(events);
889
994
  const keyOf = (operation) => {
890
995
  const path = isFileOperation(operation) ? pathOf(operation.args) : void 0;
@@ -893,7 +998,11 @@ var projectOutstandingWithMetadata = (events) => {
893
998
  if (command !== void 0) return `bash\0${operation.tool}\0${command}`;
894
999
  return `generic\0${operation.ref}\0${JSON.stringify(operation.args)}`;
895
1000
  };
896
- const successes = operations.filter((operation) => operation.outcome === "succeeded").map((operation) => ({ index: operation.index, key: keyOf(operation) }));
1001
+ const lastSuccess = /* @__PURE__ */ new Map();
1002
+ for (const operation of operations) {
1003
+ if (operation.outcome === "succeeded") lastSuccess.set(keyOf(operation), operation.index);
1004
+ }
1005
+ const fresh = options.freshEntryIds;
897
1006
  const items = [];
898
1007
  for (const operation of operations) {
899
1008
  if (operation.outcome === "succeeded") continue;
@@ -901,38 +1010,38 @@ var projectOutstandingWithMetadata = (events) => {
901
1010
  const command = isBashOperation(operation) && typeof operation.args.command === "string" ? operation.args.command : void 0;
902
1011
  const subject = path ? `${operation.ref} ${path}` : command !== void 0 ? `${operation.ref}: ${truncate(firstLine(command), MAX_LINE)}` : operation.ref;
903
1012
  const error = operation.error ? `: ${truncate(firstLine(operation.error), MAX_LINE)}` : `: ${operation.outcome}`;
904
- const key = keyOf(operation);
905
- const resolved2 = successes.some((success) => success.index > operation.index && success.key === key);
906
1013
  items.push({
907
1014
  index: operation.index,
908
1015
  entryId: operation.address,
909
1016
  description: `${subject}${error}`,
910
- resolved: resolved2
1017
+ resolved: (lastSuccess.get(keyOf(operation)) ?? -1) > operation.index,
1018
+ fresh: fresh === void 0 || fresh.has(operation.entryId)
911
1019
  });
912
1020
  }
913
1021
  if (items.length === 0) return { lines: [], omitted: 0 };
914
- const unresolved = items.filter((i) => !i.resolved).sort((a, b) => a.index - b.index);
915
- const resolved = items.filter((i) => i.resolved).sort((a, b) => a.index - b.index);
916
- const sampledUnresolved = sampleAddressed(unresolved, MAX_UNRESOLVED);
917
- const sampledResolved = sampleAddressed(resolved, MAX_RESOLVED);
1022
+ const newestFirst = [...items].sort((a, b) => b.index - a.index);
1023
+ const rank = (item) => item.resolved ? 2 : item.fresh ? 0 : 1;
1024
+ const ordered = [...newestFirst].sort((a, b) => rank(a) - rank(b));
1025
+ const ledger = foldFailureLedger(ordered, MAX_UNRESOLVED);
1026
+ const itemized = [];
1027
+ const openOlder = [];
1028
+ const aged = [];
1029
+ const resolved = [];
1030
+ ordered.forEach((item, position) => {
1031
+ if (ledger.itemized[position]) itemized.push(item);
1032
+ else if (item.resolved) resolved.push(item);
1033
+ else if (item.fresh) openOlder.push(item);
1034
+ else aged.push(item);
1035
+ });
1036
+ for (const list of [itemized, openOlder, aged, resolved]) list.sort((a, b) => a.index - b.index);
918
1037
  const lines = [];
919
- const append = (sampled, noun) => {
920
- for (let index = 0; index < sampled.values.length; index++) {
921
- if (sampled.omitted > 0 && index === sampled.splitIndex) {
922
- lines.push(omissionLine(
923
- sampled.omitted,
924
- sampled.omittedFirstEntryId,
925
- sampled.omittedLastEntryId,
926
- noun
927
- ));
928
- }
929
- const item = sampled.values[index];
930
- lines.push(`- ${item.description}${item.resolved ? " [RESOLVED]" : ""} [entry ${item.entryId}]`);
931
- }
932
- };
933
- append(sampledUnresolved, "open error records");
934
- append(sampledResolved, "resolved error records");
935
- return { lines, omitted: sampledUnresolved.omitted + sampledResolved.omitted };
1038
+ if (openOlder.length > 0) lines.push(rangeLine(openOlder.length, openOlder, "older open error records"));
1039
+ for (const item of itemized) lines.push(`- ${item.description} [entry ${item.entryId}]`);
1040
+ if (aged.length > 0) {
1041
+ lines.push(rangeLine(aged.length, aged, "open error records already itemized by an earlier compaction"));
1042
+ }
1043
+ if (resolved.length > 0) lines.push(rangeLine(resolved.length, resolved, "error records later resolved by an exact retry"));
1044
+ return { lines, omitted: ledger.total - itemized.length };
936
1045
  };
937
1046
  var projectEarlierTurns = (events) => {
938
1047
  function* earlierTurns() {
@@ -959,7 +1068,7 @@ var projectEarlierTurns = (events) => {
959
1068
  lastRun = void 0;
960
1069
  continue;
961
1070
  }
962
- if (!currentContext) continue;
1071
+ if (!currentContext || isRoutineOperation(event)) continue;
963
1072
  if (event.kind === "fabricRun") lastRun = event;
964
1073
  const name = event.kind === "toolCall" ? event.name === "fabric_exec" ? void 0 : event.name : event.kind === "bash" ? "bash" : event.kind === "fabricOperation" ? event.tool : void 0;
965
1074
  if (!name) continue;
@@ -985,14 +1094,18 @@ var projectEarlierTurns = (events) => {
985
1094
  return { lines, omitted: sampled.omitted };
986
1095
  };
987
1096
  var projectStatus = (events) => {
988
- const lastContext = [...events].reverse().find(
989
- (event) => event.kind === "user" || event.kind === "customMessage"
1097
+ const lastUser = [...events].reverse().find(
1098
+ (event) => event.kind === "user"
1099
+ );
1100
+ const lastCustom = [...events].reverse().find(
1101
+ (event) => event.kind === "customMessage"
990
1102
  );
991
1103
  const lines = [];
992
- if (lastContext?.kind === "user") {
993
- lines.push(`Last request: ${truncate(firstLine(lastContext.text), MAX_STATUS_LINE)}`);
994
- } else if (lastContext) {
995
- lines.push(`Last context: ${customMessageLine(lastContext, MAX_STATUS_LINE)}`);
1104
+ if (lastUser) {
1105
+ lines.push(`Last request: ${truncate(firstLine(lastUser.text), MAX_STATUS_LINE)} [entry ${lastUser.entryId}]`);
1106
+ }
1107
+ if (lastCustom && (!lastUser || lastCustom.index > lastUser.index)) {
1108
+ lines.push(`Later context: ${customMessageLine(lastCustom, MAX_STATUS_LINE)}`);
996
1109
  }
997
1110
  let lastModify;
998
1111
  for (const operation of collectOperations(events)) {
@@ -1029,6 +1142,7 @@ var projectTranscript = (events) => {
1029
1142
  events.filter((event) => event.kind === "fabricRun").map((event) => event.toolCallId)
1030
1143
  );
1031
1144
  const transcriptEvents = events.filter((event) => {
1145
+ if (isRoutineOperation(event)) return false;
1032
1146
  if (event.kind === "toolCall") {
1033
1147
  return event.name !== "fabric_exec" || !completedFabricCalls.has(event.toolCallId);
1034
1148
  }
@@ -1076,13 +1190,13 @@ var projectTranscript = (events) => {
1076
1190
  }
1077
1191
  return { lines, omitted };
1078
1192
  };
1079
- var projectWithMetadata = (events, retainedDialogue = []) => {
1193
+ var projectWithMetadata = (events, retainedDialogue = [], options = {}) => {
1080
1194
  const exchanges = recentDialogue(events, retainedDialogue);
1081
1195
  const dialogue = projectDialogue(exchanges);
1082
1196
  const goal = projectGoal(events, new Set(exchanges.map(({ user }) => user.entryId)));
1083
1197
  const files = projectFiles(events);
1084
1198
  const activity = projectActivity(events);
1085
- const outstanding = projectOutstandingWithMetadata(events);
1199
+ const outstanding = projectOutstandingWithMetadata(events, options);
1086
1200
  const earlierTurns = projectEarlierTurns(events);
1087
1201
  const transcript = projectTranscript(events);
1088
1202
  return {
@@ -1110,8 +1224,8 @@ var projectWithMetadata = (events, retainedDialogue = []) => {
1110
1224
 
1111
1225
  // src/compaction/render.ts
1112
1226
  var SUMMARY_SECTIONS = [
1227
+ { key: "goal", header: "[Earlier user messages]", maxBytes: 8192 },
1113
1228
  { key: "dialogue", header: "[Recent user directions and discussion]", maxBytes: 12288 },
1114
- { key: "goal", header: "[Historical requests]", maxBytes: 4096 },
1115
1229
  { key: "files", header: "[Files And Changes]", maxBytes: 4608 },
1116
1230
  { key: "activity", header: "[Fabric Activity]", maxBytes: 2048 },
1117
1231
  { key: "outstanding", header: "[Outstanding Context]", maxBytes: 4608 },
@@ -1119,6 +1233,8 @@ var SUMMARY_SECTIONS = [
1119
1233
  { key: "status", header: "[Current Status]", maxBytes: 2048 }
1120
1234
  ];
1121
1235
  var CARRY_FORWARD_HEADER = "[Carry Forward]";
1236
+ var USER_ACTIVITY_HEADER = "[User activity]";
1237
+ var USER_ACTIVITY_MAX_BYTES = 512;
1122
1238
  var REQUEST_MAX_BYTES = 3072;
1123
1239
  var CARRY_MAX_BYTES = 3072;
1124
1240
  var TRANSCRIPT_MAX_BYTES = 5120;
@@ -1202,13 +1318,23 @@ var renderSummaryWithMetadata = (sections, options) => {
1202
1318
  carryOmittedBytes = rendered.omittedBytes;
1203
1319
  }
1204
1320
  };
1321
+ if (options.userActivity) {
1322
+ blocks.push(clipUtf8(`${USER_ACTIVITY_HEADER}
1323
+ ${options.userActivity}`, USER_ACTIVITY_MAX_BYTES));
1324
+ }
1205
1325
  for (const { key, header, maxBytes } of SUMMARY_SECTIONS) {
1206
1326
  const lines = sections[key];
1207
- if (key === "dialogue") {
1327
+ if (key === "goal") {
1208
1328
  if (lines.length > 0) {
1209
1329
  const rendered = protectedBlock(header, lines, maxBytes);
1210
1330
  blocks.push(rendered.text);
1211
- dialogueOmittedBytes = rendered.omittedBytes;
1331
+ dialogueOmittedBytes += rendered.omittedBytes;
1332
+ }
1333
+ } else if (key === "dialogue") {
1334
+ if (lines.length > 0) {
1335
+ const rendered = protectedBlock(header, lines, maxBytes);
1336
+ blocks.push(rendered.text);
1337
+ dialogueOmittedBytes += rendered.omittedBytes;
1212
1338
  }
1213
1339
  request();
1214
1340
  } else if (lines.length > 0) {
@@ -1224,7 +1350,9 @@ var renderSummaryWithMetadata = (sections, options) => {
1224
1350
  const footerBlock = boundedBlock("---", [footer, POINTER_LINE], FOOTER_MAX_BYTES);
1225
1351
  const framingBytes = utf8Bytes(footerBlock) + 2 * (blocks.length + history.length) + 1;
1226
1352
  const protectedBytes = blocks.reduce((sum, block) => sum + utf8Bytes(block), 0);
1227
- blocks.push(...boundedHistory(history, MAX_SUMMARY_BYTES - framingBytes - protectedBytes), footerBlock);
1353
+ const historyDemand = history.reduce((sum, block) => sum + utf8Bytes(boundedBlock(block.header, block.lines, block.maxBytes)), 0);
1354
+ const allocation = allocateSummaryBytes(Math.max(0, MAX_SUMMARY_BYTES - framingBytes), protectedBytes, historyDemand);
1355
+ blocks.push(...boundedHistory(history, allocation.operationBytes), footerBlock);
1228
1356
  const summary = `${blocks.join("\n\n")}
1229
1357
  `;
1230
1358
  return {
@@ -1392,7 +1520,8 @@ var compileFabricBranchSummary = (entriesToSummarize, customInstructions, enrich
1392
1520
  runEnrichers(enrichers, events, projected.sections);
1393
1521
  const sections = SUMMARY_SECTIONS.filter(({ key }) => projected.sections[key].length > 0).map(({ header }) => header);
1394
1522
  if (instructions.requestLines.length > 0) {
1395
- sections.splice(projected.sections.dialogue.length > 0 ? 1 : 0, 0, "[Compaction Request]");
1523
+ const userBlocks = (projected.sections.goal.length > 0 ? 1 : 0) + (projected.sections.dialogue.length > 0 ? 1 : 0);
1524
+ sections.splice(userBlocks, 0, "[Compaction Request]");
1396
1525
  }
1397
1526
  const rendered = renderSummaryWithMetadata(projected.sections, {
1398
1527
  firstEntryId: entriesToSummarize[0]?.id ?? "",
@@ -1461,6 +1590,71 @@ var carryRequestLines = (items) => items.flatMap((item, index) => {
1461
1590
  return text ? [`- ${text} [carry:${index}]`] : [];
1462
1591
  });
1463
1592
 
1593
+ // src/compaction/user-activity.ts
1594
+ var stalenessOp = (entry) => {
1595
+ if (entry.type === "compaction") return "compaction";
1596
+ if (entry.type === "message") return entry.message.role === "user" ? "user" : "other";
1597
+ if (entry.type === "custom_message" && isPiCustomMessageEntry(entry)) {
1598
+ return isUserSourcedCustomMessage(entry) ? "user" : "background";
1599
+ }
1600
+ return "other";
1601
+ };
1602
+ var textOf = (content) => {
1603
+ if (typeof content === "string") return content;
1604
+ if (!Array.isArray(content)) return "";
1605
+ return content.filter((part) => part !== null && typeof part === "object" && part.type === "text" && typeof part.text === "string").map((part) => part.text).join("\n");
1606
+ };
1607
+ var latestUserAnchor = (entries) => {
1608
+ for (let index = entries.length - 1; index >= 0; index--) {
1609
+ const entry = entries[index];
1610
+ if (stalenessOp(entry) !== "user") continue;
1611
+ const content = entry.type === "message" ? entry.message.content : entry.content;
1612
+ return { entryId: entry.id, timestamp: entry.timestamp, text: textOf(content) };
1613
+ }
1614
+ return void 0;
1615
+ };
1616
+ var userActivity = (entries) => {
1617
+ const anchor = latestUserAnchor(entries);
1618
+ if (!anchor) return void 0;
1619
+ const staleness = foldUserStaleness(entries.map(stalenessOp));
1620
+ if (!staleness.anchored) return void 0;
1621
+ const start = Date.parse(anchor.timestamp);
1622
+ const end = Date.parse(entries.at(-1)?.timestamp ?? "");
1623
+ return {
1624
+ anchor,
1625
+ compactions: staleness.compactions,
1626
+ background: staleness.background,
1627
+ elapsedMs: Number.isFinite(start) && Number.isFinite(end) && end >= start ? end - start : void 0
1628
+ };
1629
+ };
1630
+ var formatElapsed = (ms) => {
1631
+ const minutes = Math.floor(ms / 6e4);
1632
+ if (minutes < 1) return "under a minute";
1633
+ const hours = Math.floor(minutes / 60);
1634
+ const days = Math.floor(hours / 24);
1635
+ if (days > 0) return `${days}d ${hours % 24}h`;
1636
+ return hours > 0 ? `${hours}h ${minutes % 60}m` : `${minutes}m`;
1637
+ };
1638
+ var plural = (count, one, many) => `${count} ${count === 1 ? one : many}`;
1639
+ var userActivityLine = (activity) => [
1640
+ `Latest user message: entry ${activity.anchor.entryId} at ${activity.anchor.timestamp || "(unknown time)"}.`,
1641
+ `Since then: ${activity.elapsedMs === void 0 ? "unknown time" : formatElapsed(activity.elapsedMs)} of agent work, ${plural(activity.compactions, "earlier compaction", "earlier compactions")}, ${plural(activity.background, "background delivery", "background deliveries")}.`,
1642
+ "Assistant responses below are proposals, not user instructions."
1643
+ ].join(" ");
1644
+ var REQUEST_EXCERPT_CHARS = 600;
1645
+ var latestRequestLine = (context) => {
1646
+ let anchor;
1647
+ try {
1648
+ anchor = latestUserAnchor(context.sessionManager?.getBranch?.() ?? []);
1649
+ } catch {
1650
+ return void 0;
1651
+ }
1652
+ if (!anchor) return void 0;
1653
+ const text = anchor.text.trim();
1654
+ const excerpt = text.length > REQUEST_EXCERPT_CHARS ? `${text.slice(0, REQUEST_EXCERPT_CHARS)}\u2026` : text;
1655
+ return `The user's latest request [entry ${anchor.entryId}, ${anchor.timestamp}]: ${JSON.stringify(excerpt)}`;
1656
+ };
1657
+
1464
1658
  // src/compaction/hook.ts
1465
1659
  var SUMMARY_RAW_TOKEN_BUDGET = Math.ceil(MAX_SUMMARY_BYTES / 4);
1466
1660
  var HARD_CEILING_SAFETY_RATIO = 0.9;
@@ -1897,7 +2091,10 @@ var compileFabricSummary = (branchEntries, tokensBefore, enrichers = NO_BUILTIN_
1897
2091
  const source = cumulativeSource(branchEntries, cut.firstKeptEntryId);
1898
2092
  if (source.events.length === 0) return { cancel: true, reason: "fabric: no raw cumulative source" };
1899
2093
  const retainedDialogue = cut.firstKeptEntryId ? normalizeEntries(branchEntries.slice(source.prefixEntries.length).filter((entry) => entry.type === "message" && (entry.message.role === "user" || entry.message.role === "assistant"))).filter((event) => event.kind === "user" || event.kind === "assistantText") : [];
1900
- const projected = projectWithMetadata(source.events, retainedDialogue);
2094
+ const previousMarker = findLastCompaction(branchEntries)?.index;
2095
+ const freshEntryIds = previousMarker === void 0 ? void 0 : new Set(branchEntries.slice(previousMarker + 1).map((entry) => entry.id));
2096
+ const projected = projectWithMetadata(source.events, retainedDialogue, freshEntryIds ? { freshEntryIds } : {});
2097
+ const activity = userActivity(branchEntries);
1901
2098
  const sections = projected.sections;
1902
2099
  runEnrichers(enrichers, source.events, sections);
1903
2100
  const carryLines = carryRequestLines(carryItems ?? latestCarryItems(branchEntries));
@@ -1906,7 +2103,8 @@ var compileFabricSummary = (branchEntries, tokensBefore, enrichers = NO_BUILTIN_
1906
2103
  lastEntryId: source.range.last,
1907
2104
  lastTimestamp: source.timestamp,
1908
2105
  requestLines: instructions.requestLines,
1909
- ...carryLines.length > 0 ? { carryLines } : {}
2106
+ ...carryLines.length > 0 ? { carryLines } : {},
2107
+ ...activity ? { userActivity: userActivityLine(activity) } : {}
1910
2108
  });
1911
2109
  const { summary } = rendered;
1912
2110
  const projectedTokensAfter = cut.budget ? Math.ceil(
@@ -1930,7 +2128,9 @@ var compileFabricSummary = (branchEntries, tokensBefore, enrichers = NO_BUILTIN_
1930
2128
  ...instructions.requestLines.length > 0 ? ["[Compaction Request]"] : [],
1931
2129
  ...carryLines.length > 0 ? [CARRY_FORWARD_HEADER] : []
1932
2130
  ];
1933
- sectionHeaders.splice(sections.dialogue.length > 0 ? 1 : 0, 0, ...protectedHeaders);
2131
+ const userBlocks = (sections.goal.length > 0 ? 1 : 0) + (sections.dialogue.length > 0 ? 1 : 0);
2132
+ sectionHeaders.splice(userBlocks, 0, ...protectedHeaders);
2133
+ if (activity) sectionHeaders.unshift(USER_ACTIVITY_HEADER);
1934
2134
  const details = {
1935
2135
  compactor: "fabric",
1936
2136
  version: 2,
@@ -2089,6 +2289,7 @@ export {
2089
2289
  applyCarryUpdate,
2090
2290
  isCarryUpdate,
2091
2291
  sameCarryItems,
2292
+ latestRequestLine,
2092
2293
  rawContextTokens,
2093
2294
  computeCut,
2094
2295
  fabricCompactionVersion,
@@ -2097,4 +2298,4 @@ export {
2097
2298
  compactionHandlers,
2098
2299
  registerCompactionHook
2099
2300
  };
2100
- //# sourceMappingURL=chunk-3XT5WHSG.js.map
2301
+ //# sourceMappingURL=chunk-QAGEWWCJ.js.map