@desplega.ai/agent-swarm 1.134.0 → 1.135.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 (793) hide show
  1. package/README.md +2 -2
  2. package/dist/{actions-7kast243.js → actions-cdtyz12q.js} +16 -16
  3. package/dist/{app-0g84t8wf.js → app-bsbct708.js} +7 -7
  4. package/dist/{artifact-dje5ke4h.js → artifact-wpy087er.js} +1 -1
  5. package/dist/{assistant-ac4htcky.js → assistant-139yzd1t.js} +19 -19
  6. package/dist/{azure-openai-responses-be59fbsz.js → azure-openai-responses-40z2astx.js} +5 -3
  7. package/dist/{boot-reembed-kw2541c4.js → boot-reembed-gdzp4g2k.js} +19 -19
  8. package/dist/{boot-reembed-b1rcqn85.js → boot-reembed-q7f385st.js} +17 -17
  9. package/dist/{boot-scrub-logs-ja29t92g.js → boot-scrub-logs-ammdkvre.js} +31 -33
  10. package/dist/{claude-adapter-5cg1fv8s.js → claude-adapter-h67y60dz.js} +11 -11
  11. package/dist/{claude-managed-adapter-9z9sdytx.js → claude-managed-adapter-m2v2e90a.js} +3 -3
  12. package/dist/{cli-e07exmsb.js → cli-0rgbgtft.js} +407 -234
  13. package/dist/{cli-tkrr24mz.js → cli-17e3ydca.js} +62 -59
  14. package/dist/{cli-f4wj0s3m.js → cli-3ad3q6j0.js} +35 -36
  15. package/dist/cli-41wfr4tp.js +303 -0
  16. package/dist/{cli-snw62ze5.js → cli-47d0y52n.js} +63 -47
  17. package/dist/{cli-h0djenzm.js → cli-5vmvkwey.js} +46 -46
  18. package/dist/{cli-grt6qv91.js → cli-6ewfzrgz.js} +414 -637
  19. package/dist/{cli-qtekrty1.js → cli-6t2fgxpv.js} +1 -1
  20. package/dist/{cli-brm3et47.js → cli-6t91v11y.js} +122 -116
  21. package/dist/{cli-gtafvdy0.js → cli-77vf7z36.js} +2 -2
  22. package/dist/{cli-480nehnh.js → cli-7vk1ztap.js} +23 -23
  23. package/dist/cli-87zrjxdb.js +658 -0
  24. package/dist/{cli-pt43pdp1.js → cli-8p37s71j.js} +2 -2
  25. package/dist/{cli-7bv8nckk.js → cli-96sytm77.js} +13 -6
  26. package/dist/{cli-rh6f3s9n.js → cli-9nrnc45k.js} +29 -29
  27. package/dist/cli-d2epf5ae.js +704 -0
  28. package/dist/{cli-aw8bb6sf.js → cli-dntm4d6r.js} +20 -20
  29. package/dist/{cli-492e7ap5.js → cli-dr5tcz68.js} +2 -2
  30. package/dist/cli-dwwz52tw.js +6996 -0
  31. package/dist/{cli-bnx54kxv.js → cli-fhsz3twr.js} +46 -176
  32. package/dist/{cli-g0j14czv.js → cli-gkfzvf7n.js} +23 -13
  33. package/dist/{cli-h37gbjbf.js → cli-h8htvhk5.js} +199 -111
  34. package/dist/{cli-yv9dttkh.js → cli-hp1n6zq3.js} +13 -1
  35. package/dist/{cli-07er7wrs.js → cli-hsxj0yar.js} +1 -1
  36. package/dist/{cli-jmvk6et8.js → cli-j6fpcrdk.js} +9 -7
  37. package/dist/{cli-zykjrwcx.js → cli-j8bhw4a7.js} +27 -32
  38. package/dist/{cli-fyd58xgb.js → cli-mez7x2z0.js} +19 -106
  39. package/dist/{cli-jxj92gkt.js → cli-mgnrknyg.js} +5 -5
  40. package/dist/{cli-4bap00k0.js → cli-mqwe8xz0.js} +1 -1
  41. package/dist/cli-n1q8q14d.js +177 -0
  42. package/dist/{cli-mrammd8c.js → cli-pbatxkne.js} +357 -282
  43. package/dist/cli-pmz8qr82.js +260 -0
  44. package/dist/{cli-mp9sg4cg.js → cli-pnqdak88.js} +1 -1
  45. package/dist/{cli-ghexzd2d.js → cli-pqv5gvyf.js} +2562 -1664
  46. package/dist/{cli-m07313tr.js → cli-q46hkq2p.js} +2602 -1752
  47. package/dist/{cli-1ybr6vw2.js → cli-s35981d0.js} +9 -1
  48. package/dist/{cli-k46t4664.js → cli-s9yg23fg.js} +2 -2
  49. package/dist/{cli-43x36mty.js → cli-t46mkxd2.js} +166 -138
  50. package/dist/{cli-87t2gstf.js → cli-tdtmw1r5.js} +1 -1
  51. package/dist/{cli-15429qdw.js → cli-v3qda694.js} +1 -1
  52. package/dist/{cli-h39xxnq6.js → cli-vew6xw8p.js} +1767 -1334
  53. package/dist/{cli-38taxznr.js → cli-vsap7a8d.js} +2066 -1399
  54. package/dist/{cli-6x363v1z.js → cli-x0mnesvr.js} +6 -6
  55. package/dist/{cli-4bc8vmhm.js → cli-y37pxs1m.js} +8 -8
  56. package/dist/{cli-c79a9zrc.js → cli-ysehve35.js} +2 -2
  57. package/dist/{cli-wf86d5t7.js → cli-z3h9zvty.js} +11 -11
  58. package/dist/cli-zg86g3q8.js +1093 -0
  59. package/dist/cli.js +24 -22
  60. package/dist/{codex-adapter-hsq6mz3m.js → codex-adapter-8vhjvnp9.js} +7 -7
  61. package/dist/{codex-hook-8c500gq8.js → codex-hook-7eb9d1d5.js} +2 -2
  62. package/dist/{codex-session-runner-c1x3x143.js → codex-session-runner-xeq8w3ea.js} +7 -7
  63. package/dist/{commands-rwtddtst.js → commands-zhm1v98e.js} +8 -8
  64. package/dist/{db-j2b355vz.js → db-q436srrz.js} +19 -18
  65. package/dist/{e2b-znpx78eg.js → e2b-b7jt70fc.js} +3 -3
  66. package/dist/{handlers-hchgrxkh.js → handlers-cpratgdt.js} +29 -26
  67. package/dist/{hook-spb00w76.js → hook-j1sd08ay.js} +10 -10
  68. package/dist/{hook-p49egqc0.js → hook-wfe2rdyd.js} +9 -9
  69. package/dist/{http-nh14kkms.js → http-g13pqz5z.js} +1301 -1457
  70. package/dist/{index-67pzqfrb.js → index-dde8asrx.js} +15 -14
  71. package/dist/{index-yrfphye1.js → index-g99vy4xs.js} +16 -15
  72. package/dist/{index-dvsk64sm.js → index-jbgemxkn.js} +350 -228
  73. package/dist/{index-pyp7rexm.js → index-p13cfsc2.js} +2 -2
  74. package/dist/{index-j02xvjtd.js → index-pe58mf1r.js} +3 -3
  75. package/dist/{index-4cbyhq2g.js → index-zqjz0kf8.js} +14 -13
  76. package/dist/{keepalive-9k51nqhc.js → keepalive-ep0a9f7r.js} +9 -9
  77. package/dist/{lead-2xq3dxbz.js → lead-gsw42hv0.js} +36 -34
  78. package/dist/{maintenance-0c0g6nym.js → maintenance-et8rr4t5.js} +10 -9
  79. package/dist/{oauth-refresh-sweep-273a64r2.js → oauth-refresh-sweep-tk3qn7zr.js} +10 -10
  80. package/dist/{onboard-tsv9wwhz.js → onboard-354g4580.js} +11 -9
  81. package/dist/{openai-completions-mrypq7qp.js → openai-completions-kasahkpq.js} +5 -3
  82. package/dist/{openai-responses-qhrk21ez.js → openai-responses-175qgngv.js} +5 -3
  83. package/dist/{openrouter-images-684fysx9.js → openrouter-images-asqqnbvh.js} +5 -3
  84. package/dist/{otel-impl-wp1mfzd2.js → otel-impl-7y3szdz5.js} +40 -7014
  85. package/dist/{pi-mono-adapter-yz47kk8e.js → pi-mono-adapter-6vmrr3g8.js} +184 -7248
  86. package/dist/{pricing-refresh-jw1yw2fn.js → pricing-refresh-zra6kqmc.js} +8 -8
  87. package/dist/{rbac-roles-dg964c8p.js → rbac-roles-2g89azp9.js} +8 -8
  88. package/dist/{rbac-roles-p53cg5cv.js → rbac-roles-vsfaw815.js} +51 -51
  89. package/dist/{registry-mh12y17v.js → registry-6nvn6bj0.js} +2 -1
  90. package/dist/{render-v2-56vn2rk9.js → render-v2-41schhkc.js} +7 -7
  91. package/dist/{seed-pricing-52xx6z63.js → seed-pricing-hh2j4y52.js} +7 -7
  92. package/dist/{setup-e8gp79sy.js → setup-vk6apbbf.js} +23 -21
  93. package/dist/{worker-s17f1g46.js → worker-zj8qahay.js} +36 -34
  94. package/openapi.json +1 -1
  95. package/package.json +9 -7
  96. package/plugin/commands/implement-issue.md +1 -1
  97. package/plugin/commands/start-leader.md +3 -3
  98. package/plugin/commands/work-on-task.md +2 -2
  99. package/plugin/pi-skills/implement-issue/SKILL.md +1 -1
  100. package/plugin/pi-skills/start-leader/SKILL.md +3 -3
  101. package/plugin/pi-skills/work-on-task/SKILL.md +2 -2
  102. package/src/agentmail/handlers.ts +15 -15
  103. package/src/apps/definition.ts +14 -10
  104. package/src/apps/page-validator.ts +18 -14
  105. package/src/apps/row-store.ts +98 -67
  106. package/src/apps/schema-migrate.ts +47 -34
  107. package/src/apps/script-types.ts +2 -2
  108. package/src/apps/store.ts +46 -53
  109. package/src/apps/sync-run-as.ts +2 -2
  110. package/src/apps/sync.ts +39 -31
  111. package/src/apps/user-config.ts +14 -16
  112. package/src/apps/version.ts +17 -16
  113. package/src/artifact-sdk/server.ts +4 -1
  114. package/src/be/asset-key-auth.ts +5 -2
  115. package/src/be/audit-user.ts +7 -7
  116. package/src/be/boot-scrub-logs.ts +36 -39
  117. package/src/be/budget-admission.ts +8 -8
  118. package/src/be/budget-refusal-notify.ts +9 -6
  119. package/src/be/db-client.ts +461 -0
  120. package/src/be/db-queries/mcp-oauth.ts +152 -148
  121. package/src/be/db-queries/oauth.ts +194 -192
  122. package/src/be/db-queries/task-artifacts.ts +12 -10
  123. package/src/be/db-queries/tracker.ts +105 -93
  124. package/src/be/db.ts +3333 -3627
  125. package/src/be/events.ts +80 -114
  126. package/src/be/identity.ts +7 -4
  127. package/src/be/mcp-proxy.ts +5 -5
  128. package/src/be/memory/boot-reembed.ts +11 -15
  129. package/src/be/memory/edges-store.ts +19 -13
  130. package/src/be/memory/graph-expansion.ts +7 -8
  131. package/src/be/memory/index-content.ts +144 -0
  132. package/src/be/memory/link-resolver.ts +47 -43
  133. package/src/be/memory/links-store.ts +27 -29
  134. package/src/be/memory/providers/sqlite-store.ts +251 -269
  135. package/src/be/memory/raters/retrieval.ts +15 -19
  136. package/src/be/memory/raters/run-server-raters.ts +5 -2
  137. package/src/be/memory/raters/store.ts +17 -27
  138. package/src/be/memory/retrieval-store.ts +13 -12
  139. package/src/be/memory/types.ts +19 -15
  140. package/src/be/memory/usefulness-stats.ts +85 -101
  141. package/src/be/migrations/runner.ts +2 -2
  142. package/src/be/multi-runtime.ts +137 -131
  143. package/src/be/oauth-credential-bindings.ts +13 -9
  144. package/src/be/oauth-refresh-sweep.ts +3 -3
  145. package/src/be/pricing-refresh.ts +43 -41
  146. package/src/be/rbac-audit.ts +66 -43
  147. package/src/be/rbac-roles.ts +55 -60
  148. package/src/be/script-connections.ts +249 -262
  149. package/src/be/script-credential-broker.ts +2 -2
  150. package/src/be/scripts/boot-reembed.ts +14 -19
  151. package/src/be/scripts/db.ts +133 -222
  152. package/src/be/scripts/embeddings.ts +42 -44
  153. package/src/be/scripts/retention.ts +49 -36
  154. package/src/be/scripts/run-saved.ts +9 -3
  155. package/src/be/scripts/type-contributors.ts +1 -1
  156. package/src/be/scripts/typecheck.ts +18 -15
  157. package/src/be/seed/agent-fs-provision.ts +52 -47
  158. package/src/be/seed/runner.ts +4 -4
  159. package/src/be/seed/state-db.ts +12 -10
  160. package/src/be/seed-capabilities.ts +6 -3
  161. package/src/be/seed-pricing.ts +2 -1
  162. package/src/be/seed-scripts/catalog/ops-catalog-audit.inline.ts +1 -1
  163. package/src/be/seed-scripts/catalog/ops-catalog-audit.ts +1 -1
  164. package/src/be/seed-scripts/index.ts +3 -3
  165. package/src/be/seed-skills/index.ts +52 -16
  166. package/src/be/skill-sync.ts +22 -20
  167. package/src/be/steering.ts +30 -27
  168. package/src/be/swarm-config-guard.ts +1 -0
  169. package/src/be/unmapped-identities.ts +6 -6
  170. package/src/be/users.ts +130 -138
  171. package/src/commands/onboard/types.ts +7 -1
  172. package/src/commands/onboard.tsx +10 -5
  173. package/src/commands/runner.ts +9 -12
  174. package/src/commands/setup.tsx +27 -17
  175. package/src/fs/agent-fs-provider.ts +83 -10
  176. package/src/fs/provider.ts +15 -1
  177. package/src/github/handlers.ts +57 -52
  178. package/src/gitlab/handlers.ts +36 -33
  179. package/src/heartbeat/heartbeat.ts +138 -130
  180. package/src/hooks/tool-loop-detection.test.ts +49 -0
  181. package/src/hooks/tool-loop-detection.ts +36 -1
  182. package/src/http/active-sessions.ts +9 -9
  183. package/src/http/agents.ts +76 -65
  184. package/src/http/api-keys.ts +22 -8
  185. package/src/http/approval-requests.ts +8 -8
  186. package/src/http/apps.ts +80 -77
  187. package/src/http/assets.ts +36 -27
  188. package/src/http/auth.ts +3 -3
  189. package/src/http/budgets.ts +17 -9
  190. package/src/http/codex-oauth-keep-warm.ts +1 -1
  191. package/src/http/config.ts +19 -19
  192. package/src/http/context.ts +5 -5
  193. package/src/http/core.ts +50 -32
  194. package/src/http/ecosystem.ts +1 -1
  195. package/src/http/events.ts +4 -4
  196. package/src/http/favorite-owner.ts +3 -3
  197. package/src/http/favorites.ts +4 -4
  198. package/src/http/fs.ts +46 -22
  199. package/src/http/inbox-state.ts +2 -2
  200. package/src/http/index.ts +22 -19
  201. package/src/http/integrations.ts +7 -7
  202. package/src/http/kv.ts +32 -32
  203. package/src/http/mcp-bridge.ts +3 -3
  204. package/src/http/mcp-oauth.ts +30 -30
  205. package/src/http/mcp-servers.ts +22 -22
  206. package/src/http/mcp-user.ts +8 -3
  207. package/src/http/mcp.ts +9 -6
  208. package/src/http/memory.ts +60 -160
  209. package/src/http/metrics.ts +22 -20
  210. package/src/http/oauth-callback.ts +16 -12
  211. package/src/http/oauth-locks.ts +2 -2
  212. package/src/http/page-proxy.ts +1 -1
  213. package/src/http/pages-public.ts +6 -6
  214. package/src/http/pages.ts +37 -31
  215. package/src/http/poll.ts +77 -62
  216. package/src/http/pricing.ts +7 -7
  217. package/src/http/prompt-templates.ts +25 -15
  218. package/src/http/repos.ts +5 -5
  219. package/src/http/schedules.ts +34 -28
  220. package/src/http/script-connection-proxy.ts +2 -2
  221. package/src/http/script-connections.ts +141 -120
  222. package/src/http/script-runs.ts +88 -64
  223. package/src/http/scripts.ts +99 -75
  224. package/src/http/session-cost-recompute.ts +20 -14
  225. package/src/http/session-data.ts +15 -15
  226. package/src/http/sessions.ts +9 -7
  227. package/src/http/skills.ts +34 -34
  228. package/src/http/stats.ts +13 -10
  229. package/src/http/status.ts +37 -37
  230. package/src/http/task-templates.ts +1 -1
  231. package/src/http/tasks.ts +114 -101
  232. package/src/http/trackers/jira.ts +10 -10
  233. package/src/http/trackers/linear.ts +10 -8
  234. package/src/http/users.ts +82 -65
  235. package/src/http/utils.ts +3 -3
  236. package/src/http/webhooks.ts +3 -3
  237. package/src/http/workflow-events.ts +1 -1
  238. package/src/http/workflows.ts +107 -129
  239. package/src/http/x.ts +8 -8
  240. package/src/integrations/kapso/config.ts +22 -17
  241. package/src/integrations/kapso/inbound.ts +15 -13
  242. package/src/jira/app.ts +2 -2
  243. package/src/jira/client.ts +4 -4
  244. package/src/jira/metadata.ts +15 -19
  245. package/src/jira/oauth.ts +5 -5
  246. package/src/jira/outbound.ts +2 -2
  247. package/src/jira/sync.ts +35 -35
  248. package/src/jira/webhook-lifecycle.ts +13 -14
  249. package/src/jira/webhook.ts +6 -6
  250. package/src/linear/app.ts +3 -3
  251. package/src/linear/client.ts +2 -2
  252. package/src/linear/oauth.ts +4 -4
  253. package/src/linear/outbound.ts +9 -9
  254. package/src/linear/sync.ts +43 -43
  255. package/src/metrics/version.ts +6 -3
  256. package/src/oauth/ensure-mcp-token.ts +6 -6
  257. package/src/oauth/ensure-token.ts +19 -16
  258. package/src/oauth/keepalive.ts +1 -1
  259. package/src/oauth/wrapper.ts +5 -5
  260. package/src/pages/version.ts +6 -3
  261. package/src/prompts/base-prompt.ts +239 -294
  262. package/src/prompts/defaults.ts +145 -96
  263. package/src/prompts/session-templates.ts +267 -765
  264. package/src/providers/claude-managed-adapter.ts +4 -2
  265. package/src/queue-stall-alarm.ts +14 -14
  266. package/src/scheduler/scheduler.test.ts +14 -14
  267. package/src/scheduler/scheduler.ts +22 -20
  268. package/src/script-workflows/supervisor.ts +34 -22
  269. package/src/scripts-runtime/credential-broker/broker.ts +1 -1
  270. package/src/scripts-runtime/credential-broker/types.ts +1 -1
  271. package/src/scripts-runtime/egress-secrets.ts +1 -1
  272. package/src/scripts-runtime/eval-harness.ts +1 -3
  273. package/src/scripts-runtime/import-allowlist.ts +7 -1
  274. package/src/scripts-runtime/sdk-allowlist.ts +1 -0
  275. package/src/scripts-runtime/types/stdlib.d.ts +8 -0
  276. package/src/scripts-runtime/types/swarm-sdk.d.ts +8 -0
  277. package/src/server-user.ts +1 -1
  278. package/src/server.ts +4 -2
  279. package/src/slack/ack.ts +3 -3
  280. package/src/slack/actions.ts +6 -6
  281. package/src/slack/app.ts +11 -2
  282. package/src/slack/assistant.ts +7 -7
  283. package/src/slack/commands.ts +2 -2
  284. package/src/slack/enrich.ts +25 -12
  285. package/src/slack/handlers.ts +34 -16
  286. package/src/slack/render-v2.ts +96 -66
  287. package/src/slack/responses.ts +8 -8
  288. package/src/slack/router.ts +9 -6
  289. package/src/slack/socket-mode-guard.test.ts +25 -0
  290. package/src/slack/socket-mode-guard.ts +10 -0
  291. package/src/slack/steering.ts +9 -6
  292. package/src/slack/thread-buffer.ts +9 -9
  293. package/src/slack/watcher.ts +44 -32
  294. package/src/stdio.ts +16 -14
  295. package/src/tasks/sibling-awareness.ts +13 -13
  296. package/src/tasks/terminal-result-guard.ts +3 -3
  297. package/src/tasks/worker-follow-up.ts +30 -30
  298. package/src/tests/additive-buffer.test.ts +9 -6
  299. package/src/tests/agent-activity.test.ts +35 -35
  300. package/src/tests/agent-fs-provision-seeder.test.ts +46 -44
  301. package/src/tests/agentmail-handlers.test.ts +37 -34
  302. package/src/tests/agents-harness-provider.test.ts +81 -72
  303. package/src/tests/api-key-tracking.test.ts +41 -41
  304. package/src/tests/approval-requests.test.ts +131 -126
  305. package/src/tests/apps-elements.test.ts +73 -68
  306. package/src/tests/apps-rbac.test.ts +18 -13
  307. package/src/tests/apps-script-types.test.ts +11 -7
  308. package/src/tests/apps-spike.test.ts +39 -35
  309. package/src/tests/apps-spike2.test.ts +139 -131
  310. package/src/tests/apps-spike4.test.ts +54 -51
  311. package/src/tests/apps-spike5.test.ts +148 -149
  312. package/src/tests/apps-sync-engine.test.ts +233 -217
  313. package/src/tests/apps-sync.test.ts +14 -14
  314. package/src/tests/apps-user-config.test.ts +82 -58
  315. package/src/tests/artifact-sdk.test.ts +10 -49
  316. package/src/tests/asset-key-api.test.ts +26 -16
  317. package/src/tests/asset-key-invariants.test.ts +129 -102
  318. package/src/tests/asset-key-mcp.test.ts +27 -20
  319. package/src/tests/asset-key-migration.test.ts +15 -15
  320. package/src/tests/asyncdb-guard-races.test.ts +195 -0
  321. package/src/tests/audit-updated-by.test.ts +79 -76
  322. package/src/tests/audit-user.test.ts +72 -55
  323. package/src/tests/base-prompt.test.ts +759 -664
  324. package/src/tests/budget-admission.test.ts +90 -85
  325. package/src/tests/budget-claim-gate.test.ts +111 -62
  326. package/src/tests/budget-refusal-notification.test.ts +94 -66
  327. package/src/tests/budget-user-scope.test.ts +80 -83
  328. package/src/tests/budgets-routes.test.ts +14 -20
  329. package/src/tests/channel-activity.test.ts +37 -36
  330. package/src/tests/claude-managed-adapter.test.ts +86 -69
  331. package/src/tests/codex-oauth-keep-warm.test.ts +1 -1
  332. package/src/tests/codex-steering-hook.test.ts +17 -19
  333. package/src/tests/concurrency.test.ts +68 -68
  334. package/src/tests/config-api-only-keys.test.ts +10 -11
  335. package/src/tests/connection-embedded-auth.test.ts +95 -89
  336. package/src/tests/context-key-db.test.ts +42 -34
  337. package/src/tests/context-snapshot.test.ts +14 -14
  338. package/src/tests/context-versioning.test.ts +72 -60
  339. package/src/tests/core-auth.test.ts +3 -9
  340. package/src/tests/create-page-tool.test.ts +5 -5
  341. package/src/tests/create-task-validation.test.ts +29 -27
  342. package/src/tests/credential-broker.test.ts +10 -10
  343. package/src/tests/credential-status-api.test.ts +22 -17
  344. package/src/tests/credential-status-routing.test.ts +36 -36
  345. package/src/tests/db-capacity.test.ts +67 -67
  346. package/src/tests/db-client-busy-retry.test.ts +195 -0
  347. package/src/tests/db-client.test.ts +406 -0
  348. package/src/tests/db-queries-oauth.test.ts +98 -100
  349. package/src/tests/db-queries-tracker.test.ts +54 -54
  350. package/src/tests/db-query.test.ts +4 -3
  351. package/src/tests/delete-page-tool.test.ts +31 -28
  352. package/src/tests/devin-adapter.test.ts +8 -9
  353. package/src/tests/devin-api.test.ts +7 -9
  354. package/src/tests/ensure-token.test.ts +36 -36
  355. package/src/tests/entrypoint-codex-oauth-seed.test.ts +119 -89
  356. package/src/tests/events-db.test.ts +53 -53
  357. package/src/tests/events-http.test.ts +7 -15
  358. package/src/tests/favorites.test.ts +19 -18
  359. package/src/tests/follow-up-redelivery-guard.test.ts +82 -82
  360. package/src/tests/fs-provider.test.ts +105 -1
  361. package/src/tests/fs-routes.test.ts +56 -27
  362. package/src/tests/generate-default-claude-md.test.ts +152 -6
  363. package/src/tests/generate-identity-templates.test.ts +21 -25
  364. package/src/tests/github-event-filter.test.ts +1 -1
  365. package/src/tests/github-handlers-cancel-config.test.ts +39 -40
  366. package/src/tests/github-handlers-inline-comments.test.ts +19 -19
  367. package/src/tests/github-handlers.test.ts +52 -53
  368. package/src/tests/gitlab-handlers.test.ts +70 -71
  369. package/src/tests/gitlab-vcs-db.test.ts +21 -21
  370. package/src/tests/harness-provider-resolution.test.ts +22 -22
  371. package/src/tests/heartbeat-checklist.test.ts +170 -148
  372. package/src/tests/heartbeat-reroute-decision.test.ts +184 -162
  373. package/src/tests/heartbeat-supersede-resume.test.ts +163 -102
  374. package/src/tests/heartbeat.test.ts +393 -286
  375. package/src/tests/http/context-routes.test.ts +11 -14
  376. package/src/tests/http-api-integration.test.ts +11 -24
  377. package/src/tests/http-users.test.ts +123 -114
  378. package/src/tests/identity-field-budget.test.ts +24 -10
  379. package/src/tests/identity.test.ts +17 -17
  380. package/src/tests/integrations-http.test.ts +13 -14
  381. package/src/tests/jira-metadata.test.ts +44 -44
  382. package/src/tests/jira-oauth.test.ts +7 -7
  383. package/src/tests/jira-outbound-sync.test.ts +19 -19
  384. package/src/tests/jira-sync.test.ts +71 -62
  385. package/src/tests/jira-webhook-lifecycle.test.ts +15 -15
  386. package/src/tests/jira-webhook.test.ts +24 -24
  387. package/src/tests/kapso-inbound.test.ts +33 -33
  388. package/src/tests/kv-http.test.ts +10 -16
  389. package/src/tests/kv-namespace-resolution.test.ts +9 -15
  390. package/src/tests/kv-page-proxy.test.ts +7 -15
  391. package/src/tests/kv-storage.test.ts +141 -91
  392. package/src/tests/kv-tool.test.ts +7 -7
  393. package/src/tests/launch-password-rejection.test.ts +4 -3
  394. package/src/tests/linear-outbound-sync.test.ts +10 -10
  395. package/src/tests/linear-sync-identity.test.ts +72 -72
  396. package/src/tests/linear-webhook.test.ts +51 -45
  397. package/src/tests/list-endpoint-slimming.test.ts +36 -36
  398. package/src/tests/mcp-oauth-dcr-reuse.test.ts +64 -69
  399. package/src/tests/mcp-oauth-ensure-token.test.ts +25 -23
  400. package/src/tests/mcp-oauth-manual-client.test.ts +30 -19
  401. package/src/tests/mcp-oauth-queries.test.ts +161 -154
  402. package/src/tests/mcp-oauth-resolve-secrets.test.ts +35 -36
  403. package/src/tests/mcp-server-resolved-env.test.ts +14 -14
  404. package/src/tests/mcp-server-ssrf.test.ts +4 -4
  405. package/src/tests/mcp-tools-user.test.ts +37 -33
  406. package/src/tests/mcp-tools.test.ts +1 -1
  407. package/src/tests/mcp-user-route.test.ts +28 -41
  408. package/src/tests/memory-e2e.test.ts +117 -108
  409. package/src/tests/memory-edges.test.ts +101 -116
  410. package/src/tests/memory-edit.test.ts +46 -40
  411. package/src/tests/memory-get-tool.test.ts +24 -25
  412. package/src/tests/memory-graph-expansion.test.ts +84 -81
  413. package/src/tests/memory-http-recall-gating.test.ts +23 -17
  414. package/src/tests/memory-hybrid.test.ts +36 -33
  415. package/src/tests/memory-link-resolver.test.ts +69 -70
  416. package/src/tests/memory-rate-endpoint.test.ts +46 -60
  417. package/src/tests/memory-rater-e2e.test.ts +99 -114
  418. package/src/tests/memory-rater-implicit-citation.test.ts +86 -83
  419. package/src/tests/memory-rater-llm.test.ts +70 -86
  420. package/src/tests/memory-rater-store.test.ts +86 -94
  421. package/src/tests/memory-store-tool.test.ts +176 -0
  422. package/src/tests/memory-store.test.ts +128 -127
  423. package/src/tests/memory-usefulness-endpoint.test.ts +63 -57
  424. package/src/tests/memory.test.ts +109 -106
  425. package/src/tests/metrics-http.test.ts +7 -5
  426. package/src/tests/migration-046-budgets.test.ts +106 -130
  427. package/src/tests/migration-063-schema-relax.test.ts +32 -32
  428. package/src/tests/model-control.test.ts +109 -94
  429. package/src/tests/multi-runtime-registration.test.ts +743 -711
  430. package/src/tests/oauth-access-token-tool.test.ts +14 -14
  431. package/src/tests/oauth-callback-flow.test.ts +62 -66
  432. package/src/tests/oauth-credential-bindings.test.ts +57 -64
  433. package/src/tests/oauth-keepalive.test.ts +9 -9
  434. package/src/tests/oauth-presets.test.ts +4 -4
  435. package/src/tests/oauth-refresh-failure.test.ts +38 -34
  436. package/src/tests/oauth-refresh-sweep.test.ts +53 -56
  437. package/src/tests/oauth-wrapper.test.ts +4 -4
  438. package/src/tests/openapi-response-contract.test.ts +42 -30
  439. package/src/tests/otel-session-cost-metrics.test.ts +11 -16
  440. package/src/tests/page-proxy-authed.test.ts +7 -15
  441. package/src/tests/page-proxy.test.ts +7 -15
  442. package/src/tests/pages-actions-endpoint.test.ts +4 -3
  443. package/src/tests/pages-authed-mode.test.ts +4 -3
  444. package/src/tests/pages-http.test.ts +4 -5
  445. package/src/tests/pages-list-endpoint.test.ts +4 -5
  446. package/src/tests/pages-password-mode.test.ts +5 -4
  447. package/src/tests/pages-public-authed-401.test.ts +4 -3
  448. package/src/tests/pages-public-html.test.ts +4 -3
  449. package/src/tests/pages-public-json-redirect.test.ts +4 -3
  450. package/src/tests/pages-storage.test.ts +39 -40
  451. package/src/tests/pages-versioning.test.ts +4 -3
  452. package/src/tests/pagination-metrics.test.ts +49 -39
  453. package/src/tests/pool-affinity.test.ts +144 -124
  454. package/src/tests/pool-session-logs.test.ts +31 -31
  455. package/src/tests/preload.ts +96 -3
  456. package/src/tests/pricing-refresh.test.ts +29 -32
  457. package/src/tests/pricing-routes.test.ts +9 -15
  458. package/src/tests/profile-sync.test.ts +1 -1
  459. package/src/tests/progress-dedup.test.ts +14 -14
  460. package/src/tests/prompt-template-remaining.test.ts +11 -10
  461. package/src/tests/prompt-template-session.test.ts +201 -462
  462. package/src/tests/prompt-templates-db.test.ts +33 -33
  463. package/src/tests/queue-stall-alarm.test.ts +65 -54
  464. package/src/tests/rbac-admission.test.ts +33 -41
  465. package/src/tests/rbac-audit.test.ts +56 -59
  466. package/src/tests/rbac-charact-http.test.ts +19 -23
  467. package/src/tests/rbac-charact-misc-tools.test.ts +32 -27
  468. package/src/tests/rbac-charact-skills.test.ts +29 -24
  469. package/src/tests/rbac-charact-slack.test.ts +6 -6
  470. package/src/tests/rbac-e2e-helpers.ts +4 -18
  471. package/src/tests/rbac-roles.test.ts +112 -112
  472. package/src/tests/register-service-security.test.ts +7 -7
  473. package/src/tests/reload-config.test.ts +55 -52
  474. package/src/tests/rest-api.test.ts +45 -48
  475. package/src/tests/run-bun-tests.test.ts +208 -193
  476. package/src/tests/runner-context-preamble.test.ts +12 -11
  477. package/src/tests/runner-polling-api.test.ts +22 -25
  478. package/src/tests/sandboxed-process.test.ts +28 -11
  479. package/src/tests/schedule-http-triage-tools.test.ts +10 -11
  480. package/src/tests/schedule-target-type.test.ts +65 -59
  481. package/src/tests/scheduled-tasks-api.test.ts +19 -22
  482. package/src/tests/scheduled-tasks.test.ts +121 -105
  483. package/src/tests/scheduler-backoff.test.ts +22 -22
  484. package/src/tests/script-apis-mcp.test.ts +23 -19
  485. package/src/tests/script-connections-http.test.ts +102 -97
  486. package/src/tests/script-connections-mcp.test.ts +69 -54
  487. package/src/tests/script-connections.test.ts +80 -76
  488. package/src/tests/script-runs-http.test.ts +26 -26
  489. package/src/tests/script-workflows-runtime-e2e.test.ts +43 -35
  490. package/src/tests/scripts-boot-reembed.test.ts +30 -34
  491. package/src/tests/scripts-db.test.ts +52 -39
  492. package/src/tests/scripts-embeddings.test.ts +35 -39
  493. package/src/tests/scripts-external-api.test.ts +61 -60
  494. package/src/tests/scripts-http.test.ts +61 -44
  495. package/src/tests/scripts-import-allowlist.test.ts +23 -1
  496. package/src/tests/scripts-mcp-e2e.test.ts +48 -11
  497. package/src/tests/scripts-only-gating.test.ts +48 -40
  498. package/src/tests/scripts-retention.test.ts +171 -125
  499. package/src/tests/scripts-runtime-identity.test.ts +49 -42
  500. package/src/tests/scripts-runtime-secret-egress.test.ts +33 -0
  501. package/src/tests/scripts-runtime.test.ts +5 -1
  502. package/src/tests/scripts-typecheck.test.ts +53 -54
  503. package/src/tests/sdk-allowlist.test.ts +4 -5
  504. package/src/tests/seed-capabilities.test.ts +18 -18
  505. package/src/tests/seed-scripts.test.ts +9 -9
  506. package/src/tests/seed-skills-bundled-files.test.ts +31 -28
  507. package/src/tests/seed.test.ts +5 -5
  508. package/src/tests/self-improvement.test.ts +75 -91
  509. package/src/tests/send-task-requested-by.test.ts +25 -23
  510. package/src/tests/send-task-slack-routing-guard.test.ts +15 -15
  511. package/src/tests/session-attach.test.ts +55 -56
  512. package/src/tests/session-cost-recompute-unit.test.ts +18 -18
  513. package/src/tests/session-costs-codex-recompute.test.ts +26 -32
  514. package/src/tests/session-costs-golden.test.ts +32 -36
  515. package/src/tests/session-costs-model-key-normalize.test.ts +17 -20
  516. package/src/tests/session-costs-recompute-all-providers.test.ts +19 -24
  517. package/src/tests/session-costs.test.ts +639 -191
  518. package/src/tests/session-logs.test.ts +25 -28
  519. package/src/tests/sessions.test.ts +47 -44
  520. package/src/tests/sibling-awareness-db.test.ts +26 -26
  521. package/src/tests/skill-files-http.test.ts +7 -6
  522. package/src/tests/skill-files.test.ts +41 -42
  523. package/src/tests/skill-get-file-tool.test.ts +2 -2
  524. package/src/tests/skill-sync.test.ts +48 -48
  525. package/src/tests/skill-update-scope.test.ts +16 -16
  526. package/src/tests/skills-signature.test.ts +35 -35
  527. package/src/tests/slack-actions.test.ts +23 -23
  528. package/src/tests/slack-assistant-comention-production.test.ts +9 -7
  529. package/src/tests/slack-assistant.test.ts +22 -22
  530. package/src/tests/slack-bot-filter.test.ts +22 -17
  531. package/src/tests/slack-channel-lifecycle.test.ts +1 -1
  532. package/src/tests/slack-delete.test.ts +2 -2
  533. package/src/tests/slack-identity-resolution.test.ts +66 -67
  534. package/src/tests/slack-metadata-inheritance.test.ts +105 -107
  535. package/src/tests/slack-queue-offline.test.ts +33 -23
  536. package/src/tests/slack-read-boundaries.test.ts +2 -2
  537. package/src/tests/slack-render-v2.test.ts +233 -209
  538. package/src/tests/slack-router-require-mention.test.ts +23 -18
  539. package/src/tests/slack-router.test.ts +31 -23
  540. package/src/tests/slack-steering.test.ts +66 -58
  541. package/src/tests/slack-thread-buffer.test.ts +263 -17
  542. package/src/tests/slack-thread-followups.test.ts +57 -52
  543. package/src/tests/slack-tool-blocks.test.ts +18 -16
  544. package/src/tests/slack-update.test.ts +2 -2
  545. package/src/tests/slack-upload-file.test.ts +5 -5
  546. package/src/tests/slack-watcher.test.ts +180 -172
  547. package/src/tests/spec-base-url.test.ts +3 -3
  548. package/src/tests/status.test.ts +252 -181
  549. package/src/tests/steer-task-tool.test.ts +34 -23
  550. package/src/tests/steering-core.test.ts +105 -106
  551. package/src/tests/steering-enabled.test.ts +32 -23
  552. package/src/tests/steering-promotion.test.ts +42 -38
  553. package/src/tests/steering-transport.test.ts +28 -29
  554. package/src/tests/store-progress-attachments-handler.test.ts +208 -75
  555. package/src/tests/store-progress-attachments.test.ts +60 -60
  556. package/src/tests/store-progress-cost.test.ts +16 -16
  557. package/src/tests/structured-output.test.ts +17 -14
  558. package/src/tests/swarm-config-encryption.test.ts +76 -81
  559. package/src/tests/swarm-config-reserved-keys.test.ts +58 -55
  560. package/src/tests/swarm-config-schema.test.ts +26 -27
  561. package/src/tests/swarm-repos.test.ts +66 -66
  562. package/src/tests/swarm-tool-result-gate.test.ts +70 -70
  563. package/src/tests/system-default-skills.test.ts +25 -27
  564. package/src/tests/task-artifacts.test.ts +87 -80
  565. package/src/tests/task-attachments-schema.test.ts +25 -26
  566. package/src/tests/task-cancellation.test.ts +77 -80
  567. package/src/tests/task-cascade-fail.test.ts +86 -84
  568. package/src/tests/task-completion-idempotency.test.ts +223 -220
  569. package/src/tests/task-lifecycle-telemetry.test.ts +24 -22
  570. package/src/tests/task-pause-resume.test.ts +120 -123
  571. package/src/tests/task-search-filter.test.ts +8 -8
  572. package/src/tests/task-supersede-resume.test.ts +153 -148
  573. package/src/tests/task-swarm-version.test.ts +17 -19
  574. package/src/tests/task-title-route.test.ts +6 -5
  575. package/src/tests/task-tools-ctx.test.ts +15 -15
  576. package/src/tests/task-tools-ownership.test.ts +26 -21
  577. package/src/tests/task-working-dir.test.ts +27 -27
  578. package/src/tests/tasks-requested-by-filter.test.ts +42 -38
  579. package/src/tests/test-net.ts +71 -0
  580. package/src/tests/test-proc.ts +86 -0
  581. package/src/tests/tool-annotations.test.ts +9 -8
  582. package/src/tests/tracker-fold.test.ts +44 -45
  583. package/src/tests/tracker-tools.test.ts +31 -31
  584. package/src/tests/trigger-claiming.test.ts +142 -142
  585. package/src/tests/update-profile-agentid.test.ts +41 -41
  586. package/src/tests/update-profile-api.test.ts +31 -34
  587. package/src/tests/update-profile-auth.test.ts +14 -14
  588. package/src/tests/update-schedule-mcp-tool.test.ts +19 -21
  589. package/src/tests/user-identity.test.ts +231 -221
  590. package/src/tests/user-token-rest-auth.test.ts +32 -32
  591. package/src/tests/user-token-routes.test.ts +21 -36
  592. package/src/tests/vcs-tracking.test.ts +39 -35
  593. package/src/tests/vendored-openapi.test.ts +6 -5
  594. package/src/tests/whoami-route.test.ts +10 -16
  595. package/src/tests/workflow-agent-task.test.ts +6 -6
  596. package/src/tests/workflow-async-v2.test.ts +76 -64
  597. package/src/tests/workflow-convergence.test.ts +35 -32
  598. package/src/tests/workflow-ctx.test.ts +22 -7
  599. package/src/tests/workflow-definition-telemetry.test.ts +8 -8
  600. package/src/tests/workflow-e2e.test.ts +19 -18
  601. package/src/tests/workflow-engine-v2.test.ts +94 -80
  602. package/src/tests/workflow-executors.test.ts +53 -37
  603. package/src/tests/workflow-foreach.test.ts +186 -177
  604. package/src/tests/workflow-hitl-routing.test.ts +29 -29
  605. package/src/tests/workflow-http-v2.test.ts +46 -35
  606. package/src/tests/workflow-input-redaction.test.ts +7 -7
  607. package/src/tests/workflow-integration-io.test.ts +44 -41
  608. package/src/tests/workflow-io-schemas.test.ts +28 -25
  609. package/src/tests/workflow-mcp-trigger-schema.test.ts +25 -26
  610. package/src/tests/workflow-registry.test.ts +19 -19
  611. package/src/tests/workflow-retry-v2.test.ts +32 -29
  612. package/src/tests/workflow-retry-validation.test.ts +13 -10
  613. package/src/tests/workflow-schedule-trigger.test.ts +17 -17
  614. package/src/tests/workflow-step-claims.test.ts +152 -0
  615. package/src/tests/workflow-swarm-script.test.ts +58 -54
  616. package/src/tests/workflow-trigger-schema.test.ts +21 -21
  617. package/src/tests/workflow-triggers-v2.test.ts +57 -55
  618. package/src/tests/workflow-validation-port-routing.test.ts +19 -19
  619. package/src/tests/workflow-versions.test.ts +85 -53
  620. package/src/tests/workflow-wait-builtin-events.test.ts +27 -21
  621. package/src/tests/workflow-wait-event.test.ts +60 -54
  622. package/src/tests/workflow-wait-http.test.ts +22 -19
  623. package/src/tests/workflow-wait-recovery.test.ts +28 -25
  624. package/src/tests/workflow-wait-state-queries.test.ts +70 -70
  625. package/src/tests/workflow-wait-time.test.ts +22 -19
  626. package/src/tests/workflow-workspace.test.ts +28 -28
  627. package/src/tools/accept-steer.ts +3 -3
  628. package/src/tools/app-diff.ts +8 -7
  629. package/src/tools/app-get.ts +6 -6
  630. package/src/tools/app-history.ts +4 -4
  631. package/src/tools/app-list.ts +2 -2
  632. package/src/tools/app-patch.ts +7 -7
  633. package/src/tools/app-rollback.ts +1 -1
  634. package/src/tools/app-sync.ts +2 -2
  635. package/src/tools/app-upsert.ts +9 -9
  636. package/src/tools/cancel-task.ts +70 -70
  637. package/src/tools/context-diff.ts +4 -4
  638. package/src/tools/context-history.ts +3 -3
  639. package/src/tools/create-channel.ts +1 -1
  640. package/src/tools/create-metric.ts +8 -8
  641. package/src/tools/create-page.ts +13 -10
  642. package/src/tools/credential-bindings/tool.ts +28 -24
  643. package/src/tools/delete-channel.ts +4 -4
  644. package/src/tools/delete-page.ts +4 -4
  645. package/src/tools/get-metrics.ts +1 -1
  646. package/src/tools/get-swarm.ts +1 -1
  647. package/src/tools/get-task-details.ts +6 -4
  648. package/src/tools/get-tasks.ts +2 -2
  649. package/src/tools/inject-learning.ts +4 -4
  650. package/src/tools/join-swarm.ts +5 -7
  651. package/src/tools/kv/kv-delete.ts +3 -3
  652. package/src/tools/kv/kv-get.ts +2 -2
  653. package/src/tools/kv/kv-incr.ts +3 -3
  654. package/src/tools/kv/kv-list.ts +3 -3
  655. package/src/tools/kv/kv-set.ts +3 -3
  656. package/src/tools/kv/kv-write-auth.ts +3 -3
  657. package/src/tools/kv/resolve-namespace.ts +3 -3
  658. package/src/tools/list-channels.ts +1 -1
  659. package/src/tools/list-services.ts +10 -8
  660. package/src/tools/manage-user.ts +21 -13
  661. package/src/tools/mcp-servers/mcp-server-create.ts +3 -3
  662. package/src/tools/mcp-servers/mcp-server-delete.ts +3 -3
  663. package/src/tools/mcp-servers/mcp-server-get.ts +6 -6
  664. package/src/tools/mcp-servers/mcp-server-install.ts +3 -3
  665. package/src/tools/mcp-servers/mcp-server-list.ts +2 -2
  666. package/src/tools/mcp-servers/mcp-server-uninstall.ts +2 -2
  667. package/src/tools/mcp-servers/mcp-server-update.ts +3 -3
  668. package/src/tools/memory-delete.ts +3 -3
  669. package/src/tools/memory-edit.ts +3 -3
  670. package/src/tools/memory-get.ts +5 -5
  671. package/src/tools/memory-search.ts +15 -11
  672. package/src/tools/memory-store.ts +89 -0
  673. package/src/tools/my-agent-info.ts +1 -1
  674. package/src/tools/oauth-access-token.ts +3 -3
  675. package/src/tools/poll-task.ts +24 -23
  676. package/src/tools/post-message.ts +4 -4
  677. package/src/tools/prompt-templates/delete.ts +2 -2
  678. package/src/tools/prompt-templates/get.ts +2 -2
  679. package/src/tools/prompt-templates/set.ts +15 -10
  680. package/src/tools/read-messages.ts +13 -13
  681. package/src/tools/register-agentmail-inbox.ts +9 -5
  682. package/src/tools/register-kapso-number.ts +7 -7
  683. package/src/tools/register-service.ts +2 -2
  684. package/src/tools/repos/get-repos.ts +1 -1
  685. package/src/tools/repos/update-repo.ts +1 -1
  686. package/src/tools/request-human-input.ts +3 -3
  687. package/src/tools/resolve-user.ts +8 -8
  688. package/src/tools/schedules/create-schedule.ts +8 -7
  689. package/src/tools/schedules/delete-schedule.ts +5 -5
  690. package/src/tools/schedules/list-schedules.ts +2 -2
  691. package/src/tools/schedules/patch-schedule.ts +11 -10
  692. package/src/tools/schedules/run-schedule-now.ts +3 -3
  693. package/src/tools/schedules/update-schedule.ts +11 -10
  694. package/src/tools/script-apis.ts +8 -8
  695. package/src/tools/script-connections/tool.ts +6 -6
  696. package/src/tools/send-task.ts +113 -77
  697. package/src/tools/skills/skill-create.ts +3 -3
  698. package/src/tools/skills/skill-delete.ts +3 -3
  699. package/src/tools/skills/skill-get-file.ts +2 -2
  700. package/src/tools/skills/skill-get.ts +6 -5
  701. package/src/tools/skills/skill-install-remote.ts +2 -2
  702. package/src/tools/skills/skill-install.ts +3 -3
  703. package/src/tools/skills/skill-list.ts +2 -2
  704. package/src/tools/skills/skill-publish.ts +4 -4
  705. package/src/tools/skills/skill-search.ts +1 -1
  706. package/src/tools/skills/skill-sync-remote.ts +5 -5
  707. package/src/tools/skills/skill-uninstall.ts +2 -2
  708. package/src/tools/skills/skill-update.ts +3 -3
  709. package/src/tools/slack-archive-channel.ts +1 -1
  710. package/src/tools/slack-create-channel.ts +1 -1
  711. package/src/tools/slack-delete.ts +1 -1
  712. package/src/tools/slack-download-file.ts +1 -1
  713. package/src/tools/slack-invite-to-channel.ts +1 -1
  714. package/src/tools/slack-list-channels.ts +1 -1
  715. package/src/tools/slack-post.ts +4 -4
  716. package/src/tools/slack-read.ts +3 -3
  717. package/src/tools/slack-reply.ts +7 -7
  718. package/src/tools/slack-start-thread.ts +3 -3
  719. package/src/tools/slack-update.ts +1 -1
  720. package/src/tools/slack-upload-file.ts +6 -4
  721. package/src/tools/steer-task.ts +3 -3
  722. package/src/tools/store-progress.ts +144 -77
  723. package/src/tools/swarm-config/delete-config.ts +4 -4
  724. package/src/tools/swarm-config/get-config.ts +2 -2
  725. package/src/tools/swarm-config/list-config.ts +2 -2
  726. package/src/tools/swarm-config/set-config.ts +2 -2
  727. package/src/tools/task-action.ts +70 -70
  728. package/src/tools/task-dedup.ts +3 -3
  729. package/src/tools/tool-config.ts +5 -4
  730. package/src/tools/tracker/tracker-link-task.ts +1 -1
  731. package/src/tools/tracker/tracker-map-agent.ts +1 -1
  732. package/src/tools/tracker/tracker-status.ts +13 -11
  733. package/src/tools/tracker/tracker-sync-status.ts +1 -1
  734. package/src/tools/tracker/tracker-unlink.ts +1 -1
  735. package/src/tools/unregister-service.ts +3 -3
  736. package/src/tools/update-profile.ts +6 -4
  737. package/src/tools/update-service-status.ts +3 -3
  738. package/src/tools/utils.ts +12 -9
  739. package/src/tools/whatsapp-message.ts +1 -1
  740. package/src/tools/workflows/cancel-workflow-run.ts +1 -1
  741. package/src/tools/workflows/create-workflow.ts +4 -3
  742. package/src/tools/workflows/delete-workflow.ts +1 -1
  743. package/src/tools/workflows/get-workflow-run.ts +5 -3
  744. package/src/tools/workflows/get-workflow.ts +1 -1
  745. package/src/tools/workflows/list-workflow-runs.ts +8 -6
  746. package/src/tools/workflows/list-workflows.ts +2 -2
  747. package/src/tools/workflows/patch-workflow-node.ts +20 -41
  748. package/src/tools/workflows/patch-workflow.ts +31 -45
  749. package/src/tools/workflows/trigger-workflow.ts +5 -4
  750. package/src/tools/workflows/update-workflow.ts +28 -22
  751. package/src/types.ts +2 -6
  752. package/src/utils/request-auth-context.ts +38 -3
  753. package/src/utils/sandboxed-process.ts +16 -1
  754. package/src/workflows/checkpoint.ts +16 -18
  755. package/src/workflows/cooldown.ts +6 -3
  756. package/src/workflows/engine.ts +94 -74
  757. package/src/workflows/executors/agent-task.ts +4 -4
  758. package/src/workflows/executors/foreach.ts +12 -12
  759. package/src/workflows/executors/human-in-the-loop.ts +3 -3
  760. package/src/workflows/executors/notify.ts +1 -1
  761. package/src/workflows/executors/swarm-script.ts +16 -15
  762. package/src/workflows/executors/wait.ts +3 -3
  763. package/src/workflows/foreach-join.ts +5 -5
  764. package/src/workflows/index.ts +3 -3
  765. package/src/workflows/input.ts +6 -4
  766. package/src/workflows/patch-definition.ts +72 -0
  767. package/src/workflows/recovery.ts +45 -45
  768. package/src/workflows/resume.ts +159 -98
  769. package/src/workflows/retry-poller.ts +13 -13
  770. package/src/workflows/task-step-routing.ts +98 -14
  771. package/src/workflows/triggers.ts +10 -10
  772. package/src/workflows/version.ts +59 -5
  773. package/src/workflows/wait-poller.ts +1 -1
  774. package/templates/skills/artifacts/config.json +1 -1
  775. package/templates/skills/code-quality/config.json +14 -0
  776. package/templates/skills/code-quality/content.md +61 -0
  777. package/templates/skills/heartbeat-runbook/config.json +14 -0
  778. package/templates/skills/heartbeat-runbook/content.md +59 -0
  779. package/templates/skills/memory/config.json +14 -0
  780. package/templates/skills/memory/content.md +66 -0
  781. package/templates/skills/pages/content.md +4 -2
  782. package/templates/skills/scheduling/config.json +14 -0
  783. package/templates/skills/scheduling/content.md +62 -0
  784. package/templates/skills/slack-interaction/config.json +14 -0
  785. package/templates/skills/slack-interaction/content.md +50 -0
  786. package/templates/skills/swarm-scripts/SKILL.md +93 -109
  787. package/templates/skills/swarm-scripts/config.json +2 -2
  788. package/templates/skills/swarm-scripts/content.md +92 -108
  789. package/dist/cli-2wv4kj0e.js +0 -1182
  790. package/dist/cli-34w2584r.js +0 -530
  791. package/dist/cli-589599p9.js +0 -269
  792. package/dist/cli-qs9hhsvb.js +0 -7206
  793. package/dist/cli-wrrea8xm.js +0 -176
package/README.md CHANGED
@@ -122,7 +122,7 @@ Check [our templates](https://templates.agent-swarm.dev) for a quick start.
122
122
  ## Highlights
123
123
 
124
124
  - **Lead/worker orchestration in Docker** — isolated dev environments, priority queues, pause/resume across deploys, and API-side alerts when claimable work stops being picked up. [Architecture →](https://docs.agent-swarm.dev/docs/architecture/overview)
125
- - **Compounding memory & persistent identity** — agents remember past sessions and evolve their own persona, expertise, and notes, with ratcheting file budgets and visible recovery when local edits exceed prompt limits. [Memory →](https://docs.agent-swarm.dev/docs/architecture/memory) · [Agents →](https://docs.agent-swarm.dev/docs/architecture/agents)
125
+ - **Compounding memory & persistent identity** — agents explicitly capture reusable learnings with `memory-store`, remember past sessions, and evolve their own persona, expertise, and notes, with ratcheting file budgets and visible recovery when local edits exceed prompt limits. [Memory →](https://docs.agent-swarm.dev/docs/architecture/memory) · [Agents →](https://docs.agent-swarm.dev/docs/architecture/agents)
126
126
  - **Hybrid + graph-linked memory recall** — memory retrieval can blend vector and full-text ranking, expand through linked memories, surface usefulness readouts, and let agents correct an existing memory without losing its ID or history. [Memory →](https://docs.agent-swarm.dev/docs/architecture/memory) · [MCP tools →](https://docs.agent-swarm.dev/docs/reference/mcp-tools#memory-tools)
127
127
  - **Multi-channel inputs** — Slack, GitHub, GitLab, email, WhatsApp, Linear, Jira, and the HTTP API all create tasks. [Integrations](#integrations)
128
128
  - **Slack operations and persistent thread trees** — lead agents can create, populate, and archive channels, while conversations can opt in to one editable task tree with streamed outcome cards and explicit Block Kit messages. [Slack guide →](https://docs.agent-swarm.dev/docs/guides/slack-integration)
@@ -131,7 +131,7 @@ Check [our templates](https://templates.agent-swarm.dev) for a quick start.
131
131
  - **Mid-run task steering** — add context at the next turn boundary, request an immediate interrupt where the harness supports it, or degrade safely to a follow-up task. [Task steering →](https://docs.agent-swarm.dev/docs/guides/task-steering)
132
132
  - **Operator configuration UI** — tune non-secret feature flags, limits, integration toggles, and runtime defaults from Settings → Configuration, with source and restart-required indicators. [Configuration →](https://docs.agent-swarm.dev/docs/ui/configuration)
133
133
  - **Asset namespaces** — group tasks, workflows, schedules, pages, apps, scripts, and mapped files under canonical shared or personal keys, with inheritance, subtree filtering, audited moves, and cross-entity discovery. [Asset namespaces →](https://docs.agent-swarm.dev/docs/guides/asset-namespaces)
134
- - **Persistent shared files via agent-fs** — co-deploy agent-fs for shared task attachments, previews, and search; late provisioning or config reloads activate the provider without an API restart, and tenant-authenticated control planes can invite shared-org members without receiving the bootstrap key. [Co-deployment guide →](https://docs.agent-swarm.dev/docs/guides/agent-fs-co-deployment)
134
+ - **Persistent shared files via agent-fs** — co-deploy agent-fs for shared task attachments, previews, and search; `store-progress` verifies attachment pointers before changing task state, late provisioning or config reloads activate the provider without an API restart, and tenant-authenticated control planes can invite shared-org members without receiving the bootstrap key. [Co-deployment guide →](https://docs.agent-swarm.dev/docs/guides/agent-fs-co-deployment)
135
135
  - **Durable script workflows** — launch background script runs, inspect their journals, and track them from the dashboard when a one-shot `script-run` is too small. [Guide →](https://docs.agent-swarm.dev/docs/guides/script-workflow-runs)
136
136
  - **Scripts-only MCP mode (code-mode)** — reduce the external MCP surface to eight script tools while retaining the full swarm SDK through `script-run`, cutting tool-schema context for capable coordinator models. [Guide →](https://docs.agent-swarm.dev/docs/guides/scripts-only-mode)
137
137
  - **Scripts as external APIs** — expose a saved script as a public `POST /api/x/script/<id>` endpoint with optional bearer auth, typed input validation, and per-endpoint usage tracking. [Guide →](https://docs.agent-swarm.dev/docs/guides/scripts-external-apis)
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  resolveSlackUserId
3
- } from "./cli-g0j14czv.js";
4
- import"./cli-589599p9.js";
3
+ } from "./cli-gkfzvf7n.js";
4
+ import"./cli-41wfr4tp.js";
5
5
  import {
6
6
  createTaskWithSiblingAwareness
7
- } from "./cli-wf86d5t7.js";
7
+ } from "./cli-z3h9zvty.js";
8
8
  import {
9
9
  buildCancelledBlocks,
10
10
  ensureSlackThreadTree,
@@ -12,7 +12,7 @@ import {
12
12
  getAgentEmoji,
13
13
  getTaskLink,
14
14
  isSlackRenderV2Enabled
15
- } from "./cli-grt6qv91.js";
15
+ } from "./cli-6ewfzrgz.js";
16
16
  import"./cli-qf9kpsve.js";
17
17
  import"./cli-g2p9bd1z.js";
18
18
  import"./cli-5tnr64pm.js";
@@ -24,16 +24,16 @@ import {
24
24
  init_context_key,
25
25
  init_db,
26
26
  slackContextKey
27
- } from "./cli-m07313tr.js";
28
- import"./cli-34w2584r.js";
29
- import"./cli-2wv4kj0e.js";
27
+ } from "./cli-q46hkq2p.js";
28
+ import"./cli-d2epf5ae.js";
29
+ import"./cli-87zrjxdb.js";
30
30
  import"./cli-a1rrkrb4.js";
31
31
  import"./cli-qt5bt3vk.js";
32
32
  import"./cli-nanaxrz6.js";
33
- import"./cli-1ybr6vw2.js";
34
- import"./cli-jmvk6et8.js";
33
+ import"./cli-s35981d0.js";
34
+ import"./cli-j6fpcrdk.js";
35
35
  import"./cli-mkq1rk7b.js";
36
- import"./cli-ghexzd2d.js";
36
+ import"./cli-pqv5gvyf.js";
37
37
  import"./cli-qntkxysp.js";
38
38
  import"./cli-497b685t.js";
39
39
  import"./cli-pq2ee5ja.js";
@@ -93,15 +93,15 @@ function registerActionHandlers(app) {
93
93
  const followUpText = view.state.values.follow_up_input?.follow_up_text?.value || "";
94
94
  if (!taskId || !followUpText)
95
95
  return;
96
- const originalTask = getTaskById(taskId);
96
+ const originalTask = await getTaskById(taskId);
97
97
  if (!originalTask || !originalTask.slackChannelId)
98
98
  return;
99
- const lead = getLeadAgent();
99
+ const lead = await getLeadAgent();
100
100
  const requestedByUserId = await resolveSlackUserId(client, body.user.id, {
101
101
  sampleEventType: "view_submission",
102
102
  sampleContext: view.callback_id || "follow_up_submit"
103
103
  });
104
- const followUpTask = createTaskWithSiblingAwareness(followUpText, {
104
+ const followUpTask = await createTaskWithSiblingAwareness(followUpText, {
105
105
  agentId: lead?.id,
106
106
  source: "slack",
107
107
  parentTaskId: taskId,
@@ -140,15 +140,15 @@ function registerActionHandlers(app) {
140
140
  const taskId = action.value;
141
141
  if (!taskId)
142
142
  return;
143
- const task = getTaskById(taskId);
143
+ const task = await getTaskById(taskId);
144
144
  if (!task)
145
145
  return;
146
- const cancelled = cancelTask(taskId, "Cancelled via Slack");
146
+ const cancelled = await cancelTask(taskId, "Cancelled via Slack");
147
147
  if (!cancelled) {
148
148
  return;
149
149
  }
150
150
  if (task.slackChannelId && task.agentId) {
151
- const agent = getAgentById(task.agentId);
151
+ const agent = await getAgentById(task.agentId);
152
152
  const agentName = agent?.name || "Unknown";
153
153
  const blocks = buildCancelledBlocks({ agentName, taskId: task.id });
154
154
  try {
@@ -3,20 +3,20 @@ import {
3
3
  initSlackApp,
4
4
  startSlackApp,
5
5
  stopSlackApp
6
- } from "./cli-grt6qv91.js";
6
+ } from "./cli-6ewfzrgz.js";
7
7
  import"./cli-qf9kpsve.js";
8
8
  import"./cli-g2p9bd1z.js";
9
9
  import"./cli-5tnr64pm.js";
10
- import"./cli-m07313tr.js";
11
- import"./cli-34w2584r.js";
12
- import"./cli-2wv4kj0e.js";
10
+ import"./cli-q46hkq2p.js";
11
+ import"./cli-d2epf5ae.js";
12
+ import"./cli-87zrjxdb.js";
13
13
  import"./cli-a1rrkrb4.js";
14
14
  import"./cli-qt5bt3vk.js";
15
15
  import"./cli-nanaxrz6.js";
16
- import"./cli-1ybr6vw2.js";
17
- import"./cli-jmvk6et8.js";
16
+ import"./cli-s35981d0.js";
17
+ import"./cli-j6fpcrdk.js";
18
18
  import"./cli-mkq1rk7b.js";
19
- import"./cli-ghexzd2d.js";
19
+ import"./cli-pqv5gvyf.js";
20
20
  import"./cli-qntkxysp.js";
21
21
  import"./cli-497b685t.js";
22
22
  import"./cli-pq2ee5ja.js";
@@ -3645,7 +3645,7 @@ function createArtifactServer(opts) {
3645
3645
  tunnel = null;
3646
3646
  }
3647
3647
  if (server) {
3648
- server.stop();
3648
+ await server.stop(true);
3649
3649
  server = null;
3650
3650
  }
3651
3651
  }
@@ -2,24 +2,24 @@ import {
2
2
  bufferThreadMessage,
3
3
  getBufferMessageCount,
4
4
  wasEventSeen
5
- } from "./cli-aw8bb6sf.js";
5
+ } from "./cli-dntm4d6r.js";
6
6
  import {
7
7
  hasOtherUserMention
8
- } from "./cli-6x363v1z.js";
8
+ } from "./cli-x0mnesvr.js";
9
9
  import {
10
10
  resolveSlackUserId,
11
11
  rewriteSlackMentions
12
- } from "./cli-g0j14czv.js";
13
- import"./cli-589599p9.js";
12
+ } from "./cli-gkfzvf7n.js";
13
+ import"./cli-41wfr4tp.js";
14
14
  import {
15
15
  createTaskWithSiblingAwareness
16
- } from "./cli-wf86d5t7.js";
16
+ } from "./cli-z3h9zvty.js";
17
17
  import {
18
18
  ackSlackMessage,
19
19
  ensureSlackThreadTree,
20
20
  isSlackRenderV2Enabled,
21
21
  require_dist
22
- } from "./cli-grt6qv91.js";
22
+ } from "./cli-6ewfzrgz.js";
23
23
  import"./cli-qf9kpsve.js";
24
24
  import"./cli-g2p9bd1z.js";
25
25
  import"./cli-5tnr64pm.js";
@@ -30,22 +30,22 @@ import {
30
30
  init_context_key,
31
31
  init_db,
32
32
  slackContextKey
33
- } from "./cli-m07313tr.js";
34
- import"./cli-34w2584r.js";
33
+ } from "./cli-q46hkq2p.js";
34
+ import"./cli-d2epf5ae.js";
35
35
  import {
36
36
  init_resolver,
37
37
  resolveTemplate
38
- } from "./cli-2wv4kj0e.js";
38
+ } from "./cli-87zrjxdb.js";
39
39
  import"./cli-a1rrkrb4.js";
40
40
  import"./cli-qt5bt3vk.js";
41
41
  import {
42
42
  init_env_flag,
43
43
  isEnvFlagEnabled
44
44
  } from "./cli-nanaxrz6.js";
45
- import"./cli-1ybr6vw2.js";
46
- import"./cli-jmvk6et8.js";
45
+ import"./cli-s35981d0.js";
46
+ import"./cli-j6fpcrdk.js";
47
47
  import"./cli-mkq1rk7b.js";
48
- import"./cli-ghexzd2d.js";
48
+ import"./cli-pqv5gvyf.js";
49
49
  import"./cli-qntkxysp.js";
50
50
  import"./cli-497b685t.js";
51
51
  import {
@@ -110,7 +110,7 @@ function createAssistant() {
110
110
  const channelId = message.channel;
111
111
  const messageText = msg.text || "";
112
112
  const userId = msg.user || "";
113
- const renderedMessageText = rewriteSlackMentions(messageText);
113
+ const renderedMessageText = await rewriteSlackMentions(messageText);
114
114
  if (!cachedBotUserId) {
115
115
  try {
116
116
  const authResult = await client.auth.test();
@@ -130,7 +130,7 @@ function createAssistant() {
130
130
  sampleEventType: "assistant_message",
131
131
  sampleContext: messageText
132
132
  }) : undefined;
133
- const workingAgent = getAgentWorkingOnThread(channelId, threadTs);
133
+ const workingAgent = await getAgentWorkingOnThread(channelId, threadTs);
134
134
  if (workingAgent && workingAgent.status !== "offline") {
135
135
  if (isAdditiveSlack()) {
136
136
  bufferThreadMessage(channelId, threadTs, messageText, userId, message.ts);
@@ -139,8 +139,8 @@ function createAssistant() {
139
139
  await safeSetStatus("Queuing follow-up...");
140
140
  return;
141
141
  }
142
- const latestTask = getMostRecentTaskInThread(channelId, threadTs);
143
- const task2 = createTaskWithSiblingAwareness(renderedMessageText, {
142
+ const latestTask = await getMostRecentTaskInThread(channelId, threadTs);
143
+ const task2 = await createTaskWithSiblingAwareness(renderedMessageText, {
144
144
  agentId: workingAgent.id,
145
145
  source: "slack",
146
146
  slackChannelId: channelId,
@@ -166,9 +166,9 @@ function createAssistant() {
166
166
  const channelContext = ctx && typeof ctx === "object" && "channel_id" in ctx && ctx.channel_id ? `
167
167
 
168
168
  [User is viewing channel <#${ctx.channel_id}>]` : "";
169
- const lead = getLeadAgent();
169
+ const lead = await getLeadAgent();
170
170
  if (!lead) {
171
- const task2 = createTaskWithSiblingAwareness(renderedMessageText + channelContext, {
171
+ const task2 = await createTaskWithSiblingAwareness(renderedMessageText + channelContext, {
172
172
  source: "slack",
173
173
  slackChannelId: channelId,
174
174
  slackThreadTs: threadTs,
@@ -186,7 +186,7 @@ function createAssistant() {
186
186
  }
187
187
  return;
188
188
  }
189
- const task = createTaskWithSiblingAwareness(renderedMessageText + channelContext, {
189
+ const task = await createTaskWithSiblingAwareness(renderedMessageText + channelContext, {
190
190
  agentId: lead.id,
191
191
  source: "slack",
192
192
  slackChannelId: channelId,
@@ -1,6 +1,3 @@
1
- import {
2
- AzureOpenAI
3
- } from "./cli-qs9hhsvb.js";
4
1
  import {
5
2
  convertResponsesMessages,
6
3
  convertResponsesTools,
@@ -13,6 +10,10 @@ import"./cli-5m9j2spm.js";
13
10
  import {
14
11
  retryProviderRequest
15
12
  } from "./cli-s8s499xy.js";
13
+ import {
14
+ AzureOpenAI,
15
+ init_openai
16
+ } from "./cli-vsap7a8d.js";
16
17
  import {
17
18
  formatProviderError,
18
19
  normalizeProviderError
@@ -38,6 +39,7 @@ import {
38
39
  import"./cli-pq2ee5ja.js";
39
40
 
40
41
  // node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.js
42
+ init_openai();
41
43
  var DEFAULT_AZURE_API_VERSION = "v1";
42
44
  var AZURE_TOOL_CALL_PROVIDERS = new Set(["openai", "openai-codex", "opencode", "azure-openai-responses"]);
43
45
  var OPENAI_RESPONSES_MIN_OUTPUT_TOKENS = 16;
@@ -1,22 +1,23 @@
1
1
  import {
2
2
  embedScript,
3
3
  embeddingProvider
4
- } from "./cli-rh6f3s9n.js";
5
- import"./cli-38taxznr.js";
6
- import"./cli-492e7ap5.js";
4
+ } from "./cli-9nrnc45k.js";
5
+ import"./cli-zg86g3q8.js";
6
+ import"./cli-dr5tcz68.js";
7
+ import"./cli-vsap7a8d.js";
7
8
  import {
8
- getDb,
9
+ getDbClient,
9
10
  init_db
10
- } from "./cli-m07313tr.js";
11
- import"./cli-34w2584r.js";
12
- import"./cli-2wv4kj0e.js";
11
+ } from "./cli-q46hkq2p.js";
12
+ import"./cli-d2epf5ae.js";
13
+ import"./cli-87zrjxdb.js";
13
14
  import"./cli-a1rrkrb4.js";
14
15
  import"./cli-qt5bt3vk.js";
15
16
  import"./cli-nanaxrz6.js";
16
- import"./cli-1ybr6vw2.js";
17
- import"./cli-jmvk6et8.js";
17
+ import"./cli-s35981d0.js";
18
+ import"./cli-j6fpcrdk.js";
18
19
  import"./cli-mkq1rk7b.js";
19
- import"./cli-ghexzd2d.js";
20
+ import"./cli-pqv5gvyf.js";
20
21
  import"./cli-pq2ee5ja.js";
21
22
 
22
23
  // src/be/scripts/boot-reembed.ts
@@ -31,15 +32,14 @@ function toScriptRecord(row) {
31
32
  };
32
33
  }
33
34
  async function runBootReembedScripts() {
34
- const db = getDb();
35
35
  const provider = embeddingProvider();
36
36
  const expectedBytes = provider.dimensions * Float32Array.BYTES_PER_ELEMENT;
37
- const missing = db.prepare(`SELECT s.* FROM scripts s
38
- LEFT JOIN script_embeddings e ON e.scriptId = s.id
39
- WHERE s.isScratch = 0 AND e.scriptId IS NULL`).all();
40
- const wrongDim = db.prepare(`SELECT s.* FROM scripts s
41
- JOIN script_embeddings e ON e.scriptId = s.id
42
- WHERE s.isScratch = 0 AND length(e.embedding) != ${expectedBytes}`).all();
37
+ const missing = await getDbClient().query(`SELECT s.* FROM scripts s
38
+ LEFT JOIN script_embeddings e ON e.scriptId = s.id
39
+ WHERE s.isScratch = 0 AND e.scriptId IS NULL`);
40
+ const wrongDim = await getDbClient().query(`SELECT s.* FROM scripts s
41
+ JOIN script_embeddings e ON e.scriptId = s.id
42
+ WHERE s.isScratch = 0 AND length(e.embedding) != ${expectedBytes}`);
43
43
  if (missing.length === 0 && wrongDim.length === 0) {
44
44
  return;
45
45
  }
@@ -65,8 +65,8 @@ async function runBootReembedScripts() {
65
65
  console.error(`[boot-reembed-scripts] failed to embed "${row.name}":`, err.message);
66
66
  }
67
67
  }
68
- const afterWrongDim = db.prepare(`SELECT COUNT(*) as count FROM script_embeddings
69
- WHERE length(embedding) != ${expectedBytes}`).get()?.count ?? 0;
68
+ const afterWrongDim = (await getDbClient().get(`SELECT COUNT(*) as count FROM script_embeddings
69
+ WHERE length(embedding) != ${expectedBytes}`))?.count ?? 0;
70
70
  console.log(`[boot-reembed-scripts] complete: embedded=${embedded} failed=${failed} remaining_wrong_dim=${afterWrongDim}`);
71
71
  }
72
72
  export {
@@ -3,21 +3,22 @@ import {
3
3
  getEmbeddingProvider,
4
4
  getMemoryStore,
5
5
  init_constants
6
- } from "./cli-38taxznr.js";
7
- import"./cli-492e7ap5.js";
6
+ } from "./cli-zg86g3q8.js";
7
+ import"./cli-dr5tcz68.js";
8
+ import"./cli-vsap7a8d.js";
8
9
  import {
9
- getDb,
10
+ getDbClient,
10
11
  init_db
11
- } from "./cli-m07313tr.js";
12
- import"./cli-34w2584r.js";
13
- import"./cli-2wv4kj0e.js";
12
+ } from "./cli-q46hkq2p.js";
13
+ import"./cli-d2epf5ae.js";
14
+ import"./cli-87zrjxdb.js";
14
15
  import"./cli-a1rrkrb4.js";
15
16
  import"./cli-qt5bt3vk.js";
16
17
  import"./cli-nanaxrz6.js";
17
- import"./cli-1ybr6vw2.js";
18
- import"./cli-jmvk6et8.js";
18
+ import"./cli-s35981d0.js";
19
+ import"./cli-j6fpcrdk.js";
19
20
  import"./cli-mkq1rk7b.js";
20
- import"./cli-ghexzd2d.js";
21
+ import"./cli-pqv5gvyf.js";
21
22
  import"./cli-pq2ee5ja.js";
22
23
 
23
24
  // src/be/memory/boot-reembed.ts
@@ -26,9 +27,8 @@ init_constants();
26
27
  var VECTOR_BYTES = EMBEDDING_DIMENSIONS * Float32Array.BYTES_PER_ELEMENT;
27
28
  var BATCH_SIZE = 20;
28
29
  async function runBootReembed() {
29
- const db = getDb();
30
- const invalidCount = db.prepare(`SELECT COUNT(*) as count FROM agent_memory
31
- WHERE embedding IS NOT NULL AND length(embedding) != ${VECTOR_BYTES}`).get()?.count ?? 0;
30
+ const invalidCount = (await getDbClient().get(`SELECT COUNT(*) as count FROM agent_memory
31
+ WHERE embedding IS NOT NULL AND length(embedding) != ${VECTOR_BYTES}`))?.count ?? 0;
32
32
  if (invalidCount === 0) {
33
33
  return;
34
34
  }
@@ -40,8 +40,8 @@ async function runBootReembed() {
40
40
  }
41
41
  console.log(`[boot-reembed] starting: ${invalidCount} rows with wrong embedding dimensions`);
42
42
  const store = getMemoryStore();
43
- const rows = db.prepare(`SELECT id, content FROM agent_memory
44
- WHERE embedding IS NOT NULL AND length(embedding) != ${VECTOR_BYTES}`).all();
43
+ const rows = await getDbClient().query(`SELECT id, content FROM agent_memory
44
+ WHERE embedding IS NOT NULL AND length(embedding) != ${VECTOR_BYTES}`);
45
45
  let reembedded = 0;
46
46
  let failed = 0;
47
47
  for (let i = 0;i < rows.length; i += BATCH_SIZE) {
@@ -50,7 +50,7 @@ async function runBootReembed() {
50
50
  const embeddings = await provider.embedBatch(batch.map((m) => m.content));
51
51
  for (let j = 0;j < embeddings.length; j++) {
52
52
  if (embeddings[j]) {
53
- store.updateEmbedding(batch[j].id, embeddings[j], provider.name);
53
+ await store.updateEmbedding(batch[j].id, embeddings[j], provider.name);
54
54
  reembedded++;
55
55
  }
56
56
  }
@@ -59,8 +59,8 @@ async function runBootReembed() {
59
59
  console.error(`[boot-reembed] batch ${Math.floor(i / BATCH_SIZE) + 1} failed:`, err.message);
60
60
  }
61
61
  }
62
- const afterInvalid = db.prepare(`SELECT COUNT(*) as count FROM agent_memory
63
- WHERE embedding IS NOT NULL AND length(embedding) != ${VECTOR_BYTES}`).get()?.count ?? 0;
62
+ const afterInvalid = (await getDbClient().get(`SELECT COUNT(*) as count FROM agent_memory
63
+ WHERE embedding IS NOT NULL AND length(embedding) != ${VECTOR_BYTES}`))?.count ?? 0;
64
64
  console.log(`[boot-reembed] complete: reembedded=${reembedded} failed=${failed} remaining_invalid=${afterInvalid}`);
65
65
  }
66
66
  export {
@@ -1,19 +1,19 @@
1
1
  import {
2
- getDb,
2
+ getDbClient,
3
3
  init_db
4
- } from "./cli-m07313tr.js";
5
- import"./cli-34w2584r.js";
6
- import"./cli-2wv4kj0e.js";
4
+ } from "./cli-q46hkq2p.js";
5
+ import"./cli-d2epf5ae.js";
6
+ import"./cli-87zrjxdb.js";
7
7
  import"./cli-a1rrkrb4.js";
8
8
  import"./cli-qt5bt3vk.js";
9
9
  import"./cli-nanaxrz6.js";
10
- import"./cli-1ybr6vw2.js";
11
- import"./cli-jmvk6et8.js";
10
+ import"./cli-s35981d0.js";
11
+ import"./cli-j6fpcrdk.js";
12
12
  import {
13
13
  init_secret_scrubber,
14
14
  scrubSecrets
15
15
  } from "./cli-mkq1rk7b.js";
16
- import"./cli-ghexzd2d.js";
16
+ import"./cli-pqv5gvyf.js";
17
17
  import"./cli-pq2ee5ja.js";
18
18
 
19
19
  // src/be/boot-scrub-logs.ts
@@ -24,64 +24,62 @@ var CURSOR_KEY = "boot-scrub-logs-v2-cursor";
24
24
  var BATCH_SIZE = 200;
25
25
  var yieldTick = () => new Promise((r) => setTimeout(r, 5));
26
26
  async function runBootScrubLogs() {
27
- const db = getDb();
28
- const done = db.prepare("SELECT key FROM seed_state WHERE kind = ? AND key = ?").get("maintenance", SCRUB_KEY);
27
+ const done = await getDbClient().get("SELECT key FROM seed_state WHERE kind = ? AND key = ?", ["maintenance", SCRUB_KEY]);
29
28
  if (done)
30
29
  return;
31
- const savedCursor = db.prepare("SELECT seededHash FROM seed_state WHERE kind = ? AND key = ?").get("maintenance", CURSOR_KEY)?.seededHash ?? "";
30
+ const savedCursor = (await getDbClient().get("SELECT seededHash FROM seed_state WHERE kind = ? AND key = ?", ["maintenance", CURSOR_KEY]))?.seededHash ?? "";
32
31
  const lastProcessedId = savedCursor || "";
33
- const totalRemaining = db.prepare(`SELECT COUNT(*) as count FROM session_logs
32
+ const totalRemaining = (await getDbClient().get(`SELECT COUNT(*) as count FROM session_logs
34
33
  WHERE id > ?
35
34
  AND (content LIKE '%lin!_oauth!_%' ESCAPE '!'
36
35
  OR content LIKE '%lin!_api!_%' ESCAPE '!'
37
36
  OR content LIKE '%npm!_%' ESCAPE '!'
38
- OR content LIKE '%ATATT%')`).get(lastProcessedId)?.count ?? 0;
37
+ OR content LIKE '%ATATT%')`, [lastProcessedId]))?.count ?? 0;
39
38
  if (totalRemaining === 0) {
40
- markDone(db);
39
+ await markDone();
41
40
  return;
42
41
  }
43
42
  console.log(`[boot-scrub-logs] starting: ${totalRemaining} candidate rows remaining` + (lastProcessedId ? ` (resuming from cursor ${lastProcessedId.slice(0, 8)}…)` : ""));
44
- const selectBatch = db.prepare(`SELECT id, content FROM session_logs
45
- WHERE id > ?
46
- AND (content LIKE '%lin!_oauth!_%' ESCAPE '!'
47
- OR content LIKE '%lin!_api!_%' ESCAPE '!'
48
- OR content LIKE '%npm!_%' ESCAPE '!'
49
- OR content LIKE '%ATATT%')
50
- ORDER BY id ASC
51
- LIMIT ${BATCH_SIZE}`);
52
- const update = db.prepare("UPDATE session_logs SET content = ? WHERE id = ?");
53
- const saveCursor = db.prepare(`INSERT INTO seed_state (kind, key, seededHash, seededAt)
43
+ const saveCursorSql = `INSERT INTO seed_state (kind, key, seededHash, seededAt)
54
44
  VALUES ('maintenance', '${CURSOR_KEY}', ?, datetime('now'))
55
- ON CONFLICT (kind, key) DO UPDATE SET seededHash = ?, seededAt = datetime('now')`);
45
+ ON CONFLICT (kind, key) DO UPDATE SET seededHash = ?, seededAt = datetime('now')`;
56
46
  let scrubbed = 0;
57
47
  let scanned = 0;
58
48
  let cursor = lastProcessedId;
59
49
  for (;; ) {
60
- const rows = selectBatch.all(cursor);
50
+ const rows = await getDbClient().query(`SELECT id, content FROM session_logs
51
+ WHERE id > ?
52
+ AND (content LIKE '%lin!_oauth!_%' ESCAPE '!'
53
+ OR content LIKE '%lin!_api!_%' ESCAPE '!'
54
+ OR content LIKE '%npm!_%' ESCAPE '!'
55
+ OR content LIKE '%ATATT%')
56
+ ORDER BY id ASC
57
+ LIMIT ${BATCH_SIZE}`, [cursor]);
61
58
  if (rows.length === 0)
62
59
  break;
63
60
  const batchLastId = rows[rows.length - 1].id;
64
- const tx = db.transaction(() => {
61
+ await getDbClient().transaction(async (tx) => {
65
62
  for (const row of rows) {
66
63
  const cleaned = scrubSecrets(row.content);
67
64
  if (cleaned !== row.content) {
68
- update.run(cleaned, row.id);
65
+ await tx.run("UPDATE session_logs SET content = ? WHERE id = ?", [cleaned, row.id]);
69
66
  scrubbed++;
70
67
  }
71
68
  }
72
- saveCursor.run(batchLastId, batchLastId);
69
+ await tx.run(saveCursorSql, [batchLastId, batchLastId]);
73
70
  });
74
- tx();
75
71
  scanned += rows.length;
76
72
  cursor = batchLastId;
77
73
  await yieldTick();
78
74
  }
79
- markDone(db);
80
- db.run("DELETE FROM seed_state WHERE kind = 'maintenance' AND key = ?", [CURSOR_KEY]);
75
+ await markDone();
76
+ await getDbClient().run("DELETE FROM seed_state WHERE kind = 'maintenance' AND key = ?", [
77
+ CURSOR_KEY
78
+ ]);
81
79
  console.log(`[boot-scrub-logs] complete: scanned=${scanned} scrubbed=${scrubbed}`);
82
80
  }
83
- function markDone(db) {
84
- db.run(`INSERT INTO seed_state (kind, key, seededHash, seededAt)
81
+ async function markDone() {
82
+ await getDbClient().run(`INSERT INTO seed_state (kind, key, seededHash, seededAt)
85
83
  VALUES ('maintenance', ?, 'done', datetime('now'))
86
84
  ON CONFLICT (kind, key) DO UPDATE SET seededHash = 'done', seededAt = datetime('now')`, [SCRUB_KEY]);
87
85
  }
@@ -12,32 +12,32 @@ import {
12
12
  resolveClaudeBinary,
13
13
  resolveClaudeBinaryArgv,
14
14
  resolveClaudeBridgeEnabled
15
- } from "./cli-mp9sg4cg.js";
16
- import"./cli-jxj92gkt.js";
15
+ } from "./cli-pnqdak88.js";
16
+ import"./cli-mgnrknyg.js";
17
17
  import"./cli-a3pkfpqs.js";
18
18
  import"./cli-tng3131n.js";
19
19
  import"./cli-zm7njwzd.js";
20
20
  import"./cli-cw70hymf.js";
21
- import"./cli-4bc8vmhm.js";
22
- import"./cli-yv9dttkh.js";
21
+ import"./cli-y37pxs1m.js";
22
+ import"./cli-hp1n6zq3.js";
23
23
  import"./cli-v1mwc5v2.js";
24
- import"./cli-pt43pdp1.js";
24
+ import"./cli-8p37s71j.js";
25
25
  import"./cli-e7d20cty.js";
26
26
  import"./cli-8whqavk2.js";
27
27
  import"./cli-qh4sqfws.js";
28
28
  import"./cli-3dpj7atn.js";
29
29
  import"./cli-f14fvzag.js";
30
- import"./cli-492e7ap5.js";
30
+ import"./cli-dr5tcz68.js";
31
31
  import"./cli-whrvct19.js";
32
- import"./cli-34w2584r.js";
33
- import"./cli-2wv4kj0e.js";
32
+ import"./cli-d2epf5ae.js";
33
+ import"./cli-87zrjxdb.js";
34
34
  import"./cli-a1rrkrb4.js";
35
35
  import"./cli-qt5bt3vk.js";
36
36
  import"./cli-nanaxrz6.js";
37
- import"./cli-1ybr6vw2.js";
38
- import"./cli-jmvk6et8.js";
37
+ import"./cli-s35981d0.js";
38
+ import"./cli-j6fpcrdk.js";
39
39
  import"./cli-mkq1rk7b.js";
40
- import"./cli-ghexzd2d.js";
40
+ import"./cli-pqv5gvyf.js";
41
41
  import"./cli-darcwax3.js";
42
42
  import"./cli-00w4hbam.js";
43
43
  import"./cli-7jcc9y1r.js";
@@ -3,11 +3,11 @@ import {
3
3
  checkClaudeManagedCredentials,
4
4
  composeManagedUserMessage,
5
5
  normalizeRepoUrl
6
- } from "./cli-gtafvdy0.js";
7
- import"./cli-07er7wrs.js";
6
+ } from "./cli-77vf7z36.js";
7
+ import"./cli-hsxj0yar.js";
8
8
  import"./cli-cw70hymf.js";
9
9
  import"./cli-f64gdfxc.js";
10
- import"./cli-yv9dttkh.js";
10
+ import"./cli-hp1n6zq3.js";
11
11
  import"./cli-jepmgn7r.js";
12
12
  import"./cli-mkq1rk7b.js";
13
13
  import"./cli-pq2ee5ja.js";