@desplega.ai/agent-swarm 2.13.3 → 2.13.5
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-tbt61zkm.js +17 -0
- package/dist/{acp-targets-k8xs4tj8.js → acp-targets-w8dbs4nr.js} +10 -10
- package/dist/{actions-pg5fxjer.js → actions-8zrcbjrx.js} +237 -27
- package/dist/{agent-fs-provision-vbk3fppw.js → agent-fs-provision-cbt2ttds.js} +4 -4
- package/dist/{amp-adapter-adbhxsz9.js → amp-adapter-8x6zp8w4.js} +3 -3
- package/dist/{anthropic-messages-88b7s3n9.js → anthropic-messages-vdd1zmha.js} +10 -10
- package/dist/{app-b267ggx1.js → app-zfa9dwjw.js} +7 -7
- package/dist/{approval-notifications-evc1a9z5.js → approval-notifications-rv92zmza.js} +8 -8
- package/dist/{assistant-wgz2ab84.js → assistant-q7s7rm1q.js} +25 -25
- package/dist/{boot-args-schema-6tpk28j4.js → boot-args-schema-g27kpzr1.js} +1 -1
- package/dist/{boot-reembed-r1zyvefv.js → boot-reembed-1mjs52nt.js} +1 -1
- package/dist/{boot-reembed-ankp369c.js → boot-reembed-m62dpdkg.js} +1 -1
- package/dist/{boot-scrub-sweep-cgb6r5bd.js → boot-scrub-sweep-ss1vcamw.js} +2 -2
- package/dist/{boot-seeds-bjceqg7b.js → boot-seeds-hwnvgbb3.js} +4 -4
- package/dist/{boxd-hr8rsxzq.js → boxd-y0szhp0g.js} +2 -2
- package/dist/{claude-adapter-knztdnff.js → claude-adapter-0rjmbhjk.js} +9 -9
- package/dist/{claude-managed-adapter-qwejzqkk.js → claude-managed-adapter-6k032agg.js} +4 -4
- package/dist/{claude-managed-setup-0vgz4d1j.js → claude-managed-setup-6czvve8q.js} +5 -5
- package/dist/{claude-sdk-session-c3g6dv0g.js → claude-sdk-session-pr0znb81.js} +12671 -11885
- package/dist/{cli-2v4xxnx2.js → cli-0h8skzss.js} +1 -1
- package/dist/{cli-7fa6yv98.js → cli-0qt3epg4.js} +7 -7
- package/dist/{cli-aytna2fm.js → cli-19d6v8er.js} +7 -7
- package/dist/{cli-8m6gqnf1.js → cli-1jq2em7b.js} +4 -4
- package/dist/{cli-fp65jdp2.js → cli-1kvcsd2f.js} +219 -155
- package/dist/{cli-8fj8yfmk.js → cli-2vp0z049.js} +1 -1
- package/dist/{cli-61p7ty8d.js → cli-2wzkvfgm.js} +3 -3
- package/dist/{cli-tjf1bh1v.js → cli-34fygf87.js} +6 -4
- package/dist/{cli-czeh7x13.js → cli-3860pmrq.js} +4 -4
- package/dist/{cli-dq30fq3q.js → cli-3vw6dd4g.js} +2 -2
- package/dist/{cli-4dyhzhpx.js → cli-4gaf3tx5.js} +1 -1
- package/dist/{cli-3mf04tkh.js → cli-4vynxtrb.js} +1 -1
- package/dist/{cli-hpxcfvdm.js → cli-55h8m1x3.js} +10 -7
- package/dist/{cli-hxj888w3.js → cli-5n9w2xzx.js} +2 -2
- package/dist/{cli-50whymxq.js → cli-5tq15aa7.js} +2 -2
- package/dist/{cli-8sayvj48.js → cli-5web09sb.js} +3 -3
- package/dist/{cli-gc715jrc.js → cli-69zzpjgh.js} +1 -1
- package/dist/{cli-vgh5adn9.js → cli-6msnpj1z.js} +8 -8
- package/dist/{cli-f8rcvf2x.js → cli-7r9tvk8v.js} +76 -3
- package/dist/{cli-fbmgpt72.js → cli-7ypg8hka.js} +3 -3
- package/dist/{cli-xc8m5cjn.js → cli-887vhew6.js} +3 -3
- package/dist/{cli-q8aq48v1.js → cli-8b4rpnwj.js} +1 -1
- package/dist/{cli-pzsedyb0.js → cli-8pd1t17c.js} +14 -14
- package/dist/{cli-je587f74.js → cli-94gx6ze9.js} +1 -1
- package/dist/{cli-h9d3sdnc.js → cli-94mxerrp.js} +1 -1
- package/dist/{cli-ef590376.js → cli-9n6g14vs.js} +3 -3
- package/dist/{cli-80d5g0fa.js → cli-abby987g.js} +3 -3
- package/dist/{cli-grk77aen.js → cli-avax5mp9.js} +2 -2
- package/dist/{cli-hd2a204w.js → cli-b42yfn17.js} +14 -14
- package/dist/{cli-gkjw33x5.js → cli-b9ygp1kz.js} +2 -2
- package/dist/{cli-bh53ppqm.js → cli-bvamr9g0.js} +4 -4
- package/dist/{cli-ka4tqjzd.js → cli-ced4azn1.js} +15 -12
- package/dist/{cli-v1v49t36.js → cli-cmbb2t8a.js} +3 -3
- package/dist/{cli-hhb8kbwd.js → cli-cp163xga.js} +31 -16
- package/dist/{cli-55fqpd9q.js → cli-ebpq3c5z.js} +8 -8
- package/dist/{cli-9gmkw6xn.js → cli-ehg90jd1.js} +128 -48
- package/dist/{cli-jg5txpm6.js → cli-emdfd8fh.js} +75 -1
- package/dist/{cli-gxqwm3k3.js → cli-evy3egte.js} +104 -10
- package/dist/{cli-a21cwm89.js → cli-ewk3sg68.js} +3 -3
- package/dist/{cli-syqcny89.js → cli-f7b9nyvk.js} +9 -9
- package/dist/{cli-268b3dgn.js → cli-f9xw9pr4.js} +5 -5
- package/dist/{cli-61fzwtjk.js → cli-ffn0a515.js} +9 -9
- package/dist/{cli-ya1cj689.js → cli-fw67mnyc.js} +1 -1
- package/dist/{cli-dqgnbnxs.js → cli-grbngev5.js} +6 -1
- package/dist/{cli-sy2ge2ye.js → cli-hd5bm1e1.js} +4 -4
- package/dist/{cli-rfejbpe1.js → cli-htb5bpz2.js} +1 -1
- package/dist/{cli-w24741sm.js → cli-j69pzrrz.js} +7 -7
- package/dist/{cli-g4dhd3pr.js → cli-jdq3jmny.js} +6 -23
- package/dist/{cli-hv3820ez.js → cli-k0nebh10.js} +1 -1
- package/dist/{cli-d2epqm0y.js → cli-kezzteka.js} +1 -1
- package/dist/{cli-h0ewec3d.js → cli-kr0jpw9c.js} +1 -1
- package/dist/{cli-t25rq8mg.js → cli-ks06cd0n.js} +40 -11
- package/dist/{cli-1gnf5c7x.js → cli-kwj3131p.js} +1 -1
- package/dist/{cli-wtffytm8.js → cli-m8f4379k.js} +3 -3
- package/dist/{cli-43dsqhcp.js → cli-n79j1vxc.js} +4 -4
- package/dist/{cli-b768ek79.js → cli-nrt048ys.js} +1 -0
- package/dist/{cli-h3drhntp.js → cli-pedm2kht.js} +2 -2
- package/dist/{cli-eds5xnsz.js → cli-phmy14hb.js} +2 -2
- package/dist/{cli-7kv5d674.js → cli-prz1p3ft.js} +5 -5
- package/dist/{cli-nbawx3s0.js → cli-q1h041y8.js} +6 -6
- package/dist/{cli-cah298e5.js → cli-q41qar56.js} +104 -119
- package/dist/{cli-kwm1bek7.js → cli-qmx8bnt4.js} +2 -2
- package/dist/{cli-1wew39p0.js → cli-qrvk9nka.js} +28 -19
- package/dist/{cli-v8rpjrnx.js → cli-r3dxpmyt.js} +1 -1
- package/dist/{cli-0j4qmc80.js → cli-ryem5cfq.js} +8 -8
- package/dist/{cli-8pnawt98.js → cli-s8dhq7rj.js} +5 -5
- package/dist/{cli-zkbz8m2q.js → cli-sejvnjvw.js} +3 -2
- package/dist/{cli-at67kvnp.js → cli-srktrbby.js} +1 -1
- package/dist/{cli-wsnradtk.js → cli-srre41gb.js} +2 -2
- package/dist/{cli-r6xnchva.js → cli-t0n9svkb.js} +7 -7
- package/dist/{cli-y0q92v4r.js → cli-t879ww0y.js} +2 -2
- package/dist/{cli-eetzmsy5.js → cli-t9pzz2eq.js} +2 -2
- package/dist/{cli-xwsm6xkr.js → cli-tgc1kgg3.js} +1 -1
- package/dist/{cli-dw43pnzp.js → cli-tt7dkwjj.js} +7 -7
- package/dist/{cli-y754psdt.js → cli-tvyt8w6n.js} +5 -5
- package/dist/cli-v09eza21.js +1907 -0
- package/dist/{cli-mgr3gatr.js → cli-vbge4rsp.js} +4 -4
- package/dist/{cli-ppf9ap9n.js → cli-vcpyttcw.js} +1 -1
- package/dist/{cli-1606qw3n.js → cli-wzecestt.js} +1100 -432
- package/dist/{cli-5basv0e7.js → cli-x2adbg4j.js} +71 -9
- package/dist/{cli-vx9acp12.js → cli-ybte1fqc.js} +1 -1
- package/dist/{cli-vdfngx2g.js → cli-ywy8yz6t.js} +2 -2
- package/dist/{cli-cpkxh68d.js → cli-z1vam71h.js} +2 -2
- package/dist/{cli-djwt4mtn.js → cli-z3x7h79n.js} +15 -9
- package/dist/cli-z40t85ms.js +27 -0
- package/dist/{cli-ea367bdn.js → cli-zbbtp02a.js} +104 -27
- package/dist/{cli-88np9va3.js → cli-zntvmqmm.js} +2 -2
- package/dist/{cli-snwz16eg.js → cli-zxa1vmx7.js} +2 -2
- package/dist/{cli-50wa8k4h.js → cli-zy9bb22b.js} +1 -2
- package/dist/{cli-e4gx499y.js → cli-zzq96q57.js} +273 -106
- package/dist/cli.js +21 -21
- package/dist/{codex-adapter-493vb8cv.js → codex-adapter-bn7eaxk5.js} +8 -8
- package/dist/{codex-hook-ej8hn6z5.js → codex-hook-nnmezjg9.js} +3 -3
- package/dist/{codex-login-ven5cz5j.js → codex-login-ktfg1cxk.js} +1 -1
- package/dist/{codex-session-runner-ps5m4z1g.js → codex-session-runner-j1e9hffc.js} +9 -9
- package/dist/{commands-shktk0b8.js → commands-amhpafrr.js} +3 -3
- package/dist/{controller-wn3vd217.js → controller-tw7g10j2.js} +4 -4
- package/dist/{controllers-connect-yft057ws.js → controllers-connect-2ssqz7f4.js} +25 -25
- package/dist/core-bwp98v4w.js +42 -0
- package/dist/{cursor-adapter-8fpm4dng.js → cursor-adapter-d6knjmwa.js} +2 -2
- package/dist/{db-0ezhdhz5.js → db-fd6xxm77.js} +3 -3
- package/dist/{db-84pz2w5c.js → db-sc59379z.js} +2 -2
- package/dist/{devin-adapter-fs90ab4v.js → devin-adapter-3bp6rape.js} +1 -1
- package/dist/{dispatcher-h2rz69f6.js → dispatcher-a2gdqz8c.js} +22 -22
- package/dist/{docker-1h33jvh9.js → docker-a59g3ebm.js} +2 -2
- package/dist/{dsh-adapter-g9yqv09y.js → dsh-adapter-43ygwqn7.js} +2 -2
- package/dist/{e2b-jnk0yeva.js → e2b-cn7cvjqy.js} +3 -3
- package/dist/{e2b-y7e5kmzf.js → e2b-qnxyfea6.js} +3 -3
- package/dist/{easter-egg-3d-m41ad78v.js → easter-egg-3d-a0pphy71.js} +1 -1
- package/dist/{embedding-space-yam9zwzj.js → embedding-space-qepzrach.js} +6 -6
- package/dist/{embeddings-g2be0y8q.js → embeddings-d7vr881x.js} +1 -1
- package/dist/{event-bus-08t2b4y2.js → event-bus-7gbsr0g4.js} +1 -1
- package/dist/{execute-hhdejgzf.js → execute-6afts2bn.js} +1 -1
- package/dist/{external-channel-kjt2yzfj.js → external-channel-881zq1x4.js} +2 -2
- package/dist/fx-adapter-cr2hq17y.js +20 -0
- package/dist/grok-adapter-ayddnbsc.js +20 -0
- package/dist/handlers-7ghs84x2.js +41 -0
- package/dist/{heartbeat-2e5jdexj.js → heartbeat-4c022m6a.js} +25 -25
- package/dist/{hook-acg9saz7.js → hook-4k84x499.js} +6 -6
- package/dist/{hook-34s8cmgn.js → hook-a7eh6zty.js} +9 -9
- package/dist/{http-ra2zr2f8.js → http-6aw5wanc.js} +456 -1864
- package/dist/{index-mbpxhc4w.js → index-126v2d0t.js} +1 -4
- package/dist/index-dtt0d634.js +44 -0
- package/dist/index-hmszyqkk.js +42 -0
- package/dist/index-j6rm1rtn.js +39 -0
- package/dist/{index-9q42cr54.js → index-rwwhsmjg.js} +1 -1
- package/dist/{index-93bw5wds.js → index-xhad0n8m.js} +1 -1
- package/dist/{index-2z1z7qx6.js → index-yq9hhhhy.js} +26 -26
- package/dist/{index-9r4j0a60.js → index-z2g9469g.js} +410 -27
- package/dist/{k8s-8326q0rq.js → k8s-36gfn847.js} +2 -2
- package/dist/{keepalive-vjnnqbkm.js → keepalive-zhbmztqw.js} +5 -5
- package/dist/lead-g2j4q39z.js +83 -0
- package/dist/{maintenance-px2g599e.js → maintenance-rsp0591h.js} +1 -1
- package/dist/{node-2wfcey7d.js → node-0as4n1ef.js} +3 -3
- package/dist/{node-zd6shky9.js → node-dhxbt01p.js} +3 -3
- package/dist/{node-z67yjre7.js → node-rxte5hc6.js} +290 -70
- package/dist/{node-hjn5n1yp.js → node-t0ct2zpw.js} +3 -5
- package/dist/{oauth-refresh-sweep-nkykf09m.js → oauth-refresh-sweep-w3cqmxq7.js} +4 -4
- package/dist/{object-webhooks-gt9xnq21.js → object-webhooks-331hay92.js} +7 -7
- package/dist/{onboard-1f134p65.js → onboard-n2w80m2n.js} +7 -7
- package/dist/{opencode-adapter-94976yab.js → opencode-adapter-z98127cz.js} +8 -8
- package/dist/{otel-impl-5d4p2fqs.js → otel-impl-xsk35tvf.js} +2 -2
- package/dist/{pending-vkk0vx6n.js → pending-2e6trkxd.js} +23 -23
- package/dist/{pi-mono-adapter-cyzdv5er.js → pi-mono-adapter-wh6yndtm.js} +13 -13
- package/dist/{pricing-refresh-jtmjwss9.js → pricing-refresh-9355dj1t.js} +2 -2
- package/dist/{rbac-roles-yd1fgpsn.js → rbac-roles-58y3m912.js} +3 -3
- package/dist/{rbac-roles-1fvmdyeb.js → rbac-roles-8eajw4s6.js} +6 -4
- package/dist/{render-v2-kb5s3vx4.js → render-v2-7gskkmd4.js} +7 -7
- package/dist/{resume-z1vs44n5.js → resume-0drnmpja.js} +10 -10
- package/dist/{runtime-gk6ct7r7.js → runtime-d2tcmqte.js} +1 -1
- package/dist/{session-access-nz6nre4d.js → session-access-0ztys6bd.js} +5 -5
- package/dist/{session-source-backfill-wb60zjkd.js → session-source-backfill-cdm5s046.js} +3 -3
- package/dist/{setup-2x8g8j4s.js → setup-pqwb9tcc.js} +1 -1
- package/dist/thread-buffer-epx3san4.js +42 -0
- package/dist/{tree-visibility-ts3z30kw.js → tree-visibility-rwz67mje.js} +2 -2
- package/dist/{user-merge-jobs-zetg26e0.js → user-merge-jobs-mxrhamwt.js} +3 -3
- package/dist/{virtual-modules-674fka8x.js → virtual-modules-71y1gsmg.js} +3 -3
- package/dist/{work-objects-w52yyjxm.js → work-objects-3k4ykt9j.js} +25 -25
- package/dist/worker-09gqn9xy.js +83 -0
- package/dist/{worker-follow-up-dyfxyjbj.js → worker-follow-up-y0h64xpr.js} +22 -22
- package/dist/{x-asbrnafg.js → x-d27jj7z7.js} +2 -2
- package/openapi.json +861 -33
- package/package.json +4 -4
- package/src/apps/sync.ts +20 -5
- package/src/azure-devops/boards-sync.ts +1 -1
- package/src/be/db/approvals.ts +2 -0
- package/src/be/db/runtime.ts +5 -0
- package/src/be/db/script-run-sources.ts +17 -0
- package/src/be/db/slack-trees.ts +12 -1
- package/src/be/db/tasks/read.ts +25 -1
- package/src/be/db/tasks/write.ts +47 -12
- package/src/be/db/users/avatar.ts +12 -0
- package/src/be/db-retention.ts +1 -1
- package/src/be/db.ts +149 -67
- package/src/be/design-system.ts +63 -0
- package/src/be/migrations/342_script_run_sources.sql +20 -0
- package/src/be/migrations/344_user_avatar.sql +4 -0
- package/src/be/migrations/345_task_status_kind.sql +6 -0
- package/src/be/migrations/runner.ts +8 -0
- package/src/be/migrations/script-run-sources.ts +51 -0
- package/src/be/primitives/object-embed.ts +2 -2
- package/src/be/primitives/objects.ts +2 -2
- package/src/be/rbac-roles.ts +2 -0
- package/src/be/runtime-pools/supervisor.ts +1 -0
- package/src/be/scripts/typecheck.ts +5 -3
- package/src/be/seed-scripts/catalog/design-system-seed.ts +158 -0
- package/src/be/seed-scripts/index.ts +9 -0
- package/src/be/swarm-config-guard.ts +25 -1
- package/src/bitbucket/handlers.ts +1 -1
- package/src/commands/credential-outcome-report.ts +96 -0
- package/src/commands/onboard/agent-fs-version.ts +1 -1
- package/src/commands/runner.ts +49 -3
- package/src/event-waits/github.ts +39 -6
- package/src/event-waits/index.ts +4 -2
- package/src/event-waits/types.ts +10 -3
- package/src/extensions/contract-types.generated.ts +1 -1
- package/src/github/app.ts +177 -13
- package/src/github/handlers.ts +7 -2
- package/src/github/pull-request-state.ts +100 -11
- package/src/gitlab/handlers.ts +2 -2
- package/src/heartbeat/heartbeat.ts +24 -5
- package/src/http/all-routes.ts +1 -0
- package/src/http/api-keys.ts +26 -0
- package/src/http/approval-chat-answer.ts +99 -0
- package/src/http/approval-requests.ts +280 -225
- package/src/http/asset-key-write.ts +45 -0
- package/src/http/assets.ts +4 -3
- package/src/http/design-system.ts +103 -0
- package/src/http/github-token.ts +27 -6
- package/src/http/index.ts +10 -6
- package/src/http/pages-public.ts +25 -10
- package/src/http/pages.ts +21 -10
- package/src/http/person-responder.ts +28 -0
- package/src/http/schedules.ts +6 -6
- package/src/http/sessions.ts +7 -2
- package/src/http/tasks.ts +23 -5
- package/src/http/users.ts +5 -0
- package/src/http/webhooks.ts +19 -1
- package/src/http/workflows.ts +5 -10
- package/src/integrations/chat-sdk/adapters.ts +33 -3
- package/src/integrations/chat-sdk/commands.ts +3 -1
- package/src/integrations/chat-sdk/inbound.ts +6 -18
- package/src/integrations/chat-sdk/mentions.ts +188 -0
- package/src/integrations/chat-sdk/outbound.ts +20 -3
- package/src/integrations/chat-sdk/router.ts +8 -0
- package/src/integrations/chat-sdk/telegram-thread.ts +12 -0
- package/src/jira/adf.ts +35 -9
- package/src/jira/sync.ts +1 -1
- package/src/kv-reserved-namespaces.ts +5 -0
- package/src/linear/sync.ts +5 -3
- package/src/pages/page-head.ts +11 -1
- package/src/prompts/session-templates.ts +1 -0
- package/src/providers/acp-targets.ts +2 -2
- package/src/providers/amp-adapter.ts +1 -1
- package/src/providers/claude-adapter.ts +5 -0
- package/src/providers/claude-sdk-session.ts +5 -0
- package/src/providers/dsh-adapter.ts +48 -13
- package/src/providers/runtime-dependencies.ts +1 -1
- package/src/rbac/legacy-policy.ts +4 -0
- package/src/rbac/permissions.ts +8 -0
- package/src/scheduler/deferred-task-waits.ts +74 -13
- package/src/scheduler/index.ts +1 -0
- package/src/scheduler/scheduler.test.ts +32 -1
- package/src/scheduler/scheduler.ts +24 -1
- package/src/script-workflows/executor.ts +6 -0
- package/src/script-workflows/supervisor.ts +2 -1
- package/src/scripts-runtime/sdk-allowlist.ts +2 -0
- package/src/scripts-runtime/swarm-sdk.ts +20 -24
- package/src/scripts-runtime/types/stdlib.d.ts +12 -2
- package/src/scripts-runtime/types/swarm-extension.d.ts +19 -2
- package/src/scripts-runtime/types/swarm-sdk.d.ts +12 -2
- package/src/server.ts +2 -0
- package/src/slack/actions.ts +4 -1
- package/src/slack/approval-actions.ts +148 -0
- package/src/slack/approval-buttons.ts +28 -0
- package/src/slack/render-v2.ts +148 -7
- package/src/tests/api-drain-worker-e2e.test.ts +0 -2
- package/src/tests/approval-auto-cancellation-migration.test.ts +8 -19
- package/src/tests/approval-card-resolution.test.ts +2 -17
- package/src/tests/approval-requests-notifications.test.ts +41 -27
- package/src/tests/approval-requests.test.ts +137 -369
- package/src/tests/apps-sync-engine.test.ts +5 -3
- package/src/tests/apps-table-filters-migration.test.ts +44 -25
- package/src/tests/bitbucket-handlers.test.ts +2 -0
- package/src/tests/chat-sdk-commands.test.ts +1 -0
- package/src/tests/chat-sdk-mentions.test.ts +183 -0
- package/src/tests/claude-adapter.test.ts +35 -0
- package/src/tests/codex-adapter.test.ts +3 -92
- package/src/tests/codex-gpt6-release.test.ts +0 -9
- package/src/tests/codex-oauth-credential-info.test.ts +35 -18
- package/src/tests/codex-oauth.test.ts +0 -6
- package/src/tests/codex-pool.test.ts +5 -214
- package/src/tests/codex-rate-limit-parse.test.ts +0 -7
- package/src/tests/codex-swarm-events.test.ts +11 -54
- package/src/tests/create-page-tool.test.ts +5 -0
- package/src/tests/db-client-busy-retry.test.ts +49 -16
- package/src/tests/defer-task.test.ts +1 -0
- package/src/tests/dsh-adapter.test.ts +53 -1
- package/src/tests/e2e-shards.test.ts +9 -9
- package/src/tests/enabled-tools.test.ts +0 -2
- package/src/tests/fixtures/base-prompt-baseline.json +6 -6
- package/src/tests/fixtures/compiled-source-schema-boot.ts +24 -0
- package/src/tests/fixtures/secret-corpus.ts +43 -1
- package/src/tests/github-app-worker-auth-helper.test.ts +147 -1
- package/src/tests/gitlab-handlers.test.ts +2 -0
- package/src/tests/heartbeat-jev-gate.test.ts +9 -241
- package/src/tests/heartbeat-reroute-decision.test.ts +2 -0
- package/src/tests/heartbeat-stall-thresholds.test.ts +174 -0
- package/src/tests/heartbeat-supersede-resume.test.ts +2 -0
- package/src/tests/heartbeat.test.ts +1 -0
- package/src/tests/jira-adf.test.ts +42 -2
- package/src/tests/key-usage-selection.test.ts +302 -0
- package/src/tests/memory-e2e.test.ts +34 -103
- package/src/tests/memory-key-paths.test.ts +5 -0
- package/src/tests/memory-rater-llm.test.ts +33 -149
- package/src/tests/memory-store.test.ts +24 -125
- package/src/tests/memory.test.ts +31 -100
- package/src/tests/merge-gate-detect-changes.test.ts +314 -16
- package/src/tests/migration-342-script-run-sources.test.ts +196 -0
- package/src/tests/migration-bunfs-compat.test.ts +129 -9
- package/src/tests/otel-service-name.test.ts +0 -9
- package/src/tests/otel-session-cost-metrics.test.ts +1 -38
- package/src/tests/pool-session-logs.test.ts +8 -42
- package/src/tests/pre-push-affected-tests.test.ts +106 -0
- package/src/tests/prompt-template-session.test.ts +3 -0
- package/src/tests/rbac-e2e-helpers.test.ts +10 -4
- package/src/tests/rbac-e2e-helpers.ts +13 -4
- package/src/tests/rbac-roles.test.ts +2 -0
- package/src/tests/runner-api-drain.test.ts +2 -17
- package/src/tests/runner-terminal-window-report.test.ts +132 -0
- package/src/tests/runtime-e2b-pools.test.ts +7 -1
- package/src/tests/runtime-supervisor-failures.test.ts +1 -0
- package/src/tests/sandboxed-process.test.ts +26 -21
- package/src/tests/schedule-http-triage-tools.test.ts +12 -9
- package/src/tests/schedule-target-type.test.ts +4 -1
- package/src/tests/scheduled-tasks.test.ts +14 -51
- package/src/tests/script-connections.test.ts +2 -0
- package/src/tests/script-executor-conformance.test.ts +4 -48
- package/src/tests/script-executor-quickjs-pool.test.ts +9 -7
- package/src/tests/script-native-startup.test.ts +21 -25
- package/src/tests/script-runs-retention.test.ts +43 -16
- package/src/tests/script-workflows-runtime-e2e.test.ts +56 -22
- package/src/tests/scripts-http.test.ts +9 -3
- package/src/tests/sdk-allowlist.test.ts +26 -13
- package/src/tests/sdk-store-progress-skipped.test.ts +12 -5
- package/src/tests/secret-rules.test.ts +38 -2
- package/src/tests/secret-scrub-gate.test.ts +7 -0
- package/src/tests/secret-scrubber.test.ts +62 -2
- package/src/tests/seed-scripts.test.ts +2 -2
- package/src/tests/session-logs.test.ts +1 -260
- package/src/tests/slack-render-v2.test.ts +5 -148
- package/src/tests/system-one-hosts-ui-mirror.test.ts +1 -0
- package/src/tests/task-cascade-fail.test.ts +1 -0
- package/src/tests/task-supersede-resume.test.ts +1 -0
- package/src/tests/test-proc.ts +5 -2
- package/src/tests/vcs-azure-devops.test.ts +10 -0
- package/src/tests/vcs-provider.test.ts +8 -0
- package/src/tests/window-stream-reporter.test.ts +122 -0
- package/src/tests/workflow-agent-task-retry.test.ts +1 -3
- package/src/tests/workflow-cascade-cancel.test.ts +1 -0
- package/src/tests/workflow-retry-v2.test.ts +34 -43
- package/src/tests/workflow-retry-validation.test.ts +8 -48
- package/src/tests/worktree-reaper.test.ts +2 -2
- package/src/themes/design-system.ts +163 -0
- package/src/themes/page-theme.ts +28 -19
- package/src/tools/cancel-task.ts +2 -2
- package/src/tools/chat-post.ts +7 -3
- package/src/tools/create-page.ts +3 -0
- package/src/tools/defer-task.ts +7 -2
- package/src/tools/design-system.ts +102 -0
- package/src/tools/get-task-details.ts +8 -4
- package/src/tools/get-tasks.ts +13 -2
- package/src/tools/manage-user.ts +9 -0
- package/src/tools/mcp-servers/mcp-server-get.ts +1 -1
- package/src/tools/mcp-servers/mcp-server-list.ts +1 -1
- package/src/tools/register-chat-channel.ts +11 -2
- package/src/tools/skills/skill-get-file.ts +1 -1
- package/src/tools/skills/skill-get.ts +1 -1
- package/src/tools/skills/skill-list.ts +1 -1
- package/src/tools/skills/skill-search.ts +1 -1
- package/src/tools/store-progress.ts +5 -3
- package/src/tools/utils.ts +49 -4
- package/src/tools/workflows/get-workflow-run.ts +1 -1
- package/src/tools/workflows/get-workflow.ts +1 -1
- package/src/tools/workflows/list-workflow-runs.ts +1 -1
- package/src/tools/workflows/list-workflows.ts +1 -1
- package/src/types.ts +158 -0
- package/src/utils/constants.ts +12 -0
- package/src/utils/credentials.ts +42 -5
- package/src/utils/error-tracker.ts +6 -0
- package/src/utils/key-usage.ts +114 -0
- package/src/utils/sandboxed-process.ts +1 -0
- package/src/utils/secret-rules.generated.ts +149 -149
- package/src/utils/secret-scrubber.ts +111 -5
- package/src/vcs/azure-devops.ts +22 -1
- package/src/vcs/index.ts +3 -1
- package/src/workflows/approval-inline.ts +122 -0
- package/src/workflows/approval-notifications.ts +7 -2
- package/src/workflows/engine.ts +6 -5
- package/src/workflows/executors/agent-task.ts +14 -0
- package/src/workflows/executors/system-one-providers.ts +23 -0
- package/src/workflows/resume.ts +5 -2
- package/templates/skills/apps/SKILL.md +2 -0
- package/templates/skills/apps/content.md +2 -0
- package/templates/skills/boards-and-sheets/content.md +4 -2
- package/templates/skills/pages/content.md +41 -8
- package/templates/skills/swarm-docs/content.md +6 -0
- package/templates/skills/swarm-scripts/SKILL.md +1 -0
- package/templates/skills/swarm-scripts/content.md +1 -0
- package/templates/skills/workflow-iterate/content.md +1 -1
- package/dist/acp-adapter-t2q6nsqv.js +0 -17
- package/dist/cli-kh973792.js +0 -98
- package/dist/core-nheayfgm.js +0 -42
- package/dist/fx-adapter-8g7xsp8q.js +0 -20
- package/dist/grok-adapter-ztk2zkz1.js +0 -20
- package/dist/handlers-9ywssz71.js +0 -41
- package/dist/index-6mgbdtv1.js +0 -44
- package/dist/index-hqdsn2t2.js +0 -39
- package/dist/index-st231bqv.js +0 -40
- package/dist/lead-mk0xkth2.js +0 -82
- package/dist/thread-buffer-d50rqpev.js +0 -42
- package/dist/worker-662x1vse.js +0 -82
- package/src/tests/apps-table-selection-migration.test.ts +0 -95
- package/src/tests/extensions-example-heartbeat-remediate.test.ts +0 -69
- package/src/tests/extensions-example-rewrite-and-suppress.test.ts +0 -70
package/src/be/db.ts
CHANGED
|
@@ -145,6 +145,7 @@ import {
|
|
|
145
145
|
OPEN_TASK_STATUSES,
|
|
146
146
|
parseModelTier,
|
|
147
147
|
SERVER_GENERATED_ATTACHMENT_CAPABILITY,
|
|
148
|
+
type UserAvatar,
|
|
148
149
|
} from "../types";
|
|
149
150
|
import {
|
|
150
151
|
CODEX_AUTH_FAILURE_BENCH_MS,
|
|
@@ -169,6 +170,7 @@ import {
|
|
|
169
170
|
checkIdentityFieldBudget,
|
|
170
171
|
IdentityFieldBudgetError,
|
|
171
172
|
} from "../utils/identity-field-budget";
|
|
173
|
+
import { keyPaceFromWindows, keyUsageFromWindows } from "../utils/key-usage";
|
|
172
174
|
import { activeModelBlock, type ModelFamily } from "../utils/model-rate-limit-windows";
|
|
173
175
|
import { isEffectiveOutputSchema } from "../utils/output-schema";
|
|
174
176
|
import {
|
|
@@ -225,6 +227,7 @@ import { clearAgentModelProfileOnOverrideChange } from "./db/model-profiles";
|
|
|
225
227
|
import { pageSearchSql } from "./db/page-search";
|
|
226
228
|
import { parsePageThemeTokens } from "./db/page-theme-tokens";
|
|
227
229
|
import { getDb, getDbClient } from "./db/runtime";
|
|
230
|
+
import { SCRIPT_RUN_SELECT, storeScriptRunSource } from "./db/script-run-sources";
|
|
228
231
|
import { classifyClaudeUpdate } from "./db/session-log-reasoning";
|
|
229
232
|
import {
|
|
230
233
|
assertAssetKeyMovesAllowed,
|
|
@@ -264,6 +267,7 @@ import {
|
|
|
264
267
|
WORKFLOW_CONTEXT_SET_REQUESTER_SQL,
|
|
265
268
|
WORKFLOW_SEALED_CONTEXT_BY_REQUESTER_SQL,
|
|
266
269
|
} from "./db/user-references";
|
|
270
|
+
import { parseUserAvatar } from "./db/users/avatar";
|
|
267
271
|
import { tombstoneWorkflowIdempotencyKeys } from "./db/workflow-idempotency";
|
|
268
272
|
import { deleteOrphanedRunDefinitions } from "./db/workflow-run-definitions";
|
|
269
273
|
import {
|
|
@@ -3789,7 +3793,7 @@ export async function cascadeFailDependents(
|
|
|
3789
3793
|
if (seen.has(dep.id)) continue;
|
|
3790
3794
|
|
|
3791
3795
|
const reason = `Blocked dependency ${parentId.slice(0, 8)} was ${parentStatus}`;
|
|
3792
|
-
const failed = await failTask(dep.id, reason);
|
|
3796
|
+
const failed = await failTask(dep.id, reason, { statusKind: "cascade" });
|
|
3793
3797
|
if (failed) {
|
|
3794
3798
|
results.push({
|
|
3795
3799
|
taskId: failed.id,
|
|
@@ -7486,9 +7490,10 @@ export async function failPendingResumeIfUnclaimed(
|
|
|
7486
7490
|
const now = new Date().toISOString();
|
|
7487
7491
|
const scrubbedReason = scrubSecrets(failureReason);
|
|
7488
7492
|
const row = await getDbClient().get<AgentTaskRow>(
|
|
7489
|
-
`UPDATE agent_tasks SET status = ?, failureReason = ?, finishedAt = ?, lastUpdatedAt = ?
|
|
7493
|
+
`UPDATE agent_tasks SET status = ?, statusKind = ?, failureReason = ?, finishedAt = ?, lastUpdatedAt = ?
|
|
7490
7494
|
WHERE id = ? AND status = 'pending' RETURNING *`,
|
|
7491
|
-
|
|
7495
|
+
// The resume budget ran out (failed) or the reaper escalated the pin (cancelled).
|
|
7496
|
+
[status, status === "failed" ? "error" : "system", scrubbedReason, now, now, taskId],
|
|
7492
7497
|
);
|
|
7493
7498
|
|
|
7494
7499
|
if (row) {
|
|
@@ -11954,6 +11959,23 @@ export interface AvailableKeyIndicesResult {
|
|
|
11954
11959
|
/** Rate-limited indices whose limit is a provider spend cap: no retry helps before it resets. */
|
|
11955
11960
|
spendCappedIndices: number[];
|
|
11956
11961
|
authFailureFence: number; // highest `authFailureSeq` among these rows
|
|
11962
|
+
/**
|
|
11963
|
+
* Usage per pool position (`keyUsageFromWindows`: max of the live 5h and 7d
|
|
11964
|
+
* utilization, 0 when unobserved or reset). Ranks admissible keys only.
|
|
11965
|
+
*/
|
|
11966
|
+
keyUsage: number[];
|
|
11967
|
+
/**
|
|
11968
|
+
* Pace delta per pool position (`keyPaceFromWindows`: max of used minus elapsed
|
|
11969
|
+
* share over the live 5h, 7d and `modelFamily` weekly windows, 0 when none).
|
|
11970
|
+
* Ranks admissible keys under the `pace` strategy only.
|
|
11971
|
+
*/
|
|
11972
|
+
keyPace: number[];
|
|
11973
|
+
/**
|
|
11974
|
+
* `in_progress` tasks per pool position whose `credentialKeyType` is this key
|
|
11975
|
+
* type and whose `credentialKeySuffix` is the position's suffix. Breaks ties
|
|
11976
|
+
* within the usage band; it never excludes a key.
|
|
11977
|
+
*/
|
|
11978
|
+
activeSessions: number[];
|
|
11957
11979
|
}
|
|
11958
11980
|
|
|
11959
11981
|
/**
|
|
@@ -12086,6 +12108,44 @@ export async function getAvailableKeyIndices(
|
|
|
12086
12108
|
availableIndices.push(i);
|
|
12087
12109
|
}
|
|
12088
12110
|
|
|
12111
|
+
// A position several rows apply to (one key pooled in several scopes) takes the highest reading.
|
|
12112
|
+
const keyUsage = new Array<number>(totalKeys).fill(0);
|
|
12113
|
+
// The most over-pace reading wins; a position with no live window reads 0.
|
|
12114
|
+
const keyPace = new Array<number | undefined>(totalKeys).fill(undefined);
|
|
12115
|
+
for (const row of rows) {
|
|
12116
|
+
const windows = parseRateLimitWindowsJson(row.rateLimitWindows);
|
|
12117
|
+
const usage = keyUsageFromWindows(windows, nowMs);
|
|
12118
|
+
const pace = keyPaceFromWindows(windows, nowMs, modelFamily);
|
|
12119
|
+
for (const i of positionsOf(row)) {
|
|
12120
|
+
if (i < 0 || i >= totalKeys) continue;
|
|
12121
|
+
keyUsage[i] = Math.max(keyUsage[i]!, usage);
|
|
12122
|
+
if (pace !== undefined) keyPace[i] = Math.max(keyPace[i] ?? Number.NEGATIVE_INFINITY, pace);
|
|
12123
|
+
}
|
|
12124
|
+
}
|
|
12125
|
+
|
|
12126
|
+
// Running sessions per position. A task stamps its key suffix at session start
|
|
12127
|
+
// (`recordKeyUsage`), so this moves within seconds, before any usage report.
|
|
12128
|
+
// Without `keySuffixes`, a position takes the suffix of its stored row in scope.
|
|
12129
|
+
const suffixAt = (i: number): string | undefined =>
|
|
12130
|
+
suffixes
|
|
12131
|
+
? suffixes[i]
|
|
12132
|
+
: rows.find((r) => r.keyIndex === i && r.scope === scope && r.scopeId === effectiveScopeId)
|
|
12133
|
+
?.keySuffix;
|
|
12134
|
+
const positionSuffixes = Array.from({ length: totalKeys }, (_, i) => suffixAt(i));
|
|
12135
|
+
const distinctSuffixes = [...new Set(positionSuffixes.filter((s): s is string => !!s))];
|
|
12136
|
+
const sessionsBySuffix = new Map<string, number>();
|
|
12137
|
+
if (distinctSuffixes.length > 0) {
|
|
12138
|
+
const counts = await client.query<{ suffix: string; n: number }>(
|
|
12139
|
+
`SELECT credentialKeySuffix AS suffix, COUNT(*) AS n FROM agent_tasks
|
|
12140
|
+
WHERE status = 'in_progress' AND credentialKeyType = ?
|
|
12141
|
+
AND credentialKeySuffix IN (${distinctSuffixes.map(() => "?").join(", ")})
|
|
12142
|
+
GROUP BY credentialKeySuffix`,
|
|
12143
|
+
[keyType, ...distinctSuffixes],
|
|
12144
|
+
);
|
|
12145
|
+
for (const { suffix, n } of counts) sessionsBySuffix.set(suffix, n);
|
|
12146
|
+
}
|
|
12147
|
+
const activeSessions = positionSuffixes.map((s) => (s ? (sessionsBySuffix.get(s) ?? 0) : 0));
|
|
12148
|
+
|
|
12089
12149
|
return {
|
|
12090
12150
|
availableIndices,
|
|
12091
12151
|
rejectedIndices,
|
|
@@ -12097,6 +12157,9 @@ export async function getAvailableKeyIndices(
|
|
|
12097
12157
|
? new Date(earliestModelResetsAtSec * 1000).toISOString()
|
|
12098
12158
|
: null,
|
|
12099
12159
|
authFailureFence: Math.max(0, ...rows.map((r) => r.authFailureSeq)),
|
|
12160
|
+
keyUsage,
|
|
12161
|
+
keyPace: keyPace.map((pace) => pace ?? 0),
|
|
12162
|
+
activeSessions,
|
|
12100
12163
|
};
|
|
12101
12164
|
}
|
|
12102
12165
|
|
|
@@ -12536,6 +12599,8 @@ type UserRow = {
|
|
|
12536
12599
|
dailyBudgetUsd: number | null;
|
|
12537
12600
|
status: string;
|
|
12538
12601
|
mergedIntoUserId: string | null;
|
|
12602
|
+
// Migration 344: JSON of UserAvatar. NULL = initials.
|
|
12603
|
+
avatar: string | null;
|
|
12539
12604
|
createdAt: string;
|
|
12540
12605
|
lastUpdatedAt: string;
|
|
12541
12606
|
};
|
|
@@ -12554,6 +12619,7 @@ function rowToUser(row: UserRow): User {
|
|
|
12554
12619
|
dailyBudgetUsd: row.dailyBudgetUsd ?? null,
|
|
12555
12620
|
status: (row.status as "invited" | "active" | "suspended") ?? "active",
|
|
12556
12621
|
...(row.mergedIntoUserId ? { mergedIntoUserId: row.mergedIntoUserId } : {}),
|
|
12622
|
+
avatar: parseUserAvatar(row.avatar),
|
|
12557
12623
|
createdAt: row.createdAt,
|
|
12558
12624
|
lastUpdatedAt: row.lastUpdatedAt,
|
|
12559
12625
|
};
|
|
@@ -12580,12 +12646,13 @@ export async function createUser(data: {
|
|
|
12580
12646
|
metadata?: Record<string, unknown>;
|
|
12581
12647
|
dailyBudgetUsd?: number | null;
|
|
12582
12648
|
status?: "invited" | "active" | "suspended";
|
|
12649
|
+
avatar?: UserAvatar | null;
|
|
12583
12650
|
}): Promise<User> {
|
|
12584
12651
|
const id = crypto.randomUUID().replace(/-/g, "");
|
|
12585
12652
|
const now = new Date().toISOString();
|
|
12586
12653
|
const row = await getDbClient().get<UserRow>(
|
|
12587
|
-
`INSERT INTO users (id, name, email, role, notes, emailAliases, preferredChannel, timezone, metadata, dailyBudgetUsd, status, createdAt, lastUpdatedAt)
|
|
12588
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING *`,
|
|
12654
|
+
`INSERT INTO users (id, name, email, role, notes, emailAliases, preferredChannel, timezone, metadata, dailyBudgetUsd, status, avatar, createdAt, lastUpdatedAt)
|
|
12655
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING *`,
|
|
12589
12656
|
[
|
|
12590
12657
|
id,
|
|
12591
12658
|
data.name,
|
|
@@ -12598,6 +12665,7 @@ export async function createUser(data: {
|
|
|
12598
12665
|
data.metadata !== undefined ? JSON.stringify(data.metadata) : null,
|
|
12599
12666
|
data.dailyBudgetUsd ?? null,
|
|
12600
12667
|
data.status ?? "active",
|
|
12668
|
+
data.avatar ? JSON.stringify(data.avatar) : null,
|
|
12601
12669
|
now,
|
|
12602
12670
|
now,
|
|
12603
12671
|
],
|
|
@@ -12621,6 +12689,8 @@ export async function updateUser(
|
|
|
12621
12689
|
metadata: Record<string, unknown> | null;
|
|
12622
12690
|
dailyBudgetUsd: number | null;
|
|
12623
12691
|
status: "invited" | "active" | "suspended";
|
|
12692
|
+
// null resets to initials.
|
|
12693
|
+
avatar: UserAvatar | null;
|
|
12624
12694
|
}>,
|
|
12625
12695
|
): Promise<User | null> {
|
|
12626
12696
|
const sets: string[] = [];
|
|
@@ -12666,6 +12736,10 @@ export async function updateUser(
|
|
|
12666
12736
|
sets.push("status = ?");
|
|
12667
12737
|
params.push(data.status);
|
|
12668
12738
|
}
|
|
12739
|
+
if (data.avatar !== undefined) {
|
|
12740
|
+
sets.push("avatar = ?");
|
|
12741
|
+
params.push(data.avatar === null ? null : JSON.stringify(data.avatar));
|
|
12742
|
+
}
|
|
12669
12743
|
|
|
12670
12744
|
if (sets.length === 0) return getUserById(id);
|
|
12671
12745
|
|
|
@@ -14251,6 +14325,7 @@ type ScriptRunRow = {
|
|
|
14251
14325
|
agentId: string;
|
|
14252
14326
|
scriptName: string | null;
|
|
14253
14327
|
source: string;
|
|
14328
|
+
storedSource?: string | null;
|
|
14254
14329
|
args: string;
|
|
14255
14330
|
kind: string;
|
|
14256
14331
|
status: string;
|
|
@@ -14293,7 +14368,7 @@ function rowToScriptRun(row: ScriptRunRow): ScriptRun {
|
|
|
14293
14368
|
id: row.id,
|
|
14294
14369
|
agentId: row.agentId,
|
|
14295
14370
|
scriptName: row.scriptName ?? undefined,
|
|
14296
|
-
source: row.source,
|
|
14371
|
+
source: row.storedSource ?? row.source,
|
|
14297
14372
|
// Durable-run args are sealed replay state; callers get the redacted view.
|
|
14298
14373
|
// The supervisor reads the exact value via getScriptRunExecutionArgs.
|
|
14299
14374
|
args: sealedJsonForDisplay(row.args),
|
|
@@ -14341,40 +14416,43 @@ export async function createScriptRun(data: {
|
|
|
14341
14416
|
updatedBy?: string;
|
|
14342
14417
|
}): Promise<{ run: ScriptRun; existing: boolean }> {
|
|
14343
14418
|
const client = getDbClient();
|
|
14344
|
-
|
|
14345
|
-
|
|
14346
|
-
|
|
14347
|
-
|
|
14348
|
-
|
|
14349
|
-
|
|
14350
|
-
|
|
14419
|
+
return client.transaction(async () => {
|
|
14420
|
+
if (data.idempotencyKey) {
|
|
14421
|
+
const existing = await client.get<ScriptRunRow>(
|
|
14422
|
+
`${SCRIPT_RUN_SELECT} WHERE r.idempotencyKey = ?`,
|
|
14423
|
+
[data.idempotencyKey],
|
|
14424
|
+
);
|
|
14425
|
+
if (existing) return { run: rowToScriptRun(existing), existing: true };
|
|
14426
|
+
}
|
|
14351
14427
|
|
|
14352
|
-
|
|
14353
|
-
|
|
14354
|
-
|
|
14428
|
+
const sourceHash = await storeScriptRunSource(data.source);
|
|
14429
|
+
const row = await client.get<ScriptRunRow>(
|
|
14430
|
+
`INSERT INTO script_runs
|
|
14431
|
+
(id, agentId, scriptName, source, sourceHash, args, idempotencyKey, requestedByUserId, sourceTaskId,
|
|
14355
14432
|
created_by, updated_by, startedAt)
|
|
14356
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
14433
|
+
VALUES (?, ?, ?, '', ?, ?, ?, ?, ?, ?, ?, ?)
|
|
14357
14434
|
RETURNING *`,
|
|
14358
|
-
|
|
14359
|
-
|
|
14360
|
-
|
|
14361
|
-
|
|
14362
|
-
|
|
14363
|
-
|
|
14364
|
-
|
|
14365
|
-
|
|
14366
|
-
|
|
14367
|
-
|
|
14368
|
-
|
|
14369
|
-
|
|
14370
|
-
|
|
14371
|
-
|
|
14372
|
-
|
|
14373
|
-
|
|
14374
|
-
|
|
14375
|
-
|
|
14376
|
-
|
|
14377
|
-
|
|
14435
|
+
[
|
|
14436
|
+
data.id,
|
|
14437
|
+
data.agentId,
|
|
14438
|
+
data.scriptName ?? null,
|
|
14439
|
+
sourceHash,
|
|
14440
|
+
// Sealed, not scrubbed: this is the run's execution input. The supervisor
|
|
14441
|
+
// launches (and relaunches after a restart or pause) from it, so a
|
|
14442
|
+
// redacted value would change what the script receives.
|
|
14443
|
+
sealJson(data.args ?? null),
|
|
14444
|
+
data.idempotencyKey ?? null,
|
|
14445
|
+
data.requestedByUserId ?? null,
|
|
14446
|
+
data.sourceTaskId ?? null,
|
|
14447
|
+
data.createdBy ?? null,
|
|
14448
|
+
data.updatedBy ?? data.createdBy ?? null,
|
|
14449
|
+
// ISO like finishedAt and the inline path, not the column's datetime('now') default.
|
|
14450
|
+
new Date().toISOString(),
|
|
14451
|
+
],
|
|
14452
|
+
);
|
|
14453
|
+
if (!row) throw new Error("Failed to create script run");
|
|
14454
|
+
return { run: rowToScriptRun({ ...row, storedSource: data.source }), existing: false };
|
|
14455
|
+
});
|
|
14378
14456
|
}
|
|
14379
14457
|
|
|
14380
14458
|
// Persist a synchronous inline run (POST /api/scripts/run) as an already-terminal
|
|
@@ -14401,40 +14479,44 @@ export async function recordInlineScriptRun(data: {
|
|
|
14401
14479
|
const args = scrubJsonValue(data.args ?? null);
|
|
14402
14480
|
const output = data.output === undefined ? null : scrubJsonValue(data.output);
|
|
14403
14481
|
const provenance = getCurrentRunProvenance();
|
|
14404
|
-
const
|
|
14405
|
-
|
|
14406
|
-
|
|
14482
|
+
const client = getDbClient();
|
|
14483
|
+
return client.transaction(async () => {
|
|
14484
|
+
const sourceHash = await storeScriptRunSource(data.source);
|
|
14485
|
+
const row = await client.get<ScriptRunRow>(
|
|
14486
|
+
`INSERT INTO script_runs
|
|
14487
|
+
(id, agentId, scriptName, source, sourceHash, args, kind, status, output, error,
|
|
14407
14488
|
startedAt, finishedAt, requestedByUserId, created_by, updated_by, apiEndpointId,
|
|
14408
14489
|
sourceStepId, parentScriptRunId)
|
|
14409
|
-
VALUES (?, ?, ?, ?, ?, 'inline', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
14490
|
+
VALUES (?, ?, ?, '', ?, ?, 'inline', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
14410
14491
|
RETURNING *`,
|
|
14411
|
-
|
|
14412
|
-
|
|
14413
|
-
|
|
14414
|
-
|
|
14415
|
-
|
|
14416
|
-
|
|
14417
|
-
|
|
14418
|
-
|
|
14419
|
-
|
|
14420
|
-
|
|
14421
|
-
|
|
14422
|
-
|
|
14423
|
-
|
|
14424
|
-
|
|
14425
|
-
|
|
14426
|
-
|
|
14427
|
-
|
|
14428
|
-
|
|
14429
|
-
|
|
14430
|
-
|
|
14431
|
-
|
|
14432
|
-
|
|
14433
|
-
|
|
14492
|
+
[
|
|
14493
|
+
data.id,
|
|
14494
|
+
data.agentId,
|
|
14495
|
+
data.scriptName ?? null,
|
|
14496
|
+
sourceHash,
|
|
14497
|
+
args,
|
|
14498
|
+
data.status,
|
|
14499
|
+
output,
|
|
14500
|
+
data.error ?? null,
|
|
14501
|
+
data.startedAt,
|
|
14502
|
+
data.finishedAt,
|
|
14503
|
+
data.requestedByUserId ?? null,
|
|
14504
|
+
data.createdBy ?? null,
|
|
14505
|
+
data.createdBy ?? null,
|
|
14506
|
+
data.apiEndpointId ?? null,
|
|
14507
|
+
// A run called through another script run's token (a nested
|
|
14508
|
+
// ctx.swarm.script_run) records that run and its workflow step.
|
|
14509
|
+
provenance?.sourceStepId ?? null,
|
|
14510
|
+
provenance?.sourceScriptRunId ?? null,
|
|
14511
|
+
],
|
|
14512
|
+
);
|
|
14513
|
+
if (!row) throw new Error("Failed to record inline script run");
|
|
14514
|
+
return rowToScriptRun({ ...row, storedSource: data.source });
|
|
14515
|
+
});
|
|
14434
14516
|
}
|
|
14435
14517
|
|
|
14436
14518
|
export async function getScriptRun(id: string): Promise<ScriptRun | null> {
|
|
14437
|
-
const row = await getDbClient().get<ScriptRunRow>(
|
|
14519
|
+
const row = await getDbClient().get<ScriptRunRow>(`${SCRIPT_RUN_SELECT} WHERE r.id = ?`, [id]);
|
|
14438
14520
|
return row ? rowToScriptRun(row) : null;
|
|
14439
14521
|
}
|
|
14440
14522
|
|
|
@@ -14442,7 +14524,7 @@ export async function getScriptRunByIdempotencyKey(
|
|
|
14442
14524
|
idempotencyKey: string,
|
|
14443
14525
|
): Promise<ScriptRun | null> {
|
|
14444
14526
|
const row = await getDbClient().get<ScriptRunRow>(
|
|
14445
|
-
|
|
14527
|
+
`${SCRIPT_RUN_SELECT} WHERE r.idempotencyKey = ?`,
|
|
14446
14528
|
[idempotencyKey],
|
|
14447
14529
|
);
|
|
14448
14530
|
return row ? rowToScriptRun(row) : null;
|
|
@@ -14639,7 +14721,7 @@ async function updateScriptRunGuarded(
|
|
|
14639
14721
|
|
|
14640
14722
|
export async function getRunningScriptRuns(): Promise<ScriptRun[]> {
|
|
14641
14723
|
const rows = await getDbClient().query<ScriptRunRow>(
|
|
14642
|
-
|
|
14724
|
+
`${SCRIPT_RUN_SELECT} WHERE r.status IN ('running', 'paused')`,
|
|
14643
14725
|
);
|
|
14644
14726
|
return rows.map(rowToScriptRun);
|
|
14645
14727
|
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* KV storage for the org design system (`src/themes/design-system.ts`). The
|
|
3
|
+
* `design-system` namespace is reserved, so these helpers are its only writer.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
DESIGN_SYSTEM_KEY,
|
|
8
|
+
DESIGN_SYSTEM_NAMESPACE,
|
|
9
|
+
DESIGN_SYSTEM_PREVIOUS_KEY,
|
|
10
|
+
readDesignSystem,
|
|
11
|
+
} from "../themes/design-system";
|
|
12
|
+
import type { DesignSystem } from "../types";
|
|
13
|
+
import { getDbClient, getKv, upsertKv } from "./db";
|
|
14
|
+
|
|
15
|
+
export type StoredDesignSystem =
|
|
16
|
+
| { status: "none" }
|
|
17
|
+
| { status: "invalid"; reason: string }
|
|
18
|
+
| { status: DesignSystem["status"]; record: DesignSystem };
|
|
19
|
+
|
|
20
|
+
function toStored(value: unknown): StoredDesignSystem {
|
|
21
|
+
const read = readDesignSystem(value);
|
|
22
|
+
if (!read) return { status: "none" };
|
|
23
|
+
if ("invalid" in read) return { status: "invalid", reason: read.invalid };
|
|
24
|
+
return { status: read.record.status, record: read.record };
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export async function getDesignSystem(): Promise<{
|
|
28
|
+
current: StoredDesignSystem;
|
|
29
|
+
previous: StoredDesignSystem;
|
|
30
|
+
}> {
|
|
31
|
+
const [current, previous] = await Promise.all([
|
|
32
|
+
getKv(DESIGN_SYSTEM_NAMESPACE, DESIGN_SYSTEM_KEY),
|
|
33
|
+
getKv(DESIGN_SYSTEM_NAMESPACE, DESIGN_SYSTEM_PREVIOUS_KEY),
|
|
34
|
+
]);
|
|
35
|
+
return { current: toStored(current?.value), previous: toStored(previous?.value) };
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** The record pages render with: an active, valid design system, else null. */
|
|
39
|
+
export async function getActiveDesignSystem(): Promise<DesignSystem | null> {
|
|
40
|
+
const stored = toStored((await getKv(DESIGN_SYSTEM_NAMESPACE, DESIGN_SYSTEM_KEY))?.value);
|
|
41
|
+
return "record" in stored && stored.record.status === "active" ? stored.record : null;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Saves `record` and moves the value it replaces to `org.prev`. */
|
|
45
|
+
export async function saveDesignSystem(record: DesignSystem): Promise<void> {
|
|
46
|
+
await getDbClient().transaction(async () => {
|
|
47
|
+
const current = await getKv(DESIGN_SYSTEM_NAMESPACE, DESIGN_SYSTEM_KEY);
|
|
48
|
+
if (current) {
|
|
49
|
+
await upsertKv({
|
|
50
|
+
namespace: DESIGN_SYSTEM_NAMESPACE,
|
|
51
|
+
key: DESIGN_SYSTEM_PREVIOUS_KEY,
|
|
52
|
+
value: current.value,
|
|
53
|
+
valueType: "json",
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
await upsertKv({
|
|
57
|
+
namespace: DESIGN_SYSTEM_NAMESPACE,
|
|
58
|
+
key: DESIGN_SYSTEM_KEY,
|
|
59
|
+
value: record,
|
|
60
|
+
valueType: "json",
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
-- Keep the legacy NOT NULL source column so this is an additive migration.
|
|
2
|
+
-- Boot moves existing source text into the content store in bounded batches.
|
|
3
|
+
CREATE TABLE script_run_sources (
|
|
4
|
+
hash TEXT PRIMARY KEY,
|
|
5
|
+
source TEXT NOT NULL
|
|
6
|
+
);
|
|
7
|
+
|
|
8
|
+
ALTER TABLE script_runs ADD COLUMN sourceHash TEXT REFERENCES script_run_sources(hash);
|
|
9
|
+
|
|
10
|
+
-- Includes NULLs for the resumable backfill, as well as FK and GC lookups.
|
|
11
|
+
CREATE INDEX idx_script_runs_sourceHash ON script_runs(sourceHash);
|
|
12
|
+
|
|
13
|
+
CREATE TRIGGER script_runs_delete_source
|
|
14
|
+
AFTER DELETE ON script_runs
|
|
15
|
+
WHEN OLD.sourceHash IS NOT NULL
|
|
16
|
+
BEGIN
|
|
17
|
+
DELETE FROM script_run_sources
|
|
18
|
+
WHERE hash = OLD.sourceHash
|
|
19
|
+
AND NOT EXISTS (SELECT 1 FROM script_runs WHERE sourceHash = OLD.sourceHash);
|
|
20
|
+
END;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
-- Adds a JSON-in-TEXT `avatar` column to `users`, the same shape as
|
|
2
|
+
-- `agents.avatar` (migration 119): a lucide glyph, an https image link, or an
|
|
3
|
+
-- agent-fs image. NULL means "no custom avatar"; the UI falls back to initials.
|
|
4
|
+
ALTER TABLE users ADD COLUMN avatar TEXT;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
-- Why a task reached its terminal status (e.g. failed + agent vs failed + error).
|
|
2
|
+
-- Refines `status` and never replaces it. NULL means unknown: rows finished
|
|
3
|
+
-- before this column existed are not backfilled. No CHECK constraint: the
|
|
4
|
+
-- valid kinds per status live in TASK_STATUS_KINDS (src/types.ts), so a new
|
|
5
|
+
-- kind needs no migration.
|
|
6
|
+
ALTER TABLE agent_tasks ADD COLUMN statusKind TEXT;
|
|
@@ -2,6 +2,7 @@ import type { Database } from "bun:sqlite";
|
|
|
2
2
|
import { createHash } from "node:crypto";
|
|
3
3
|
import { readdirSync, readFileSync } from "node:fs";
|
|
4
4
|
import { join } from "node:path";
|
|
5
|
+
import { backfillScriptRunSources } from "./script-run-sources";
|
|
5
6
|
|
|
6
7
|
interface Migration {
|
|
7
8
|
version: number;
|
|
@@ -198,6 +199,7 @@ export function runMigrations(db: Database): void {
|
|
|
198
199
|
db,
|
|
199
200
|
"no migrations directory could be located (see the preceding [migrations] warning)",
|
|
200
201
|
);
|
|
202
|
+
backfillScriptRunSources(db);
|
|
201
203
|
return;
|
|
202
204
|
}
|
|
203
205
|
|
|
@@ -215,6 +217,7 @@ export function runMigrations(db: Database): void {
|
|
|
215
217
|
|
|
216
218
|
if (migrations.length === 0) {
|
|
217
219
|
assertNotEmptyDatabase(db, `no .sql migration files found in ${migrationsDir}`);
|
|
220
|
+
backfillScriptRunSources(db);
|
|
218
221
|
return;
|
|
219
222
|
}
|
|
220
223
|
|
|
@@ -311,4 +314,9 @@ export function runMigrations(db: Database): void {
|
|
|
311
314
|
}
|
|
312
315
|
|
|
313
316
|
db.run("PRAGMA foreign_keys = ON");
|
|
317
|
+
|
|
318
|
+
// Run outside the schema transactions so an interrupted boot keeps completed
|
|
319
|
+
// batches. Check the actual schema even when its SQL file is not packaged:
|
|
320
|
+
// an upgraded database can reuse it even with an incomplete migration bundle.
|
|
321
|
+
backfillScriptRunSources(db);
|
|
314
322
|
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { Database } from "bun:sqlite";
|
|
2
|
+
import { createHash } from "node:crypto";
|
|
3
|
+
|
|
4
|
+
const BATCH_SIZE = 25;
|
|
5
|
+
|
|
6
|
+
function hasScriptRunSourceSchema(db: Database): boolean {
|
|
7
|
+
const schema = db
|
|
8
|
+
.prepare<{ ready: number }, []>(`SELECT
|
|
9
|
+
EXISTS (SELECT 1 FROM pragma_table_info('script_runs') WHERE name = 'sourceHash')
|
|
10
|
+
AND (SELECT count(*) FROM pragma_table_info('script_run_sources')
|
|
11
|
+
WHERE name IN ('hash', 'source')) = 2 AS ready`)
|
|
12
|
+
.get();
|
|
13
|
+
return Boolean(schema?.ready);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** The API must have the schema its run readers and writers use. */
|
|
17
|
+
export function assertScriptRunSourceSchema(db: Database): void {
|
|
18
|
+
if (!hasScriptRunSourceSchema(db)) {
|
|
19
|
+
throw new Error(
|
|
20
|
+
"[migrations] Required script-run source schema is missing. " +
|
|
21
|
+
"Ensure MIGRATIONS_DIR includes 342_script_run_sources.sql and run migrations before starting the API.",
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** Boot-only backfill: each committed batch can be safely skipped on restart. */
|
|
27
|
+
export function backfillScriptRunSources(db: Database): void {
|
|
28
|
+
// The generic migration runner also handles partial historical schemas.
|
|
29
|
+
if (!hasScriptRunSourceSchema(db)) return;
|
|
30
|
+
const pending = db.prepare<{ id: string; source: string }, []>(
|
|
31
|
+
`SELECT id, source FROM script_runs WHERE sourceHash IS NULL LIMIT ${BATCH_SIZE}`,
|
|
32
|
+
);
|
|
33
|
+
const insert = db.prepare(
|
|
34
|
+
"INSERT OR IGNORE INTO script_run_sources (hash, source) VALUES (?, ?)",
|
|
35
|
+
);
|
|
36
|
+
const update = db.prepare("UPDATE script_runs SET sourceHash = ?, source = '' WHERE id = ?");
|
|
37
|
+
|
|
38
|
+
const batch = db.transaction(() => {
|
|
39
|
+
const rows = pending.all();
|
|
40
|
+
for (const row of rows) {
|
|
41
|
+
const hash = createHash("sha256").update(row.source, "utf8").digest("hex");
|
|
42
|
+
insert.run(hash, row.source);
|
|
43
|
+
update.run(hash, row.id);
|
|
44
|
+
}
|
|
45
|
+
return rows.length;
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
while (batch.immediate() === BATCH_SIZE) {
|
|
49
|
+
// Release the write lock between batches; the NULL index is the watermark.
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FilesError } from "@/fs/provider";
|
|
2
|
-
import {
|
|
2
|
+
import { buildAgentFsFileLink } from "@/utils/constants";
|
|
3
3
|
import { agentFsClientFor } from "../agent-fs-identity";
|
|
4
4
|
import { getDbClient, getSwarmConfigs } from "../db";
|
|
5
5
|
import { parseScene } from "./boards/elements";
|
|
@@ -73,7 +73,7 @@ async function open(id: string) {
|
|
|
73
73
|
return { row, owner: row.ownerAgentId, provider: client.provider, scope };
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
const withLink = (row: Row): PrimitiveObject => ({ ...row, link:
|
|
76
|
+
const withLink = (row: Row): PrimitiveObject => ({ ...row, link: buildAgentFsFileLink(row) });
|
|
77
77
|
|
|
78
78
|
/** agent-fs keeps this drive's rows fresh through `file.changed` (object-webhooks.ts). */
|
|
79
79
|
async function driveWatched(orgId: string, driveId: string): Promise<boolean> {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type FileScope, FilesError, normalizeStoredKey } from "@/fs/provider";
|
|
2
|
-
import {
|
|
2
|
+
import { buildAgentFsFileLink } from "@/utils/constants";
|
|
3
3
|
import { scrubSecrets } from "@/utils/secret-scrubber";
|
|
4
4
|
import { agentFsClientFor } from "../agent-fs-identity";
|
|
5
5
|
import { getDbClient } from "../db";
|
|
@@ -107,7 +107,7 @@ const REINDEX_LIMITS: ReindexLimits = {
|
|
|
107
107
|
// shortcut: in-process only; two API replicas can still reindex one drive at once (each pass is safe, just duplicated work).
|
|
108
108
|
const reindexing = new Set<string>();
|
|
109
109
|
|
|
110
|
-
const withLink = (row: ObjectRow): PrimitiveObject => ({ ...row, link:
|
|
110
|
+
const withLink = (row: ObjectRow): PrimitiveObject => ({ ...row, link: buildAgentFsFileLink(row) });
|
|
111
111
|
|
|
112
112
|
export async function clientFor(agentId: string | undefined) {
|
|
113
113
|
const client = agentId ? await agentFsClientFor(agentId) : undefined;
|
package/src/be/rbac-roles.ts
CHANGED
|
@@ -46,6 +46,7 @@ export const BUILTIN_ROLES = [
|
|
|
46
46
|
"fs.join.own",
|
|
47
47
|
"objects.read",
|
|
48
48
|
"objects.write",
|
|
49
|
+
"page.launch",
|
|
49
50
|
],
|
|
50
51
|
},
|
|
51
52
|
{
|
|
@@ -61,6 +62,7 @@ export const BUILTIN_ROLES = [
|
|
|
61
62
|
"comb.presence",
|
|
62
63
|
"fs.join.own",
|
|
63
64
|
"objects.read",
|
|
65
|
+
"page.launch",
|
|
64
66
|
],
|
|
65
67
|
},
|
|
66
68
|
{
|
|
@@ -418,8 +418,8 @@ export interface BoardsNamespace {
|
|
|
418
418
|
export interface SwarmSdk {
|
|
419
419
|
// --- memory ---
|
|
420
420
|
memory_search(args: { query: string; intent: string; scope?: "all" | "agent" | "swarm"; limit?: number; source?: string; keyPrefix?: string }): Promise<unknown>;
|
|
421
|
-
memory_get(args: { memoryId
|
|
422
|
-
memory_rate(args: { id
|
|
421
|
+
memory_get(args: { memoryId?: string; id?: string; intent: string }): Promise<unknown>;
|
|
422
|
+
memory_rate(args: { id?: string; memoryId?: string; useful: boolean; note?: string; taskId?: string; referencesSource?: string }): Promise<unknown>;
|
|
423
423
|
// --- tasks ---
|
|
424
424
|
task_list(args?: Record<string, unknown>): Promise<unknown>;
|
|
425
425
|
task_get(args: { taskId: string }): Promise<unknown>;
|
|
@@ -579,7 +579,7 @@ export interface SwarmSdk {
|
|
|
579
579
|
chat_reply(args: { text?: string; card?: unknown }): Promise<unknown>;
|
|
580
580
|
chat_post(args: { adapter: "telegram" | "slack" | "discord" | "teams" | "rocketchat"; threadId?: string; channelId?: string; text?: string; card?: unknown }): Promise<unknown>;
|
|
581
581
|
chat_openDm(args: { adapter: "telegram" | "slack" | "discord" | "teams" | "rocketchat"; userId: string }): Promise<unknown>;
|
|
582
|
-
chat_registerChannel(args: { adapter: "telegram" | "slack" | "discord" | "teams" | "rocketchat"; channelId: string; agentId?: string; workflowId?: string; name?: string }): Promise<unknown>;
|
|
582
|
+
chat_registerChannel(args: { adapter: "telegram" | "slack" | "discord" | "teams" | "rocketchat"; channelId: string; agentId?: string; workflowId?: string; name?: string; defaultThreadId?: string }): Promise<unknown>;
|
|
583
583
|
chat_unregisterChannel(args: { adapter: "telegram" | "slack" | "discord" | "teams" | "rocketchat"; channelId: string }): Promise<unknown>;
|
|
584
584
|
|
|
585
585
|
// --- write: messaging (internal) ---
|
|
@@ -716,6 +716,8 @@ export interface SwarmSdk {
|
|
|
716
716
|
}): Promise<unknown>;
|
|
717
717
|
page_create(args: Record<string, unknown>): Promise<unknown>;
|
|
718
718
|
page_delete(args: { pageId?: string; slug?: string }): Promise<unknown>;
|
|
719
|
+
designSystem_get(args?: Record<string, never>): Promise<unknown>;
|
|
720
|
+
designSystem_set(args: Record<string, unknown>): Promise<unknown>;
|
|
719
721
|
metric_create(args: Record<string, unknown>): Promise<unknown>;
|
|
720
722
|
|
|
721
723
|
// --- human input ---
|