@spinabot/brigade 0.1.2 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1931) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +748 -88
  3. package/brigade.mjs +150 -73
  4. package/dist/agents/a2a-policy-canonicalize.d.ts +60 -0
  5. package/dist/agents/a2a-policy-canonicalize.d.ts.map +1 -0
  6. package/dist/agents/a2a-policy-canonicalize.js +103 -0
  7. package/dist/agents/a2a-policy-canonicalize.js.map +1 -0
  8. package/dist/agents/agent-event-bus.d.ts +221 -0
  9. package/dist/agents/agent-event-bus.d.ts.map +1 -0
  10. package/dist/agents/agent-event-bus.js +88 -0
  11. package/dist/agents/agent-event-bus.js.map +1 -0
  12. package/dist/agents/agent-events.d.ts +84 -0
  13. package/dist/agents/agent-events.d.ts.map +1 -0
  14. package/dist/agents/agent-events.js +309 -0
  15. package/dist/agents/agent-events.js.map +1 -0
  16. package/dist/agents/agent-events.types.d.ts +139 -0
  17. package/dist/agents/agent-events.types.d.ts.map +1 -0
  18. package/dist/agents/agent-events.types.js +27 -0
  19. package/dist/agents/agent-events.types.js.map +1 -0
  20. package/dist/agents/agent-loop.d.ts +145 -0
  21. package/dist/agents/agent-loop.d.ts.map +1 -0
  22. package/dist/agents/agent-loop.js +1938 -0
  23. package/dist/agents/agent-loop.js.map +1 -0
  24. package/dist/agents/agent-scope.d.ts +28 -0
  25. package/dist/agents/agent-scope.d.ts.map +1 -0
  26. package/dist/agents/agent-scope.js +39 -0
  27. package/dist/agents/agent-scope.js.map +1 -0
  28. package/dist/agents/approval-bridge.d.ts +139 -0
  29. package/dist/agents/approval-bridge.d.ts.map +1 -0
  30. package/dist/agents/approval-bridge.js +178 -0
  31. package/dist/agents/approval-bridge.js.map +1 -0
  32. package/dist/agents/carrow.d.ts +49 -0
  33. package/dist/agents/carrow.d.ts.map +1 -0
  34. package/dist/agents/carrow.js +57 -0
  35. package/dist/agents/carrow.js.map +1 -0
  36. package/dist/agents/channels/abort-triggers.d.ts +17 -0
  37. package/dist/agents/channels/abort-triggers.d.ts.map +1 -0
  38. package/dist/agents/channels/abort-triggers.js +52 -0
  39. package/dist/agents/channels/abort-triggers.js.map +1 -0
  40. package/dist/agents/channels/access-control/index.d.ts +5 -0
  41. package/dist/agents/channels/access-control/index.d.ts.map +1 -0
  42. package/dist/agents/channels/access-control/index.js +4 -0
  43. package/dist/agents/channels/access-control/index.js.map +1 -0
  44. package/dist/agents/channels/access-control/policy.d.ts +69 -0
  45. package/dist/agents/channels/access-control/policy.d.ts.map +1 -0
  46. package/dist/agents/channels/access-control/policy.js +123 -0
  47. package/dist/agents/channels/access-control/policy.js.map +1 -0
  48. package/dist/agents/channels/access-control/store.d.ts +86 -0
  49. package/dist/agents/channels/access-control/store.d.ts.map +1 -0
  50. package/dist/agents/channels/access-control/store.js +482 -0
  51. package/dist/agents/channels/access-control/store.js.map +1 -0
  52. package/dist/agents/channels/access-control/types.d.ts +52 -0
  53. package/dist/agents/channels/access-control/types.d.ts.map +1 -0
  54. package/dist/agents/channels/access-control/types.js +20 -0
  55. package/dist/agents/channels/access-control/types.js.map +1 -0
  56. package/dist/agents/channels/active-manager.d.ts +31 -0
  57. package/dist/agents/channels/active-manager.d.ts.map +1 -0
  58. package/dist/agents/channels/active-manager.js +41 -0
  59. package/dist/agents/channels/active-manager.js.map +1 -0
  60. package/dist/agents/channels/agent-switch-command.d.ts +53 -0
  61. package/dist/agents/channels/agent-switch-command.d.ts.map +1 -0
  62. package/dist/agents/channels/agent-switch-command.js +349 -0
  63. package/dist/agents/channels/agent-switch-command.js.map +1 -0
  64. package/dist/agents/channels/approval-router.d.ts +158 -0
  65. package/dist/agents/channels/approval-router.d.ts.map +1 -0
  66. package/dist/agents/channels/approval-router.js +446 -0
  67. package/dist/agents/channels/approval-router.js.map +1 -0
  68. package/dist/agents/channels/channel-entry-contract.d.ts +70 -0
  69. package/dist/agents/channels/channel-entry-contract.d.ts.map +1 -0
  70. package/dist/agents/channels/channel-entry-contract.js +48 -0
  71. package/dist/agents/channels/channel-entry-contract.js.map +1 -0
  72. package/dist/agents/channels/channel-plugin-manager.d.ts +86 -0
  73. package/dist/agents/channels/channel-plugin-manager.d.ts.map +1 -0
  74. package/dist/agents/channels/channel-plugin-manager.js +345 -0
  75. package/dist/agents/channels/channel-plugin-manager.js.map +1 -0
  76. package/dist/agents/channels/chat-type.d.ts +27 -0
  77. package/dist/agents/channels/chat-type.d.ts.map +1 -0
  78. package/dist/agents/channels/chat-type.js +33 -0
  79. package/dist/agents/channels/chat-type.js.map +1 -0
  80. package/dist/agents/channels/dedupe.d.ts +44 -0
  81. package/dist/agents/channels/dedupe.d.ts.map +1 -0
  82. package/dist/agents/channels/dedupe.js +80 -0
  83. package/dist/agents/channels/dedupe.js.map +1 -0
  84. package/dist/agents/channels/inbound-pipeline.d.ts +90 -0
  85. package/dist/agents/channels/inbound-pipeline.d.ts.map +1 -0
  86. package/dist/agents/channels/inbound-pipeline.js +721 -0
  87. package/dist/agents/channels/inbound-pipeline.js.map +1 -0
  88. package/dist/agents/channels/last-channel.d.ts +56 -0
  89. package/dist/agents/channels/last-channel.d.ts.map +1 -0
  90. package/dist/agents/channels/last-channel.js +65 -0
  91. package/dist/agents/channels/last-channel.js.map +1 -0
  92. package/dist/agents/channels/manager.d.ts +76 -0
  93. package/dist/agents/channels/manager.d.ts.map +1 -0
  94. package/dist/agents/channels/manager.js +132 -0
  95. package/dist/agents/channels/manager.js.map +1 -0
  96. package/dist/agents/channels/media-capture.d.ts +23 -0
  97. package/dist/agents/channels/media-capture.d.ts.map +1 -0
  98. package/dist/agents/channels/media-capture.js +40 -0
  99. package/dist/agents/channels/media-capture.js.map +1 -0
  100. package/dist/agents/channels/plugin-channel-manager-facade.d.ts +18 -0
  101. package/dist/agents/channels/plugin-channel-manager-facade.d.ts.map +1 -0
  102. package/dist/agents/channels/plugin-channel-manager-facade.js +52 -0
  103. package/dist/agents/channels/plugin-channel-manager-facade.js.map +1 -0
  104. package/dist/agents/channels/reply-sanitizer.d.ts +38 -0
  105. package/dist/agents/channels/reply-sanitizer.d.ts.map +1 -0
  106. package/dist/agents/channels/reply-sanitizer.js +94 -0
  107. package/dist/agents/channels/reply-sanitizer.js.map +1 -0
  108. package/dist/agents/channels/retryable-inbound.d.ts +31 -0
  109. package/dist/agents/channels/retryable-inbound.d.ts.map +1 -0
  110. package/dist/agents/channels/retryable-inbound.js +37 -0
  111. package/dist/agents/channels/retryable-inbound.js.map +1 -0
  112. package/dist/agents/channels/types.adapters.d.ts +399 -0
  113. package/dist/agents/channels/types.adapters.d.ts.map +1 -0
  114. package/dist/agents/channels/types.adapters.js +33 -0
  115. package/dist/agents/channels/types.adapters.js.map +1 -0
  116. package/dist/agents/channels/types.core.d.ts +134 -0
  117. package/dist/agents/channels/types.core.d.ts.map +1 -0
  118. package/dist/agents/channels/types.core.js +32 -0
  119. package/dist/agents/channels/types.core.js.map +1 -0
  120. package/dist/agents/channels/types.plugin.d.ts +78 -0
  121. package/dist/agents/channels/types.plugin.d.ts.map +1 -0
  122. package/dist/agents/channels/types.plugin.js +30 -0
  123. package/dist/agents/channels/types.plugin.js.map +1 -0
  124. package/dist/agents/channels/whatsapp/account-config.d.ts +50 -0
  125. package/dist/agents/channels/whatsapp/account-config.d.ts.map +1 -0
  126. package/dist/agents/channels/whatsapp/account-config.js +105 -0
  127. package/dist/agents/channels/whatsapp/account-config.js.map +1 -0
  128. package/dist/agents/channels/whatsapp/adapter.d.ts +22 -0
  129. package/dist/agents/channels/whatsapp/adapter.d.ts.map +1 -0
  130. package/dist/agents/channels/whatsapp/adapter.js +270 -0
  131. package/dist/agents/channels/whatsapp/adapter.js.map +1 -0
  132. package/dist/agents/channels/whatsapp/chunk.d.ts +26 -0
  133. package/dist/agents/channels/whatsapp/chunk.d.ts.map +1 -0
  134. package/dist/agents/channels/whatsapp/chunk.js +123 -0
  135. package/dist/agents/channels/whatsapp/chunk.js.map +1 -0
  136. package/dist/agents/channels/whatsapp/connection.d.ts +249 -0
  137. package/dist/agents/channels/whatsapp/connection.d.ts.map +1 -0
  138. package/dist/agents/channels/whatsapp/connection.js +1628 -0
  139. package/dist/agents/channels/whatsapp/connection.js.map +1 -0
  140. package/dist/agents/channels/whatsapp/convex-auth-state.d.ts +34 -0
  141. package/dist/agents/channels/whatsapp/convex-auth-state.d.ts.map +1 -0
  142. package/dist/agents/channels/whatsapp/convex-auth-state.js +168 -0
  143. package/dist/agents/channels/whatsapp/convex-auth-state.js.map +1 -0
  144. package/dist/agents/channels/whatsapp/format.d.ts +15 -0
  145. package/dist/agents/channels/whatsapp/format.d.ts.map +1 -0
  146. package/dist/agents/channels/whatsapp/format.js +66 -0
  147. package/dist/agents/channels/whatsapp/format.js.map +1 -0
  148. package/dist/agents/channels/whatsapp/inbound-extras.d.ts +30 -0
  149. package/dist/agents/channels/whatsapp/inbound-extras.d.ts.map +1 -0
  150. package/dist/agents/channels/whatsapp/inbound-extras.js +146 -0
  151. package/dist/agents/channels/whatsapp/inbound-extras.js.map +1 -0
  152. package/dist/agents/channels/whatsapp/index.d.ts +7 -0
  153. package/dist/agents/channels/whatsapp/index.d.ts.map +1 -0
  154. package/dist/agents/channels/whatsapp/index.js +7 -0
  155. package/dist/agents/channels/whatsapp/index.js.map +1 -0
  156. package/dist/agents/channels/whatsapp/media.d.ts +47 -0
  157. package/dist/agents/channels/whatsapp/media.d.ts.map +1 -0
  158. package/dist/agents/channels/whatsapp/media.js +192 -0
  159. package/dist/agents/channels/whatsapp/media.js.map +1 -0
  160. package/dist/agents/channels/whatsapp/module.d.ts +10 -0
  161. package/dist/agents/channels/whatsapp/module.d.ts.map +1 -0
  162. package/dist/agents/channels/whatsapp/module.js +17 -0
  163. package/dist/agents/channels/whatsapp/module.js.map +1 -0
  164. package/dist/agents/channels/whatsapp/plugin.d.ts +60 -0
  165. package/dist/agents/channels/whatsapp/plugin.d.ts.map +1 -0
  166. package/dist/agents/channels/whatsapp/plugin.js +238 -0
  167. package/dist/agents/channels/whatsapp/plugin.js.map +1 -0
  168. package/dist/agents/cmd-ism-guard.d.ts +47 -0
  169. package/dist/agents/cmd-ism-guard.d.ts.map +1 -0
  170. package/dist/agents/cmd-ism-guard.js +100 -0
  171. package/dist/agents/cmd-ism-guard.js.map +1 -0
  172. package/dist/agents/config-write-guard.d.ts +25 -0
  173. package/dist/agents/config-write-guard.d.ts.map +1 -0
  174. package/dist/agents/config-write-guard.js +95 -0
  175. package/dist/agents/config-write-guard.js.map +1 -0
  176. package/dist/agents/content-quality-retry.d.ts +66 -0
  177. package/dist/agents/content-quality-retry.d.ts.map +1 -0
  178. package/dist/agents/content-quality-retry.js +140 -0
  179. package/dist/agents/content-quality-retry.js.map +1 -0
  180. package/dist/agents/error-classifier.d.ts +89 -0
  181. package/dist/agents/error-classifier.d.ts.map +1 -0
  182. package/dist/agents/error-classifier.js +630 -0
  183. package/dist/agents/error-classifier.js.map +1 -0
  184. package/dist/agents/exec-gate.d.ts +113 -0
  185. package/dist/agents/exec-gate.d.ts.map +1 -0
  186. package/dist/agents/exec-gate.js +335 -0
  187. package/dist/agents/exec-gate.js.map +1 -0
  188. package/dist/agents/exec-session-allow.d.ts +30 -0
  189. package/dist/agents/exec-session-allow.d.ts.map +1 -0
  190. package/dist/agents/exec-session-allow.js +50 -0
  191. package/dist/agents/exec-session-allow.js.map +1 -0
  192. package/dist/agents/extensions/active-registry.d.ts +4 -0
  193. package/dist/agents/extensions/active-registry.d.ts.map +1 -0
  194. package/dist/agents/extensions/active-registry.js +18 -0
  195. package/dist/agents/extensions/active-registry.js.map +1 -0
  196. package/dist/agents/extensions/discovery.d.ts +84 -0
  197. package/dist/agents/extensions/discovery.d.ts.map +1 -0
  198. package/dist/agents/extensions/discovery.js +249 -0
  199. package/dist/agents/extensions/discovery.js.map +1 -0
  200. package/dist/agents/extensions/hook-runner.d.ts +67 -0
  201. package/dist/agents/extensions/hook-runner.d.ts.map +1 -0
  202. package/dist/agents/extensions/hook-runner.js +155 -0
  203. package/dist/agents/extensions/hook-runner.js.map +1 -0
  204. package/dist/agents/extensions/index.d.ts +15 -0
  205. package/dist/agents/extensions/index.d.ts.map +1 -0
  206. package/dist/agents/extensions/index.js +14 -0
  207. package/dist/agents/extensions/index.js.map +1 -0
  208. package/dist/agents/extensions/loader.d.ts +38 -0
  209. package/dist/agents/extensions/loader.d.ts.map +1 -0
  210. package/dist/agents/extensions/loader.js +142 -0
  211. package/dist/agents/extensions/loader.js.map +1 -0
  212. package/dist/agents/extensions/modules/arxiv.d.ts +28 -0
  213. package/dist/agents/extensions/modules/arxiv.d.ts.map +1 -0
  214. package/dist/agents/extensions/modules/arxiv.js +145 -0
  215. package/dist/agents/extensions/modules/arxiv.js.map +1 -0
  216. package/dist/agents/extensions/modules/brave.d.ts +28 -0
  217. package/dist/agents/extensions/modules/brave.d.ts.map +1 -0
  218. package/dist/agents/extensions/modules/brave.js +489 -0
  219. package/dist/agents/extensions/modules/brave.js.map +1 -0
  220. package/dist/agents/extensions/modules/duckduckgo.d.ts +27 -0
  221. package/dist/agents/extensions/modules/duckduckgo.d.ts.map +1 -0
  222. package/dist/agents/extensions/modules/duckduckgo.js +263 -0
  223. package/dist/agents/extensions/modules/duckduckgo.js.map +1 -0
  224. package/dist/agents/extensions/modules/exa.d.ts +19 -0
  225. package/dist/agents/extensions/modules/exa.d.ts.map +1 -0
  226. package/dist/agents/extensions/modules/exa.js +208 -0
  227. package/dist/agents/extensions/modules/exa.js.map +1 -0
  228. package/dist/agents/extensions/modules/firecrawl.d.ts +51 -0
  229. package/dist/agents/extensions/modules/firecrawl.d.ts.map +1 -0
  230. package/dist/agents/extensions/modules/firecrawl.js +280 -0
  231. package/dist/agents/extensions/modules/firecrawl.js.map +1 -0
  232. package/dist/agents/extensions/modules/github-search.d.ts +29 -0
  233. package/dist/agents/extensions/modules/github-search.d.ts.map +1 -0
  234. package/dist/agents/extensions/modules/github-search.js +197 -0
  235. package/dist/agents/extensions/modules/github-search.js.map +1 -0
  236. package/dist/agents/extensions/modules/hackernews.d.ts +17 -0
  237. package/dist/agents/extensions/modules/hackernews.d.ts.map +1 -0
  238. package/dist/agents/extensions/modules/hackernews.js +144 -0
  239. package/dist/agents/extensions/modules/hackernews.js.map +1 -0
  240. package/dist/agents/extensions/modules/index.d.ts +11 -0
  241. package/dist/agents/extensions/modules/index.d.ts.map +1 -0
  242. package/dist/agents/extensions/modules/index.js +64 -0
  243. package/dist/agents/extensions/modules/index.js.map +1 -0
  244. package/dist/agents/extensions/modules/npm-search.d.ts +15 -0
  245. package/dist/agents/extensions/modules/npm-search.d.ts.map +1 -0
  246. package/dist/agents/extensions/modules/npm-search.js +126 -0
  247. package/dist/agents/extensions/modules/npm-search.js.map +1 -0
  248. package/dist/agents/extensions/modules/ollama-search.d.ts +30 -0
  249. package/dist/agents/extensions/modules/ollama-search.d.ts.map +1 -0
  250. package/dist/agents/extensions/modules/ollama-search.js +171 -0
  251. package/dist/agents/extensions/modules/ollama-search.js.map +1 -0
  252. package/dist/agents/extensions/modules/perplexity.d.ts +19 -0
  253. package/dist/agents/extensions/modules/perplexity.d.ts.map +1 -0
  254. package/dist/agents/extensions/modules/perplexity.js +358 -0
  255. package/dist/agents/extensions/modules/perplexity.js.map +1 -0
  256. package/dist/agents/extensions/modules/searxng.d.ts +43 -0
  257. package/dist/agents/extensions/modules/searxng.d.ts.map +1 -0
  258. package/dist/agents/extensions/modules/searxng.js +191 -0
  259. package/dist/agents/extensions/modules/searxng.js.map +1 -0
  260. package/dist/agents/extensions/modules/tavily.d.ts +71 -0
  261. package/dist/agents/extensions/modules/tavily.d.ts.map +1 -0
  262. package/dist/agents/extensions/modules/tavily.js +330 -0
  263. package/dist/agents/extensions/modules/tavily.js.map +1 -0
  264. package/dist/agents/extensions/modules/web-provider-helpers.d.ts +89 -0
  265. package/dist/agents/extensions/modules/web-provider-helpers.d.ts.map +1 -0
  266. package/dist/agents/extensions/modules/web-provider-helpers.js +146 -0
  267. package/dist/agents/extensions/modules/web-provider-helpers.js.map +1 -0
  268. package/dist/agents/extensions/modules/web-search-filters.d.ts +62 -0
  269. package/dist/agents/extensions/modules/web-search-filters.d.ts.map +1 -0
  270. package/dist/agents/extensions/modules/web-search-filters.js +179 -0
  271. package/dist/agents/extensions/modules/web-search-filters.js.map +1 -0
  272. package/dist/agents/extensions/modules/wikipedia.d.ts +16 -0
  273. package/dist/agents/extensions/modules/wikipedia.d.ts.map +1 -0
  274. package/dist/agents/extensions/modules/wikipedia.js +138 -0
  275. package/dist/agents/extensions/modules/wikipedia.js.map +1 -0
  276. package/dist/agents/extensions/registry-cache.d.ts +74 -0
  277. package/dist/agents/extensions/registry-cache.d.ts.map +1 -0
  278. package/dist/agents/extensions/registry-cache.js +117 -0
  279. package/dist/agents/extensions/registry-cache.js.map +1 -0
  280. package/dist/agents/extensions/registry.d.ts +184 -0
  281. package/dist/agents/extensions/registry.d.ts.map +1 -0
  282. package/dist/agents/extensions/registry.js +512 -0
  283. package/dist/agents/extensions/registry.js.map +1 -0
  284. package/dist/agents/extensions/types.d.ts +1195 -0
  285. package/dist/agents/extensions/types.d.ts.map +1 -0
  286. package/dist/agents/extensions/types.js +28 -0
  287. package/dist/agents/extensions/types.js.map +1 -0
  288. package/dist/agents/gateway-call.d.ts +171 -0
  289. package/dist/agents/gateway-call.d.ts.map +1 -0
  290. package/dist/agents/gateway-call.js +74 -0
  291. package/dist/agents/gateway-call.js.map +1 -0
  292. package/dist/agents/heartbeat-runner.d.ts +100 -0
  293. package/dist/agents/heartbeat-runner.d.ts.map +1 -0
  294. package/dist/agents/heartbeat-runner.js +268 -0
  295. package/dist/agents/heartbeat-runner.js.map +1 -0
  296. package/dist/agents/heartbeat-scheduler.d.ts +56 -0
  297. package/dist/agents/heartbeat-scheduler.d.ts.map +1 -0
  298. package/dist/agents/heartbeat-scheduler.js +366 -0
  299. package/dist/agents/heartbeat-scheduler.js.map +1 -0
  300. package/dist/agents/heartbeat-wake.d.ts +99 -0
  301. package/dist/agents/heartbeat-wake.d.ts.map +1 -0
  302. package/dist/agents/heartbeat-wake.js +304 -0
  303. package/dist/agents/heartbeat-wake.js.map +1 -0
  304. package/dist/agents/identity-file.d.ts +26 -0
  305. package/dist/agents/identity-file.d.ts.map +1 -0
  306. package/dist/agents/identity-file.js +86 -0
  307. package/dist/agents/identity-file.js.map +1 -0
  308. package/dist/agents/identity-links.d.ts +44 -0
  309. package/dist/agents/identity-links.d.ts.map +1 -0
  310. package/dist/agents/identity-links.js +51 -0
  311. package/dist/agents/identity-links.js.map +1 -0
  312. package/dist/agents/loop/autonomous-agent.d.ts +55 -0
  313. package/dist/agents/loop/autonomous-agent.d.ts.map +1 -0
  314. package/dist/agents/loop/autonomous-agent.js +91 -0
  315. package/dist/agents/loop/autonomous-agent.js.map +1 -0
  316. package/dist/agents/loop/loop-guards.d.ts +95 -0
  317. package/dist/agents/loop/loop-guards.d.ts.map +1 -0
  318. package/dist/agents/loop/loop-guards.js +169 -0
  319. package/dist/agents/loop/loop-guards.js.map +1 -0
  320. package/dist/agents/loop/loop-runner.d.ts +72 -0
  321. package/dist/agents/loop/loop-runner.d.ts.map +1 -0
  322. package/dist/agents/loop/loop-runner.js +114 -0
  323. package/dist/agents/loop/loop-runner.js.map +1 -0
  324. package/dist/agents/memory/auto-recall.d.ts +69 -0
  325. package/dist/agents/memory/auto-recall.d.ts.map +1 -0
  326. package/dist/agents/memory/auto-recall.js +147 -0
  327. package/dist/agents/memory/auto-recall.js.map +1 -0
  328. package/dist/agents/memory/behavior-review.d.ts +68 -0
  329. package/dist/agents/memory/behavior-review.d.ts.map +1 -0
  330. package/dist/agents/memory/behavior-review.js +131 -0
  331. package/dist/agents/memory/behavior-review.js.map +1 -0
  332. package/dist/agents/memory/consolidate.d.ts +62 -0
  333. package/dist/agents/memory/consolidate.d.ts.map +1 -0
  334. package/dist/agents/memory/consolidate.js +275 -0
  335. package/dist/agents/memory/consolidate.js.map +1 -0
  336. package/dist/agents/memory/contradiction.d.ts +44 -0
  337. package/dist/agents/memory/contradiction.d.ts.map +1 -0
  338. package/dist/agents/memory/contradiction.js +86 -0
  339. package/dist/agents/memory/contradiction.js.map +1 -0
  340. package/dist/agents/memory/curator.d.ts +22 -0
  341. package/dist/agents/memory/curator.d.ts.map +1 -0
  342. package/dist/agents/memory/curator.js +52 -0
  343. package/dist/agents/memory/curator.js.map +1 -0
  344. package/dist/agents/memory/decay.d.ts +32 -0
  345. package/dist/agents/memory/decay.d.ts.map +1 -0
  346. package/dist/agents/memory/decay.js +86 -0
  347. package/dist/agents/memory/decay.js.map +1 -0
  348. package/dist/agents/memory/dream.d.ts +52 -0
  349. package/dist/agents/memory/dream.d.ts.map +1 -0
  350. package/dist/agents/memory/dream.js +192 -0
  351. package/dist/agents/memory/dream.js.map +1 -0
  352. package/dist/agents/memory/embedder-providers.d.ts +114 -0
  353. package/dist/agents/memory/embedder-providers.d.ts.map +1 -0
  354. package/dist/agents/memory/embedder-providers.js +213 -0
  355. package/dist/agents/memory/embedder-providers.js.map +1 -0
  356. package/dist/agents/memory/embedder.d.ts +84 -0
  357. package/dist/agents/memory/embedder.d.ts.map +1 -0
  358. package/dist/agents/memory/embedder.js +218 -0
  359. package/dist/agents/memory/embedder.js.map +1 -0
  360. package/dist/agents/memory/eval/asr-bench.d.ts +33 -0
  361. package/dist/agents/memory/eval/asr-bench.d.ts.map +1 -0
  362. package/dist/agents/memory/eval/asr-bench.js +129 -0
  363. package/dist/agents/memory/eval/asr-bench.js.map +1 -0
  364. package/dist/agents/memory/eval/capabilities.d.ts +97 -0
  365. package/dist/agents/memory/eval/capabilities.d.ts.map +1 -0
  366. package/dist/agents/memory/eval/capabilities.js +210 -0
  367. package/dist/agents/memory/eval/capabilities.js.map +1 -0
  368. package/dist/agents/memory/eval/gold-export.d.ts +44 -0
  369. package/dist/agents/memory/eval/gold-export.d.ts.map +1 -0
  370. package/dist/agents/memory/eval/gold-export.js +85 -0
  371. package/dist/agents/memory/eval/gold-export.js.map +1 -0
  372. package/dist/agents/memory/eval/gold-hard.d.ts +35 -0
  373. package/dist/agents/memory/eval/gold-hard.d.ts.map +1 -0
  374. package/dist/agents/memory/eval/gold-hard.js +113 -0
  375. package/dist/agents/memory/eval/gold-hard.js.map +1 -0
  376. package/dist/agents/memory/eval/gold-rich.d.ts +33 -0
  377. package/dist/agents/memory/eval/gold-rich.d.ts.map +1 -0
  378. package/dist/agents/memory/eval/gold-rich.js +82 -0
  379. package/dist/agents/memory/eval/gold-rich.js.map +1 -0
  380. package/dist/agents/memory/eval/gold-synthetic.d.ts +19 -0
  381. package/dist/agents/memory/eval/gold-synthetic.d.ts.map +1 -0
  382. package/dist/agents/memory/eval/gold-synthetic.js +65 -0
  383. package/dist/agents/memory/eval/gold-synthetic.js.map +1 -0
  384. package/dist/agents/memory/eval/gold.d.ts +73 -0
  385. package/dist/agents/memory/eval/gold.d.ts.map +1 -0
  386. package/dist/agents/memory/eval/gold.js +174 -0
  387. package/dist/agents/memory/eval/gold.js.map +1 -0
  388. package/dist/agents/memory/eval/harness.d.ts +110 -0
  389. package/dist/agents/memory/eval/harness.d.ts.map +1 -0
  390. package/dist/agents/memory/eval/harness.js +123 -0
  391. package/dist/agents/memory/eval/harness.js.map +1 -0
  392. package/dist/agents/memory/eval/metrics.d.ts +71 -0
  393. package/dist/agents/memory/eval/metrics.d.ts.map +1 -0
  394. package/dist/agents/memory/eval/metrics.js +169 -0
  395. package/dist/agents/memory/eval/metrics.js.map +1 -0
  396. package/dist/agents/memory/event-log.d.ts +52 -0
  397. package/dist/agents/memory/event-log.d.ts.map +1 -0
  398. package/dist/agents/memory/event-log.js +65 -0
  399. package/dist/agents/memory/event-log.js.map +1 -0
  400. package/dist/agents/memory/extract.d.ts +155 -0
  401. package/dist/agents/memory/extract.d.ts.map +1 -0
  402. package/dist/agents/memory/extract.js +571 -0
  403. package/dist/agents/memory/extract.js.map +1 -0
  404. package/dist/agents/memory/governance.d.ts +45 -0
  405. package/dist/agents/memory/governance.d.ts.map +1 -0
  406. package/dist/agents/memory/governance.js +113 -0
  407. package/dist/agents/memory/governance.js.map +1 -0
  408. package/dist/agents/memory/graph-export.d.ts +59 -0
  409. package/dist/agents/memory/graph-export.d.ts.map +1 -0
  410. package/dist/agents/memory/graph-export.js +181 -0
  411. package/dist/agents/memory/graph-export.js.map +1 -0
  412. package/dist/agents/memory/graph-recall.d.ts +42 -0
  413. package/dist/agents/memory/graph-recall.d.ts.map +1 -0
  414. package/dist/agents/memory/graph-recall.js +165 -0
  415. package/dist/agents/memory/graph-recall.js.map +1 -0
  416. package/dist/agents/memory/graph.d.ts +92 -0
  417. package/dist/agents/memory/graph.d.ts.map +1 -0
  418. package/dist/agents/memory/graph.js +266 -0
  419. package/dist/agents/memory/graph.js.map +1 -0
  420. package/dist/agents/memory/host-ports.d.ts +27 -0
  421. package/dist/agents/memory/host-ports.d.ts.map +1 -0
  422. package/dist/agents/memory/host-ports.js +31 -0
  423. package/dist/agents/memory/host-ports.js.map +1 -0
  424. package/dist/agents/memory/hybrid.d.ts +46 -0
  425. package/dist/agents/memory/hybrid.d.ts.map +1 -0
  426. package/dist/agents/memory/hybrid.js +184 -0
  427. package/dist/agents/memory/hybrid.js.map +1 -0
  428. package/dist/agents/memory/index.d.ts +13 -0
  429. package/dist/agents/memory/index.d.ts.map +1 -0
  430. package/dist/agents/memory/index.js +13 -0
  431. package/dist/agents/memory/index.js.map +1 -0
  432. package/dist/agents/memory/json-scan.d.ts +14 -0
  433. package/dist/agents/memory/json-scan.d.ts.map +1 -0
  434. package/dist/agents/memory/json-scan.js +47 -0
  435. package/dist/agents/memory/json-scan.js.map +1 -0
  436. package/dist/agents/memory/links.d.ts +92 -0
  437. package/dist/agents/memory/links.d.ts.map +1 -0
  438. package/dist/agents/memory/links.js +140 -0
  439. package/dist/agents/memory/links.js.map +1 -0
  440. package/dist/agents/memory/maintenance.d.ts +18 -0
  441. package/dist/agents/memory/maintenance.d.ts.map +1 -0
  442. package/dist/agents/memory/maintenance.js +66 -0
  443. package/dist/agents/memory/maintenance.js.map +1 -0
  444. package/dist/agents/memory/memory-mcp-server.d.ts +39 -0
  445. package/dist/agents/memory/memory-mcp-server.d.ts.map +1 -0
  446. package/dist/agents/memory/memory-mcp-server.js +122 -0
  447. package/dist/agents/memory/memory-mcp-server.js.map +1 -0
  448. package/dist/agents/memory/memory-mcp.d.ts +34 -0
  449. package/dist/agents/memory/memory-mcp.d.ts.map +1 -0
  450. package/dist/agents/memory/memory-mcp.js +130 -0
  451. package/dist/agents/memory/memory-mcp.js.map +1 -0
  452. package/dist/agents/memory/plugin-runtime.d.ts +133 -0
  453. package/dist/agents/memory/plugin-runtime.d.ts.map +1 -0
  454. package/dist/agents/memory/plugin-runtime.js +149 -0
  455. package/dist/agents/memory/plugin-runtime.js.map +1 -0
  456. package/dist/agents/memory/query.d.ts +50 -0
  457. package/dist/agents/memory/query.d.ts.map +1 -0
  458. package/dist/agents/memory/query.js +94 -0
  459. package/dist/agents/memory/query.js.map +1 -0
  460. package/dist/agents/memory/records.d.ts +617 -0
  461. package/dist/agents/memory/records.d.ts.map +1 -0
  462. package/dist/agents/memory/records.js +1327 -0
  463. package/dist/agents/memory/records.js.map +1 -0
  464. package/dist/agents/memory/reembed.d.ts +42 -0
  465. package/dist/agents/memory/reembed.d.ts.map +1 -0
  466. package/dist/agents/memory/reembed.js +60 -0
  467. package/dist/agents/memory/reembed.js.map +1 -0
  468. package/dist/agents/memory/relationship-extract.d.ts +259 -0
  469. package/dist/agents/memory/relationship-extract.d.ts.map +1 -0
  470. package/dist/agents/memory/relationship-extract.js +454 -0
  471. package/dist/agents/memory/relationship-extract.js.map +1 -0
  472. package/dist/agents/memory/rerank.d.ts +37 -0
  473. package/dist/agents/memory/rerank.d.ts.map +1 -0
  474. package/dist/agents/memory/rerank.js +43 -0
  475. package/dist/agents/memory/rerank.js.map +1 -0
  476. package/dist/agents/memory/scoring.d.ts +85 -0
  477. package/dist/agents/memory/scoring.d.ts.map +1 -0
  478. package/dist/agents/memory/scoring.js +139 -0
  479. package/dist/agents/memory/scoring.js.map +1 -0
  480. package/dist/agents/memory/self-improve.d.ts +56 -0
  481. package/dist/agents/memory/self-improve.d.ts.map +1 -0
  482. package/dist/agents/memory/self-improve.js +98 -0
  483. package/dist/agents/memory/self-improve.js.map +1 -0
  484. package/dist/agents/memory/self-review.d.ts +68 -0
  485. package/dist/agents/memory/self-review.d.ts.map +1 -0
  486. package/dist/agents/memory/self-review.js +109 -0
  487. package/dist/agents/memory/self-review.js.map +1 -0
  488. package/dist/agents/memory/storage.d.ts +156 -0
  489. package/dist/agents/memory/storage.d.ts.map +1 -0
  490. package/dist/agents/memory/storage.js +359 -0
  491. package/dist/agents/memory/storage.js.map +1 -0
  492. package/dist/agents/memory/tideline.d.ts +203 -0
  493. package/dist/agents/memory/tideline.d.ts.map +1 -0
  494. package/dist/agents/memory/tideline.js +189 -0
  495. package/dist/agents/memory/tideline.js.map +1 -0
  496. package/dist/agents/memory/vault.d.ts +142 -0
  497. package/dist/agents/memory/vault.d.ts.map +1 -0
  498. package/dist/agents/memory/vault.js +787 -0
  499. package/dist/agents/memory/vault.js.map +1 -0
  500. package/dist/agents/memory/write-gate.d.ts +76 -0
  501. package/dist/agents/memory/write-gate.d.ts.map +1 -0
  502. package/dist/agents/memory/write-gate.js +140 -0
  503. package/dist/agents/memory/write-gate.js.map +1 -0
  504. package/dist/agents/mid-turn-switch.d.ts +25 -0
  505. package/dist/agents/mid-turn-switch.d.ts.map +1 -0
  506. package/dist/agents/mid-turn-switch.js +103 -0
  507. package/dist/agents/mid-turn-switch.js.map +1 -0
  508. package/dist/agents/model-fallback.d.ts +50 -0
  509. package/dist/agents/model-fallback.d.ts.map +1 -0
  510. package/dist/agents/model-fallback.js +226 -0
  511. package/dist/agents/model-fallback.js.map +1 -0
  512. package/dist/agents/model-resolution.d.ts +38 -0
  513. package/dist/agents/model-resolution.d.ts.map +1 -0
  514. package/dist/agents/model-resolution.js +155 -0
  515. package/dist/agents/model-resolution.js.map +1 -0
  516. package/dist/agents/org/a2a-adapter.d.ts +49 -0
  517. package/dist/agents/org/a2a-adapter.d.ts.map +1 -0
  518. package/dist/agents/org/a2a-adapter.js +92 -0
  519. package/dist/agents/org/a2a-adapter.js.map +1 -0
  520. package/dist/agents/org/assets/mascots/README.md +34 -0
  521. package/dist/agents/org/assets/mascots/Untitled-1.png +0 -0
  522. package/dist/agents/org/assets/mascots/brigade_biceps.png +0 -0
  523. package/dist/agents/org/audit-log.d.ts +22 -0
  524. package/dist/agents/org/audit-log.d.ts.map +1 -0
  525. package/dist/agents/org/audit-log.js +37 -0
  526. package/dist/agents/org/audit-log.js.map +1 -0
  527. package/dist/agents/org/auto-derive.d.ts +22 -0
  528. package/dist/agents/org/auto-derive.d.ts.map +1 -0
  529. package/dist/agents/org/auto-derive.js +66 -0
  530. package/dist/agents/org/auto-derive.js.map +1 -0
  531. package/dist/agents/org/delivery-kind.d.ts +89 -0
  532. package/dist/agents/org/delivery-kind.d.ts.map +1 -0
  533. package/dist/agents/org/delivery-kind.js +149 -0
  534. package/dist/agents/org/delivery-kind.js.map +1 -0
  535. package/dist/agents/org/derive-graph.d.ts +34 -0
  536. package/dist/agents/org/derive-graph.d.ts.map +1 -0
  537. package/dist/agents/org/derive-graph.js +266 -0
  538. package/dist/agents/org/derive-graph.js.map +1 -0
  539. package/dist/agents/org/lints.d.ts +21 -0
  540. package/dist/agents/org/lints.d.ts.map +1 -0
  541. package/dist/agents/org/lints.js +133 -0
  542. package/dist/agents/org/lints.js.map +1 -0
  543. package/dist/agents/org/pride-html.d.ts +61 -0
  544. package/dist/agents/org/pride-html.d.ts.map +1 -0
  545. package/dist/agents/org/pride-html.js +565 -0
  546. package/dist/agents/org/pride-html.js.map +1 -0
  547. package/dist/agents/org/pride-image.d.ts +101 -0
  548. package/dist/agents/org/pride-image.d.ts.map +1 -0
  549. package/dist/agents/org/pride-image.js +210 -0
  550. package/dist/agents/org/pride-image.js.map +1 -0
  551. package/dist/agents/org/pride-taunts.d.ts +47 -0
  552. package/dist/agents/org/pride-taunts.d.ts.map +1 -0
  553. package/dist/agents/org/pride-taunts.js +411 -0
  554. package/dist/agents/org/pride-taunts.js.map +1 -0
  555. package/dist/agents/org/pride-template.d.ts +272 -0
  556. package/dist/agents/org/pride-template.d.ts.map +1 -0
  557. package/dist/agents/org/pride-template.js +892 -0
  558. package/dist/agents/org/pride-template.js.map +1 -0
  559. package/dist/agents/org/pride-themes.d.ts +80 -0
  560. package/dist/agents/org/pride-themes.d.ts.map +1 -0
  561. package/dist/agents/org/pride-themes.js +7596 -0
  562. package/dist/agents/org/pride-themes.js.map +1 -0
  563. package/dist/agents/org/structured-errors.d.ts +47 -0
  564. package/dist/agents/org/structured-errors.d.ts.map +1 -0
  565. package/dist/agents/org/structured-errors.js +97 -0
  566. package/dist/agents/org/structured-errors.js.map +1 -0
  567. package/dist/agents/org/types.d.ts +139 -0
  568. package/dist/agents/org/types.d.ts.map +1 -0
  569. package/dist/agents/org/types.js +43 -0
  570. package/dist/agents/org/types.js.map +1 -0
  571. package/dist/agents/org/validate.d.ts +36 -0
  572. package/dist/agents/org/validate.d.ts.map +1 -0
  573. package/dist/agents/org/validate.js +135 -0
  574. package/dist/agents/org/validate.js.map +1 -0
  575. package/dist/agents/path-write-guard.d.ts +82 -0
  576. package/dist/agents/path-write-guard.d.ts.map +1 -0
  577. package/dist/agents/path-write-guard.js +722 -0
  578. package/dist/agents/path-write-guard.js.map +1 -0
  579. package/dist/agents/payload-mutators.d.ts +175 -0
  580. package/dist/agents/payload-mutators.d.ts.map +1 -0
  581. package/dist/agents/payload-mutators.js +994 -0
  582. package/dist/agents/payload-mutators.js.map +1 -0
  583. package/dist/agents/pending-system-events.d.ts +76 -0
  584. package/dist/agents/pending-system-events.d.ts.map +1 -0
  585. package/dist/agents/pending-system-events.js +115 -0
  586. package/dist/agents/pending-system-events.js.map +1 -0
  587. package/dist/agents/provider-attribution.d.ts +19 -0
  588. package/dist/agents/provider-attribution.d.ts.map +1 -0
  589. package/dist/agents/provider-attribution.js +62 -0
  590. package/dist/agents/provider-attribution.js.map +1 -0
  591. package/dist/agents/quality/slop-detector.d.ts +40 -0
  592. package/dist/agents/quality/slop-detector.d.ts.map +1 -0
  593. package/dist/agents/quality/slop-detector.js +108 -0
  594. package/dist/agents/quality/slop-detector.js.map +1 -0
  595. package/dist/agents/quality/slop-index.d.ts +27 -0
  596. package/dist/agents/quality/slop-index.d.ts.map +1 -0
  597. package/dist/agents/quality/slop-index.js +124 -0
  598. package/dist/agents/quality/slop-index.js.map +1 -0
  599. package/dist/agents/retry-policy.d.ts +38 -0
  600. package/dist/agents/retry-policy.d.ts.map +1 -0
  601. package/dist/agents/retry-policy.js +276 -0
  602. package/dist/agents/retry-policy.js.map +1 -0
  603. package/dist/agents/routing/account-id.d.ts +43 -0
  604. package/dist/agents/routing/account-id.d.ts.map +1 -0
  605. package/dist/agents/routing/account-id.js +103 -0
  606. package/dist/agents/routing/account-id.js.map +1 -0
  607. package/dist/agents/routing/bindings.d.ts +20 -0
  608. package/dist/agents/routing/bindings.d.ts.map +1 -0
  609. package/dist/agents/routing/bindings.js +22 -0
  610. package/dist/agents/routing/bindings.js.map +1 -0
  611. package/dist/agents/routing/dm-scope-warning.d.ts +37 -0
  612. package/dist/agents/routing/dm-scope-warning.d.ts.map +1 -0
  613. package/dist/agents/routing/dm-scope-warning.js +110 -0
  614. package/dist/agents/routing/dm-scope-warning.js.map +1 -0
  615. package/dist/agents/routing/identity-links.d.ts +45 -0
  616. package/dist/agents/routing/identity-links.d.ts.map +1 -0
  617. package/dist/agents/routing/identity-links.js +85 -0
  618. package/dist/agents/routing/identity-links.js.map +1 -0
  619. package/dist/agents/routing/resolve-route.d.ts +91 -0
  620. package/dist/agents/routing/resolve-route.d.ts.map +1 -0
  621. package/dist/agents/routing/resolve-route.js +653 -0
  622. package/dist/agents/routing/resolve-route.js.map +1 -0
  623. package/dist/agents/routing/session-key.d.ts +168 -0
  624. package/dist/agents/routing/session-key.d.ts.map +1 -0
  625. package/dist/agents/routing/session-key.js +268 -0
  626. package/dist/agents/routing/session-key.js.map +1 -0
  627. package/dist/agents/sanitize-surrogates.d.ts +30 -0
  628. package/dist/agents/sanitize-surrogates.d.ts.map +1 -0
  629. package/dist/agents/sanitize-surrogates.js +56 -0
  630. package/dist/agents/sanitize-surrogates.js.map +1 -0
  631. package/dist/agents/session-context.d.ts +80 -0
  632. package/dist/agents/session-context.d.ts.map +1 -0
  633. package/dist/agents/session-context.js +76 -0
  634. package/dist/agents/session-context.js.map +1 -0
  635. package/dist/agents/session-event-prompt.d.ts +124 -0
  636. package/dist/agents/session-event-prompt.d.ts.map +1 -0
  637. package/dist/agents/session-event-prompt.js +179 -0
  638. package/dist/agents/session-event-prompt.js.map +1 -0
  639. package/dist/agents/session-inbox.d.ts +129 -0
  640. package/dist/agents/session-inbox.d.ts.map +1 -0
  641. package/dist/agents/session-inbox.js +492 -0
  642. package/dist/agents/session-inbox.js.map +1 -0
  643. package/dist/agents/session-registry.d.ts +148 -0
  644. package/dist/agents/session-registry.d.ts.map +1 -0
  645. package/dist/agents/session-registry.js +405 -0
  646. package/dist/agents/session-registry.js.map +1 -0
  647. package/dist/agents/session-wiring.d.ts +214 -0
  648. package/dist/agents/session-wiring.d.ts.map +1 -0
  649. package/dist/agents/session-wiring.js +278 -0
  650. package/dist/agents/session-wiring.js.map +1 -0
  651. package/dist/agents/session-write-lock.d.ts +15 -0
  652. package/dist/agents/session-write-lock.d.ts.map +1 -0
  653. package/dist/agents/session-write-lock.js +15 -0
  654. package/dist/agents/session-write-lock.js.map +1 -0
  655. package/dist/agents/skills/agent-filter.d.ts +43 -0
  656. package/dist/agents/skills/agent-filter.d.ts.map +1 -0
  657. package/dist/agents/skills/agent-filter.js +89 -0
  658. package/dist/agents/skills/agent-filter.js.map +1 -0
  659. package/dist/agents/skills/discovery.d.ts +97 -0
  660. package/dist/agents/skills/discovery.d.ts.map +1 -0
  661. package/dist/agents/skills/discovery.js +136 -0
  662. package/dist/agents/skills/discovery.js.map +1 -0
  663. package/dist/agents/skills/eligibility.d.ts +118 -0
  664. package/dist/agents/skills/eligibility.d.ts.map +1 -0
  665. package/dist/agents/skills/eligibility.js +280 -0
  666. package/dist/agents/skills/eligibility.js.map +1 -0
  667. package/dist/agents/skills/grant.d.ts +70 -0
  668. package/dist/agents/skills/grant.d.ts.map +1 -0
  669. package/dist/agents/skills/grant.js +106 -0
  670. package/dist/agents/skills/grant.js.map +1 -0
  671. package/dist/agents/skills/index.d.ts +35 -0
  672. package/dist/agents/skills/index.d.ts.map +1 -0
  673. package/dist/agents/skills/index.js +88 -0
  674. package/dist/agents/skills/index.js.map +1 -0
  675. package/dist/agents/skills/install-spec.d.ts +51 -0
  676. package/dist/agents/skills/install-spec.d.ts.map +1 -0
  677. package/dist/agents/skills/install-spec.js +21 -0
  678. package/dist/agents/skills/install-spec.js.map +1 -0
  679. package/dist/agents/skills/install.d.ts +68 -0
  680. package/dist/agents/skills/install.d.ts.map +1 -0
  681. package/dist/agents/skills/install.js +206 -0
  682. package/dist/agents/skills/install.js.map +1 -0
  683. package/dist/agents/skills/org-access.d.ts +27 -0
  684. package/dist/agents/skills/org-access.d.ts.map +1 -0
  685. package/dist/agents/skills/org-access.js +87 -0
  686. package/dist/agents/skills/org-access.js.map +1 -0
  687. package/dist/agents/skills/skill-consolidate.d.ts +76 -0
  688. package/dist/agents/skills/skill-consolidate.d.ts.map +1 -0
  689. package/dist/agents/skills/skill-consolidate.js +264 -0
  690. package/dist/agents/skills/skill-consolidate.js.map +1 -0
  691. package/dist/agents/skills/skill-curator.d.ts +91 -0
  692. package/dist/agents/skills/skill-curator.d.ts.map +1 -0
  693. package/dist/agents/skills/skill-curator.js +239 -0
  694. package/dist/agents/skills/skill-curator.js.map +1 -0
  695. package/dist/agents/skills/skill-manifest.d.ts +35 -0
  696. package/dist/agents/skills/skill-manifest.d.ts.map +1 -0
  697. package/dist/agents/skills/skill-manifest.js +82 -0
  698. package/dist/agents/skills/skill-manifest.js.map +1 -0
  699. package/dist/agents/skills/skill-review.d.ts +91 -0
  700. package/dist/agents/skills/skill-review.d.ts.map +1 -0
  701. package/dist/agents/skills/skill-review.js +271 -0
  702. package/dist/agents/skills/skill-review.js.map +1 -0
  703. package/dist/agents/skills/skill-usage.d.ts +81 -0
  704. package/dist/agents/skills/skill-usage.d.ts.map +1 -0
  705. package/dist/agents/skills/skill-usage.js +208 -0
  706. package/dist/agents/skills/skill-usage.js.map +1 -0
  707. package/dist/agents/skills/status.d.ts +68 -0
  708. package/dist/agents/skills/status.d.ts.map +1 -0
  709. package/dist/agents/skills/status.js +147 -0
  710. package/dist/agents/skills/status.js.map +1 -0
  711. package/dist/agents/skills/update-config.d.ts +32 -0
  712. package/dist/agents/skills/update-config.d.ts.map +1 -0
  713. package/dist/agents/skills/update-config.js +53 -0
  714. package/dist/agents/skills/update-config.js.map +1 -0
  715. package/dist/agents/slash-commands.d.ts +25 -0
  716. package/dist/agents/slash-commands.d.ts.map +1 -0
  717. package/dist/agents/slash-commands.js +151 -0
  718. package/dist/agents/slash-commands.js.map +1 -0
  719. package/dist/agents/smart-compaction.d.ts +105 -0
  720. package/dist/agents/smart-compaction.d.ts.map +1 -0
  721. package/dist/agents/smart-compaction.js +355 -0
  722. package/dist/agents/smart-compaction.js.map +1 -0
  723. package/dist/agents/stream-wrappers.d.ts +20 -0
  724. package/dist/agents/stream-wrappers.d.ts.map +1 -0
  725. package/dist/agents/stream-wrappers.js +307 -0
  726. package/dist/agents/stream-wrappers.js.map +1 -0
  727. package/dist/agents/subagent-abort-cascade.d.ts +31 -0
  728. package/dist/agents/subagent-abort-cascade.d.ts.map +1 -0
  729. package/dist/agents/subagent-abort-cascade.js +124 -0
  730. package/dist/agents/subagent-abort-cascade.js.map +1 -0
  731. package/dist/agents/subagent-announce-delivery.d.ts +83 -0
  732. package/dist/agents/subagent-announce-delivery.d.ts.map +1 -0
  733. package/dist/agents/subagent-announce-delivery.js +159 -0
  734. package/dist/agents/subagent-announce-delivery.js.map +1 -0
  735. package/dist/agents/subagent-budget.d.ts +36 -0
  736. package/dist/agents/subagent-budget.d.ts.map +1 -0
  737. package/dist/agents/subagent-budget.js +93 -0
  738. package/dist/agents/subagent-budget.js.map +1 -0
  739. package/dist/agents/subagent-completion-bridge.d.ts +42 -0
  740. package/dist/agents/subagent-completion-bridge.d.ts.map +1 -0
  741. package/dist/agents/subagent-completion-bridge.js +338 -0
  742. package/dist/agents/subagent-completion-bridge.js.map +1 -0
  743. package/dist/agents/subagent-lifecycle-events.d.ts +31 -0
  744. package/dist/agents/subagent-lifecycle-events.d.ts.map +1 -0
  745. package/dist/agents/subagent-lifecycle-events.js +21 -0
  746. package/dist/agents/subagent-lifecycle-events.js.map +1 -0
  747. package/dist/agents/subagent-policy.d.ts +206 -0
  748. package/dist/agents/subagent-policy.d.ts.map +1 -0
  749. package/dist/agents/subagent-policy.js +295 -0
  750. package/dist/agents/subagent-policy.js.map +1 -0
  751. package/dist/agents/subagent-registry-completion.d.ts +69 -0
  752. package/dist/agents/subagent-registry-completion.d.ts.map +1 -0
  753. package/dist/agents/subagent-registry-completion.js +128 -0
  754. package/dist/agents/subagent-registry-completion.js.map +1 -0
  755. package/dist/agents/subagent-registry.d.ts +85 -0
  756. package/dist/agents/subagent-registry.d.ts.map +1 -0
  757. package/dist/agents/subagent-registry.js +215 -0
  758. package/dist/agents/subagent-registry.js.map +1 -0
  759. package/dist/agents/subagent-registry.types.d.ts +94 -0
  760. package/dist/agents/subagent-registry.types.d.ts.map +1 -0
  761. package/dist/agents/subagent-registry.types.js +19 -0
  762. package/dist/agents/subagent-registry.types.js.map +1 -0
  763. package/dist/agents/subagent-runner.d.ts +75 -0
  764. package/dist/agents/subagent-runner.d.ts.map +1 -0
  765. package/dist/agents/subagent-runner.js +358 -0
  766. package/dist/agents/subagent-runner.js.map +1 -0
  767. package/dist/agents/subagent-spawn-abort-marker.d.ts +46 -0
  768. package/dist/agents/subagent-spawn-abort-marker.d.ts.map +1 -0
  769. package/dist/agents/subagent-spawn-abort-marker.js +81 -0
  770. package/dist/agents/subagent-spawn-abort-marker.js.map +1 -0
  771. package/dist/agents/subagent-spawn.d.ts +104 -0
  772. package/dist/agents/subagent-spawn.d.ts.map +1 -0
  773. package/dist/agents/subagent-spawn.js +358 -0
  774. package/dist/agents/subagent-spawn.js.map +1 -0
  775. package/dist/agents/thinking-fallback.d.ts +49 -0
  776. package/dist/agents/thinking-fallback.d.ts.map +1 -0
  777. package/dist/agents/thinking-fallback.js +97 -0
  778. package/dist/agents/thinking-fallback.js.map +1 -0
  779. package/dist/agents/tool-guard.d.ts +71 -0
  780. package/dist/agents/tool-guard.d.ts.map +1 -0
  781. package/dist/agents/tool-guard.js +154 -0
  782. package/dist/agents/tool-guard.js.map +1 -0
  783. package/dist/agents/tool-loop-detector.d.ts +115 -0
  784. package/dist/agents/tool-loop-detector.d.ts.map +1 -0
  785. package/dist/agents/tool-loop-detector.js +0 -0
  786. package/dist/agents/tool-loop-detector.js.map +1 -0
  787. package/dist/agents/tool-summaries.d.ts +3 -0
  788. package/dist/agents/tool-summaries.d.ts.map +1 -0
  789. package/dist/agents/tool-summaries.js +78 -0
  790. package/dist/agents/tool-summaries.js.map +1 -0
  791. package/dist/agents/tools/agents-list-tool.d.ts +51 -0
  792. package/dist/agents/tools/agents-list-tool.d.ts.map +1 -0
  793. package/dist/agents/tools/agents-list-tool.js +167 -0
  794. package/dist/agents/tools/agents-list-tool.js.map +1 -0
  795. package/dist/agents/tools/browser.d.ts +144 -0
  796. package/dist/agents/tools/browser.d.ts.map +1 -0
  797. package/dist/agents/tools/browser.js +1538 -0
  798. package/dist/agents/tools/browser.js.map +1 -0
  799. package/dist/agents/tools/common.d.ts +208 -0
  800. package/dist/agents/tools/common.d.ts.map +1 -0
  801. package/dist/agents/tools/common.js +405 -0
  802. package/dist/agents/tools/common.js.map +1 -0
  803. package/dist/agents/tools/composio-tool.d.ts +179 -0
  804. package/dist/agents/tools/composio-tool.d.ts.map +1 -0
  805. package/dist/agents/tools/composio-tool.js +474 -0
  806. package/dist/agents/tools/composio-tool.js.map +1 -0
  807. package/dist/agents/tools/cron-tool.d.ts +187 -0
  808. package/dist/agents/tools/cron-tool.d.ts.map +1 -0
  809. package/dist/agents/tools/cron-tool.js +985 -0
  810. package/dist/agents/tools/cron-tool.js.map +1 -0
  811. package/dist/agents/tools/find-tool.d.ts +55 -0
  812. package/dist/agents/tools/find-tool.d.ts.map +1 -0
  813. package/dist/agents/tools/find-tool.js +163 -0
  814. package/dist/agents/tools/find-tool.js.map +1 -0
  815. package/dist/agents/tools/generate-image-tool.d.ts +77 -0
  816. package/dist/agents/tools/generate-image-tool.d.ts.map +1 -0
  817. package/dist/agents/tools/generate-image-tool.js +421 -0
  818. package/dist/agents/tools/generate-image-tool.js.map +1 -0
  819. package/dist/agents/tools/index.d.ts +14 -0
  820. package/dist/agents/tools/index.d.ts.map +1 -0
  821. package/dist/agents/tools/index.js +12 -0
  822. package/dist/agents/tools/index.js.map +1 -0
  823. package/dist/agents/tools/manage-access-tool.d.ts +64 -0
  824. package/dist/agents/tools/manage-access-tool.d.ts.map +1 -0
  825. package/dist/agents/tools/manage-access-tool.js +188 -0
  826. package/dist/agents/tools/manage-access-tool.js.map +1 -0
  827. package/dist/agents/tools/manage-agent-tool.d.ts +50 -0
  828. package/dist/agents/tools/manage-agent-tool.d.ts.map +1 -0
  829. package/dist/agents/tools/manage-agent-tool.js +232 -0
  830. package/dist/agents/tools/manage-agent-tool.js.map +1 -0
  831. package/dist/agents/tools/manage-channel-access-tool.d.ts +44 -0
  832. package/dist/agents/tools/manage-channel-access-tool.d.ts.map +1 -0
  833. package/dist/agents/tools/manage-channel-access-tool.js +144 -0
  834. package/dist/agents/tools/manage-channel-access-tool.js.map +1 -0
  835. package/dist/agents/tools/manage-memory-tool.d.ts +30 -0
  836. package/dist/agents/tools/manage-memory-tool.d.ts.map +1 -0
  837. package/dist/agents/tools/manage-memory-tool.js +309 -0
  838. package/dist/agents/tools/manage-memory-tool.js.map +1 -0
  839. package/dist/agents/tools/manage-provider-tool.d.ts +65 -0
  840. package/dist/agents/tools/manage-provider-tool.d.ts.map +1 -0
  841. package/dist/agents/tools/manage-provider-tool.js +249 -0
  842. package/dist/agents/tools/manage-provider-tool.js.map +1 -0
  843. package/dist/agents/tools/manage-skill-tool.d.ts +121 -0
  844. package/dist/agents/tools/manage-skill-tool.d.ts.map +1 -0
  845. package/dist/agents/tools/manage-skill-tool.js +722 -0
  846. package/dist/agents/tools/manage-skill-tool.js.map +1 -0
  847. package/dist/agents/tools/memory-tools.d.ts +172 -0
  848. package/dist/agents/tools/memory-tools.d.ts.map +1 -0
  849. package/dist/agents/tools/memory-tools.js +561 -0
  850. package/dist/agents/tools/memory-tools.js.map +1 -0
  851. package/dist/agents/tools/oauth-authorize-tool.d.ts +94 -0
  852. package/dist/agents/tools/oauth-authorize-tool.d.ts.map +1 -0
  853. package/dist/agents/tools/oauth-authorize-tool.js +670 -0
  854. package/dist/agents/tools/oauth-authorize-tool.js.map +1 -0
  855. package/dist/agents/tools/org-tool.d.ts +208 -0
  856. package/dist/agents/tools/org-tool.d.ts.map +1 -0
  857. package/dist/agents/tools/org-tool.js +790 -0
  858. package/dist/agents/tools/org-tool.js.map +1 -0
  859. package/dist/agents/tools/registry.d.ts +146 -0
  860. package/dist/agents/tools/registry.d.ts.map +1 -0
  861. package/dist/agents/tools/registry.js +396 -0
  862. package/dist/agents/tools/registry.js.map +1 -0
  863. package/dist/agents/tools/send-media-tool.d.ts +92 -0
  864. package/dist/agents/tools/send-media-tool.d.ts.map +1 -0
  865. package/dist/agents/tools/send-media-tool.js +512 -0
  866. package/dist/agents/tools/send-media-tool.js.map +1 -0
  867. package/dist/agents/tools/send-message-tool.d.ts +84 -0
  868. package/dist/agents/tools/send-message-tool.d.ts.map +1 -0
  869. package/dist/agents/tools/send-message-tool.js +226 -0
  870. package/dist/agents/tools/send-message-tool.js.map +1 -0
  871. package/dist/agents/tools/sessions/history.d.ts +53 -0
  872. package/dist/agents/tools/sessions/history.d.ts.map +1 -0
  873. package/dist/agents/tools/sessions/history.js +138 -0
  874. package/dist/agents/tools/sessions/history.js.map +1 -0
  875. package/dist/agents/tools/sessions/index.d.ts +92 -0
  876. package/dist/agents/tools/sessions/index.d.ts.map +1 -0
  877. package/dist/agents/tools/sessions/index.js +125 -0
  878. package/dist/agents/tools/sessions/index.js.map +1 -0
  879. package/dist/agents/tools/sessions/list.d.ts +53 -0
  880. package/dist/agents/tools/sessions/list.d.ts.map +1 -0
  881. package/dist/agents/tools/sessions/list.js +134 -0
  882. package/dist/agents/tools/sessions/list.js.map +1 -0
  883. package/dist/agents/tools/sessions/resolve-access.d.ts +34 -0
  884. package/dist/agents/tools/sessions/resolve-access.d.ts.map +1 -0
  885. package/dist/agents/tools/sessions/resolve-access.js +67 -0
  886. package/dist/agents/tools/sessions/resolve-access.js.map +1 -0
  887. package/dist/agents/tools/sessions/send.d.ts +68 -0
  888. package/dist/agents/tools/sessions/send.d.ts.map +1 -0
  889. package/dist/agents/tools/sessions/send.js +556 -0
  890. package/dist/agents/tools/sessions/send.js.map +1 -0
  891. package/dist/agents/tools/sessions/shared.d.ts +145 -0
  892. package/dist/agents/tools/sessions/shared.d.ts.map +1 -0
  893. package/dist/agents/tools/sessions/shared.js +352 -0
  894. package/dist/agents/tools/sessions/shared.js.map +1 -0
  895. package/dist/agents/tools/sessions/spawn.d.ts +71 -0
  896. package/dist/agents/tools/sessions/spawn.d.ts.map +1 -0
  897. package/dist/agents/tools/sessions/spawn.js +132 -0
  898. package/dist/agents/tools/sessions/spawn.js.map +1 -0
  899. package/dist/agents/tools/spawn-agent-tool.d.ts +87 -0
  900. package/dist/agents/tools/spawn-agent-tool.d.ts.map +1 -0
  901. package/dist/agents/tools/spawn-agent-tool.js +189 -0
  902. package/dist/agents/tools/spawn-agent-tool.js.map +1 -0
  903. package/dist/agents/tools/spawn-agents-tool.d.ts +75 -0
  904. package/dist/agents/tools/spawn-agents-tool.d.ts.map +1 -0
  905. package/dist/agents/tools/spawn-agents-tool.js +267 -0
  906. package/dist/agents/tools/spawn-agents-tool.js.map +1 -0
  907. package/dist/agents/tools/types.d.ts +55 -0
  908. package/dist/agents/tools/types.d.ts.map +1 -0
  909. package/dist/agents/tools/types.js +28 -0
  910. package/dist/agents/tools/types.js.map +1 -0
  911. package/dist/agents/tools/web-fetch-utils.d.ts +114 -0
  912. package/dist/agents/tools/web-fetch-utils.d.ts.map +1 -0
  913. package/dist/agents/tools/web-fetch-utils.js +560 -0
  914. package/dist/agents/tools/web-fetch-utils.js.map +1 -0
  915. package/dist/agents/tools/web-fetch.d.ts +97 -0
  916. package/dist/agents/tools/web-fetch.d.ts.map +1 -0
  917. package/dist/agents/tools/web-fetch.js +369 -0
  918. package/dist/agents/tools/web-fetch.js.map +1 -0
  919. package/dist/agents/tools/web-retry.d.ts +55 -0
  920. package/dist/agents/tools/web-retry.d.ts.map +1 -0
  921. package/dist/agents/tools/web-retry.js +172 -0
  922. package/dist/agents/tools/web-retry.js.map +1 -0
  923. package/dist/agents/tools/web-search.d.ts +96 -0
  924. package/dist/agents/tools/web-search.d.ts.map +1 -0
  925. package/dist/agents/tools/web-search.js +459 -0
  926. package/dist/agents/tools/web-search.js.map +1 -0
  927. package/dist/agents/tools/web-shared.d.ts +123 -0
  928. package/dist/agents/tools/web-shared.d.ts.map +1 -0
  929. package/dist/agents/tools/web-shared.js +207 -0
  930. package/dist/agents/tools/web-shared.js.map +1 -0
  931. package/dist/assets/brigade-favicon.png +0 -0
  932. package/dist/auth/profile-cooldown.d.ts +105 -0
  933. package/dist/auth/profile-cooldown.d.ts.map +1 -0
  934. package/dist/auth/profile-cooldown.js +466 -0
  935. package/dist/auth/profile-cooldown.js.map +1 -0
  936. package/dist/auth/profiles.d.ts +93 -0
  937. package/dist/auth/profiles.d.ts.map +1 -0
  938. package/dist/auth/profiles.js +321 -0
  939. package/dist/auth/profiles.js.map +1 -0
  940. package/dist/buildstamp.json +1 -0
  941. package/dist/cli/argv.d.ts +20 -0
  942. package/dist/cli/argv.d.ts.map +1 -0
  943. package/dist/cli/argv.js +47 -0
  944. package/dist/cli/argv.js.map +1 -0
  945. package/dist/cli/commands/agent.d.ts +19 -0
  946. package/dist/cli/commands/agent.d.ts.map +1 -0
  947. package/dist/cli/commands/agent.js +297 -0
  948. package/dist/cli/commands/agent.js.map +1 -0
  949. package/dist/cli/commands/agents-bindings.d.ts +80 -0
  950. package/dist/cli/commands/agents-bindings.d.ts.map +1 -0
  951. package/dist/cli/commands/agents-bindings.js +252 -0
  952. package/dist/cli/commands/agents-bindings.js.map +1 -0
  953. package/dist/cli/commands/agents-cmd.d.ts +160 -0
  954. package/dist/cli/commands/agents-cmd.d.ts.map +1 -0
  955. package/dist/cli/commands/agents-cmd.js +1199 -0
  956. package/dist/cli/commands/agents-cmd.js.map +1 -0
  957. package/dist/cli/commands/agents-config.d.ts +102 -0
  958. package/dist/cli/commands/agents-config.d.ts.map +1 -0
  959. package/dist/cli/commands/agents-config.js +294 -0
  960. package/dist/cli/commands/agents-config.js.map +1 -0
  961. package/dist/cli/commands/agents-shared.d.ts +57 -0
  962. package/dist/cli/commands/agents-shared.d.ts.map +1 -0
  963. package/dist/cli/commands/agents-shared.js +83 -0
  964. package/dist/cli/commands/agents-shared.js.map +1 -0
  965. package/dist/cli/commands/backup.d.ts +36 -0
  966. package/dist/cli/commands/backup.d.ts.map +1 -0
  967. package/dist/cli/commands/backup.js +244 -0
  968. package/dist/cli/commands/backup.js.map +1 -0
  969. package/dist/cli/commands/channels.d.ts +106 -0
  970. package/dist/cli/commands/channels.d.ts.map +1 -0
  971. package/dist/cli/commands/channels.js +830 -0
  972. package/dist/cli/commands/channels.js.map +1 -0
  973. package/dist/cli/commands/chat.d.ts +43 -0
  974. package/dist/cli/commands/chat.d.ts.map +1 -0
  975. package/dist/cli/commands/chat.js +84 -0
  976. package/dist/cli/commands/chat.js.map +1 -0
  977. package/dist/cli/commands/config-cmd.d.ts +62 -0
  978. package/dist/cli/commands/config-cmd.d.ts.map +1 -0
  979. package/dist/cli/commands/config-cmd.js +404 -0
  980. package/dist/cli/commands/config-cmd.js.map +1 -0
  981. package/dist/cli/commands/connect.d.ts +73 -0
  982. package/dist/cli/commands/connect.d.ts.map +1 -0
  983. package/dist/cli/commands/connect.js +1952 -0
  984. package/dist/cli/commands/connect.js.map +1 -0
  985. package/dist/cli/commands/cron.d.ts +58 -0
  986. package/dist/cli/commands/cron.d.ts.map +1 -0
  987. package/dist/cli/commands/cron.js +250 -0
  988. package/dist/cli/commands/cron.js.map +1 -0
  989. package/dist/cli/commands/doctor.d.ts +25 -0
  990. package/dist/cli/commands/doctor.d.ts.map +1 -0
  991. package/dist/cli/commands/doctor.js +618 -0
  992. package/dist/cli/commands/doctor.js.map +1 -0
  993. package/dist/cli/commands/encrypt-cmd.d.ts +12 -0
  994. package/dist/cli/commands/encrypt-cmd.d.ts.map +1 -0
  995. package/dist/cli/commands/encrypt-cmd.js +119 -0
  996. package/dist/cli/commands/encrypt-cmd.js.map +1 -0
  997. package/dist/cli/commands/exec-cmd.d.ts +55 -0
  998. package/dist/cli/commands/exec-cmd.d.ts.map +1 -0
  999. package/dist/cli/commands/exec-cmd.js +253 -0
  1000. package/dist/cli/commands/exec-cmd.js.map +1 -0
  1001. package/dist/cli/commands/gateway-install.d.ts +21 -0
  1002. package/dist/cli/commands/gateway-install.d.ts.map +1 -0
  1003. package/dist/cli/commands/gateway-install.js +71 -0
  1004. package/dist/cli/commands/gateway-install.js.map +1 -0
  1005. package/dist/cli/commands/gateway-supervise.d.ts +102 -0
  1006. package/dist/cli/commands/gateway-supervise.d.ts.map +1 -0
  1007. package/dist/cli/commands/gateway-supervise.js +194 -0
  1008. package/dist/cli/commands/gateway-supervise.js.map +1 -0
  1009. package/dist/cli/commands/gateway.d.ts +58 -0
  1010. package/dist/cli/commands/gateway.d.ts.map +1 -0
  1011. package/dist/cli/commands/gateway.js +497 -0
  1012. package/dist/cli/commands/gateway.js.map +1 -0
  1013. package/dist/cli/commands/logs.d.ts +14 -0
  1014. package/dist/cli/commands/logs.d.ts.map +1 -0
  1015. package/dist/cli/commands/logs.js +93 -0
  1016. package/dist/cli/commands/logs.js.map +1 -0
  1017. package/dist/cli/commands/mcp-cmd.d.ts +4 -0
  1018. package/dist/cli/commands/mcp-cmd.d.ts.map +1 -0
  1019. package/dist/cli/commands/mcp-cmd.js +30 -0
  1020. package/dist/cli/commands/mcp-cmd.js.map +1 -0
  1021. package/dist/cli/commands/onboard-config.d.ts +23 -0
  1022. package/dist/cli/commands/onboard-config.d.ts.map +1 -0
  1023. package/dist/cli/commands/onboard-config.js +33 -0
  1024. package/dist/cli/commands/onboard-config.js.map +1 -0
  1025. package/dist/cli/commands/onboard.d.ts +48 -0
  1026. package/dist/cli/commands/onboard.d.ts.map +1 -0
  1027. package/dist/cli/commands/onboard.js +397 -0
  1028. package/dist/cli/commands/onboard.js.map +1 -0
  1029. package/dist/cli/commands/org-cmd.d.ts +87 -0
  1030. package/dist/cli/commands/org-cmd.d.ts.map +1 -0
  1031. package/dist/cli/commands/org-cmd.js +394 -0
  1032. package/dist/cli/commands/org-cmd.js.map +1 -0
  1033. package/dist/cli/commands/org-cmd.templates.d.ts +66 -0
  1034. package/dist/cli/commands/org-cmd.templates.d.ts.map +1 -0
  1035. package/dist/cli/commands/org-cmd.templates.js +145 -0
  1036. package/dist/cli/commands/org-cmd.templates.js.map +1 -0
  1037. package/dist/cli/commands/org-slash.d.ts +107 -0
  1038. package/dist/cli/commands/org-slash.d.ts.map +1 -0
  1039. package/dist/cli/commands/org-slash.js +263 -0
  1040. package/dist/cli/commands/org-slash.js.map +1 -0
  1041. package/dist/cli/commands/pairing.d.ts +33 -0
  1042. package/dist/cli/commands/pairing.d.ts.map +1 -0
  1043. package/dist/cli/commands/pairing.js +155 -0
  1044. package/dist/cli/commands/pairing.js.map +1 -0
  1045. package/dist/cli/commands/secrets-audit.d.ts +17 -0
  1046. package/dist/cli/commands/secrets-audit.d.ts.map +1 -0
  1047. package/dist/cli/commands/secrets-audit.js +109 -0
  1048. package/dist/cli/commands/secrets-audit.js.map +1 -0
  1049. package/dist/cli/commands/sessions.d.ts +22 -0
  1050. package/dist/cli/commands/sessions.d.ts.map +1 -0
  1051. package/dist/cli/commands/sessions.js +99 -0
  1052. package/dist/cli/commands/sessions.js.map +1 -0
  1053. package/dist/cli/commands/skills.d.ts +17 -0
  1054. package/dist/cli/commands/skills.d.ts.map +1 -0
  1055. package/dist/cli/commands/skills.js +100 -0
  1056. package/dist/cli/commands/skills.js.map +1 -0
  1057. package/dist/cli/commands/status.d.ts +26 -0
  1058. package/dist/cli/commands/status.d.ts.map +1 -0
  1059. package/dist/cli/commands/status.js +252 -0
  1060. package/dist/cli/commands/status.js.map +1 -0
  1061. package/dist/cli/commands/store-cmd.d.ts +36 -0
  1062. package/dist/cli/commands/store-cmd.d.ts.map +1 -0
  1063. package/dist/cli/commands/store-cmd.js +405 -0
  1064. package/dist/cli/commands/store-cmd.js.map +1 -0
  1065. package/dist/cli/flows/web-setup.d.ts +47 -0
  1066. package/dist/cli/flows/web-setup.d.ts.map +1 -0
  1067. package/dist/cli/flows/web-setup.js +324 -0
  1068. package/dist/cli/flows/web-setup.js.map +1 -0
  1069. package/dist/cli/program/build-program.d.ts +3 -0
  1070. package/dist/cli/program/build-program.d.ts.map +1 -0
  1071. package/dist/cli/program/build-program.js +1326 -0
  1072. package/dist/cli/program/build-program.js.map +1 -0
  1073. package/dist/cli/run-main.d.ts +2 -0
  1074. package/dist/cli/run-main.d.ts.map +1 -0
  1075. package/dist/cli/run-main.js +63 -0
  1076. package/dist/cli/run-main.js.map +1 -0
  1077. package/dist/config/agent-limits.d.ts +22 -0
  1078. package/dist/config/agent-limits.d.ts.map +1 -0
  1079. package/dist/config/agent-limits.js +34 -0
  1080. package/dist/config/agent-limits.js.map +1 -0
  1081. package/dist/config/io.d.ts +378 -0
  1082. package/dist/config/io.d.ts.map +1 -0
  1083. package/dist/config/io.js +602 -0
  1084. package/dist/config/io.js.map +1 -0
  1085. package/dist/config/paths.d.ts +80 -0
  1086. package/dist/config/paths.d.ts.map +1 -0
  1087. package/dist/config/paths.js +342 -0
  1088. package/dist/config/paths.js.map +1 -0
  1089. package/dist/config/types.d.ts +12 -0
  1090. package/dist/config/types.d.ts.map +1 -0
  1091. package/dist/config/types.js +12 -0
  1092. package/dist/config/types.js.map +1 -0
  1093. package/dist/core/agent-dispatcher.d.ts +91 -0
  1094. package/dist/core/agent-dispatcher.d.ts.map +1 -0
  1095. package/dist/core/agent-dispatcher.js +251 -0
  1096. package/dist/core/agent-dispatcher.js.map +1 -0
  1097. package/dist/core/agent-events-stream.d.ts +76 -0
  1098. package/dist/core/agent-events-stream.d.ts.map +1 -0
  1099. package/dist/core/agent-events-stream.js +185 -0
  1100. package/dist/core/agent-events-stream.js.map +1 -0
  1101. package/dist/core/agent-runtime-persist.d.ts +53 -0
  1102. package/dist/core/agent-runtime-persist.d.ts.map +1 -0
  1103. package/dist/core/agent-runtime-persist.js +114 -0
  1104. package/dist/core/agent-runtime-persist.js.map +1 -0
  1105. package/dist/core/auth-bridge.d.ts +8 -0
  1106. package/dist/core/auth-bridge.d.ts.map +1 -0
  1107. package/dist/core/auth-bridge.js +102 -0
  1108. package/dist/core/auth-bridge.js.map +1 -0
  1109. package/dist/core/auth-error.d.ts +49 -0
  1110. package/dist/core/auth-error.d.ts.map +1 -0
  1111. package/dist/core/auth-error.js.map +1 -0
  1112. package/dist/core/brigade-config.d.ts +205 -0
  1113. package/dist/core/brigade-config.d.ts.map +1 -0
  1114. package/dist/core/brigade-config.js +58 -6
  1115. package/dist/core/brigade-config.js.map +1 -0
  1116. package/dist/core/config.d.ts +17 -0
  1117. package/dist/core/config.d.ts.map +1 -0
  1118. package/dist/core/config.js +92 -246
  1119. package/dist/core/config.js.map +1 -0
  1120. package/dist/core/console-stream.d.ts +52 -0
  1121. package/dist/core/console-stream.d.ts.map +1 -0
  1122. package/dist/core/console-stream.js +49 -3
  1123. package/dist/core/console-stream.js.map +1 -0
  1124. package/dist/core/daemon/launchd.d.ts +19 -0
  1125. package/dist/core/daemon/launchd.d.ts.map +1 -0
  1126. package/dist/core/daemon/launchd.js +117 -0
  1127. package/dist/core/daemon/launchd.js.map +1 -0
  1128. package/dist/core/daemon/schtasks.d.ts +23 -0
  1129. package/dist/core/daemon/schtasks.d.ts.map +1 -0
  1130. package/dist/core/daemon/schtasks.js +139 -0
  1131. package/dist/core/daemon/schtasks.js.map +1 -0
  1132. package/dist/core/daemon/service.d.ts +56 -0
  1133. package/dist/core/daemon/service.d.ts.map +1 -0
  1134. package/dist/core/daemon/service.js +54 -0
  1135. package/dist/core/daemon/service.js.map +1 -0
  1136. package/dist/core/daemon/systemd.d.ts +19 -0
  1137. package/dist/core/daemon/systemd.d.ts.map +1 -0
  1138. package/dist/core/daemon/systemd.js +117 -0
  1139. package/dist/core/daemon/systemd.js.map +1 -0
  1140. package/dist/core/event-logger.d.ts +74 -0
  1141. package/dist/core/event-logger.d.ts.map +1 -0
  1142. package/dist/core/event-logger.js +299 -6
  1143. package/dist/core/event-logger.js.map +1 -0
  1144. package/dist/core/exec-approvals.d.ts +178 -0
  1145. package/dist/core/exec-approvals.d.ts.map +1 -0
  1146. package/dist/core/exec-approvals.js +591 -266
  1147. package/dist/core/exec-approvals.js.map +1 -0
  1148. package/dist/core/extension-lifecycle.d.ts +27 -0
  1149. package/dist/core/extension-lifecycle.d.ts.map +1 -0
  1150. package/dist/core/extension-lifecycle.js +45 -0
  1151. package/dist/core/extension-lifecycle.js.map +1 -0
  1152. package/dist/core/gateway-caller-impl.d.ts +42 -0
  1153. package/dist/core/gateway-caller-impl.d.ts.map +1 -0
  1154. package/dist/core/gateway-caller-impl.js +95 -0
  1155. package/dist/core/gateway-caller-impl.js.map +1 -0
  1156. package/dist/core/gateway-lock.d.ts +88 -0
  1157. package/dist/core/gateway-lock.d.ts.map +1 -0
  1158. package/dist/core/gateway-lock.js +204 -0
  1159. package/dist/core/gateway-lock.js.map +1 -0
  1160. package/dist/core/gateway-probe.d.ts +148 -0
  1161. package/dist/core/gateway-probe.d.ts.map +1 -0
  1162. package/dist/core/gateway-probe.js +319 -0
  1163. package/dist/core/gateway-probe.js.map +1 -0
  1164. package/dist/core/gateway-spawn.d.ts +40 -0
  1165. package/dist/core/gateway-spawn.d.ts.map +1 -0
  1166. package/dist/core/gateway-spawn.js +156 -0
  1167. package/dist/core/gateway-spawn.js.map +1 -0
  1168. package/dist/core/model-caps.d.ts +85 -0
  1169. package/dist/core/model-caps.d.ts.map +1 -0
  1170. package/dist/core/model-caps.js +88 -2
  1171. package/dist/core/model-caps.js.map +1 -0
  1172. package/dist/core/port-inspect.d.ts +37 -0
  1173. package/dist/core/port-inspect.d.ts.map +1 -0
  1174. package/dist/core/port-inspect.js +165 -0
  1175. package/dist/core/port-inspect.js.map +1 -0
  1176. package/dist/core/server-lanes.d.ts +25 -0
  1177. package/dist/core/server-lanes.d.ts.map +1 -0
  1178. package/dist/core/server-lanes.js +31 -0
  1179. package/dist/core/server-lanes.js.map +1 -0
  1180. package/dist/core/server-methods/cron.d.ts +104 -0
  1181. package/dist/core/server-methods/cron.d.ts.map +1 -0
  1182. package/dist/core/server-methods/cron.js +183 -0
  1183. package/dist/core/server-methods/cron.js.map +1 -0
  1184. package/dist/core/server-methods/health.d.ts +36 -0
  1185. package/dist/core/server-methods/health.d.ts.map +1 -0
  1186. package/dist/core/server-methods/health.js +51 -0
  1187. package/dist/core/server-methods/health.js.map +1 -0
  1188. package/dist/core/server-methods/org.d.ts +93 -0
  1189. package/dist/core/server-methods/org.d.ts.map +1 -0
  1190. package/dist/core/server-methods/org.js +95 -0
  1191. package/dist/core/server-methods/org.js.map +1 -0
  1192. package/dist/core/server-methods/sessions.d.ts +133 -0
  1193. package/dist/core/server-methods/sessions.d.ts.map +1 -0
  1194. package/dist/core/server-methods/sessions.js +209 -0
  1195. package/dist/core/server-methods/sessions.js.map +1 -0
  1196. package/dist/core/server.d.ts +46 -0
  1197. package/dist/core/server.d.ts.map +1 -0
  1198. package/dist/core/server.js +4716 -249
  1199. package/dist/core/server.js.map +1 -0
  1200. package/dist/core/system-prompt.d.ts +92 -0
  1201. package/dist/core/system-prompt.d.ts.map +1 -0
  1202. package/dist/core/system-prompt.js +180 -1584
  1203. package/dist/core/system-prompt.js.map +1 -0
  1204. package/dist/core/version.d.ts +4 -0
  1205. package/dist/core/version.d.ts.map +1 -0
  1206. package/dist/core/version.js +8 -13
  1207. package/dist/core/version.js.map +1 -0
  1208. package/dist/core/webhook-guards.d.ts +131 -0
  1209. package/dist/core/webhook-guards.d.ts.map +1 -0
  1210. package/dist/core/webhook-guards.js +283 -0
  1211. package/dist/core/webhook-guards.js.map +1 -0
  1212. package/dist/core/ws-subscription-filter.d.ts +9 -0
  1213. package/dist/core/ws-subscription-filter.d.ts.map +1 -0
  1214. package/dist/core/ws-subscription-filter.js +39 -0
  1215. package/dist/core/ws-subscription-filter.js.map +1 -0
  1216. package/dist/cron/active-service.d.ts +30 -0
  1217. package/dist/cron/active-service.d.ts.map +1 -0
  1218. package/dist/cron/active-service.js +48 -0
  1219. package/dist/cron/active-service.js.map +1 -0
  1220. package/dist/cron/isolated-agent/run-executor.d.ts +49 -0
  1221. package/dist/cron/isolated-agent/run-executor.d.ts.map +1 -0
  1222. package/dist/cron/isolated-agent/run-executor.js +343 -0
  1223. package/dist/cron/isolated-agent/run-executor.js.map +1 -0
  1224. package/dist/cron/isolated-agent/run.d.ts +27 -0
  1225. package/dist/cron/isolated-agent/run.d.ts.map +1 -0
  1226. package/dist/cron/isolated-agent/run.js +29 -0
  1227. package/dist/cron/isolated-agent/run.js.map +1 -0
  1228. package/dist/cron/normalize.d.ts +103 -0
  1229. package/dist/cron/normalize.d.ts.map +1 -0
  1230. package/dist/cron/normalize.js +376 -0
  1231. package/dist/cron/normalize.js.map +1 -0
  1232. package/dist/cron/parse.d.ts +27 -0
  1233. package/dist/cron/parse.d.ts.map +1 -0
  1234. package/dist/cron/parse.js +55 -0
  1235. package/dist/cron/parse.js.map +1 -0
  1236. package/dist/cron/reminder-context.d.ts +78 -0
  1237. package/dist/cron/reminder-context.d.ts.map +1 -0
  1238. package/dist/cron/reminder-context.js +167 -0
  1239. package/dist/cron/reminder-context.js.map +1 -0
  1240. package/dist/cron/run-log.d.ts +48 -0
  1241. package/dist/cron/run-log.d.ts.map +1 -0
  1242. package/dist/cron/run-log.js +225 -0
  1243. package/dist/cron/run-log.js.map +1 -0
  1244. package/dist/cron/schedule.d.ts +46 -0
  1245. package/dist/cron/schedule.d.ts.map +1 -0
  1246. package/dist/cron/schedule.js +144 -0
  1247. package/dist/cron/schedule.js.map +1 -0
  1248. package/dist/cron/service/jobs.d.ts +138 -0
  1249. package/dist/cron/service/jobs.d.ts.map +1 -0
  1250. package/dist/cron/service/jobs.js +370 -0
  1251. package/dist/cron/service/jobs.js.map +1 -0
  1252. package/dist/cron/service/locked.d.ts +46 -0
  1253. package/dist/cron/service/locked.d.ts.map +1 -0
  1254. package/dist/cron/service/locked.js +54 -0
  1255. package/dist/cron/service/locked.js.map +1 -0
  1256. package/dist/cron/service/ops.d.ts +124 -0
  1257. package/dist/cron/service/ops.d.ts.map +1 -0
  1258. package/dist/cron/service/ops.js +415 -0
  1259. package/dist/cron/service/ops.js.map +1 -0
  1260. package/dist/cron/service/state.d.ts +254 -0
  1261. package/dist/cron/service/state.d.ts.map +1 -0
  1262. package/dist/cron/service/state.js +50 -0
  1263. package/dist/cron/service/state.js.map +1 -0
  1264. package/dist/cron/service/store.d.ts +65 -0
  1265. package/dist/cron/service/store.d.ts.map +1 -0
  1266. package/dist/cron/service/store.js +350 -0
  1267. package/dist/cron/service/store.js.map +1 -0
  1268. package/dist/cron/service/timer.d.ts +113 -0
  1269. package/dist/cron/service/timer.d.ts.map +1 -0
  1270. package/dist/cron/service/timer.js +1081 -0
  1271. package/dist/cron/service/timer.js.map +1 -0
  1272. package/dist/cron/session-reaper.d.ts +62 -0
  1273. package/dist/cron/session-reaper.d.ts.map +1 -0
  1274. package/dist/cron/session-reaper.js +152 -0
  1275. package/dist/cron/session-reaper.js.map +1 -0
  1276. package/dist/cron/session-target.d.ts +56 -0
  1277. package/dist/cron/session-target.d.ts.map +1 -0
  1278. package/dist/cron/session-target.js +96 -0
  1279. package/dist/cron/session-target.js.map +1 -0
  1280. package/dist/cron/stagger.d.ts +34 -0
  1281. package/dist/cron/stagger.d.ts.map +1 -0
  1282. package/dist/cron/stagger.js +69 -0
  1283. package/dist/cron/stagger.js.map +1 -0
  1284. package/dist/cron/types.d.ts +287 -0
  1285. package/dist/cron/types.d.ts.map +1 -0
  1286. package/dist/cron/types.js +22 -0
  1287. package/dist/cron/types.js.map +1 -0
  1288. package/dist/cron/validate-timestamp.d.ts +33 -0
  1289. package/dist/cron/validate-timestamp.d.ts.map +1 -0
  1290. package/dist/cron/validate-timestamp.js +54 -0
  1291. package/dist/cron/validate-timestamp.js.map +1 -0
  1292. package/dist/entry.d.ts +2 -0
  1293. package/dist/entry.d.ts.map +1 -0
  1294. package/dist/entry.js +57 -0
  1295. package/dist/entry.js.map +1 -0
  1296. package/dist/extension-sdk.d.ts +28 -0
  1297. package/dist/extension-sdk.d.ts.map +1 -0
  1298. package/dist/extension-sdk.js +26 -0
  1299. package/dist/extension-sdk.js.map +1 -0
  1300. package/dist/identity/device.d.ts +19 -0
  1301. package/dist/identity/device.d.ts.map +1 -0
  1302. package/dist/identity/device.js +88 -0
  1303. package/dist/identity/device.js.map +1 -0
  1304. package/dist/infra/backoff.d.ts +24 -0
  1305. package/dist/infra/backoff.d.ts.map +1 -0
  1306. package/dist/infra/backoff.js +48 -0
  1307. package/dist/infra/backoff.js.map +1 -0
  1308. package/dist/infra/errors.d.ts +35 -0
  1309. package/dist/infra/errors.d.ts.map +1 -0
  1310. package/dist/infra/errors.js +54 -0
  1311. package/dist/infra/errors.js.map +1 -0
  1312. package/dist/infra/fs/atomic-rename.d.ts +31 -0
  1313. package/dist/infra/fs/atomic-rename.d.ts.map +1 -0
  1314. package/dist/infra/fs/atomic-rename.js +75 -0
  1315. package/dist/infra/fs/atomic-rename.js.map +1 -0
  1316. package/dist/infra/json-file.d.ts +25 -0
  1317. package/dist/infra/json-file.d.ts.map +1 -0
  1318. package/dist/infra/json-file.js +49 -0
  1319. package/dist/infra/json-file.js.map +1 -0
  1320. package/dist/infra/json-utf8-bytes.d.ts +14 -0
  1321. package/dist/infra/json-utf8-bytes.d.ts.map +1 -0
  1322. package/dist/infra/json-utf8-bytes.js +20 -0
  1323. package/dist/infra/json-utf8-bytes.js.map +1 -0
  1324. package/dist/infra/net/dns-pinning.d.ts +66 -0
  1325. package/dist/infra/net/dns-pinning.d.ts.map +1 -0
  1326. package/dist/infra/net/dns-pinning.js +128 -0
  1327. package/dist/infra/net/dns-pinning.js.map +1 -0
  1328. package/dist/infra/net/fetch-guard.d.ts +85 -0
  1329. package/dist/infra/net/fetch-guard.d.ts.map +1 -0
  1330. package/dist/infra/net/fetch-guard.js +439 -0
  1331. package/dist/infra/net/fetch-guard.js.map +1 -0
  1332. package/dist/infra/prototype-keys.d.ts +19 -0
  1333. package/dist/infra/prototype-keys.d.ts.map +1 -0
  1334. package/dist/infra/prototype-keys.js +22 -0
  1335. package/dist/infra/prototype-keys.js.map +1 -0
  1336. package/dist/integrations/ollama.d.ts +67 -0
  1337. package/dist/integrations/ollama.d.ts.map +1 -0
  1338. package/dist/integrations/ollama.js +53 -0
  1339. package/dist/integrations/ollama.js.map +1 -0
  1340. package/dist/integrations/provider-discovery.d.ts +66 -0
  1341. package/dist/integrations/provider-discovery.d.ts.map +1 -0
  1342. package/dist/integrations/provider-discovery.js +166 -0
  1343. package/dist/integrations/provider-discovery.js.map +1 -0
  1344. package/dist/logging/redact.d.ts +28 -0
  1345. package/dist/logging/redact.d.ts.map +1 -0
  1346. package/dist/logging/redact.js +51 -0
  1347. package/dist/logging/redact.js.map +1 -0
  1348. package/dist/logging/subsystem-logger.d.ts +77 -0
  1349. package/dist/logging/subsystem-logger.d.ts.map +1 -0
  1350. package/dist/logging/subsystem-logger.js +577 -0
  1351. package/dist/logging/subsystem-logger.js.map +1 -0
  1352. package/dist/logging/subsystem.d.ts +13 -0
  1353. package/dist/logging/subsystem.d.ts.map +1 -0
  1354. package/dist/logging/subsystem.js +12 -0
  1355. package/dist/logging/subsystem.js.map +1 -0
  1356. package/dist/process/command-queue.d.ts +152 -0
  1357. package/dist/process/command-queue.d.ts.map +1 -0
  1358. package/dist/process/command-queue.js +420 -0
  1359. package/dist/process/command-queue.js.map +1 -0
  1360. package/dist/process/lanes.d.ts +102 -0
  1361. package/dist/process/lanes.d.ts.map +1 -0
  1362. package/dist/process/lanes.js +117 -0
  1363. package/dist/process/lanes.js.map +1 -0
  1364. package/dist/process/session-lane.d.ts +31 -0
  1365. package/dist/process/session-lane.d.ts.map +1 -0
  1366. package/dist/process/session-lane.js +45 -0
  1367. package/dist/process/session-lane.js.map +1 -0
  1368. package/dist/protocol/errors.d.ts +35 -0
  1369. package/dist/protocol/errors.d.ts.map +1 -0
  1370. package/dist/protocol/errors.js +36 -0
  1371. package/dist/protocol/errors.js.map +1 -0
  1372. package/dist/protocol/handshake.d.ts +101 -0
  1373. package/dist/protocol/handshake.d.ts.map +1 -0
  1374. package/dist/protocol/handshake.js +49 -0
  1375. package/dist/protocol/handshake.js.map +1 -0
  1376. package/dist/protocol/messages.d.ts +68 -0
  1377. package/dist/protocol/messages.d.ts.map +1 -0
  1378. package/dist/protocol/messages.js +20 -0
  1379. package/dist/protocol/messages.js.map +1 -0
  1380. package/dist/protocol/methods.d.ts +312 -0
  1381. package/dist/protocol/methods.d.ts.map +1 -0
  1382. package/dist/protocol/methods.js +16 -0
  1383. package/dist/protocol/methods.js.map +1 -0
  1384. package/dist/protocol.d.ts +598 -0
  1385. package/dist/protocol.d.ts.map +1 -0
  1386. package/dist/protocol.js +12 -0
  1387. package/dist/protocol.js.map +1 -0
  1388. package/dist/providers/auth-methods.d.ts +82 -0
  1389. package/dist/providers/auth-methods.d.ts.map +1 -0
  1390. package/dist/providers/auth-methods.js +180 -0
  1391. package/dist/providers/auth-methods.js.map +1 -0
  1392. package/dist/providers/catalog.d.ts +85 -0
  1393. package/dist/providers/catalog.d.ts.map +1 -0
  1394. package/dist/providers/catalog.js +41 -0
  1395. package/dist/providers/catalog.js.map +1 -0
  1396. package/dist/providers/validate-key.d.ts +42 -0
  1397. package/dist/providers/validate-key.d.ts.map +1 -0
  1398. package/dist/providers/validate-key.js.map +1 -0
  1399. package/dist/security/external-content.d.ts +67 -0
  1400. package/dist/security/external-content.d.ts.map +1 -0
  1401. package/dist/security/external-content.js +80 -0
  1402. package/dist/security/external-content.js.map +1 -0
  1403. package/dist/security/injection-patterns.d.ts +33 -0
  1404. package/dist/security/injection-patterns.d.ts.map +1 -0
  1405. package/dist/security/injection-patterns.js +97 -0
  1406. package/dist/security/injection-patterns.js.map +1 -0
  1407. package/dist/security/media-path-guard.d.ts +25 -0
  1408. package/dist/security/media-path-guard.d.ts.map +1 -0
  1409. package/dist/security/media-path-guard.js +98 -0
  1410. package/dist/security/media-path-guard.js.map +1 -0
  1411. package/dist/security/terminal-input-sanitizer.d.ts +30 -0
  1412. package/dist/security/terminal-input-sanitizer.d.ts.map +1 -0
  1413. package/dist/security/terminal-input-sanitizer.js +70 -0
  1414. package/dist/security/terminal-input-sanitizer.js.map +1 -0
  1415. package/dist/sessions/bootstrap-marker.d.ts +5 -0
  1416. package/dist/sessions/bootstrap-marker.d.ts.map +1 -0
  1417. package/dist/sessions/bootstrap-marker.js +120 -0
  1418. package/dist/sessions/bootstrap-marker.js.map +1 -0
  1419. package/dist/sessions/session-file-repair.d.ts +12 -0
  1420. package/dist/sessions/session-file-repair.d.ts.map +1 -0
  1421. package/dist/sessions/session-file-repair.js +155 -0
  1422. package/dist/sessions/session-file-repair.js.map +1 -0
  1423. package/dist/sessions/session-key-utils.d.ts +54 -0
  1424. package/dist/sessions/session-key-utils.d.ts.map +1 -0
  1425. package/dist/sessions/session-key-utils.js +133 -0
  1426. package/dist/sessions/session-key-utils.js.map +1 -0
  1427. package/dist/sessions/session-manager-factory.d.ts +21 -0
  1428. package/dist/sessions/session-manager-factory.d.ts.map +1 -0
  1429. package/dist/sessions/session-manager-factory.js +142 -0
  1430. package/dist/sessions/session-manager-factory.js.map +1 -0
  1431. package/dist/sessions/session-store.d.ts +154 -0
  1432. package/dist/sessions/session-store.d.ts.map +1 -0
  1433. package/dist/sessions/session-store.js +498 -0
  1434. package/dist/sessions/session-store.js.map +1 -0
  1435. package/dist/sessions/session-write-lock.d.ts +10 -0
  1436. package/dist/sessions/session-write-lock.d.ts.map +1 -0
  1437. package/dist/sessions/session-write-lock.js +167 -0
  1438. package/dist/sessions/session-write-lock.js.map +1 -0
  1439. package/dist/sessions/transcript-reader.d.ts +37 -0
  1440. package/dist/sessions/transcript-reader.d.ts.map +1 -0
  1441. package/dist/sessions/transcript-reader.js +136 -0
  1442. package/dist/sessions/transcript-reader.js.map +1 -0
  1443. package/dist/sessions/transcript-repair.d.ts +16 -0
  1444. package/dist/sessions/transcript-repair.d.ts.map +1 -0
  1445. package/dist/sessions/transcript-repair.js +214 -0
  1446. package/dist/sessions/transcript-repair.js.map +1 -0
  1447. package/dist/shared/global-singleton.d.ts +27 -0
  1448. package/dist/shared/global-singleton.d.ts.map +1 -0
  1449. package/dist/shared/global-singleton.js +35 -0
  1450. package/dist/shared/global-singleton.js.map +1 -0
  1451. package/dist/shared/string-coerce.d.ts +12 -0
  1452. package/dist/shared/string-coerce.d.ts.map +1 -0
  1453. package/dist/shared/string-coerce.js +12 -0
  1454. package/dist/shared/string-coerce.js.map +1 -0
  1455. package/dist/storage/boot.d.ts +28 -0
  1456. package/dist/storage/boot.d.ts.map +1 -0
  1457. package/dist/storage/boot.js +588 -0
  1458. package/dist/storage/boot.js.map +1 -0
  1459. package/dist/storage/config-cache.d.ts +23 -0
  1460. package/dist/storage/config-cache.d.ts.map +1 -0
  1461. package/dist/storage/config-cache.js +58 -0
  1462. package/dist/storage/config-cache.js.map +1 -0
  1463. package/dist/storage/convex/auth-store.d.ts +52 -0
  1464. package/dist/storage/convex/auth-store.d.ts.map +1 -0
  1465. package/dist/storage/convex/auth-store.js +282 -0
  1466. package/dist/storage/convex/auth-store.js.map +1 -0
  1467. package/dist/storage/convex/blob-store.d.ts +20 -0
  1468. package/dist/storage/convex/blob-store.d.ts.map +1 -0
  1469. package/dist/storage/convex/blob-store.js +74 -0
  1470. package/dist/storage/convex/blob-store.js.map +1 -0
  1471. package/dist/storage/convex/channel-store.d.ts +112 -0
  1472. package/dist/storage/convex/channel-store.d.ts.map +1 -0
  1473. package/dist/storage/convex/channel-store.js +267 -0
  1474. package/dist/storage/convex/channel-store.js.map +1 -0
  1475. package/dist/storage/convex/client.d.ts +53 -0
  1476. package/dist/storage/convex/client.d.ts.map +1 -0
  1477. package/dist/storage/convex/client.js +121 -0
  1478. package/dist/storage/convex/client.js.map +1 -0
  1479. package/dist/storage/convex/config-store.d.ts +29 -0
  1480. package/dist/storage/convex/config-store.d.ts.map +1 -0
  1481. package/dist/storage/convex/config-store.js +205 -0
  1482. package/dist/storage/convex/config-store.js.map +1 -0
  1483. package/dist/storage/convex/cron-store.d.ts +86 -0
  1484. package/dist/storage/convex/cron-store.d.ts.map +1 -0
  1485. package/dist/storage/convex/cron-store.js +428 -0
  1486. package/dist/storage/convex/cron-store.js.map +1 -0
  1487. package/dist/storage/convex/exec-approval-store.d.ts +38 -0
  1488. package/dist/storage/convex/exec-approval-store.d.ts.map +1 -0
  1489. package/dist/storage/convex/exec-approval-store.js +147 -0
  1490. package/dist/storage/convex/exec-approval-store.js.map +1 -0
  1491. package/dist/storage/convex/extension-store.d.ts +28 -0
  1492. package/dist/storage/convex/extension-store.d.ts.map +1 -0
  1493. package/dist/storage/convex/extension-store.js +39 -0
  1494. package/dist/storage/convex/extension-store.js.map +1 -0
  1495. package/dist/storage/convex/index.d.ts +35 -0
  1496. package/dist/storage/convex/index.d.ts.map +1 -0
  1497. package/dist/storage/convex/index.js +141 -0
  1498. package/dist/storage/convex/index.js.map +1 -0
  1499. package/dist/storage/convex/instance-store.d.ts +37 -0
  1500. package/dist/storage/convex/instance-store.d.ts.map +1 -0
  1501. package/dist/storage/convex/instance-store.js +88 -0
  1502. package/dist/storage/convex/instance-store.js.map +1 -0
  1503. package/dist/storage/convex/log-store.d.ts +36 -0
  1504. package/dist/storage/convex/log-store.d.ts.map +1 -0
  1505. package/dist/storage/convex/log-store.js +213 -0
  1506. package/dist/storage/convex/log-store.js.map +1 -0
  1507. package/dist/storage/convex/memory-store.d.ts +50 -0
  1508. package/dist/storage/convex/memory-store.d.ts.map +1 -0
  1509. package/dist/storage/convex/memory-store.js +537 -0
  1510. package/dist/storage/convex/memory-store.js.map +1 -0
  1511. package/dist/storage/convex/message-store.d.ts +32 -0
  1512. package/dist/storage/convex/message-store.d.ts.map +1 -0
  1513. package/dist/storage/convex/message-store.js +272 -0
  1514. package/dist/storage/convex/message-store.js.map +1 -0
  1515. package/dist/storage/convex/org-store.d.ts +46 -0
  1516. package/dist/storage/convex/org-store.d.ts.map +1 -0
  1517. package/dist/storage/convex/org-store.js +101 -0
  1518. package/dist/storage/convex/org-store.js.map +1 -0
  1519. package/dist/storage/convex/session-store.d.ts +44 -0
  1520. package/dist/storage/convex/session-store.d.ts.map +1 -0
  1521. package/dist/storage/convex/session-store.js +257 -0
  1522. package/dist/storage/convex/session-store.js.map +1 -0
  1523. package/dist/storage/convex/skill-store.d.ts +49 -0
  1524. package/dist/storage/convex/skill-store.d.ts.map +1 -0
  1525. package/dist/storage/convex/skill-store.js +84 -0
  1526. package/dist/storage/convex/skill-store.js.map +1 -0
  1527. package/dist/storage/convex/subagent-store.d.ts +28 -0
  1528. package/dist/storage/convex/subagent-store.d.ts.map +1 -0
  1529. package/dist/storage/convex/subagent-store.js +83 -0
  1530. package/dist/storage/convex/subagent-store.js.map +1 -0
  1531. package/dist/storage/convex/workspace-store.d.ts +25 -0
  1532. package/dist/storage/convex/workspace-store.d.ts.map +1 -0
  1533. package/dist/storage/convex/workspace-store.js +127 -0
  1534. package/dist/storage/convex/workspace-store.js.map +1 -0
  1535. package/dist/storage/cron-cache.d.ts +17 -0
  1536. package/dist/storage/cron-cache.d.ts.map +1 -0
  1537. package/dist/storage/cron-cache.js +67 -0
  1538. package/dist/storage/cron-cache.js.map +1 -0
  1539. package/dist/storage/encryption.d.ts +69 -0
  1540. package/dist/storage/encryption.d.ts.map +1 -0
  1541. package/dist/storage/encryption.js +389 -0
  1542. package/dist/storage/encryption.js.map +1 -0
  1543. package/dist/storage/factory-reset.d.ts +7 -0
  1544. package/dist/storage/factory-reset.d.ts.map +1 -0
  1545. package/dist/storage/factory-reset.js +34 -0
  1546. package/dist/storage/factory-reset.js.map +1 -0
  1547. package/dist/storage/facts-cache.d.ts +24 -0
  1548. package/dist/storage/facts-cache.d.ts.map +1 -0
  1549. package/dist/storage/facts-cache.js +110 -0
  1550. package/dist/storage/facts-cache.js.map +1 -0
  1551. package/dist/storage/flush.d.ts +4 -0
  1552. package/dist/storage/flush.d.ts.map +1 -0
  1553. package/dist/storage/flush.js +128 -0
  1554. package/dist/storage/flush.js.map +1 -0
  1555. package/dist/storage/instance-admin.d.ts +52 -0
  1556. package/dist/storage/instance-admin.d.ts.map +1 -0
  1557. package/dist/storage/instance-admin.js +91 -0
  1558. package/dist/storage/instance-admin.js.map +1 -0
  1559. package/dist/storage/local/auth-store.d.ts +44 -0
  1560. package/dist/storage/local/auth-store.d.ts.map +1 -0
  1561. package/dist/storage/local/auth-store.js +252 -0
  1562. package/dist/storage/local/auth-store.js.map +1 -0
  1563. package/dist/storage/local/blob-store.d.ts +14 -0
  1564. package/dist/storage/local/blob-store.d.ts.map +1 -0
  1565. package/dist/storage/local/blob-store.js +87 -0
  1566. package/dist/storage/local/blob-store.js.map +1 -0
  1567. package/dist/storage/local/channel-store.d.ts +107 -0
  1568. package/dist/storage/local/channel-store.d.ts.map +1 -0
  1569. package/dist/storage/local/channel-store.js +147 -0
  1570. package/dist/storage/local/channel-store.js.map +1 -0
  1571. package/dist/storage/local/config-store.d.ts +23 -0
  1572. package/dist/storage/local/config-store.d.ts.map +1 -0
  1573. package/dist/storage/local/config-store.js +98 -0
  1574. package/dist/storage/local/config-store.js.map +1 -0
  1575. package/dist/storage/local/cron-store.d.ts +30 -0
  1576. package/dist/storage/local/cron-store.d.ts.map +1 -0
  1577. package/dist/storage/local/cron-store.js +186 -0
  1578. package/dist/storage/local/cron-store.js.map +1 -0
  1579. package/dist/storage/local/exec-approval-store.d.ts +41 -0
  1580. package/dist/storage/local/exec-approval-store.d.ts.map +1 -0
  1581. package/dist/storage/local/exec-approval-store.js +78 -0
  1582. package/dist/storage/local/exec-approval-store.js.map +1 -0
  1583. package/dist/storage/local/extension-store.d.ts +13 -0
  1584. package/dist/storage/local/extension-store.d.ts.map +1 -0
  1585. package/dist/storage/local/extension-store.js +36 -0
  1586. package/dist/storage/local/extension-store.js.map +1 -0
  1587. package/dist/storage/local/file-watcher.d.ts +24 -0
  1588. package/dist/storage/local/file-watcher.d.ts.map +1 -0
  1589. package/dist/storage/local/file-watcher.js +141 -0
  1590. package/dist/storage/local/file-watcher.js.map +1 -0
  1591. package/dist/storage/local/index.d.ts +33 -0
  1592. package/dist/storage/local/index.d.ts.map +1 -0
  1593. package/dist/storage/local/index.js +143 -0
  1594. package/dist/storage/local/index.js.map +1 -0
  1595. package/dist/storage/local/instance-store.d.ts +30 -0
  1596. package/dist/storage/local/instance-store.d.ts.map +1 -0
  1597. package/dist/storage/local/instance-store.js +83 -0
  1598. package/dist/storage/local/instance-store.js.map +1 -0
  1599. package/dist/storage/local/log-store.d.ts +27 -0
  1600. package/dist/storage/local/log-store.d.ts.map +1 -0
  1601. package/dist/storage/local/log-store.js +185 -0
  1602. package/dist/storage/local/log-store.js.map +1 -0
  1603. package/dist/storage/local/memory-store.d.ts +39 -0
  1604. package/dist/storage/local/memory-store.d.ts.map +1 -0
  1605. package/dist/storage/local/memory-store.js +258 -0
  1606. package/dist/storage/local/memory-store.js.map +1 -0
  1607. package/dist/storage/local/message-store.d.ts +27 -0
  1608. package/dist/storage/local/message-store.d.ts.map +1 -0
  1609. package/dist/storage/local/message-store.js +253 -0
  1610. package/dist/storage/local/message-store.js.map +1 -0
  1611. package/dist/storage/local/org-store.d.ts +39 -0
  1612. package/dist/storage/local/org-store.d.ts.map +1 -0
  1613. package/dist/storage/local/org-store.js +155 -0
  1614. package/dist/storage/local/org-store.js.map +1 -0
  1615. package/dist/storage/local/session-store.d.ts +30 -0
  1616. package/dist/storage/local/session-store.d.ts.map +1 -0
  1617. package/dist/storage/local/session-store.js +82 -0
  1618. package/dist/storage/local/session-store.js.map +1 -0
  1619. package/dist/storage/local/skill-store.d.ts +40 -0
  1620. package/dist/storage/local/skill-store.d.ts.map +1 -0
  1621. package/dist/storage/local/skill-store.js +121 -0
  1622. package/dist/storage/local/skill-store.js.map +1 -0
  1623. package/dist/storage/local/subagent-store.d.ts +20 -0
  1624. package/dist/storage/local/subagent-store.d.ts.map +1 -0
  1625. package/dist/storage/local/subagent-store.js +71 -0
  1626. package/dist/storage/local/subagent-store.js.map +1 -0
  1627. package/dist/storage/local/workspace-store.d.ts +22 -0
  1628. package/dist/storage/local/workspace-store.d.ts.map +1 -0
  1629. package/dist/storage/local/workspace-store.js +190 -0
  1630. package/dist/storage/local/workspace-store.js.map +1 -0
  1631. package/dist/storage/migrate.d.ts +64 -0
  1632. package/dist/storage/migrate.d.ts.map +1 -0
  1633. package/dist/storage/migrate.js +585 -0
  1634. package/dist/storage/migrate.js.map +1 -0
  1635. package/dist/storage/runtime-context.d.ts +35 -0
  1636. package/dist/storage/runtime-context.d.ts.map +1 -0
  1637. package/dist/storage/runtime-context.js +145 -0
  1638. package/dist/storage/runtime-context.js.map +1 -0
  1639. package/dist/storage/sentinel.d.ts +28 -0
  1640. package/dist/storage/sentinel.d.ts.map +1 -0
  1641. package/dist/storage/sentinel.js +98 -0
  1642. package/dist/storage/sentinel.js.map +1 -0
  1643. package/dist/storage/session-cache.d.ts +15 -0
  1644. package/dist/storage/session-cache.d.ts.map +1 -0
  1645. package/dist/storage/session-cache.js +81 -0
  1646. package/dist/storage/session-cache.js.map +1 -0
  1647. package/dist/storage/store.d.ts +745 -0
  1648. package/dist/storage/store.d.ts.map +1 -0
  1649. package/dist/storage/store.js +36 -0
  1650. package/dist/storage/store.js.map +1 -0
  1651. package/dist/storage/strict-guard.d.ts +17 -0
  1652. package/dist/storage/strict-guard.d.ts.map +1 -0
  1653. package/dist/storage/strict-guard.js +200 -0
  1654. package/dist/storage/strict-guard.js.map +1 -0
  1655. package/dist/storage/workspace-live-mirror.d.ts +33 -0
  1656. package/dist/storage/workspace-live-mirror.d.ts.map +1 -0
  1657. package/dist/storage/workspace-live-mirror.js +207 -0
  1658. package/dist/storage/workspace-live-mirror.js.map +1 -0
  1659. package/dist/system-prompt/assembler.d.ts +113 -0
  1660. package/dist/system-prompt/assembler.d.ts.map +1 -0
  1661. package/dist/system-prompt/assembler.js +649 -0
  1662. package/dist/system-prompt/assembler.js.map +1 -0
  1663. package/dist/system-prompt/bootstrap-budget.d.ts +22 -0
  1664. package/dist/system-prompt/bootstrap-budget.d.ts.map +1 -0
  1665. package/dist/system-prompt/bootstrap-budget.js +83 -0
  1666. package/dist/system-prompt/bootstrap-budget.js.map +1 -0
  1667. package/dist/system-prompt/cache-boundary.d.ts +13 -0
  1668. package/dist/system-prompt/cache-boundary.d.ts.map +1 -0
  1669. package/dist/system-prompt/cache-boundary.js +56 -0
  1670. package/dist/system-prompt/cache-boundary.js.map +1 -0
  1671. package/dist/system-prompt/cache-stability.d.ts +3 -0
  1672. package/dist/system-prompt/cache-stability.d.ts.map +1 -0
  1673. package/dist/system-prompt/cache-stability.js +18 -0
  1674. package/dist/system-prompt/cache-stability.js.map +1 -0
  1675. package/dist/system-prompt/guidance.d.ts +147 -0
  1676. package/dist/system-prompt/guidance.d.ts.map +1 -0
  1677. package/dist/system-prompt/guidance.js +352 -0
  1678. package/dist/system-prompt/guidance.js.map +1 -0
  1679. package/dist/system-prompt/identity-defaults.d.ts +50 -0
  1680. package/dist/system-prompt/identity-defaults.d.ts.map +1 -0
  1681. package/dist/system-prompt/identity-defaults.js +119 -0
  1682. package/dist/system-prompt/identity-defaults.js.map +1 -0
  1683. package/dist/system-prompt/org/escalation-inbox.d.ts +53 -0
  1684. package/dist/system-prompt/org/escalation-inbox.d.ts.map +1 -0
  1685. package/dist/system-prompt/org/escalation-inbox.js +71 -0
  1686. package/dist/system-prompt/org/escalation-inbox.js.map +1 -0
  1687. package/dist/system-prompt/org/receiver-hint.d.ts +72 -0
  1688. package/dist/system-prompt/org/receiver-hint.d.ts.map +1 -0
  1689. package/dist/system-prompt/org/receiver-hint.js +116 -0
  1690. package/dist/system-prompt/org/receiver-hint.js.map +1 -0
  1691. package/dist/system-prompt/org/render-org-block.d.ts +42 -0
  1692. package/dist/system-prompt/org/render-org-block.d.ts.map +1 -0
  1693. package/dist/system-prompt/org/render-org-block.js +57 -0
  1694. package/dist/system-prompt/org/render-org-block.js.map +1 -0
  1695. package/dist/system-prompt/org/sub-agent-anchor.d.ts +30 -0
  1696. package/dist/system-prompt/org/sub-agent-anchor.d.ts.map +1 -0
  1697. package/dist/system-prompt/org/sub-agent-anchor.js +36 -0
  1698. package/dist/system-prompt/org/sub-agent-anchor.js.map +1 -0
  1699. package/dist/system-prompt/override.d.ts +7 -0
  1700. package/dist/system-prompt/override.d.ts.map +1 -0
  1701. package/dist/system-prompt/override.js +13 -0
  1702. package/dist/system-prompt/override.js.map +1 -0
  1703. package/dist/system-prompt/pi-injection.d.ts +5 -0
  1704. package/dist/system-prompt/pi-injection.d.ts.map +1 -0
  1705. package/dist/system-prompt/pi-injection.js +33 -0
  1706. package/dist/system-prompt/pi-injection.js.map +1 -0
  1707. package/dist/system-prompt/runtime-params.d.ts +34 -0
  1708. package/dist/system-prompt/runtime-params.d.ts.map +1 -0
  1709. package/dist/system-prompt/runtime-params.js +108 -0
  1710. package/dist/system-prompt/runtime-params.js.map +1 -0
  1711. package/dist/system-prompt/sanitize.d.ts +7 -0
  1712. package/dist/system-prompt/sanitize.d.ts.map +1 -0
  1713. package/dist/system-prompt/sanitize.js +31 -0
  1714. package/dist/system-prompt/sanitize.js.map +1 -0
  1715. package/dist/system-prompt/types.d.ts +7 -0
  1716. package/dist/system-prompt/types.d.ts.map +1 -0
  1717. package/dist/system-prompt/types.js +3 -0
  1718. package/dist/system-prompt/types.js.map +1 -0
  1719. package/dist/system-prompt/workspace-loader.d.ts +12 -0
  1720. package/dist/system-prompt/workspace-loader.d.ts.map +1 -0
  1721. package/dist/system-prompt/workspace-loader.js +115 -0
  1722. package/dist/system-prompt/workspace-loader.js.map +1 -0
  1723. package/dist/tideline/advanced.d.ts +25 -0
  1724. package/dist/tideline/advanced.d.ts.map +1 -0
  1725. package/dist/tideline/advanced.js +34 -0
  1726. package/dist/tideline/advanced.js.map +1 -0
  1727. package/dist/tideline/eval.d.ts +19 -0
  1728. package/dist/tideline/eval.d.ts.map +1 -0
  1729. package/dist/tideline/eval.js +24 -0
  1730. package/dist/tideline/eval.js.map +1 -0
  1731. package/dist/tideline/host-ports.standalone.d.ts +49 -0
  1732. package/dist/tideline/host-ports.standalone.d.ts.map +1 -0
  1733. package/dist/tideline/host-ports.standalone.js +61 -0
  1734. package/dist/tideline/host-ports.standalone.js.map +1 -0
  1735. package/dist/tideline/index.d.ts +34 -0
  1736. package/dist/tideline/index.d.ts.map +1 -0
  1737. package/dist/tideline/index.js +42 -0
  1738. package/dist/tideline/index.js.map +1 -0
  1739. package/dist/tui/approval-prompt.d.ts +73 -0
  1740. package/dist/tui/approval-prompt.d.ts.map +1 -0
  1741. package/dist/tui/approval-prompt.js +272 -0
  1742. package/dist/tui/approval-prompt.js.map +1 -0
  1743. package/dist/tui/client.d.ts +89 -0
  1744. package/dist/tui/client.d.ts.map +1 -0
  1745. package/dist/tui/client.js.map +1 -0
  1746. package/dist/ui/brand-frames-cli.d.ts +19 -0
  1747. package/dist/ui/brand-frames-cli.d.ts.map +1 -0
  1748. package/dist/ui/brand-frames-cli.js +8 -13
  1749. package/dist/ui/brand-frames-cli.js.map +1 -0
  1750. package/dist/ui/brand.d.ts +41 -0
  1751. package/dist/ui/brand.d.ts.map +1 -0
  1752. package/dist/ui/brand.js +28 -6
  1753. package/dist/ui/brand.js.map +1 -0
  1754. package/dist/ui/editor.d.ts +30 -0
  1755. package/dist/ui/editor.d.ts.map +1 -0
  1756. package/dist/ui/editor.js +73 -0
  1757. package/dist/ui/editor.js.map +1 -0
  1758. package/dist/ui/format-session.d.ts +68 -0
  1759. package/dist/ui/format-session.d.ts.map +1 -0
  1760. package/dist/ui/format-session.js +181 -0
  1761. package/dist/ui/format-session.js.map +1 -0
  1762. package/dist/ui/markdown.d.ts +48 -0
  1763. package/dist/ui/markdown.d.ts.map +1 -0
  1764. package/dist/ui/markdown.js +60 -0
  1765. package/dist/ui/markdown.js.map +1 -0
  1766. package/dist/ui/onboard-storage-mode.d.ts +17 -0
  1767. package/dist/ui/onboard-storage-mode.d.ts.map +1 -0
  1768. package/dist/ui/onboard-storage-mode.js +638 -0
  1769. package/dist/ui/onboard-storage-mode.js.map +1 -0
  1770. package/dist/ui/onboarding.d.ts +97 -0
  1771. package/dist/ui/onboarding.d.ts.map +1 -0
  1772. package/dist/ui/onboarding.js +259 -111
  1773. package/dist/ui/onboarding.js.map +1 -0
  1774. package/dist/ui/searchable-select.d.ts +48 -0
  1775. package/dist/ui/searchable-select.d.ts.map +1 -0
  1776. package/dist/ui/searchable-select.js +108 -0
  1777. package/dist/ui/searchable-select.js.map +1 -0
  1778. package/dist/ui/syntax-theme.d.ts +30 -0
  1779. package/dist/ui/syntax-theme.d.ts.map +1 -0
  1780. package/dist/ui/syntax-theme.js +72 -0
  1781. package/dist/ui/syntax-theme.js.map +1 -0
  1782. package/dist/ui/terminal-cleanup.d.ts +46 -0
  1783. package/dist/ui/terminal-cleanup.d.ts.map +1 -0
  1784. package/dist/ui/terminal-cleanup.js +17 -5
  1785. package/dist/ui/terminal-cleanup.js.map +1 -0
  1786. package/dist/ui/theme.d.ts +21 -0
  1787. package/dist/ui/theme.d.ts.map +1 -0
  1788. package/dist/ui/theme.js +66 -2
  1789. package/dist/ui/theme.js.map +1 -0
  1790. package/dist/ui/tool-result.d.ts +47 -0
  1791. package/dist/ui/tool-result.d.ts.map +1 -0
  1792. package/dist/ui/tool-result.js +100 -0
  1793. package/dist/ui/tool-result.js.map +1 -0
  1794. package/dist/utils/delivery-context.d.ts +50 -0
  1795. package/dist/utils/delivery-context.d.ts.map +1 -0
  1796. package/dist/utils/delivery-context.js +82 -0
  1797. package/dist/utils/delivery-context.js.map +1 -0
  1798. package/dist/utils/message-channel.d.ts +60 -0
  1799. package/dist/utils/message-channel.d.ts.map +1 -0
  1800. package/dist/utils/message-channel.js +103 -0
  1801. package/dist/utils/message-channel.js.map +1 -0
  1802. package/dist/utils/string-coerce.d.ts +50 -0
  1803. package/dist/utils/string-coerce.d.ts.map +1 -0
  1804. package/dist/utils/string-coerce.js +101 -0
  1805. package/dist/utils/string-coerce.js.map +1 -0
  1806. package/dist/version.d.ts +20 -0
  1807. package/dist/version.d.ts.map +1 -0
  1808. package/dist/version.js +54 -0
  1809. package/dist/version.js.map +1 -0
  1810. package/dist/workspace/bootstrap.d.ts +12 -0
  1811. package/dist/workspace/bootstrap.d.ts.map +1 -0
  1812. package/dist/workspace/bootstrap.js +123 -0
  1813. package/dist/workspace/bootstrap.js.map +1 -0
  1814. package/dist/workspace/fs-utils.d.ts +2 -0
  1815. package/dist/workspace/fs-utils.d.ts.map +1 -0
  1816. package/dist/workspace/fs-utils.js +14 -0
  1817. package/dist/workspace/fs-utils.js.map +1 -0
  1818. package/dist/workspace/git-init.d.ts +5 -0
  1819. package/dist/workspace/git-init.d.ts.map +1 -0
  1820. package/dist/workspace/git-init.js +71 -0
  1821. package/dist/workspace/git-init.js.map +1 -0
  1822. package/dist/workspace/state.d.ts +13 -0
  1823. package/dist/workspace/state.d.ts.map +1 -0
  1824. package/dist/workspace/state.js +128 -0
  1825. package/dist/workspace/state.js.map +1 -0
  1826. package/dist/workspace/template-loader.d.ts +15 -0
  1827. package/dist/workspace/template-loader.d.ts.map +1 -0
  1828. package/dist/workspace/template-loader.js +214 -0
  1829. package/dist/workspace/template-loader.js.map +1 -0
  1830. package/package.json +173 -68
  1831. package/scripts/build-done.mjs +125 -0
  1832. package/scripts/run-brigade.mjs +208 -0
  1833. package/skills/1password/SKILL.md +70 -0
  1834. package/skills/1password/references/cli-examples.md +29 -0
  1835. package/skills/1password/references/get-started.md +17 -0
  1836. package/skills/apple-notes/SKILL.md +77 -0
  1837. package/skills/apple-reminders/SKILL.md +118 -0
  1838. package/skills/bear-notes/SKILL.md +107 -0
  1839. package/skills/blogwatcher/SKILL.md +69 -0
  1840. package/skills/blucli/SKILL.md +47 -0
  1841. package/skills/bluebubbles/SKILL.md +136 -0
  1842. package/skills/camsnap/SKILL.md +45 -0
  1843. package/skills/canvas/SKILL.md +204 -0
  1844. package/skills/coding-agent/SKILL.md +316 -0
  1845. package/skills/discord/SKILL.md +197 -0
  1846. package/skills/eightctl/SKILL.md +50 -0
  1847. package/skills/gemini/SKILL.md +43 -0
  1848. package/skills/gh-issues/SKILL.md +885 -0
  1849. package/skills/gifgrep/SKILL.md +79 -0
  1850. package/skills/git-commit/SKILL.md +40 -0
  1851. package/skills/github/SKILL.md +163 -0
  1852. package/skills/gog/SKILL.md +116 -0
  1853. package/skills/goplaces/SKILL.md +52 -0
  1854. package/skills/healthcheck/SKILL.md +245 -0
  1855. package/skills/himalaya/SKILL.md +257 -0
  1856. package/skills/himalaya/references/configuration.md +184 -0
  1857. package/skills/himalaya/references/message-composition.md +199 -0
  1858. package/skills/imsg/SKILL.md +122 -0
  1859. package/skills/lead-scout/SKILL.md +46 -0
  1860. package/skills/mcporter/SKILL.md +61 -0
  1861. package/skills/model-usage/SKILL.md +69 -0
  1862. package/skills/nano-pdf/SKILL.md +38 -0
  1863. package/skills/node-connect/SKILL.md +142 -0
  1864. package/skills/notion/SKILL.md +174 -0
  1865. package/skills/oauth-setup/SKILL.md +55 -0
  1866. package/skills/obsidian/SKILL.md +81 -0
  1867. package/skills/openai-whisper/SKILL.md +38 -0
  1868. package/skills/openai-whisper-api/SKILL.md +62 -0
  1869. package/skills/openai-whisper-api/scripts/transcribe.sh +88 -0
  1870. package/skills/openhue/SKILL.md +112 -0
  1871. package/skills/oracle/SKILL.md +125 -0
  1872. package/skills/ordercli/SKILL.md +78 -0
  1873. package/skills/peekaboo/SKILL.md +190 -0
  1874. package/skills/sag/SKILL.md +87 -0
  1875. package/skills/session-logs/SKILL.md +151 -0
  1876. package/skills/share-skills/SKILL.md +72 -0
  1877. package/skills/sherpa-onnx-tts/SKILL.md +109 -0
  1878. package/skills/sherpa-onnx-tts/bin/sherpa-onnx-tts +178 -0
  1879. package/skills/skill-creator/SKILL.md +372 -0
  1880. package/skills/skill-creator/license.txt +202 -0
  1881. package/skills/skill-creator/scripts/init_skill.py +378 -0
  1882. package/skills/skill-creator/scripts/package_skill.py +139 -0
  1883. package/skills/skill-creator/scripts/quick_validate.py +159 -0
  1884. package/skills/skill-creator/scripts/test_package_skill.py +160 -0
  1885. package/skills/skill-creator/scripts/test_quick_validate.py +72 -0
  1886. package/skills/slack/SKILL.md +144 -0
  1887. package/skills/songsee/SKILL.md +49 -0
  1888. package/skills/sonoscli/SKILL.md +65 -0
  1889. package/skills/spotify-player/SKILL.md +64 -0
  1890. package/skills/summarize/SKILL.md +87 -0
  1891. package/skills/taskflow/SKILL.md +149 -0
  1892. package/skills/taskflow-inbox-triage/SKILL.md +119 -0
  1893. package/skills/things-mac/SKILL.md +86 -0
  1894. package/skills/tmux/SKILL.md +170 -0
  1895. package/skills/tmux/scripts/find-sessions.sh +112 -0
  1896. package/skills/tmux/scripts/wait-for-text.sh +83 -0
  1897. package/skills/trello/SKILL.md +108 -0
  1898. package/skills/video-frames/SKILL.md +46 -0
  1899. package/skills/video-frames/scripts/frame.sh +81 -0
  1900. package/skills/voice-call/SKILL.md +45 -0
  1901. package/skills/wacli/SKILL.md +72 -0
  1902. package/skills/weather/SKILL.md +129 -0
  1903. package/skills/xurl/SKILL.md +461 -0
  1904. package/templates/workspace/AGENTS.md +223 -0
  1905. package/templates/workspace/BOOTSTRAP.md +64 -0
  1906. package/templates/workspace/HEARTBEAT.md +15 -0
  1907. package/templates/workspace/IDENTITY.md +31 -0
  1908. package/templates/workspace/SOUL.md +47 -0
  1909. package/templates/workspace/TOOLS.md +48 -0
  1910. package/templates/workspace/USER.md +25 -0
  1911. package/CHANGELOG.md +0 -48
  1912. package/SECURITY.md +0 -208
  1913. package/assets/brigade-wordmark.png +0 -0
  1914. package/dist/cli/chat-cmd.js +0 -191
  1915. package/dist/cli/config-cmd.js +0 -171
  1916. package/dist/cli/connect-cmd.js +0 -487
  1917. package/dist/cli/doctor-cmd.js +0 -387
  1918. package/dist/cli/gateway-cmd.js +0 -155
  1919. package/dist/cli.js +0 -328
  1920. package/dist/core/agent.js +0 -1123
  1921. package/dist/core/auth-label.js +0 -147
  1922. package/dist/core/cli-error.js +0 -94
  1923. package/dist/core/error-classifier.js +0 -354
  1924. package/dist/core/provider-payload-mutators.js +0 -517
  1925. package/dist/core/provider-quirks.js +0 -285
  1926. package/dist/core/smart-compaction.js +0 -209
  1927. package/dist/core/system-prompt-defaults.js +0 -264
  1928. package/dist/core/system-prompt-guidance.js +0 -271
  1929. package/dist/index.js +0 -32
  1930. package/dist/ui/brand-frames.js +0 -36
  1931. package/dist/ui/chat.js +0 -1008
@@ -0,0 +1,1327 @@
1
+ /**
2
+ * Structured memory records — an append-only JSONL file
3
+ * (`<workspace>/memory/facts.jsonl`). Single-user, so reads scan the whole
4
+ * file and writes are read-modify-write — no concurrency budget to fight.
5
+ *
6
+ * A "memory" here is a structured fact, NOT a raw note: one declarative
7
+ * sentence tagged with a `segment` (what kind of fact) and a `tier` +
8
+ * `importance` + `decayRate` derived from that segment. This is what the
9
+ * post-turn extraction subagent emits and what `write_memory` persists; the
10
+ * lexical recall layer (storage.ts) searches these alongside MEMORY.md +
11
+ * daily notes.
12
+ *
13
+ * Conflict resolution: `supersedes` archives older records, the
14
+ * `correction` segment overturns a prior belief, and a decay GC ages out
15
+ * neglected facts. (A heavier 3-LLM consolidation debate is intentionally
16
+ * NOT done in v1 — supersede + decay cover the common cases.)
17
+ */
18
+ import * as fs from "node:fs";
19
+ import * as path from "node:path";
20
+ // Host seams (logger / convex cache / runtime-mode probe / write-time threat-scan)
21
+ // are routed through ONE swappable module — `./host-ports.js` — so the core has zero
22
+ // `../../` host imports and stays extractable. Brigade's host-ports forwards to the
23
+ // real modules (pure indirection, no behavior change); a standalone publish swaps it
24
+ // for an fs-only build. See host-ports.ts.
25
+ import { createSubsystemLogger, getCachedFacts, MemoryThreatError, primeFactsCache, scanForThreats, tryGetRuntimeContext, workspaceIdFromDir, writeThroughFactsCache, } from "./host-ports.js";
26
+ import { bm25Score, tokenize } from "./scoring.js";
27
+ import { evaluateWriteGate, isTrustedTarget, isUntrustedSource, WriteGateError } from "./write-gate.js";
28
+ import { inverseLinkKind } from "./links.js";
29
+ import { MemoryEventLog } from "./event-log.js";
30
+ import { cosine, getDefaultEmbedder } from "./embedder.js";
31
+ import { recallHybrid, recallHybridAsync } from "./hybrid.js";
32
+ /** Runtime list of every {@link MemorySourceType} — for validating
33
+ * externally-loaded data (e.g. the real-data gold path, where a typo'd source
34
+ * would otherwise be silently treated as TRUSTED by the write-gate). The
35
+ * `satisfies` clause makes a typo/extra value a COMPILE error; keep in sync with
36
+ * the type above if a source is ever added. */
37
+ export const MEMORY_SOURCE_TYPES = [
38
+ "user_instruction",
39
+ "owner_message",
40
+ "channel_message",
41
+ "tool_output",
42
+ "retrieved_document",
43
+ "compaction",
44
+ "extraction",
45
+ "dream",
46
+ ];
47
+ /**
48
+ * Per-segment defaults. `identity` is the most durable (permanent, slow
49
+ * decay); `context` the most ephemeral (short tier, fast decay).
50
+ */
51
+ export const SEGMENT_DEFAULTS = {
52
+ identity: { tier: "permanent", importance: 0.85, decayRate: 0.01 },
53
+ correction: { tier: "long", importance: 0.8, decayRate: 0.015 },
54
+ relationship: { tier: "long", importance: 0.75, decayRate: 0.02 },
55
+ preference: { tier: "long", importance: 0.7, decayRate: 0.02 },
56
+ project: { tier: "long", importance: 0.65, decayRate: 0.025 },
57
+ knowledge: { tier: "long", importance: 0.6, decayRate: 0.03 },
58
+ context: { tier: "short", importance: 0.4, decayRate: 0.08 },
59
+ };
60
+ export const MEMORY_SEGMENTS = Object.keys(SEGMENT_DEFAULTS);
61
+ /** Relative path of the structured fact store within a workspace. */
62
+ export const FACTS_RELATIVE_PATH = path.join("memory", "facts.jsonl");
63
+ const driftLog = createSubsystemLogger("memory/records");
64
+ /**
65
+ * Hard cap on a single fact's content. A fact is meant to be one sentence;
66
+ * this stops a misbehaving model (or pasted blob) from writing a megabyte
67
+ * "fact" that then bloats the always-read JSONL AND every auto-recall
68
+ * injection. Generous enough for any legitimate fact.
69
+ */
70
+ export const MAX_FACT_CONTENT_CHARS = 1000;
71
+ /**
72
+ * Jaccard-similarity threshold above which two facts are treated as the same
73
+ * at write time (dedup). Deliberately HIGH (0.85) so only near-identical
74
+ * restatements collapse — distinct facts that merely share words (e.g. two
75
+ * different facts about the same topic) are kept separate.
76
+ */
77
+ export const DEDUP_SIMILARITY = 0.85;
78
+ /**
79
+ * Idempotency bars for "is this extracted fact ALREADY known?" — looser than the
80
+ * write-time {@link DEDUP_SIMILARITY} because post-turn extraction REWORDS a fact
81
+ * the operator already taught (a paraphrase scores well below 0.85 on both lanes:
82
+ * measured ≈0.4–0.64 cosine / ≈0.2–0.6 Jaccard for real restatements). These bars
83
+ * apply ONLY when the existing candidate is SUBJECT-BEARING — the single-valued
84
+ * facts (`diet`, `ui_theme`, …) extraction must not churn a subject-less twin
85
+ * beside — so the looseness can't suppress an ADDITIVE fact (pets, skills: no
86
+ * subjectKey ⇒ they fall back to the strict {@link DEDUP_SIMILARITY} near-exact
87
+ * bar). Empirically these cleanly separate real restatements from distinct facts.
88
+ */
89
+ export const IDEMPOTENT_COSINE_BAR = 0.45;
90
+ export const IDEMPOTENT_JACCARD_BAR = 0.4;
91
+ /** CONTENT-token SET of a fact (for dedup + slot-restate detection). Uses the
92
+ * SAME stopword-stripping tokenizer as recall (scoring.ts `tokenize`) so similarity
93
+ * is measured on MEANINGFUL tokens, not sentence scaffolding — a shared frame like
94
+ * "the user prefers to use the …" must not inflate overlap (it was inflating it to
95
+ * the point of wrongly superseding unrelated facts). One tokenizer, one basis. */
96
+ function tokenSet(content) {
97
+ return new Set(tokenize(content));
98
+ }
99
+ /** Normalize an attribute SLOT key: lowercase, non-alphanumeric runs → "_",
100
+ * trimmed of edge underscores. So "Deploy Day" / "deploy-day" / "deploy_day"
101
+ * all collapse to one slot, maximizing supersede matches across phrasings. */
102
+ function normalizeSubjectKey(raw) {
103
+ // Unicode-aware (lockstep with scoring.ts tokenize + embedder features): a
104
+ // non-Latin attribute name (e.g. a CJK/Cyrillic slot) keeps its characters
105
+ // instead of collapsing to empty, so same-slot supersede works across scripts.
106
+ return raw
107
+ .toLowerCase()
108
+ .replace(/[^\p{L}\p{N}]+/gu, "_")
109
+ .replace(/^_+|_+$/g, "");
110
+ }
111
+ /** Jaccard similarity |A∩B| / |A∪B| of two token sets (0 when both empty). */
112
+ function jaccard(a, b) {
113
+ if (a.size === 0 && b.size === 0)
114
+ return 0;
115
+ let inter = 0;
116
+ for (const t of a)
117
+ if (b.has(t))
118
+ inter += 1;
119
+ const union = a.size + b.size - inter;
120
+ return union === 0 ? 0 : inter / union;
121
+ }
122
+ /** Token-set Jaccard over two raw contents (the dedup/idempotency basis — same
123
+ * tokenizer as recall). Exposed so the extraction-idempotency check (extract.ts)
124
+ * measures "already-known" with the IDENTICAL near-duplicate basis the write-time
125
+ * dedup uses, instead of re-deriving a divergent one. */
126
+ export function contentSimilarity(a, b) {
127
+ return jaccard(tokenSet(a), tokenSet(b));
128
+ }
129
+ /**
130
+ * Segment SPECIFICITY rank — higher = more specific / more authoritative about
131
+ * the operator's self-model. Drives "richest wins" so a reworded, subject-less
132
+ * `knowledge` copy emitted by post-turn extraction can never out-rank the
133
+ * `identity`/`preference`/`correction` original the operator actually taught.
134
+ * The authoritative self-model segments (the write-gate's PROTECTED set) sit at
135
+ * the top; descriptive/situational segments below; generic `knowledge` (the
136
+ * confinement target extraction lands in) is the floor with `context`.
137
+ */
138
+ const SEGMENT_SPECIFICITY = {
139
+ identity: 5,
140
+ correction: 5,
141
+ preference: 5,
142
+ relationship: 3,
143
+ project: 3,
144
+ context: 1,
145
+ knowledge: 1,
146
+ };
147
+ /** The fields that make one record "richer" than a near-identical twin, in
148
+ * precedence order. A higher tuple wins; ties fall through to the next field.
149
+ * Recency is INTENTIONALLY NOT here — a fresher restatement must not beat a
150
+ * metadata-bearing original (the bug this fixes). The caller breaks a true
151
+ * all-equal tie by recency for stability. */
152
+ function richnessTuple(r) {
153
+ return [
154
+ r.subjectKey ? 1 : 0, // a subject-bearing fact anchors a vault hub — keep it
155
+ SEGMENT_SPECIFICITY[r.segment] ?? 0, // identity/preference/correction beat knowledge
156
+ typeof r.confidence === "number" ? r.confidence : 0, // more-confident wins
157
+ r.importance, // then importance
158
+ r.accessCount, // then confirmations (recall reinforcement / reasserts)
159
+ ];
160
+ }
161
+ /**
162
+ * Compare two records by metadata RICHNESS (NOT recency). Returns >0 when `a` is
163
+ * richer, <0 when `b` is, 0 when equal on every richness field. This is the
164
+ * survivor-selection ordering for every dedup / supersede / consolidation merge:
165
+ * the SURVIVING record must be the richest one, so a subject-less reworded copy
166
+ * never archives a subject-bearing `identity`/`preference` original.
167
+ */
168
+ export function compareRichness(a, b) {
169
+ const ta = richnessTuple(a);
170
+ const tb = richnessTuple(b);
171
+ for (let i = 0; i < ta.length; i++) {
172
+ if (ta[i] !== tb[i])
173
+ return ta[i] - tb[i];
174
+ }
175
+ return 0;
176
+ }
177
+ /**
178
+ * Of two near-identical records, the one that should SURVIVE a merge: the richer
179
+ * by {@link compareRichness}; an exact richness tie breaks to the NEWER record
180
+ * (a genuine restatement refreshes the belief). Pure — picks, never mutates.
181
+ */
182
+ export function richerSurvivor(a, b) {
183
+ const byRichness = compareRichness(a, b);
184
+ if (byRichness !== 0)
185
+ return byRichness > 0 ? a : b;
186
+ return a.createdAt >= b.createdAt ? a : b;
187
+ }
188
+ /**
189
+ * Fold the RICHER metadata of `loser` into `survivor`, in place — so collapsing a
190
+ * near-duplicate pair never DROPS hard-won metadata even when the survivor was the
191
+ * sparser record. Each field takes the more-informative value across BOTH records:
192
+ * a present `subjectKey` is never lost to none; the more-specific segment is kept;
193
+ * importance / confidence / accessCount take the max; `sourceTurn` / `validFrom`
194
+ * backfill if missing; links union (deduped). Provenance (`sourceType`, `createdBy`)
195
+ * is NOT merged — those are identity/trust, not richness, and the survivor keeps its
196
+ * own. Returns `survivor` for chaining. Mutates `survivor` only.
197
+ */
198
+ export function inheritRicherMetadata(survivor, loser) {
199
+ // subjectKey — a subject anchor must never be lost to none (the vault-hub key).
200
+ if (!survivor.subjectKey && loser.subjectKey)
201
+ survivor.subjectKey = loser.subjectKey;
202
+ // segment — keep the more-specific of the two (identity/preference beat knowledge).
203
+ if ((SEGMENT_SPECIFICITY[loser.segment] ?? 0) > (SEGMENT_SPECIFICITY[survivor.segment] ?? 0)) {
204
+ survivor.segment = loser.segment;
205
+ // Re-base the segment-derived durability so a promoted segment isn't left with
206
+ // the weaker tier/decay of the segment it replaced (importance is maxed below).
207
+ const d = SEGMENT_DEFAULTS[survivor.segment] ?? SEGMENT_DEFAULTS.context;
208
+ survivor.tier = d.tier;
209
+ survivor.decayRate = d.decayRate;
210
+ }
211
+ survivor.importance = Math.max(survivor.importance, loser.importance);
212
+ if (typeof loser.confidence === "number") {
213
+ survivor.confidence = Math.max(survivor.confidence ?? 0, loser.confidence);
214
+ }
215
+ survivor.accessCount = Math.max(survivor.accessCount, loser.accessCount);
216
+ if (!survivor.sourceTurn && loser.sourceTurn)
217
+ survivor.sourceTurn = loser.sourceTurn;
218
+ if (survivor.validFrom === undefined && loser.validFrom !== undefined)
219
+ survivor.validFrom = loser.validFrom;
220
+ // Links union, deduped by kind|target (don't carry an edge that points at the
221
+ // survivor itself — a self-loop from a mirrored supersede).
222
+ if (loser.links && loser.links.length > 0) {
223
+ const seen = new Set((survivor.links ?? []).map((l) => `${l.kind}|${l.target}`));
224
+ const merged = [...(survivor.links ?? [])];
225
+ for (const l of loser.links) {
226
+ const key = `${l.kind}|${l.target}`;
227
+ if (l.target === survivor.memoryId || seen.has(key))
228
+ continue;
229
+ seen.add(key);
230
+ merged.push(l);
231
+ }
232
+ if (merged.length > 0)
233
+ survivor.links = merged;
234
+ }
235
+ return survivor;
236
+ }
237
+ /** `mem_<base36 time>_<rand>` — a time-sortable id shape. */
238
+ export function makeMemoryId() {
239
+ return `mem_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
240
+ }
241
+ /**
242
+ * Treat a missing origin as owner (back-compat with records persisted
243
+ * before ownership tracking shipped). All recall + dedup logic should
244
+ * route through this helper rather than reading `createdBy` directly so
245
+ * the legacy default stays in one place.
246
+ */
247
+ export function resolveRecordOrigin(origin) {
248
+ return origin ?? { kind: "owner" };
249
+ }
250
+ /** Origin-isolation bucket key. Owner (and legacy/undefined-origin) facts share
251
+ * one bucket; each channel peer (channelId+conversationId+sessionKey) is its
252
+ * OWN bucket — so any cross-fact operation (consolidation, dream merges) can
253
+ * group by this and never mix origins. The canonical key; consolidate.ts +
254
+ * dream.ts + FactStore.distinctOrigins all route through it. */
255
+ export function originBucketKey(r) {
256
+ const o = resolveRecordOrigin(r.createdBy);
257
+ if (o.kind !== "channel")
258
+ return "owner";
259
+ // JSON-encode the tuple so a ':' INSIDE a component (a WhatsApp JID conversationId,
260
+ // the ':'-structured sessionKey) can't shift the delimiter and collide two DISTINCT
261
+ // origins into ONE bucket (a cross-principal merge in dream/consolidate). accountId
262
+ // is in the key so two operator accounts of the same channel stay distinct origins.
263
+ return `channel:${JSON.stringify([o.channelId ?? "", o.accountId ?? "", o.conversationId ?? "", o.sessionKey ?? ""])}`;
264
+ }
265
+ /** Two origins are the same when both fields-by-fields match. */
266
+ export function sameOrigin(a, b) {
267
+ const resolvedA = resolveRecordOrigin(a);
268
+ const resolvedB = resolveRecordOrigin(b);
269
+ if (resolvedA.kind !== resolvedB.kind)
270
+ return false;
271
+ if (resolvedA.kind === "owner")
272
+ return true;
273
+ const channelA = resolvedA;
274
+ const channelB = resolvedB;
275
+ return (channelA.channelId === channelB.channelId &&
276
+ (channelA.accountId ?? "") === (channelB.accountId ?? "") &&
277
+ channelA.conversationId === channelB.conversationId &&
278
+ channelA.sessionKey === channelB.sessionKey);
279
+ }
280
+ /** True if the record matches the filter. `undefined` filter matches every record. */
281
+ export function recordMatchesOriginFilter(record, filter) {
282
+ if (filter === undefined)
283
+ return true;
284
+ return sameOrigin(record.createdBy, filter);
285
+ }
286
+ /** Clamp to [0,1], falling back to `fallback` when not a finite number. */
287
+ export function clampImportance(value, fallback) {
288
+ if (typeof value !== "number" || !Number.isFinite(value))
289
+ return fallback;
290
+ return Math.max(0, Math.min(1, value));
291
+ }
292
+ /**
293
+ * Append-only-ish JSONL fact store. "Mutations" (markAccessed / supersede /
294
+ * setLifecycle / decay) are read-modify-write of the whole file — fine at
295
+ * single-user scale, and atomic via tmp+rename so a crash never leaves a
296
+ * half-written store.
297
+ */
298
+ export class FactStore {
299
+ file;
300
+ /** Injectable wall-clock. Defaults to `Date.now`; the eval pins it (e.g. `() => 0`)
301
+ * so write-time `createdAt` AND score-time `now` share ONE deterministic clock —
302
+ * otherwise decay over the (load-dependent) gap between seeding and recall makes
303
+ * the hybrid/decay lanes non-reproducible. Production passes nothing → `Date.now`. */
304
+ clock;
305
+ eventLogCache;
306
+ /** Did the most recent readAll SKIP any non-empty line (unparseable JSON or an
307
+ * invalid record shape)? Such content — a hand-edit, a torn/concurrent write, a
308
+ * partial sync — would be silently DROPPED by the next writeAll (which rewrites
309
+ * only the parsed records). When set, writeAll snapshots the file to a `.bak`
310
+ * first so the skipped content stays recoverable. */
311
+ lastReadHadUnparseable = false;
312
+ constructor(workspaceDir, opts = {}) {
313
+ this.file = path.join(workspaceDir, FACTS_RELATIVE_PATH);
314
+ this.clock = opts.now ?? (() => Date.now());
315
+ }
316
+ /** Absolute path to the JSONL file (for diagnostics). */
317
+ get filePath() {
318
+ return this.file;
319
+ }
320
+ /** The append-only event log (sibling `events.jsonl` of the facts file). */
321
+ eventLog() {
322
+ if (!this.eventLogCache) {
323
+ this.eventLogCache = new MemoryEventLog(path.join(path.dirname(this.file), "events.jsonl"));
324
+ }
325
+ return this.eventLogCache;
326
+ }
327
+ /** Emit a provenance event. Filesystem mode appends to `events.jsonl`; convex mode
328
+ * appends to the convex audit trail via the OPTIONAL `appendMemoryEvent` store hook
329
+ * (best-effort + fire-and-forget — an audit-log write must never fail a memory
330
+ * write, and the log is additive, never affecting recall). When the hook is absent
331
+ * (a backend without the convex events table yet) it degrades to no audit trail. */
332
+ emit(event) {
333
+ const rctx = tryGetRuntimeContext();
334
+ if (rctx?.mode === "convex") {
335
+ const append = rctx.store.memory.appendMemoryEvent;
336
+ if (append) {
337
+ const wsId = workspaceIdFromDir(path.dirname(path.dirname(this.file)));
338
+ void append.call(rctx.store.memory, wsId, event).catch(() => { });
339
+ }
340
+ return;
341
+ }
342
+ this.eventLog().append(event);
343
+ }
344
+ /** The append-only provenance history. SYNC — filesystem only (convex reads are
345
+ * async; use {@link readEventsAsync}). Empty in convex mode. Ordered oldest-first. */
346
+ readEvents() {
347
+ if (tryGetRuntimeContext()?.mode === "convex")
348
+ return [];
349
+ return this.eventLog().readAll();
350
+ }
351
+ /** The append-only provenance history, working in BOTH modes — fs reads
352
+ * `events.jsonl`; convex reads the audit trail via the optional `listMemoryEvents`
353
+ * store hook (empty when the hook is absent). Ordered oldest-first. */
354
+ async readEventsAsync() {
355
+ const rctx = tryGetRuntimeContext();
356
+ if (rctx?.mode === "convex") {
357
+ const list = rctx.store.memory.listMemoryEvents;
358
+ if (!list)
359
+ return [];
360
+ const wsId = workspaceIdFromDir(path.dirname(path.dirname(this.file)));
361
+ return (await list.call(rctx.store.memory, wsId));
362
+ }
363
+ return this.eventLog().readAll();
364
+ }
365
+ /** Read every record. Malformed lines are skipped (never throws on a bad line). */
366
+ readAll() {
367
+ // Convex mode — serve from the boot-hydrated per-workspace cache. An
368
+ // unprimed workspace genuinely has no facts (boot hydrates every
369
+ // config agent's workspace + main); prime the empty shape so later
370
+ // writes diff against it.
371
+ const rctx = tryGetRuntimeContext();
372
+ if (rctx?.mode === "convex") {
373
+ const wsId = workspaceIdFromDir(path.dirname(path.dirname(this.file)));
374
+ const cached = getCachedFacts(wsId);
375
+ if (cached)
376
+ return structuredClone(cached);
377
+ // MISS SELF-HEAL: a workspace that wasn't boot-hydrated (a key mismatch, an
378
+ // agent added AFTER boot, or a hydration race) would otherwise read EMPTY
379
+ // forever. Prime [] for this synchronous read, but kick off a one-shot backfill
380
+ // so the NEXT read serves the real rows instead of permanent amnesia. Guarded
381
+ // (a fake store may omit the method). Best-effort.
382
+ primeFactsCache(wsId, []);
383
+ if (typeof rctx.store.memory.listAllFactRecordsRaw === "function") {
384
+ void rctx.store.memory
385
+ .listAllFactRecordsRaw(wsId)
386
+ .then((records) => {
387
+ if (records.length === 0)
388
+ return;
389
+ // MERGE, don't clobber: a write that landed DURING the fetch must not be
390
+ // lost (priming the fetched rows over it would drop it), and the
391
+ // pre-existing rows must not be lost either. Backfilled rows fill the
392
+ // cache; any locally-written row WINS on memoryId conflict.
393
+ const byId = new Map(records.map((r) => [r.memoryId, r]));
394
+ for (const local of getCachedFacts(wsId) ?? [])
395
+ byId.set(local.memoryId, local);
396
+ primeFactsCache(wsId, [...byId.values()]);
397
+ })
398
+ .catch(() => { });
399
+ }
400
+ return [];
401
+ }
402
+ let raw;
403
+ try {
404
+ raw = fs.readFileSync(this.file, "utf8");
405
+ }
406
+ catch {
407
+ return [];
408
+ }
409
+ const out = [];
410
+ let nonEmpty = 0;
411
+ for (const line of raw.split("\n")) {
412
+ const trimmed = line.trim();
413
+ if (!trimmed)
414
+ continue;
415
+ nonEmpty++;
416
+ try {
417
+ const rec = JSON.parse(trimmed);
418
+ if (rec && typeof rec.memoryId === "string" && typeof rec.content === "string") {
419
+ out.push(rec);
420
+ }
421
+ }
422
+ catch {
423
+ // Skip a corrupt line rather than failing the whole read.
424
+ }
425
+ }
426
+ // Flag for the drift guard: any non-empty line we couldn't turn into a record
427
+ // is content the next writeAll would silently drop — snapshot before that.
428
+ this.lastReadHadUnparseable = nonEmpty > out.length;
429
+ return out;
430
+ }
431
+ /** Active records, optionally filtered, most-recent-first, capped by `limit`. */
432
+ list(filter = {}) {
433
+ const lifecycle = filter.lifecycle ?? "active";
434
+ let recs = this.readAll().filter((r) => r.lifecycle === lifecycle);
435
+ if (filter.segment)
436
+ recs = recs.filter((r) => r.segment === filter.segment);
437
+ if (filter.origin !== undefined) {
438
+ recs = recs.filter((r) => recordMatchesOriginFilter(r, filter.origin));
439
+ }
440
+ recs.sort((a, b) => b.createdAt - a.createdAt);
441
+ return filter.limit && filter.limit > 0 ? recs.slice(0, filter.limit) : recs;
442
+ }
443
+ /**
444
+ * Persist a new fact. Derives tier/importance/decay from the segment
445
+ * defaults (writer may override tier/importance). Archives any `supersedes`
446
+ * targets. Returns the stored record.
447
+ */
448
+ write(fact) {
449
+ const defaults = SEGMENT_DEFAULTS[fact.segment] ?? SEGMENT_DEFAULTS.context;
450
+ const now = this.clock();
451
+ const record = {
452
+ memoryId: makeMemoryId(),
453
+ content: fact.content.trim().slice(0, MAX_FACT_CONTENT_CHARS),
454
+ segment: fact.segment,
455
+ tier: fact.tier ?? defaults.tier,
456
+ importance: clampImportance(fact.importance, defaults.importance),
457
+ decayRate: defaults.decayRate,
458
+ accessCount: 0,
459
+ lastAccessedAt: now,
460
+ createdAt: now,
461
+ sourceTurn: fact.sourceTurn,
462
+ supersedes: fact.supersedes && fact.supersedes.length > 0 ? fact.supersedes : undefined,
463
+ lifecycle: "active",
464
+ ...(fact.createdBy !== undefined ? { createdBy: fact.createdBy } : {}),
465
+ ...(fact.sourceType !== undefined ? { sourceType: fact.sourceType } : {}),
466
+ ...(fact.links !== undefined && fact.links.length > 0 ? { links: fact.links } : {}),
467
+ ...(fact.validFrom !== undefined ? { validFrom: fact.validFrom } : {}),
468
+ ...(fact.validTo !== undefined ? { validTo: fact.validTo } : {}),
469
+ ...(fact.confidence !== undefined ? { confidence: fact.confidence } : {}),
470
+ ...(fact.status !== undefined ? { status: fact.status } : {}),
471
+ ...(fact.sourcePointers !== undefined && fact.sourcePointers.length > 0
472
+ ? { sourcePointers: fact.sourcePointers }
473
+ : {}),
474
+ ...(fact.modality !== undefined ? { modality: fact.modality } : {}),
475
+ ...(fact.mediaPointer !== undefined ? { mediaPointer: fact.mediaPointer } : {}),
476
+ ...(fact.subjectKey && fact.subjectKey.trim() ? { subjectKey: normalizeSubjectKey(fact.subjectKey) } : {}),
477
+ metadata: fact.metadata,
478
+ };
479
+ const all = this.readAll();
480
+ // Write-gate (Tideline Step 12) — an UNTRUSTED source (tool_output /
481
+ // retrieved_document) must not poison the authoritative store: it can't
482
+ // author an identity/preference/correction fact, nor supersede an
483
+ // owner-authored one. Dormant for trusted/legacy writes (sourceType
484
+ // undefined). Evaluated BEFORE any mutation so a blocked write is a
485
+ // clean no-op (throws WriteGateError; the caller surfaces it).
486
+ if (isUntrustedSource(record.sourceType)) {
487
+ const supersedeIds = new Set(record.supersedes ?? []);
488
+ const verdict = evaluateWriteGate({
489
+ sourceType: record.sourceType,
490
+ segment: record.segment,
491
+ supersedeTargets: all
492
+ // Match the origin-gated archive loop below (~line 791): a cross-origin
493
+ // supersede silently no-ops there, so the gate must NOT hard-block on it —
494
+ // only same-origin targets are real supersede candidates to evaluate.
495
+ .filter((r) => supersedeIds.has(r.memoryId) && sameOrigin(r.createdBy, record.createdBy))
496
+ .map((r) => ({ memoryId: r.memoryId, sourceType: r.sourceType })),
497
+ });
498
+ if (!verdict.allow) {
499
+ this.emit({
500
+ at: now,
501
+ kind: "blocked",
502
+ memoryId: record.memoryId,
503
+ segment: record.segment,
504
+ ...(record.sourceType !== undefined ? { sourceType: record.sourceType } : {}),
505
+ reason: verdict.reason,
506
+ });
507
+ throw new WriteGateError(verdict.reason);
508
+ }
509
+ // CONTENT threat-scan — the write-gate above confines WHICH segment an
510
+ // untrusted source may author (provenance); this confines WHAT the text
511
+ // SAYS. An untrusted source may legitimately write `knowledge`, so an
512
+ // injection/exfil/C2 payload ("ignore prior instructions…", a beacon, an
513
+ // exfil curl) can ride a permitted write — block it at the source so it
514
+ // never persists. Owner/model-authored writes are NOT content-blocked here
515
+ // (the owner is trusted; the recall-time scan is the net for owner-pasted
516
+ // attacker text). Evaluated pre-mutation → a blocked write is a clean no-op.
517
+ const threats = scanForThreats(record.content, "strict");
518
+ if (threats.length > 0) {
519
+ this.emit({
520
+ at: now,
521
+ kind: "blocked",
522
+ memoryId: record.memoryId,
523
+ segment: record.segment,
524
+ ...(record.sourceType !== undefined ? { sourceType: record.sourceType } : {}),
525
+ reason: `content matched threat pattern(s): ${threats.join(", ")}`,
526
+ });
527
+ throw new MemoryThreatError(threats);
528
+ }
529
+ }
530
+ // SUPERSEDE the prior belief(s) this write replaces — WITHOUT relying on the
531
+ // model recalling ids. Trigger: an explicit attribute SLOT (subjectKey) →
532
+ // supersede same-slot, same-origin values (precise; segment-independent — a
533
+ // `correction` supersedes a `preference`). Soft-archive (bi-temporal close +
534
+ // `contradicts`/`transition` link), history kept. A near-identical prior
535
+ // (restated, not changed) is reinforced, not churned. An UNTRUSTED source can't
536
+ // archive a TRUSTED prior (the write-gate override guard).
537
+ //
538
+ // We deliberately do NOT auto-supersede by CONTENT overlap: a slot-less
539
+ // `correction` shares a sentence frame with unrelated facts, and (MEASURED) no
540
+ // overlap threshold separates a same-subject value change ("deploys Fridays"→
541
+ // "Mondays", ≈0.5) from a DIFFERENT-subject one ("dark theme editor"→"light
542
+ // theme terminal", ≈0.5) — they fully overlap, so the old content gate silently
543
+ // archived still-true facts (data loss). A slot-less correction now COEXISTS
544
+ // with the prior (freshest wins at recall; dream consolidates near-duplicates);
545
+ // to auto-replace a single-valued attribute, the writer sets a `subjectKey`.
546
+ const slotSuperseded = [];
547
+ if (record.subjectKey && !record.supersedes) {
548
+ const incoming = tokenSet(record.content);
549
+ const priors = all.filter((r) => r.lifecycle === "active" &&
550
+ r.memoryId !== record.memoryId &&
551
+ sameOrigin(r.createdBy, record.createdBy) &&
552
+ r.subjectKey === record.subjectKey);
553
+ // Same write-gate guard as the archive loop + dedup below: an
554
+ // UNTRUSTED source must not reinforce (bump importance / refresh
555
+ // access on) a TRUSTED, owner-authored prior through this restate
556
+ // back door — that's an unsuperseded mutation the write-gate never
557
+ // sees. When incoming is untrusted and the match is trusted, it
558
+ // falls through to a separate record, leaving the owner fact as-is.
559
+ const restated = priors.find((r) => jaccard(incoming, tokenSet(r.content)) >= DEDUP_SIMILARITY &&
560
+ !(isUntrustedSource(record.sourceType) && isTrustedTarget(r.sourceType)));
561
+ if (restated) {
562
+ // Inherit the RICHER metadata of the incoming restatement so a reinforce
563
+ // never DROPS hard-won metadata (a more-specific segment, a higher
564
+ // confidence, links). subjectKey already matches by construction; the
565
+ // accessCount bump below is the reinforcement signal.
566
+ inheritRicherMetadata(restated, record);
567
+ restated.lastAccessedAt = now;
568
+ restated.accessCount += 1;
569
+ if (!restated.sourceTurn && record.sourceTurn)
570
+ restated.sourceTurn = record.sourceTurn;
571
+ this.writeAll(all);
572
+ this.emit({ at: now, kind: "reinforced", memoryId: restated.memoryId, segment: restated.segment });
573
+ return restated;
574
+ }
575
+ for (const r of priors) {
576
+ if (isUntrustedSource(record.sourceType) && isTrustedTarget(r.sourceType))
577
+ continue;
578
+ r.lifecycle = "archived";
579
+ r.validTo = now;
580
+ slotSuperseded.push(r.memoryId);
581
+ }
582
+ if (slotSuperseded.length > 0) {
583
+ // `contradicts` flags the conflict for consolidation; `transition`
584
+ // records the temporal evolution (Step 19) so the graph walk + the
585
+ // dream can trace what this belief BECAME and count repeated changes.
586
+ record.links = [
587
+ ...(record.links ?? []),
588
+ ...slotSuperseded.flatMap((target) => [
589
+ { kind: "contradicts", target },
590
+ { kind: "transition", target },
591
+ ]),
592
+ ];
593
+ }
594
+ }
595
+ // Write-time dedup (no LLM). A near-identical ACTIVE fact already exists
596
+ // (e.g. the model called write_memory AND the post-turn extraction sweep
597
+ // distilled the same fact) → don't add a parallel copy. Instead reinforce
598
+ // the existing one: keep the higher importance, refresh access, inherit a
599
+ // sourceTurn if it lacked one. Skipped for explicit corrections/updates
600
+ // (they carry `supersedes` and intentionally replace prior beliefs). This
601
+ // is the cheap layer; semantic contradictions are handled by consolidation.
602
+ //
603
+ // Origin guard: dedup ONLY merges with records of the same origin. A
604
+ // peer's "I prefer dark mode" must not merge into an owner's identical
605
+ // note (which would lift the peer's fact to owner-visible) or into
606
+ // another peer's identical note (which would cross-pollinate
607
+ // session-scoped state). Different-origin facts stay separate even if
608
+ // the text matches.
609
+ if (!record.supersedes && !record.subjectKey) {
610
+ const incoming = tokenSet(record.content);
611
+ const dup = all.find((r) => r.lifecycle === "active" &&
612
+ sameOrigin(r.createdBy, record.createdBy) &&
613
+ jaccard(incoming, tokenSet(r.content)) >= DEDUP_SIMILARITY &&
614
+ // Write-gate blind-spot guard: dedup-merge reinforces the matched
615
+ // fact (bumps importance + refreshes access). An UNTRUSTED source
616
+ // (tool_output / retrieved_document / compaction) must not be able to
617
+ // reinforce a TRUSTED, owner-authored fact through this back door —
618
+ // that is an unsuperseded mutation the write-gate never sees. When the
619
+ // incoming write is untrusted and the match is owner-authored/trusted,
620
+ // skip the merge: the untrusted write falls through to a separate
621
+ // record (subject to the gate's segment rule), leaving the owner fact
622
+ // exactly as the operator left it.
623
+ !(isUntrustedSource(record.sourceType) && isTrustedTarget(r.sourceType)));
624
+ if (dup) {
625
+ // Inherit the RICHER metadata of the incoming copy into the surviving
626
+ // `dup` so a reinforce never DROPS metadata. The incoming carries no
627
+ // subjectKey here (a subject-bearing write takes the slot path above),
628
+ // but it MAY be a more-specific segment / higher confidence — keep the
629
+ // richer of each. `dup` keeps its stable id + accessCount history; the
630
+ // bump below is the reinforcement signal.
631
+ inheritRicherMetadata(dup, record);
632
+ dup.lastAccessedAt = now;
633
+ dup.accessCount += 1;
634
+ if (!dup.sourceTurn && record.sourceTurn)
635
+ dup.sourceTurn = record.sourceTurn;
636
+ this.writeAll(all);
637
+ this.emit({ at: now, kind: "reinforced", memoryId: dup.memoryId, segment: dup.segment });
638
+ return dup;
639
+ }
640
+ }
641
+ // Embed-on-write (HYBRID recall vector lane, BOTH modes) — store a vector
642
+ // for the vector lane. fs mode cosine-scans it in-app; convex mode ALSO
643
+ // ANN-serves it via the built-in `by_embedding` vectorIndex at scale.
644
+ // Embedding both modes keeps recall IDENTICAL across them (cross-mode
645
+ // parity). Runs AFTER the write-gate AND after the dedup early-return so a
646
+ // blocked (poisoned) OR deduped-away write pays no embedding cost; GUARDED
647
+ // so a custom/learned embedder that throws degrades to no-vector (graceful
648
+ // BM25-only recall for this fact) rather than failing the write. The bundled
649
+ // embedder is synchronous + can't throw; an async model uses the async write
650
+ // path (future).
651
+ try {
652
+ const emb = getDefaultEmbedder();
653
+ const v = emb.embed([record.content]);
654
+ // Exact-width gate (not just truthy): a misconfigured learned embedder
655
+ // emitting a wrong-width vector would otherwise reach the convex by_embedding
656
+ // (fixed-dim) insert and THROW, losing the write. Drop the bad vector → the
657
+ // fact persists and recalls via BM25.
658
+ if (!(v instanceof Promise) && Array.isArray(v[0]) && v[0].length === emb.dims) {
659
+ record.embedding = v[0];
660
+ }
661
+ }
662
+ catch {
663
+ /* embedder failure → no vector; this fact recalls via BM25 only */
664
+ }
665
+ // Archive superseded records (corrections/updates overwrite prior beliefs).
666
+ // ORIGIN GUARD: a principal may only supersede ITS OWN facts. Without this, a
667
+ // channel peer's write_memory({supersedes:[ownerFactId]}) would archive the
668
+ // OWNER's fact (cross-origin data loss + recall blackout) — the write-gate's
669
+ // supersede rule doesn't catch it because a peer tool write carries no sourceType.
670
+ // Mirrors the sameOrigin guard the subjectKey + dedup paths already enforce;
671
+ // a cross-origin supersede id is silently ignored.
672
+ if (record.supersedes) {
673
+ const dead = new Set(record.supersedes);
674
+ for (const r of all) {
675
+ if (dead.has(r.memoryId) && r.lifecycle === "active" && sameOrigin(r.createdBy, record.createdBy)) {
676
+ r.lifecycle = "archived";
677
+ // Bi-temporal close — match the auto-supersede path: a superseded belief
678
+ // stopped being valid NOW, so the history records WHEN.
679
+ r.validTo = now;
680
+ }
681
+ }
682
+ }
683
+ all.push(record);
684
+ this.writeAll(all);
685
+ this.emit({
686
+ at: now,
687
+ kind: "created",
688
+ memoryId: record.memoryId,
689
+ segment: record.segment,
690
+ ...(record.sourceType !== undefined ? { sourceType: record.sourceType } : {}),
691
+ ...((record.supersedes?.length ?? 0) + slotSuperseded.length > 0
692
+ ? { targets: [...(record.supersedes ?? []), ...slotSuperseded] }
693
+ : {}),
694
+ });
695
+ return record;
696
+ }
697
+ /**
698
+ * Extraction-idempotency probe (Fix 1). Given a candidate fact's content +
699
+ * origin, return an ALREADY-STORED active same-origin record that the
700
+ * candidate is merely a RESTATEMENT of — or `undefined` if it's genuinely new.
701
+ * The post-turn distiller calls this BEFORE writing so it never re-creates a
702
+ * fact the operator already taught (which would pile a subject-less `knowledge`
703
+ * churn copy beside a rich `identity`/`preference` original and then let
704
+ * consolidation archive the wrong one).
705
+ *
706
+ * Two match lanes (a candidate that hits EITHER is "already known"):
707
+ * 1. SUBJECT-ANCHORED restatement — the existing record is SUBJECT-BEARING
708
+ * (the single-valued kind extraction must not churn a twin beside) and the
709
+ * candidate is a paraphrase of it: embedding cosine ≥ {@link IDEMPOTENT_COSINE_BAR}
710
+ * OR content Jaccard ≥ {@link IDEMPOTENT_JACCARD_BAR}. The loose bar is safe
711
+ * here BECAUSE it's gated on an existing subjectKey — an ADDITIVE fact (no
712
+ * subjectKey: pets, skills) can't trip it.
713
+ * 2. NEAR-EXACT restatement of ANY existing fact — content Jaccard ≥
714
+ * {@link DEDUP_SIMILARITY} (the write-time dedup bar), so even an additive
715
+ * fact's verbatim re-extraction is recognised.
716
+ *
717
+ * Origin-isolated (only same-origin candidates) and embedder-guarded (a thrown/
718
+ * async embedder degrades to the Jaccard lanes). The richest of several matches
719
+ * is returned so a reinforcement lands on the best record.
720
+ */
721
+ findEquivalentActive(content, origin) {
722
+ const text = content.trim();
723
+ if (!text)
724
+ return undefined;
725
+ const candidates = this.readAll().filter((r) => r.lifecycle === "active" && sameOrigin(r.createdBy, origin));
726
+ if (candidates.length === 0)
727
+ return undefined;
728
+ const incomingTokens = tokenSet(text);
729
+ // Embed the candidate once for the cosine lane (best-effort; the bundled
730
+ // embedder is sync + can't throw, a learned/async one degrades to Jaccard).
731
+ let incomingVec;
732
+ try {
733
+ const emb = getDefaultEmbedder();
734
+ const v = emb.embed([text]);
735
+ if (!(v instanceof Promise) && Array.isArray(v[0]) && v[0].length === emb.dims)
736
+ incomingVec = v[0];
737
+ }
738
+ catch {
739
+ /* no vector → Jaccard-only matching */
740
+ }
741
+ const matches = [];
742
+ for (const r of candidates) {
743
+ const jac = jaccard(incomingTokens, tokenSet(r.content));
744
+ if (jac >= DEDUP_SIMILARITY) {
745
+ matches.push(r);
746
+ continue;
747
+ }
748
+ if (r.subjectKey) {
749
+ const cos = incomingVec && r.embedding && r.embedding.length === incomingVec.length
750
+ ? cosine(incomingVec, r.embedding)
751
+ : 0;
752
+ if (cos >= IDEMPOTENT_COSINE_BAR || jac >= IDEMPOTENT_JACCARD_BAR)
753
+ matches.push(r);
754
+ }
755
+ }
756
+ if (matches.length === 0)
757
+ return undefined;
758
+ // The richest match takes the reinforcement (so an `identity`+subjectKey
759
+ // original wins over a sparser twin if both somehow matched).
760
+ return matches.reduce((best, r) => (compareRichness(r, best) > 0 ? r : best));
761
+ }
762
+ /**
763
+ * Reinforce an existing record by id WITHOUT writing a new one (the
764
+ * idempotency no-op's "optionally reinforce" path). Bumps access (recall-
765
+ * reinforcement) and lifts confidence toward `minConfidence` if given — so a
766
+ * re-seen fact gets MORE durable rather than spawning a churn duplicate. No-op
767
+ * (undefined) if the id isn't an active record. Emits a `reinforced` event.
768
+ */
769
+ reinforce(memoryId, opts = {}) {
770
+ const all = this.readAll();
771
+ const rec = all.find((r) => r.memoryId === memoryId);
772
+ if (!rec || rec.lifecycle !== "active")
773
+ return undefined;
774
+ const now = this.clock();
775
+ rec.accessCount += 1;
776
+ rec.lastAccessedAt = now;
777
+ if (typeof opts.minConfidence === "number") {
778
+ rec.confidence = Math.max(rec.confidence ?? 0, Math.min(1, Math.max(0, opts.minConfidence)));
779
+ }
780
+ this.writeAll(all);
781
+ this.emit({ at: now, kind: "reinforced", memoryId, segment: rec.segment });
782
+ return rec;
783
+ }
784
+ /**
785
+ * Lexical recall over active facts — Okapi BM25 × `effectiveScore`
786
+ * (decay + importance), origin-filtered (the shared scorer, scoring.ts).
787
+ * The SAME scorer runs in fs (these `readAll` records) and convex mode
788
+ * (the hydrated cache) ⇒ cross-mode parity by construction. Marks every
789
+ * returned record accessed (recall reinforcement) unless `markAccessed:
790
+ * false`. Returns at most `limit` hits (default 8), each with its score.
791
+ */
792
+ search(query, opts = {}) {
793
+ const limit = opts.limit && opts.limit > 0 ? opts.limit : 8;
794
+ // Active + origin-matching candidates. Isolation is enforced HERE (never
795
+ // inside the scorer): the origin filter is mandatory on every tool-facing
796
+ // recall. `undefined` origin = the maintenance default (whole store) —
797
+ // tool callers always pass an explicit filter.
798
+ const now = this.clock();
799
+ // Active + origin + still-valid (bi-temporal valid-time): a fact whose
800
+ // `validTo` has passed is excluded from recall independent of lifecycle, so
801
+ // a future-dated expiry written ahead of time stops surfacing on its own.
802
+ const candidates = this.readAll().filter((r) => r.lifecycle === "active" &&
803
+ (r.validTo === undefined || r.validTo > now) &&
804
+ (opts.origin === undefined || recordMatchesOriginFilter(r, opts.origin)));
805
+ // BM25 × effectiveScore (the shared v1 scorer). Identical code in fs +
806
+ // convex (over readAll / the hydrated cache) ⇒ cross-mode parity by
807
+ // construction. Replaces the old substring term-overlap.
808
+ const top = bm25Score(candidates, query, now)
809
+ .slice(0, limit)
810
+ .map((s) => ({ ...s.record, score: s.score }));
811
+ if (opts.markAccessed !== false && top.length > 0) {
812
+ this.markAccessed(top.map((r) => r.memoryId));
813
+ }
814
+ return top;
815
+ }
816
+ /**
817
+ * Hybrid recall (Tideline v2) — BM25 ⊕ vector (cosine over each record's
818
+ * `embedding`), fused via `recallHybrid`. Embeddings are populated on write in
819
+ * BOTH modes (see embed-on-write in `write`), so the vector lane contributes
820
+ * IDENTICALLY in fs and convex mode — that's the cross-mode-parity guarantee.
821
+ * Convex additionally ANN-serves the SAME vectors via the built-in
822
+ * `by_embedding` vectorIndex at scale; this in-app cosine is the identical
823
+ * ranking over the hydrated cache. A record misses the vector lane only if its
824
+ * embedder threw on write (graceful BM25-only for that fact) or it predates
825
+ * embed-on-write (legacy). Same active+origin candidate filter + reinforcement
826
+ * semantics as `search`.
827
+ */
828
+ searchHybrid(query, opts = {}) {
829
+ const limit = opts.limit && opts.limit > 0 ? opts.limit : 8;
830
+ const now = this.clock();
831
+ const candidates = this.readAll().filter((r) => r.lifecycle === "active" &&
832
+ (r.validTo === undefined || r.validTo > now) && // bi-temporal valid-time gate (see search)
833
+ (opts.origin === undefined || recordMatchesOriginFilter(r, opts.origin)));
834
+ const top = recallHybrid(candidates, query, getDefaultEmbedder(), now, { limit }).map((f) => ({
835
+ ...f.record,
836
+ score: f.score,
837
+ }));
838
+ if (opts.markAccessed !== false && top.length > 0) {
839
+ this.markAccessed(top.map((r) => r.memoryId));
840
+ }
841
+ return top;
842
+ }
843
+ /**
844
+ * The recall entry point live callers (auto-recall, recall_memory) use →
845
+ * the HYBRID lane (BM25 ⊕ vector, {@link searchHybrid}) in BOTH modes, so
846
+ * recall is identical fs ↔ convex (parity by construction, same as v1). The
847
+ * lower-level `search` stays a pure-lexical primitive for callers that want
848
+ * just BM25 (the eval floor, transparency).
849
+ */
850
+ recall(query, opts = {}) {
851
+ return this.searchHybrid(query, opts);
852
+ }
853
+ /**
854
+ * ASYNC hybrid recall — identical to {@link searchHybrid} but pre-embeds the
855
+ * query via {@link recallHybridAsync}, so it works with a LEARNED (async)
856
+ * embedder (OpenAI / local node-llama-cpp) as well as the sync HRR default
857
+ * (awaiting a sync embed is a no-op). This is the path that delivers true-
858
+ * synonymy recall when a learned embedder is selected; the sync `searchHybrid`/
859
+ * `recall` stay for callers that aren't async (and degrade to BM25-primary
860
+ * under a learned embedder — never crash). Same candidate filter + reinforcement.
861
+ */
862
+ async searchHybridAsync(query, opts = {}) {
863
+ const limit = opts.limit && opts.limit > 0 ? opts.limit : 8;
864
+ const now = this.clock();
865
+ const candidates = this.readAll().filter((r) => r.lifecycle === "active" &&
866
+ (r.validTo === undefined || r.validTo > now) &&
867
+ (opts.origin === undefined || recordMatchesOriginFilter(r, opts.origin)));
868
+ const top = (await recallHybridAsync(candidates, query, getDefaultEmbedder(), now, { limit })).map((f) => ({
869
+ ...f.record,
870
+ score: f.score,
871
+ }));
872
+ if (opts.markAccessed !== false && top.length > 0) {
873
+ this.markAccessed(top.map((r) => r.memoryId));
874
+ }
875
+ return top;
876
+ }
877
+ /** Async recall entry point (the learned-embedder-aware {@link searchHybridAsync}). */
878
+ async recallAsync(query, opts = {}) {
879
+ return this.searchHybridAsync(query, opts);
880
+ }
881
+ /**
882
+ * Recall transparency (Tideline Step 11) — like `search` but returns each
883
+ * hit's {@link ScoreBreakdown} and does NOT reinforce decay (diagnostic +
884
+ * passive). Same candidate filtering (active + origin) and the same scorer,
885
+ * so the ranking matches `search` exactly — this just exposes the arithmetic
886
+ * (bm25 × modulator) behind each rank, for "why did this surface?" tooling.
887
+ */
888
+ explainRecall(query, opts = {}) {
889
+ const limit = opts.limit && opts.limit > 0 ? opts.limit : 8;
890
+ const now = this.clock();
891
+ const candidates = this.readAll().filter((r) => r.lifecycle === "active" &&
892
+ (r.validTo === undefined || r.validTo > now) && // bi-temporal valid-time gate (see search)
893
+ (opts.origin === undefined || recordMatchesOriginFilter(r, opts.origin)));
894
+ return bm25Score(candidates, query, now, { breakdown: true })
895
+ .slice(0, limit)
896
+ .map((s) => ({ ...s.record, score: s.score, breakdown: s.breakdown }));
897
+ }
898
+ /** Bump accessCount + lastAccessedAt for the given ids (recall reinforcement). */
899
+ markAccessed(ids) {
900
+ if (ids.length === 0)
901
+ return;
902
+ const set = new Set(ids);
903
+ const all = this.readAll();
904
+ let changed = false;
905
+ const now = this.clock();
906
+ for (const r of all) {
907
+ if (set.has(r.memoryId)) {
908
+ r.accessCount += 1;
909
+ r.lastAccessedAt = now;
910
+ changed = true;
911
+ }
912
+ }
913
+ if (changed)
914
+ this.writeAll(all);
915
+ }
916
+ /**
917
+ * Write embeddings onto existing records by id (the re-embed pass's apply-step).
918
+ * Used to fill vectors that embed-on-write SKIPPED because the selected embedder
919
+ * is async (a learned model) — see {@link reembedPending}. Read-mutate-write,
920
+ * so it flows through the convex write-through cache like any other mutation.
921
+ */
922
+ applyEmbeddings(updates) {
923
+ if (updates.length === 0)
924
+ return;
925
+ const byId = new Map(updates.map((u) => [u.memoryId, u.embedding]));
926
+ const all = this.readAll();
927
+ // Exact-width gate: only accept vectors matching the active embedder's dims,
928
+ // so a wrong-width vector can't reach the fixed-dim convex by_embedding insert
929
+ // (which would throw + lose the fact). reembed.ts gates too; belt-and-suspenders.
930
+ const expectedDims = getDefaultEmbedder().dims;
931
+ let changed = false;
932
+ for (const r of all) {
933
+ const e = byId.get(r.memoryId);
934
+ if (e && e.length === expectedDims) {
935
+ r.embedding = e;
936
+ changed = true;
937
+ }
938
+ }
939
+ if (changed)
940
+ this.writeAll(all);
941
+ }
942
+ /**
943
+ * Feedback-driven self-learning (the continual-learning loop's signal). `up`
944
+ * nudges importance (+ confidence if set) UP and reinforces decay; `down`
945
+ * nudges them DOWN — ASYMMETRIC (+0.05 / −0.10), so a
946
+ * few bad recalls outweigh many lukewarm ones. Persisted + logged to the event
947
+ * track (telemetry). Recall's trust/importance modulation then adapts, closing
948
+ * the loop: recall → feedback → better recall. Returns the updated record.
949
+ */
950
+ applyFeedback(memoryId, signal) {
951
+ const all = this.readAll();
952
+ const rec = all.find((r) => r.memoryId === memoryId);
953
+ // Only LIVE facts take feedback (consistent with invalidate) — feeding back
954
+ // an archived/pruned id would silently mutate a dead record to no effect.
955
+ if (!rec || rec.lifecycle !== "active")
956
+ return undefined;
957
+ const delta = signal === "up" ? 0.05 : -0.1;
958
+ const clamp = (x) => Math.max(0, Math.min(1, x));
959
+ rec.importance = clamp(rec.importance + delta);
960
+ if (typeof rec.confidence === "number")
961
+ rec.confidence = clamp(rec.confidence + delta);
962
+ const now = this.clock();
963
+ // `up` is a recall-and-keep → reinforce decay (bump access). `down` must NOT
964
+ // touch the access clock: refreshing lastAccessedAt would reset the decay
965
+ // timer and partly counteract the importance drop it just applied.
966
+ if (signal === "up") {
967
+ rec.lastAccessedAt = now;
968
+ rec.accessCount += 1;
969
+ }
970
+ this.writeAll(all);
971
+ this.emit({ at: now, kind: "feedback", memoryId, segment: rec.segment, signal });
972
+ return rec;
973
+ }
974
+ /**
975
+ * Metadata-preservation on reconcile (Fix 2). Fold the RICHER metadata of the
976
+ * `loserId` record into the `survivorId` record, in place — so a supersede /
977
+ * consolidation merge that ARCHIVES the loser doesn't DROP its hard-won metadata
978
+ * (a `subjectKey`, a more-specific segment, a higher importance/confidence). The
979
+ * caller invokes this on the KEEPER right before archiving the duplicate, so the
980
+ * survivor inherits from BOTH. No-op (false) if either id is missing or the
981
+ * survivor isn't active. Persists + returns whether anything changed.
982
+ *
983
+ * This is the store-level counterpart to {@link inheritRicherMetadata} (which
984
+ * the in-`write` reinforce paths call on their in-memory `all` array); the
985
+ * consolidation passes (dream / LLM consolidation) call THIS because their
986
+ * survivor lives in the store, not in a write-local array.
987
+ */
988
+ mergeMetadataInto(survivorId, loserId) {
989
+ if (survivorId === loserId)
990
+ return false;
991
+ const all = this.readAll();
992
+ const survivor = all.find((r) => r.memoryId === survivorId);
993
+ const loser = all.find((r) => r.memoryId === loserId);
994
+ if (!survivor || survivor.lifecycle !== "active" || !loser)
995
+ return false;
996
+ const before = JSON.stringify([
997
+ survivor.subjectKey,
998
+ survivor.segment,
999
+ survivor.importance,
1000
+ survivor.confidence,
1001
+ survivor.accessCount,
1002
+ survivor.sourceTurn,
1003
+ survivor.validFrom,
1004
+ survivor.tier,
1005
+ survivor.decayRate,
1006
+ (survivor.links ?? []).map((l) => `${l.kind}|${l.target}`).sort(),
1007
+ ]);
1008
+ inheritRicherMetadata(survivor, loser);
1009
+ const after = JSON.stringify([
1010
+ survivor.subjectKey,
1011
+ survivor.segment,
1012
+ survivor.importance,
1013
+ survivor.confidence,
1014
+ survivor.accessCount,
1015
+ survivor.sourceTurn,
1016
+ survivor.validFrom,
1017
+ survivor.tier,
1018
+ survivor.decayRate,
1019
+ (survivor.links ?? []).map((l) => `${l.kind}|${l.target}`).sort(),
1020
+ ]);
1021
+ if (before === after)
1022
+ return false;
1023
+ this.writeAll(all);
1024
+ return true;
1025
+ }
1026
+ /**
1027
+ * Bi-temporally INVALIDATE a fact (Tideline v2, step 15) — close its valid
1028
+ * interval (`validTo = now`) + archive it, so recall drops it while HISTORY
1029
+ * keeps it (transaction time `createdAt` untouched). If `supersededBy` is
1030
+ * given, records a `contradicts` link on the superseder → the stale fact.
1031
+ * Persisted + logged. Returns the invalidated record, or `undefined` if it's
1032
+ * missing / already inactive.
1033
+ */
1034
+ invalidate(staleId, opts = {}) {
1035
+ const all = this.readAll();
1036
+ const stale = all.find((r) => r.memoryId === staleId);
1037
+ if (!stale || stale.lifecycle !== "active")
1038
+ return undefined;
1039
+ const now = opts.now ?? this.clock();
1040
+ stale.validTo = now;
1041
+ stale.lifecycle = "archived";
1042
+ if (opts.supersededBy) {
1043
+ const by = all.find((r) => r.memoryId === opts.supersededBy);
1044
+ if (by) {
1045
+ // Idempotent: drop any prior contradicts/transition edge to this
1046
+ // stale id, then re-add both — `contradicts` (conflict flag) +
1047
+ // `transition` (Step 19 temporal evolution edge for the graph/dream).
1048
+ const kept = (by.links ?? []).filter((l) => !((l.kind === "contradicts" || l.kind === "transition") && l.target === staleId));
1049
+ const links = [
1050
+ ...kept,
1051
+ { kind: "contradicts", target: staleId },
1052
+ { kind: "transition", target: staleId },
1053
+ ];
1054
+ by.links = links;
1055
+ }
1056
+ }
1057
+ this.writeAll(all);
1058
+ this.emit({
1059
+ at: now,
1060
+ kind: "invalidated",
1061
+ memoryId: staleId,
1062
+ segment: stale.segment,
1063
+ ...(opts.supersededBy ? { targets: [opts.supersededBy] } : {}),
1064
+ });
1065
+ return stale;
1066
+ }
1067
+ /**
1068
+ * Step 19 — persist TYPED association edges between fact pairs (where the
1069
+ * relationship extractor's typed taxonomy AND the dream's synonymy/relatedness
1070
+ * edges land). Bidirectional, deduped per (kind,target), and capped per record per
1071
+ * kind (a hub-fact fan-out guard); only ACTIVE facts are linked. Each edge carries
1072
+ * the edge `kind` (default `relates` for legacy synonymy callers), an optional
1073
+ * `reason` (the model's justification, for explainable rendering) and `strength`.
1074
+ * Idempotent — re-running adds nothing already present (a later write may BACKFILL a
1075
+ * reason onto a prior reason-less edge of the same kind, which is not counted as a
1076
+ * new edge). Goes through readAll/writeAll like every mutation, so it is fs↔convex
1077
+ * parity by construction. Returns the number of NEW link entries written.
1078
+ *
1079
+ * Callers MUST pass only SAME-ORIGIN pairs (the dream computes synonymy per origin
1080
+ * bucket; the extractor pre-filters to one origin) — a cross-principal edge would
1081
+ * leak one peer's facts into another principal's graph-recall walk.
1082
+ *
1083
+ * The edge is written DIRECTED on the kind the caller supplies, and the REVERSE
1084
+ * endpoint records the INVERSE kind (causes↔caused_by, precedes↔follows,
1085
+ * enables/blocks→caused_by/blocks, part_of→part_of, …) so the graph reads
1086
+ * correctly from either note; symmetric kinds (co_constrains/contrasts_with/
1087
+ * same_topic/relates/relates_to/uses/works_on/located_at) mirror unchanged.
1088
+ */
1089
+ linkRelated(pairs, opts = {}) {
1090
+ if (pairs.length === 0)
1091
+ return 0;
1092
+ const maxPerRecord = opts.maxPerRecord && opts.maxPerRecord > 0 ? opts.maxPerRecord : 12;
1093
+ const all = this.readAll();
1094
+ const byId = new Map(all.map((r) => [r.memoryId, r]));
1095
+ let added = 0;
1096
+ const addOne = (fromId, toId, kind, reason, strength) => {
1097
+ if (fromId === toId)
1098
+ return;
1099
+ const rec = byId.get(fromId);
1100
+ if (!rec || rec.lifecycle !== "active")
1101
+ return;
1102
+ const links = rec.links ?? [];
1103
+ const existing = links.find((l) => l.kind === kind && l.target === toId);
1104
+ if (existing) {
1105
+ // Idempotent: edge already present. BACKFILL a reason/strength onto a
1106
+ // prior reason-less edge (a relink pass enriches an earlier bare edge)
1107
+ // without counting it as a new edge — keeps re-runs at 0 new.
1108
+ if (reason && !existing.reason)
1109
+ existing.reason = reason;
1110
+ if (strength !== undefined && existing.strength === undefined)
1111
+ existing.strength = strength;
1112
+ return;
1113
+ }
1114
+ if (links.filter((l) => l.kind === kind).length >= maxPerRecord)
1115
+ return; // per-kind fan-out cap
1116
+ rec.links = [
1117
+ ...links,
1118
+ { kind, target: toId, ...(reason ? { reason } : {}), ...(strength !== undefined ? { strength } : {}) },
1119
+ ];
1120
+ added++;
1121
+ };
1122
+ for (const { a, b, kind, reason, strength } of pairs) {
1123
+ // Both endpoints must be ACTIVE — skip a pair where either was archived
1124
+ // (e.g. consolidated away this same dream pass): a relation to a dead fact
1125
+ // is noise, and a supersede already carries that pair's relationship.
1126
+ if (byId.get(a)?.lifecycle !== "active" || byId.get(b)?.lifecycle !== "active")
1127
+ continue;
1128
+ const fwd = kind ?? "relates";
1129
+ addOne(a, b, fwd, reason, strength);
1130
+ addOne(b, a, inverseLinkKind(fwd), reason, strength);
1131
+ }
1132
+ if (added > 0)
1133
+ this.writeAll(all);
1134
+ return added;
1135
+ }
1136
+ /**
1137
+ * Lane B (Step 25) — REVERSE a retraction: re-activate an `archived` fact and
1138
+ * clear its valid-time bound so it surfaces again. The reversible counterpart
1139
+ * to {@link invalidate} — the operator's "restore" after an over-eager
1140
+ * retraction. Persisted + logged (a `reinforced` event: the fact is reasserted
1141
+ * as valid). Returns the record, or `undefined` if it's missing / not archived.
1142
+ */
1143
+ reactivate(id, opts = {}) {
1144
+ const all = this.readAll();
1145
+ const rec = all.find((r) => r.memoryId === id);
1146
+ if (!rec || rec.lifecycle !== "archived")
1147
+ return undefined;
1148
+ // Only restore a RETRACTED or decayed fact — NOT one SUPERSEDED or CONSOLIDATED
1149
+ // away. A superseded/consolidated record is the TARGET of a contradicts/transition
1150
+ // edge from an ACTIVE successor; resurrecting it would put two contradictory
1151
+ // beliefs live at once (breaking the single-value invariant — exactly what the
1152
+ // supersede mechanism exists to prevent). A pure retract / decay leaves no such
1153
+ // incoming edge, so it stays restorable.
1154
+ const supersededByActive = all.some((r) => r.lifecycle === "active" &&
1155
+ (r.links ?? []).some((l) => (l.kind === "contradicts" || l.kind === "transition") && l.target === id));
1156
+ if (supersededByActive)
1157
+ return undefined;
1158
+ // Belt-and-suspenders for the single-valued-slot invariant: if a same-origin fact
1159
+ // now occupies this subjectKey, restoring would create two live values — refuse.
1160
+ if (rec.subjectKey &&
1161
+ all.some((r) => r.lifecycle === "active" && r.subjectKey === rec.subjectKey && sameOrigin(r.createdBy, rec.createdBy)))
1162
+ return undefined;
1163
+ rec.lifecycle = "active";
1164
+ rec.validTo = undefined;
1165
+ this.writeAll(all);
1166
+ this.emit({ at: opts.now ?? this.clock(), kind: "reinforced", memoryId: id, segment: rec.segment });
1167
+ return rec;
1168
+ }
1169
+ /**
1170
+ * Records whose VAULT note must be preserved: every ACTIVE fact PLUS any ARCHIVED
1171
+ * fact that is still RESTORABLE — i.e. retracted/decayed, NOT superseded/consolidated
1172
+ * by an active successor (same edge test as {@link reactivate}). The vault prune
1173
+ * deletes notes outside this set, so a reversibly-retracted fact — and the operator's
1174
+ * hand-pinned edits on it — survives a re-render; only a hard-purged fact's note
1175
+ * (gone from the store entirely) is removed.
1176
+ */
1177
+ listForVault(origin) {
1178
+ const all = this.readAll().filter((r) => origin === undefined || recordMatchesOriginFilter(r, origin));
1179
+ const supersededByActive = new Set(all
1180
+ .filter((r) => r.lifecycle === "active")
1181
+ .flatMap((r) => (r.links ?? []).filter((l) => l.kind === "contradicts" || l.kind === "transition").map((l) => l.target)));
1182
+ return all.filter((r) => r.lifecycle === "active" || (r.lifecycle === "archived" && !supersededByActive.has(r.memoryId)));
1183
+ }
1184
+ /**
1185
+ * Dream/curator lane (Step 22) — REVERSIBLE: patch cognition fields on an
1186
+ * ACTIVE record, used to PROMOTE a repeatedly-corrected belief to a confirmed
1187
+ * preference. Returns the PRIOR {confidence,status,importance} (also recorded
1188
+ * in the "confirmed" event) so a dream pass can be undone — Lane A is
1189
+ * reversible by design. No-op (undefined) if `memoryId` isn't an active record.
1190
+ */
1191
+ promote(memoryId, patch, opts = {}) {
1192
+ const clamp01 = (x) => Math.max(0, Math.min(1, x));
1193
+ const all = this.readAll();
1194
+ const rec = all.find((r) => r.memoryId === memoryId);
1195
+ if (!rec || rec.lifecycle !== "active")
1196
+ return undefined;
1197
+ const prior = {
1198
+ ...(rec.confidence !== undefined ? { confidence: rec.confidence } : {}),
1199
+ ...(rec.status !== undefined ? { status: rec.status } : {}),
1200
+ importance: rec.importance,
1201
+ };
1202
+ if (patch.status !== undefined)
1203
+ rec.status = patch.status;
1204
+ if (patch.confidence !== undefined)
1205
+ rec.confidence = clamp01(patch.confidence);
1206
+ if (patch.importance !== undefined)
1207
+ rec.importance = clamp01(patch.importance);
1208
+ this.writeAll(all);
1209
+ this.emit({ at: opts.now ?? this.clock(), kind: "confirmed", memoryId, segment: rec.segment, prior });
1210
+ return prior;
1211
+ }
1212
+ /**
1213
+ * Dream/curator lane (Step 22): archive low-value decayed facts, emitting an
1214
+ * "evicted" event per fact. Returns the ids actually archived (skips already
1215
+ * non-active ones). Distinct from decay GC's `setLifecycle` in that it logs.
1216
+ */
1217
+ evict(ids, opts = {}) {
1218
+ if (ids.length === 0)
1219
+ return [];
1220
+ const now = opts.now ?? this.clock();
1221
+ const set = new Set(ids);
1222
+ const all = this.readAll();
1223
+ const evicted = [];
1224
+ for (const r of all) {
1225
+ if (set.has(r.memoryId) && r.lifecycle === "active") {
1226
+ r.lifecycle = "archived";
1227
+ r.validTo = r.validTo ?? now;
1228
+ evicted.push(r.memoryId);
1229
+ }
1230
+ }
1231
+ if (evicted.length === 0)
1232
+ return [];
1233
+ this.writeAll(all);
1234
+ for (const id of evicted) {
1235
+ const seg = all.find((r) => r.memoryId === id)?.segment;
1236
+ this.emit({ at: now, kind: "evicted", memoryId: id, ...(seg ? { segment: seg } : {}) });
1237
+ }
1238
+ return evicted;
1239
+ }
1240
+ /**
1241
+ * Governance (Step 24) — HARD-delete records (crypto-shred: the sealed
1242
+ * content is REMOVED, not archived, so it's unrecoverable even with the key).
1243
+ * Returns the ids actually removed. Filesystem rewrites the JSONL without
1244
+ * them; convex mode realises the deletion through the write-through diff.
1245
+ * Distinct from evict/setLifecycle, which only flip lifecycle.
1246
+ */
1247
+ purge(ids) {
1248
+ if (ids.length === 0)
1249
+ return [];
1250
+ const set = new Set(ids);
1251
+ const all = this.readAll();
1252
+ const removed = all.filter((r) => set.has(r.memoryId)).map((r) => r.memoryId);
1253
+ if (removed.length === 0)
1254
+ return [];
1255
+ this.writeAll(all.filter((r) => !set.has(r.memoryId)));
1256
+ return removed;
1257
+ }
1258
+ /**
1259
+ * The DISTINCT origins present in the active store (owner + each channel
1260
+ * peer). The per-origin fan-out seam: the curator/dream run one pass per
1261
+ * origin so a cross-fact operation never mixes principals. Deduped by
1262
+ * {@link originBucketKey}; owner first, then channels in stable key order.
1263
+ */
1264
+ distinctOrigins() {
1265
+ const byKey = new Map();
1266
+ for (const r of this.readAll()) {
1267
+ if (r.lifecycle !== "active")
1268
+ continue;
1269
+ const key = originBucketKey(r);
1270
+ if (!byKey.has(key))
1271
+ byKey.set(key, resolveRecordOrigin(r.createdBy));
1272
+ }
1273
+ return [...byKey.entries()].sort((a, b) => (a[0] === "owner" ? -1 : b[0] === "owner" ? 1 : a[0].localeCompare(b[0]))).map(([, o]) => o);
1274
+ }
1275
+ /** Set the lifecycle of specific records (used by decay GC). */
1276
+ setLifecycle(ids, lifecycle) {
1277
+ if (ids.length === 0)
1278
+ return;
1279
+ const set = new Set(ids);
1280
+ const all = this.readAll();
1281
+ let changed = false;
1282
+ for (const r of all) {
1283
+ if (set.has(r.memoryId) && r.lifecycle !== lifecycle) {
1284
+ r.lifecycle = lifecycle;
1285
+ changed = true;
1286
+ }
1287
+ }
1288
+ if (changed)
1289
+ this.writeAll(all);
1290
+ }
1291
+ /** Atomic whole-file rewrite (tmp + rename) so a crash can't corrupt the store. */
1292
+ writeAll(records) {
1293
+ // Convex mode — prime the cache (next readAll sees this write) and
1294
+ // enqueue per-record mutations realising the diff. All FactStore
1295
+ // mutators (write/markAccessed/setLifecycle/dedup-reinforce) funnel
1296
+ // through here, so this one branch covers every memory write path.
1297
+ const rctx = tryGetRuntimeContext();
1298
+ if (rctx?.mode === "convex") {
1299
+ const wsId = workspaceIdFromDir(path.dirname(path.dirname(this.file)));
1300
+ writeThroughFactsCache(rctx.store, wsId, records);
1301
+ return;
1302
+ }
1303
+ fs.mkdirSync(path.dirname(this.file), { recursive: true });
1304
+ // DRIFT GUARD — the most recent read SKIPPED non-empty line(s) it couldn't
1305
+ // parse (a hand-edit, a torn/concurrent write, a partial convex→fs sync). The
1306
+ // atomic rewrite below keeps only the parsed records, so that content is about
1307
+ // to be SILENTLY LOST. Snapshot the current on-disk file to a sibling
1308
+ // `.bak-<pid>-<ts>` first so it stays recoverable, then proceed — refusing the
1309
+ // write would wedge the agent's own memory. Cheap single-operator insurance.
1310
+ if (this.lastReadHadUnparseable) {
1311
+ try {
1312
+ const bak = `${this.file}.bak-${process.pid}-${Math.round(this.clock())}`;
1313
+ fs.copyFileSync(this.file, bak);
1314
+ driftLog.warn("facts.jsonl had unparseable line(s); snapshotted before overwrite so nothing is silently dropped", { bak });
1315
+ }
1316
+ catch {
1317
+ /* best-effort snapshot — never block the write on a failed backup */
1318
+ }
1319
+ this.lastReadHadUnparseable = false; // consumed — the snapshot now holds it
1320
+ }
1321
+ const body = records.map((r) => JSON.stringify(r)).join("\n") + (records.length > 0 ? "\n" : "");
1322
+ const tmp = `${this.file}.tmp-${process.pid}-${Date.now()}`;
1323
+ fs.writeFileSync(tmp, body, "utf8");
1324
+ fs.renameSync(tmp, this.file);
1325
+ }
1326
+ }
1327
+ //# sourceMappingURL=records.js.map