@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
@@ -18,12 +18,12 @@ import {
18
18
  createChronicleProjectAccess,
19
19
  isChronicleProjectServerAvailable,
20
20
  resolveChronicleProjectServerOptions
21
- } from "../chunk-ASX6AW36.js";
21
+ } from "../chunk-LXWCMQNJ.js";
22
22
  import {
23
23
  childChronicleContext,
24
24
  createChronicleContext,
25
25
  startChronicleFileObserver
26
- } from "../chunk-62V2AFVG.js";
26
+ } from "../chunk-U4FWBSO3.js";
27
27
  import {
28
28
  CHRONICLE_FACET_FIELDS,
29
29
  CHRONICLE_PROJECT_SERVER_MAX_FRAME_CHARS,
@@ -41,49 +41,49 @@ import {
41
41
  findChroniclePartitions,
42
42
  isChronicleMetricsAvailable,
43
43
  resolveChronicleRuntimeLocation
44
- } from "../chunk-AT4V4XGI.js";
44
+ } from "../chunk-4BMVPOHO.js";
45
45
  import "../chunk-SZ6AYUIZ.js";
46
- import {
47
- createChroniclePromptManifest
48
- } from "../chunk-2YU4WVBW.js";
49
- import "../chunk-H5E77KUJ.js";
50
- import "../chunk-TYW2GI5I.js";
46
+ import "../chunk-J2WRWR37.js";
51
47
  import "../chunk-LHOA5DWA.js";
52
- import "../chunk-GFJOMSHG.js";
53
- import "../chunk-QRTG4XTI.js";
48
+ import "../chunk-LA7CLDRW.js";
49
+ import "../chunk-WAHQVNWT.js";
54
50
  import "../chunk-EODDVJBM.js";
55
- import "../chunk-CQQL4ZOQ.js";
56
- import "../chunk-RPOA7IAE.js";
57
- import "../chunk-FFSX2QDQ.js";
58
- import "../chunk-DEIQMBD2.js";
59
- import "../chunk-FNXVT7HF.js";
51
+ import "../chunk-ZT7JNIGX.js";
52
+ import "../chunk-W5VITDM2.js";
53
+ import "../chunk-YPT4A46F.js";
54
+ import "../chunk-B7F4WVP4.js";
60
55
  import "../chunk-WQTOVMGV.js";
61
- import "../chunk-AD7ZFZCS.js";
62
- import "../chunk-KBZGE6LN.js";
56
+ import "../chunk-FNXVT7HF.js";
57
+ import "../chunk-5BMIE7QG.js";
58
+ import "../chunk-DYLPMV4Q.js";
63
59
  import "../chunk-5S437PRC.js";
64
- import "../chunk-WZO23AWO.js";
60
+ import {
61
+ createChroniclePromptManifest
62
+ } from "../chunk-2YU4WVBW.js";
63
+ import "../chunk-6FHWXLPT.js";
64
+ import "../chunk-M27LIEKV.js";
65
65
  import "../chunk-XEBHSJLT.js";
66
- import "../chunk-VB3H5WWB.js";
67
- import "../chunk-M2WF6AXG.js";
68
- import "../chunk-4XV6IR37.js";
66
+ import "../chunk-6NWEVFEL.js";
67
+ import "../chunk-LSMMOS2Z.js";
69
68
  import "../chunk-4VWO3ZXL.js";
70
- import "../chunk-EFEHDQGY.js";
71
- import "../chunk-AWNQ6ED6.js";
72
- import "../chunk-FSWCWSTS.js";
69
+ import "../chunk-ZHZ2Y2DH.js";
70
+ import "../chunk-HI3JGZR2.js";
71
+ import "../chunk-HMLIGAU7.js";
73
72
  import "../chunk-TRT2HRWZ.js";
74
73
  import "../chunk-LX5QWLBL.js";
75
- import "../chunk-FAYRX2AD.js";
76
- import "../chunk-7ZHZE5EO.js";
74
+ import "../chunk-POOOIWE5.js";
75
+ import "../chunk-OSGLYW5J.js";
76
+ import "../chunk-FC2ZGRF3.js";
77
+ import "../chunk-THEGTRAG.js";
77
78
  import "../chunk-SVT4RNTR.js";
78
- import "../chunk-WEBMSQP2.js";
79
- import "../chunk-YNCVSFGF.js";
80
- import "../chunk-CB2HFKTP.js";
79
+ import "../chunk-SAFHACFA.js";
80
+ import "../chunk-VVBP6KGT.js";
81
81
  import "../chunk-KJ2ZTQSL.js";
82
82
  import "../chunk-B4AMLZPB.js";
83
+ import "../chunk-PFZO3C6H.js";
83
84
  import "../chunk-O37BQ65S.js";
84
- import "../chunk-WOEZV3Q4.js";
85
+ import "../chunk-25LSLC3G.js";
85
86
  import "../chunk-TBRL2RCC.js";
86
- import "../chunk-PFZO3C6H.js";
87
87
  export {
88
88
  CHRONICLE_FACET_FIELDS,
89
89
  CHRONICLE_PROJECT_SERVER_MAX_FRAME_CHARS,
@@ -9,11 +9,5 @@ export interface ChronicleLegacyImportResult {
9
9
  /** Day families refused for a broken chain; none of their events landed. */
10
10
  quarantined: ChronicleQuarantinedFamily[];
11
11
  }
12
- /** A chain break found while importing; carries enough context to act on. */
13
- export declare class ChronicleImportError extends Error {
14
- readonly day: string;
15
- readonly sequence: number;
16
- constructor(message: string, day: string, sequence: number);
17
- }
18
12
  export declare function importLegacyChronicleJournal(journal: ChronicleSqliteJournal, directory: string): Promise<ChronicleLegacyImportResult>;
19
13
  //# sourceMappingURL=legacy-journal-import.d.ts.map
@@ -54,6 +54,20 @@ export declare class ChronicleMetricsIngester {
54
54
  private ingestEventAtomically;
55
55
  private ingestEvent;
56
56
  private ingestDailyCounters;
57
+ /**
58
+ * Per-tool fold used by the auto-thinning pipeline. Distinct from
59
+ * `daily_counters` (which is name-agnostic): keyed by `(day, tool_name)`
60
+ * so `underusedTools()` can pick candidates without scanning the journal.
61
+ *
62
+ * `kind` selects which counter increments:
63
+ * - `invocation` — `tool.started` and `tool.executed` (success)
64
+ * - `failure` — `tool.failed` and `tool.executed` with `!ok`
65
+ *
66
+ * `lastInvokedAt` is the event's wall-clock at fold time, not the tool's
67
+ * internal duration; the auto-thinning policy uses it to compute
68
+ * "days since last use" relative to the request's anchor day.
69
+ */
70
+ private ingestToolDaily;
57
71
  private ingestProvider;
58
72
  private ingestTokenCost;
59
73
  private ingestTask;
@@ -1,7 +1,7 @@
1
1
  import type { DatabaseSync } from 'node:sqlite';
2
2
  import type { ChronicleSignalFamily } from './query.js';
3
3
  import type { ChronicleEvent } from './types.js';
4
- export declare const SCHEMA_VERSION = 4;
4
+ export declare const SCHEMA_VERSION = 6;
5
5
  export declare const READ_CHUNK_BYTES: number;
6
6
  export declare const SQLITE_SOURCE_PREFIX = "sqlite:";
7
7
  export declare const SQLITE_INGEST_BATCH = 2000;
@@ -28,6 +28,15 @@ export interface ChronicleProviderDailyRow {
28
28
  avgDurationMs: number;
29
29
  maxDurationMs: number;
30
30
  }
31
+ /** A row of {@link ChronicleMetricsStore.underusedTools}. */
32
+ export interface ChronicleUnderusedToolRow {
33
+ toolName: string;
34
+ invocations: number;
35
+ failures: number;
36
+ durationMsTotal: number;
37
+ lastInvokedAt: number | null;
38
+ daysSinceLastUse: number | null;
39
+ }
31
40
  export interface ChronicleTaskOutcomeRow {
32
41
  taskId: string;
33
42
  runId: string;
@@ -8,9 +8,10 @@
8
8
  * the previous run (per-partition byte offsets in `ingest_state`), so the
9
9
  * raw JSONL partitions can be purged by retention without losing metrics.
10
10
  */
11
+ import { type ChronicleFileLineageRow, type ChronicleMetricsRefreshResult, type ChronicleMetricsSummary, type ChronicleProviderDailyRow, type ChronicleTaskOutcomeRow, type ChronicleUnderusedToolRow, isChronicleMetricsAvailable } from './metrics-schema.js';
11
12
  import type { ChronicleSummary } from './query.js';
12
- import { isChronicleMetricsAvailable, type ChronicleFileLineageRow, type ChronicleMetricsRefreshResult, type ChronicleMetricsSummary, type ChronicleProviderDailyRow, type ChronicleTaskOutcomeRow } from './metrics-schema.js';
13
- export { isChronicleMetricsAvailable, type ChronicleFileLineageRow, type ChronicleMetricsRefreshResult, type ChronicleMetricsSummary, type ChronicleProviderDailyRow, type ChronicleTaskOutcomeRow, };
13
+ export type { ChronicleFileLineageRow, ChronicleMetricsRefreshResult, ChronicleMetricsSummary, ChronicleProviderDailyRow, ChronicleTaskOutcomeRow, ChronicleUnderusedToolRow, };
14
+ export { isChronicleMetricsAvailable };
14
15
  export declare class ChronicleMetricsStore {
15
16
  private readonly db;
16
17
  private readonly directory;
@@ -43,6 +44,23 @@ export declare class ChronicleMetricsStore {
43
44
  limit?: number;
44
45
  }): ChronicleFileLineageRow[];
45
46
  summary(): ChronicleMetricsSummary;
47
+ /**
48
+ * Per-tool candidates for the auto-thinning pipeline. Returns one row per
49
+ * tool that has at least one day in `[fromDay, toDay]` (default: last 30
50
+ * days), with `invocations` summed across the window and `lastInvokedAt`
51
+ * taken as the max. The caller is responsible for the "underused" filter
52
+ * (`invocations <= maxInvocations`, `lastInvokedAt` older than
53
+ * `toDay - idleDays`) and for excluding tools still active in the window.
54
+ *
55
+ * The query intentionally does NOT pre-filter by threshold — the policy
56
+ * layer owns that decision so the same data feeds both the dry-run
57
+ * (`/tool autothin candidates`) and the apply path.
58
+ */
59
+ underusedTools(options?: {
60
+ from?: string;
61
+ to?: string;
62
+ limit?: number;
63
+ }): ChronicleUnderusedToolRow[];
46
64
  /**
47
65
  * A `ChronicleSummary` for the default/unfiltered dashboard view — only
48
66
  * `from`/`to` (day-precision) narrow it.
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  createChronicleContext,
4
4
  startChronicleFileObserver
5
- } from "../chunk-62V2AFVG.js";
5
+ } from "../chunk-U4FWBSO3.js";
6
6
  import {
7
7
  CHRONICLE_MAX_APPEND_BATCH,
8
8
  CHRONICLE_PROJECT_SERVER_MAX_FRAME_CHARS,
@@ -17,54 +17,54 @@ import {
17
17
  encodeChronicleProjectServerMessage,
18
18
  importLegacyChronicleJournal,
19
19
  resolveChronicleRuntimeLocation
20
- } from "../chunk-AT4V4XGI.js";
20
+ } from "../chunk-4BMVPOHO.js";
21
21
  import "../chunk-SZ6AYUIZ.js";
22
- import {
23
- restrictFilePermissions
24
- } from "../chunk-H5E77KUJ.js";
25
- import "../chunk-TYW2GI5I.js";
22
+ import "../chunk-J2WRWR37.js";
26
23
  import "../chunk-LHOA5DWA.js";
27
- import "../chunk-GFJOMSHG.js";
28
- import "../chunk-QRTG4XTI.js";
24
+ import "../chunk-LA7CLDRW.js";
25
+ import "../chunk-WAHQVNWT.js";
29
26
  import "../chunk-EODDVJBM.js";
30
- import "../chunk-CQQL4ZOQ.js";
31
- import "../chunk-RPOA7IAE.js";
32
- import "../chunk-FFSX2QDQ.js";
33
- import "../chunk-DEIQMBD2.js";
27
+ import "../chunk-ZT7JNIGX.js";
28
+ import "../chunk-W5VITDM2.js";
29
+ import "../chunk-YPT4A46F.js";
30
+ import "../chunk-B7F4WVP4.js";
31
+ import "../chunk-WQTOVMGV.js";
34
32
  import {
35
33
  useDaemonPerfDefaults
36
34
  } from "../chunk-FNXVT7HF.js";
37
- import "../chunk-WQTOVMGV.js";
38
- import "../chunk-AD7ZFZCS.js";
35
+ import "../chunk-5BMIE7QG.js";
39
36
  import {
40
37
  startSharedHeapWatchdog
41
- } from "../chunk-KBZGE6LN.js";
38
+ } from "../chunk-DYLPMV4Q.js";
42
39
  import "../chunk-5S437PRC.js";
43
- import "../chunk-WZO23AWO.js";
40
+ import {
41
+ restrictFilePermissions
42
+ } from "../chunk-6FHWXLPT.js";
43
+ import "../chunk-M27LIEKV.js";
44
44
  import "../chunk-XEBHSJLT.js";
45
- import "../chunk-VB3H5WWB.js";
46
- import "../chunk-M2WF6AXG.js";
47
- import "../chunk-4XV6IR37.js";
45
+ import "../chunk-6NWEVFEL.js";
46
+ import "../chunk-LSMMOS2Z.js";
48
47
  import "../chunk-4VWO3ZXL.js";
49
- import "../chunk-EFEHDQGY.js";
50
- import "../chunk-AWNQ6ED6.js";
51
- import "../chunk-FSWCWSTS.js";
48
+ import "../chunk-ZHZ2Y2DH.js";
49
+ import "../chunk-HI3JGZR2.js";
50
+ import "../chunk-HMLIGAU7.js";
52
51
  import "../chunk-TRT2HRWZ.js";
53
52
  import "../chunk-LX5QWLBL.js";
54
- import "../chunk-FAYRX2AD.js";
53
+ import "../chunk-POOOIWE5.js";
55
54
  import {
56
55
  atomicWrite
57
- } from "../chunk-7ZHZE5EO.js";
56
+ } from "../chunk-OSGLYW5J.js";
57
+ import "../chunk-FC2ZGRF3.js";
58
+ import "../chunk-THEGTRAG.js";
58
59
  import "../chunk-SVT4RNTR.js";
59
- import "../chunk-WEBMSQP2.js";
60
- import "../chunk-YNCVSFGF.js";
61
- import "../chunk-CB2HFKTP.js";
60
+ import "../chunk-SAFHACFA.js";
61
+ import "../chunk-VVBP6KGT.js";
62
62
  import "../chunk-KJ2ZTQSL.js";
63
63
  import "../chunk-B4AMLZPB.js";
64
+ import "../chunk-PFZO3C6H.js";
64
65
  import "../chunk-O37BQ65S.js";
65
- import "../chunk-WOEZV3Q4.js";
66
+ import "../chunk-25LSLC3G.js";
66
67
  import "../chunk-TBRL2RCC.js";
67
- import "../chunk-PFZO3C6H.js";
68
68
 
69
69
  // src/chronicle/project-server.ts
70
70
  import { randomBytes } from "node:crypto";
@@ -94,13 +94,15 @@ function parseArgs(argv) {
94
94
  if (!values.get(key)) throw new Error(`Chronicle project server requires ${key}`);
95
95
  }
96
96
  const retentionInput = Number(values.get("--retention-days"));
97
+ const durabilityInput = values.get("--durability") ?? process.env["WRONGSTACK_CHRONICLE_DURABILITY"] ?? "";
97
98
  return {
98
99
  projectRoot: path.resolve(values.get("--project-root")),
99
100
  globalRoot: path.resolve(values.get("--global-root")),
100
101
  projectId: values.get("--project-id"),
101
102
  projectDir: path.resolve(values.get("--project-dir")),
102
103
  workspaceId: values.get("--workspace-id"),
103
- retentionDays: Number.isFinite(retentionInput) && retentionInput > 0 ? retentionInput : 30
104
+ retentionDays: Number.isFinite(retentionInput) && retentionInput > 0 ? retentionInput : 30,
105
+ durability: durabilityInput.trim().toLowerCase() === "full" ? "full" : "normal"
104
106
  };
105
107
  }
106
108
  useDaemonPerfDefaults();
@@ -176,6 +178,7 @@ function store() {
176
178
  const journal = new ChronicleSqliteJournal({
177
179
  directory: chronicleDirectory,
178
180
  retentionDays: parsed.retentionDays,
181
+ durability: parsed.durability,
179
182
  // Bound burst growth independently of age retention. Prefix eviction keeps
180
183
  // at most this many rows while preserving chain verification via checkpoints.
181
184
  maxEvents: 1e5,
@@ -263,6 +266,10 @@ async function appendInputs(inputs) {
263
266
  }
264
267
  var watcherSink = {
265
268
  append: async (input) => (await appendInputs([input]))[0],
269
+ // The file observer reconciles a whole burst at once (a branch switch, a
270
+ // build drop). Routing that through `appendInputs` as ONE call keeps it to
271
+ // one `BEGIN IMMEDIATE` + one fsync instead of one per changed file.
272
+ appendBatch: (inputs) => appendInputs([...inputs]),
266
273
  flush: async () => flushJournals(),
267
274
  stats: () => journalForToday().stats()
268
275
  };
@@ -520,7 +527,8 @@ async function stop(_reason) {
520
527
  else resolve2();
521
528
  });
522
529
  });
523
- await watcher?.close().catch(() => {
530
+ await watcher?.close().catch((error) => {
531
+ watcherLastError = error instanceof Error ? error.message : String(error);
524
532
  });
525
533
  watcher = void 0;
526
534
  await flushJournals().catch(() => {
@@ -8,6 +8,19 @@ import type { ChronicleEvent, ChronicleEventInput } from './types.js';
8
8
  */
9
9
  export interface ChronicleEventSink {
10
10
  append(input: ChronicleEventInput): Promise<ChronicleEvent>;
11
+ /**
12
+ * Append many events as ONE unit of work. Optional: adapters that emit a
13
+ * single event per call have nothing to gain, and leaving it optional keeps
14
+ * every existing sink (and test double) valid without a shim.
15
+ *
16
+ * The SQLite journal wraps each append in `BEGIN IMMEDIATE` and, at
17
+ * `synchronous = FULL`, fsyncs on commit. Callers that produce a burst —
18
+ * the file observer reconciling a branch switch, say — turn N transactions
19
+ * and N fsyncs into one by routing through here. SQLite's binding is
20
+ * synchronous, so `Promise.all` over N `append()` calls does NOT overlap
21
+ * them; batching is the only thing that actually helps.
22
+ */
23
+ appendBatch?(inputs: readonly ChronicleEventInput[]): Promise<ChronicleEvent[]>;
11
24
  flush(): Promise<void>;
12
25
  stats(): ChronicleJournalStats;
13
26
  }
@@ -1,9 +1,9 @@
1
1
  import type { ChronicleJournalStats, ChroniclePurgeResult } from './journal.js';
2
2
  import { ChronicleStorageQuotaError } from './sqlite-journal-quota.js';
3
- import { CHRONICLE_SQLITE_FILE, LEGACY_JSONL_BOUNDARY_KEY, LEGACY_JSONL_MIGRATION_KEY, LEGACY_JSONL_QUARANTINE_KEY } from './sqlite-journal-schema.js';
3
+ import { CHRONICLE_SQLITE_FILE, LEGACY_JSONL_BOUNDARY_KEY, LEGACY_JSONL_MIGRATION_KEY } from './sqlite-journal-schema.js';
4
4
  import { ChronicleSqliteQueryEngine, type ChronicleSqliteQueryEngineOptions } from './sqlite-query.js';
5
5
  import { type ChronicleEvent, type ChronicleEventInput, type ChronicleVerifyResult } from './types.js';
6
- export { CHRONICLE_SQLITE_FILE, ChronicleStorageQuotaError, LEGACY_JSONL_BOUNDARY_KEY, LEGACY_JSONL_MIGRATION_KEY, LEGACY_JSONL_QUARANTINE_KEY, };
6
+ export { CHRONICLE_SQLITE_FILE, ChronicleStorageQuotaError, LEGACY_JSONL_BOUNDARY_KEY, LEGACY_JSONL_MIGRATION_KEY };
7
7
  export interface ChronicleSqliteJournalOptions {
8
8
  /** Directory holding the journal, i.e. `<projectDir>/chronicle`. */
9
9
  directory: string;
@@ -17,6 +17,24 @@ export interface ChronicleSqliteJournalOptions {
17
17
  /** Aggregate SQLite allocation ceiling across the database, WAL, and SHM files. */
18
18
  maxBytes?: number | undefined;
19
19
  retentionCheckIntervalMs?: number | undefined;
20
+ /**
21
+ * WAL durability level. Defaults to `'normal'`.
22
+ *
23
+ * In WAL mode `NORMAL` still survives a **process** crash — an aborted
24
+ * agent, an OOM kill, a `taskkill` — because the WAL is already written;
25
+ * only an OS crash or power loss can cost the last commits. `FULL` adds an
26
+ * fsync to every commit to close that last gap.
27
+ *
28
+ * This journal is the highest-volume writer in the runtime (measured at
29
+ * ~7.2GB over 7 days), so that per-commit fsync was the single largest
30
+ * source of disk I/O in the system — paid continuously, for telemetry that
31
+ * is reconstructible from the session logs. Every other SQLite store here
32
+ * (mailbox, kanban, techstack, vector-memory) runs `NORMAL`.
33
+ *
34
+ * Set `'full'` when the deployment genuinely needs power-loss durability
35
+ * for the audit trail.
36
+ */
37
+ durability?: 'normal' | 'full' | undefined;
20
38
  }
21
39
  export interface ChronicleSqlitePurgeOptions {
22
40
  retentionDays: number;
@@ -36,6 +36,7 @@ var ERROR_CODES = {
36
36
  SESSION_NOT_FOUND: "SESSION_NOT_FOUND",
37
37
  SESSION_CORRUPTED: "SESSION_CORRUPTED",
38
38
  SESSION_WRITE_FAILED: "SESSION_WRITE_FAILED",
39
+ SESSION_ID_REQUIRED: "SESSION_ID_REQUIRED",
39
40
  // Container / Registry
40
41
  CONTAINER_TOKEN_ALREADY_BOUND: "CONTAINER_TOKEN_ALREADY_BOUND",
41
42
  CONTAINER_TOKEN_NOT_BOUND: "CONTAINER_TOKEN_NOT_BOUND",
@@ -330,4 +331,4 @@ export {
330
331
  isParseError,
331
332
  isSddError
332
333
  };
333
- //# sourceMappingURL=chunk-WOEZV3Q4.js.map
334
+ //# sourceMappingURL=chunk-25LSLC3G.js.map