@desplega.ai/agent-swarm 2.10.0 → 2.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/acp-adapter-11m13kx4.js +16 -0
- package/dist/{acp-targets-arrwv4f0.js → acp-targets-311gcyvw.js} +9 -9
- package/dist/{actions-y0d2n1c2.js → actions-c4chgxp6.js} +27 -24
- package/dist/{agent-fs-provision-tpj7sktd.js → agent-fs-provision-0b9awm5n.js} +10 -5
- package/dist/{amp-adapter-vmmnmw8d.js → amp-adapter-r0veq6x5.js} +3 -3
- package/dist/{anthropic-messages-zdca3gv1.js → anthropic-messages-88b7s3n9.js} +177 -25
- package/dist/{app-wb7w45dq.js → app-hn5fftf5.js} +7 -6
- package/dist/{approval-notifications-7mqr6vbd.js → approval-notifications-3g6yc8nv.js} +7 -6
- package/dist/{assistant-gf60454p.js → assistant-cpjgpjvp.js} +29 -26
- package/dist/{azure-openai-responses-b3y7fz36.js → azure-openai-responses-jeaas6x0.js} +10 -10
- package/dist/{boot-args-schema-qxmd59sr.js → boot-args-schema-hce1av1h.js} +1 -1
- package/dist/{boot-reembed-5tmeskj2.js → boot-reembed-bztbxc4z.js} +1 -1
- package/dist/{boot-reembed-wb44vc3s.js → boot-reembed-d7xcym0j.js} +1 -1
- package/dist/{boot-scrub-sweep-25bxhnw4.js → boot-scrub-sweep-mkmm16gk.js} +2 -2
- package/dist/{boot-seeds-nj9za0vk.js → boot-seeds-arrkbe8t.js} +4 -4
- package/dist/{boxd-wn235q80.js → boxd-68n75y1s.js} +2 -2
- package/dist/{claude-adapter-d3krpdyb.js → claude-adapter-ykpyr5p8.js} +8 -8
- package/dist/{claude-managed-adapter-t8nfgcgz.js → claude-managed-adapter-ssg6z4bt.js} +4 -4
- package/dist/{claude-managed-setup-7y4pwd81.js → claude-managed-setup-trd59v7b.js} +4 -4
- package/dist/{claude-sdk-session-d138zy0e.js → claude-sdk-session-yjcze0j1.js} +10941 -10412
- package/dist/{cli-vq2eg24x.js → cli-01tvvtad.js} +63 -60
- package/dist/cli-04zc3f7b.js +68 -0
- package/dist/{cli-01k6wpr9.js → cli-0k1a0sde.js} +7 -7
- package/dist/{cli-j6te8keb.js → cli-0pp1yjg2.js} +8 -8
- package/dist/{cli-0b4zam62.js → cli-0vcqcwfn.js} +18 -0
- package/dist/{cli-wwp1bd3n.js → cli-12vek61e.js} +564 -97
- package/dist/{cli-rqx70rcz.js → cli-17qzb39j.js} +5 -2
- package/dist/{cli-124ntmf0.js → cli-1htmtqc2.js} +143 -63
- package/dist/{cli-3f8zbtqa.js → cli-2amwhyv2.js} +15 -11
- package/dist/{cli-7sf9sb0w.js → cli-2m6yaq6b.js} +1 -1
- package/dist/{cli-6cwr32fe.js → cli-2tw284hj.js} +422 -140
- package/dist/{cli-6ehs4mta.js → cli-2z2c4k6q.js} +18 -4
- package/dist/{cli-nstkanmx.js → cli-39qm0rtm.js} +8 -8
- package/dist/{cli-hnamkvnc.js → cli-3p288654.js} +2 -2
- package/dist/{cli-4ymxrwg5.js → cli-4dyzzkfb.js} +2 -2
- package/dist/{cli-3kd08rej.js → cli-4jjrhy48.js} +1 -1
- package/dist/{cli-kxn3747f.js → cli-4se3x6qm.js} +1 -26
- package/dist/cli-52nfye5j.js +673 -0
- package/dist/cli-55tc8cj4.js +252 -0
- package/dist/cli-5r95eqbh.js +186 -0
- package/dist/{cli-6037prsx.js → cli-5tg94mdw.js} +13 -13
- package/dist/{cli-2spnz7ye.js → cli-5x03v6en.js} +11137 -8332
- package/dist/{cli-y4ccxtz5.js → cli-5z0g0e8v.js} +153 -6
- package/dist/{cli-8y43jx2r.js → cli-6p8p2e6r.js} +16 -9
- package/dist/{cli-539h29es.js → cli-72yms3ey.js} +224 -189
- package/dist/{cli-y8p78ekx.js → cli-73q4g5nx.js} +21 -21
- package/dist/{cli-p74md7t8.js → cli-7b7rxz22.js} +13 -15
- package/dist/{cli-43ms35q9.js → cli-7wy8gbwb.js} +3 -3
- package/dist/{cli-7mv4h3sn.js → cli-7yn42w6m.js} +2 -2
- package/dist/{cli-gabsjg8x.js → cli-8hp56wat.js} +3 -2
- package/dist/cli-8mfdbdhe.js +43 -0
- package/dist/{cli-zcfpsfzf.js → cli-96234j5w.js} +3 -3
- package/dist/{cli-1z4qggfe.js → cli-9fvk9mv8.js} +30 -21
- package/dist/{cli-2rnd5j3t.js → cli-9qe5y107.js} +2 -2
- package/dist/{cli-5mpy301f.js → cli-9t7syepg.js} +1 -1
- package/dist/{cli-7cp6aa1q.js → cli-9y4tgrkf.js} +23 -177
- package/dist/{cli-7evph51z.js → cli-a49frv85.js} +2 -2
- package/dist/{cli-3aaeb78m.js → cli-agjbj5x0.js} +95 -10
- package/dist/{cli-th1dkc2v.js → cli-b93d81yg.js} +2 -2
- package/dist/{cli-qj39vrc6.js → cli-bhgrhedp.js} +1 -1
- package/dist/{cli-2xv18ywz.js → cli-bmqp0ser.js} +2 -2
- package/dist/{cli-9fjr27ez.js → cli-bp6k9acz.js} +18 -22
- package/dist/{cli-5a6pqy45.js → cli-bpje8n65.js} +31 -4
- package/dist/{cli-2v2zdm0a.js → cli-bz97ff9n.js} +2 -2
- package/dist/{cli-3caf7pmg.js → cli-c7j31hq9.js} +3 -3
- package/dist/{cli-t9ga4qmb.js → cli-cah298e5.js} +40 -33
- package/dist/{cli-aw83sr40.js → cli-cjqyse9q.js} +3 -3
- package/dist/{cli-b6px1k1q.js → cli-dd2k2mcd.js} +1 -1
- package/dist/{cli-nv4xsvmk.js → cli-dkvtfgn4.js} +7 -7
- package/dist/{cli-7r162fxe.js → cli-e3ahxq5y.js} +23 -17
- package/dist/{cli-3et6fmfe.js → cli-e8n0hdzd.js} +1 -1
- package/dist/{cli-tsa40663.js → cli-ebqx630g.js} +3 -3
- package/dist/{cli-kbtzfrxj.js → cli-en6dmkxd.js} +3 -3
- package/dist/{cli-m9cvf7vs.js → cli-eq4kew31.js} +14 -14
- package/dist/{cli-fcfbct2j.js → cli-eqq0hwvx.js} +5 -5
- package/dist/{cli-7zm3b3f5.js → cli-ercwc8xn.js} +1 -1
- package/dist/{cli-vs9vdpy0.js → cli-ex1y88j3.js} +1 -1
- package/dist/{cli-mk7c5ac4.js → cli-fxd1mwtr.js} +2 -2
- package/dist/{cli-91pkxres.js → cli-fy4gb74g.js} +2 -2
- package/dist/{cli-fq2rr3jb.js → cli-fyaq4zdv.js} +6 -6
- package/dist/{cli-cc93xzes.js → cli-gfy6hbd9.js} +28 -17
- package/dist/{cli-s1khw52h.js → cli-h70a2mxy.js} +71 -17
- package/dist/cli-hbvgzjq4.js +69 -0
- package/dist/{cli-qx4f057j.js → cli-hhc47ack.js} +4 -4
- package/dist/{cli-q5srsxq2.js → cli-j5gtytvg.js} +154 -41
- package/dist/{cli-psffsanb.js → cli-js10kdk7.js} +6 -1
- package/dist/{cli-54vrpgm0.js → cli-k3facve0.js} +8 -5
- package/dist/{cli-vsw91x06.js → cli-k5jx8jya.js} +10 -6
- package/dist/{cli-tr27kwyg.js → cli-krbcr00p.js} +261 -6
- package/dist/{cli-5qhfv9rw.js → cli-kwr5qv5g.js} +44 -17
- package/dist/{cli-md50mj0r.js → cli-m5qtmrbc.js} +3 -3
- package/dist/{cli-vfqvrd82.js → cli-ma9ys8rt.js} +2 -2
- package/dist/{cli-w16kwbzw.js → cli-mbwmqb5w.js} +1 -1
- package/dist/{cli-w1q68d8x.js → cli-mcymtvwn.js} +322 -72
- package/dist/{cli-k3q2va86.js → cli-mq2fbgva.js} +66 -5
- package/dist/{cli-xqdz5cqm.js → cli-mz7ycqn8.js} +1 -0
- package/dist/{cli-kpgcm7xy.js → cli-n85m2wkq.js} +1 -1
- package/dist/{cli-v8z0yga9.js → cli-n8f0fs3c.js} +4 -4
- package/dist/{cli-mys27d03.js → cli-nja15knq.js} +3 -3
- package/dist/{cli-zk7v5s89.js → cli-pe3yxedk.js} +3 -3
- package/dist/{cli-v46zsvqk.js → cli-ph95yejc.js} +2 -2
- package/dist/{cli-6237rnyr.js → cli-pqfecppn.js} +1 -1
- package/dist/{cli-qrta34nb.js → cli-q2dywc8h.js} +4 -4
- package/dist/{cli-k6nejceb.js → cli-q4z9s6zs.js} +2 -2
- package/dist/{cli-s1zqk1aj.js → cli-q8tc22bj.js} +15 -9
- package/dist/{cli-hg42n3hx.js → cli-qrzq3hvg.js} +8 -8
- package/dist/{cli-43evxwj4.js → cli-r0mz92by.js} +9 -4
- package/dist/{cli-jrbq4djp.js → cli-r14ac1y0.js} +1 -1
- package/dist/{cli-5gpqgs8b.js → cli-rtmqzat7.js} +2 -2
- package/dist/{cli-tvgqesec.js → cli-s6zk31gr.js} +4 -4
- package/dist/{cli-6ym4jhzp.js → cli-sv2r3bw8.js} +7 -7
- package/dist/{cli-wafmk3fn.js → cli-t75xngj1.js} +12 -12
- package/dist/{cli-x40a0w9j.js → cli-tdk7jtka.js} +1 -1
- package/dist/{cli-zeh2mhkg.js → cli-tm60vtax.js} +1 -1
- package/dist/cli-tsfkcd4v.js +30 -0
- package/dist/{cli-8st34zhr.js → cli-v9ya390t.js} +57 -19
- package/dist/{cli-zfqg6fzn.js → cli-vbppqvte.js} +3 -3
- package/dist/{cli-p0n7b5rz.js → cli-wvjqaqcp.js} +2907 -151
- package/dist/{cli-sb4426be.js → cli-xf4z5bdn.js} +5 -5
- package/dist/{cli-p0c3vtch.js → cli-xm34qj8m.js} +772 -515
- package/dist/{cli-z0m452jr.js → cli-ya3kf4gs.js} +1 -1
- package/dist/{cli-had1p04a.js → cli-yegz2g06.js} +4 -4
- package/dist/{cli-k5yewqgd.js → cli-yfpc6qy9.js} +3 -3
- package/dist/{cli-q2d3e1k1.js → cli-z4f346g5.js} +1 -1
- package/dist/{cli-yab6sh8p.js → cli-zcghfsdg.js} +23 -4
- package/dist/cli.js +34 -30
- package/dist/{cloudflare-workers-ai-system-one-4aysy6rh.js → cloudflare-workers-ai-system-one-w3m0fbf8.js} +2 -2
- package/dist/{codex-adapter-exfdbj73.js → codex-adapter-wc6e4wct.js} +8 -8
- package/dist/{codex-hook-59atdwd8.js → codex-hook-aqtj17yr.js} +1 -1
- package/dist/{codex-login-a239g1ah.js → codex-login-1ven7yje.js} +1 -1
- package/dist/{codex-session-runner-xhznc4g3.js → codex-session-runner-ppfgjd97.js} +9 -9
- package/dist/{commands-d8g349v4.js → commands-tsv2vx5b.js} +3 -3
- package/dist/{controller-mwgdmb8y.js → controller-ye4sdwsy.js} +4 -4
- package/dist/{controllers-connect-5v7qx04j.js → controllers-connect-zn4dg69h.js} +25 -22
- package/dist/core-dxcy02sc.js +41 -0
- package/dist/{cursor-adapter-p2q5h35d.js → cursor-adapter-q2g9vwts.js} +2 -2
- package/dist/{db-wcw0b2j8.js → db-3r1fyr2n.js} +6 -2
- package/dist/{db-qpganbeb.js → db-g111qn9j.js} +3 -3
- package/dist/{devin-adapter-zp4tqq53.js → devin-adapter-t8d86q9x.js} +1 -1
- package/dist/{dispatcher-8d8s49yz.js → dispatcher-4q8s0mx8.js} +22 -19
- package/dist/{docker-09tkkg0n.js → docker-1b41eysj.js} +51 -14
- package/dist/{dsh-adapter-me0twn13.js → dsh-adapter-mmcw1z5s.js} +2 -2
- package/dist/{e2b-3v1e745x.js → e2b-ew8c5j5v.js} +3 -3
- package/dist/{e2b-sm28k0k3.js → e2b-xm60c8ad.js} +6 -6
- package/dist/{easter-egg-3d-wv7w5ty6.js → easter-egg-3d-04ke6hcp.js} +1 -1
- package/dist/{embedding-space-e48xchqa.js → embedding-space-kcdn52vz.js} +6 -6
- package/dist/{embeddings-tgq2afbq.js → embeddings-jnzcd91a.js} +1 -1
- package/dist/{event-bus-xr83x566.js → event-bus-v4ywhc2p.js} +1 -1
- package/dist/{execute-8rhwrk7f.js → execute-74amghty.js} +8 -4
- package/dist/{external-channel-8bt3j2pm.js → external-channel-v9zgxnxz.js} +2 -2
- package/dist/fx-adapter-0ar6pqm3.js +19 -0
- package/dist/{google-generative-ai-bh0djqjp.js → google-generative-ai-sw77egmr.js} +9 -9
- package/dist/{google-vertex-prjbw8dj.js → google-vertex-rrw93g8h.js} +9 -9
- package/dist/grok-adapter-t6m74fb1.js +19 -0
- package/dist/handlers-9kwcrc4k.js +38 -0
- package/dist/{heartbeat-x0056ra5.js → heartbeat-p8pk1msj.js} +25 -22
- package/dist/{hook-a7vmn2st.js → hook-k1h73zd7.js} +5 -5
- package/dist/{hook-mrd2ayxv.js → hook-p5reemds.js} +8 -8
- package/dist/{http-ym9c5svp.js → http-ms1z5xxy.js} +2549 -224
- package/dist/index-23cdfzr6.js +39 -0
- package/dist/{index-01ns1pkw.js → index-76zzxtzf.js} +1 -1
- package/dist/{index-ny60jcat.js → index-fbkqhvvj.js} +40 -18
- package/dist/index-g7kkjs5b.js +38 -0
- package/dist/{index-x6azjwm8.js → index-gjn6qfgn.js} +1 -1
- package/dist/{index-b5wgnm78.js → index-kdmkfjt7.js} +4 -4
- package/dist/{index-p46tvwtx.js → index-kn63q1gr.js} +28 -25
- package/dist/{index-9myfj74s.js → index-kzdqn3dd.js} +3 -3
- package/dist/{index-4a0670yh.js → index-p2f5xg64.js} +6 -6
- package/dist/index-stk36pa5.js +43 -0
- package/dist/{k8s-m56sw868.js → k8s-fy8hbhkg.js} +73 -14
- package/dist/{keepalive-7yxg8z4c.js → keepalive-031js8jz.js} +4 -4
- package/dist/lead-mfggjtfk.js +77 -0
- package/dist/{llama-cpp-classify-nfgswa1m.js → llama-cpp-classify-yvb8vh7w.js} +2 -2
- package/dist/{maintenance-6tefxmk1.js → maintenance-sq9v3qx9.js} +1 -1
- package/dist/{mistral-conversations-tm2vd4gc.js → mistral-conversations-w4bncwbt.js} +7 -7
- package/dist/{node-7qsx5kvm.js → node-z67yjre7.js} +19 -13
- package/dist/{oauth-refresh-sweep-70cavc3a.js → oauth-refresh-sweep-zqmnyvs8.js} +3 -3
- package/dist/object-webhooks-r24wwb5y.js +21 -0
- package/dist/{onboard-fja65z08.js → onboard-p25yhh7t.js} +5 -5
- package/dist/{openai-codex-responses-sxjv60xx.js → openai-codex-responses-70g39cgz.js} +20 -14
- package/dist/{openai-completions-0c7qnhsx.js → openai-completions-cv3hp4h5.js} +18 -11
- package/dist/{openai-decisions-ytp6w6xh.js → openai-decisions-fyq1p9f9.js} +2 -2
- package/dist/{openai-responses-a7h29chp.js → openai-responses-trsvnks6.js} +13 -11
- package/dist/{opencode-adapter-hakkm7yh.js → opencode-adapter-wcjc4zdk.js} +7 -7
- package/dist/{openrouter-images-xr9gme9x.js → openrouter-images-0jj12a2q.js} +6 -6
- package/dist/{otel-impl-7zhnt6gj.js → otel-impl-ff1gf20m.js} +2 -2
- package/dist/{pending-h01yzpx4.js → pending-hxj5yatb.js} +23 -20
- package/dist/{pi-messages-2j0fpqwq.js → pi-messages-zk3g4esn.js} +1 -1
- package/dist/{pi-mono-adapter-f52hz743.js → pi-mono-adapter-vkp4zz7p.js} +19 -18
- package/dist/{pricing-refresh-fzxvk2zf.js → pricing-refresh-9w7gx41w.js} +2 -2
- package/dist/{rbac-roles-9v6vhgbs.js → rbac-roles-84aw10nz.js} +3 -3
- package/dist/{rbac-roles-hfgh8sba.js → rbac-roles-hz74vckp.js} +2 -2
- package/dist/{registry-32b1mft6.js → registry-eeyx1201.js} +1 -1
- package/dist/{render-v2-1rgspxzf.js → render-v2-nrdkg9gf.js} +7 -6
- package/dist/{resume-tqy61x24.js → resume-s6ey36rh.js} +9 -8
- package/dist/{runtime-exkxyx5f.js → runtime-x0b4pyam.js} +2 -2
- package/dist/{session-access-3act7vt4.js → session-access-xv49tk14.js} +4 -4
- package/dist/{session-source-backfill-82qe7fqq.js → session-source-backfill-r5j988ah.js} +3 -3
- package/dist/{setup-ry1vfdef.js → setup-mj0krk1p.js} +1 -1
- package/dist/thread-buffer-temgaqsy.js +41 -0
- package/dist/tree-visibility-cbrsfaar.js +24 -0
- package/dist/{typesafe-system-one-vcfj2ak8.js → typesafe-system-one-qkvkgrcz.js} +2 -2
- package/dist/{user-merge-jobs-bx6bf7db.js → user-merge-jobs-f9d8nwnw.js} +3 -3
- package/dist/{virtual-modules-s0rjzcqq.js → virtual-modules-ns0ryw05.js} +32 -10
- package/dist/{work-objects-z2e5tv03.js → work-objects-pydhzast.js} +25 -22
- package/dist/worker-efcemc22.js +77 -0
- package/dist/{worker-follow-up-y3xeg89w.js → worker-follow-up-9z2xec5e.js} +22 -19
- package/dist/{x-wg164ss9.js → x-3dtaf2r9.js} +2 -2
- package/openapi.json +2040 -559
- package/package.json +15 -11
- package/src/azure-devops/auth.ts +2 -3
- package/src/be/agent-fs-identity.ts +46 -0
- package/src/be/agent-history.ts +215 -0
- package/src/be/db/agents.ts +34 -12
- package/src/be/db/request-composition.ts +190 -0
- package/src/be/db/runtime.ts +15 -0
- package/src/be/db/slack-trees.ts +220 -10
- package/src/be/db/tasks/human-free.ts +3 -2
- package/src/be/db/tasks/write.ts +2 -2
- package/src/be/db/workflow-run-retention.ts +101 -0
- package/src/be/db-client.ts +23 -1
- package/src/be/db-retention-defaults.ts +46 -0
- package/src/be/db-retention.ts +55 -6
- package/src/be/db.ts +2 -0
- package/src/be/mcp-events/catalog.ts +108 -0
- package/src/be/mcp-events/dispatcher.ts +202 -0
- package/src/be/mcp-events/protocol.ts +296 -0
- package/src/be/mcp-events/store.ts +231 -0
- package/src/be/mcp-events/webhook.ts +226 -0
- package/src/be/memory/providers/sqlite-store.ts +110 -24
- package/src/be/memory/review-recall-filter.ts +22 -0
- package/src/be/memory/search-candidates.ts +5 -7
- package/src/be/memory/types.ts +5 -0
- package/src/be/migrations/322_runtime_pool_workspace.sql +8 -0
- package/src/be/migrations/323_slack_task_tree_visibility.sql +9 -0
- package/src/be/migrations/326_slack_reconcile_pages.sql +13 -0
- package/src/be/migrations/327_mcp_event_subscriptions.sql +57 -0
- package/src/be/migrations/329_workflow_run_retention.sql +9 -0
- package/src/be/migrations/330_request_composition.sql +22 -0
- package/src/be/migrations/332_primitive_objects.sql +31 -0
- package/src/be/migrations/334_agent_history.sql +23 -0
- package/src/be/migrations/335_primitive_object_webhooks.sql +36 -0
- package/src/be/model-profile-check.ts +1 -1
- package/src/be/multi-runtime.ts +32 -4
- package/src/be/primitives/boards/elements.ts +717 -0
- package/src/be/primitives/boards/excalifont-metrics.json +516 -0
- package/src/be/primitives/boards/service.ts +121 -0
- package/src/be/primitives/object-webhooks.ts +348 -0
- package/src/be/primitives/objects.ts +686 -0
- package/src/be/primitives/sheets/a1.ts +136 -0
- package/src/be/primitives/sheets/engine-worker.ts +194 -0
- package/src/be/primitives/sheets/engine.ts +199 -0
- package/src/be/primitives/sheets/format.ts +106 -0
- package/src/be/primitives/sheets/service.ts +415 -0
- package/src/be/primitives/write-object.ts +83 -0
- package/src/be/runtime-pools/controllers.ts +18 -3
- package/src/be/runtime-pools/db.ts +15 -4
- package/src/be/runtime-pools/supervisor.ts +42 -2
- package/src/be/script-credential-broker.ts +8 -27
- package/src/be/scripts/typecheck.ts +216 -0
- package/src/be/seed/agent-fs-provision.ts +18 -0
- package/src/be/swarm-config-guard.ts +10 -2
- package/src/be/users.ts +19 -0
- package/src/commands/context-preamble.ts +11 -4
- package/src/commands/credential-outcome-report.ts +33 -9
- package/src/commands/e2b-stack-wizard.tsx +12 -6
- package/src/commands/onboard/agent-fs-version.ts +1 -1
- package/src/commands/onboard/steps/harness.tsx +1 -1
- package/src/commands/provider-credentials.ts +1 -0
- package/src/commands/runner.ts +116 -12
- package/src/e2b/env.ts +3 -1
- package/src/extensions/catalog.generated.json +1 -1
- package/src/fs/agent-fs-provider.ts +33 -2
- package/src/github/app.ts +59 -14
- package/src/gitlab/auth.ts +3 -4
- package/src/heartbeat/heartbeat.ts +11 -11
- package/src/http/agent-lifecycle.ts +152 -0
- package/src/http/agents.ts +12 -0
- package/src/http/all-routes.ts +4 -0
- package/src/http/auth.ts +2 -1
- package/src/http/config.ts +2 -1
- package/src/http/core.ts +2 -0
- package/src/http/github-token.ts +66 -0
- package/src/http/index.ts +36 -0
- package/src/http/mcp-user.ts +11 -8
- package/src/http/mcp.ts +58 -42
- package/src/http/object-webhooks.ts +101 -0
- package/src/http/operator-actor.ts +2 -1
- package/src/http/prompt-templates.ts +1 -0
- package/src/http/request-composition.ts +310 -0
- package/src/http/sessions.ts +7 -0
- package/src/http/tasks.ts +6 -1
- package/src/http/tool-schema-estimate.ts +95 -0
- package/src/http/workflows.ts +61 -11
- package/src/integrations/chat-sdk/inbound.ts +2 -2
- package/src/integrations/chat-sdk/outbound-files.ts +3 -2
- package/src/prompts/base-prompt.ts +133 -7
- package/src/prompts/resolver.ts +41 -2
- package/src/providers/acp-targets.ts +2 -2
- package/src/providers/amp-adapter.ts +1 -1
- package/src/providers/opencode-adapter.ts +76 -2
- package/src/providers/opencode-swarm-plugin.ts +22 -3
- package/src/providers/pi-mono-adapter.ts +1 -0
- package/src/providers/pi-mono-extension.ts +71 -0
- package/src/providers/pricing-sources.md +4 -0
- package/src/providers/request-composition-hook.ts +312 -0
- package/src/providers/types.ts +5 -0
- package/src/rbac/legacy-policy.ts +2 -0
- package/src/rbac/permissions.ts +5 -0
- package/src/runtime-providers/controller-protocol.ts +7 -0
- package/src/runtime-providers/docker.ts +80 -12
- package/src/runtime-providers/k8s.ts +111 -6
- package/src/runtime-providers/types.ts +17 -0
- package/src/scheduler/scheduler.ts +1 -1
- package/src/script-workflows/guest-ctx.ts +32 -0
- package/src/script-workflows/workflow-ctx.ts +2 -0
- package/src/scripts-runtime/ctx.ts +9 -1
- package/src/scripts-runtime/executors/native.ts +106 -21
- package/src/scripts-runtime/executors/quickjs-prelude.ts +9 -2
- package/src/scripts-runtime/executors/quickjs-runner.ts +12 -1
- package/src/scripts-runtime/sdk-allowlist.ts +88 -0
- package/src/scripts-runtime/swarm-sdk.ts +51 -3
- package/src/scripts-runtime/types/stdlib.d.ts +267 -0
- package/src/scripts-runtime/types/swarm-sdk.d.ts +267 -0
- package/src/server-user.ts +16 -1
- package/src/server.ts +48 -0
- package/src/slack/ack.ts +10 -5
- package/src/slack/actions.ts +3 -3
- package/src/slack/app.ts +2 -0
- package/src/slack/assistant.ts +4 -4
- package/src/slack/blocks.ts +3 -3
- package/src/slack/handlers.ts +3 -3
- package/src/slack/reaction-shortcode.ts +23 -2
- package/src/slack/render-v2.ts +297 -200
- package/src/slack/responses.ts +7 -5
- package/src/slack/thread-buffer.ts +3 -3
- package/src/slack/tree-visibility.ts +64 -0
- package/src/tasks/worker-follow-up.ts +127 -17
- package/src/tests/agent-history.test.ts +313 -0
- package/src/tests/azure-devops-auth.test.ts +6 -0
- package/src/tests/azure-devops-outbound.test.ts +47 -14
- package/src/tests/base-prompt.test.ts +149 -1
- package/src/tests/chat-sdk-outbound-files.test.ts +3 -1
- package/src/tests/check-playwright-version.test.ts +33 -0
- package/src/tests/check-unit-test-allowlist.test.ts +193 -0
- package/src/tests/context-preamble-budget.test.ts +65 -0
- package/src/tests/credential-check.test.ts +12 -0
- package/src/tests/credential-outcome-report.test.ts +81 -1
- package/src/tests/db-client.test.ts +22 -0
- package/src/tests/db-retention-defaults.test.ts +244 -0
- package/src/tests/db-retention.test.ts +2 -1
- package/src/tests/db-task-read-contract.test.ts +2 -0
- package/src/tests/db-task-write-contract.test.ts +2 -0
- package/src/tests/deploy-release-dispatch.test.ts +332 -0
- package/src/tests/e2b-stack-wizard.test.tsx +156 -0
- package/src/tests/e2e-coverage-contract.test.ts +6 -2
- package/src/tests/e2e-diff-coverage.test.ts +154 -0
- package/src/tests/e2e-rerun-quarantine.test.ts +180 -0
- package/src/tests/e2e-shards.test.ts +137 -0
- package/src/tests/e2e-tracker-ingest.test.ts +266 -0
- package/src/tests/entrypoint-chown-no-follow.test.ts +69 -0
- package/src/tests/entrypoint-repo-clone-target.test.ts +112 -0
- package/src/tests/env-flag.test.ts +4 -2
- package/src/tests/event-loop-lag.test.ts +12 -18
- package/src/tests/extensions-example-slack-reply-gate.test.ts +15 -0
- package/src/tests/extensions-heartbeat.test.ts +34 -0
- package/src/tests/fixtures/base-prompt-baseline-cases.ts +78 -0
- package/src/tests/fixtures/base-prompt-baseline.json +18 -0
- package/src/tests/github-app-worker-auth-helper.test.ts +325 -0
- package/src/tests/github-installation-token-route.test.ts +199 -0
- package/src/tests/gitlab-auth.test.ts +10 -0
- package/src/tests/heartbeat.test.ts +38 -0
- package/src/tests/http-api-integration.test.ts +0 -6
- package/src/tests/mcp-user-events.test.ts +708 -0
- package/src/tests/memory-key-paths.test.ts +4 -1
- package/src/tests/memory-search-stall.test.ts +421 -0
- package/src/tests/migration-322-runtime-pool-workspace.test.ts +116 -0
- package/src/tests/migration-329-workflow-run-retention.test.ts +32 -0
- package/src/tests/model-profile-fallbacks.test.ts +236 -2
- package/src/tests/opencode-adapter.test.ts +97 -0
- package/src/tests/pi-mono-extension.test.ts +168 -0
- package/src/tests/preload-env.test.ts +61 -1
- package/src/tests/preload.ts +22 -0
- package/src/tests/primitives-boards.test.ts +686 -0
- package/src/tests/primitives-object-webhooks.test.ts +642 -0
- package/src/tests/primitives-objects.test.ts +248 -0
- package/src/tests/prompt-template-resolver.test.ts +85 -0
- package/src/tests/reasoning-kind-ui-parity.test.ts +112 -0
- package/src/tests/reload-config.test.ts +45 -0
- package/src/tests/request-composition.test.ts +447 -0
- package/src/tests/runner-max-concurrent.test.ts +86 -0
- package/src/tests/runtime-pools-db.test.ts +80 -0
- package/src/tests/runtime-provider-registration.test.ts +8 -0
- package/src/tests/runtime-providers-docker.test.ts +192 -1
- package/src/tests/runtime-providers-k8s.test.ts +127 -0
- package/src/tests/runtime-remote-controller.test.ts +64 -1
- package/src/tests/runtime-supervisor.test.ts +101 -0
- package/src/tests/script-connections.test.ts +8 -0
- package/src/tests/script-native-sandbox-identity.test.ts +264 -0
- package/src/tests/scripts-namespaces.test.ts +211 -0
- package/src/tests/secret-scrub-gate.test.ts +1 -0
- package/src/tests/secret-scrubber-convex.test.ts +168 -0
- package/src/tests/secret-scrubber.test.ts +1 -1
- package/src/tests/session-tokens.test.ts +27 -0
- package/src/tests/sheet-engine.test.ts +58 -0
- package/src/tests/slack-blocks.test.ts +18 -0
- package/src/tests/slack-empty-icon-config.test.ts +113 -0
- package/src/tests/slack-file-tools-attachments.test.ts +74 -6
- package/src/tests/slack-reaction-config.test.ts +38 -2
- package/src/tests/slack-read-boundaries.test.ts +4 -2
- package/src/tests/slack-render-v2-query-plans.test.ts +100 -1
- package/src/tests/slack-render-v2-reconcile.test.ts +75 -4
- package/src/tests/slack-render-v2.test.ts +683 -11
- package/src/tests/swarm-config-reserved-keys.test.ts +1 -0
- package/src/tests/task-session-prompts.test.ts +37 -0
- package/src/tests/task-start-after-commit.test.ts +82 -0
- package/src/tests/ui-logs-parser.test.ts +67 -0
- package/src/tests/user-delete-perf.test.ts +36 -9
- package/src/tests/webhook-filter.test.ts +327 -0
- package/src/tests/workflow-async-v2.test.ts +19 -16
- package/src/tests/workflow-e2e.test.ts +1 -9
- package/src/tests/workflow-finalization-races.test.ts +553 -0
- package/src/tests/workflow-foreach.test.ts +2 -0
- package/src/tests/workflow-hitl-routing.test.ts +26 -20
- package/src/tests/workflow-http-v2.test.ts +105 -2
- package/src/tests/workflow-idempotency.test.ts +41 -0
- package/src/tests/workflow-mcp-webhook-filter.test.ts +214 -0
- package/src/tests/workflow-parallel-park.test.ts +297 -0
- package/src/tests/workflow-retry-v2.test.ts +158 -21
- package/src/tests/workflow-retry-validation.test.ts +13 -13
- package/src/tests/workflow-runs-retention.test.ts +533 -0
- package/src/tests/workflow-script-principal.test.ts +7 -2
- package/src/tests/workflow-tla-races.test.ts +36 -2
- package/src/tests/workflow-triggers-v2.test.ts +201 -0
- package/src/tests/workflow-wait-builtin-events.test.ts +3 -1
- package/src/tests/workflow-wait-event.test.ts +28 -2
- package/src/tests/workflow-wait-poller.test.ts +94 -0
- package/src/tests/workflow-wait-time.test.ts +7 -3
- package/src/tests/workflow-wait.ts +44 -0
- package/src/tools/boards.ts +260 -0
- package/src/tools/objects.ts +191 -0
- package/src/tools/sheets.ts +312 -0
- package/src/tools/slack-read.ts +10 -3
- package/src/tools/tool-config.ts +23 -0
- package/src/tools/workflows/create-workflow.ts +18 -4
- package/src/tools/workflows/patch-workflow-node.ts +4 -0
- package/src/tools/workflows/patch-workflow.ts +4 -0
- package/src/tools/workflows/update-workflow.ts +24 -3
- package/src/types.ts +216 -2
- package/src/utils/credentials.ts +7 -0
- package/src/utils/sandboxed-process.ts +47 -2
- package/src/utils/secret-scrubber.ts +61 -6
- package/src/workflows/checkpoint.ts +18 -0
- package/src/workflows/engine.ts +73 -31
- package/src/workflows/foreach-driver.ts +42 -4
- package/src/workflows/input.ts +29 -1
- package/src/workflows/patch-definition.ts +15 -1
- package/src/workflows/recovery.ts +6 -1
- package/src/workflows/resume.ts +11 -3
- package/src/workflows/retry-poller.ts +32 -6
- package/src/workflows/successor-routing.ts +108 -0
- package/src/workflows/task-step-routing.ts +5 -2
- package/src/workflows/triggers.ts +21 -36
- package/src/workflows/validation.ts +10 -0
- package/src/workflows/wait-poller.ts +6 -2
- package/src/workflows/webhook-filter.ts +203 -0
- package/templates/ai-toolbox.manifest.json +1 -1
- package/templates/extensions/slack-reply-gate/hooks.ts +8 -4
- package/templates/skills/agent-browser/SKILL.md +1 -0
- package/templates/skills/agent-browser/content.md +1 -0
- package/templates/skills/pages/content.md +5 -0
- package/templates/skills/swarm-docs/content.md +8 -1
- package/templates/skills/swarm-scripts/SKILL.md +1 -0
- package/templates/skills/swarm-scripts/content.md +1 -0
- package/templates/skills/tdd-planning/content.md +5 -2
- package/dist/acp-adapter-bht22g3k.js +0 -16
- package/dist/core-sxy4epp2.js +0 -38
- package/dist/fx-adapter-adtdb3jb.js +0 -19
- package/dist/grok-adapter-accnn9km.js +0 -19
- package/dist/handlers-1x77561e.js +0 -35
- package/dist/index-48qzcqzj.js +0 -35
- package/dist/index-rkvaambe.js +0 -36
- package/dist/index-xj1mq27m.js +0 -40
- package/dist/lead-enzn86bz.js +0 -74
- package/dist/thread-buffer-3x93yexa.js +0 -38
- package/dist/worker-zfcv2wbf.js +0 -74
- package/src/slack/socket-mode-guard.test.ts +0 -25
- package/src/tests/agent-activity.test.ts +0 -247
- package/src/tests/agent-fs-live-url.test.ts +0 -55
- package/src/tests/agentmail-inbox-mapping.test.ts +0 -73
- package/src/tests/approval-sweeps-config.test.ts +0 -47
- package/src/tests/cards.test.ts +0 -169
- package/src/tests/chat-sdk-facts.test.ts +0 -23
- package/src/tests/config-env-export-chat-sdk.test.ts +0 -11
- package/src/tests/core-auth.test.ts +0 -156
- package/src/tests/date-utils.test.ts +0 -48
- package/src/tests/db-context-versions.test.ts +0 -37
- package/src/tests/db-runtime.test.ts +0 -131
- package/src/tests/enabled-capabilities.test.ts +0 -20
- package/src/tests/extensions-example-mcp-install.test.ts +0 -67
- package/src/tests/extensions-lead-equivalence.test.ts +0 -70
- package/src/tests/get-workflow-run-tool.test.ts +0 -98
- package/src/tests/github-event-labels.test.ts +0 -24
- package/src/tests/haiku-5-5-pricing.test.ts +0 -38
- package/src/tests/http-log-scrubbing.test.ts +0 -123
- package/src/tests/http-semconv-attributes.test.ts +0 -92
- package/src/tests/identity.test.ts +0 -117
- package/src/tests/inbox-state.test.ts +0 -167
- package/src/tests/internal-ai/models.test.ts +0 -54
- package/src/tests/launch-password-rejection.test.ts +0 -140
- package/src/tests/list-total-cache.test.ts +0 -88
- package/src/tests/match-route.test.ts +0 -187
- package/src/tests/memory-feature-flags.test.ts +0 -45
- package/src/tests/memory-get-tool.test.ts +0 -269
- package/src/tests/memory-health-endpoint.test.ts +0 -78
- package/src/tests/memory-http-access.test.ts +0 -221
- package/src/tests/memory-retrieval-purge.test.ts +0 -99
- package/src/tests/multi-runtime-enabled-stats.test.ts +0 -229
- package/src/tests/openai-embedding-provider.test.ts +0 -159
- package/src/tests/org-identity.test.ts +0 -44
- package/src/tests/pages-actions-endpoint.test.ts +0 -103
- package/src/tests/pages-browser-sdk.test.ts +0 -76
- package/src/tests/pages-feedback-keys.test.ts +0 -121
- package/src/tests/pages-frame-ancestors.test.ts +0 -189
- package/src/tests/pages-list-endpoint.test.ts +0 -148
- package/src/tests/pages-password-mode.test.ts +0 -266
- package/src/tests/pages-public-authed-401.test.ts +0 -103
- package/src/tests/pages-public-html.test.ts +0 -297
- package/src/tests/pages-public-json-redirect.test.ts +0 -122
- package/src/tests/pages-view-count.test.ts +0 -245
- package/src/tests/prompt-templates-db.test.ts +0 -616
- package/src/tests/rbac-engine.test.ts +0 -742
- package/src/tests/repo-allow-merge-gate.test.ts +0 -389
- package/src/tests/route-def-find-route.test.ts +0 -192
- package/src/tests/runtime-stale-threshold.test.ts +0 -40
- package/src/tests/schedule-validation-helper.test.ts +0 -51
- package/src/tests/scheduled-tasks-api.test.ts +0 -355
- package/src/tests/scheduler-backoff.test.ts +0 -166
- package/src/tests/script-run-token.test.ts +0 -75
- package/src/tests/scripts-extract-signature.test.ts +0 -47
- package/src/tests/scripts-sdk-bridge-tool-failure.test.ts +0 -141
- package/src/tests/seed-workflow-dreaming.test.ts +0 -117
- package/src/tests/short-id.test.ts +0 -23
- package/src/tests/skill-files-http.test.ts +0 -222
- package/src/tests/skill-get-file-tool.test.ts +0 -110
- package/src/tests/skill-script-refs.test.ts +0 -63
- package/src/tests/skill-update-scope.test.ts +0 -252
- package/src/tests/skills-bundle.test.ts +0 -99
- package/src/tests/slack-app-icon.test.ts +0 -94
- package/src/tests/slack-assistant-comention.test.ts +0 -139
- package/src/tests/slack-delete.test.ts +0 -157
- package/src/tests/slack-inbound-diagnostics-auth.test.ts +0 -93
- package/src/tests/slack-manifest.test.ts +0 -23
- package/src/tests/slack-task-output.test.ts +0 -90
- package/src/tests/store-progress-output-guidance.test.ts +0 -34
- package/src/tests/swarm-diff.test.ts +0 -728
- package/src/tests/task-lifecycle-events.test.ts +0 -53
- package/src/tests/template-asset-config.test.ts +0 -18
- package/src/tests/template-fetch.test.ts +0 -490
- package/src/tests/themes-page-theme.test.ts +0 -155
- package/src/tests/tool-annotations.test.ts +0 -442
- package/src/tests/tool-output-agent-id.test.ts +0 -202
- package/src/tests/update-profile-agentid.test.ts +0 -248
- package/src/tests/whoami-route.test.ts +0 -162
- package/src/tests/workflow-definition-telemetry.test.ts +0 -134
- package/src/tests/workflow-patch.test.ts +0 -169
- package/src/tests/workflow-run-steps-index.test.ts +0 -65
- package/src/tests/workflow-schedule-trigger.test.ts +0 -104
- package/src/tests/workflow-step-claims.test.ts +0 -152
- package/src/tests/workflow-step-order.test.ts +0 -92
- package/src/tests/workflow-trigger-schema.test.ts +0 -359
- package/src/tests/workflow-versions.test.ts +0 -240
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
} from "../constants";
|
|
16
16
|
import { isLearningKey, isLongtermKey, LONGTERM_ROOT, tierSource } from "../key-paths";
|
|
17
17
|
import { recencyDecay } from "../reranker";
|
|
18
|
+
import { notReviewTaskCompletionSql } from "../review-recall-filter";
|
|
18
19
|
import { MAX_CANDIDATE_FETCH } from "../search-candidates";
|
|
19
20
|
import type {
|
|
20
21
|
MemoryCandidate,
|
|
@@ -59,6 +60,8 @@ export const FTS_SCAN_BATCH_SQL = `SELECT rowid AS rowid, memory_id AS memoryId,
|
|
|
59
60
|
FROM memory_fts WHERE rowid > ? ORDER BY rowid LIMIT ?`;
|
|
60
61
|
export const MEMORY_ID_BATCH_SQL = `SELECT rowid AS rowid, id FROM agent_memory
|
|
61
62
|
WHERE rowid > ? ORDER BY rowid LIMIT ?`;
|
|
63
|
+
/** How long search reuses one health result. Stale by at most this long. */
|
|
64
|
+
export const SEARCH_HEALTH_TTL_MS = 60_000;
|
|
62
65
|
const FTS_SCAN_BATCH_SIZE = 1000;
|
|
63
66
|
const FTS_POPULATE_BATCH_SIZE = 500;
|
|
64
67
|
|
|
@@ -206,6 +209,7 @@ export class SqliteMemoryStore implements MemoryStore {
|
|
|
206
209
|
private ftsInitialized = false;
|
|
207
210
|
private ftsPopulate: Promise<void> | null = null;
|
|
208
211
|
private lastPopulate: MemoryVecPopulateStats | null = null;
|
|
212
|
+
private searchHealthCache: { health: MemoryHealth; db: unknown; at: number } | null = null;
|
|
209
213
|
|
|
210
214
|
constructor() {
|
|
211
215
|
this.ensureVecTable();
|
|
@@ -252,8 +256,9 @@ export class SqliteMemoryStore implements MemoryStore {
|
|
|
252
256
|
* FTS_MISSING_IDS_SQL), and inserts run in batches that yield the event loop
|
|
253
257
|
* between them, so a cold rebuild cannot stall the API the way the old
|
|
254
258
|
* synchronous correlated anti-join did at boot. Rows written by
|
|
255
|
-
* store()/delete() while this runs go through syncFtsRow/deleteFtsRows
|
|
256
|
-
*
|
|
259
|
+
* store()/delete() while this runs go through syncFtsRow/deleteFtsRows.
|
|
260
|
+
* The insert below skips ids memory_fts already holds, in one statement, so
|
|
261
|
+
* a write that commits its memory and FTS rows together cannot be doubled.
|
|
257
262
|
*/
|
|
258
263
|
private async populateFtsTable(): Promise<void> {
|
|
259
264
|
const client = getDbClient();
|
|
@@ -320,15 +325,29 @@ export class SqliteMemoryStore implements MemoryStore {
|
|
|
320
325
|
return this.ftsPopulate ?? Promise.resolve();
|
|
321
326
|
}
|
|
322
327
|
|
|
323
|
-
|
|
328
|
+
/**
|
|
329
|
+
* Delete and insert run in one transaction (a SAVEPOINT inside a caller's),
|
|
330
|
+
* so a backfill insert cannot land between them, and a failure rolls back
|
|
331
|
+
* only the FTS write. `freshId`: the caller inserted the memory row under a
|
|
332
|
+
* new id in the same transaction, so no FTS row can exist for it and the
|
|
333
|
+
* delete, a full memory_fts scan (memory_id is UNINDEXED), is skipped.
|
|
334
|
+
*/
|
|
335
|
+
private async syncFtsRow(
|
|
336
|
+
memoryId: string,
|
|
337
|
+
name: string,
|
|
338
|
+
content: string,
|
|
339
|
+
freshId = false,
|
|
340
|
+
): Promise<void> {
|
|
324
341
|
if (!this.ftsInitialized && !(await this.getFtsTableSchema())) return;
|
|
325
342
|
try {
|
|
326
|
-
await getDbClient().
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
343
|
+
await getDbClient().transaction(async (tx) => {
|
|
344
|
+
if (!freshId) await tx.run("DELETE FROM memory_fts WHERE memory_id = ?", [memoryId]);
|
|
345
|
+
await tx.run("INSERT INTO memory_fts(memory_id, name, content) VALUES (?, ?, ?)", [
|
|
346
|
+
memoryId,
|
|
347
|
+
name,
|
|
348
|
+
content,
|
|
349
|
+
]);
|
|
350
|
+
});
|
|
332
351
|
} catch (err) {
|
|
333
352
|
console.error(`[memory-fts] sync failed memory_id=${memoryId}: ${(err as Error).message}`);
|
|
334
353
|
}
|
|
@@ -457,6 +476,7 @@ export class SqliteMemoryStore implements MemoryStore {
|
|
|
457
476
|
}
|
|
458
477
|
|
|
459
478
|
const afterCount = this.getVecCount();
|
|
479
|
+
this.searchHealthCache = null;
|
|
460
480
|
this.lastPopulate = {
|
|
461
481
|
attempted,
|
|
462
482
|
inserted,
|
|
@@ -547,10 +567,11 @@ export class SqliteMemoryStore implements MemoryStore {
|
|
|
547
567
|
input.agentId ?? null,
|
|
548
568
|
],
|
|
549
569
|
);
|
|
570
|
+
// Same transaction: a backfill sees the memory row only with its FTS row.
|
|
571
|
+
await this.syncFtsRow(inserted.id, inserted.name, inserted.content, true);
|
|
550
572
|
return inserted;
|
|
551
573
|
});
|
|
552
574
|
|
|
553
|
-
await this.syncFtsRow(row.id, row.name, row.content);
|
|
554
575
|
return rowToAgentMemory(row);
|
|
555
576
|
}
|
|
556
577
|
|
|
@@ -635,6 +656,7 @@ export class SqliteMemoryStore implements MemoryStore {
|
|
|
635
656
|
isLead = false,
|
|
636
657
|
includeExpired = false,
|
|
637
658
|
keyPrefix,
|
|
659
|
+
excludeReviewTaskCompletions,
|
|
638
660
|
} = options;
|
|
639
661
|
|
|
640
662
|
if (options.exhaustive) {
|
|
@@ -645,11 +667,12 @@ export class SqliteMemoryStore implements MemoryStore {
|
|
|
645
667
|
isLead,
|
|
646
668
|
includeExpired,
|
|
647
669
|
keyPrefix,
|
|
670
|
+
excludeReviewTaskCompletions,
|
|
648
671
|
minSimilarity: options.minSimilarity,
|
|
649
672
|
});
|
|
650
673
|
}
|
|
651
674
|
|
|
652
|
-
const health = this.
|
|
675
|
+
const health = this.searchHealth();
|
|
653
676
|
if (
|
|
654
677
|
isHybridSearchEnabled() &&
|
|
655
678
|
options.queryText &&
|
|
@@ -668,6 +691,7 @@ export class SqliteMemoryStore implements MemoryStore {
|
|
|
668
691
|
isLead,
|
|
669
692
|
includeExpired,
|
|
670
693
|
keyPrefix,
|
|
694
|
+
excludeReviewTaskCompletions,
|
|
671
695
|
});
|
|
672
696
|
}
|
|
673
697
|
|
|
@@ -682,6 +706,7 @@ export class SqliteMemoryStore implements MemoryStore {
|
|
|
682
706
|
isLead,
|
|
683
707
|
includeExpired,
|
|
684
708
|
keyPrefix,
|
|
709
|
+
excludeReviewTaskCompletions,
|
|
685
710
|
minSimilarity: options.minSimilarity,
|
|
686
711
|
});
|
|
687
712
|
}
|
|
@@ -697,6 +722,7 @@ export class SqliteMemoryStore implements MemoryStore {
|
|
|
697
722
|
isLead,
|
|
698
723
|
includeExpired,
|
|
699
724
|
keyPrefix,
|
|
725
|
+
excludeReviewTaskCompletions,
|
|
700
726
|
});
|
|
701
727
|
}
|
|
702
728
|
|
|
@@ -710,6 +736,7 @@ export class SqliteMemoryStore implements MemoryStore {
|
|
|
710
736
|
isLead,
|
|
711
737
|
includeExpired,
|
|
712
738
|
keyPrefix,
|
|
739
|
+
excludeReviewTaskCompletions,
|
|
713
740
|
minSimilarity: options.minSimilarity,
|
|
714
741
|
});
|
|
715
742
|
}
|
|
@@ -725,6 +752,7 @@ export class SqliteMemoryStore implements MemoryStore {
|
|
|
725
752
|
isLead: boolean;
|
|
726
753
|
includeExpired: boolean;
|
|
727
754
|
keyPrefix?: string;
|
|
755
|
+
excludeReviewTaskCompletions?: boolean;
|
|
728
756
|
},
|
|
729
757
|
): Promise<MemoryCandidate[]> {
|
|
730
758
|
const overfetchLimit = armFetchLimit(options.limit);
|
|
@@ -806,6 +834,7 @@ export class SqliteMemoryStore implements MemoryStore {
|
|
|
806
834
|
isLead: boolean;
|
|
807
835
|
includeExpired: boolean;
|
|
808
836
|
keyPrefix?: string;
|
|
837
|
+
excludeReviewTaskCompletions?: boolean;
|
|
809
838
|
},
|
|
810
839
|
): Promise<MemoryCandidate[]> {
|
|
811
840
|
const match = this.buildFtsMatch(queryText);
|
|
@@ -817,6 +846,7 @@ export class SqliteMemoryStore implements MemoryStore {
|
|
|
817
846
|
|
|
818
847
|
this.addScopeConditions(conditions, params, agentId, scope, isLead, "m");
|
|
819
848
|
this.addKeyPrefixCondition(conditions, params, keyPrefix, "m");
|
|
849
|
+
this.addReviewExclusion(conditions, params, options.excludeReviewTaskCompletions, "m");
|
|
820
850
|
|
|
821
851
|
if (source) {
|
|
822
852
|
conditions.push("m.source = ?");
|
|
@@ -883,6 +913,7 @@ export class SqliteMemoryStore implements MemoryStore {
|
|
|
883
913
|
isLead: boolean;
|
|
884
914
|
includeExpired: boolean;
|
|
885
915
|
keyPrefix?: string;
|
|
916
|
+
excludeReviewTaskCompletions?: boolean;
|
|
886
917
|
minSimilarity?: number;
|
|
887
918
|
},
|
|
888
919
|
): Promise<MemoryCandidate[]> {
|
|
@@ -890,14 +921,16 @@ export class SqliteMemoryStore implements MemoryStore {
|
|
|
890
921
|
const floor = options.minSimilarity ?? minSimilarity();
|
|
891
922
|
|
|
892
923
|
const embeddingBuffer = serializeEmbedding(queryEmbedding);
|
|
893
|
-
// sqlite-vec hard ceiling
|
|
894
|
-
|
|
924
|
+
// sqlite-vec's hard ceiling for knn queries. A table with fewer rows
|
|
925
|
+
// returns them all, so no per-query row count is needed to size k.
|
|
926
|
+
const knnLimit = 4096;
|
|
895
927
|
|
|
896
928
|
const conditions: string[] = ["v.embedding MATCH ?"];
|
|
897
929
|
const params: (Buffer | string | number | null)[] = [embeddingBuffer];
|
|
898
930
|
|
|
899
931
|
this.addScopeConditions(conditions, params, agentId, scope, isLead, "m");
|
|
900
932
|
this.addKeyPrefixCondition(conditions, params, keyPrefix, "m");
|
|
933
|
+
this.addReviewExclusion(conditions, params, options.excludeReviewTaskCompletions, "m");
|
|
901
934
|
|
|
902
935
|
if (source) {
|
|
903
936
|
conditions.push("m.source = ?");
|
|
@@ -952,6 +985,7 @@ export class SqliteMemoryStore implements MemoryStore {
|
|
|
952
985
|
isLead: boolean;
|
|
953
986
|
includeExpired: boolean;
|
|
954
987
|
keyPrefix?: string;
|
|
988
|
+
excludeReviewTaskCompletions?: boolean;
|
|
955
989
|
minSimilarity?: number;
|
|
956
990
|
},
|
|
957
991
|
): Promise<MemoryCandidate[]> {
|
|
@@ -962,6 +996,7 @@ export class SqliteMemoryStore implements MemoryStore {
|
|
|
962
996
|
const params: (string | number | null)[] = [];
|
|
963
997
|
this.addScopeConditions(conditions, params, agentId, scope, isLead);
|
|
964
998
|
this.addKeyPrefixCondition(conditions, params, keyPrefix);
|
|
999
|
+
this.addReviewExclusion(conditions, params, options.excludeReviewTaskCompletions);
|
|
965
1000
|
if (source) {
|
|
966
1001
|
conditions.push("source = ?");
|
|
967
1002
|
params.push(source);
|
|
@@ -1063,6 +1098,7 @@ export class SqliteMemoryStore implements MemoryStore {
|
|
|
1063
1098
|
isLead: boolean;
|
|
1064
1099
|
includeExpired: boolean;
|
|
1065
1100
|
keyPrefix?: string;
|
|
1101
|
+
excludeReviewTaskCompletions?: boolean;
|
|
1066
1102
|
minSimilarity?: number;
|
|
1067
1103
|
},
|
|
1068
1104
|
): Promise<MemoryCandidate[]> {
|
|
@@ -1074,6 +1110,7 @@ export class SqliteMemoryStore implements MemoryStore {
|
|
|
1074
1110
|
|
|
1075
1111
|
this.addScopeConditions(conditions, params, agentId, scope, isLead);
|
|
1076
1112
|
this.addKeyPrefixCondition(conditions, params, keyPrefix);
|
|
1113
|
+
this.addReviewExclusion(conditions, params, options.excludeReviewTaskCompletions);
|
|
1077
1114
|
|
|
1078
1115
|
if (source) {
|
|
1079
1116
|
conditions.push("source = ?");
|
|
@@ -1149,6 +1186,19 @@ export class SqliteMemoryStore implements MemoryStore {
|
|
|
1149
1186
|
params.push(keyPrefix, keyPrefix);
|
|
1150
1187
|
}
|
|
1151
1188
|
|
|
1189
|
+
/** A review recaller's filter, applied in SQL so the rows never fill the window. */
|
|
1190
|
+
private addReviewExclusion(
|
|
1191
|
+
conditions: string[],
|
|
1192
|
+
params: (Buffer | string | number | null)[],
|
|
1193
|
+
exclude: boolean | undefined,
|
|
1194
|
+
tableAlias = "",
|
|
1195
|
+
): void {
|
|
1196
|
+
if (!exclude) return;
|
|
1197
|
+
const filter = notReviewTaskCompletionSql(tableAlias);
|
|
1198
|
+
conditions.push(filter.sql);
|
|
1199
|
+
params.push(...filter.params);
|
|
1200
|
+
}
|
|
1201
|
+
|
|
1152
1202
|
private buildListWhereClause(
|
|
1153
1203
|
agentId: string,
|
|
1154
1204
|
options: MemoryListOptions,
|
|
@@ -1426,6 +1476,7 @@ export class SqliteMemoryStore implements MemoryStore {
|
|
|
1426
1476
|
if (this.vecInitialized && this.getVecTableSchema()) {
|
|
1427
1477
|
const placeholders = ids.map(() => "?").join(",");
|
|
1428
1478
|
await getDbClient().run(`DELETE FROM memory_vec WHERE memory_id IN (${placeholders})`, ids);
|
|
1479
|
+
this.noteVecWrite();
|
|
1429
1480
|
}
|
|
1430
1481
|
await this.deleteFtsRows(ids);
|
|
1431
1482
|
}
|
|
@@ -1536,8 +1587,11 @@ export class SqliteMemoryStore implements MemoryStore {
|
|
|
1536
1587
|
id,
|
|
1537
1588
|
vecBuffer,
|
|
1538
1589
|
]);
|
|
1590
|
+
this.noteVecWrite();
|
|
1539
1591
|
} catch (err) {
|
|
1540
1592
|
console.error(`[memory-vec] update failed memory_id=${id}: ${(err as Error).message}`);
|
|
1593
|
+
// The row now misses from memory_vec: search must see the fallback.
|
|
1594
|
+
this.searchHealthCache = null;
|
|
1541
1595
|
}
|
|
1542
1596
|
}
|
|
1543
1597
|
});
|
|
@@ -1550,6 +1604,7 @@ export class SqliteMemoryStore implements MemoryStore {
|
|
|
1550
1604
|
]);
|
|
1551
1605
|
if (this.vecInitialized && this.getVecTableSchema()) {
|
|
1552
1606
|
await tx.run("DELETE FROM memory_vec WHERE memory_id = ?", [id]);
|
|
1607
|
+
this.noteVecWrite();
|
|
1553
1608
|
}
|
|
1554
1609
|
});
|
|
1555
1610
|
}
|
|
@@ -1587,6 +1642,7 @@ export class SqliteMemoryStore implements MemoryStore {
|
|
|
1587
1642
|
// re-embed backfill picks the row up via `embedding IS NULL`.
|
|
1588
1643
|
if (contentChanged && this.vecInitialized && this.getVecTableSchema()) {
|
|
1589
1644
|
await tx.run("DELETE FROM memory_vec WHERE memory_id = ?", [id]);
|
|
1645
|
+
this.noteVecWrite();
|
|
1590
1646
|
}
|
|
1591
1647
|
if (after.name !== before.name || contentChanged) {
|
|
1592
1648
|
await this.syncFtsRow(id, after.name, after.content);
|
|
@@ -1643,15 +1699,16 @@ export class SqliteMemoryStore implements MemoryStore {
|
|
|
1643
1699
|
const tableExists = this.getVecTableSchema() !== null;
|
|
1644
1700
|
const tableUsable = tableExists && isSqliteVecAvailable();
|
|
1645
1701
|
const count = (sql: string) => db.prepare<{ count: number }, []>(sql).get()?.count ?? 0;
|
|
1702
|
+
const validEmbedding = count(
|
|
1703
|
+
`SELECT COUNT(*) as count FROM agent_memory WHERE embedding IS NOT NULL AND length(embedding) = ${VECTOR_BYTES}`,
|
|
1704
|
+
);
|
|
1646
1705
|
|
|
1647
1706
|
return {
|
|
1648
1707
|
total: count("SELECT COUNT(*) as count FROM agent_memory"),
|
|
1649
1708
|
withEmbedding: count(
|
|
1650
1709
|
"SELECT COUNT(*) as count FROM agent_memory WHERE embedding IS NOT NULL",
|
|
1651
1710
|
),
|
|
1652
|
-
validEmbedding
|
|
1653
|
-
`SELECT COUNT(*) as count FROM agent_memory WHERE embedding IS NOT NULL AND length(embedding) = ${VECTOR_BYTES}`,
|
|
1654
|
-
),
|
|
1711
|
+
validEmbedding,
|
|
1655
1712
|
invalidEmbedding: count(
|
|
1656
1713
|
`SELECT COUNT(*) as count FROM agent_memory WHERE embedding IS NOT NULL AND length(embedding) != ${VECTOR_BYTES}`,
|
|
1657
1714
|
),
|
|
@@ -1662,18 +1719,21 @@ export class SqliteMemoryStore implements MemoryStore {
|
|
|
1662
1719
|
AND (expiresAt IS NULL OR expiresAt > datetime('now'))`,
|
|
1663
1720
|
),
|
|
1664
1721
|
memoryVec: tableUsable ? count("SELECT COUNT(*) as count FROM memory_vec") : 0,
|
|
1722
|
+
// Valid rows minus the valid rows memory_vec holds. memory_vec.memory_id
|
|
1723
|
+
// is its primary key, so the join counts each memory at most once. The
|
|
1724
|
+
// CROSS JOIN pins memory_vec as the outer loop: an agent_memory-driven
|
|
1725
|
+
// anti-join probes vec0 once per memory, which held the event loop for
|
|
1726
|
+
// seconds at 57k memories; this side is a primary-key lookup per vec row.
|
|
1665
1727
|
missingFromVec: tableUsable
|
|
1666
|
-
?
|
|
1728
|
+
? validEmbedding -
|
|
1729
|
+
count(
|
|
1667
1730
|
`SELECT COUNT(*) as count
|
|
1668
|
-
FROM
|
|
1669
|
-
|
|
1731
|
+
FROM memory_vec v
|
|
1732
|
+
CROSS JOIN agent_memory m ON m.id = v.memory_id
|
|
1670
1733
|
WHERE m.embedding IS NOT NULL
|
|
1671
|
-
AND length(m.embedding) = ${VECTOR_BYTES}
|
|
1672
|
-
AND v.memory_id IS NULL`,
|
|
1734
|
+
AND length(m.embedding) = ${VECTOR_BYTES}`,
|
|
1673
1735
|
)
|
|
1674
|
-
:
|
|
1675
|
-
`SELECT COUNT(*) as count FROM agent_memory WHERE embedding IS NOT NULL AND length(embedding) = ${VECTOR_BYTES}`,
|
|
1676
|
-
),
|
|
1736
|
+
: validEmbedding,
|
|
1677
1737
|
extraInVec: tableUsable
|
|
1678
1738
|
? count(
|
|
1679
1739
|
`SELECT COUNT(*) as count
|
|
@@ -1685,6 +1745,32 @@ export class SqliteMemoryStore implements MemoryStore {
|
|
|
1685
1745
|
};
|
|
1686
1746
|
}
|
|
1687
1747
|
|
|
1748
|
+
/**
|
|
1749
|
+
* getHealth() for the search path. The counts scan agent_memory and
|
|
1750
|
+
* memory_vec synchronously, so search reuses one result per window; the
|
|
1751
|
+
* health endpoint keeps calling getHealth() for fresh counts.
|
|
1752
|
+
*/
|
|
1753
|
+
private searchHealth(): MemoryHealth {
|
|
1754
|
+
const db = getDb();
|
|
1755
|
+
const cached = this.searchHealthCache;
|
|
1756
|
+
// The db check drops a result that outlived a DB swap (tests reinit it).
|
|
1757
|
+
if (cached && cached.db === db && Date.now() - cached.at < SEARCH_HEALTH_TTL_MS) {
|
|
1758
|
+
return cached.health;
|
|
1759
|
+
}
|
|
1760
|
+
const health = this.getHealth();
|
|
1761
|
+
this.searchHealthCache = { health, db, at: Date.now() };
|
|
1762
|
+
return health;
|
|
1763
|
+
}
|
|
1764
|
+
|
|
1765
|
+
/**
|
|
1766
|
+
* A vec write can heal a cached fallback (first vector, backfilled row), so
|
|
1767
|
+
* it drops one. A cached "vec" stays: dropping it on every write would
|
|
1768
|
+
* recount on the next search, and a stale "vec" is at worst one TTL old.
|
|
1769
|
+
*/
|
|
1770
|
+
private noteVecWrite(): void {
|
|
1771
|
+
if (this.searchHealthCache?.health.retrievalMode !== "vec") this.searchHealthCache = null;
|
|
1772
|
+
}
|
|
1773
|
+
|
|
1688
1774
|
getHealth(): MemoryHealth {
|
|
1689
1775
|
const schema = this.getVecTableSchema();
|
|
1690
1776
|
const counts = this.getHealthCounts();
|
|
@@ -37,6 +37,28 @@ function parseTags(raw: string | null): string[] {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
/**
|
|
41
|
+
* `isReviewTask` + the drop rule as a WHERE condition on agent_memory, so a
|
|
42
|
+
* store excludes the rows before its LIMIT. `memoryAlias` is the agent_memory
|
|
43
|
+
* alias in the query ("" for none). The CASE keeps json_each off malformed or
|
|
44
|
+
* non-array tags, which `parseTags` reads as no tags.
|
|
45
|
+
*/
|
|
46
|
+
export function notReviewTaskCompletionSql(memoryAlias = ""): { sql: string; params: string[] } {
|
|
47
|
+
const col = (name: string) => (memoryAlias ? `${memoryAlias}.${name}` : name);
|
|
48
|
+
return {
|
|
49
|
+
sql: `NOT (${col("source")} = 'task_completion' AND EXISTS (
|
|
50
|
+
SELECT 1 FROM agent_tasks rt
|
|
51
|
+
WHERE rt.id = ${col("sourceTaskId")}
|
|
52
|
+
AND (rt.taskType = ?
|
|
53
|
+
OR CASE WHEN json_valid(rt.tags)
|
|
54
|
+
THEN json_type(rt.tags) = 'array' AND EXISTS (
|
|
55
|
+
SELECT 1 FROM json_each(rt.tags)
|
|
56
|
+
WHERE value IN (${REVIEW_TASK_TAGS.map(() => "?").join(",")}))
|
|
57
|
+
ELSE 0 END)))`,
|
|
58
|
+
params: [REVIEW_TASK_TYPE, ...REVIEW_TASK_TAGS],
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
|
|
40
62
|
/** True when `taskId` names a review task. Unknown or missing ids are not review tasks. */
|
|
41
63
|
export async function isReviewTaskId(taskId: string | undefined | null): Promise<boolean> {
|
|
42
64
|
if (!taskId) return false;
|
|
@@ -31,15 +31,13 @@ export async function searchMemoryCandidates(
|
|
|
31
31
|
store: MemoryStore,
|
|
32
32
|
embedding: Float32Array,
|
|
33
33
|
agentId: string,
|
|
34
|
-
{
|
|
35
|
-
excludeReviewTaskCompletions = false,
|
|
36
|
-
...options
|
|
37
|
-
}: MemorySearchOptions & { limit: number; excludeReviewTaskCompletions?: boolean },
|
|
34
|
+
options: MemorySearchOptions & { limit: number },
|
|
38
35
|
): Promise<MemoryCandidate[]> {
|
|
39
|
-
//
|
|
40
|
-
//
|
|
36
|
+
// The store excludes review completions in its query, so they never fill the
|
|
37
|
+
// window. The filter here is the net for a store that ignores the option;
|
|
38
|
+
// any row it drops counts as a missing document and widens the fetch.
|
|
41
39
|
const keep = (rows: MemoryCandidate[]) =>
|
|
42
|
-
excludeReviewTaskCompletions ? dropReviewTaskCompletions(rows) : Promise.resolve(rows);
|
|
40
|
+
options.excludeReviewTaskCompletions ? dropReviewTaskCompletions(rows) : Promise.resolve(rows);
|
|
43
41
|
let fetchLimit = options.limit;
|
|
44
42
|
let raw = await store.search(embedding, agentId, { ...options, limit: fetchLimit });
|
|
45
43
|
let rows = await keep(raw);
|
package/src/be/memory/types.ts
CHANGED
|
@@ -161,6 +161,11 @@ export interface MemorySearchOptions {
|
|
|
161
161
|
isLead?: boolean;
|
|
162
162
|
includeExpired?: boolean;
|
|
163
163
|
queryText?: string;
|
|
164
|
+
/**
|
|
165
|
+
* Leave out `task_completion` memories whose source task is a review task
|
|
166
|
+
* (`review-recall-filter.ts`). Set when the searching task is a review task.
|
|
167
|
+
*/
|
|
168
|
+
excludeReviewTaskCompletions?: boolean;
|
|
164
169
|
/**
|
|
165
170
|
* Keep only memories whose `key` starts with this string. The vector arm
|
|
166
171
|
* applies it after the sqlite-vec KNN (capped at 4096 rows), so a prefix
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
-- Persistent per-agent workspace volumes for runtime pools.
|
|
2
|
+
-- NULL keeps the pre-existing ephemeral behaviour.
|
|
3
|
+
ALTER TABLE runtime_pools ADD COLUMN workspace TEXT CHECK (workspace IS NULL OR json_valid(workspace));
|
|
4
|
+
ALTER TABLE runtime_instances ADD COLUMN workspace_slot INTEGER CHECK (workspace_slot IS NULL OR workspace_slot >= 0);
|
|
5
|
+
-- One live runtime per (agent, slot): a second reconciler loses the insert instead of sharing a volume.
|
|
6
|
+
CREATE UNIQUE INDEX idx_runtime_instances_workspace_slot
|
|
7
|
+
ON runtime_instances(agent_id, workspace_slot)
|
|
8
|
+
WHERE workspace_slot IS NOT NULL AND status != 'offline';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
-- Keep presentation transitions independent of outcome delivery and V2 activation.
|
|
2
|
+
ALTER TABLE slack_render_v2_state ADD COLUMN task_tree_enabled INTEGER
|
|
3
|
+
CHECK (task_tree_enabled IN (0, 1));
|
|
4
|
+
ALTER TABLE slack_render_v2_state ADD COLUMN task_tree_enabled_at TEXT;
|
|
5
|
+
|
|
6
|
+
-- Recovery includes old active tasks, without scanning non-Slack history.
|
|
7
|
+
CREATE INDEX idx_slack_render_active_tasks ON agent_tasks(slackChannelId, slackThreadTs)
|
|
8
|
+
WHERE slackChannelId IS NOT NULL AND slackThreadTs IS NOT NULL
|
|
9
|
+
AND status NOT IN ('completed', 'failed', 'cancelled', 'superseded', 'skipped');
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
-- Independent keyset cursors keep each recovery tick bounded without losing old work.
|
|
2
|
+
ALTER TABLE slack_render_v2_state ADD COLUMN reconcile_cursors TEXT NOT NULL DEFAULT '{}';
|
|
3
|
+
|
|
4
|
+
CREATE INDEX idx_slack_reconcile_active ON agent_tasks(id)
|
|
5
|
+
WHERE slackChannelId IS NOT NULL AND slackThreadTs IS NOT NULL
|
|
6
|
+
AND status IN ('offered', 'reviewing', 'pending', 'in_progress', 'paused');
|
|
7
|
+
CREATE INDEX idx_slack_reconcile_terminal ON agent_tasks(id)
|
|
8
|
+
WHERE slackChannelId IS NOT NULL AND slackThreadTs IS NOT NULL
|
|
9
|
+
AND status IN ('completed', 'failed', 'cancelled');
|
|
10
|
+
CREATE INDEX idx_slack_reconcile_outcome ON slack_messages(id)
|
|
11
|
+
WHERE kind = 'outcome' AND finalized_at IS NULL AND delivery_abandoned_at IS NULL;
|
|
12
|
+
CREATE INDEX idx_slack_reconcile_tree ON slack_messages(id)
|
|
13
|
+
WHERE kind = 'tree' AND closed_at IS NULL;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
-- Webhook subscriptions for MCP Events on the user MCP (/mcp-user).
|
|
2
|
+
--
|
|
3
|
+
-- MCP Events (SEP-3415 draft, extension `io.modelcontextprotocol/events`) lets
|
|
4
|
+
-- a client call `events/subscribe` with a callback URL and a client-supplied
|
|
5
|
+
-- `whsec_` signing secret. The server then POSTs a signed Standard Webhooks
|
|
6
|
+
-- delivery to that URL when a matching event happens. v1 offers
|
|
7
|
+
-- `task.completed` and `task.failed` for tasks the subscribing user requested.
|
|
8
|
+
--
|
|
9
|
+
-- The subscription key is (userId, url, eventName, argumentsJson). `id` is a
|
|
10
|
+
-- deterministic hash of that key (`sub_<hex>`), so the primary key also makes
|
|
11
|
+
-- subscribe an idempotent upsert. argumentsJson is canonical JSON (sorted
|
|
12
|
+
-- keys), so key order never creates a second row.
|
|
13
|
+
--
|
|
14
|
+
-- secretSealed holds the signing secret sealed with the swarm encryption key
|
|
15
|
+
-- (src/be/crypto). previousSecretSealed / previousSecretUntil keep the old
|
|
16
|
+
-- secret for a short dual-signing window after a client rotates it.
|
|
17
|
+
--
|
|
18
|
+
-- verifiedAt records the endpoint verification challenge that let this row be
|
|
19
|
+
-- written. A row exists only after verification succeeded, and a subscribe to
|
|
20
|
+
-- the same (userId, url) inside the verification window skips the challenge.
|
|
21
|
+
--
|
|
22
|
+
-- tokenId is the aswt_ token whose session subscribed. Delivery checks it is
|
|
23
|
+
-- still unrevoked, so revoking a connection stops its events at once.
|
|
24
|
+
--
|
|
25
|
+
-- expiresAt is the granted lease (refreshBefore). Expired rows are never
|
|
26
|
+
-- delivered to and are deleted lazily.
|
|
27
|
+
|
|
28
|
+
CREATE TABLE IF NOT EXISTS mcp_event_subscriptions (
|
|
29
|
+
id TEXT PRIMARY KEY,
|
|
30
|
+
userId TEXT NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
|
31
|
+
tokenId TEXT NOT NULL REFERENCES user_tokens(id) ON DELETE CASCADE,
|
|
32
|
+
eventName TEXT NOT NULL,
|
|
33
|
+
argumentsJson TEXT NOT NULL,
|
|
34
|
+
url TEXT NOT NULL,
|
|
35
|
+
secretSealed TEXT NOT NULL,
|
|
36
|
+
previousSecretSealed TEXT,
|
|
37
|
+
previousSecretUntil TEXT,
|
|
38
|
+
verifiedAt TEXT NOT NULL,
|
|
39
|
+
expiresAt TEXT NOT NULL,
|
|
40
|
+
lastDeliveryAt TEXT,
|
|
41
|
+
-- One of the SEP-3415 lastError categories, never a raw endpoint response.
|
|
42
|
+
lastError TEXT,
|
|
43
|
+
failedSince TEXT,
|
|
44
|
+
createdAt TEXT NOT NULL,
|
|
45
|
+
updatedAt TEXT NOT NULL,
|
|
46
|
+
created_by TEXT REFERENCES users(id),
|
|
47
|
+
updated_by TEXT REFERENCES users(id)
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
CREATE INDEX IF NOT EXISTS idx_mcp_event_subscriptions_user_event
|
|
51
|
+
ON mcp_event_subscriptions(userId, eventName, expiresAt);
|
|
52
|
+
CREATE INDEX IF NOT EXISTS idx_mcp_event_subscriptions_expires
|
|
53
|
+
ON mcp_event_subscriptions(expiresAt);
|
|
54
|
+
CREATE INDEX IF NOT EXISTS idx_mcp_event_subscriptions_created_by
|
|
55
|
+
ON mcp_event_subscriptions(created_by) WHERE created_by IS NOT NULL;
|
|
56
|
+
CREATE INDEX IF NOT EXISTS idx_mcp_event_subscriptions_updated_by
|
|
57
|
+
ON mcp_event_subscriptions(updated_by) WHERE updated_by IS NOT NULL;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
-- Opt-in terminal-run retention seeks the expiry frontier by completion time.
|
|
2
|
+
-- Keep the predicate identical to workflow-run-retention.ts for the partial index.
|
|
3
|
+
CREATE INDEX IF NOT EXISTS idx_workflow_runs_retention
|
|
4
|
+
ON workflow_runs(status, finishedAt, id)
|
|
5
|
+
WHERE status IN ('completed', 'failed', 'skipped', 'cancelled');
|
|
6
|
+
|
|
7
|
+
-- Approval links are logical references rather than SQLite foreign keys.
|
|
8
|
+
CREATE INDEX IF NOT EXISTS idx_approval_requests_workflow_step
|
|
9
|
+
ON approval_requests(workflowRunStepId);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
-- Request composition manifest: what each LLM call's prompt is made of.
|
|
2
|
+
-- One row per session (seq 0), plus a new seq only when the static parts
|
|
3
|
+
-- change. Each part carries chars, an estimated token count and a fidelity.
|
|
4
|
+
-- Message history and the harness's own base prompt are derived at read time
|
|
5
|
+
-- from per-call usage in session_logs, so they are not stored here.
|
|
6
|
+
CREATE TABLE IF NOT EXISTS request_composition (
|
|
7
|
+
id TEXT PRIMARY KEY,
|
|
8
|
+
taskId TEXT NOT NULL REFERENCES agent_tasks(id) ON DELETE CASCADE,
|
|
9
|
+
agentId TEXT NOT NULL REFERENCES agents(id) ON DELETE CASCADE,
|
|
10
|
+
sessionId TEXT NOT NULL,
|
|
11
|
+
seq INTEGER NOT NULL DEFAULT 0,
|
|
12
|
+
provider TEXT NOT NULL,
|
|
13
|
+
model TEXT,
|
|
14
|
+
source TEXT NOT NULL CHECK (source IN ('worker', 'harness-hook')),
|
|
15
|
+
parts TEXT NOT NULL,
|
|
16
|
+
staticEstTokens INTEGER NOT NULL,
|
|
17
|
+
tokenRatio REAL NOT NULL DEFAULT 1.0,
|
|
18
|
+
createdAt TEXT NOT NULL,
|
|
19
|
+
UNIQUE (sessionId, seq)
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
CREATE INDEX IF NOT EXISTS idx_request_composition_task ON request_composition(taskId);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
-- Primitive objects (src/be/primitives/objects.ts): a stable id per agent-fs
|
|
2
|
+
-- file that backs a primitive (a board today). The file is the source of
|
|
3
|
+
-- truth and embeds the id, so this table is a rebuildable cache:
|
|
4
|
+
-- `object-reindex` restores every row from the drive.
|
|
5
|
+
CREATE TABLE IF NOT EXISTS primitive_objects (
|
|
6
|
+
id TEXT PRIMARY KEY,
|
|
7
|
+
-- Validated in code against PRIMITIVE_KINDS, so a new kind needs no migration.
|
|
8
|
+
kind TEXT NOT NULL,
|
|
9
|
+
orgId TEXT NOT NULL,
|
|
10
|
+
driveId TEXT NOT NULL,
|
|
11
|
+
-- agent-fs path, no leading slash.
|
|
12
|
+
path TEXT NOT NULL,
|
|
13
|
+
title TEXT,
|
|
14
|
+
-- Last agent-fs version this row saw.
|
|
15
|
+
fileVersion INTEGER,
|
|
16
|
+
ownerAgentId TEXT,
|
|
17
|
+
createdAt TEXT NOT NULL,
|
|
18
|
+
updatedAt TEXT NOT NULL,
|
|
19
|
+
created_by TEXT REFERENCES users(id),
|
|
20
|
+
updated_by TEXT REFERENCES users(id),
|
|
21
|
+
UNIQUE (orgId, driveId, path)
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
CREATE INDEX IF NOT EXISTS idx_primitive_objects_kind
|
|
25
|
+
ON primitive_objects(orgId, driveId, kind, updatedAt);
|
|
26
|
+
|
|
27
|
+
-- deleteUser rewrites the audit columns; keep that an index search.
|
|
28
|
+
CREATE INDEX IF NOT EXISTS idx_primitive_objects_created_by
|
|
29
|
+
ON primitive_objects(created_by) WHERE created_by IS NOT NULL;
|
|
30
|
+
CREATE INDEX IF NOT EXISTS idx_primitive_objects_updated_by
|
|
31
|
+
ON primitive_objects(updated_by) WHERE updated_by IS NOT NULL;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
-- Append-only history of agent deletes and restores (src/be/db/agent-history.ts).
|
|
2
|
+
-- A delete writes the full `agents` row here, then hard-deletes it; a restore
|
|
3
|
+
-- reinserts the latest `deleted` snapshot. No FK on agent_id: the row outlives
|
|
4
|
+
-- the agent. The triggers make the table append-only.
|
|
5
|
+
CREATE TABLE IF NOT EXISTS agent_history (
|
|
6
|
+
id TEXT PRIMARY KEY,
|
|
7
|
+
agent_id TEXT NOT NULL,
|
|
8
|
+
event TEXT NOT NULL CHECK (event IN ('deleted', 'restored')),
|
|
9
|
+
-- `user:<id>` or the operator key fingerprint `op:<hex>`.
|
|
10
|
+
actor_ref TEXT NOT NULL,
|
|
11
|
+
reason TEXT NOT NULL CHECK (length(trim(reason)) >= 3),
|
|
12
|
+
-- SELECT * of the agents row at the event, as JSON.
|
|
13
|
+
snapshot_json TEXT NOT NULL,
|
|
14
|
+
created_at TEXT NOT NULL
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
CREATE INDEX IF NOT EXISTS idx_agent_history_agent ON agent_history(agent_id, created_at);
|
|
18
|
+
|
|
19
|
+
CREATE TRIGGER IF NOT EXISTS agent_history_no_update BEFORE UPDATE ON agent_history
|
|
20
|
+
BEGIN SELECT RAISE(ABORT, 'agent_history is append-only'); END;
|
|
21
|
+
|
|
22
|
+
CREATE TRIGGER IF NOT EXISTS agent_history_no_delete BEFORE DELETE ON agent_history
|
|
23
|
+
BEGIN SELECT RAISE(ABORT, 'agent_history is append-only'); END;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
-- Keep primitive_objects in sync with agent-fs through its signed
|
|
2
|
+
-- `file.changed` webhook (src/be/primitives/object-webhooks.ts).
|
|
3
|
+
|
|
4
|
+
-- Set when agent-fs reports the file deleted. The row is kept: a revert or a
|
|
5
|
+
-- move can bring the file back, and object-list hides tombstoned rows.
|
|
6
|
+
ALTER TABLE primitive_objects ADD COLUMN deletedAt TEXT;
|
|
7
|
+
|
|
8
|
+
-- One agent-fs webhook subscription per drive that holds objects. The row id is
|
|
9
|
+
-- the receiver URL's last segment, so a delivery finds its secret by URL.
|
|
10
|
+
CREATE TABLE IF NOT EXISTS agent_fs_object_webhooks (
|
|
11
|
+
id TEXT PRIMARY KEY,
|
|
12
|
+
orgId TEXT NOT NULL,
|
|
13
|
+
driveId TEXT NOT NULL,
|
|
14
|
+
-- agent-fs subscription id; NULL until registration succeeds.
|
|
15
|
+
subscriptionId TEXT,
|
|
16
|
+
-- Receiver URL registered with agent-fs.
|
|
17
|
+
url TEXT,
|
|
18
|
+
-- whsec_ signing secret, encrypted with the swarm secrets key.
|
|
19
|
+
secretCiphertext TEXT,
|
|
20
|
+
status TEXT NOT NULL DEFAULT 'pending' CHECK (status IN ('pending', 'active', 'failed')),
|
|
21
|
+
lastError TEXT,
|
|
22
|
+
-- Lease for the replica that is registering; NULL when none is.
|
|
23
|
+
claimedAt TEXT,
|
|
24
|
+
attemptedAt TEXT,
|
|
25
|
+
createdAt TEXT NOT NULL,
|
|
26
|
+
updatedAt TEXT NOT NULL,
|
|
27
|
+
created_by TEXT REFERENCES users(id),
|
|
28
|
+
updated_by TEXT REFERENCES users(id),
|
|
29
|
+
UNIQUE (orgId, driveId)
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
-- deleteUser rewrites the audit columns; keep that an index search.
|
|
33
|
+
CREATE INDEX IF NOT EXISTS idx_agent_fs_object_webhooks_created_by
|
|
34
|
+
ON agent_fs_object_webhooks(created_by) WHERE created_by IS NOT NULL;
|
|
35
|
+
CREATE INDEX IF NOT EXISTS idx_agent_fs_object_webhooks_updated_by
|
|
36
|
+
ON agent_fs_object_webhooks(updated_by) WHERE updated_by IS NOT NULL;
|
|
@@ -91,7 +91,7 @@ export async function vcsRepoId(vcsRepo: string | null | undefined): Promise<str
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
/** Pooled credential values the worker would get, by var: exported config rows only. */
|
|
94
|
-
async function configPools(
|
|
94
|
+
export async function configPools(
|
|
95
95
|
agentId: string,
|
|
96
96
|
{ vcsRepo, includeRepoSecrets = true }: ProfileCheckOptions,
|
|
97
97
|
): Promise<Map<string, string>> {
|