@e4779/pi-fabric 0.92.17-fork.3

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 (1044) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +181 -0
  3. package/THIRD_PARTY_NOTICES.md +33 -0
  4. package/dist/activity/store.d.ts +33 -0
  5. package/dist/activity/store.d.ts.map +1 -0
  6. package/dist/activity/types.d.ts +104 -0
  7. package/dist/activity/types.d.ts.map +1 -0
  8. package/dist/actors/binding-store.d.ts +17 -0
  9. package/dist/actors/binding-store.d.ts.map +1 -0
  10. package/dist/actors/context.d.ts +13 -0
  11. package/dist/actors/context.d.ts.map +1 -0
  12. package/dist/actors/delivery-policy.d.ts +8 -0
  13. package/dist/actors/delivery-policy.d.ts.map +1 -0
  14. package/dist/actors/directory.d.ts +47 -0
  15. package/dist/actors/directory.d.ts.map +1 -0
  16. package/dist/actors/global-registry.d.ts +47 -0
  17. package/dist/actors/global-registry.d.ts.map +1 -0
  18. package/dist/actors/host-event-observer.d.ts +5 -0
  19. package/dist/actors/host-event-observer.d.ts.map +1 -0
  20. package/dist/actors/host-event-payload.d.ts +14 -0
  21. package/dist/actors/host-event-payload.d.ts.map +1 -0
  22. package/dist/actors/log-store.d.ts +22 -0
  23. package/dist/actors/log-store.d.ts.map +1 -0
  24. package/dist/actors/manager.d.ts +175 -0
  25. package/dist/actors/manager.d.ts.map +1 -0
  26. package/dist/actors/mesh-monitor.d.ts +22 -0
  27. package/dist/actors/mesh-monitor.d.ts.map +1 -0
  28. package/dist/actors/predicate.d.ts +7 -0
  29. package/dist/actors/predicate.d.ts.map +1 -0
  30. package/dist/actors/registry-store.d.ts +15 -0
  31. package/dist/actors/registry-store.d.ts.map +1 -0
  32. package/dist/actors/types.d.ts +218 -0
  33. package/dist/actors/types.d.ts.map +1 -0
  34. package/dist/agents/bash-worktree-add.d.ts +24 -0
  35. package/dist/agents/bash-worktree-add.d.ts.map +1 -0
  36. package/dist/agents/budget-ledger.d.ts +88 -0
  37. package/dist/agents/budget-ledger.d.ts.map +1 -0
  38. package/dist/agents/claude-cli.d.ts +32 -0
  39. package/dist/agents/claude-cli.d.ts.map +1 -0
  40. package/dist/agents/claude-cli.js +17 -0
  41. package/dist/agents/claude-cli.js.map +7 -0
  42. package/dist/agents/clone-first-worktree.d.ts +17 -0
  43. package/dist/agents/clone-first-worktree.d.ts.map +1 -0
  44. package/dist/agents/compact-control.d.ts +32 -0
  45. package/dist/agents/compact-control.d.ts.map +1 -0
  46. package/dist/agents/compact-control.js +129 -0
  47. package/dist/agents/compact-control.js.map +7 -0
  48. package/dist/agents/constants.d.ts +9 -0
  49. package/dist/agents/constants.d.ts.map +1 -0
  50. package/dist/agents/cow-clone.d.ts +8 -0
  51. package/dist/agents/cow-clone.d.ts.map +1 -0
  52. package/dist/agents/handoff-completion.d.ts +4 -0
  53. package/dist/agents/handoff-completion.d.ts.map +1 -0
  54. package/dist/agents/handoff.d.ts +19 -0
  55. package/dist/agents/handoff.d.ts.map +1 -0
  56. package/dist/agents/lifecycle.d.ts +32 -0
  57. package/dist/agents/lifecycle.d.ts.map +1 -0
  58. package/dist/agents/manager.d.ts +75 -0
  59. package/dist/agents/manager.d.ts.map +1 -0
  60. package/dist/agents/pi-binary.d.ts +7 -0
  61. package/dist/agents/pi-binary.d.ts.map +1 -0
  62. package/dist/agents/request.d.ts +13 -0
  63. package/dist/agents/request.d.ts.map +1 -0
  64. package/dist/agents/result.d.ts +8 -0
  65. package/dist/agents/result.d.ts.map +1 -0
  66. package/dist/agents/result.js +9 -0
  67. package/dist/agents/result.js.map +7 -0
  68. package/dist/agents/rm.d.ts +15 -0
  69. package/dist/agents/rm.d.ts.map +1 -0
  70. package/dist/agents/semaphore.d.ts +7 -0
  71. package/dist/agents/semaphore.d.ts.map +1 -0
  72. package/dist/agents/service-provider.d.ts +9 -0
  73. package/dist/agents/service-provider.d.ts.map +1 -0
  74. package/dist/agents/service-schema.d.ts +6 -0
  75. package/dist/agents/service-schema.d.ts.map +1 -0
  76. package/dist/agents/service-types.d.ts +192 -0
  77. package/dist/agents/service-types.d.ts.map +1 -0
  78. package/dist/agents/service.d.ts +36 -0
  79. package/dist/agents/service.d.ts.map +1 -0
  80. package/dist/agents/session-export.d.ts +39 -0
  81. package/dist/agents/session-export.d.ts.map +1 -0
  82. package/dist/agents/session-pins.d.ts +24 -0
  83. package/dist/agents/session-pins.d.ts.map +1 -0
  84. package/dist/agents/thinking-transfer.d.ts +39 -0
  85. package/dist/agents/thinking-transfer.d.ts.map +1 -0
  86. package/dist/agents/transports/herdr-transport.d.ts +10 -0
  87. package/dist/agents/transports/herdr-transport.d.ts.map +1 -0
  88. package/dist/agents/transports/localterm-transport.d.ts +7 -0
  89. package/dist/agents/transports/localterm-transport.d.ts.map +1 -0
  90. package/dist/agents/transports/process-transport.d.ts +7 -0
  91. package/dist/agents/transports/process-transport.d.ts.map +1 -0
  92. package/dist/agents/transports/process-utils.d.ts +33 -0
  93. package/dist/agents/transports/process-utils.d.ts.map +1 -0
  94. package/dist/agents/transports/screen-transport.d.ts +7 -0
  95. package/dist/agents/transports/screen-transport.d.ts.map +1 -0
  96. package/dist/agents/transports/tmux-transport.d.ts +7 -0
  97. package/dist/agents/transports/tmux-transport.d.ts.map +1 -0
  98. package/dist/agents/types.d.ts +280 -0
  99. package/dist/agents/types.d.ts.map +1 -0
  100. package/dist/agents/veda-cli.d.ts +22 -0
  101. package/dist/agents/veda-cli.d.ts.map +1 -0
  102. package/dist/agents/veda-cli.js +13 -0
  103. package/dist/agents/veda-cli.js.map +7 -0
  104. package/dist/agents/worktree-manager.d.ts +14 -0
  105. package/dist/agents/worktree-manager.d.ts.map +1 -0
  106. package/dist/agents/worktree-paths.d.ts +5 -0
  107. package/dist/agents/worktree-paths.d.ts.map +1 -0
  108. package/dist/agents.d.ts +8 -0
  109. package/dist/agents.d.ts.map +1 -0
  110. package/dist/agents.js +761 -0
  111. package/dist/agents.js.map +7 -0
  112. package/dist/async-settlement.d.ts +4 -0
  113. package/dist/async-settlement.d.ts.map +1 -0
  114. package/dist/audit/details.d.ts +86 -0
  115. package/dist/audit/details.d.ts.map +1 -0
  116. package/dist/audit/index.d.ts +4 -0
  117. package/dist/audit/index.d.ts.map +1 -0
  118. package/dist/audit/projection.d.ts +20 -0
  119. package/dist/audit/projection.d.ts.map +1 -0
  120. package/dist/audit/trace.d.ts +99 -0
  121. package/dist/audit/trace.d.ts.map +1 -0
  122. package/dist/capture/catalog.d.ts +30 -0
  123. package/dist/capture/catalog.d.ts.map +1 -0
  124. package/dist/capture/interceptor.d.ts +20 -0
  125. package/dist/capture/interceptor.d.ts.map +1 -0
  126. package/dist/capture/wrapper.d.ts +15 -0
  127. package/dist/capture/wrapper.d.ts.map +1 -0
  128. package/dist/chunks/chunk-2DMJ7MEI.js +1984 -0
  129. package/dist/chunks/chunk-2DMJ7MEI.js.map +7 -0
  130. package/dist/chunks/chunk-2PZWDVJB.js +738 -0
  131. package/dist/chunks/chunk-2PZWDVJB.js.map +7 -0
  132. package/dist/chunks/chunk-2UQV52II.js +440 -0
  133. package/dist/chunks/chunk-2UQV52II.js.map +7 -0
  134. package/dist/chunks/chunk-32BNQ75J.js +1445 -0
  135. package/dist/chunks/chunk-32BNQ75J.js.map +7 -0
  136. package/dist/chunks/chunk-3H7SDWZI.js +467 -0
  137. package/dist/chunks/chunk-3H7SDWZI.js.map +7 -0
  138. package/dist/chunks/chunk-3MEHEH6B.js +41 -0
  139. package/dist/chunks/chunk-3MEHEH6B.js.map +7 -0
  140. package/dist/chunks/chunk-3QECYQGA.js +70 -0
  141. package/dist/chunks/chunk-3QECYQGA.js.map +7 -0
  142. package/dist/chunks/chunk-3WIGAX56.js +644 -0
  143. package/dist/chunks/chunk-3WIGAX56.js.map +7 -0
  144. package/dist/chunks/chunk-3YZUQESG.js +16 -0
  145. package/dist/chunks/chunk-3YZUQESG.js.map +7 -0
  146. package/dist/chunks/chunk-4JETKRFE.js +287 -0
  147. package/dist/chunks/chunk-4JETKRFE.js.map +7 -0
  148. package/dist/chunks/chunk-4SSMGBF4.js +93 -0
  149. package/dist/chunks/chunk-4SSMGBF4.js.map +7 -0
  150. package/dist/chunks/chunk-5SU3YXBS.js +15 -0
  151. package/dist/chunks/chunk-5SU3YXBS.js.map +7 -0
  152. package/dist/chunks/chunk-656HWVFU.js +409 -0
  153. package/dist/chunks/chunk-656HWVFU.js.map +7 -0
  154. package/dist/chunks/chunk-7A6NVHB5.js +1242 -0
  155. package/dist/chunks/chunk-7A6NVHB5.js.map +7 -0
  156. package/dist/chunks/chunk-7TB7NXSL.js +58 -0
  157. package/dist/chunks/chunk-7TB7NXSL.js.map +7 -0
  158. package/dist/chunks/chunk-AAHHYDTO.js +24 -0
  159. package/dist/chunks/chunk-AAHHYDTO.js.map +7 -0
  160. package/dist/chunks/chunk-ARLYAW2A.js +95 -0
  161. package/dist/chunks/chunk-ARLYAW2A.js.map +7 -0
  162. package/dist/chunks/chunk-AYBIR4YV.js +210 -0
  163. package/dist/chunks/chunk-AYBIR4YV.js.map +7 -0
  164. package/dist/chunks/chunk-BOTRGFQQ.js +87 -0
  165. package/dist/chunks/chunk-BOTRGFQQ.js.map +7 -0
  166. package/dist/chunks/chunk-CGPK5WHX.js +96 -0
  167. package/dist/chunks/chunk-CGPK5WHX.js.map +7 -0
  168. package/dist/chunks/chunk-CI56CW53.js +470 -0
  169. package/dist/chunks/chunk-CI56CW53.js.map +7 -0
  170. package/dist/chunks/chunk-CPSW2GW4.js +1466 -0
  171. package/dist/chunks/chunk-CPSW2GW4.js.map +7 -0
  172. package/dist/chunks/chunk-CQFP2RCP.js +64 -0
  173. package/dist/chunks/chunk-CQFP2RCP.js.map +7 -0
  174. package/dist/chunks/chunk-D5WKZONW.js +797 -0
  175. package/dist/chunks/chunk-D5WKZONW.js.map +7 -0
  176. package/dist/chunks/chunk-DLXPTBPL.js +151 -0
  177. package/dist/chunks/chunk-DLXPTBPL.js.map +7 -0
  178. package/dist/chunks/chunk-G4LADAYY.js +287 -0
  179. package/dist/chunks/chunk-G4LADAYY.js.map +7 -0
  180. package/dist/chunks/chunk-GXNR6NRU.js +447 -0
  181. package/dist/chunks/chunk-GXNR6NRU.js.map +7 -0
  182. package/dist/chunks/chunk-IGVDD2HT.js +10 -0
  183. package/dist/chunks/chunk-IGVDD2HT.js.map +7 -0
  184. package/dist/chunks/chunk-J2HV2URQ.js +1125 -0
  185. package/dist/chunks/chunk-J2HV2URQ.js.map +7 -0
  186. package/dist/chunks/chunk-KAD7UWT2.js +99 -0
  187. package/dist/chunks/chunk-KAD7UWT2.js.map +7 -0
  188. package/dist/chunks/chunk-KYXZJNV6.js +227 -0
  189. package/dist/chunks/chunk-KYXZJNV6.js.map +7 -0
  190. package/dist/chunks/chunk-LMAVZN7J.js +8 -0
  191. package/dist/chunks/chunk-LMAVZN7J.js.map +7 -0
  192. package/dist/chunks/chunk-M3S7XITB.js +110 -0
  193. package/dist/chunks/chunk-M3S7XITB.js.map +7 -0
  194. package/dist/chunks/chunk-MGDLRV2R.js +112 -0
  195. package/dist/chunks/chunk-MGDLRV2R.js.map +7 -0
  196. package/dist/chunks/chunk-MGWQOKBV.js +30 -0
  197. package/dist/chunks/chunk-MGWQOKBV.js.map +7 -0
  198. package/dist/chunks/chunk-N5GUXC6F.js +184 -0
  199. package/dist/chunks/chunk-N5GUXC6F.js.map +7 -0
  200. package/dist/chunks/chunk-NQOEHX62.js +215 -0
  201. package/dist/chunks/chunk-NQOEHX62.js.map +7 -0
  202. package/dist/chunks/chunk-OKOHRXGF.js +100 -0
  203. package/dist/chunks/chunk-OKOHRXGF.js.map +7 -0
  204. package/dist/chunks/chunk-OP2KTYQB.js +286 -0
  205. package/dist/chunks/chunk-OP2KTYQB.js.map +7 -0
  206. package/dist/chunks/chunk-OTCASLY2.js +52 -0
  207. package/dist/chunks/chunk-OTCASLY2.js.map +7 -0
  208. package/dist/chunks/chunk-PAN6C3JM.js +42 -0
  209. package/dist/chunks/chunk-PAN6C3JM.js.map +7 -0
  210. package/dist/chunks/chunk-PH7ZJ27F.js +6873 -0
  211. package/dist/chunks/chunk-PH7ZJ27F.js.map +7 -0
  212. package/dist/chunks/chunk-PM5I335G.js +225 -0
  213. package/dist/chunks/chunk-PM5I335G.js.map +7 -0
  214. package/dist/chunks/chunk-PSNXUZMY.js +218 -0
  215. package/dist/chunks/chunk-PSNXUZMY.js.map +7 -0
  216. package/dist/chunks/chunk-PXAICAUT.js +24 -0
  217. package/dist/chunks/chunk-PXAICAUT.js.map +7 -0
  218. package/dist/chunks/chunk-RERA6YWA.js +359 -0
  219. package/dist/chunks/chunk-RERA6YWA.js.map +7 -0
  220. package/dist/chunks/chunk-RNOPHITP.js +1720 -0
  221. package/dist/chunks/chunk-RNOPHITP.js.map +7 -0
  222. package/dist/chunks/chunk-RRGTKHXZ.js +931 -0
  223. package/dist/chunks/chunk-RRGTKHXZ.js.map +7 -0
  224. package/dist/chunks/chunk-SWB2OHYW.js +93 -0
  225. package/dist/chunks/chunk-SWB2OHYW.js.map +7 -0
  226. package/dist/chunks/chunk-T3A5GNCW.js +19 -0
  227. package/dist/chunks/chunk-T3A5GNCW.js.map +7 -0
  228. package/dist/chunks/chunk-TPLMVELH.js +118 -0
  229. package/dist/chunks/chunk-TPLMVELH.js.map +7 -0
  230. package/dist/chunks/chunk-TSRKCXNI.js +17 -0
  231. package/dist/chunks/chunk-TSRKCXNI.js.map +7 -0
  232. package/dist/chunks/chunk-U5FYOMG5.js +119 -0
  233. package/dist/chunks/chunk-U5FYOMG5.js.map +7 -0
  234. package/dist/chunks/chunk-U6CTHPZC.js +1924 -0
  235. package/dist/chunks/chunk-U6CTHPZC.js.map +7 -0
  236. package/dist/chunks/chunk-UDFDF7IY.js +1572 -0
  237. package/dist/chunks/chunk-UDFDF7IY.js.map +7 -0
  238. package/dist/chunks/chunk-UKMQK5VP.js +231 -0
  239. package/dist/chunks/chunk-UKMQK5VP.js.map +7 -0
  240. package/dist/chunks/chunk-UQ4LTUH4.js +2181 -0
  241. package/dist/chunks/chunk-UQ4LTUH4.js.map +7 -0
  242. package/dist/chunks/chunk-UTR3I23Z.js +65 -0
  243. package/dist/chunks/chunk-UTR3I23Z.js.map +7 -0
  244. package/dist/chunks/chunk-VPPIJRNZ.js +50 -0
  245. package/dist/chunks/chunk-VPPIJRNZ.js.map +7 -0
  246. package/dist/chunks/chunk-VRYEGVHR.js +195 -0
  247. package/dist/chunks/chunk-VRYEGVHR.js.map +7 -0
  248. package/dist/chunks/chunk-VRZNFNPB.js +4218 -0
  249. package/dist/chunks/chunk-VRZNFNPB.js.map +7 -0
  250. package/dist/chunks/chunk-VXZZJ44D.js +295 -0
  251. package/dist/chunks/chunk-VXZZJ44D.js.map +7 -0
  252. package/dist/chunks/chunk-W3FRE4VI.js +297 -0
  253. package/dist/chunks/chunk-W3FRE4VI.js.map +7 -0
  254. package/dist/chunks/chunk-WVH324VF.js +60 -0
  255. package/dist/chunks/chunk-WVH324VF.js.map +7 -0
  256. package/dist/chunks/chunk-X7G62ZGH.js +151 -0
  257. package/dist/chunks/chunk-X7G62ZGH.js.map +7 -0
  258. package/dist/chunks/chunk-XB3RJVT4.js +17 -0
  259. package/dist/chunks/chunk-XB3RJVT4.js.map +7 -0
  260. package/dist/chunks/chunk-XT4346N7.js +651 -0
  261. package/dist/chunks/chunk-XT4346N7.js.map +7 -0
  262. package/dist/chunks/chunk-Y7KNRAFL.js +1180 -0
  263. package/dist/chunks/chunk-Y7KNRAFL.js.map +7 -0
  264. package/dist/chunks/chunk-YK5AZ7CZ.js +692 -0
  265. package/dist/chunks/chunk-YK5AZ7CZ.js.map +7 -0
  266. package/dist/chunks/chunk-YU4O6SWQ.js +246 -0
  267. package/dist/chunks/chunk-YU4O6SWQ.js.map +7 -0
  268. package/dist/chunks/chunk-YU62DDKK.js +22 -0
  269. package/dist/chunks/chunk-YU62DDKK.js.map +7 -0
  270. package/dist/chunks/chunk-Z63R5GVN.js +121 -0
  271. package/dist/chunks/chunk-Z63R5GVN.js.map +7 -0
  272. package/dist/chunks/chunk-ZDNGXLEC.js +221 -0
  273. package/dist/chunks/chunk-ZDNGXLEC.js.map +7 -0
  274. package/dist/chunks/chunk-ZZ4LHQYJ.js +777 -0
  275. package/dist/chunks/chunk-ZZ4LHQYJ.js.map +7 -0
  276. package/dist/commands/fabric.d.ts +17 -0
  277. package/dist/commands/fabric.d.ts.map +1 -0
  278. package/dist/compaction/bounds.d.ts +23 -0
  279. package/dist/compaction/bounds.d.ts.map +1 -0
  280. package/dist/compaction/branch-details.d.ts +83 -0
  281. package/dist/compaction/branch-details.d.ts.map +1 -0
  282. package/dist/compaction/branch-summary.d.ts +9 -0
  283. package/dist/compaction/branch-summary.d.ts.map +1 -0
  284. package/dist/compaction/enrichers.d.ts +10 -0
  285. package/dist/compaction/enrichers.d.ts.map +1 -0
  286. package/dist/compaction/hook.d.ts +99 -0
  287. package/dist/compaction/hook.d.ts.map +1 -0
  288. package/dist/compaction/hook.js +22 -0
  289. package/dist/compaction/hook.js.map +7 -0
  290. package/dist/compaction/instructions.d.ts +38 -0
  291. package/dist/compaction/instructions.d.ts.map +1 -0
  292. package/dist/compaction/normalize.d.ts +83 -0
  293. package/dist/compaction/normalize.d.ts.map +1 -0
  294. package/dist/compaction/projections.d.ts +31 -0
  295. package/dist/compaction/projections.d.ts.map +1 -0
  296. package/dist/compaction/qa.d.ts +27 -0
  297. package/dist/compaction/qa.d.ts.map +1 -0
  298. package/dist/compaction/render.d.ts +10 -0
  299. package/dist/compaction/render.d.ts.map +1 -0
  300. package/dist/compaction/threshold.d.ts +5 -0
  301. package/dist/compaction/threshold.d.ts.map +1 -0
  302. package/dist/compaction/trace-events.d.ts +23 -0
  303. package/dist/compaction/trace-events.d.ts.map +1 -0
  304. package/dist/components/catalog.d.ts +25 -0
  305. package/dist/components/catalog.d.ts.map +1 -0
  306. package/dist/components/effect-policy.d.ts +21 -0
  307. package/dist/components/effect-policy.d.ts.map +1 -0
  308. package/dist/components/effect-scope.d.ts +31 -0
  309. package/dist/components/effect-scope.d.ts.map +1 -0
  310. package/dist/components/loader.d.ts +27 -0
  311. package/dist/components/loader.d.ts.map +1 -0
  312. package/dist/components/model-guidance.d.ts +48 -0
  313. package/dist/components/model-guidance.d.ts.map +1 -0
  314. package/dist/components/provider-component.d.ts +31 -0
  315. package/dist/components/provider-component.d.ts.map +1 -0
  316. package/dist/components/supervisor.d.ts +29 -0
  317. package/dist/components/supervisor.d.ts.map +1 -0
  318. package/dist/components/types.d.ts +140 -0
  319. package/dist/components/types.d.ts.map +1 -0
  320. package/dist/config-migrations.d.ts +11 -0
  321. package/dist/config-migrations.d.ts.map +1 -0
  322. package/dist/config.d.ts +282 -0
  323. package/dist/config.d.ts.map +1 -0
  324. package/dist/core/action-arguments.d.ts +12 -0
  325. package/dist/core/action-arguments.d.ts.map +1 -0
  326. package/dist/core/action-registry.d.ts +170 -0
  327. package/dist/core/action-registry.d.ts.map +1 -0
  328. package/dist/core/action-registry.js +20 -0
  329. package/dist/core/action-registry.js.map +7 -0
  330. package/dist/core/action-repair.d.ts +15 -0
  331. package/dist/core/action-repair.d.ts.map +1 -0
  332. package/dist/core/action-result.d.ts +13 -0
  333. package/dist/core/action-result.d.ts.map +1 -0
  334. package/dist/core/agent-dir.d.ts +2 -0
  335. package/dist/core/agent-dir.d.ts.map +1 -0
  336. package/dist/core/approval-controller.d.ts +31 -0
  337. package/dist/core/approval-controller.d.ts.map +1 -0
  338. package/dist/core/atomic-write.d.ts +15 -0
  339. package/dist/core/atomic-write.d.ts.map +1 -0
  340. package/dist/core/auto-approval-classifier.d.ts +17 -0
  341. package/dist/core/auto-approval-classifier.d.ts.map +1 -0
  342. package/dist/core/call-preview.d.ts +8 -0
  343. package/dist/core/call-preview.d.ts.map +1 -0
  344. package/dist/core/child-tool-allowlist.d.ts +3 -0
  345. package/dist/core/child-tool-allowlist.d.ts.map +1 -0
  346. package/dist/core/compact-controller.d.ts +42 -0
  347. package/dist/core/compact-controller.d.ts.map +1 -0
  348. package/dist/core/core-override-guidance.d.ts +7 -0
  349. package/dist/core/core-override-guidance.d.ts.map +1 -0
  350. package/dist/core/damaged-file.d.ts +6 -0
  351. package/dist/core/damaged-file.d.ts.map +1 -0
  352. package/dist/core/direct-tool-approval.d.ts +19 -0
  353. package/dist/core/direct-tool-approval.d.ts.map +1 -0
  354. package/dist/core/effect-conflict.d.ts +3 -0
  355. package/dist/core/effect-conflict.d.ts.map +1 -0
  356. package/dist/core/file-lock.d.ts +12 -0
  357. package/dist/core/file-lock.d.ts.map +1 -0
  358. package/dist/core/kernel-skills.d.ts +3 -0
  359. package/dist/core/kernel-skills.d.ts.map +1 -0
  360. package/dist/core/model-resolution.d.ts +62 -0
  361. package/dist/core/model-resolution.d.ts.map +1 -0
  362. package/dist/core/model-usage.d.ts +8 -0
  363. package/dist/core/model-usage.d.ts.map +1 -0
  364. package/dist/core/pi-arguments.d.ts +3 -0
  365. package/dist/core/pi-arguments.d.ts.map +1 -0
  366. package/dist/core/pi-bash-error.d.ts +9 -0
  367. package/dist/core/pi-bash-error.d.ts.map +1 -0
  368. package/dist/core/pi-tools.d.ts +9 -0
  369. package/dist/core/pi-tools.d.ts.map +1 -0
  370. package/dist/core/provider-bindings.d.ts +47 -0
  371. package/dist/core/provider-bindings.d.ts.map +1 -0
  372. package/dist/core/proxy-contract.d.ts +18 -0
  373. package/dist/core/proxy-contract.d.ts.map +1 -0
  374. package/dist/core/session-context.d.ts +14 -0
  375. package/dist/core/session-context.d.ts.map +1 -0
  376. package/dist/core/shell-jobs.d.ts +99 -0
  377. package/dist/core/shell-jobs.d.ts.map +1 -0
  378. package/dist/core/skill-block.d.ts +10 -0
  379. package/dist/core/skill-block.d.ts.map +1 -0
  380. package/dist/core/skill-dir.d.ts +4 -0
  381. package/dist/core/skill-dir.d.ts.map +1 -0
  382. package/dist/core/skill-prompt.d.ts +3 -0
  383. package/dist/core/skill-prompt.d.ts.map +1 -0
  384. package/dist/core/skill-references.d.ts +7 -0
  385. package/dist/core/skill-references.d.ts.map +1 -0
  386. package/dist/core/stable-hash.d.ts +3 -0
  387. package/dist/core/stable-hash.d.ts.map +1 -0
  388. package/dist/core/system-guidance.d.ts +13 -0
  389. package/dist/core/system-guidance.d.ts.map +1 -0
  390. package/dist/core/token-math.d.ts +16 -0
  391. package/dist/core/token-math.d.ts.map +1 -0
  392. package/dist/core/tool-ownership.d.ts +47 -0
  393. package/dist/core/tool-ownership.d.ts.map +1 -0
  394. package/dist/core/tool-result-proxy.d.ts +18 -0
  395. package/dist/core/tool-result-proxy.d.ts.map +1 -0
  396. package/dist/entropy/active.d.ts +9 -0
  397. package/dist/entropy/active.d.ts.map +1 -0
  398. package/dist/entropy/compiled-store.d.ts +16 -0
  399. package/dist/entropy/compiled-store.d.ts.map +1 -0
  400. package/dist/entropy/compiled-surface.d.ts +57 -0
  401. package/dist/entropy/compiled-surface.d.ts.map +1 -0
  402. package/dist/entropy/compiler.d.ts +27 -0
  403. package/dist/entropy/compiler.d.ts.map +1 -0
  404. package/dist/entropy/corpus.d.ts +22 -0
  405. package/dist/entropy/corpus.d.ts.map +1 -0
  406. package/dist/entropy/fingerprint.d.ts +9 -0
  407. package/dist/entropy/fingerprint.d.ts.map +1 -0
  408. package/dist/entropy/index.d.ts +16 -0
  409. package/dist/entropy/index.d.ts.map +1 -0
  410. package/dist/entropy/index.js +194 -0
  411. package/dist/entropy/index.js.map +7 -0
  412. package/dist/entropy/meter.d.ts +10 -0
  413. package/dist/entropy/meter.d.ts.map +1 -0
  414. package/dist/entropy/normal-form.d.ts +40 -0
  415. package/dist/entropy/normal-form.d.ts.map +1 -0
  416. package/dist/entropy/passes.d.ts +13 -0
  417. package/dist/entropy/passes.d.ts.map +1 -0
  418. package/dist/entropy/pool-store.d.ts +15 -0
  419. package/dist/entropy/pool-store.d.ts.map +1 -0
  420. package/dist/entropy/pool.d.ts +41 -0
  421. package/dist/entropy/pool.d.ts.map +1 -0
  422. package/dist/entropy/presentation.d.ts +12 -0
  423. package/dist/entropy/presentation.d.ts.map +1 -0
  424. package/dist/entropy/sessions.d.ts +47 -0
  425. package/dist/entropy/sessions.d.ts.map +1 -0
  426. package/dist/entropy/surface.d.ts +30 -0
  427. package/dist/entropy/surface.d.ts.map +1 -0
  428. package/dist/entropy/trial.d.ts +38 -0
  429. package/dist/entropy/trial.d.ts.map +1 -0
  430. package/dist/entropy/types.d.ts +181 -0
  431. package/dist/entropy/types.d.ts.map +1 -0
  432. package/dist/execution-service.d.ts +66 -0
  433. package/dist/execution-service.d.ts.map +1 -0
  434. package/dist/fabric-exec-arguments.d.ts +7 -0
  435. package/dist/fabric-exec-arguments.d.ts.map +1 -0
  436. package/dist/fabric-exec-tool.d.ts +8 -0
  437. package/dist/fabric-exec-tool.d.ts.map +1 -0
  438. package/dist/fabric-runtime-state.d.ts +96 -0
  439. package/dist/fabric-runtime-state.d.ts.map +1 -0
  440. package/dist/fabric-runtime-state.js +11928 -0
  441. package/dist/fabric-runtime-state.js.map +7 -0
  442. package/dist/fabric-state.d.ts +95 -0
  443. package/dist/fabric-state.d.ts.map +1 -0
  444. package/dist/failure-progress.d.ts +3 -0
  445. package/dist/failure-progress.d.ts.map +1 -0
  446. package/dist/host-compatibility.d.ts +5 -0
  447. package/dist/host-compatibility.d.ts.map +1 -0
  448. package/dist/index.d.ts +11 -0
  449. package/dist/index.d.ts.map +1 -0
  450. package/dist/index.js +6094 -0
  451. package/dist/index.js.map +7 -0
  452. package/dist/jev/auth.d.ts +5 -0
  453. package/dist/jev/auth.d.ts.map +1 -0
  454. package/dist/jev/browser.d.ts +37 -0
  455. package/dist/jev/browser.d.ts.map +1 -0
  456. package/dist/jev/browser.js +13 -0
  457. package/dist/jev/browser.js.map +7 -0
  458. package/dist/jev/client.d.ts +29 -0
  459. package/dist/jev/client.d.ts.map +1 -0
  460. package/dist/jev/client.js +11 -0
  461. package/dist/jev/client.js.map +7 -0
  462. package/dist/jev/config.d.ts +17 -0
  463. package/dist/jev/config.d.ts.map +1 -0
  464. package/dist/jev/guest-types.d.ts +2 -0
  465. package/dist/jev/guest-types.d.ts.map +1 -0
  466. package/dist/jev/manager.d.ts +36 -0
  467. package/dist/jev/manager.d.ts.map +1 -0
  468. package/dist/jev/observation.d.ts +59 -0
  469. package/dist/jev/observation.d.ts.map +1 -0
  470. package/dist/jev/observation.js +20 -0
  471. package/dist/jev/observation.js.map +7 -0
  472. package/dist/jev/types.d.ts +142 -0
  473. package/dist/jev/types.d.ts.map +1 -0
  474. package/dist/jev/validation.d.ts +8 -0
  475. package/dist/jev/validation.d.ts.map +1 -0
  476. package/dist/jev.d.ts +9 -0
  477. package/dist/jev.d.ts.map +1 -0
  478. package/dist/jev.js +49 -0
  479. package/dist/jev.js.map +7 -0
  480. package/dist/lifecycle/broker.d.ts +30 -0
  481. package/dist/lifecycle/broker.d.ts.map +1 -0
  482. package/dist/lifecycle/delivery-scheduler.d.ts +30 -0
  483. package/dist/lifecycle/delivery-scheduler.d.ts.map +1 -0
  484. package/dist/lifecycle/types.d.ts +91 -0
  485. package/dist/lifecycle/types.d.ts.map +1 -0
  486. package/dist/log-tail.d.ts +11 -0
  487. package/dist/log-tail.d.ts.map +1 -0
  488. package/dist/main-agent.d.ts +70 -0
  489. package/dist/main-agent.d.ts.map +1 -0
  490. package/dist/managed-host.d.ts +22 -0
  491. package/dist/managed-host.d.ts.map +1 -0
  492. package/dist/mcp.d.ts +9 -0
  493. package/dist/mcp.d.ts.map +1 -0
  494. package/dist/mcp.js +21 -0
  495. package/dist/mcp.js.map +7 -0
  496. package/dist/memory/client.d.ts +31 -0
  497. package/dist/memory/client.d.ts.map +1 -0
  498. package/dist/memory/context.d.ts +114 -0
  499. package/dist/memory/context.d.ts.map +1 -0
  500. package/dist/memory/digest.d.ts +48 -0
  501. package/dist/memory/digest.d.ts.map +1 -0
  502. package/dist/memory/digest.js +7 -0
  503. package/dist/memory/digest.js.map +7 -0
  504. package/dist/memory/discovery.d.ts +43 -0
  505. package/dist/memory/discovery.d.ts.map +1 -0
  506. package/dist/memory/discovery.js +25 -0
  507. package/dist/memory/discovery.js.map +7 -0
  508. package/dist/memory/expand-service.d.ts +4 -0
  509. package/dist/memory/expand-service.d.ts.map +1 -0
  510. package/dist/memory/host-source.d.ts +60 -0
  511. package/dist/memory/host-source.d.ts.map +1 -0
  512. package/dist/memory/index.d.ts +113 -0
  513. package/dist/memory/index.d.ts.map +1 -0
  514. package/dist/memory/lineage.d.ts +25 -0
  515. package/dist/memory/lineage.d.ts.map +1 -0
  516. package/dist/memory/normalize.d.ts +188 -0
  517. package/dist/memory/normalize.d.ts.map +1 -0
  518. package/dist/memory/normalize.js +26 -0
  519. package/dist/memory/normalize.js.map +7 -0
  520. package/dist/memory/portable.d.ts +66 -0
  521. package/dist/memory/portable.d.ts.map +1 -0
  522. package/dist/memory/provider.d.ts +15 -0
  523. package/dist/memory/provider.d.ts.map +1 -0
  524. package/dist/memory/recall-service.d.ts +5 -0
  525. package/dist/memory/recall-service.d.ts.map +1 -0
  526. package/dist/memory/regex.d.ts +19 -0
  527. package/dist/memory/regex.d.ts.map +1 -0
  528. package/dist/memory/request-cache.d.ts +49 -0
  529. package/dist/memory/request-cache.d.ts.map +1 -0
  530. package/dist/memory/request-context.d.ts +57 -0
  531. package/dist/memory/request-context.d.ts.map +1 -0
  532. package/dist/memory/request-limits.d.ts +8 -0
  533. package/dist/memory/request-limits.d.ts.map +1 -0
  534. package/dist/memory/search.d.ts +98 -0
  535. package/dist/memory/search.d.ts.map +1 -0
  536. package/dist/memory/search.js +24 -0
  537. package/dist/memory/search.js.map +7 -0
  538. package/dist/memory/sessions-service.d.ts +3 -0
  539. package/dist/memory/sessions-service.d.ts.map +1 -0
  540. package/dist/memory/source-observation.d.ts +28 -0
  541. package/dist/memory/source-observation.d.ts.map +1 -0
  542. package/dist/memory/tokenize.d.ts +24 -0
  543. package/dist/memory/tokenize.d.ts.map +1 -0
  544. package/dist/memory.d.ts +8 -0
  545. package/dist/memory.d.ts.map +1 -0
  546. package/dist/memory.js +119 -0
  547. package/dist/memory.js.map +7 -0
  548. package/dist/mesh/store.d.ts +78 -0
  549. package/dist/mesh/store.d.ts.map +1 -0
  550. package/dist/output-budget.d.ts +12 -0
  551. package/dist/output-budget.d.ts.map +1 -0
  552. package/dist/prewalk/arm.d.ts +8 -0
  553. package/dist/prewalk/arm.d.ts.map +1 -0
  554. package/dist/prewalk/controller.d.ts +66 -0
  555. package/dist/prewalk/controller.d.ts.map +1 -0
  556. package/dist/prewalk/fs-drift.d.ts +19 -0
  557. package/dist/prewalk/fs-drift.d.ts.map +1 -0
  558. package/dist/prewalk/handoff.d.ts +46 -0
  559. package/dist/prewalk/handoff.d.ts.map +1 -0
  560. package/dist/protocol.d.ts +275 -0
  561. package/dist/protocol.d.ts.map +1 -0
  562. package/dist/protocol.js +46 -0
  563. package/dist/protocol.js.map +7 -0
  564. package/dist/providers/agents-actions.d.ts +3 -0
  565. package/dist/providers/agents-actions.d.ts.map +1 -0
  566. package/dist/providers/agents-message-router.d.ts +29 -0
  567. package/dist/providers/agents-message-router.d.ts.map +1 -0
  568. package/dist/providers/agents-progress.d.ts +18 -0
  569. package/dist/providers/agents-progress.d.ts.map +1 -0
  570. package/dist/providers/agents-provider.d.ts +51 -0
  571. package/dist/providers/agents-provider.d.ts.map +1 -0
  572. package/dist/providers/arg-normalization.d.ts +15 -0
  573. package/dist/providers/arg-normalization.d.ts.map +1 -0
  574. package/dist/providers/captured-tools-provider.d.ts +23 -0
  575. package/dist/providers/captured-tools-provider.d.ts.map +1 -0
  576. package/dist/providers/compact-provider.d.ts +14 -0
  577. package/dist/providers/compact-provider.d.ts.map +1 -0
  578. package/dist/providers/components-provider.d.ts +12 -0
  579. package/dist/providers/components-provider.d.ts.map +1 -0
  580. package/dist/providers/jev-provider.d.ts +70 -0
  581. package/dist/providers/jev-provider.d.ts.map +1 -0
  582. package/dist/providers/jev-provider.js +28 -0
  583. package/dist/providers/jev-provider.js.map +7 -0
  584. package/dist/providers/mcp-descriptor-cache.d.ts +47 -0
  585. package/dist/providers/mcp-descriptor-cache.d.ts.map +1 -0
  586. package/dist/providers/mcp-provider.d.ts +47 -0
  587. package/dist/providers/mcp-provider.d.ts.map +1 -0
  588. package/dist/providers/memory-provider.d.ts +32 -0
  589. package/dist/providers/memory-provider.d.ts.map +1 -0
  590. package/dist/providers/memory-provider.js +23 -0
  591. package/dist/providers/memory-provider.js.map +7 -0
  592. package/dist/providers/mesh-provider.d.ts +17 -0
  593. package/dist/providers/mesh-provider.d.ts.map +1 -0
  594. package/dist/providers/pi-bash-cwd.d.ts +49 -0
  595. package/dist/providers/pi-bash-cwd.d.ts.map +1 -0
  596. package/dist/providers/pi-tools-provider.d.ts +25 -0
  597. package/dist/providers/pi-tools-provider.d.ts.map +1 -0
  598. package/dist/providers/schema-provider.d.ts +15 -0
  599. package/dist/providers/schema-provider.d.ts.map +1 -0
  600. package/dist/providers/state-provider.d.ts +16 -0
  601. package/dist/providers/state-provider.d.ts.map +1 -0
  602. package/dist/providers/write-diff-limits.d.ts +5 -0
  603. package/dist/providers/write-diff-limits.d.ts.map +1 -0
  604. package/dist/providers/write-preview.d.ts +3 -0
  605. package/dist/providers/write-preview.d.ts.map +1 -0
  606. package/dist/ref-names.d.ts +2 -0
  607. package/dist/ref-names.d.ts.map +1 -0
  608. package/dist/repairs/active.d.ts +7 -0
  609. package/dist/repairs/active.d.ts.map +1 -0
  610. package/dist/repairs/apply.d.ts +7 -0
  611. package/dist/repairs/apply.d.ts.map +1 -0
  612. package/dist/repairs/catalog-digest.d.ts +5 -0
  613. package/dist/repairs/catalog-digest.d.ts.map +1 -0
  614. package/dist/repairs/classify.d.ts +10 -0
  615. package/dist/repairs/classify.d.ts.map +1 -0
  616. package/dist/repairs/compiler.d.ts +33 -0
  617. package/dist/repairs/compiler.d.ts.map +1 -0
  618. package/dist/repairs/promote.d.ts +4 -0
  619. package/dist/repairs/promote.d.ts.map +1 -0
  620. package/dist/repairs/store.d.ts +10 -0
  621. package/dist/repairs/store.d.ts.map +1 -0
  622. package/dist/repairs/types.d.ts +49 -0
  623. package/dist/repairs/types.d.ts.map +1 -0
  624. package/dist/repeat-guard.d.ts +25 -0
  625. package/dist/repeat-guard.d.ts.map +1 -0
  626. package/dist/residency/actor-client.d.ts +16 -0
  627. package/dist/residency/actor-client.d.ts.map +1 -0
  628. package/dist/residency/actor-client.js +9 -0
  629. package/dist/residency/actor-client.js.map +7 -0
  630. package/dist/residency/client.d.ts +44 -0
  631. package/dist/residency/client.d.ts.map +1 -0
  632. package/dist/residency/host.d.ts +3 -0
  633. package/dist/residency/host.d.ts.map +1 -0
  634. package/dist/residency/host.js +32 -0
  635. package/dist/residency/host.js.map +7 -0
  636. package/dist/residency/launcher-owner.d.ts +7 -0
  637. package/dist/residency/launcher-owner.d.ts.map +1 -0
  638. package/dist/residency/launcher.d.ts +3 -0
  639. package/dist/residency/launcher.d.ts.map +1 -0
  640. package/dist/residency/launcher.js +154 -0
  641. package/dist/residency/launcher.js.map +7 -0
  642. package/dist/residency/pi-entry.d.ts +3 -0
  643. package/dist/residency/pi-entry.d.ts.map +1 -0
  644. package/dist/residency/pi-entry.js +48 -0
  645. package/dist/residency/pi-entry.js.map +7 -0
  646. package/dist/residency/protocol.d.ts +122 -0
  647. package/dist/residency/protocol.d.ts.map +1 -0
  648. package/dist/run-display.d.ts +3 -0
  649. package/dist/run-display.d.ts.map +1 -0
  650. package/dist/runtime/core-override-guest-types.d.ts +15 -0
  651. package/dist/runtime/core-override-guest-types.d.ts.map +1 -0
  652. package/dist/runtime/core-override-guest-types.js +9 -0
  653. package/dist/runtime/core-override-guest-types.js.map +7 -0
  654. package/dist/runtime/core-tool-properties.d.ts +6 -0
  655. package/dist/runtime/core-tool-properties.d.ts.map +1 -0
  656. package/dist/runtime/cpython-child-source.d.ts +2 -0
  657. package/dist/runtime/cpython-child-source.d.ts.map +1 -0
  658. package/dist/runtime/cpython-linux-sandbox.d.ts +2 -0
  659. package/dist/runtime/cpython-linux-sandbox.d.ts.map +1 -0
  660. package/dist/runtime/cpython-runtime.d.ts +9 -0
  661. package/dist/runtime/cpython-runtime.d.ts.map +1 -0
  662. package/dist/runtime/cpython-runtime.js +677 -0
  663. package/dist/runtime/cpython-runtime.js.map +7 -0
  664. package/dist/runtime/dynamic-guest-types.d.ts +3 -0
  665. package/dist/runtime/dynamic-guest-types.d.ts.map +1 -0
  666. package/dist/runtime/dynamic-guest-types.js +8 -0
  667. package/dist/runtime/dynamic-guest-types.js.map +7 -0
  668. package/dist/runtime/guest-code-repair.d.ts +2 -0
  669. package/dist/runtime/guest-code-repair.d.ts.map +1 -0
  670. package/dist/runtime/guest-stack-map.d.ts +11 -0
  671. package/dist/runtime/guest-stack-map.d.ts.map +1 -0
  672. package/dist/runtime/guest-types.d.ts +40 -0
  673. package/dist/runtime/guest-types.d.ts.map +1 -0
  674. package/dist/runtime/guest-types.js +13 -0
  675. package/dist/runtime/guest-types.js.map +7 -0
  676. package/dist/runtime/kernel.d.ts +30 -0
  677. package/dist/runtime/kernel.d.ts.map +1 -0
  678. package/dist/runtime/monty-bridge.d.ts +4 -0
  679. package/dist/runtime/monty-bridge.d.ts.map +1 -0
  680. package/dist/runtime/monty-runtime.d.ts +6 -0
  681. package/dist/runtime/monty-runtime.d.ts.map +1 -0
  682. package/dist/runtime/monty-runtime.js +485 -0
  683. package/dist/runtime/monty-runtime.js.map +7 -0
  684. package/dist/runtime/monty-source.d.ts +10 -0
  685. package/dist/runtime/monty-source.d.ts.map +1 -0
  686. package/dist/runtime/monty-values.d.ts +7 -0
  687. package/dist/runtime/monty-values.d.ts.map +1 -0
  688. package/dist/runtime/node-process-child-source.d.ts +2 -0
  689. package/dist/runtime/node-process-child-source.d.ts.map +1 -0
  690. package/dist/runtime/node-process-runtime.d.ts +10 -0
  691. package/dist/runtime/node-process-runtime.d.ts.map +1 -0
  692. package/dist/runtime/node-process-runtime.js +16 -0
  693. package/dist/runtime/node-process-runtime.js.map +7 -0
  694. package/dist/runtime/orchestration.d.ts +3 -0
  695. package/dist/runtime/orchestration.d.ts.map +1 -0
  696. package/dist/runtime/python-arguments.d.ts +2 -0
  697. package/dist/runtime/python-arguments.d.ts.map +1 -0
  698. package/dist/runtime/python-error-guidance.d.ts +6 -0
  699. package/dist/runtime/python-error-guidance.d.ts.map +1 -0
  700. package/dist/runtime/quickjs-runtime.d.ts +8 -0
  701. package/dist/runtime/quickjs-runtime.d.ts.map +1 -0
  702. package/dist/runtime/quickjs-runtime.js +15 -0
  703. package/dist/runtime/quickjs-runtime.js.map +7 -0
  704. package/dist/runtime/type-checker.d.ts +18 -0
  705. package/dist/runtime/type-checker.d.ts.map +1 -0
  706. package/dist/runtime/type-checker.js +11 -0
  707. package/dist/runtime/type-checker.js.map +7 -0
  708. package/dist/runtime/typescript-kernel.d.ts +14 -0
  709. package/dist/runtime/typescript-kernel.d.ts.map +1 -0
  710. package/dist/runtime/typescript-kernel.js +53 -0
  711. package/dist/runtime/typescript-kernel.js.map +7 -0
  712. package/dist/runtime-paths.d.ts +7 -0
  713. package/dist/runtime-paths.d.ts.map +1 -0
  714. package/dist/runtime-state-builtins.d.ts +26 -0
  715. package/dist/runtime-state-builtins.d.ts.map +1 -0
  716. package/dist/runtime-state-speculation.d.ts +16 -0
  717. package/dist/runtime-state-speculation.d.ts.map +1 -0
  718. package/dist/schema/controller.d.ts +35 -0
  719. package/dist/schema/controller.d.ts.map +1 -0
  720. package/dist/schema/policy.d.ts +2 -0
  721. package/dist/schema/policy.d.ts.map +1 -0
  722. package/dist/schema/types.d.ts +86 -0
  723. package/dist/schema/types.d.ts.map +1 -0
  724. package/dist/schema/workspace.d.ts +19 -0
  725. package/dist/schema/workspace.d.ts.map +1 -0
  726. package/dist/speculation/eligibility.d.ts +22 -0
  727. package/dist/speculation/eligibility.d.ts.map +1 -0
  728. package/dist/speculation/freshness.d.ts +10 -0
  729. package/dist/speculation/freshness.d.ts.map +1 -0
  730. package/dist/speculation/partial-json.d.ts +9 -0
  731. package/dist/speculation/partial-json.d.ts.map +1 -0
  732. package/dist/speculation/python-scanner.d.ts +7 -0
  733. package/dist/speculation/python-scanner.d.ts.map +1 -0
  734. package/dist/speculation/python-scanner.js +166 -0
  735. package/dist/speculation/python-scanner.js.map +7 -0
  736. package/dist/speculation/scanner.d.ts +13 -0
  737. package/dist/speculation/scanner.d.ts.map +1 -0
  738. package/dist/speculation/scanner.js +182 -0
  739. package/dist/speculation/scanner.js.map +7 -0
  740. package/dist/speculation/store.d.ts +41 -0
  741. package/dist/speculation/store.d.ts.map +1 -0
  742. package/dist/speculation/stream-tap.d.ts +30 -0
  743. package/dist/speculation/stream-tap.d.ts.map +1 -0
  744. package/dist/speculation/types.d.ts +44 -0
  745. package/dist/speculation/types.d.ts.map +1 -0
  746. package/dist/state/complexity.d.ts +13 -0
  747. package/dist/state/complexity.d.ts.map +1 -0
  748. package/dist/state/evidence-runner.d.ts +17 -0
  749. package/dist/state/evidence-runner.d.ts.map +1 -0
  750. package/dist/state/store.d.ts +76 -0
  751. package/dist/state/store.d.ts.map +1 -0
  752. package/dist/state/types.d.ts +165 -0
  753. package/dist/state/types.d.ts.map +1 -0
  754. package/dist/storage/retention.d.ts +22 -0
  755. package/dist/storage/retention.d.ts.map +1 -0
  756. package/dist/thinking.d.ts +19 -0
  757. package/dist/thinking.d.ts.map +1 -0
  758. package/dist/topology/control-plane.d.ts +58 -0
  759. package/dist/topology/control-plane.d.ts.map +1 -0
  760. package/dist/topology/participant-directory.d.ts +33 -0
  761. package/dist/topology/participant-directory.d.ts.map +1 -0
  762. package/dist/topology/peer-settle.d.ts +51 -0
  763. package/dist/topology/peer-settle.d.ts.map +1 -0
  764. package/dist/topology/records.d.ts +6 -0
  765. package/dist/topology/records.d.ts.map +1 -0
  766. package/dist/topology/types.d.ts +89 -0
  767. package/dist/topology/types.d.ts.map +1 -0
  768. package/dist/type-error-guidance.d.ts +3 -0
  769. package/dist/type-error-guidance.d.ts.map +1 -0
  770. package/dist/ui/arc-group.d.ts +17 -0
  771. package/dist/ui/arc-group.d.ts.map +1 -0
  772. package/dist/ui/border-status-editor.d.ts +22 -0
  773. package/dist/ui/border-status-editor.d.ts.map +1 -0
  774. package/dist/ui/code-preview-shell.d.ts +11 -0
  775. package/dist/ui/code-preview-shell.d.ts.map +1 -0
  776. package/dist/ui/code-preview.d.ts +53 -0
  777. package/dist/ui/code-preview.d.ts.map +1 -0
  778. package/dist/ui/controller.d.ts +20 -0
  779. package/dist/ui/controller.d.ts.map +1 -0
  780. package/dist/ui/conversation-chrome.d.ts +16 -0
  781. package/dist/ui/conversation-chrome.d.ts.map +1 -0
  782. package/dist/ui/conversation-chrome.js +11 -0
  783. package/dist/ui/conversation-chrome.js.map +7 -0
  784. package/dist/ui/conversation-commands.d.ts +12 -0
  785. package/dist/ui/conversation-commands.d.ts.map +1 -0
  786. package/dist/ui/conversation-history.d.ts +6 -0
  787. package/dist/ui/conversation-history.d.ts.map +1 -0
  788. package/dist/ui/conversation-host.d.ts +7 -0
  789. package/dist/ui/conversation-host.d.ts.map +1 -0
  790. package/dist/ui/conversation-host.js +9 -0
  791. package/dist/ui/conversation-host.js.map +7 -0
  792. package/dist/ui/conversation-native-reader-checkpoint.d.ts +8 -0
  793. package/dist/ui/conversation-native-reader-checkpoint.d.ts.map +1 -0
  794. package/dist/ui/conversation-native-reader-replay.d.ts +10 -0
  795. package/dist/ui/conversation-native-reader-replay.d.ts.map +1 -0
  796. package/dist/ui/conversation-native-reader.d.ts +110 -0
  797. package/dist/ui/conversation-native-reader.d.ts.map +1 -0
  798. package/dist/ui/conversation-native-reader.js +1050 -0
  799. package/dist/ui/conversation-native-reader.js.map +7 -0
  800. package/dist/ui/conversation-queue-store.d.ts +14 -0
  801. package/dist/ui/conversation-queue-store.d.ts.map +1 -0
  802. package/dist/ui/conversation-queue.d.ts +244 -0
  803. package/dist/ui/conversation-queue.d.ts.map +1 -0
  804. package/dist/ui/conversation-render.d.ts +104 -0
  805. package/dist/ui/conversation-render.d.ts.map +1 -0
  806. package/dist/ui/conversation-selection.d.ts +18 -0
  807. package/dist/ui/conversation-selection.d.ts.map +1 -0
  808. package/dist/ui/conversation-shortcut.d.ts +3 -0
  809. package/dist/ui/conversation-shortcut.d.ts.map +1 -0
  810. package/dist/ui/conversation-targets.d.ts +7 -0
  811. package/dist/ui/conversation-targets.d.ts.map +1 -0
  812. package/dist/ui/conversation-targets.js +12 -0
  813. package/dist/ui/conversation-targets.js.map +7 -0
  814. package/dist/ui/conversation-transcript.d.ts +25 -0
  815. package/dist/ui/conversation-transcript.d.ts.map +1 -0
  816. package/dist/ui/conversation.d.ts +219 -0
  817. package/dist/ui/conversation.d.ts.map +1 -0
  818. package/dist/ui/conversation.js +2861 -0
  819. package/dist/ui/conversation.js.map +7 -0
  820. package/dist/ui/core-tool-render.d.ts +20 -0
  821. package/dist/ui/core-tool-render.d.ts.map +1 -0
  822. package/dist/ui/dashboard-detail.d.ts +68 -0
  823. package/dist/ui/dashboard-detail.d.ts.map +1 -0
  824. package/dist/ui/dashboard-fabric-graph.d.ts +50 -0
  825. package/dist/ui/dashboard-fabric-graph.d.ts.map +1 -0
  826. package/dist/ui/dashboard-graph-controller.d.ts +52 -0
  827. package/dist/ui/dashboard-graph-controller.d.ts.map +1 -0
  828. package/dist/ui/dashboard-modal-controller.d.ts +36 -0
  829. package/dist/ui/dashboard-modal-controller.d.ts.map +1 -0
  830. package/dist/ui/dashboard-model.d.ts +111 -0
  831. package/dist/ui/dashboard-model.d.ts.map +1 -0
  832. package/dist/ui/dashboard-presentation.d.ts +6 -0
  833. package/dist/ui/dashboard-presentation.d.ts.map +1 -0
  834. package/dist/ui/dashboard.d.ts +156 -0
  835. package/dist/ui/dashboard.d.ts.map +1 -0
  836. package/dist/ui/dashboard.js +4622 -0
  837. package/dist/ui/dashboard.js.map +7 -0
  838. package/dist/ui/diff-background.d.ts +12 -0
  839. package/dist/ui/diff-background.d.ts.map +1 -0
  840. package/dist/ui/dynamic-border.d.ts +8 -0
  841. package/dist/ui/dynamic-border.d.ts.map +1 -0
  842. package/dist/ui/escape-halt.d.ts +11 -0
  843. package/dist/ui/escape-halt.d.ts.map +1 -0
  844. package/dist/ui/fabric-actor-delivery-selector.d.ts +17 -0
  845. package/dist/ui/fabric-actor-delivery-selector.d.ts.map +1 -0
  846. package/dist/ui/fabric-actor-tool-selector.d.ts +22 -0
  847. package/dist/ui/fabric-actor-tool-selector.d.ts.map +1 -0
  848. package/dist/ui/fabric-code-parser.d.ts +9 -0
  849. package/dist/ui/fabric-code-parser.d.ts.map +1 -0
  850. package/dist/ui/fabric-host-event-selector.d.ts +29 -0
  851. package/dist/ui/fabric-host-event-selector.d.ts.map +1 -0
  852. package/dist/ui/fabric-model-selector.d.ts +64 -0
  853. package/dist/ui/fabric-model-selector.d.ts.map +1 -0
  854. package/dist/ui/fabric-render.d.ts +113 -0
  855. package/dist/ui/fabric-render.d.ts.map +1 -0
  856. package/dist/ui/fabric-thinking-selector.d.ts +26 -0
  857. package/dist/ui/fabric-thinking-selector.d.ts.map +1 -0
  858. package/dist/ui/fabric-title-hint.d.ts +3 -0
  859. package/dist/ui/fabric-title-hint.d.ts.map +1 -0
  860. package/dist/ui/format.d.ts +9 -0
  861. package/dist/ui/format.d.ts.map +1 -0
  862. package/dist/ui/handoff-completion.d.ts +3 -0
  863. package/dist/ui/handoff-completion.d.ts.map +1 -0
  864. package/dist/ui/highlight.d.ts +69 -0
  865. package/dist/ui/highlight.d.ts.map +1 -0
  866. package/dist/ui/model-picker.d.ts +46 -0
  867. package/dist/ui/model-picker.d.ts.map +1 -0
  868. package/dist/ui/model-picker.js +17 -0
  869. package/dist/ui/model-picker.js.map +7 -0
  870. package/dist/ui/preview-lines.d.ts +16 -0
  871. package/dist/ui/preview-lines.d.ts.map +1 -0
  872. package/dist/ui/row-balance.d.ts +29 -0
  873. package/dist/ui/row-balance.d.ts.map +1 -0
  874. package/dist/ui/settings-component.d.ts +26 -0
  875. package/dist/ui/settings-component.d.ts.map +1 -0
  876. package/dist/ui/settings-rpc.d.ts +15 -0
  877. package/dist/ui/settings-rpc.d.ts.map +1 -0
  878. package/dist/ui/settings-section-context.d.ts +18 -0
  879. package/dist/ui/settings-section-context.d.ts.map +1 -0
  880. package/dist/ui/settings-sections-agents.d.ts +5 -0
  881. package/dist/ui/settings-sections-agents.d.ts.map +1 -0
  882. package/dist/ui/settings-sections-execution.d.ts +8 -0
  883. package/dist/ui/settings-sections-execution.d.ts.map +1 -0
  884. package/dist/ui/settings-sections-lifecycle.d.ts +6 -0
  885. package/dist/ui/settings-sections-lifecycle.d.ts.map +1 -0
  886. package/dist/ui/settings-sections-presentation.d.ts +6 -0
  887. package/dist/ui/settings-sections-presentation.d.ts.map +1 -0
  888. package/dist/ui/settings-sections.d.ts +12 -0
  889. package/dist/ui/settings-sections.d.ts.map +1 -0
  890. package/dist/ui/settings-submenus.d.ts +74 -0
  891. package/dist/ui/settings-submenus.d.ts.map +1 -0
  892. package/dist/ui/settings-values.d.ts +63 -0
  893. package/dist/ui/settings-values.d.ts.map +1 -0
  894. package/dist/ui/settings.d.ts +21 -0
  895. package/dist/ui/settings.d.ts.map +1 -0
  896. package/dist/ui/settings.js +1985 -0
  897. package/dist/ui/settings.js.map +7 -0
  898. package/dist/ui/shell-hang-keys.d.ts +11 -0
  899. package/dist/ui/shell-hang-keys.d.ts.map +1 -0
  900. package/dist/ui/shiki-language.d.ts +7 -0
  901. package/dist/ui/shiki-language.d.ts.map +1 -0
  902. package/dist/ui/shiki-theme.d.ts +7 -0
  903. package/dist/ui/shiki-theme.d.ts.map +1 -0
  904. package/dist/ui/snapshot.d.ts +17 -0
  905. package/dist/ui/snapshot.d.ts.map +1 -0
  906. package/dist/ui/spinner.d.ts +6 -0
  907. package/dist/ui/spinner.d.ts.map +1 -0
  908. package/dist/ui/state-file-preview.d.ts +13 -0
  909. package/dist/ui/state-file-preview.d.ts.map +1 -0
  910. package/dist/ui/structured.d.ts +9 -0
  911. package/dist/ui/structured.d.ts.map +1 -0
  912. package/dist/ui/tool-call-timing.d.ts +2 -0
  913. package/dist/ui/tool-call-timing.d.ts.map +1 -0
  914. package/dist/ui/tool-display.d.ts +8 -0
  915. package/dist/ui/tool-display.d.ts.map +1 -0
  916. package/dist/ui/topology.d.ts +162 -0
  917. package/dist/ui/topology.d.ts.map +1 -0
  918. package/dist/ui/transcript-parser.d.ts +18 -0
  919. package/dist/ui/transcript-parser.d.ts.map +1 -0
  920. package/dist/ui/transcript-reader.d.ts +10 -0
  921. package/dist/ui/transcript-reader.d.ts.map +1 -0
  922. package/dist/ui/transcript-sanitization.d.ts +14 -0
  923. package/dist/ui/transcript-sanitization.d.ts.map +1 -0
  924. package/dist/ui/transcript.d.ts +52 -0
  925. package/dist/ui/transcript.d.ts.map +1 -0
  926. package/dist/ui/types.d.ts +84 -0
  927. package/dist/ui/types.d.ts.map +1 -0
  928. package/dist/ui/widget.d.ts +16 -0
  929. package/dist/ui/widget.d.ts.map +1 -0
  930. package/dist/ui/word-diff/alignment.d.ts +6 -0
  931. package/dist/ui/word-diff/alignment.d.ts.map +1 -0
  932. package/dist/ui/word-diff/change-block.d.ts +18 -0
  933. package/dist/ui/word-diff/change-block.d.ts.map +1 -0
  934. package/dist/ui/word-diff/changed-line.d.ts +14 -0
  935. package/dist/ui/word-diff/changed-line.d.ts.map +1 -0
  936. package/dist/ui/word-diff/emphasis.d.ts +9 -0
  937. package/dist/ui/word-diff/emphasis.d.ts.map +1 -0
  938. package/dist/ui/word-diff/line-emphasis.d.ts +7 -0
  939. package/dist/ui/word-diff/line-emphasis.d.ts.map +1 -0
  940. package/dist/ui/word-diff/line-matching.d.ts +10 -0
  941. package/dist/ui/word-diff/line-matching.d.ts.map +1 -0
  942. package/dist/ui/word-diff/line-similarity.d.ts +16 -0
  943. package/dist/ui/word-diff/line-similarity.d.ts.map +1 -0
  944. package/dist/ui/word-diff/normalize.d.ts +3 -0
  945. package/dist/ui/word-diff/normalize.d.ts.map +1 -0
  946. package/dist/ui/word-diff/parse.d.ts +17 -0
  947. package/dist/ui/word-diff/parse.d.ts.map +1 -0
  948. package/dist/ui/word-diff/range-refinement.d.ts +5 -0
  949. package/dist/ui/word-diff/range-refinement.d.ts.map +1 -0
  950. package/dist/ui/word-diff/ranges.d.ts +11 -0
  951. package/dist/ui/word-diff/ranges.d.ts.map +1 -0
  952. package/dist/ui/word-diff/smart-filter.d.ts +3 -0
  953. package/dist/ui/word-diff/smart-filter.d.ts.map +1 -0
  954. package/dist/ui/word-diff/sparse-line-matching.d.ts +25 -0
  955. package/dist/ui/word-diff/sparse-line-matching.d.ts.map +1 -0
  956. package/dist/ui/word-diff/text-boundaries.d.ts +11 -0
  957. package/dist/ui/word-diff/text-boundaries.d.ts.map +1 -0
  958. package/dist/ui/word-diff/token-alignment.d.ts +9 -0
  959. package/dist/ui/word-diff/token-alignment.d.ts.map +1 -0
  960. package/dist/ui/word-diff/token-text-refinement.d.ts +4 -0
  961. package/dist/ui/word-diff/token-text-refinement.d.ts.map +1 -0
  962. package/dist/ui/word-diff/tokens.d.ts +16 -0
  963. package/dist/ui/word-diff/tokens.d.ts.map +1 -0
  964. package/dist/ui/word-diff/types.d.ts +10 -0
  965. package/dist/ui/word-diff/types.d.ts.map +1 -0
  966. package/dist/util.d.ts +3 -0
  967. package/dist/util.d.ts.map +1 -0
  968. package/dist/worker/model-control.d.ts +14 -0
  969. package/dist/worker/model-control.d.ts.map +1 -0
  970. package/dist/worker/model-control.js +118 -0
  971. package/dist/worker/model-control.js.map +7 -0
  972. package/dist/worker/options.d.ts +3 -0
  973. package/dist/worker/options.d.ts.map +1 -0
  974. package/dist/worker/options.js +156 -0
  975. package/dist/worker/options.js.map +7 -0
  976. package/dist/worker/run-record.d.ts +22 -0
  977. package/dist/worker/run-record.d.ts.map +1 -0
  978. package/dist/worker/run-record.js +124 -0
  979. package/dist/worker/run-record.js.map +7 -0
  980. package/dist/worker/session-export.d.ts +45 -0
  981. package/dist/worker/session-export.d.ts.map +1 -0
  982. package/dist/worker/session-export.js +91 -0
  983. package/dist/worker/session-export.js.map +7 -0
  984. package/dist/worker.d.ts +3 -0
  985. package/dist/worker.d.ts.map +1 -0
  986. package/dist/worker.js +1074 -0
  987. package/dist/worker.js.map +7 -0
  988. package/docs/agents.md +618 -0
  989. package/docs/architecture.md +141 -0
  990. package/docs/audit-trace.md +116 -0
  991. package/docs/certification.md +166 -0
  992. package/docs/compaction.md +345 -0
  993. package/docs/component-calculus.md +191 -0
  994. package/docs/components.md +330 -0
  995. package/docs/configuration.md +529 -0
  996. package/docs/entropy.md +214 -0
  997. package/docs/interface.md +210 -0
  998. package/docs/jev.md +289 -0
  999. package/docs/kernels.md +186 -0
  1000. package/docs/memory-recall.md +664 -0
  1001. package/docs/programmatic-compaction.md +205 -0
  1002. package/docs/provider-component-calculus.md +378 -0
  1003. package/docs/providers.md +163 -0
  1004. package/docs/repairs.md +90 -0
  1005. package/docs/residency-runtime.md +82 -0
  1006. package/docs/schema-enforcement.md +166 -0
  1007. package/docs/skills.md +50 -0
  1008. package/docs/speculation.md +171 -0
  1009. package/docs/state-layer.md +197 -0
  1010. package/package.json +135 -0
  1011. package/skillsets/python/fabric-advisor/SKILL.md +29 -0
  1012. package/skillsets/python/fabric-ambient/SKILL.md +44 -0
  1013. package/skillsets/python/fabric-ambient/references/setup.md +67 -0
  1014. package/skillsets/python/fabric-council/SKILL.md +54 -0
  1015. package/skillsets/python/fabric-exec/SKILL.md +74 -0
  1016. package/skillsets/python/fabric-exec/references/agents.md +65 -0
  1017. package/skillsets/python/fabric-exec/references/mcp.md +23 -0
  1018. package/skillsets/python/fabric-exec/references/mesh.md +27 -0
  1019. package/skillsets/python/fabric-fusion/SKILL.md +112 -0
  1020. package/skillsets/python/fabric-guide/SKILL.md +29 -0
  1021. package/skillsets/python/fabric-jev/SKILL.md +162 -0
  1022. package/skillsets/python/fabric-rlm/SKILL.md +120 -0
  1023. package/skillsets/python/fabric-schema/SKILL.md +55 -0
  1024. package/skillsets/python/fabric-spec/SKILL.md +42 -0
  1025. package/skillsets/python/fabric-supervisor/SKILL.md +37 -0
  1026. package/skillsets/python/fabric-swarm/SKILL.md +40 -0
  1027. package/skillsets/python/fabric-workflow/SKILL.md +62 -0
  1028. package/skillsets/typescript/fabric-advisor/SKILL.md +29 -0
  1029. package/skillsets/typescript/fabric-ambient/SKILL.md +44 -0
  1030. package/skillsets/typescript/fabric-ambient/references/setup.md +90 -0
  1031. package/skillsets/typescript/fabric-council/SKILL.md +94 -0
  1032. package/skillsets/typescript/fabric-exec/SKILL.md +142 -0
  1033. package/skillsets/typescript/fabric-exec/references/agents.md +218 -0
  1034. package/skillsets/typescript/fabric-exec/references/mcp.md +49 -0
  1035. package/skillsets/typescript/fabric-exec/references/mesh.md +51 -0
  1036. package/skillsets/typescript/fabric-fusion/SKILL.md +332 -0
  1037. package/skillsets/typescript/fabric-guide/SKILL.md +29 -0
  1038. package/skillsets/typescript/fabric-jev/SKILL.md +159 -0
  1039. package/skillsets/typescript/fabric-rlm/SKILL.md +284 -0
  1040. package/skillsets/typescript/fabric-schema/SKILL.md +121 -0
  1041. package/skillsets/typescript/fabric-spec/SKILL.md +42 -0
  1042. package/skillsets/typescript/fabric-supervisor/SKILL.md +37 -0
  1043. package/skillsets/typescript/fabric-swarm/SKILL.md +80 -0
  1044. package/skillsets/typescript/fabric-workflow/SKILL.md +133 -0
@@ -0,0 +1,1050 @@
1
+ import {
2
+ getConversationHost
3
+ } from "../chunks/chunk-5SU3YXBS.js";
4
+
5
+ // src/ui/conversation-native-reader.ts
6
+ import fs2 from "node:fs";
7
+
8
+ // src/ui/conversation-native-reader-replay.ts
9
+ var NativeReaderEventReplay = class {
10
+ #records = /* @__PURE__ */ new Map();
11
+ #partials = /* @__PURE__ */ new Map();
12
+ #queue;
13
+ #next = 0;
14
+ constructor(records = []) {
15
+ for (const record of records) this.append(record);
16
+ }
17
+ append(record) {
18
+ const index = this.#next++;
19
+ if (record.type === "queue_update") {
20
+ if (this.#queue !== void 0) this.#records.delete(this.#queue);
21
+ this.#queue = index;
22
+ }
23
+ if (typeof record.toolCallId === "string") {
24
+ const replacesPartial = record.type === "tool_execution_start" || record.type === "tool_execution_update" && record.partialResult !== null && typeof record.partialResult === "object";
25
+ if (replacesPartial) {
26
+ const previous = this.#partials.get(record.toolCallId);
27
+ if (previous !== void 0) this.#records.delete(previous);
28
+ this.#partials.delete(record.toolCallId);
29
+ if (record.type === "tool_execution_update") this.#partials.set(record.toolCallId, index);
30
+ }
31
+ }
32
+ this.#records.set(index, record);
33
+ }
34
+ records() {
35
+ return this.#records.values();
36
+ }
37
+ };
38
+
39
+ // src/ui/conversation-native-reader-checkpoint.ts
40
+ import fs from "node:fs";
41
+ import os from "node:os";
42
+ import path from "node:path";
43
+ import { createHash } from "node:crypto";
44
+ import { deserialize, serialize } from "node:v8";
45
+ var remove = (directory) => {
46
+ try {
47
+ fs.rmSync(directory, { recursive: true, force: true });
48
+ } catch {
49
+ }
50
+ };
51
+ var abandoned = new FinalizationRegistry(remove);
52
+ var digest = (data) => createHash("sha256").update(data).digest("hex");
53
+ var NativeReaderCheckpoint = class {
54
+ #directory;
55
+ #digest;
56
+ constructor(value) {
57
+ const data = serialize(value);
58
+ this.#digest = digest(data);
59
+ this.#directory = fs.mkdtempSync(path.join(os.tmpdir(), "pi-native-reader-"));
60
+ try {
61
+ fs.chmodSync(this.#directory, 448);
62
+ const temporary = path.join(this.#directory, "pending");
63
+ fs.writeFileSync(temporary, data, { flag: "wx", mode: 384 });
64
+ fs.renameSync(temporary, path.join(this.#directory, "checkpoint"));
65
+ } catch (error) {
66
+ remove(this.#directory);
67
+ throw error;
68
+ }
69
+ abandoned.register(this, this.#directory, this);
70
+ }
71
+ restore() {
72
+ const file = path.join(this.#directory, "checkpoint");
73
+ const descriptor = fs.openSync(file, fs.constants.O_RDONLY | (fs.constants.O_NOFOLLOW ?? 0));
74
+ try {
75
+ const data = fs.readFileSync(descriptor);
76
+ if (digest(data) !== this.#digest) throw new Error("reader checkpoint checksum mismatch");
77
+ return deserialize(data);
78
+ } finally {
79
+ fs.closeSync(descriptor);
80
+ }
81
+ }
82
+ dispose() {
83
+ remove(this.#directory);
84
+ abandoned.unregister(this);
85
+ }
86
+ };
87
+
88
+ // src/ui/conversation-native-reader.ts
89
+ var INITIAL_PAGE_BYTES = 256 * 1024;
90
+ var OLDER_PAGE_BYTES = 256 * 1024;
91
+ var GROWTH_PAGE_BYTES = 1024 * 1024;
92
+ var CLASSIFY_PROBE_BYTES = 4096;
93
+ var MAX_ERROR_CHARS = 200;
94
+ var emptyUsage = () => ({
95
+ input: 0,
96
+ output: 0,
97
+ cacheRead: 0,
98
+ cacheWrite: 0,
99
+ totalTokens: 0,
100
+ cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 }
101
+ });
102
+ var parseRecord = (raw) => {
103
+ try {
104
+ const parsed = JSON.parse(raw);
105
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) return void 0;
106
+ return parsed;
107
+ } catch {
108
+ return void 0;
109
+ }
110
+ };
111
+ var isSessionEntry = (value) => typeof value === "object" && value !== null && typeof value.type === "string" && typeof value.id === "string" && (value.parentId === null || typeof value.parentId === "string");
112
+ var messageFingerprint = (message) => {
113
+ if ("content" in message) return JSON.stringify(message.content);
114
+ if ("summary" in message) return JSON.stringify(message.summary);
115
+ return "";
116
+ };
117
+ var messageKey = (message) => {
118
+ if (message.role === "toolResult") return `toolResult:${message.toolCallId}`;
119
+ if (message.role === "assistant") {
120
+ const calls = message.content.filter((block) => block.type === "toolCall").map((block) => block.id);
121
+ if (calls.length > 0) return `assistant:${message.timestamp}:calls:${calls.join(",")}`;
122
+ }
123
+ return `${message.role}:${message.timestamp}:${messageFingerprint(message)}`;
124
+ };
125
+ var clipError = (error) => {
126
+ const text = error instanceof Error ? error.message : String(error);
127
+ return text.length > MAX_ERROR_CHARS ? `${text.slice(0, MAX_ERROR_CHARS)}\u2026` : text;
128
+ };
129
+ var readBackwardPage = (descriptor, end, budget, includeFinalPartialLine) => {
130
+ let windowBudget = Math.max(budget, 1);
131
+ for (; ; ) {
132
+ const candidate = Math.max(0, end - windowBudget);
133
+ const buffer = Buffer.allocUnsafe(end - candidate);
134
+ const bytesRead = fs2.readSync(descriptor, buffer, 0, buffer.length, candidate);
135
+ const data = buffer.subarray(0, Math.max(0, bytesRead));
136
+ if (data.length === 0) return { start: candidate, end: candidate, records: [] };
137
+ const firstNewline = data.indexOf(10);
138
+ if (firstNewline === -1) {
139
+ if (candidate === 0) {
140
+ const raw = data.toString("utf8").replace(/\r$/, "");
141
+ return includeFinalPartialLine && raw && parseRecord(raw) ? { start: 0, end, records: [raw] } : { start: 0, end: 0, records: [] };
142
+ }
143
+ windowBudget = Math.min(windowBudget * 2, end);
144
+ continue;
145
+ }
146
+ const alignStart = candidate > 0 ? firstNewline + 1 : 0;
147
+ const records = [];
148
+ let lineStart = alignStart;
149
+ let lastComplete = alignStart;
150
+ for (let index = alignStart; index < data.length; index++) {
151
+ if (data[index] !== 10) continue;
152
+ const raw = data.subarray(lineStart, index).toString("utf8").replace(/\r$/, "");
153
+ if (raw) records.push(raw);
154
+ lineStart = index + 1;
155
+ lastComplete = lineStart;
156
+ }
157
+ if (records.length === 0 && candidate > 0) {
158
+ windowBudget = Math.min(windowBudget * 2, end);
159
+ continue;
160
+ }
161
+ let endOffset = end;
162
+ if (lastComplete < data.length) {
163
+ const tail = data.subarray(lastComplete).toString("utf8").replace(/\r$/, "");
164
+ if (includeFinalPartialLine && tail && parseRecord(tail)) {
165
+ records.push(tail);
166
+ } else {
167
+ endOffset = candidate + lastComplete;
168
+ }
169
+ }
170
+ return { start: candidate + alignStart, end: endOffset, records };
171
+ }
172
+ };
173
+ var readForwardPage = (descriptor, start, size, budget) => {
174
+ let windowBudget = Math.max(budget, 1);
175
+ for (; ; ) {
176
+ const limit = Math.min(size, start + windowBudget);
177
+ if (limit <= start) return { start, end: start, records: [] };
178
+ const buffer = Buffer.allocUnsafe(limit - start);
179
+ const bytesRead = fs2.readSync(descriptor, buffer, 0, buffer.length, start);
180
+ const data = buffer.subarray(0, Math.max(0, bytesRead));
181
+ if (data.length === 0) return { start, end: start, records: [] };
182
+ const records = [];
183
+ let lineStart = 0;
184
+ let lastComplete = 0;
185
+ for (let index = 0; index < data.length; index++) {
186
+ if (data[index] !== 10) continue;
187
+ const raw = data.subarray(lineStart, index).toString("utf8").replace(/\r$/, "");
188
+ if (raw) records.push(raw);
189
+ lineStart = index + 1;
190
+ lastComplete = lineStart;
191
+ }
192
+ if (lastComplete < data.length) {
193
+ const tail = data.subarray(lastComplete).toString("utf8").replace(/\r$/, "");
194
+ if (limit >= size && tail && parseRecord(tail)) {
195
+ records.push(tail);
196
+ lastComplete = data.length;
197
+ }
198
+ }
199
+ if (lastComplete === 0 && limit < size) {
200
+ windowBudget = Math.min(windowBudget * 2, size - start);
201
+ continue;
202
+ }
203
+ return { start, end: start + lastComplete, records };
204
+ }
205
+ };
206
+ var classifyFile = (filePath) => {
207
+ let descriptor;
208
+ try {
209
+ const noFollow = typeof fs2.constants.O_NOFOLLOW === "number" ? fs2.constants.O_NOFOLLOW : 0;
210
+ descriptor = fs2.openSync(filePath, fs2.constants.O_RDONLY | noFollow);
211
+ const stat = fs2.fstatSync(descriptor);
212
+ if (!stat.isFile()) return "unreadable";
213
+ const buffer = Buffer.allocUnsafe(Math.max(1, Math.min(CLASSIFY_PROBE_BYTES, stat.size)));
214
+ const bytesRead = fs2.readSync(descriptor, buffer, 0, buffer.length, 0);
215
+ const head = buffer.subarray(0, Math.max(0, bytesRead)).toString("utf8");
216
+ const firstLine = head.split("\n", 1)[0] ?? "";
217
+ const parsed = parseRecord(firstLine);
218
+ return parsed?.type === "session" ? "session" : "events";
219
+ } catch {
220
+ return "unreadable";
221
+ } finally {
222
+ if (descriptor !== void 0) closeQuietly(descriptor);
223
+ }
224
+ };
225
+ var openDescriptor = (filePath) => {
226
+ try {
227
+ const noFollow = typeof fs2.constants.O_NOFOLLOW === "number" ? fs2.constants.O_NOFOLLOW : 0;
228
+ const descriptor = fs2.openSync(filePath, fs2.constants.O_RDONLY | noFollow);
229
+ const stat = fs2.fstatSync(descriptor);
230
+ if (!stat.isFile()) {
231
+ closeQuietly(descriptor);
232
+ return { error: "not a regular file" };
233
+ }
234
+ return { descriptor, size: stat.size };
235
+ } catch (error) {
236
+ return { error: clipError(error) };
237
+ }
238
+ };
239
+ var closeQuietly = (descriptor) => {
240
+ try {
241
+ fs2.closeSync(descriptor);
242
+ } catch {
243
+ }
244
+ };
245
+ var NativeConversationReader = class _NativeConversationReader {
246
+ #sourceId = "";
247
+ #status = "";
248
+ #sessionFile;
249
+ #eventsFile;
250
+ #entries = [];
251
+ #entryIds = /* @__PURE__ */ new Set();
252
+ #byId = /* @__PURE__ */ new Map();
253
+ #sessionEntryIds = /* @__PURE__ */ new Set();
254
+ #eventEntryIds = /* @__PURE__ */ new Set();
255
+ #sessionLeafId;
256
+ #eventLeafId;
257
+ #sessionId;
258
+ #streamed = /* @__PURE__ */ new Map();
259
+ #streamedOrder = [];
260
+ #partial;
261
+ #eventReplay = new NativeReaderEventReplay();
262
+ #pendingMessages;
263
+ #partialArgsRaw = /* @__PURE__ */ new Map();
264
+ #tools = /* @__PURE__ */ new Map();
265
+ #windows = /* @__PURE__ */ new Map();
266
+ #followed = true;
267
+ #revision = -1;
268
+ #error;
269
+ #snapshot;
270
+ #treeDirty = true;
271
+ #messagesDirty = true;
272
+ #streamingDirty = true;
273
+ #branch = [];
274
+ #branchMessages = [];
275
+ #messages = [];
276
+ #streaming = { active: false, tools: [] };
277
+ #pathComplete = false;
278
+ #persisted = /* @__PURE__ */ new Set();
279
+ #messageKeys = /* @__PURE__ */ new WeakMap();
280
+ #entryProjections = /* @__PURE__ */ new WeakMap();
281
+ #logClassification;
282
+ #checkpoint;
283
+ #suspendedMetadata;
284
+ #loadedRanges = /* @__PURE__ */ new Map();
285
+ /** Last transcript produced; undefined before the first successful read. */
286
+ get last() {
287
+ this.#resume();
288
+ return this.#snapshot;
289
+ }
290
+ /** True when decoded history is offloaded to a private disk checkpoint. */
291
+ get suspended() {
292
+ return this.#checkpoint !== void 0;
293
+ }
294
+ /** Release decoded history without depending on the original source files. */
295
+ suspend() {
296
+ if (this.#checkpoint) return true;
297
+ if (!this.#snapshot) return false;
298
+ let checkpoint;
299
+ try {
300
+ checkpoint = new NativeReaderCheckpoint(this.#captureState());
301
+ } catch {
302
+ return false;
303
+ }
304
+ const { messages: _messages, entries: _entries, streaming: _streaming, pendingMessages: _pending, ...metadata } = this.#snapshot;
305
+ this.#suspendedMetadata = metadata;
306
+ this.#checkpoint = checkpoint;
307
+ this.#dropDecodedState();
308
+ return true;
309
+ }
310
+ read(source, followLatest = true) {
311
+ const sourceId = typeof source?.id === "string" ? source.id : "";
312
+ const status = typeof source?.status === "string" ? source.status : "";
313
+ const explicitSession = typeof source?.sessionFile === "string" && source.sessionFile ? source.sessionFile : void 0;
314
+ const explicitEvents = typeof source?.eventsFile === "string" && source.eventsFile ? source.eventsFile : void 0;
315
+ const logFile = typeof source?.logFile === "string" ? source.logFile : void 0;
316
+ let sessionFile = explicitSession;
317
+ let eventsFile = explicitEvents;
318
+ let logUnresolved = false;
319
+ if (logFile && logFile !== explicitSession && logFile !== explicitEvents) {
320
+ const kind = this.#classifyLog(logFile);
321
+ if (kind === "session") sessionFile ??= logFile;
322
+ else if (kind === "events") eventsFile ??= logFile;
323
+ else logUnresolved = true;
324
+ }
325
+ if (sourceId === this.#sourceId && sessionFile === this.#sessionFile && !this.#resume()) {
326
+ this.#status = status;
327
+ this.#followed = followLatest !== false;
328
+ if (this.#suspendedMetadata) this.#suspendedMetadata = { ...this.#suspendedMetadata, status };
329
+ if (this.#snapshot.status !== status) {
330
+ this.#snapshot = { ...this.#snapshot, status, revision: ++this.#revision, updatedAt: Date.now() };
331
+ }
332
+ return this.#snapshot;
333
+ }
334
+ if (sourceId !== this.#sourceId || sessionFile !== this.#sessionFile) {
335
+ this.#resetPaths(sourceId, status, sessionFile, eventsFile);
336
+ } else {
337
+ this.#status = status;
338
+ if (eventsFile !== this.#eventsFile) {
339
+ this.#eventsFile = eventsFile;
340
+ this.#resetEventsState();
341
+ }
342
+ }
343
+ if (logUnresolved) {
344
+ this.#windows.set("events", { head: 0, tail: 0, size: 0, hasOlder: false, unavailable: true });
345
+ this.#setError(logFile ?? "source log unreadable");
346
+ }
347
+ this.#followed = followLatest !== false;
348
+ this.#ingest(this.#followed);
349
+ return this.#snapshot ?? this.#buildSnapshot();
350
+ }
351
+ /** Load older whole-record pages of history. Repeated calls load all of it. */
352
+ loadOlder(pages = 1) {
353
+ if (!this.#resume()) return this.#snapshot;
354
+ if (!this.#snapshot) return void 0;
355
+ for (let page = 0; page < Math.max(1, pages); page++) {
356
+ let progressed = false;
357
+ for (const [kind, filePath] of this.#windowFiles()) {
358
+ if (this.#loadOlderFile(kind, filePath)) progressed = true;
359
+ }
360
+ if (!progressed) break;
361
+ }
362
+ this.#snapshot = this.#buildSnapshot();
363
+ return this.#snapshot;
364
+ }
365
+ /** Consume any records newer than the current window (used when pinned). */
366
+ loadNewer() {
367
+ if (!this.#resume()) return this.#snapshot;
368
+ if (!this.#snapshot) return void 0;
369
+ this.#followed = true;
370
+ this.#ingest(true);
371
+ return this.#snapshot ?? void 0;
372
+ }
373
+ /** Drop the current windows and re-read from the tail of both files. */
374
+ loadLatest() {
375
+ if (!this.#resume()) return this.#snapshot;
376
+ if (!this.#snapshot) return void 0;
377
+ for (const [kind, filePath] of this.#windowFiles()) this.#initWindow(kind, filePath);
378
+ this.#followed = true;
379
+ this.#ingest(true);
380
+ return this.#snapshot ?? void 0;
381
+ }
382
+ /** Drop all cached state for a clean re-read. */
383
+ clear() {
384
+ this.#resetPaths("", "", void 0, void 0);
385
+ }
386
+ #captureState() {
387
+ return {
388
+ entries: this.#entries,
389
+ sessionEntryIds: [...this.#sessionEntryIds],
390
+ eventEntryIds: [...this.#eventEntryIds],
391
+ streamed: this.#streamedOrder.map((key) => this.#streamed.get(key)),
392
+ partial: this.#partial,
393
+ pendingMessages: this.#pendingMessages,
394
+ partialArgsRaw: [...this.#partialArgsRaw],
395
+ tools: [...this.#tools.values()],
396
+ eventRecords: [...this.#eventReplay.records()]
397
+ };
398
+ }
399
+ #dropDecodedState() {
400
+ this.#entries = [];
401
+ this.#entryIds.clear();
402
+ this.#byId.clear();
403
+ this.#sessionEntryIds.clear();
404
+ this.#eventEntryIds.clear();
405
+ this.#eventReplay = new NativeReaderEventReplay();
406
+ this.#resetStreamingState();
407
+ this.#treeDirty = true;
408
+ this.#pathComplete = false;
409
+ this.#branch = [];
410
+ this.#branchMessages = [];
411
+ this.#messages = [];
412
+ this.#persisted.clear();
413
+ this.#messageKeys = /* @__PURE__ */ new WeakMap();
414
+ this.#entryProjections = /* @__PURE__ */ new WeakMap();
415
+ this.#snapshot = void 0;
416
+ }
417
+ #restoreState(state) {
418
+ this.#dropDecodedState();
419
+ this.#entries = state.entries;
420
+ for (const entry of state.entries) {
421
+ this.#entryIds.add(entry.id);
422
+ this.#byId.set(entry.id, entry);
423
+ }
424
+ for (const id of state.sessionEntryIds) this.#sessionEntryIds.add(id);
425
+ for (const id of state.eventEntryIds) this.#eventEntryIds.add(id);
426
+ for (const message of state.streamed) this.#foldMessage(message);
427
+ this.#partial = state.partial;
428
+ this.#pendingMessages = state.pendingMessages;
429
+ for (const [index, raw] of state.partialArgsRaw) this.#partialArgsRaw.set(index, raw);
430
+ for (const tool of state.tools) this.#tools.set(tool.toolCallId, tool);
431
+ this.#eventReplay = new NativeReaderEventReplay(state.eventRecords);
432
+ }
433
+ #rememberRange(kind, page) {
434
+ if (page.end <= page.start) return;
435
+ const ranges = [...this.#loadedRanges.get(kind) ?? [], [page.start, page.end]];
436
+ ranges.sort((a, b) => a[0] - b[0]);
437
+ const merged = [];
438
+ for (const range of ranges) {
439
+ const previous = merged.at(-1);
440
+ if (previous && range[0] <= previous[1]) previous[1] = Math.max(previous[1], range[1]);
441
+ else merged.push([...range]);
442
+ }
443
+ this.#loadedRanges.set(kind, merged);
444
+ }
445
+ #restoreLoadedRanges() {
446
+ const restored = new _NativeConversationReader();
447
+ for (const [kind, filePath] of this.#windowFiles()) {
448
+ const ranges = this.#loadedRanges.get(kind);
449
+ if (!ranges?.length) continue;
450
+ const opened = openDescriptor(filePath);
451
+ if (!opened || "error" in opened) throw new Error(`${filePath}: ${opened?.error ?? "unavailable"}`);
452
+ try {
453
+ for (const [head, tail] of ranges) {
454
+ if (opened.size < tail) throw new Error(`${filePath}: loaded range no longer available`);
455
+ let offset = head;
456
+ while (offset < tail) {
457
+ const page = readForwardPage(opened.descriptor, offset, tail, GROWTH_PAGE_BYTES);
458
+ if (page.end <= offset) throw new Error(`${filePath}: incomplete loaded range`);
459
+ restored.#applyRecords(kind, page.records, true);
460
+ offset = page.end;
461
+ }
462
+ }
463
+ } finally {
464
+ closeQuietly(opened.descriptor);
465
+ }
466
+ }
467
+ return restored.#captureState();
468
+ }
469
+ #resume() {
470
+ const checkpoint = this.#checkpoint;
471
+ if (!checkpoint) return true;
472
+ let state;
473
+ try {
474
+ try {
475
+ state = checkpoint.restore();
476
+ } catch {
477
+ state = this.#restoreLoadedRanges();
478
+ }
479
+ } catch (error) {
480
+ const reason = clipError(`Unable to restore reader history: ${clipError(error)}`);
481
+ if (this.#snapshot?.error !== reason) {
482
+ this.#snapshot = {
483
+ ...this.#suspendedMetadata,
484
+ messages: [],
485
+ entries: [],
486
+ streaming: { active: false, tools: [] },
487
+ revision: ++this.#revision,
488
+ unavailable: {
489
+ ...this.#sessionFile ? { sessionFile: true } : {},
490
+ ...this.#eventsFile ? { eventsFile: true } : {}
491
+ },
492
+ error: reason,
493
+ updatedAt: Date.now()
494
+ };
495
+ }
496
+ return false;
497
+ }
498
+ this.#restoreState(state);
499
+ this.#checkpoint = void 0;
500
+ this.#suspendedMetadata = void 0;
501
+ checkpoint.dispose();
502
+ this.#snapshot = this.#buildSnapshot();
503
+ return true;
504
+ }
505
+ #windowFiles() {
506
+ const files = [];
507
+ if (this.#sessionFile) files.push(["session", this.#sessionFile]);
508
+ if (this.#eventsFile) files.push(["events", this.#eventsFile]);
509
+ return files;
510
+ }
511
+ #setError(detail) {
512
+ this.#error = clipError(detail);
513
+ }
514
+ #resetPaths(sourceId, status, sessionFile, eventsFile) {
515
+ this.#checkpoint?.dispose();
516
+ this.#checkpoint = void 0;
517
+ this.#suspendedMetadata = void 0;
518
+ this.#loadedRanges.clear();
519
+ this.#sourceId = sourceId;
520
+ this.#status = status;
521
+ this.#sessionFile = sessionFile;
522
+ this.#eventsFile = eventsFile;
523
+ this.#entries = [];
524
+ this.#entryIds.clear();
525
+ this.#byId.clear();
526
+ this.#sessionEntryIds.clear();
527
+ this.#eventEntryIds.clear();
528
+ this.#sessionLeafId = void 0;
529
+ this.#eventLeafId = void 0;
530
+ this.#sessionId = void 0;
531
+ this.#eventReplay = new NativeReaderEventReplay();
532
+ this.#resetStreamingState();
533
+ this.#windows.clear();
534
+ this.#treeDirty = true;
535
+ this.#messagesDirty = true;
536
+ this.#branch = [];
537
+ this.#branchMessages = [];
538
+ this.#messages = [];
539
+ this.#persisted.clear();
540
+ this.#messageKeys = /* @__PURE__ */ new WeakMap();
541
+ this.#entryProjections = /* @__PURE__ */ new WeakMap();
542
+ this.#error = void 0;
543
+ this.#snapshot = void 0;
544
+ for (const [kind, filePath] of this.#windowFiles()) this.#initWindow(kind, filePath);
545
+ }
546
+ #resetStreamingState() {
547
+ this.#messagesDirty = true;
548
+ this.#streamingDirty = true;
549
+ this.#streaming = { active: false, tools: [] };
550
+ this.#pendingMessages = void 0;
551
+ this.#streamed.clear();
552
+ this.#streamedOrder = [];
553
+ this.#partial = void 0;
554
+ this.#partialArgsRaw.clear();
555
+ this.#tools.clear();
556
+ }
557
+ #resetEventsState() {
558
+ this.#treeDirty = true;
559
+ this.#eventReplay = new NativeReaderEventReplay();
560
+ this.#resetStreamingState();
561
+ this.#eventLeafId = void 0;
562
+ for (const id of this.#eventEntryIds) {
563
+ if (this.#sessionEntryIds.has(id)) continue;
564
+ this.#entryIds.delete(id);
565
+ const entry = this.#byId.get(id);
566
+ if (entry) {
567
+ this.#byId.delete(id);
568
+ const index = this.#entries.indexOf(entry);
569
+ if (index >= 0) this.#entries.splice(index, 1);
570
+ }
571
+ }
572
+ this.#eventEntryIds.clear();
573
+ this.#windows.delete("events");
574
+ this.#loadedRanges.delete("events");
575
+ this.#error = void 0;
576
+ if (this.#eventsFile) this.#initWindow("events", this.#eventsFile);
577
+ }
578
+ #initWindow(kind, filePath) {
579
+ const opened = openDescriptor(filePath);
580
+ if (!opened || "error" in opened) {
581
+ this.#windows.set(kind, {
582
+ head: 0,
583
+ tail: 0,
584
+ size: 0,
585
+ hasOlder: false,
586
+ unavailable: true
587
+ });
588
+ if (opened && "error" in opened) this.#setError(`${filePath}: ${opened.error}`);
589
+ return;
590
+ }
591
+ try {
592
+ const page = readBackwardPage(opened.descriptor, opened.size, INITIAL_PAGE_BYTES, kind === "events");
593
+ this.#applyRecords(kind, page.records, true);
594
+ this.#rememberRange(kind, page);
595
+ this.#windows.set(kind, {
596
+ head: page.start,
597
+ tail: page.end,
598
+ size: opened.size,
599
+ hasOlder: page.start > 0,
600
+ unavailable: false
601
+ });
602
+ } catch (error) {
603
+ this.#windows.set(kind, {
604
+ head: 0,
605
+ tail: 0,
606
+ size: 0,
607
+ hasOlder: false,
608
+ unavailable: true
609
+ });
610
+ this.#setError(`${filePath}: ${clipError(error)}`);
611
+ } finally {
612
+ closeQuietly(opened.descriptor);
613
+ }
614
+ }
615
+ #loadOlderFile(kind, filePath) {
616
+ const window = this.#windows.get(kind);
617
+ if (!window || !window.hasOlder || window.head <= 0) return false;
618
+ const opened = openDescriptor(filePath);
619
+ if (!opened) return false;
620
+ if ("error" in opened) {
621
+ window.unavailable = true;
622
+ this.#setError(`${filePath}: ${opened.error}`);
623
+ return false;
624
+ }
625
+ try {
626
+ const page = readBackwardPage(opened.descriptor, window.head, OLDER_PAGE_BYTES, false);
627
+ if (page.start >= window.head) return false;
628
+ this.#applyRecords(kind, page.records, false);
629
+ this.#rememberRange(kind, page);
630
+ window.head = page.start;
631
+ window.hasOlder = page.start > 0;
632
+ window.unavailable = false;
633
+ return true;
634
+ } finally {
635
+ closeQuietly(opened.descriptor);
636
+ }
637
+ }
638
+ #growFile(kind, filePath, followLatest) {
639
+ const window = this.#windows.get(kind);
640
+ if (!window) return false;
641
+ const opened = openDescriptor(filePath);
642
+ if (!opened) return false;
643
+ if ("error" in opened) {
644
+ window.unavailable = true;
645
+ this.#setError(`${filePath}: ${opened.error}`);
646
+ return false;
647
+ }
648
+ try {
649
+ window.size = opened.size;
650
+ window.unavailable = false;
651
+ if (!followLatest || opened.size <= window.tail) return false;
652
+ const page = readForwardPage(opened.descriptor, window.tail, opened.size, GROWTH_PAGE_BYTES);
653
+ if (page.end <= window.tail) return false;
654
+ this.#applyRecords(kind, page.records, true);
655
+ this.#rememberRange(kind, page);
656
+ window.tail = Math.max(window.tail, page.end);
657
+ return true;
658
+ } finally {
659
+ closeQuietly(opened.descriptor);
660
+ }
661
+ }
662
+ #ingest(followLatest) {
663
+ for (const [kind, filePath] of this.#windowFiles()) {
664
+ this.#growFile(kind, filePath, followLatest);
665
+ }
666
+ this.#snapshot = this.#buildSnapshot();
667
+ }
668
+ #applyRecords(kind, records, updateLeaf) {
669
+ const parsed = records.map(parseRecord).filter((record) => record !== void 0);
670
+ if (kind === "session") {
671
+ for (const record of parsed) this.#applySessionRecord(record, updateLeaf);
672
+ return;
673
+ }
674
+ if (updateLeaf) {
675
+ for (const record of parsed) {
676
+ this.#eventReplay.append(record);
677
+ this.#applyEventRecord(record);
678
+ }
679
+ } else {
680
+ const replay = new NativeReaderEventReplay(parsed);
681
+ for (const record of this.#eventReplay.records()) replay.append(record);
682
+ this.#eventReplay = replay;
683
+ this.#resetStreamingState();
684
+ this.#eventLeafId = void 0;
685
+ for (const record of replay.records()) this.#applyEventRecord(record);
686
+ }
687
+ }
688
+ #applySessionRecord(record, updateLeaf) {
689
+ if (record.type === "session") {
690
+ if (typeof record.id === "string") this.#sessionId = record.id;
691
+ return;
692
+ }
693
+ if (!isSessionEntry(record)) return;
694
+ this.#appendEntry(record, "session", updateLeaf);
695
+ }
696
+ // Entry list order is irrelevant: path construction walks byId from the leaf,
697
+ // so older pages and live folds can append in any order.
698
+ #appendEntry(entry, origin, updateLeaf = true) {
699
+ this.#treeDirty = true;
700
+ this.#messagesDirty = true;
701
+ if (this.#entryIds.has(entry.id)) {
702
+ const existing = this.#byId.get(entry.id);
703
+ if (existing && existing !== entry) {
704
+ const replacement = { ...existing, ...entry };
705
+ this.#entries[this.#entries.indexOf(existing)] = replacement;
706
+ this.#byId.set(entry.id, replacement);
707
+ }
708
+ (origin === "session" ? this.#sessionEntryIds : this.#eventEntryIds).add(entry.id);
709
+ if (updateLeaf) {
710
+ if (origin === "session") this.#sessionLeafId = entry.id;
711
+ else this.#eventLeafId = entry.id;
712
+ }
713
+ return;
714
+ }
715
+ this.#entryIds.add(entry.id);
716
+ this.#byId.set(entry.id, entry);
717
+ (origin === "session" ? this.#sessionEntryIds : this.#eventEntryIds).add(entry.id);
718
+ this.#entries.push(entry);
719
+ if (!updateLeaf) return;
720
+ if (origin === "session") this.#sessionLeafId = entry.id;
721
+ else this.#eventLeafId = entry.id;
722
+ }
723
+ #applyEventRecord(event) {
724
+ switch (event.type) {
725
+ case "queue_update": {
726
+ const strings = (value) => Array.isArray(value) ? value.filter((item) => typeof item === "string") : [];
727
+ this.#pendingMessages = { steering: strings(event.steering), followUp: strings(event.followUp) };
728
+ return;
729
+ }
730
+ case "message_start": {
731
+ const message = event.message;
732
+ if (!message || typeof message !== "object") return;
733
+ if (message.role === "assistant") {
734
+ this.#streamingDirty = true;
735
+ this.#partial = {
736
+ ...message,
737
+ content: message.content.map((part) => ({ ...part })),
738
+ usage: message.usage ?? emptyUsage(),
739
+ stopReason: message.stopReason && message.stopReason !== "pending" ? message.stopReason : "pending"
740
+ };
741
+ } else {
742
+ this.#foldMessage(message);
743
+ }
744
+ return;
745
+ }
746
+ case "message_update":
747
+ this.#applyPartialDelta(event);
748
+ return;
749
+ case "message_end": {
750
+ const message = event.message;
751
+ if (!message || typeof message !== "object") return;
752
+ if (message.role === "assistant") {
753
+ this.#streamingDirty = true;
754
+ this.#partial = void 0;
755
+ this.#partialArgsRaw.clear();
756
+ }
757
+ this.#foldMessage(message);
758
+ return;
759
+ }
760
+ case "tool_execution_start": {
761
+ if (typeof event.toolCallId !== "string") return;
762
+ this.#streamingDirty = true;
763
+ const args = event.args;
764
+ this.#tools.set(event.toolCallId, {
765
+ toolCallId: event.toolCallId,
766
+ toolName: typeof event.toolName === "string" ? event.toolName : "",
767
+ ...args !== void 0 ? { args } : {},
768
+ status: "running",
769
+ executionStarted: true,
770
+ argsComplete: true
771
+ });
772
+ return;
773
+ }
774
+ case "tool_execution_update": {
775
+ const tool = this.#toolFor(event);
776
+ if (!tool) return;
777
+ this.#streamingDirty = true;
778
+ const partial = event.partialResult;
779
+ if (partial && typeof partial === "object") {
780
+ tool.partial = {
781
+ ...Array.isArray(partial.content) ? { content: partial.content } : {},
782
+ ...partial.details !== void 0 ? { details: partial.details } : {}
783
+ };
784
+ }
785
+ return;
786
+ }
787
+ case "tool_execution_end": {
788
+ const tool = this.#toolFor(event);
789
+ if (!tool) return;
790
+ this.#streamingDirty = true;
791
+ const result = event.result;
792
+ if (result && typeof result === "object") {
793
+ tool.result = {
794
+ ...Array.isArray(result.content) ? { content: result.content } : {},
795
+ ...result.details !== void 0 ? { details: result.details } : {}
796
+ };
797
+ }
798
+ tool.isError = event.isError === true;
799
+ tool.status = event.isError === true ? "failed" : "completed";
800
+ tool.executionStarted = true;
801
+ tool.argsComplete = true;
802
+ return;
803
+ }
804
+ case "turn_end": {
805
+ const message = event.message;
806
+ if (message && typeof message === "object") this.#foldMessage(message);
807
+ if (Array.isArray(event.toolResults)) {
808
+ for (const result of event.toolResults) {
809
+ if (result && typeof result === "object") this.#foldMessage(result);
810
+ }
811
+ }
812
+ return;
813
+ }
814
+ case "agent_end": {
815
+ if (!Array.isArray(event.messages)) return;
816
+ for (const message of event.messages) {
817
+ if (message && typeof message === "object") this.#foldMessage(message);
818
+ }
819
+ return;
820
+ }
821
+ case "entry_appended": {
822
+ if (isSessionEntry(event.entry)) this.#appendEntry(event.entry, "events");
823
+ return;
824
+ }
825
+ default:
826
+ return;
827
+ }
828
+ }
829
+ #toolFor(event) {
830
+ if (typeof event.toolCallId !== "string") return void 0;
831
+ const previous = this.#tools.get(event.toolCallId);
832
+ if (!previous) return void 0;
833
+ const tool = { ...previous };
834
+ this.#tools.set(event.toolCallId, tool);
835
+ return tool;
836
+ }
837
+ #applyPartialDelta(event) {
838
+ const delta = event.assistantMessageEvent;
839
+ if (!delta || typeof delta !== "object") return;
840
+ this.#streamingDirty = true;
841
+ if (!this.#partial) {
842
+ this.#partial = {
843
+ role: "assistant",
844
+ content: [],
845
+ api: "",
846
+ provider: "",
847
+ model: "",
848
+ usage: emptyUsage(),
849
+ stopReason: "pending",
850
+ timestamp: Date.now()
851
+ };
852
+ }
853
+ const partial = this.#partial;
854
+ if (event.usage && typeof event.usage === "object") {
855
+ partial.usage = event.usage;
856
+ }
857
+ const contentIndex = typeof delta.contentIndex === "number" ? delta.contentIndex : 0;
858
+ switch (delta.type) {
859
+ case "text_start":
860
+ partial.content[contentIndex] = { type: "text", text: "" };
861
+ return;
862
+ case "text_delta": {
863
+ const block = partial.content[contentIndex];
864
+ const text = typeof delta.delta === "string" ? delta.delta : "";
865
+ partial.content[contentIndex] = {
866
+ type: "text",
867
+ text: (block?.type === "text" ? block.text : "") + text
868
+ };
869
+ return;
870
+ }
871
+ case "text_end": {
872
+ if (typeof delta.content === "string") {
873
+ partial.content[contentIndex] = { type: "text", text: delta.content };
874
+ }
875
+ return;
876
+ }
877
+ case "thinking_start":
878
+ partial.content[contentIndex] = { type: "thinking", thinking: "" };
879
+ return;
880
+ case "thinking_delta": {
881
+ const block = partial.content[contentIndex];
882
+ const text = typeof delta.delta === "string" ? delta.delta : "";
883
+ partial.content[contentIndex] = {
884
+ type: "thinking",
885
+ thinking: (block?.type === "thinking" ? block.thinking : "") + text
886
+ };
887
+ return;
888
+ }
889
+ case "thinking_end": {
890
+ if (typeof delta.content === "string") {
891
+ partial.content[contentIndex] = { type: "thinking", thinking: delta.content };
892
+ }
893
+ return;
894
+ }
895
+ case "toolcall_start": {
896
+ this.#partialArgsRaw.delete(contentIndex);
897
+ partial.content[contentIndex] = {
898
+ type: "toolCall",
899
+ id: typeof delta.id === "string" ? delta.id : "",
900
+ name: typeof delta.toolName === "string" ? delta.toolName : "",
901
+ arguments: {}
902
+ };
903
+ return;
904
+ }
905
+ case "toolcall_delta": {
906
+ const raw = typeof delta.delta === "string" ? delta.delta : "";
907
+ if (!raw) return;
908
+ const accumulated = (this.#partialArgsRaw.get(contentIndex) ?? "") + raw;
909
+ this.#partialArgsRaw.set(contentIndex, accumulated);
910
+ const parsed = parseRecord(accumulated);
911
+ const block = partial.content[contentIndex];
912
+ if (block?.type === "toolCall" && parsed) partial.content[contentIndex] = { ...block, arguments: parsed };
913
+ return;
914
+ }
915
+ case "toolcall_end": {
916
+ const toolCall = delta.toolCall;
917
+ if (toolCall && typeof toolCall === "object") partial.content[contentIndex] = toolCall;
918
+ this.#partialArgsRaw.delete(contentIndex);
919
+ return;
920
+ }
921
+ default:
922
+ return;
923
+ }
924
+ }
925
+ #foldMessage(message) {
926
+ if (!message || typeof message !== "object" || typeof message.role !== "string") return;
927
+ const key = this.#messageKey(message);
928
+ if (this.#streamed.has(key)) return;
929
+ this.#messagesDirty = true;
930
+ this.#streamed.set(key, message);
931
+ this.#streamedOrder.push(key);
932
+ }
933
+ #messageKey(message) {
934
+ let key = this.#messageKeys.get(message);
935
+ if (key === void 0) {
936
+ key = messageKey(message);
937
+ this.#messageKeys.set(message, key);
938
+ }
939
+ return key;
940
+ }
941
+ #classifyLog(filePath) {
942
+ const cached = this.#logClassification;
943
+ try {
944
+ const stat = fs2.lstatSync(filePath);
945
+ if (cached?.path === filePath && stat.isFile() && cached.dev === stat.dev && cached.ino === stat.ino && cached.size > 0 && (stat.size > cached.size || stat.size === cached.size && stat.mtimeMs === cached.mtimeMs)) {
946
+ return cached.kind;
947
+ }
948
+ const kind = classifyFile(filePath);
949
+ if (kind !== "unreadable") {
950
+ this.#logClassification = { path: filePath, kind, dev: stat.dev, ino: stat.ino, size: stat.size, mtimeMs: stat.mtimeMs };
951
+ return kind;
952
+ }
953
+ } catch {
954
+ }
955
+ return cached?.path === filePath ? cached.kind : "unreadable";
956
+ }
957
+ #buildSnapshot() {
958
+ const sessionWindow = this.#windows.get("session");
959
+ const eventsWindow = this.#windows.get("events");
960
+ const hasMore = (sessionWindow?.hasOlder ?? false) || (eventsWindow?.hasOlder ?? false);
961
+ const hasNewer = !this.#followed && (sessionWindow !== void 0 && sessionWindow.tail < sessionWindow.size || eventsWindow !== void 0 && eventsWindow.tail < eventsWindow.size);
962
+ const leafId = this.#sessionLeafId ?? this.#eventLeafId ?? null;
963
+ if (this.#treeDirty) {
964
+ this.#pathComplete = leafId !== null && this.#pathReachesRoot(leafId);
965
+ const branch = leafId !== null ? getConversationHost().buildContextEntries(this.#entries, leafId, this.#byId) : [];
966
+ const projections = branch.map((entry) => {
967
+ let projected = this.#entryProjections.get(entry);
968
+ if (!projected) {
969
+ projected = {
970
+ entry: {
971
+ entryId: entry.id,
972
+ parentId: entry.parentId,
973
+ entryType: entry.type,
974
+ timestamp: entry.timestamp,
975
+ ...entry.type === "message" ? { message: entry.message } : {},
976
+ entry
977
+ },
978
+ messages: getConversationHost().sessionEntryToContextMessages(entry)
979
+ };
980
+ this.#entryProjections.set(entry, projected);
981
+ }
982
+ return projected;
983
+ });
984
+ this.#branch = projections.map((projection) => projection.entry);
985
+ this.#branchMessages = projections.flatMap((projection) => projection.messages);
986
+ this.#persisted = new Set(this.#entries.flatMap((entry) => entry.type === "message" ? [this.#messageKey(entry.message)] : []));
987
+ this.#treeDirty = false;
988
+ this.#messagesDirty = true;
989
+ }
990
+ if (this.#messagesDirty) {
991
+ const streamed = this.#streamedOrder.filter((key) => !this.#persisted.has(key)).map((key) => this.#streamed.get(key));
992
+ this.#messages = [...this.#branchMessages, ...streamed];
993
+ this.#messagesDirty = false;
994
+ }
995
+ if (this.#streamingDirty) {
996
+ const tools = [...this.#tools.values()];
997
+ const partialAssistant = this.#partial ? { ...this.#partial, content: [...this.#partial.content] } : void 0;
998
+ this.#streaming = {
999
+ active: partialAssistant !== void 0 || tools.some((tool) => tool.status === "running"),
1000
+ ...partialAssistant ? { partialAssistant } : {},
1001
+ tools
1002
+ };
1003
+ this.#streamingDirty = false;
1004
+ }
1005
+ const historyComplete = !hasMore && this.#pathComplete && (sessionWindow?.head ?? 0) === 0 && (eventsWindow?.head ?? 0) === 0;
1006
+ const unavailable = {};
1007
+ if (sessionWindow?.unavailable) unavailable.sessionFile = true;
1008
+ if (eventsWindow?.unavailable) unavailable.eventsFile = true;
1009
+ const hasUnavailable = unavailable.sessionFile || unavailable.eventsFile;
1010
+ const error = hasUnavailable ? this.#error : void 0;
1011
+ const previous = this.#snapshot;
1012
+ if (previous && previous.messages === this.#messages && previous.entries === this.#branch && previous.streaming === this.#streaming && previous.pendingMessages === this.#pendingMessages && previous.leafId === leafId && previous.sourceId === this.#sourceId && previous.status === this.#status && previous.sessionFile === this.#sessionFile && previous.eventsFile === this.#eventsFile && previous.sessionId === this.#sessionId && previous.historyComplete === historyComplete && previous.hasMore === hasMore && previous.hasNewer === hasNewer && previous.unavailable?.sessionFile === unavailable.sessionFile && previous.unavailable?.eventsFile === unavailable.eventsFile && previous.error === error) return previous;
1013
+ return {
1014
+ messages: this.#messages,
1015
+ revision: ++this.#revision,
1016
+ entries: this.#branch,
1017
+ streaming: this.#streaming,
1018
+ ...this.#pendingMessages ? { pendingMessages: this.#pendingMessages } : {},
1019
+ leafId,
1020
+ sourceId: this.#sourceId,
1021
+ status: this.#status,
1022
+ ...this.#sessionFile ? { sessionFile: this.#sessionFile } : {},
1023
+ ...this.#eventsFile ? { eventsFile: this.#eventsFile } : {},
1024
+ ...this.#sessionId ? { sessionId: this.#sessionId } : {},
1025
+ historyComplete,
1026
+ hasMore,
1027
+ hasNewer,
1028
+ ...hasUnavailable ? { unavailable } : {},
1029
+ ...error ? { error } : {},
1030
+ updatedAt: Date.now()
1031
+ };
1032
+ }
1033
+ #pathReachesRoot(leafId) {
1034
+ let current = this.#byId.get(leafId);
1035
+ if (!current) return false;
1036
+ const guard = /* @__PURE__ */ new Set();
1037
+ while (current.parentId !== null) {
1038
+ if (guard.has(current.id)) return true;
1039
+ guard.add(current.id);
1040
+ const parent = this.#byId.get(current.parentId);
1041
+ if (!parent) return false;
1042
+ current = parent;
1043
+ }
1044
+ return true;
1045
+ }
1046
+ };
1047
+ export {
1048
+ NativeConversationReader
1049
+ };
1050
+ //# sourceMappingURL=conversation-native-reader.js.map