@wrongstack/core 0.285.0 → 0.287.0

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 (340) hide show
  1. package/dist/autophase/phase-orchestrator.d.ts.map +1 -1
  2. package/dist/boot.d.ts.map +1 -1
  3. package/dist/coordination/agent-monitor.d.ts +29 -0
  4. package/dist/coordination/agent-monitor.d.ts.map +1 -1
  5. package/dist/coordination/autonomous-brain.d.ts +0 -2
  6. package/dist/coordination/autonomous-brain.d.ts.map +1 -1
  7. package/dist/coordination/autonomous-coordinator.d.ts +4 -0
  8. package/dist/coordination/autonomous-coordinator.d.ts.map +1 -1
  9. package/dist/coordination/brain-ledger.d.ts +142 -0
  10. package/dist/coordination/brain-ledger.d.ts.map +1 -0
  11. package/dist/coordination/brain-monitor.d.ts +46 -2
  12. package/dist/coordination/brain-monitor.d.ts.map +1 -1
  13. package/dist/coordination/brain.d.ts +43 -0
  14. package/dist/coordination/brain.d.ts.map +1 -1
  15. package/dist/coordination/delegate-tool.d.ts +8 -14
  16. package/dist/coordination/delegate-tool.d.ts.map +1 -1
  17. package/dist/coordination/director/director-btw-notes.d.ts +20 -0
  18. package/dist/coordination/director/director-btw-notes.d.ts.map +1 -0
  19. package/dist/coordination/director/director-collab.d.ts +40 -0
  20. package/dist/coordination/director/director-collab.d.ts.map +1 -0
  21. package/dist/coordination/director.d.ts +28 -9
  22. package/dist/coordination/director.d.ts.map +1 -1
  23. package/dist/coordination/fleet-manager.d.ts +21 -0
  24. package/dist/coordination/fleet-manager.d.ts.map +1 -1
  25. package/dist/coordination/fleet.d.ts +6 -7
  26. package/dist/coordination/fleet.d.ts.map +1 -1
  27. package/dist/coordination/global-mailbox.d.ts +96 -21
  28. package/dist/coordination/global-mailbox.d.ts.map +1 -1
  29. package/dist/coordination/icoordinator.d.ts +1 -3
  30. package/dist/coordination/icoordinator.d.ts.map +1 -1
  31. package/dist/coordination/index.d.ts +2 -1
  32. package/dist/coordination/index.d.ts.map +1 -1
  33. package/dist/coordination/index.js +2176 -806
  34. package/dist/coordination/index.js.map +4 -4
  35. package/dist/coordination/knowledge-graph.d.ts +13 -1
  36. package/dist/coordination/knowledge-graph.d.ts.map +1 -1
  37. package/dist/coordination/mail-tools.d.ts.map +1 -1
  38. package/dist/coordination/mailbox-actions.d.ts +12 -13
  39. package/dist/coordination/mailbox-actions.d.ts.map +1 -1
  40. package/dist/coordination/mailbox-constants.d.ts +64 -0
  41. package/dist/coordination/mailbox-constants.d.ts.map +1 -0
  42. package/dist/coordination/mailbox-events.d.ts +32 -0
  43. package/dist/coordination/mailbox-events.d.ts.map +1 -0
  44. package/dist/coordination/mailbox-message-codec.d.ts +28 -0
  45. package/dist/coordination/mailbox-message-codec.d.ts.map +1 -0
  46. package/dist/coordination/mailbox-types.d.ts +130 -5
  47. package/dist/coordination/mailbox-types.d.ts.map +1 -1
  48. package/dist/coordination/mailbox.d.ts +21 -2
  49. package/dist/coordination/mailbox.d.ts.map +1 -1
  50. package/dist/coordination/package-author-tracker.d.ts.map +1 -1
  51. package/dist/coordination/subagent-result-tool.d.ts.map +1 -1
  52. package/dist/core/agent-loop.d.ts.map +1 -1
  53. package/dist/core/agent-response.d.ts +10 -1
  54. package/dist/core/agent-response.d.ts.map +1 -1
  55. package/dist/core/agent-tools.d.ts.map +1 -1
  56. package/dist/core/agent.d.ts +8 -0
  57. package/dist/core/agent.d.ts.map +1 -1
  58. package/dist/core/context.d.ts +25 -0
  59. package/dist/core/context.d.ts.map +1 -1
  60. package/dist/core/conversation-state.d.ts +6 -0
  61. package/dist/core/conversation-state.d.ts.map +1 -1
  62. package/dist/core/fallback-model.d.ts.map +1 -1
  63. package/dist/core/mailbox-loop.d.ts +12 -5
  64. package/dist/core/mailbox-loop.d.ts.map +1 -1
  65. package/dist/core/system-prompt-builder.d.ts +14 -6
  66. package/dist/core/system-prompt-builder.d.ts.map +1 -1
  67. package/dist/defaults/index.d.ts +0 -1
  68. package/dist/defaults/index.d.ts.map +1 -1
  69. package/dist/defaults/index.js +1690 -1998
  70. package/dist/defaults/index.js.map +4 -4
  71. package/dist/execution/auto-compaction-middleware.d.ts +8 -1
  72. package/dist/execution/auto-compaction-middleware.d.ts.map +1 -1
  73. package/dist/execution/autonomous-runner.d.ts +7 -1
  74. package/dist/execution/autonomous-runner.d.ts.map +1 -1
  75. package/dist/execution/autonomy-brain.d.ts +72 -11
  76. package/dist/execution/autonomy-brain.d.ts.map +1 -1
  77. package/dist/execution/brain-chain.d.ts +53 -0
  78. package/dist/execution/brain-chain.d.ts.map +1 -0
  79. package/dist/execution/brain-evaluation.d.ts +66 -0
  80. package/dist/execution/brain-evaluation.d.ts.map +1 -0
  81. package/dist/execution/brain-runtime.d.ts +171 -0
  82. package/dist/execution/brain-runtime.d.ts.map +1 -0
  83. package/dist/execution/compaction-core.d.ts.map +1 -1
  84. package/dist/execution/council-brain.d.ts +79 -0
  85. package/dist/execution/council-brain.d.ts.map +1 -0
  86. package/dist/execution/council-orchestrator.d.ts +32 -0
  87. package/dist/execution/council-orchestrator.d.ts.map +1 -0
  88. package/dist/execution/council-personas.d.ts +19 -0
  89. package/dist/execution/council-personas.d.ts.map +1 -0
  90. package/dist/execution/council-profiles.d.ts +34 -0
  91. package/dist/execution/council-profiles.d.ts.map +1 -0
  92. package/dist/execution/council-prompts.d.ts +21 -0
  93. package/dist/execution/council-prompts.d.ts.map +1 -0
  94. package/dist/execution/council-resolution.d.ts +57 -0
  95. package/dist/execution/council-resolution.d.ts.map +1 -0
  96. package/dist/execution/design-kit-loader.d.ts.map +1 -1
  97. package/dist/execution/enhance-recovery.d.ts +35 -0
  98. package/dist/execution/enhance-recovery.d.ts.map +1 -0
  99. package/dist/execution/error-handler.d.ts.map +1 -1
  100. package/dist/execution/eternal-autonomy.d.ts +12 -0
  101. package/dist/execution/eternal-autonomy.d.ts.map +1 -1
  102. package/dist/execution/index.d.ts +11 -1
  103. package/dist/execution/index.d.ts.map +1 -1
  104. package/dist/execution/index.js +3076 -526
  105. package/dist/execution/index.js.map +4 -4
  106. package/dist/execution/intelligent-compactor.d.ts +18 -7
  107. package/dist/execution/intelligent-compactor.d.ts.map +1 -1
  108. package/dist/execution/one-shot-llm.d.ts +52 -0
  109. package/dist/execution/one-shot-llm.d.ts.map +1 -0
  110. package/dist/execution/parallel-eternal-engine.d.ts +12 -0
  111. package/dist/execution/parallel-eternal-engine.d.ts.map +1 -1
  112. package/dist/execution/prompt-enhancer.d.ts +23 -4
  113. package/dist/execution/prompt-enhancer.d.ts.map +1 -1
  114. package/dist/execution/prompt-enhancer.js +24 -6
  115. package/dist/execution/prompt-enhancer.js.map +2 -2
  116. package/dist/execution/selective-compactor.d.ts +4 -4
  117. package/dist/execution/strategy-compactor.d.ts +7 -0
  118. package/dist/execution/strategy-compactor.d.ts.map +1 -1
  119. package/dist/execution/tool-executor.d.ts +19 -5
  120. package/dist/execution/tool-executor.d.ts.map +1 -1
  121. package/dist/hooks/registry.d.ts.map +1 -1
  122. package/dist/hooks/runner.d.ts.map +1 -1
  123. package/dist/hooks/shell-executor.d.ts.map +1 -1
  124. package/dist/hq/alerts.d.ts +5 -0
  125. package/dist/hq/alerts.d.ts.map +1 -1
  126. package/dist/hq/auth-store.d.ts +38 -10
  127. package/dist/hq/auth-store.d.ts.map +1 -1
  128. package/dist/hq/commands.d.ts +8 -4
  129. package/dist/hq/commands.d.ts.map +1 -1
  130. package/dist/hq/cost-bridge.d.ts +5 -3
  131. package/dist/hq/cost-bridge.d.ts.map +1 -1
  132. package/dist/hq/factory.d.ts +3 -0
  133. package/dist/hq/factory.d.ts.map +1 -1
  134. package/dist/hq/fleet-bridge.d.ts.map +1 -1
  135. package/dist/hq/index.d.ts +0 -1
  136. package/dist/hq/index.d.ts.map +1 -1
  137. package/dist/hq/index.js +1016 -283
  138. package/dist/hq/index.js.map +4 -4
  139. package/dist/hq/persistence.d.ts +42 -0
  140. package/dist/hq/persistence.d.ts.map +1 -1
  141. package/dist/hq/protocol/brain.d.ts +24 -0
  142. package/dist/hq/protocol/brain.d.ts.map +1 -0
  143. package/dist/hq/protocol/browser.d.ts +12 -0
  144. package/dist/hq/protocol/browser.d.ts.map +1 -0
  145. package/dist/hq/protocol/client.d.ts +69 -0
  146. package/dist/hq/protocol/client.d.ts.map +1 -0
  147. package/dist/hq/protocol/core.d.ts +130 -0
  148. package/dist/hq/protocol/core.d.ts.map +1 -0
  149. package/dist/hq/protocol/fleet.d.ts +73 -0
  150. package/dist/hq/protocol/fleet.d.ts.map +1 -0
  151. package/dist/hq/protocol/mailbox.d.ts +76 -0
  152. package/dist/hq/protocol/mailbox.d.ts.map +1 -0
  153. package/dist/hq/protocol/mcp.d.ts +51 -0
  154. package/dist/hq/protocol/mcp.d.ts.map +1 -0
  155. package/dist/hq/protocol/project.d.ts +26 -0
  156. package/dist/hq/protocol/project.d.ts.map +1 -0
  157. package/dist/hq/protocol/session.d.ts +153 -0
  158. package/dist/hq/protocol/session.d.ts.map +1 -0
  159. package/dist/hq/protocol/tool.d.ts +31 -0
  160. package/dist/hq/protocol/tool.d.ts.map +1 -0
  161. package/dist/hq/protocol.d.ts +10 -559
  162. package/dist/hq/protocol.d.ts.map +1 -1
  163. package/dist/hq/publisher.d.ts +4 -0
  164. package/dist/hq/publisher.d.ts.map +1 -1
  165. package/dist/index.d.ts +24 -8
  166. package/dist/index.d.ts.map +1 -1
  167. package/dist/index.js +7676 -3432
  168. package/dist/index.js.map +4 -4
  169. package/dist/infrastructure/index.js +13 -11
  170. package/dist/infrastructure/index.js.map +2 -2
  171. package/dist/infrastructure/token-counter.d.ts.map +1 -1
  172. package/dist/kernel/events/agent-events.d.ts +283 -0
  173. package/dist/kernel/events/agent-events.d.ts.map +1 -0
  174. package/dist/kernel/events/brain-events.d.ts +176 -0
  175. package/dist/kernel/events/brain-events.d.ts.map +1 -0
  176. package/dist/kernel/events/fleet-events.d.ts +39 -0
  177. package/dist/kernel/events/fleet-events.d.ts.map +1 -0
  178. package/dist/kernel/events/memory-events.d.ts +165 -0
  179. package/dist/kernel/events/memory-events.d.ts.map +1 -0
  180. package/dist/kernel/events/provider-events.d.ts +98 -0
  181. package/dist/kernel/events/provider-events.d.ts.map +1 -0
  182. package/dist/kernel/events/sdd-events.d.ts +118 -0
  183. package/dist/kernel/events/sdd-events.d.ts.map +1 -0
  184. package/dist/kernel/events/session-events.d.ts +227 -0
  185. package/dist/kernel/events/session-events.d.ts.map +1 -0
  186. package/dist/kernel/events/tool-events.d.ts +185 -0
  187. package/dist/kernel/events/tool-events.d.ts.map +1 -0
  188. package/dist/kernel/events/worktree-events.d.ts +58 -0
  189. package/dist/kernel/events/worktree-events.d.ts.map +1 -0
  190. package/dist/kernel/events.d.ts +12 -1282
  191. package/dist/kernel/events.d.ts.map +1 -1
  192. package/dist/kernel/index.js +22 -2
  193. package/dist/kernel/index.js.map +2 -2
  194. package/dist/kernel/run-controller.d.ts +15 -0
  195. package/dist/kernel/run-controller.d.ts.map +1 -1
  196. package/dist/mailbox-attach.d.ts.map +1 -1
  197. package/dist/models/index.js +19 -6
  198. package/dist/models/index.js.map +2 -2
  199. package/dist/models/llm-selector.d.ts +7 -0
  200. package/dist/models/llm-selector.d.ts.map +1 -1
  201. package/dist/observability/index.js +16 -15
  202. package/dist/observability/index.js.map +2 -2
  203. package/dist/plugins/auto-review-plugin.d.ts +36 -0
  204. package/dist/plugins/auto-review-plugin.d.ts.map +1 -0
  205. package/dist/plugins/chimera-plugin.d.ts +8 -0
  206. package/dist/plugins/chimera-plugin.d.ts.map +1 -1
  207. package/dist/security/index.d.ts +1 -0
  208. package/dist/security/index.d.ts.map +1 -1
  209. package/dist/security/index.js +260 -23
  210. package/dist/security/index.js.map +4 -4
  211. package/dist/security/permission-policy-schema.d.ts +77 -0
  212. package/dist/security/permission-policy-schema.d.ts.map +1 -0
  213. package/dist/security/permission-policy.d.ts +5 -0
  214. package/dist/security/permission-policy.d.ts.map +1 -1
  215. package/dist/security/secret-scrubber.d.ts.map +1 -1
  216. package/dist/security/secret-vault.d.ts +9 -0
  217. package/dist/security/secret-vault.d.ts.map +1 -1
  218. package/dist/session-registry.d.ts.map +1 -1
  219. package/dist/skills/index.js.map +2 -2
  220. package/dist/storage/config-loader.d.ts +10 -0
  221. package/dist/storage/config-loader.d.ts.map +1 -1
  222. package/dist/storage/goal-kanban.d.ts +69 -0
  223. package/dist/storage/goal-kanban.d.ts.map +1 -0
  224. package/dist/storage/goal-store.d.ts +1 -1
  225. package/dist/storage/goal-store.d.ts.map +1 -1
  226. package/dist/storage/index.d.ts +1 -1
  227. package/dist/storage/index.d.ts.map +1 -1
  228. package/dist/storage/index.js +572 -879
  229. package/dist/storage/index.js.map +4 -4
  230. package/dist/storage/memory-consolidator.d.ts +9 -1
  231. package/dist/storage/memory-consolidator.d.ts.map +1 -1
  232. package/dist/storage/plan-store.d.ts +1 -1
  233. package/dist/storage/plan-store.d.ts.map +1 -1
  234. package/dist/storage/queue-store.d.ts +4 -0
  235. package/dist/storage/queue-store.d.ts.map +1 -1
  236. package/dist/storage/session-store.d.ts +9 -0
  237. package/dist/storage/session-store.d.ts.map +1 -1
  238. package/dist/storage/task-store.d.ts +1 -1
  239. package/dist/storage/task-store.d.ts.map +1 -1
  240. package/dist/storage/todos-checkpoint.d.ts +2 -2
  241. package/dist/storage/todos-checkpoint.d.ts.map +1 -1
  242. package/dist/tools/council-tool.d.ts +25 -0
  243. package/dist/tools/council-tool.d.ts.map +1 -0
  244. package/dist/tools/index.d.ts +2 -0
  245. package/dist/tools/index.d.ts.map +1 -1
  246. package/dist/tools/index.js +1884 -12
  247. package/dist/tools/index.js.map +4 -4
  248. package/dist/tools/one-shot-llm-tool.d.ts +51 -0
  249. package/dist/tools/one-shot-llm-tool.d.ts.map +1 -0
  250. package/dist/types/config.d.ts +236 -4
  251. package/dist/types/config.d.ts.map +1 -1
  252. package/dist/types/context-window.d.ts.map +1 -1
  253. package/dist/types/council.d.ts +134 -0
  254. package/dist/types/council.d.ts.map +1 -0
  255. package/dist/types/default-config.d.ts +3 -3
  256. package/dist/types/hooks.d.ts +14 -0
  257. package/dist/types/hooks.d.ts.map +1 -1
  258. package/dist/types/index.d.ts +2 -0
  259. package/dist/types/index.d.ts.map +1 -1
  260. package/dist/types/index.js +40 -8
  261. package/dist/types/index.js.map +3 -3
  262. package/dist/types/multi-agent.d.ts +8 -0
  263. package/dist/types/multi-agent.d.ts.map +1 -1
  264. package/dist/types/observability.d.ts +5 -0
  265. package/dist/types/observability.d.ts.map +1 -1
  266. package/dist/types/one-shot-llm.d.ts +128 -0
  267. package/dist/types/one-shot-llm.d.ts.map +1 -0
  268. package/dist/types/plugin.d.ts +6 -0
  269. package/dist/types/plugin.d.ts.map +1 -1
  270. package/dist/types/provider.d.ts +17 -0
  271. package/dist/types/provider.d.ts.map +1 -1
  272. package/dist/types/system-prompt.d.ts +2 -1
  273. package/dist/types/system-prompt.d.ts.map +1 -1
  274. package/dist/types/tool-executor.d.ts +10 -0
  275. package/dist/types/tool-executor.d.ts.map +1 -1
  276. package/dist/types/tool.d.ts +7 -0
  277. package/dist/types/tool.d.ts.map +1 -1
  278. package/dist/utils/atomic-write.d.ts.map +1 -1
  279. package/dist/utils/glob-expand.d.ts.map +1 -1
  280. package/dist/utils/incoming-images.d.ts +39 -0
  281. package/dist/utils/incoming-images.d.ts.map +1 -0
  282. package/dist/utils/index.d.ts +1 -0
  283. package/dist/utils/index.d.ts.map +1 -1
  284. package/dist/utils/index.js +156 -11
  285. package/dist/utils/index.js.map +4 -4
  286. package/dist/utils/tool-wire-compact.d.ts +1 -0
  287. package/dist/utils/tool-wire-compact.d.ts.map +1 -1
  288. package/dist/utils/wstack-paths.d.ts +20 -4
  289. package/dist/utils/wstack-paths.d.ts.map +1 -1
  290. package/dist/worktree/worktree-manager.d.ts +13 -4
  291. package/dist/worktree/worktree-manager.d.ts.map +1 -1
  292. package/instructions/agents/browser.md +25 -16
  293. package/instructions/cli/next-task-predictor.md +5 -3
  294. package/instructions/coordination/subagent-baseline.md +17 -2
  295. package/instructions/leader-after-task.md +19 -8
  296. package/instructions/llm/council-judge.md +19 -0
  297. package/instructions/llm/council-voter.md +22 -0
  298. package/instructions/modes/architect.md +14 -9
  299. package/instructions/modes/audit-lite.md +9 -7
  300. package/instructions/modes/brief-system.md +12 -12
  301. package/instructions/modes/brief.md +7 -5
  302. package/instructions/modes/code-auditor.md +13 -8
  303. package/instructions/modes/code-reviewer.md +13 -8
  304. package/instructions/modes/debug-lite.md +7 -6
  305. package/instructions/modes/debugger.md +13 -9
  306. package/instructions/modes/devops.md +13 -9
  307. package/instructions/modes/plan-lite.md +7 -6
  308. package/instructions/modes/refactor-lite.md +7 -6
  309. package/instructions/modes/refactorer.md +14 -9
  310. package/instructions/modes/research-lite.md +8 -6
  311. package/instructions/modes/research-web.md +18 -55
  312. package/instructions/modes/review-lite.md +7 -6
  313. package/instructions/modes/teach-system.md +15 -15
  314. package/instructions/modes/teach.md +13 -12
  315. package/instructions/modes/test-lite.md +6 -5
  316. package/instructions/modes/tester.md +13 -9
  317. package/instructions/modes/ui-design.md +14 -8
  318. package/instructions/sections/tool/commit-hygiene.md +1 -7
  319. package/instructions/sections/tool/common-patterns.md +7 -1
  320. package/instructions/sections/tool/delegation-full.md +3 -31
  321. package/instructions/sections/tool/mailbox-compact.md +1 -1
  322. package/instructions/sections/tool/mailbox-full.md +6 -22
  323. package/instructions/system.md +294 -8
  324. package/package.json +2 -2
  325. package/skills/docker-deploy/SKILL.md +1 -1
  326. package/skills/mailbox-bridge/SKILL.md +16 -7
  327. package/skills/output-standards/SKILL.md +16 -16
  328. package/skills/wrongstack-mailbox/SKILL.md +57 -12
  329. package/dist/coordination/director-construction.d.ts +0 -90
  330. package/dist/coordination/director-construction.d.ts.map +0 -1
  331. package/dist/hq/agent-bridge.d.ts +0 -27
  332. package/dist/hq/agent-bridge.d.ts.map +0 -1
  333. package/dist/plugins/git-plugin.d.ts +0 -15
  334. package/dist/plugins/git-plugin.d.ts.map +0 -1
  335. package/dist/plugins/observability-plugin.d.ts +0 -19
  336. package/dist/plugins/observability-plugin.d.ts.map +0 -1
  337. package/dist/plugins/plan-plugin.d.ts +0 -16
  338. package/dist/plugins/plan-plugin.d.ts.map +0 -1
  339. package/dist/storage/memory-store.d.ts +0 -119
  340. package/dist/storage/memory-store.d.ts.map +0 -1
@@ -87,6 +87,12 @@ but once that bridge dies the next start mints a new one. So always read
87
87
  it freshly from the token file (or accept it from the user); never
88
88
  hardcode it into prompts or committed code, and re-read it after a 401.
89
89
 
90
+ The project token authorizes the route, **not the caller's identity**. The
91
+ bridge accepts caller-supplied `from`, message type, registration ids, and
92
+ acknowledgement `readerId`; it does not separately authorize control/steer
93
+ messages. Use an honest, stable agent id, never impersonate `hq@...` or another
94
+ agent, and treat every token holder as fully trusted for that project mailbox.
95
+
90
96
  If you're working with explicit env vars:
91
97
 
92
98
  ```ts
@@ -371,18 +377,55 @@ setInterval(() => {
371
377
  }, 30_000);
372
378
  ```
373
379
 
374
- ### Poll, don't long-poll
380
+ ### Real-time push via SSE (preferred) or polling
381
+
382
+ The bridge supports **Server-Sent Events (SSE)** on `GET /mailbox/events`
383
+ for real-time push. This is the preferred approach — no polling needed.
384
+
385
+ ```ts
386
+ // Open an SSE connection that pushes events in real-time.
387
+ const res = await fetch(`${url}/mailbox/events`, {
388
+ headers: { Authorization: `Bearer ${token}` },
389
+ });
390
+ const reader = res.body!.getReader();
391
+ const decoder = new TextDecoder();
392
+
393
+ for (;;) {
394
+ const { done, value } = await reader.read();
395
+ if (done) break;
396
+ const text = decoder.decode(value);
397
+ // SSE events arrive as: data: {"type":"message.sent",...}\n\n
398
+ for (const line of text.split('\n')) {
399
+ if (!line.startsWith('data: ')) continue;
400
+ const event = JSON.parse(line.slice(6));
401
+ if (event.type === 'message.sent') {
402
+ console.log(`[${event.type}] ${event.from} → ${event.to}: ${event.messageId}`);
403
+ // Fetch the full message via /mailbox/query or /mailbox/check.
404
+ }
405
+ }
406
+ }
407
+ ```
408
+
409
+ **SSE event types:**
410
+
411
+ | Event `type` | When | Payload fields |
412
+ |--------------|------|---------------|
413
+ | `message.sent` | A message was sent via `POST /mailbox/send` | `messageId`, `from`, `to`, `timestamp` |
414
+
415
+ The SSE stream sends a `: connected` comment on open and a
416
+ `: keepalive` comment every 15 s to prevent proxy/CDN timeouts.
375
417
 
376
- The bridge does not support long-polling or websockets. Poll for new
377
- messages on a 5–10 s interval. Don't poll faster than 1 Hz — that's noisy
378
- and gives nothing useful.
418
+ **Important:** SSE events carry only the message id and metadata — not
419
+ the full message body. When you receive an event, call `/mailbox/check`
420
+ or `/mailbox/query` to fetch the complete message content.
379
421
 
380
- For normal inbox catch-up, prefer `/mailbox/check` over manual
381
- `/mailbox/query` + `/mailbox/ack-many`. It checks direct mail,
382
- `baseId` alias mail, and broadcasts in one call, dedupes messages, and
383
- can optionally mark them read or completed via one batch ack.
422
+ **Fallback: polling.** If your HTTP client doesn't support SSE (or you're
423
+ behind a proxy that buffers responses), poll on a 5–10 s interval. Don't
424
+ poll faster than 1 Hz the bridge enforces a rate limit of 120 requests
425
+ per minute per bearer token.
384
426
 
385
427
  ```ts
428
+ // Fallback: poll every 5 s when SSE is unavailable.
386
429
  async function pollOnce(): Promise<void> {
387
430
  const result = await mb('/mailbox/check', {
388
431
  agentId,
@@ -504,7 +547,7 @@ All routes take JSON bodies on POST (or no body on GET). All require
504
547
 
505
548
  | Method | Path | Purpose |
506
549
  |--------|------|---------|
507
- | POST | `/mailbox/send` | Send a message |
550
+ | POST | `/mailbox/send` | Send a message (supports optional `ttlMs` for auto-expiry) |
508
551
  | POST | `/mailbox/query` | Query messages (filters: `to`, `from`, `unreadBy`, `type`, `minPriority`, `incompleteOnly`, `limit`, `since`) |
509
552
  | POST | `/mailbox/check` | Read inbox mail for `agentId`/`baseId` plus broadcasts; optionally `markRead=false`, `completed=true`, `outcome` |
510
553
  | POST | `/mailbox/ack` | Acknowledge one message |
@@ -516,6 +559,7 @@ All routes take JSON bodies on POST (or no body on GET). All require
516
559
  | POST | `/mailbox/heartbeat` | Update client heartbeat |
517
560
  | GET | `/mailbox/agents` | List all registered agents |
518
561
  | GET | `/mailbox/agents/online` | List agents with a live heartbeat (within 60 s) |
562
+ | GET | `/mailbox/events` | **SSE stream** — real-time push of mailbox events (auth required) |
519
563
  | GET | `/healthz` | Liveness probe — does NOT require auth |
520
564
 
521
565
  ### Error shape
@@ -528,6 +572,7 @@ All routes take JSON bodies on POST (or no body on GET). All require
528
572
  |------|------|----------------------------|
529
573
  | `VALIDATION_ERROR` | 400 | Missing or wrong-type field. Read the message; it tells you which field. |
530
574
  | `UNAUTHORIZED` | 401 | Token mismatch. Re-read `~/.wrongstack/projects/<slug>/.mailbox.token` and try again — the bridge may have restarted. |
575
+ | `RATE_LIMITED` | 429 | Rate limit exceeded (max 120 requests/min per token). Slow down or use SSE instead of polling. |
531
576
  | `NOT_FOUND` | 404 | Wrong route. Check the path table above. |
532
577
  | `INTERNAL_ERROR` | 500 | WrongStack-side failure. Retry once; if it persists, surface to the user. |
533
578
 
@@ -606,9 +651,9 @@ await mb('/mailbox/send', {
606
651
  - **Don't reuse one `agentId` across multiple external sessions.** If
607
652
  two processes register under the same id, heartbeats overwrite each
608
653
  other and read receipts become unreliable.
609
- - **Don't poll faster than 1 Hz.** The bridge isn't load-tested for
610
- high-frequency polling, and there's no rate limit at the server side
611
- your noisy client can starve other agents.
654
+ - **Don't poll faster than 1 Hz.** The bridge enforces a rate limit of
655
+ 120 requests/min per bearer token (returns `429 RATE_LIMITED` beyond
656
+ that). Prefer SSE (`GET /mailbox/events`) over polling when possible.
612
657
  - **Don't include the token in any logged output.** It's the only
613
658
  credential. If you must print the URL, redact the token (`[REDACTED]`).
614
659
  - **Don't reply to a broadcast with another broadcast.** Replies should
@@ -1,90 +0,0 @@
1
- /**
2
- * Director construction helpers.
3
- *
4
- * The `Director` constructor was historically a single 300+ line function
5
- * that interleaved field assignments with two pieces of event-listener
6
- * wiring: the `task.completed` listener on the coordinator (which mirrors
7
- * completions into the in-memory wait table, the on-disk checkpoint, and
8
- * the session JSONL event stream) and the `budget.threshold_reached`
9
- * filter on the FleetBus (which implements the heartbeat-driven timeout
10
- * policy and the per-kind auto-extension logic).
11
- *
12
- * Both wirings were inlined because they close over a lot of Director
13
- * private state (`completed`, `taskWaiters`, `taskDescriptions`,
14
- * `appendSessionEvent`, `scheduleManifest`, `recordExtension`,
15
- * `maxBudgetExtensions`, `maxFleetCostUsd`, etc.). Pulling them out
16
- * without losing the closures requires a narrow `DirectorInternals`
17
- * shape — exactly what this module exposes.
18
- *
19
- * The constructor itself stays a member-initializer; the helpers below
20
- * are called *during* construction, after the relevant fields are
21
- * populated. Each helper ends with `coordinator.on(...)` /
22
- * `fleet.filter(...)` registration so the listener is wired exactly
23
- * once, at construction time.
24
- */
25
- import type { TaskResult, TaskSpec } from '../types/multi-agent.js';
26
- /** Cap on the in-memory `completed` map. Trimmed oldest-first when exceeded. */
27
- export declare const MAX_COMPLETED = 10000;
28
- /** Narrow shape the wiring helpers need from a partially-constructed Director.
29
- * The helpers accept a `Director` instance (structural typing — the class
30
- * exposes every field this interface requires), so the constructor can pass
31
- * `this` directly without an explicit cast.
32
- *
33
- * Note: Private/protected members cannot be picked via Pick<> because keyof
34
- * only returns public keys. We define the interface explicitly rather than
35
- * deriving from Director to include private fields the wiring code needs. */
36
- export interface DirectorInternals {
37
- id: string;
38
- directorRunId: string;
39
- completed: Map<string, import('../types/multi-agent.js').TaskResult>;
40
- taskWaiters: Map<string, {
41
- promise: Promise<import('../types/multi-agent.js').TaskResult>;
42
- resolve: (r: import('../types/multi-agent.js').TaskResult) => void;
43
- }>;
44
- taskDescriptions: Map<string, string>;
45
- stateCheckpoint: import('../storage/director-state.js').DirectorStateCheckpoint | null;
46
- usage: import('./fleet-bus.js').FleetUsageAggregator;
47
- fleetManager: import('./fleet-manager.js').FleetManager | undefined;
48
- fleet: import('./fleet-bus.js').FleetBus;
49
- coordinator: import('./icoordinator.js').ICoordinator;
50
- maxBudgetExtensions: number;
51
- maxFleetCostUsd: number;
52
- recordExtension: (subagentId: string, taskId: string | undefined, kind: string, newLimit: number) => void;
53
- appendSessionEvent: (event: Parameters<import('../types/session.js').SessionWriter['append']>[0]) => Promise<void>;
54
- scheduleManifest: () => void;
55
- brain: import('./brain.js').BrainArbiter | undefined;
56
- }
57
- export { TIMEOUT_PREEMPT_FRACTION } from './subagent-budget.js';
58
- /**
59
- * Wire the coordinator's `task.completed` event into the Director's
60
- * in-memory wait table, the on-disk state checkpoint, and the session
61
- * JSONL event stream.
62
- *
63
- * Mirrors coordinator completion events into:
64
- * - `d.completed` (capped at `Director.MAX_COMPLETED`, oldest-first trim)
65
- * - `d.taskWaiters` (resolve and clear the matching waiter)
66
- * - `d.stateCheckpoint.recordTaskStatus(...)` + `setUsage(...)`
67
- * - session event stream via `d.appendSessionEvent(...)`
68
- * - fleet manifest via `d.fleetManager?.flushManifest()` or `d.scheduleManifest()`
69
- *
70
- * Returns the listener so the Director can call `coordinator.off(...)`
71
- * during `shutdown()`.
72
- */
73
- export declare function wireTaskCompletedListener(d: DirectorInternals): (payload: {
74
- task: TaskSpec;
75
- result: TaskResult;
76
- }) => void;
77
- /**
78
- * Wire the FleetBus's `budget.threshold_reached` filter with the
79
- * Director's auto-extend/deny policy. Implements:
80
- *
81
- * - Heartbeat-driven timeout policy: while a subagent keeps executing
82
- * tools it never dies on time; once it stops making progress between
83
- * grants, deny. Wall-clock time alone is never a reliable "stuck" signal.
84
- * - Per-kind auto-extension with `maxBudgetExtensions` cap.
85
- * - Brain-decision routing when a brain arbiter is configured.
86
- * - Collab-subagent passthrough (BugHunter / RefactorPlanner / Critic
87
- * own their own budget routing via the CollabSession).
88
- */
89
- export declare function wireBudgetHandler(d: DirectorInternals): void;
90
- //# sourceMappingURL=director-construction.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"director-construction.d.ts","sourceRoot":"","sources":["../../src/coordination/director-construction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAEpE,gFAAgF;AAChF,eAAO,MAAM,aAAa,QAAS,CAAC;AAEpC;;;;;;;8EAO8E;AAC9E,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,yBAAyB,EAAE,UAAU,CAAC,CAAC;IACrE,WAAW,EAAE,GAAG,CACd,MAAM,EACN;QAAE,OAAO,EAAE,OAAO,CAAC,OAAO,yBAAyB,EAAE,UAAU,CAAC,CAAC;QAAC,OAAO,EAAE,CAAC,CAAC,EAAE,OAAO,yBAAyB,EAAE,UAAU,KAAK,IAAI,CAAA;KAAE,CACvI,CAAC;IACF,gBAAgB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,eAAe,EAAE,OAAO,8BAA8B,EAAE,uBAAuB,GAAG,IAAI,CAAC;IACvF,KAAK,EAAE,OAAO,gBAAgB,EAAE,oBAAoB,CAAC;IACrD,YAAY,EAAE,OAAO,oBAAoB,EAAE,YAAY,GAAG,SAAS,CAAC;IACpE,KAAK,EAAE,OAAO,gBAAgB,EAAE,QAAQ,CAAC;IACzC,WAAW,EAAE,OAAO,mBAAmB,EAAE,YAAY,CAAC;IACtD,mBAAmB,EAAE,MAAM,CAAC;IAC5B,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1G,kBAAkB,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,OAAO,qBAAqB,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACnH,gBAAgB,EAAE,MAAM,IAAI,CAAC;IAC7B,KAAK,EAAE,OAAO,YAAY,EAAE,YAAY,GAAG,SAAS,CAAC;CACtD;AAyBD,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAShE;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,EAAE,iBAAiB,GAAG,CAAC,OAAO,EAAE;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,UAAU,CAAA;CAAE,KAAK,IAAI,CAiEzH;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,iBAAiB,GAAG,IAAI,CA2J5D"}
@@ -1,27 +0,0 @@
1
- /**
2
- * AgentMonitorEventBridge — forwards local agent timeline and status events
3
- * to the HQ publisher as structured HQ event envelopes, so the HQ browser
4
- * dashboard sees real-time agent conversation streams.
5
- */
6
- import type { EventBus } from '../kernel/events.js';
7
- import { type HqEventEnvelope } from './protocol.js';
8
- export type HqAgentEventPublisher = (envelope: HqEventEnvelope) => void;
9
- export interface AgentMonitorEventBridgeOptions {
10
- /** Local EventBus emitting agent.timeline.* and agent.status_changed events. */
11
- events: EventBus;
12
- /** Client/project identifiers for HQ envelope authorship. */
13
- clientId: string;
14
- projectId: string;
15
- /**
16
- * Publish callback — called with each HQ event envelope. Wire this to
17
- * your HQ publisher's `send()` or queue method when connected.
18
- * When null (no HQ connection), events are silently dropped.
19
- */
20
- publish?: HqAgentEventPublisher | undefined;
21
- }
22
- /**
23
- * Start forwarding agent monitoring events to HQ. Returns a disposer that
24
- * unsubscribes all listeners — call on shutdown.
25
- */
26
- export declare function startAgentMonitorEventBridge(opts: AgentMonitorEventBridgeOptions): () => void;
27
- //# sourceMappingURL=agent-bridge.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"agent-bridge.d.ts","sourceRoot":"","sources":["../../src/hq/agent-bridge.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAgF,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AAEnI,MAAM,MAAM,qBAAqB,GAAG,CAAC,QAAQ,EAAE,eAAe,KAAK,IAAI,CAAC;AAExE,MAAM,WAAW,8BAA8B;IAC7C,gFAAgF;IAChF,MAAM,EAAE,QAAQ,CAAC;IACjB,6DAA6D;IAC7D,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,OAAO,CAAC,EAAE,qBAAqB,GAAG,SAAS,CAAC;CAC7C;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,8BAA8B,GAAG,MAAM,IAAI,CAyD7F"}
@@ -1,15 +0,0 @@
1
- import type { Plugin } from '../types/plugin.js';
2
- import type { SlashCommand } from '../index.js';
3
- /**
4
- * GitPlugin — built-in git helpers.
5
- *
6
- * Registers `/commit`, `/gitcheck` and `/push`. First-party ("official")
7
- * plugin, so the commands keep their bare names and `gc` / `gcstatus` aliases.
8
- * `/commit` generates an LLM commit message from the session provider when one
9
- * is available, falling back to diff heuristics. No configuration required.
10
- */
11
- export declare function createGitPlugin(): Plugin;
12
- export declare function buildCommitCommand(): SlashCommand;
13
- export declare function buildGitcheckCommand(): SlashCommand;
14
- export declare function buildPushCommand(): SlashCommand;
15
- //# sourceMappingURL=git-plugin.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"git-plugin.d.ts","sourceRoot":"","sources":["../../src/plugins/git-plugin.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,KAAK,EAAE,YAAY,EAAW,MAAM,aAAa,CAAC;AAEzD;;;;;;;GAOG;AACH,wBAAgB,eAAe,IAAI,MAAM,CA2BxC;AAgLD,wBAAgB,kBAAkB,IAAI,YAAY,CA+FjD;AAED,wBAAgB,oBAAoB,IAAI,YAAY,CAmBnD;AAED,wBAAgB,gBAAgB,IAAI,YAAY,CAiC/C"}
@@ -1,19 +0,0 @@
1
- import type { Plugin } from '../types/plugin.js';
2
- import type { SlashCommand } from '../index.js';
3
- import type { HealthRegistry, MetricsSink } from '../types/observability.js';
4
- interface ObservabilityPluginOptions {
5
- metricsSink?: MetricsSink | undefined;
6
- healthRegistry?: HealthRegistry | undefined;
7
- }
8
- /**
9
- * ObservabilityPlugin — runtime metrics + health checks.
10
- *
11
- * Registers `/metrics` and `/health`. First-party ("official") plugin, so the
12
- * commands keep their bare names. Both require the host to have started the
13
- * metrics subsystem (`--metrics`); without it they report that and no-op.
14
- */
15
- export declare function createObservabilityPlugin(opts?: ObservabilityPluginOptions): Plugin;
16
- export declare function buildMetricsCommand(metricsSink?: MetricsSink): SlashCommand;
17
- export declare function buildHealthCommand(healthRegistry?: HealthRegistry): SlashCommand;
18
- export {};
19
- //# sourceMappingURL=observability-plugin.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"observability-plugin.d.ts","sourceRoot":"","sources":["../../src/plugins/observability-plugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAE7E,UAAU,0BAA0B;IAClC,WAAW,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IACtC,cAAc,CAAC,EAAE,cAAc,GAAG,SAAS,CAAC;CAC7C;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,CAAC,EAAE,0BAA0B,GAAG,MAAM,CA8BnF;AAQD,wBAAgB,mBAAmB,CAAC,WAAW,CAAC,EAAE,WAAW,GAAG,YAAY,CAqC3E;AAED,wBAAgB,kBAAkB,CAAC,cAAc,CAAC,EAAE,cAAc,GAAG,YAAY,CAmBhF"}
@@ -1,16 +0,0 @@
1
- import type { Plugin } from '../types/plugin.js';
2
- import type { SlashCommand } from '../index.js';
3
- import type { WstackPaths } from '../utils/wstack-paths.js';
4
- interface PlanPluginOptions {
5
- paths?: WstackPaths | undefined;
6
- }
7
- /**
8
- * PlanPlugin — strategic plan board (`/plan`), the higher-level counterpart to
9
- * `/todos`. First-party ("official") plugin, so the command keeps its bare
10
- * name. Plans persist to `<projectDir>/plan.json` (from the injected
11
- * `WstackPaths`); the live context is read off `ctx` at dispatch.
12
- */
13
- export declare function createPlanPlugin(opts?: PlanPluginOptions): Plugin;
14
- export declare function buildPlanCommand(planPath?: string): SlashCommand;
15
- export {};
16
- //# sourceMappingURL=plan-plugin.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plan-plugin.d.ts","sourceRoot":"","sources":["../../src/plugins/plan-plugin.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAW,MAAM,aAAa,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAE5D,UAAU,iBAAiB;IACzB,KAAK,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;CACjC;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,CAAC,EAAE,iBAAiB,GAAG,MAAM,CAyBjE;AAYD,wBAAgB,gBAAgB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,YAAY,CAuHhE"}
@@ -1,119 +0,0 @@
1
- import type { MemoryEntry, MemoryRelevanceContext, MemoryScope, MemoryStore, ScoredEntry } from '../types/memory.js';
2
- import type { EventBus } from '../kernel/events.js';
3
- import type { WstackPaths } from '../utils/wstack-paths.js';
4
- import { type MemoryBackend } from './memory-backend.js';
5
- export interface MemoryStoreOptions {
6
- paths: WstackPaths;
7
- /**
8
- * Optional event bus — when provided, mutations emit events so plugins
9
- * and other subsystems can react to memory changes.
10
- */
11
- events?: EventBus | undefined;
12
- /**
13
- * Storage backend. Defaults to FileMemoryBackend when omitted.
14
- * Plugins can register a custom backend (graph, semantic, vector)
15
- * via the DI container to override storage behavior.
16
- */
17
- backend?: MemoryBackend | undefined;
18
- }
19
- /**
20
- * Three scopes:
21
- * project-agents → <project>/.wrongstack/AGENTS.md (committed)
22
- * project-memory → ~/.wrongstack/projects/<hash>/memory.md (per-project agent notes)
23
- * user-memory → ~/.wrongstack/memory.md (global personal memory)
24
- */
25
- export declare class DefaultMemoryStore implements MemoryStore {
26
- private readonly files;
27
- private readonly events?;
28
- private traceId?;
29
- private readonly backend;
30
- /**
31
- * Per-scope serialization queue. `remember` / `forget` / `consolidate` /
32
- * `clear` are read-modify-write against a single file; without a lock,
33
- * two concurrent calls on the same scope can read the same baseline and
34
- * the later write silently drops the earlier entry. We chain each
35
- * mutation onto the prior promise for the same scope so they run in
36
- * issue order. Different scopes still proceed in parallel.
37
- *
38
- * The chain tracks only the last pending write. If a write fails, its
39
- * error is caught and swallowed so the chain stays alive for subsequent
40
- * calls. The error is stored in `writeErrors` so callers can learn about
41
- * it on the next read operation.
42
- */
43
- private readonly writeChain;
44
- /** Last write error per scope — surfaced as warnings on the next readAll(). */
45
- private readonly writeErrors;
46
- /**
47
- * When the global root is a temporary directory (opencode, CI sandboxes),
48
- * memory files are also mirrored to the project tree so they survive
49
- * session cleanup. The primary path stays in the temp root for isolation;
50
- * this backup ensures memory is never lost.
51
- */
52
- private readonly persistBackup;
53
- private readonly backupDir;
54
- /**
55
- * Per-scope tracked byte sizes — incremented on `remember()`, decremented on
56
- * `forget()`, recalculated after `consolidate()`. Eliminates the redundant
57
- * readAll() call that previously checked the file size after every write.
58
- */
59
- private readonly _trackedByteSizes;
60
- /** Result cache for scoreRelevant() — keyed by scope + context hash, TTL 30s. */
61
- private readonly _scoreCache;
62
- /**
63
- * Per-entry cached lowercase strings — lazily allocated once and reused
64
- * across scoreRelevant() calls so repeated scoring of the same entries skips
65
- * re-lowercasing. Keyed by entry object identity; cleared (set to null) on
66
- * every mutation (remember/forget/consolidate/clear) via invalidateScoreCaches().
67
- */
68
- private _cachedLower;
69
- constructor(opts: MemoryStoreOptions);
70
- /** Expose the backend for plugin introspection and advanced queries. */
71
- getBackend(): MemoryBackend;
72
- private runSerialized;
73
- /**
74
- * Recalculate the tracked byte size for a scope by re-reading the file and
75
- * summing the serialized byte length of each line. Called after consolidate()
76
- * (which modifies the file) to keep the tracker accurate.
77
- */
78
- private _recalcTrackedByteSize;
79
- readAll(): Promise<string>;
80
- read(scope: MemoryScope): Promise<string>;
81
- /**
82
- * List entries from a scope, newest first. Delegates to the backend
83
- * so graph/semantic backends can return enriched or filtered results.
84
- */
85
- list(scope?: MemoryScope, limit?: number): Promise<MemoryEntry[]>;
86
- /**
87
- * Find memories related to the given text via graph traversal.
88
- * Falls back to content search when no graph backend is available.
89
- */
90
- findRelated(text: string, scope?: MemoryScope, limit?: number): Promise<MemoryEntry[]>;
91
- search(query: string, scope?: MemoryScope, limit?: number): Promise<MemoryEntry[]>;
92
- remember(text: string, scope?: MemoryScope, metadata?: Omit<Partial<MemoryEntry>, 'scope' | 'text' | 'ts'>): Promise<void>;
93
- /**
94
- * Drop the relevance caches after a mutation. Both the per-context score
95
- * cache and the per-entry lowercase cache are keyed on entry objects that a
96
- * mutation invalidates, so they must be cleared together when entries change.
97
- */
98
- private invalidateScoreCaches;
99
- /**
100
- * Score and rank memories by relevance to the current context.
101
- * Returns entries with score >= MIN_RELEVANCE_SCORE, sorted highest first.
102
- */
103
- scoreRelevant(ctx: MemoryRelevanceContext, scope?: MemoryScope, limit?: number): Promise<ScoredEntry[]>;
104
- forget(query: string, scope?: MemoryScope): Promise<number>;
105
- consolidate(scope: MemoryScope): Promise<void>;
106
- clear(scope?: MemoryScope): Promise<void>;
107
- /**
108
- * Return a new MemoryStore proxy that carries `traceId` on every storage
109
- * event. The original store is left unchanged — callers that need a
110
- * trace-decorated view (e.g. session-run tools) receive the proxy while
111
- * the singleton remains trace-free for boot-time use.
112
- *
113
- * The proxy implements the full `MemoryStore` interface; all other
114
- * properties (backend, etc.) are delegated to the original store.
115
- */
116
- withTraceId(traceId: string): MemoryStore;
117
- private mirrorBackup;
118
- }
119
- //# sourceMappingURL=memory-store.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"memory-store.d.ts","sourceRoot":"","sources":["../../src/storage/memory-store.ts"],"names":[],"mappings":"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"}