@wrongstack/core 0.313.1 → 0.316.2

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 (290) hide show
  1. package/dist/chronicle/index.js +31 -31
  2. package/dist/chronicle/legacy-journal-import.d.ts +0 -6
  3. package/dist/chronicle/metrics-ingest.d.ts +14 -0
  4. package/dist/chronicle/metrics-schema.d.ts +10 -1
  5. package/dist/chronicle/metrics-store.d.ts +20 -2
  6. package/dist/chronicle/project-server.js +39 -31
  7. package/dist/chronicle/sink.d.ts +13 -0
  8. package/dist/chronicle/sqlite-journal.d.ts +20 -2
  9. package/dist/{chunk-WOEZV3Q4.js → chunk-25LSLC3G.js} +2 -1
  10. package/dist/{chunk-AI4LLQ2U.js → chunk-27QIURLN.js} +229 -12
  11. package/dist/{chunk-I45KAW2N.js → chunk-3AGWVSS7.js} +38 -450
  12. package/dist/chunk-3BDV7RL3.js +211 -0
  13. package/dist/{chunk-NFAYHPRH.js → chunk-3ECENVHL.js} +10 -8
  14. package/dist/{chunk-FW5LDDMJ.js → chunk-45WI72ZB.js} +1576 -1156
  15. package/dist/{chunk-AT4V4XGI.js → chunk-4BMVPOHO.js} +539 -313
  16. package/dist/{chunk-YBUJCZ57.js → chunk-4I7HGVVA.js} +17 -5
  17. package/dist/{chunk-JVGPR3TS.js → chunk-4LCZVJVF.js} +7 -55
  18. package/dist/{chunk-4ZHTKJHM.js → chunk-4SJNS7OB.js} +36 -2
  19. package/dist/{chunk-AD7ZFZCS.js → chunk-5BMIE7QG.js} +3 -3
  20. package/dist/{chunk-IQ35HMQL.js → chunk-5YPSXQXM.js} +71 -24
  21. package/dist/chunk-6FHWXLPT.js +10 -0
  22. package/dist/{chunk-FIV4IJL7.js → chunk-6H5GEOET.js} +163 -20
  23. package/dist/{chunk-VB3H5WWB.js → chunk-6NWEVFEL.js} +2 -2
  24. package/dist/{chunk-E6I5RXVK.js → chunk-AYW5YINX.js} +2 -2
  25. package/dist/{chunk-DEIQMBD2.js → chunk-B7F4WVP4.js} +2 -2
  26. package/dist/{chunk-XQ2XGIBF.js → chunk-BPBKKBUK.js} +6 -7
  27. package/dist/{chunk-K4YUNKU7.js → chunk-BYD345OX.js} +2 -2
  28. package/dist/{chunk-LZDDLNCZ.js → chunk-C27KDLOX.js} +4 -4
  29. package/dist/{chunk-6AKOTGLM.js → chunk-CU546ESW.js} +7 -7
  30. package/dist/{chunk-ZZ4V3WIZ.js → chunk-DLHHXUAM.js} +10 -1
  31. package/dist/{chunk-BAKVJLEV.js → chunk-DOTHQSJ2.js} +28 -16
  32. package/dist/{chunk-KBZGE6LN.js → chunk-DYLPMV4Q.js} +4 -3
  33. package/dist/{chunk-52RTVH4M.js → chunk-F3JWNST7.js} +2 -2
  34. package/dist/{chunk-WEBMSQP2.js → chunk-FC2ZGRF3.js} +21 -4
  35. package/dist/{chunk-FHAMQS7Q.js → chunk-FCBTO76Z.js} +76 -146
  36. package/dist/{chunk-4LJJYBAU.js → chunk-FHZVFYSL.js} +9 -1
  37. package/dist/{chunk-W4A6QA3D.js → chunk-FWNLEZYG.js} +4 -3
  38. package/dist/{chunk-OJZEX73F.js → chunk-GDQ7CZRQ.js} +5 -1
  39. package/dist/{chunk-QVOVMXJR.js → chunk-GJJGJB2R.js} +32 -9
  40. package/dist/{chunk-4XV6IR37.js → chunk-HI3JGZR2.js} +7 -6
  41. package/dist/{chunk-FSWCWSTS.js → chunk-HMLIGAU7.js} +26 -26
  42. package/dist/{chunk-PFXFQQRT.js → chunk-HXKZ7OBQ.js} +7 -43
  43. package/dist/{chunk-2FQL4PDC.js → chunk-I7DALG7J.js} +5 -5
  44. package/dist/{chunk-GM54GJBU.js → chunk-IRUTEHCE.js} +3 -3
  45. package/dist/{chunk-TYW2GI5I.js → chunk-J2WRWR37.js} +40 -13
  46. package/dist/{chunk-ZEHUCJHY.js → chunk-JFPJ6LLQ.js} +2 -2
  47. package/dist/chunk-JMULFFLN.js +9 -0
  48. package/dist/{chunk-RD6DEE36.js → chunk-JO4MGB6Z.js} +94 -8
  49. package/dist/{chunk-5DSMEVA4.js → chunk-K6BXGITA.js} +7 -7
  50. package/dist/{chunk-O74MJHXU.js → chunk-KZMSZV32.js} +2 -2
  51. package/dist/{chunk-GFJOMSHG.js → chunk-LA7CLDRW.js} +6 -2
  52. package/dist/{chunk-M2WF6AXG.js → chunk-LSMMOS2Z.js} +7 -3
  53. package/dist/{chunk-ASX6AW36.js → chunk-LXWCMQNJ.js} +3 -3
  54. package/dist/{chunk-WZO23AWO.js → chunk-M27LIEKV.js} +72 -22
  55. package/dist/{chunk-JTHKOYWU.js → chunk-MJPHJRAL.js} +15 -15
  56. package/dist/{chunk-G5AAKEEZ.js → chunk-MTL4O5YR.js} +5 -5
  57. package/dist/chunk-NHJ75HXY.js +1 -0
  58. package/dist/{chunk-ZYU2YOJ6.js → chunk-NIOAGFPB.js} +29 -15
  59. package/dist/{chunk-Y2GE5TSI.js → chunk-NS52ISWS.js} +2 -2
  60. package/dist/{chunk-UIWONWVG.js → chunk-NSOFPKGT.js} +541 -148
  61. package/dist/{chunk-RCQYT2I4.js → chunk-NVIZG63R.js} +2 -2
  62. package/dist/{chunk-EPC3GZD4.js → chunk-OOYZPOXM.js} +2 -2
  63. package/dist/{chunk-7ZHZE5EO.js → chunk-OSGLYW5J.js} +2 -2
  64. package/dist/{chunk-CE4ZOCOI.js → chunk-PFCMSSUF.js} +9 -9
  65. package/dist/{chunk-GFXZTHNI.js → chunk-PGRVXIMY.js} +5 -5
  66. package/dist/{chunk-JJPMWPB6.js → chunk-PISBFBJN.js} +6 -6
  67. package/dist/chunk-POOOIWE5.js +9 -0
  68. package/dist/{chunk-5RP3QTRL.js → chunk-PQNS3U7Z.js} +20 -3
  69. package/dist/{chunk-3E244UDA.js → chunk-QSTSJOCK.js} +52 -6
  70. package/dist/{chunk-YUPMXOGP.js → chunk-RFQMOKWK.js} +3 -3
  71. package/dist/chunk-RTOTNK3P.js +484 -0
  72. package/dist/{chunk-SN2DQRL6.js → chunk-RXKSDUAU.js} +7 -7
  73. package/dist/{chunk-T3KGZBU5.js → chunk-S45JPKQN.js} +189 -43
  74. package/dist/{chunk-YNCVSFGF.js → chunk-SAFHACFA.js} +4 -1
  75. package/dist/{chunk-KI4L2DUL.js → chunk-TCCHINEF.js} +114 -19
  76. package/dist/{chunk-AWNQ6ED6.js → chunk-THEGTRAG.js} +7 -2
  77. package/dist/{chunk-2KKODIQU.js → chunk-TR4LQE7L.js} +15 -15
  78. package/dist/{chunk-GPQ3NJPR.js → chunk-TWJMGXCI.js} +3 -3
  79. package/dist/{chunk-H72H4XDU.js → chunk-U45AXT5D.js} +9 -9
  80. package/dist/{chunk-62V2AFVG.js → chunk-U4FWBSO3.js} +160 -73
  81. package/dist/{chunk-A455ATZB.js → chunk-UBGDX6FI.js} +8 -1
  82. package/dist/chunk-UJILKYES.js +75 -0
  83. package/dist/{chunk-KSJ5UTP7.js → chunk-ULMAQV3T.js} +84 -4
  84. package/dist/{chunk-CB2HFKTP.js → chunk-VVBP6KGT.js} +1 -1
  85. package/dist/{chunk-RPOA7IAE.js → chunk-W5VITDM2.js} +43 -25
  86. package/dist/{chunk-QRTG4XTI.js → chunk-WAHQVNWT.js} +7 -1
  87. package/dist/{chunk-SQP64RCS.js → chunk-WGGYRBXH.js} +3019 -2976
  88. package/dist/{chunk-K3G6JBUC.js → chunk-WLYKU45P.js} +679 -141
  89. package/dist/chunk-WP7BVANJ.js +53 -0
  90. package/dist/{chunk-GAZEWQEZ.js → chunk-XF4VUMKW.js} +2 -2
  91. package/dist/{chunk-PAAWLLZX.js → chunk-Y5YXDM7D.js} +2 -2
  92. package/dist/{chunk-65RDIOR2.js → chunk-YOPAUVU4.js} +162 -44
  93. package/dist/{chunk-FFSX2QDQ.js → chunk-YPT4A46F.js} +3 -3
  94. package/dist/chunk-YWXT3JNM.js +425 -0
  95. package/dist/{chunk-EFEHDQGY.js → chunk-ZHZ2Y2DH.js} +64 -10
  96. package/dist/{chunk-CQQL4ZOQ.js → chunk-ZT7JNIGX.js} +4 -3
  97. package/dist/coordination/agent-monitor.d.ts +9 -1
  98. package/dist/coordination/agent-subagent-runner.d.ts +1 -1
  99. package/dist/coordination/agents/agent-prompts.d.ts +8 -0
  100. package/dist/coordination/agents/index.d.ts +33 -1
  101. package/dist/coordination/agents/index.js +52 -22
  102. package/dist/coordination/agents/phase3-wave1-platform.d.ts +1 -3
  103. package/dist/coordination/agents/phase3-wave2-meta.d.ts +1 -3
  104. package/dist/coordination/agents/phase8-wave3-products.d.ts +1 -3
  105. package/dist/coordination/agents/phase9-wave4-platform-meta.d.ts +1 -3
  106. package/dist/coordination/agents/project-agent-identity.d.ts +11 -11
  107. package/dist/coordination/agents/types.d.ts +13 -2
  108. package/dist/coordination/brain-monitor.d.ts +30 -7
  109. package/dist/coordination/collab-debug.d.ts +1 -1
  110. package/dist/coordination/collab-pause.d.ts +1 -1
  111. package/dist/coordination/delegate-tool.d.ts +7 -5
  112. package/dist/coordination/director-kanban-queue-helpers.d.ts +1 -0
  113. package/dist/coordination/director-options.d.ts +7 -0
  114. package/dist/coordination/director-spawn-model.d.ts +17 -0
  115. package/dist/coordination/director-tools.d.ts +2 -2
  116. package/dist/coordination/director.d.ts +12 -0
  117. package/dist/coordination/dispatcher.d.ts +8 -0
  118. package/dist/coordination/fleet-bus.d.ts +35 -4
  119. package/dist/coordination/fleet-supervisor.d.ts +10 -2
  120. package/dist/coordination/fleet.d.ts +16 -7
  121. package/dist/coordination/index.d.ts +4 -0
  122. package/dist/coordination/index.js +86 -49
  123. package/dist/coordination/kanban-dispatch-port.d.ts +2 -2
  124. package/dist/coordination/mailbox-http-router.d.ts +4 -3
  125. package/dist/coordination/mailbox-http-validation.d.ts +1 -1
  126. package/dist/coordination/mailbox-project-server.js +15 -15
  127. package/dist/coordination/mailbox-types.d.ts +24 -6
  128. package/dist/coordination/model-tier-leader.d.ts +122 -0
  129. package/dist/coordination/model-tier.d.ts +122 -0
  130. package/dist/coordination/multi-agent-coordinator.d.ts +24 -0
  131. package/dist/coordination/origin-session.d.ts +16 -0
  132. package/dist/coordination/provider-status-tracker.d.ts +37 -5
  133. package/dist/coordination/session-note-hub.d.ts +44 -0
  134. package/dist/coordination/session-note-tool.d.ts +10 -0
  135. package/dist/core/agent.d.ts +1 -1
  136. package/dist/core/context.d.ts +22 -3
  137. package/dist/core/index.d.ts +2 -0
  138. package/dist/core/index.js +130 -38
  139. package/dist/core/request-conversation-binding.d.ts +37 -0
  140. package/dist/core/session-notes.d.ts +25 -0
  141. package/dist/core/system-prompt-builder.d.ts +11 -2
  142. package/dist/core/system-prompt-variants.d.ts +78 -0
  143. package/dist/design/index.js +3 -3
  144. package/dist/execution/auto-compaction-middleware.d.ts +11 -0
  145. package/dist/execution/autonomy-brain.d.ts +2 -1
  146. package/dist/execution/autonomy-prompt-contributor.d.ts +7 -2
  147. package/dist/execution/compaction-core.d.ts +4 -4
  148. package/dist/execution/eternal-autonomy.d.ts +1 -1
  149. package/dist/execution/index.js +138 -129
  150. package/dist/execution/model-runtime.d.ts +0 -7
  151. package/dist/execution/parallel-eternal-engine.d.ts +7 -7
  152. package/dist/extension/index.js +3 -3
  153. package/dist/goal/index.js +6 -6
  154. package/dist/hooks/index.js +3 -3
  155. package/dist/hq/index.js +14 -12
  156. package/dist/hq/persistence/event-log.d.ts +0 -1
  157. package/dist/hq/persistence.d.ts +4 -4
  158. package/dist/hq/publisher.d.ts +2 -0
  159. package/dist/index.d.ts +14 -11
  160. package/dist/index.js +728 -635
  161. package/dist/infrastructure/index.d.ts +4 -4
  162. package/dist/infrastructure/index.js +281 -260
  163. package/dist/infrastructure/token-counter.d.ts +9 -0
  164. package/dist/kernel/events/agent-events.d.ts +77 -3
  165. package/dist/kernel/events/brain-events.d.ts +12 -0
  166. package/dist/kernel/events/provider-events.d.ts +7 -1
  167. package/dist/kernel/events/session-events.d.ts +14 -0
  168. package/dist/kernel/events/tool-events.d.ts +13 -0
  169. package/dist/kernel/index.js +4 -4
  170. package/dist/mailbox-attach.d.ts +1 -1
  171. package/dist/models/index.js +10 -9
  172. package/dist/observability/event-bridge.d.ts +25 -5
  173. package/dist/observability/index.d.ts +9 -8
  174. package/dist/observability/index.js +459 -351
  175. package/dist/observability/tool-usage-source.d.ts +65 -0
  176. package/dist/plugin/index.d.ts +5 -0
  177. package/dist/plugin/index.js +66 -50
  178. package/dist/plugins/auto-review-plugin.d.ts +3 -2
  179. package/dist/plugins/review-finding-commands.d.ts +0 -8
  180. package/dist/{review-finding-store-DKAV3AS6.js → plugins/review-finding-store.js} +7 -6
  181. package/dist/plugins/review-finding-types.js +19 -0
  182. package/dist/plugins/review-report-integration.js +21 -0
  183. package/dist/{review-report-store-OWY3EC3N.js → plugins/review-report-store.js} +7 -6
  184. package/dist/plugins/review-report-types.js +13 -0
  185. package/dist/prompts/index.js +5 -5
  186. package/dist/registry/index.js +3 -3
  187. package/dist/registry/tool-registry.d.ts +59 -9
  188. package/dist/{registry-R23UBE7H.js → registry-7N4O3E7W.js} +5 -5
  189. package/dist/security/capabilities.d.ts +6 -0
  190. package/dist/security/file-permissions.d.ts +1 -1
  191. package/dist/security/index.js +47 -33
  192. package/dist/security/permission-policy.d.ts +12 -1
  193. package/dist/security/secret-scrubber.d.ts +15 -0
  194. package/dist/session-catalog/index.d.ts +1 -0
  195. package/dist/session-catalog/index.js +19 -14
  196. package/dist/session-catalog/project-server.js +30 -13
  197. package/dist/session-catalog/protocol.d.ts +32 -1
  198. package/dist/session-catalog/registry.d.ts +17 -1
  199. package/dist/session-catalog/session-agents.d.ts +56 -0
  200. package/dist/session-catalog/store-rebuild.d.ts +14 -0
  201. package/dist/session-catalog/store-schema.d.ts +26 -0
  202. package/dist/session-catalog/store.d.ts +27 -1
  203. package/dist/session-note-attach.d.ts +9 -0
  204. package/dist/skills/index.js +5 -5
  205. package/dist/statusline/index.d.ts +43 -0
  206. package/dist/statusline/index.js +102 -0
  207. package/dist/storage/board-store-port.d.ts +2 -2
  208. package/dist/storage/config-loader/in-project-policy.d.ts +29 -0
  209. package/dist/storage/config-loader.d.ts +3 -2
  210. package/dist/storage/file-session-writer.d.ts +4 -2
  211. package/dist/storage/goal-coordination.d.ts +6 -1
  212. package/dist/storage/goal-kanban.d.ts +4 -1
  213. package/dist/storage/index.d.ts +12 -4
  214. package/dist/storage/index.js +76 -61
  215. package/dist/storage/input-history-store.d.ts +2 -4
  216. package/dist/storage/memory-curator.d.ts +133 -0
  217. package/dist/storage/session-agent-attribution.d.ts +39 -0
  218. package/dist/storage/session-doctor.d.ts +109 -0
  219. package/dist/storage/session-event-bridge.d.ts +5 -7
  220. package/dist/storage/session-outcome.d.ts +42 -0
  221. package/dist/storage/session-recovery.d.ts +55 -0
  222. package/dist/storage/session-store/load-session-data.d.ts +11 -0
  223. package/dist/storage/session-store/prune-helpers.d.ts +1 -1
  224. package/dist/storage/session-store/resume-session.d.ts +0 -2
  225. package/dist/storage/session-store/types.d.ts +8 -0
  226. package/dist/storage/session-store.d.ts +3 -3
  227. package/dist/storage/session-summary-tracker.d.ts +8 -1
  228. package/dist/storage/session-write-buffer.d.ts +18 -0
  229. package/dist/storage/session-writer-truncate.d.ts +2 -0
  230. package/dist/tasking/index.js +2 -2
  231. package/dist/tools/fallback-manage-tools.d.ts +6 -4
  232. package/dist/tools/index.js +21 -21
  233. package/dist/tools/model-tier-set-tool.d.ts +66 -0
  234. package/dist/types/agent-bridge.d.ts +2 -1
  235. package/dist/types/config/mcp-features.d.ts +7 -0
  236. package/dist/types/config/model-tiers.d.ts +148 -0
  237. package/dist/types/config/root.d.ts +9 -0
  238. package/dist/types/config/tools.d.ts +73 -0
  239. package/dist/types/config.d.ts +1 -0
  240. package/dist/types/context.d.ts +2 -0
  241. package/dist/types/default-config.d.ts +6 -0
  242. package/dist/types/errors.d.ts +2 -1
  243. package/dist/types/index.d.ts +11 -9
  244. package/dist/types/index.js +25 -15
  245. package/dist/types/multi-agent.d.ts +43 -0
  246. package/dist/types/plugin.d.ts +1 -1
  247. package/dist/types/provider.d.ts +15 -0
  248. package/dist/types/runtime-capability-manifest.d.ts +1 -1
  249. package/dist/types/secret-scrubber.d.ts +15 -0
  250. package/dist/types/session-markers.d.ts +37 -10
  251. package/dist/types/session-markers.js +1 -1
  252. package/dist/types/session-timeline.d.ts +197 -0
  253. package/dist/types/session-timeline.js +12 -0
  254. package/dist/types/session.d.ts +172 -11
  255. package/dist/types/system-prompt.d.ts +27 -0
  256. package/dist/utils/config-backup.d.ts +9 -1
  257. package/dist/utils/heap-watchdog.js +2 -2
  258. package/dist/utils/index.js +50 -48
  259. package/dist/utils/message-invariants.d.ts +4 -1
  260. package/dist/utils/regex-guard.d.ts +1 -1
  261. package/dist/utils/socket-path.d.ts +1 -1
  262. package/dist/utils/token-estimate.d.ts +6 -2
  263. package/dist/utils/wstack-paths.d.ts +2 -0
  264. package/dist/wiring/proxy-rewrite.d.ts +28 -0
  265. package/dist/wiring/proxy-rewrite.js +7 -1
  266. package/dist/worktree/index.js +2 -2
  267. package/instructions/agents/explore-companion.md +45 -18
  268. package/instructions/agents/memory-curator.md +34 -22
  269. package/instructions/coordination/director-preamble.md +12 -7
  270. package/instructions/coordination/subagent-baseline.md +26 -5
  271. package/instructions/leader-after-task.md +4 -1
  272. package/instructions/llm/chimera-review.md +30 -9
  273. package/instructions/llm/memory-curator.md +31 -0
  274. package/instructions/sections/tool/delegation-compact.md +2 -0
  275. package/instructions/sections/tool/delegation-full.md +5 -1
  276. package/instructions/sections/tool/mailbox-compact.md +5 -1
  277. package/instructions/sections/tool/mailbox-full.md +3 -0
  278. package/instructions/sections/tool/session-note-compact.md +3 -0
  279. package/instructions/sections/tool/session-note-full.md +15 -0
  280. package/instructions/system-lite.md +9 -4
  281. package/instructions/system-pro.md +66 -143
  282. package/instructions/system.md +73 -175
  283. package/package.json +33 -5
  284. package/dist/chunk-2BUUIMQB.js +0 -225
  285. package/dist/chunk-FAYRX2AD.js +0 -13
  286. package/dist/chunk-H5E77KUJ.js +0 -15
  287. package/dist/chunk-M7BS2K6U.js +0 -1
  288. package/dist/coordination/agents.d.ts +0 -8
  289. package/dist/coordination/transport.d.ts +0 -2
  290. package/dist/storage/session-writer/session-writer-summary-tracker.d.ts +0 -28
@@ -10,11 +10,11 @@ import {
10
10
  noOpVault,
11
11
  rewriteConfigEncrypted,
12
12
  rotateConfigKeys
13
- } from "../chunk-6AKOTGLM.js";
13
+ } from "../chunk-CU546ESW.js";
14
14
  import {
15
15
  ReadOnlyPermissionPolicy,
16
16
  toolMutates
17
- } from "../chunk-ZEHUCJHY.js";
17
+ } from "../chunk-JFPJ6LLQ.js";
18
18
  import {
19
19
  decryptConfigSecrets,
20
20
  encryptConfigSecrets,
@@ -25,13 +25,32 @@ import {
25
25
  evaluateToolKanbanBoundary,
26
26
  kanbanGovernance,
27
27
  setKanbanGovernance
28
- } from "../chunk-EPC3GZD4.js";
28
+ } from "../chunk-OOYZPOXM.js";
29
+ import {
30
+ matchAny,
31
+ matchAnyCommand,
32
+ matchGlob,
33
+ subjectForToolInput
34
+ } from "../chunk-WAHQVNWT.js";
35
+ import {
36
+ safeParse
37
+ } from "../chunk-W5VITDM2.js";
38
+ import "../chunk-B7F4WVP4.js";
29
39
  import {
30
40
  ERROR_DETAIL_MAX,
31
41
  sanitizeApiError,
32
42
  scrubErrorDetail,
33
43
  scrubErrorText
34
- } from "../chunk-PAAWLLZX.js";
44
+ } from "../chunk-Y5YXDM7D.js";
45
+ import {
46
+ DefaultSecretScrubber
47
+ } from "../chunk-QSTSJOCK.js";
48
+ import {
49
+ SECRET_DIR_MODE,
50
+ SECRET_FILE_MODE,
51
+ restrictDirPermissions,
52
+ restrictFilePermissions
53
+ } from "../chunk-6FHWXLPT.js";
35
54
  import {
36
55
  DANGEROUS_FOR_SUBAGENTS,
37
56
  ToolCapabilities,
@@ -40,35 +59,16 @@ import {
40
59
  getDangerousCapabilities,
41
60
  hasCapability,
42
61
  hasDangerousCapabilityForSubagents
43
- } from "../chunk-A455ATZB.js";
44
- import {
45
- SECRET_DIR_MODE,
46
- SECRET_FILE_MODE,
47
- restrictDirPermissions,
48
- restrictFilePermissions
49
- } from "../chunk-H5E77KUJ.js";
50
- import {
51
- DefaultSecretScrubber
52
- } from "../chunk-3E244UDA.js";
53
- import {
54
- matchAny,
55
- matchAnyCommand,
56
- matchGlob,
57
- subjectForToolInput
58
- } from "../chunk-QRTG4XTI.js";
59
- import {
60
- safeParse
61
- } from "../chunk-RPOA7IAE.js";
62
- import "../chunk-DEIQMBD2.js";
62
+ } from "../chunk-UBGDX6FI.js";
63
63
  import {
64
64
  atomicWrite
65
- } from "../chunk-7ZHZE5EO.js";
65
+ } from "../chunk-OSGLYW5J.js";
66
66
  import {
67
67
  wstackGlobalRoot
68
- } from "../chunk-YNCVSFGF.js";
69
- import "../chunk-WOEZV3Q4.js";
70
- import "../chunk-TBRL2RCC.js";
68
+ } from "../chunk-SAFHACFA.js";
71
69
  import "../chunk-PFZO3C6H.js";
70
+ import "../chunk-25LSLC3G.js";
71
+ import "../chunk-TBRL2RCC.js";
72
72
 
73
73
  // src/security/directory-permission-policy.ts
74
74
  import * as path from "node:path";
@@ -1646,7 +1646,7 @@ var DefaultPermissionPolicy = class {
1646
1646
  return false;
1647
1647
  }
1648
1648
  yoloBlockedAsDestructive(tool, input, ctx) {
1649
- if (!this.yolo || this.yoloDestructive) return false;
1649
+ if (!this.effectiveYolo(ctx) || this.yoloDestructive) return false;
1650
1650
  if (this.hasAgentStateWriteTarget(tool, input, ctx)) return true;
1651
1651
  if (attachesWellKnownCredential(input)) return true;
1652
1652
  const isShellSurface = tool.name === "bash" || tool.name === "exec" || (tool.capabilities ?? []).includes("shell.arbitrary");
@@ -1658,6 +1658,20 @@ var DefaultPermissionPolicy = class {
1658
1658
  setPromptDelegate(delegate) {
1659
1659
  this.promptDelegate = delegate;
1660
1660
  }
1661
+ /**
1662
+ * YOLO as it applies to ONE conversation.
1663
+ *
1664
+ * `this.yolo` is a process-wide switch, which is right for a CLI or a TUI —
1665
+ * one process, one conversation. A WebUI holds four at once, and YOLO is a
1666
+ * per-tab preference stored on each session's own context meta, so reading
1667
+ * the process switch meant turning YOLO on in one tab auto-approved the
1668
+ * tools of the other three. The instance flag stays as the fallback for
1669
+ * hosts (and tests) that never write the meta key.
1670
+ */
1671
+ effectiveYolo(ctx) {
1672
+ const scoped = ctx?.meta?.["yolo"];
1673
+ return typeof scoped === "boolean" ? scoped : this.yolo;
1674
+ }
1661
1675
  setYolo(enabled) {
1662
1676
  if (this.yolo !== enabled) this._evalCache.clear();
1663
1677
  this.yolo = enabled;
@@ -1745,7 +1759,7 @@ var DefaultPermissionPolicy = class {
1745
1759
  const entry = mergeTrustEntries(this.policy[tool.name], namespaceEntry);
1746
1760
  const subject = subjectForToolInput(tool.name, input, tool.subjectKey, tool.subjectFields);
1747
1761
  const cacheKey = `${tool.name}::${subject ?? tool.name}`;
1748
- const evalKey = `${cacheKey}::${permissionFingerprint(tool)}`;
1762
+ const evalKey = `${ctx.session?.id ?? "__default__"}::${cacheKey}::${permissionFingerprint(tool)}::y${this.effectiveYolo(ctx) ? 1 : 0}`;
1749
1763
  if (tool.name !== "write" && !this.hasAgentStateWriteTarget(tool, input, ctx)) {
1750
1764
  const cached = this._evalCache.get(evalKey);
1751
1765
  if (cached !== void 0) return cached;
@@ -1805,7 +1819,7 @@ var DefaultPermissionPolicy = class {
1805
1819
  this._evalCache.set(evalKey, decision);
1806
1820
  return decision;
1807
1821
  }
1808
- if (!this.yolo && this.isSensitiveReadCall(tool, input)) {
1822
+ if (!this.effectiveYolo(ctx) && this.isSensitiveReadCall(tool, input)) {
1809
1823
  if (this.promptDelegate) {
1810
1824
  const userDecision = await this.promptDelegate(tool, input, subject ?? tool.name);
1811
1825
  if (userDecision === "always") {
@@ -1841,7 +1855,7 @@ var DefaultPermissionPolicy = class {
1841
1855
  reason: "sensitive file read needs explicit approval"
1842
1856
  };
1843
1857
  }
1844
- if (this.yolo) {
1858
+ if (this.effectiveYolo(ctx)) {
1845
1859
  if (this.yoloBlockedAsDestructive(tool, input, ctx)) {
1846
1860
  return {
1847
1861
  permission: "confirm",
@@ -1962,7 +1976,7 @@ var DefaultPermissionPolicy = class {
1962
1976
  wildcardEntries: this.wildcardEntries,
1963
1977
  sessionDenied: this.sessionDenied,
1964
1978
  sessionAllowed: this.sessionAllowed,
1965
- yolo: this.yolo,
1979
+ yolo: this.effectiveYolo(ctx),
1966
1980
  promptDelegatePresent: this.promptDelegate !== void 0,
1967
1981
  isSensitiveReadCall: (t, inp) => this.isSensitiveReadCall(t, inp),
1968
1982
  yoloBlockedAsDestructive: (t, inp, c) => this.yoloBlockedAsDestructive(t, inp, c)
@@ -4,7 +4,7 @@ import type { PermissionDecision, PermissionPolicy, PermissionTrace, TrustPolicy
4
4
  import type { Tool } from '../types/tool.js';
5
5
  import { type TrustPolicyDiagnostic } from './permission-policy-schema.js';
6
6
  export { AutoApprovePermissionPolicy } from './auto-approve-policy.js';
7
- export { alwaysAllowUnavailableReason, matchesTrust, matchesCommandTrust, hasShellSubject, permissionFingerprint, shellCommandLineFromInput, inputPathLooksSensitive, shellCommandReadsSensitivePath, } from './permission-helpers.js';
7
+ export { alwaysAllowUnavailableReason, inputPathLooksSensitive, matchesTrust, shellCommandLineFromInput, shellCommandReadsSensitivePath } from './permission-helpers.js';
8
8
  /**
9
9
  * Combine an exact-name trust entry with the wildcard entry that also matched.
10
10
  *
@@ -40,6 +40,17 @@ export declare class DefaultPermissionPolicy implements PermissionPolicy {
40
40
  private hasAgentStateWriteTarget;
41
41
  private yoloBlockedAsDestructive;
42
42
  setPromptDelegate(delegate: PermissionPolicyOptions['promptDelegate']): void;
43
+ /**
44
+ * YOLO as it applies to ONE conversation.
45
+ *
46
+ * `this.yolo` is a process-wide switch, which is right for a CLI or a TUI —
47
+ * one process, one conversation. A WebUI holds four at once, and YOLO is a
48
+ * per-tab preference stored on each session's own context meta, so reading
49
+ * the process switch meant turning YOLO on in one tab auto-approved the
50
+ * tools of the other three. The instance flag stays as the fallback for
51
+ * hosts (and tests) that never write the meta key.
52
+ */
53
+ private effectiveYolo;
43
54
  setYolo(enabled: boolean): void;
44
55
  getYolo(): boolean;
45
56
  getPolicyDiagnostics(): readonly TrustPolicyDiagnostic[];
@@ -10,5 +10,20 @@ export declare class DefaultSecretScrubber implements SecretScrubber {
10
10
  * value without a credential anchor returns immediately without regex work.
11
11
  */
12
12
  scrubObject<T>(obj: T): T;
13
+ /**
14
+ * Copy-on-write {@link scrubObject}: clean subtrees come back by reference.
15
+ *
16
+ * `scrubObject` rebuilds the entire graph unconditionally — a new object for
17
+ * every node, a new array for every array — whether or not anything was
18
+ * redacted. On the read path that is almost all waste: measured over a real
19
+ * 133 MB journal, 488k nodes and 309k strings were rebuilt so that FOUR
20
+ * strings could be redacted, costing ~480 ms of allocation and the GC
21
+ * pressure that comes with it. Rebuilding only the spine above an actual
22
+ * redaction gives the same output for a fraction of the garbage.
23
+ *
24
+ * The sharing is why this is a separate method rather than a change to
25
+ * `scrubObject`: see the contract note on `SecretScrubber.scrubObjectShared`.
26
+ */
27
+ scrubObjectShared<T>(obj: T): T;
13
28
  }
14
29
  //# sourceMappingURL=secret-scrubber.d.ts.map
@@ -2,5 +2,6 @@ export * from './client.js';
2
2
  export * from './endpoint.js';
3
3
  export * from './protocol.js';
4
4
  export * from './registry.js';
5
+ export * from './session-agents.js';
5
6
  export * from './store.js';
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1,17 +1,19 @@
1
- import "../chunk-M7BS2K6U.js";
1
+ import "../chunk-NHJ75HXY.js";
2
2
  import {
3
3
  ProjectSessionRegistry,
4
4
  getProjectSessionRegistry,
5
5
  hasProjectSessionRegistry
6
- } from "../chunk-YBUJCZ57.js";
6
+ } from "../chunk-4I7HGVVA.js";
7
7
  import {
8
- SessionCatalogStore
9
- } from "../chunk-AI4LLQ2U.js";
8
+ SessionCatalogStore,
9
+ deriveSessionAgents
10
+ } from "../chunk-27QIURLN.js";
10
11
  import {
11
12
  SessionCatalogProjectClient,
12
13
  resolveSessionCatalogDaemonAvailability,
13
14
  resolveSessionCatalogProjectServerUrl
14
- } from "../chunk-52RTVH4M.js";
15
+ } from "../chunk-F3JWNST7.js";
16
+ import "../chunk-JMULFFLN.js";
15
17
  import {
16
18
  SESSION_CATALOG_DEFAULT_LEASE_MS,
17
19
  SESSION_CATALOG_DEFAULT_RESERVATION_MS,
@@ -24,17 +26,19 @@ import {
24
26
  sessionCatalogProjectServerEndpoint,
25
27
  sessionCatalogProjectServerKey,
26
28
  sessionCatalogProjectServerMetadataPath
27
- } from "../chunk-E6I5RXVK.js";
28
- import "../chunk-GM54GJBU.js";
29
- import "../chunk-W4A6QA3D.js";
30
- import "../chunk-3E244UDA.js";
31
- import "../chunk-AD7ZFZCS.js";
29
+ } from "../chunk-AYW5YINX.js";
30
+ import "../chunk-5BMIE7QG.js";
31
+ import "../chunk-IRUTEHCE.js";
32
+ import "../chunk-FWNLEZYG.js";
33
+ import "../chunk-QSTSJOCK.js";
32
34
  import "../chunk-TRT2HRWZ.js";
33
35
  import "../chunk-LX5QWLBL.js";
34
- import "../chunk-FAYRX2AD.js";
35
- import "../chunk-7ZHZE5EO.js";
36
- import "../chunk-YNCVSFGF.js";
37
- import "../chunk-WOEZV3Q4.js";
36
+ import "../chunk-POOOIWE5.js";
37
+ import "../chunk-OSGLYW5J.js";
38
+ import "../chunk-SAFHACFA.js";
39
+ import "../chunk-3ECENVHL.js";
40
+ import "../chunk-B4AMLZPB.js";
41
+ import "../chunk-25LSLC3G.js";
38
42
  import "../chunk-TBRL2RCC.js";
39
43
  export {
40
44
  ProjectSessionRegistry,
@@ -46,6 +50,7 @@ export {
46
50
  SESSION_CATALOG_PROTOCOL_VERSION,
47
51
  SessionCatalogProjectClient,
48
52
  SessionCatalogStore,
53
+ deriveSessionAgents,
49
54
  encodeSessionCatalogMessage,
50
55
  ensureSessionCatalogSocketDirectory,
51
56
  getProjectSessionRegistry,
@@ -1,32 +1,35 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  SessionCatalogStore
4
- } from "../chunk-AI4LLQ2U.js";
4
+ } from "../chunk-27QIURLN.js";
5
+ import "../chunk-JMULFFLN.js";
5
6
  import {
6
7
  SESSION_CATALOG_MAX_FRAME_CHARS,
7
8
  SESSION_CATALOG_PROTOCOL_VERSION,
8
9
  encodeSessionCatalogMessage,
9
10
  sessionCatalogProjectServerEndpoint,
10
11
  sessionCatalogProjectServerMetadataPath
11
- } from "../chunk-E6I5RXVK.js";
12
- import "../chunk-GM54GJBU.js";
13
- import "../chunk-W4A6QA3D.js";
14
- import {
15
- restrictFilePermissions
16
- } from "../chunk-H5E77KUJ.js";
17
- import "../chunk-3E244UDA.js";
12
+ } from "../chunk-AYW5YINX.js";
18
13
  import {
19
14
  useDaemonPerfDefaults
20
15
  } from "../chunk-FNXVT7HF.js";
21
- import "../chunk-AD7ZFZCS.js";
16
+ import "../chunk-5BMIE7QG.js";
17
+ import "../chunk-IRUTEHCE.js";
18
+ import "../chunk-FWNLEZYG.js";
19
+ import "../chunk-QSTSJOCK.js";
20
+ import {
21
+ restrictFilePermissions
22
+ } from "../chunk-6FHWXLPT.js";
22
23
  import "../chunk-TRT2HRWZ.js";
23
24
  import "../chunk-LX5QWLBL.js";
24
- import "../chunk-FAYRX2AD.js";
25
+ import "../chunk-POOOIWE5.js";
25
26
  import {
26
27
  atomicWrite
27
- } from "../chunk-7ZHZE5EO.js";
28
- import "../chunk-YNCVSFGF.js";
29
- import "../chunk-WOEZV3Q4.js";
28
+ } from "../chunk-OSGLYW5J.js";
29
+ import "../chunk-SAFHACFA.js";
30
+ import "../chunk-3ECENVHL.js";
31
+ import "../chunk-B4AMLZPB.js";
32
+ import "../chunk-25LSLC3G.js";
30
33
  import "../chunk-TBRL2RCC.js";
31
34
 
32
35
  // src/session-catalog/project-server.ts
@@ -99,6 +102,7 @@ var OPERATION_KEYS = {
99
102
  reconnect_lease: ["sessionId", "leaseId", "leaseSecret", "ownerInstanceId", "expiresAt"],
100
103
  reserve_resume: ["targetSessionId", "requesterInstanceId", "currentSessionId", "reservationMs"],
101
104
  activate_reservation: ["reservation", "entry", "leaseMs"],
105
+ renew_reservation: ["reservationId", "requesterInstanceId", "reservationMs"],
102
106
  cancel_reservation: ["reservationId", "requesterInstanceId"],
103
107
  heartbeat: ["credential", "status"],
104
108
  publish_agents: ["credential", "revision", "agents"],
@@ -121,6 +125,7 @@ var OPERATION_KEYS = {
121
125
  ],
122
126
  resolve_id: ["query"],
123
127
  get_summary: ["sessionId"],
128
+ list_session_agents: ["sessionId"],
124
129
  rename: ["sessionId", "name"],
125
130
  acquire_maintenance: ["sessionId", "operation", "holderId", "leaseMs", "holderPid"],
126
131
  release_maintenance: ["lease"],
@@ -228,6 +233,14 @@ async function dispatch(op, args) {
228
233
  value.leaseMs
229
234
  );
230
235
  }
236
+ case "renew_reservation": {
237
+ const value = args;
238
+ return catalog.renewReservation(
239
+ value.reservationId,
240
+ value.requesterInstanceId,
241
+ value.reservationMs
242
+ );
243
+ }
231
244
  case "cancel_reservation": {
232
245
  const value = args;
233
246
  catalog.cancelReservation(value.reservationId, value.requesterInstanceId);
@@ -321,6 +334,10 @@ async function dispatch(op, args) {
321
334
  value.holderId
322
335
  );
323
336
  }
337
+ case "list_session_agents": {
338
+ const value = args;
339
+ return catalog.listSessionAgents(value.sessionId);
340
+ }
324
341
  case "rebuild_catalog":
325
342
  return catalog.rebuildCatalog();
326
343
  default:
@@ -1,5 +1,6 @@
1
- import type { SessionRegistryEntry } from './session-registry-types.js';
2
1
  import type { SessionSummary } from '../types/session.js';
2
+ import type { SessionAgentRecord } from './session-agents.js';
3
+ import type { SessionRegistryEntry } from './session-registry-types.js';
3
4
  export declare const SESSION_CATALOG_PROTOCOL_VERSION = 1;
4
5
  export declare const SESSION_CATALOG_MAX_FRAME_CHARS: number;
5
6
  export declare const SESSION_CATALOG_DEFAULT_LEASE_MS = 30000;
@@ -126,6 +127,25 @@ export interface SessionCatalogOperations {
126
127
  };
127
128
  result: SessionLeaseCredential;
128
129
  };
130
+ /**
131
+ * Extend a reservation that is still being worked on.
132
+ *
133
+ * A resume reserves ownership BEFORE it can know how long the transcript
134
+ * takes to open, and the default window is 15s. Hydrating a large journal
135
+ * (load + summary + file-observation validation + opening the append
136
+ * handle, all of which can also wait on this daemon) routinely outruns it,
137
+ * and `activate_reservation` then fails with "reservation expired" after
138
+ * the expensive work is already done. Renewal keeps the reservation alive
139
+ * for exactly as long as the caller is demonstrably still hydrating.
140
+ */
141
+ renew_reservation: {
142
+ args: {
143
+ reservationId: string;
144
+ requesterInstanceId: string;
145
+ reservationMs?: number;
146
+ };
147
+ result: ResumeReservation;
148
+ };
129
149
  cancel_reservation: {
130
150
  args: {
131
151
  reservationId: string;
@@ -210,6 +230,17 @@ export interface SessionCatalogOperations {
210
230
  };
211
231
  result: CatalogSessionRecord | null;
212
232
  };
233
+ /**
234
+ * Agent roster of one session, derived from its journal. Read-only: there
235
+ * is no write op, because the rows are a projection of the transcript and
236
+ * a writer would create a second authority that can disagree with it.
237
+ */
238
+ list_session_agents: {
239
+ args: {
240
+ sessionId: string;
241
+ };
242
+ result: SessionAgentRecord[];
243
+ };
213
244
  rename: {
214
245
  args: {
215
246
  sessionId: string;
@@ -1,8 +1,22 @@
1
- import type { AgentEntry, SessionRegistryEntry } from './session-registry-types.js';
2
1
  import type { ResumeReservation, SessionCatalogEvent } from './protocol.js';
2
+ import type { AgentEntry, SessionRegistryEntry } from './session-registry-types.js';
3
3
  export interface SessionResumeClaim {
4
4
  reservation: ResumeReservation;
5
5
  activate(entry: SessionRegistryRegistration): Promise<void>;
6
+ /**
7
+ * Push the reservation deadline out while the caller is still hydrating.
8
+ *
9
+ * The reservation is taken before the transcript is opened, so its window
10
+ * has to cover work whose duration nobody knows yet. Callers that do slow
11
+ * work between reserve and activate must call this periodically; without it
12
+ * a large journal simply outlives its own reservation and `activate` fails
13
+ * after the expensive part already succeeded.
14
+ *
15
+ * Resolves to `false` when the reservation is already settled (activated or
16
+ * cancelled) — renewal is then a no-op, not an error. Rejects when the
17
+ * daemon refuses (expired, or owned by someone else).
18
+ */
19
+ renew(reservationMs?: number): Promise<boolean>;
6
20
  cancel(): Promise<void>;
7
21
  }
8
22
  export type SessionRegistryRegistration = Omit<SessionRegistryEntry, 'status' | 'lastHeartbeatAt' | 'agentCount' | 'agents'> & {
@@ -36,6 +50,8 @@ export declare class ProjectSessionRegistry {
36
50
  sessionId: string;
37
51
  projectSlug: string;
38
52
  projectRoot: string;
53
+ /** Initial reservation window. Callers doing slow hydration should also `renew()`. */
54
+ reservationMs?: number | undefined;
39
55
  }): Promise<SessionResumeClaim>;
40
56
  updateAgents(agents: AgentEntry[]): Promise<void>;
41
57
  private flushAgents;
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Derive the agent roster of one session from its journal.
3
+ *
4
+ * The journal is the source of truth and this is a pure projection over it —
5
+ * deliberately, because the alternative (agents writing their own rows as they
6
+ * spawn) creates a second authority that drifts the first time a process dies
7
+ * between the append and the row. A projection cannot drift: re-run it and it
8
+ * agrees with the file by construction.
9
+ *
10
+ * Three records feed a row, and they do NOT arrive in a fixed order.
11
+ * `agent_session_linked` is appended by the subagent factory, which runs
12
+ * INSIDE `coordinator.spawn()`, while `agent_spawned` is appended by the fleet
13
+ * layer only after that call returns — so the link normally lands first. Every
14
+ * merge here is therefore an upsert keyed on `agentId`, never a lookup that
15
+ * assumes the row already exists.
16
+ */
17
+ import type { Usage } from '../types/provider.js';
18
+ import type { SessionEvent } from '../types/session.js';
19
+ export type SessionAgentStatus = 'running' | 'completed' | 'failed';
20
+ export interface SessionAgentRecord {
21
+ agentId: string;
22
+ /** Role the agent was spawned as, from `agent_spawned`. */
23
+ role?: string | undefined;
24
+ provider?: string | undefined;
25
+ model?: string | undefined;
26
+ /** The agent's own journal id, when it has one of its own. */
27
+ agentSessionId?: string | undefined;
28
+ /** Absolute path of the agent's own JSONL, when it has one. */
29
+ transcriptPath?: string | undefined;
30
+ /** Set when another agent — not the leader — spawned this one. */
31
+ parentAgentId?: string | undefined;
32
+ spawnedAt?: string | undefined;
33
+ endedAt?: string | undefined;
34
+ status: SessionAgentStatus;
35
+ error?: string | undefined;
36
+ /**
37
+ * Events in THIS journal stamped with this agent's id.
38
+ *
39
+ * Non-zero only for agents running on the parent-interleaved writer, whose
40
+ * events land in the leader's file. An agent with its own transcript writes
41
+ * nothing here, so a `0` means "look in `transcriptPath`", not "did nothing".
42
+ */
43
+ interleavedEventCount: number;
44
+ usage?: Usage | undefined;
45
+ }
46
+ /**
47
+ * Project a session's events into one record per agent, ordered by first
48
+ * appearance so the roster reads in spawn order.
49
+ *
50
+ * Tolerates truncated journals: an agent that never got a terminal record
51
+ * stays `running`, which is exactly what a crashed-mid-fleet session should
52
+ * report. Callers that need "running or just never finished" must compare
53
+ * against the session's own liveness, which this function has no view of.
54
+ */
55
+ export declare function deriveSessionAgents(events: Iterable<SessionEvent>): SessionAgentRecord[];
56
+ //# sourceMappingURL=session-agents.d.ts.map
@@ -1,5 +1,19 @@
1
1
  import type { DatabaseSync } from 'node:sqlite';
2
2
  import type { SessionSummary } from '../types/session.js';
3
+ /**
4
+ * Collect the transcript/summary files this catalog indexes.
5
+ *
6
+ * Skips exactly what `DefaultSessionStore`'s own directory scan skips — see
7
+ * `shouldSkipSessionDirectoryEntry`. The two disagreed: the store excluded
8
+ * `subagents/` (and `shared/`, `attachments/`) from what counts as a session,
9
+ * while this walk descended into them, so a full rebuild pushed subagent
10
+ * transcripts into the table backing the user's session list. On a real project
11
+ * that is 3,156 worker transcripts against 170 actual sessions; the five
12
+ * subagent rows found in a live catalog were this leak already in progress.
13
+ *
14
+ * Subagent transcripts are not unindexed — each director run maintains its own
15
+ * `_index.jsonl` beside them. They just are not user-resumable sessions.
16
+ */
3
17
  export declare function walkSessionFiles(root: string, suffix: string): string[];
4
18
  export declare function summarizeTranscriptFile(transcriptFilePath: string, id: string): SessionSummary;
5
19
  export declare function rebuildCatalogIndex(db: DatabaseSync, sessionsDir: string, containedPathFn: (relative: string) => string, transactionFn: <T>(run: () => T) => T, bumpGenerationFn: () => number): {
@@ -1,5 +1,14 @@
1
1
  import type { DatabaseSync } from 'node:sqlite';
2
2
  import type { SessionRegistryEntry } from './session-registry-types.js';
3
+ /**
4
+ * Bumped ONLY for breaking changes — a mismatch throws and takes the catalog
5
+ * with it (`initializeCatalogSchema`), and there is no downgrade path.
6
+ *
7
+ * Purely additive tables do not qualify and must not bump it: every statement
8
+ * below is `IF NOT EXISTS`, so a new binary adds what it needs on open and an
9
+ * older binary reading the same file simply never queries the extra tables.
10
+ * `session_agents` / `session_agent_index` were added this way.
11
+ */
3
12
  export declare const SCHEMA_VERSION = 1;
4
13
  export declare const MAX_LEASE_MS = 120000;
5
14
  export declare const MAX_RESERVATION_MS = 60000;
@@ -25,6 +34,23 @@ export interface ReservationRow {
25
34
  current_session_id: string | null;
26
35
  expires_at: number;
27
36
  }
37
+ export interface SessionAgentRow {
38
+ session_id: string;
39
+ agent_id: string;
40
+ role: string | null;
41
+ provider: string | null;
42
+ model: string | null;
43
+ agent_session_id: string | null;
44
+ transcript_path: string | null;
45
+ parent_agent_id: string | null;
46
+ spawned_at: string | null;
47
+ ended_at: string | null;
48
+ status: string;
49
+ error: string | null;
50
+ interleaved_event_count: number;
51
+ usage_json: string | null;
52
+ ordinal: number;
53
+ }
28
54
  export interface CatalogRow {
29
55
  session_id: string;
30
56
  transcript_relative_path: string;
@@ -1,6 +1,7 @@
1
- import type { SessionRegistryEntry } from './session-registry-types.js';
2
1
  import type { SessionSummary } from '../types/session.js';
3
2
  import type { CatalogSessionRecord, MaintenanceLease, ResumeReservation, SessionCatalogHealth, SessionCatalogListArgs, SessionLeaseCredential } from './protocol.js';
3
+ import { type SessionAgentRecord } from './session-agents.js';
4
+ import type { SessionRegistryEntry } from './session-registry-types.js';
4
5
  export declare class SessionCatalogStore {
5
6
  readonly projectDir: string;
6
7
  readonly databasePath: string;
@@ -24,6 +25,15 @@ export declare class SessionCatalogStore {
24
25
  reconnectLease(credential: SessionLeaseCredential): SessionLeaseCredential;
25
26
  reserveResume(targetSessionId: string, requesterInstanceId: string, currentSessionId?: string, reservationMs?: number): ResumeReservation;
26
27
  activateReservation(reservation: ResumeReservation, entry: SessionRegistryEntry, leaseMs?: number): SessionLeaseCredential;
28
+ /**
29
+ * Extend a live reservation the requester still owns.
30
+ *
31
+ * Deliberately does NOT call `reapExpired()` first: reaping would delete an
32
+ * already-expired row and turn the accurate "expired" answer into the
33
+ * indistinguishable "not owned by this requester". The caller needs to know
34
+ * which of the two happened.
35
+ */
36
+ renewReservation(reservationId: string, requesterInstanceId: string, reservationMs?: number): ResumeReservation;
27
37
  cancelReservation(reservationId: string, requesterInstanceId: string): void;
28
38
  heartbeat(credential: SessionLeaseCredential, status?: SessionRegistryEntry['status']): SessionLeaseCredential;
29
39
  publishAgents(credential: SessionLeaseCredential, revision: number, agents: SessionRegistryEntry['agents']): {
@@ -39,6 +49,22 @@ export declare class SessionCatalogStore {
39
49
  private catalogRecord;
40
50
  listCatalog(criteria?: SessionCatalogListArgs): CatalogSessionRecord[];
41
51
  getSummary(sessionId: string): CatalogSessionRecord | null;
52
+ /**
53
+ * The agent roster of one session, derived from its journal.
54
+ *
55
+ * Cached in `session_agents`, keyed to the transcript's size and mtime: the
56
+ * journal is the authority, so the cache is a memo of a pure function over
57
+ * it rather than a second place agents get recorded. When the file has grown
58
+ * (the usual case — a live session) the rows are re-derived from scratch, so
59
+ * a partial read can never leave a half-updated roster behind.
60
+ *
61
+ * Returns `[]` for a session with no transcript on disk. A caller cannot
62
+ * distinguish that from "a real session that spawned nothing", and should
63
+ * not need to: both mean there is no agent to show.
64
+ */
65
+ listSessionAgents(sessionId: string): SessionAgentRecord[];
66
+ private readSessionAgentRows;
67
+ private writeSessionAgentRows;
42
68
  resolveId(query: string): string;
43
69
  rename(sessionId: string, name: string): Promise<CatalogSessionRecord>;
44
70
  acquireMaintenance(sessionId: string, operation: MaintenanceLease['operation'], holderId: string, leaseMs?: number, holderPid?: number): MaintenanceLease;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Bind a running agent to the same-session note hub so peers can reach it
3
+ * without mailbox. Unregisters via the agent hook on teardown.
4
+ *
5
+ * @module session-note-attach
6
+ */
7
+ import type { AgentInternals } from './core/agent-internals.js';
8
+ export declare function attachSessionNotes(a: AgentInternals): void;
9
+ //# sourceMappingURL=session-note-attach.d.ts.map
@@ -13,7 +13,7 @@ import {
13
13
  parseSkillRef,
14
14
  validateSkillNameAvailable,
15
15
  writeSkeletonSkill
16
- } from "../chunk-SN2DQRL6.js";
16
+ } from "../chunk-RXKSDUAU.js";
17
17
  import {
18
18
  FOREIGN_SKILL_TOOLS,
19
19
  resolveForeignToolIds,
@@ -24,16 +24,16 @@ import "../chunk-LHOA5DWA.js";
24
24
  import {
25
25
  SKILL_LIMITS
26
26
  } from "../chunk-XEBHSJLT.js";
27
- import "../chunk-7ZHZE5EO.js";
27
+ import "../chunk-OSGLYW5J.js";
28
28
  import {
29
29
  isValidSkillNameFormat,
30
30
  parseSkillFrontmatter,
31
31
  stripFrontmatter,
32
32
  validateSkillName
33
- } from "../chunk-WEBMSQP2.js";
34
- import "../chunk-WOEZV3Q4.js";
35
- import "../chunk-TBRL2RCC.js";
33
+ } from "../chunk-FC2ZGRF3.js";
36
34
  import "../chunk-PFZO3C6H.js";
35
+ import "../chunk-25LSLC3G.js";
36
+ import "../chunk-TBRL2RCC.js";
37
37
  export {
38
38
  DEFAULT_SKILLS_SH_URL,
39
39
  FOREIGN_SKILL_TOOLS,