@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
|
@@ -32,6 +32,7 @@ import { CLAUDE_CREDENTIALS_HINT, validateClaudeCredentials } from "../utils/cre
|
|
|
32
32
|
import { isEnvFlagEnabled } from "../utils/env-flag";
|
|
33
33
|
import {
|
|
34
34
|
parseStderrForErrors,
|
|
35
|
+
RATE_LIMIT_WINDOWS_EVENT,
|
|
35
36
|
redactRateLimitEventLine,
|
|
36
37
|
SessionErrorTracker,
|
|
37
38
|
trackErrorFromJson,
|
|
@@ -1293,6 +1294,10 @@ class ClaudeSession implements ProviderSession {
|
|
|
1293
1294
|
for (const event of normalized.events) this.emit(event);
|
|
1294
1295
|
|
|
1295
1296
|
trackErrorFromJson(json, this.errorTracker);
|
|
1297
|
+
if (json.type === "rate_limit_event") {
|
|
1298
|
+
const windows = this.errorTracker.getRateLimitWindows();
|
|
1299
|
+
if (windows) this.emit({ type: "custom", name: RATE_LIMIT_WINDOWS_EVENT, data: windows });
|
|
1300
|
+
}
|
|
1296
1301
|
} catch {
|
|
1297
1302
|
// Not JSON — ignore
|
|
1298
1303
|
}
|
|
@@ -14,6 +14,7 @@ import type { RunStopHookSessionSummaryOpts } from "../hooks/hook";
|
|
|
14
14
|
import { getContextWindowSize } from "../utils/context-window";
|
|
15
15
|
import {
|
|
16
16
|
parseStderrForErrors,
|
|
17
|
+
RATE_LIMIT_WINDOWS_EVENT,
|
|
17
18
|
redactRateLimitEvent,
|
|
18
19
|
SessionErrorTracker,
|
|
19
20
|
trackErrorFromJson,
|
|
@@ -576,6 +577,10 @@ class ClaudeSdkSession implements ProviderSession {
|
|
|
576
577
|
this.transcript.push(...normalized.transcriptEntries);
|
|
577
578
|
for (const event of normalized.events) this.emit(event);
|
|
578
579
|
trackErrorFromJson(json, this.errorTracker);
|
|
580
|
+
if (json.type === "rate_limit_event") {
|
|
581
|
+
const windows = this.errorTracker.getRateLimitWindows();
|
|
582
|
+
if (windows) this.emit({ type: "custom", name: RATE_LIMIT_WINDOWS_EVENT, data: windows });
|
|
583
|
+
}
|
|
579
584
|
return normalized.isResult;
|
|
580
585
|
}
|
|
581
586
|
|
|
@@ -39,6 +39,28 @@ import type {
|
|
|
39
39
|
// npm's `latest` is older and lacks the JSON/stdin contract used here.
|
|
40
40
|
export const DSH_PACKAGE = "@deepseek-ai/dsh@0.2.2-rc.3";
|
|
41
41
|
|
|
42
|
+
/** Held stderr past this is flushed as is, so a line with no newline cannot grow without bound. */
|
|
43
|
+
const STDERR_HOLD_MAX = 64 * 1024;
|
|
44
|
+
const PEM_PRIVATE_BEGIN_RE = /^-----BEGIN [A-Z0-9 ]{0,32}PRIVATE KEY/;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* How much of the pending stderr text can be scrubbed and emitted now: every
|
|
48
|
+
* complete line, except a private-key PEM block still waiting for its END
|
|
49
|
+
* line. A token split across two pipe chunks, or a PEM body split across
|
|
50
|
+
* lines, is then scrubbed whole. Past `STDERR_HOLD_MAX` everything goes, and
|
|
51
|
+
* the scrubber's truncated-PEM rule still covers a cut block.
|
|
52
|
+
*/
|
|
53
|
+
export function stderrFlushLength(pending: string): number {
|
|
54
|
+
if (pending.length > STDERR_HOLD_MAX) return pending.length;
|
|
55
|
+
let cut = pending.lastIndexOf("\n") + 1;
|
|
56
|
+
const begin = cut > 0 ? pending.lastIndexOf("-----BEGIN ", cut - 1) : -1;
|
|
57
|
+
if (begin >= 0 && !pending.slice(begin, cut).includes("-----END ")) {
|
|
58
|
+
const lineStart = pending.lastIndexOf("\n", begin) + 1;
|
|
59
|
+
if (PEM_PRIVATE_BEGIN_RE.test(pending.slice(begin, begin + 64))) cut = lineStart;
|
|
60
|
+
}
|
|
61
|
+
return cut;
|
|
62
|
+
}
|
|
63
|
+
|
|
42
64
|
export function checkDshCredentials(env: Record<string, string | undefined>): CredStatus {
|
|
43
65
|
return env.DEEPSEEK_API_KEY?.trim() || env.OPENROUTER_API_KEY?.trim()
|
|
44
66
|
? { ready: true, missing: [], satisfiedBy: "env" }
|
|
@@ -234,20 +256,33 @@ class DshSession implements ProviderSession {
|
|
|
234
256
|
|
|
235
257
|
private async readStderr(): Promise<void> {
|
|
236
258
|
const decoder = new TextDecoder();
|
|
259
|
+
// Scrub whole lines, not raw chunks: a chunk boundary can split a token.
|
|
260
|
+
let pending = "";
|
|
237
261
|
for await (const chunk of this.proc.stderr) {
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
262
|
+
pending += decoder.decode(chunk, { stream: true });
|
|
263
|
+
const cut = stderrFlushLength(pending);
|
|
264
|
+
if (cut === 0) continue;
|
|
265
|
+
const text = pending.slice(0, cut);
|
|
266
|
+
pending = pending.slice(cut);
|
|
267
|
+
await this.consumeStderr(text);
|
|
268
|
+
}
|
|
269
|
+
pending += decoder.decode();
|
|
270
|
+
if (pending) await this.consumeStderr(pending);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
private async consumeStderr(text: string): Promise<void> {
|
|
274
|
+
const content = scrubSecrets(text);
|
|
275
|
+
this.stderr = (this.stderr + content).slice(-8000);
|
|
276
|
+
this.emit({ type: "raw_stderr", content });
|
|
277
|
+
// dsh downgrades a failed plugin to a "did not activate" warning even
|
|
278
|
+
// with failOnStartupError, then runs on without the swarm tools. A
|
|
279
|
+
// session that cannot reach store-progress must not pass as healthy.
|
|
280
|
+
if (
|
|
281
|
+
!this.failure &&
|
|
282
|
+
this.stderr.includes(`${DSH_MCP_ENTRY_ID} (@deepseek-ai/dsh-mcp-client)`)
|
|
283
|
+
) {
|
|
284
|
+
this.failure = `dsh could not connect to the swarm MCP server: ${this.stderr.trim().slice(0, 500)}`;
|
|
285
|
+
await terminateProcessGroup(this.proc.pid);
|
|
251
286
|
}
|
|
252
287
|
}
|
|
253
288
|
|
|
@@ -117,7 +117,7 @@ export async function validateProviderDependencies(
|
|
|
117
117
|
: resolveAcpTarget(config);
|
|
118
118
|
const hint =
|
|
119
119
|
provider === "grok"
|
|
120
|
-
? "Use worker-full, install @xai-official/grok@1.0.
|
|
120
|
+
? "Use worker-full, install @xai-official/grok@1.0.88, or set GROK_BINARY to a trusted executable."
|
|
121
121
|
: provider === "fx"
|
|
122
122
|
? "Use worker-full, install the pinned fx release (Dockerfile.worker FX_VERSION), or set FX_BINARY."
|
|
123
123
|
: `ACP_TARGET='${target.target}'. ${acpInstallHints[target.target]}`;
|
|
@@ -348,6 +348,10 @@ export const LEGACY_POLICY = {
|
|
|
348
348
|
"comb.presence": operatorOrUser,
|
|
349
349
|
"fs.join.own": anyAuthenticated,
|
|
350
350
|
"page.delete.any": leadOrResourceOwner,
|
|
351
|
+
// Any agent records the requester's answer to the first-page ask (src/tools/design-system.ts).
|
|
352
|
+
"design-system.write": anyAuthenticated,
|
|
353
|
+
// Opening a page is a read. Writes from the page session keep their own verbs.
|
|
354
|
+
"page.launch": anyAuthenticated,
|
|
351
355
|
// Humans only: agents edit objects with the board-* and sheet-* tools as themselves.
|
|
352
356
|
"objects.read": operatorOrUser,
|
|
353
357
|
"objects.write": operatorOrUser,
|
package/src/rbac/permissions.ts
CHANGED
|
@@ -356,6 +356,14 @@ export const PERMISSIONS = {
|
|
|
356
356
|
description: "Delete a page the caller does not own.",
|
|
357
357
|
namespace: "page",
|
|
358
358
|
},
|
|
359
|
+
"design-system.write": {
|
|
360
|
+
description: "Set or decline the org design system that restyles every page.",
|
|
361
|
+
namespace: "page",
|
|
362
|
+
},
|
|
363
|
+
"page.launch": {
|
|
364
|
+
description: "Open a public or authed page: mint its page-session cookie.",
|
|
365
|
+
namespace: "page",
|
|
366
|
+
},
|
|
359
367
|
"objects.read": {
|
|
360
368
|
description:
|
|
361
369
|
"Read a board or sheet on the swarm's shared agent-fs drive through the object routes.",
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
updateScheduledTask,
|
|
7
7
|
} from "@/be/db";
|
|
8
8
|
import {
|
|
9
|
+
type ConfirmResult,
|
|
9
10
|
describeEventWait,
|
|
10
11
|
type EventMatch,
|
|
11
12
|
EXTERNAL_EVENT_ADAPTERS,
|
|
@@ -13,6 +14,7 @@ import {
|
|
|
13
14
|
type ExternalEventAdapter,
|
|
14
15
|
getExternalEventAdapter,
|
|
15
16
|
matchKeyOf,
|
|
17
|
+
toConfirmResult,
|
|
16
18
|
} from "@/event-waits";
|
|
17
19
|
import type { PreparedTaskCreate } from "@/tasks/sibling-awareness";
|
|
18
20
|
import { type AgentTask, type ScheduledTask, SUPERSEDED_WORKFLOW_TASK_REASON } from "@/types";
|
|
@@ -83,6 +85,7 @@ const WAIT_MEMBER_STATUS_SQL = `CASE
|
|
|
83
85
|
async function resolveWaitCause(
|
|
84
86
|
scheduleId: string,
|
|
85
87
|
reason: WakeReason,
|
|
88
|
+
causeDetail?: string,
|
|
86
89
|
): Promise<
|
|
87
90
|
{ table: WaitTable; mode?: "all" | "any"; cause: string; matchedTaskIds: string[] } | undefined
|
|
88
91
|
> {
|
|
@@ -102,11 +105,11 @@ async function resolveWaitCause(
|
|
|
102
105
|
if (reason !== externalWakeReason(eventWait.source, eventWait.event)) return undefined;
|
|
103
106
|
return {
|
|
104
107
|
table: "deferred_event_waits",
|
|
105
|
-
cause: describeEventWait(
|
|
108
|
+
cause: `${describeEventWait(
|
|
106
109
|
eventWait.source,
|
|
107
110
|
eventWait.event,
|
|
108
111
|
JSON.parse(eventWait.matchJson) as EventMatch,
|
|
109
|
-
)
|
|
112
|
+
)}${causeDetail ? `: ${causeDetail}` : ""}`,
|
|
110
113
|
matchedTaskIds: [],
|
|
111
114
|
};
|
|
112
115
|
}
|
|
@@ -160,8 +163,9 @@ async function prepareDeferredWakeTask(
|
|
|
160
163
|
scheduleId: string,
|
|
161
164
|
reason: WakeReason,
|
|
162
165
|
extraTags: string[],
|
|
166
|
+
causeDetail?: string,
|
|
163
167
|
): Promise<PreparedTaskCreate | undefined> {
|
|
164
|
-
const resolved = await resolveWaitCause(scheduleId, reason);
|
|
168
|
+
const resolved = await resolveWaitCause(scheduleId, reason, causeDetail);
|
|
165
169
|
if (!resolved) return undefined;
|
|
166
170
|
let schedule = await getScheduledTaskById(scheduleId);
|
|
167
171
|
if (!schedule?.enabled) return undefined;
|
|
@@ -179,11 +183,15 @@ async function prepareDeferredWakeTask(
|
|
|
179
183
|
*/
|
|
180
184
|
export const DEFERRED_WAIT_WOKE_EVENT = "task_deferred_wait_woke";
|
|
181
185
|
|
|
182
|
-
/**
|
|
186
|
+
/**
|
|
187
|
+
* Undefined means a normal schedule; an empty preparation means the wait is not ready.
|
|
188
|
+
* `causeDetail` is what an external event's confirm read reported; it is appended to the cause.
|
|
189
|
+
*/
|
|
183
190
|
export async function prepareDeferredTaskWait(
|
|
184
191
|
scheduleId: string,
|
|
185
192
|
reason: WakeReason,
|
|
186
193
|
extraTags: string[] = [],
|
|
194
|
+
causeDetail?: string,
|
|
187
195
|
): Promise<{ task?: PreparedTaskCreate } | undefined> {
|
|
188
196
|
const client = getDbClient();
|
|
189
197
|
// Keep ordinary schedule dispatch off the write-lock path.
|
|
@@ -199,7 +207,7 @@ export async function prepareDeferredTaskWait(
|
|
|
199
207
|
// first; the transaction below re-reads the wait and its member set before claiming.
|
|
200
208
|
// The prepared description carries the cause seen here; for an `any` wait a member
|
|
201
209
|
// that settles between this read and the claim is missing from that text only.
|
|
202
|
-
return { task: await prepareDeferredWakeTask(scheduleId, reason, extraTags) };
|
|
210
|
+
return { task: await prepareDeferredWakeTask(scheduleId, reason, extraTags, causeDetail) };
|
|
203
211
|
}
|
|
204
212
|
|
|
205
213
|
/** Undefined means a normal schedule; an empty result means another caller won. */
|
|
@@ -209,14 +217,16 @@ export async function dispatchDeferredTaskWait(
|
|
|
209
217
|
extraTags: string[] = [],
|
|
210
218
|
triggerTaskId?: string,
|
|
211
219
|
prepared?: { task?: PreparedTaskCreate },
|
|
220
|
+
causeDetail?: string,
|
|
212
221
|
): Promise<{ task?: AgentTask } | undefined> {
|
|
213
|
-
const preparation =
|
|
222
|
+
const preparation =
|
|
223
|
+
prepared ?? (await prepareDeferredTaskWait(scheduleId, reason, extraTags, causeDetail));
|
|
214
224
|
if (!preparation) return undefined;
|
|
215
225
|
const preparedForWait = preparation.task;
|
|
216
226
|
if (!preparedForWait) return {};
|
|
217
227
|
const client = getDbClient();
|
|
218
228
|
return client.transaction(async () => {
|
|
219
|
-
const resolved = await resolveWaitCause(scheduleId, reason);
|
|
229
|
+
const resolved = await resolveWaitCause(scheduleId, reason, causeDetail);
|
|
220
230
|
if (!resolved) return {};
|
|
221
231
|
let schedule = await getScheduledTaskById(scheduleId);
|
|
222
232
|
if (!schedule?.enabled) return {};
|
|
@@ -366,6 +376,50 @@ export async function reapSpentDeferredSchedules(now = new Date()): Promise<numb
|
|
|
366
376
|
return result.changes;
|
|
367
377
|
}
|
|
368
378
|
|
|
379
|
+
/**
|
|
380
|
+
* Newest confirm read per wait target. The same provider event can arrive twice
|
|
381
|
+
* (an App webhook and a repo webhook both subscribed), and a PR's check runs finish
|
|
382
|
+
* in bursts, so candidates for one target share reads. A caller only shares a read
|
|
383
|
+
* that has not started yet: one that started before the caller arrived may have read
|
|
384
|
+
* state the caller's event changed. So a candidate arriving mid-read queues one
|
|
385
|
+
* trailing read, which every later candidate joins until it starts. At most one read
|
|
386
|
+
* runs and one waits per target. The claim in `dispatchDeferredTaskWait` still makes
|
|
387
|
+
* the wake itself exactly-once.
|
|
388
|
+
*/
|
|
389
|
+
type ConfirmFlight = { started: boolean; result: Promise<ConfirmResult> };
|
|
390
|
+
const confirmFlights = new Map<string, ConfirmFlight>();
|
|
391
|
+
|
|
392
|
+
function confirmFresh(
|
|
393
|
+
key: string,
|
|
394
|
+
read: () => Promise<boolean | ConfirmResult>,
|
|
395
|
+
): Promise<ConfirmResult> {
|
|
396
|
+
const previous = confirmFlights.get(key);
|
|
397
|
+
if (previous && !previous.started) return previous.result;
|
|
398
|
+
const flight: ConfirmFlight = { started: false, result: Promise.resolve({ happened: false }) };
|
|
399
|
+
const after = previous ? previous.result.then(noop, noop) : Promise.resolve();
|
|
400
|
+
flight.result = after
|
|
401
|
+
.then(() => {
|
|
402
|
+
flight.started = true;
|
|
403
|
+
return read();
|
|
404
|
+
})
|
|
405
|
+
.then(toConfirmResult)
|
|
406
|
+
.finally(() => {
|
|
407
|
+
if (confirmFlights.get(key) === flight) confirmFlights.delete(key);
|
|
408
|
+
});
|
|
409
|
+
confirmFlights.set(key, flight);
|
|
410
|
+
return flight.result;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
function noop(): void {}
|
|
414
|
+
|
|
415
|
+
/** True when some agent holds a pending wait for `event`, so its webhook deliveries are worth verifying. */
|
|
416
|
+
export async function hasPendingEventWait(source: string, event: string): Promise<boolean> {
|
|
417
|
+
return !!(await getDbClient().get(
|
|
418
|
+
"SELECT 1 AS found FROM deferred_event_waits WHERE status = 'pending' AND source = ? AND event = ? LIMIT 1",
|
|
419
|
+
[source, event],
|
|
420
|
+
));
|
|
421
|
+
}
|
|
422
|
+
|
|
369
423
|
/**
|
|
370
424
|
* Fire pending external-event waits. A webhook names the candidate target (`only`)
|
|
371
425
|
* and sets `trustEvent`: an adapter without `confirm` fires on it, one with `confirm`
|
|
@@ -387,7 +441,7 @@ export async function reconcileDeferredEventWaits(
|
|
|
387
441
|
${only ? "AND w.source = ? AND w.event = ? AND w.matchKey = ?" : ""}`,
|
|
388
442
|
only ? [only.source, only.event, only.matchKey] : [],
|
|
389
443
|
);
|
|
390
|
-
const satisfied = new Map<string,
|
|
444
|
+
const satisfied = new Map<string, ConfirmResult>();
|
|
391
445
|
for (const wait of waits) {
|
|
392
446
|
const adapter = getExternalEventAdapter(wait.source);
|
|
393
447
|
if (!adapter || (!adapter.confirm && !trustEvent)) continue;
|
|
@@ -397,13 +451,20 @@ export async function reconcileDeferredEventWaits(
|
|
|
397
451
|
satisfied.set(
|
|
398
452
|
key,
|
|
399
453
|
adapter.confirm
|
|
400
|
-
? await
|
|
401
|
-
|
|
454
|
+
? await confirmFresh(key, () =>
|
|
455
|
+
adapter.confirm!(wait.event, JSON.parse(wait.matchJson) as EventMatch),
|
|
456
|
+
)
|
|
457
|
+
: { happened: true },
|
|
402
458
|
);
|
|
403
|
-
|
|
459
|
+
const result = satisfied.get(key)!;
|
|
460
|
+
if (result.happened)
|
|
404
461
|
await dispatchDeferredTaskWait(
|
|
405
462
|
wait.scheduleId,
|
|
406
463
|
externalWakeReason(wait.source, wait.event),
|
|
464
|
+
[],
|
|
465
|
+
undefined,
|
|
466
|
+
undefined,
|
|
467
|
+
result.detail,
|
|
407
468
|
);
|
|
408
469
|
} catch (err) {
|
|
409
470
|
// A broken wait must not stop the others or the ceiling poller.
|
|
@@ -462,7 +523,7 @@ export async function initDeferredTaskWaits(): Promise<void> {
|
|
|
462
523
|
for (const adapter of EXTERNAL_EVENT_ADAPTERS) {
|
|
463
524
|
const listener = externalEventListener(adapter);
|
|
464
525
|
externalEventListeners.set(adapter, listener);
|
|
465
|
-
workflowEventBus.onPrefix(
|
|
526
|
+
for (const prefix of adapter.busPrefixes) workflowEventBus.onPrefix(prefix, listener);
|
|
466
527
|
}
|
|
467
528
|
await reconcileDeferredTaskWaits();
|
|
468
529
|
// Provider reads can be slow or down: never hold boot on them.
|
|
@@ -479,7 +540,7 @@ export function stopDeferredTaskWaits(): void {
|
|
|
479
540
|
workflowEventBus.off("task.superseded", onTaskEvent);
|
|
480
541
|
workflowEventBus.off("task.created", onTaskEvent);
|
|
481
542
|
for (const [adapter, listener] of externalEventListeners) {
|
|
482
|
-
workflowEventBus.offPrefix(
|
|
543
|
+
for (const prefix of adapter.busPrefixes) workflowEventBus.offPrefix(prefix, listener);
|
|
483
544
|
}
|
|
484
545
|
externalEventListeners.clear();
|
|
485
546
|
}
|
package/src/scheduler/index.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
|
2
2
|
import { unlinkSync } from "node:fs";
|
|
3
3
|
import { closeDb, createAgent, createScheduledTask, createTaskExtended, initDb } from "../be/db";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
calculateNextRun,
|
|
6
|
+
createStandaloneScheduleTask,
|
|
7
|
+
parseSchedulerIntervalMs,
|
|
8
|
+
} from "./scheduler";
|
|
5
9
|
|
|
6
10
|
const TEST_DB_PATH = "./test-scheduler.sqlite";
|
|
7
11
|
|
|
@@ -20,6 +24,33 @@ afterAll(() => {
|
|
|
20
24
|
}
|
|
21
25
|
});
|
|
22
26
|
|
|
27
|
+
describe("parseSchedulerIntervalMs", () => {
|
|
28
|
+
test("falls back to 10s unless the value is an integer inside the timer range", () => {
|
|
29
|
+
const unusable = [
|
|
30
|
+
undefined,
|
|
31
|
+
"",
|
|
32
|
+
"abc",
|
|
33
|
+
"NaN",
|
|
34
|
+
"Infinity",
|
|
35
|
+
"-Infinity",
|
|
36
|
+
"0",
|
|
37
|
+
"-1",
|
|
38
|
+
"1.5",
|
|
39
|
+
"2147483648",
|
|
40
|
+
"10000000000",
|
|
41
|
+
];
|
|
42
|
+
for (const raw of unusable) {
|
|
43
|
+
expect(parseSchedulerIntervalMs(raw)).toBe(10_000);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
test("keeps a positive configured interval unchanged", () => {
|
|
48
|
+
expect(parseSchedulerIntervalMs("2500")).toBe(2500);
|
|
49
|
+
expect(parseSchedulerIntervalMs("30000")).toBe(30_000);
|
|
50
|
+
expect(parseSchedulerIntervalMs("2147483647")).toBe(2_147_483_647);
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
|
|
23
54
|
describe("calculateNextRun", () => {
|
|
24
55
|
test("calculates next run with cron expression", async () => {
|
|
25
56
|
const schedule = await createScheduledTask({
|
|
@@ -28,6 +28,7 @@ import { buildScriptCredentialBindingsWithFailures } from "@/be/script-credentia
|
|
|
28
28
|
import { getScript } from "@/be/scripts/db";
|
|
29
29
|
import { runScriptWithRunCredential } from "@/be/scripts/run-credential";
|
|
30
30
|
import { seededWorkflowState } from "@/be/seed/workflows-seeder";
|
|
31
|
+
import { SCHEDULER_INTERVAL_MS_BOUNDS } from "@/be/swarm-config-guard";
|
|
31
32
|
import { telemetry } from "@/telemetry";
|
|
32
33
|
import type { AgentTask, ScheduledTask, Workflow } from "@/types";
|
|
33
34
|
import { getExecutorRegistry as getWorkflowExecutorRegistry } from "@/workflows";
|
|
@@ -558,6 +559,28 @@ export async function executeSchedule(
|
|
|
558
559
|
}
|
|
559
560
|
}
|
|
560
561
|
|
|
562
|
+
/** Polling interval when `SCHEDULER_INTERVAL_MS` is absent or unusable. */
|
|
563
|
+
const DEFAULT_SCHEDULER_INTERVAL_MS = 10_000;
|
|
564
|
+
|
|
565
|
+
/**
|
|
566
|
+
* Parse SCHEDULER_INTERVAL_MS: an integer inside `SCHEDULER_INTERVAL_MS_BOUNDS`
|
|
567
|
+
* (1 ms to 24.8 days), or the 10-second default.
|
|
568
|
+
*
|
|
569
|
+
* `Number(value) || 10_000` kept a negative interval, and `setInterval` treats a
|
|
570
|
+
* non-positive delay as "as fast as the runtime permits", so a negative value made
|
|
571
|
+
* the scheduler poll in a tight loop (#3169). A delay above the 32-bit timer
|
|
572
|
+
* ceiling overflows to 1 ms and produces the same loop, so it falls back too. The
|
|
573
|
+
* config API validates the key against the same bounds; this is the boot-path
|
|
574
|
+
* guard for the deployment env, and for rows written before those bounds existed.
|
|
575
|
+
*/
|
|
576
|
+
export function parseSchedulerIntervalMs(raw: string | undefined): number {
|
|
577
|
+
const value = Number(raw);
|
|
578
|
+
const { min, max } = SCHEDULER_INTERVAL_MS_BOUNDS;
|
|
579
|
+
return Number.isInteger(value) && value >= min && value <= max
|
|
580
|
+
? value
|
|
581
|
+
: DEFAULT_SCHEDULER_INTERVAL_MS;
|
|
582
|
+
}
|
|
583
|
+
|
|
561
584
|
/**
|
|
562
585
|
* Start the scheduler polling loop.
|
|
563
586
|
* @param registry ExecutorRegistry for triggering workflows linked to schedules
|
|
@@ -565,7 +588,7 @@ export async function executeSchedule(
|
|
|
565
588
|
*/
|
|
566
589
|
export function startScheduler(
|
|
567
590
|
registry: ExecutorRegistry,
|
|
568
|
-
intervalMs =
|
|
591
|
+
intervalMs = DEFAULT_SCHEDULER_INTERVAL_MS,
|
|
569
592
|
opts?: { runId?: string },
|
|
570
593
|
): void {
|
|
571
594
|
if (schedulerRun) {
|
|
@@ -32,6 +32,7 @@ export const MAX_ACTIVE_CAPABILITY_DISPATCHES = 8;
|
|
|
32
32
|
export type ScriptExecutionResult = {
|
|
33
33
|
exitCode: number | null;
|
|
34
34
|
stderr: string;
|
|
35
|
+
terminated?: boolean;
|
|
35
36
|
};
|
|
36
37
|
|
|
37
38
|
export type ScriptExecutionHandle = {
|
|
@@ -193,6 +194,7 @@ export class LocalProcessScriptExecutor implements ScriptExecutor {
|
|
|
193
194
|
let proc: Bun.Subprocess<"ignore", "ignore", "pipe"> | undefined;
|
|
194
195
|
let capabilitySocket: Socket | undefined;
|
|
195
196
|
let protocolFailure: Error | undefined;
|
|
197
|
+
let terminated = false;
|
|
196
198
|
const sockets = new Set<Socket>();
|
|
197
199
|
const server = createServer((socket) => {
|
|
198
200
|
sockets.add(socket);
|
|
@@ -412,6 +414,9 @@ export class LocalProcessScriptExecutor implements ScriptExecutor {
|
|
|
412
414
|
clearInterval(heartbeat);
|
|
413
415
|
await terminateProcessGroup(spawned.pid);
|
|
414
416
|
let stderr = await stderrPromise;
|
|
417
|
+
// The caller owns the status for pause/cancel/limits. On API shutdown,
|
|
418
|
+
// leaving it running lets the next supervisor replay the durable journal.
|
|
419
|
+
if (terminated) return { exitCode: processExitCode, stderr, terminated: true };
|
|
415
420
|
try {
|
|
416
421
|
if (protocolFailure) throw protocolFailure;
|
|
417
422
|
if (processExitCode !== 0) {
|
|
@@ -450,6 +455,7 @@ export class LocalProcessScriptExecutor implements ScriptExecutor {
|
|
|
450
455
|
startedAtMs: Date.now(),
|
|
451
456
|
exited,
|
|
452
457
|
terminate: async (signal = "SIGTERM") => {
|
|
458
|
+
terminated = true;
|
|
453
459
|
built.abortInFlightSteps();
|
|
454
460
|
if (signal === "SIGTERM") await terminateProcessGroup(spawned.pid);
|
|
455
461
|
else if (signal === "SIGKILL") forceTerminateProcessGroup(spawned.pid);
|
|
@@ -58,7 +58,8 @@ export async function startScriptRunProcess(
|
|
|
58
58
|
});
|
|
59
59
|
|
|
60
60
|
execution.exited
|
|
61
|
-
.then(async ({ exitCode, stderr }) => {
|
|
61
|
+
.then(async ({ exitCode, stderr, terminated }) => {
|
|
62
|
+
if (terminated) return;
|
|
62
63
|
const current = await getScriptRun(run.id);
|
|
63
64
|
if (current && current.status === "running") {
|
|
64
65
|
if (exitCode !== 0) {
|
|
@@ -219,6 +219,8 @@ export const SDK_TOOL_NAME_MAP = {
|
|
|
219
219
|
app_upsert: "app-upsert",
|
|
220
220
|
page_create: "create_page",
|
|
221
221
|
page_delete: "delete-page", // destructive
|
|
222
|
+
designSystem_get: "design-system-get",
|
|
223
|
+
designSystem_set: "design-system-set",
|
|
222
224
|
metric_create: "create_metric",
|
|
223
225
|
|
|
224
226
|
// ── human input ──
|
|
@@ -79,8 +79,13 @@ function bridgeRequestFor(name: string, args: unknown): BridgeRequest | null {
|
|
|
79
79
|
case "memory_search":
|
|
80
80
|
return { method: "POST", path: "/api/memory/search", body };
|
|
81
81
|
case "memory_get": {
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
if (body.memoryId && body.id && body.memoryId !== body.id) {
|
|
83
|
+
throw new Error("memoryId and id must identify the same memory; supply only one.");
|
|
84
|
+
}
|
|
85
|
+
const memoryId = body.memoryId ?? body.id;
|
|
86
|
+
if (typeof memoryId !== "string" || !memoryId) {
|
|
87
|
+
throw new Error("Supply memoryId (or its alias id) from memory-search.");
|
|
88
|
+
}
|
|
84
89
|
const getIntent = typeof body.intent === "string" ? body.intent : "script-sdk";
|
|
85
90
|
return {
|
|
86
91
|
method: "GET",
|
|
@@ -88,8 +93,15 @@ function bridgeRequestFor(name: string, args: unknown): BridgeRequest | null {
|
|
|
88
93
|
};
|
|
89
94
|
}
|
|
90
95
|
case "memory_rate": {
|
|
96
|
+
if (body.id && body.memoryId && body.id !== body.memoryId) {
|
|
97
|
+
throw new Error("id and memoryId must identify the same memory; supply only one.");
|
|
98
|
+
}
|
|
99
|
+
const memoryId = body.id ?? body.memoryId;
|
|
100
|
+
if (typeof memoryId !== "string" || !memoryId) {
|
|
101
|
+
throw new Error("Supply id (or its alias memoryId) from memory-search.");
|
|
102
|
+
}
|
|
91
103
|
const event = {
|
|
92
|
-
memoryId
|
|
104
|
+
memoryId,
|
|
93
105
|
signal: body.useful === false ? -1 : 1,
|
|
94
106
|
weight: 1,
|
|
95
107
|
source: "explicit-self",
|
|
@@ -108,6 +120,11 @@ function bridgeRequestFor(name: string, args: unknown): BridgeRequest | null {
|
|
|
108
120
|
}
|
|
109
121
|
|
|
110
122
|
// ── tasks ──
|
|
123
|
+
// task_storeProgress deliberately has no REST shortcut: the store-progress
|
|
124
|
+
// MCP tool owns every completion field (attachments, citations, uiSpec,
|
|
125
|
+
// learning, persistMemory, chainedTaskId), and rebuilding its body by hand
|
|
126
|
+
// silently dropped the fields this switch forgot. Falls through to the
|
|
127
|
+
// generic MCP bridge below, like task_defer and the other lifecycle tools.
|
|
111
128
|
case "task_list":
|
|
112
129
|
return { method: "GET", path: appendQuery("/api/tasks", body) };
|
|
113
130
|
case "task_get": {
|
|
@@ -115,27 +132,6 @@ function bridgeRequestFor(name: string, args: unknown): BridgeRequest | null {
|
|
|
115
132
|
if (!taskId) throw new Error("task_get requires string `taskId`");
|
|
116
133
|
return { method: "GET", path: `/api/tasks/${encodeURIComponent(taskId)}` };
|
|
117
134
|
}
|
|
118
|
-
case "task_storeProgress": {
|
|
119
|
-
const taskId = typeof body.taskId === "string" ? body.taskId : undefined;
|
|
120
|
-
if (!taskId) throw new Error("task_storeProgress requires string `taskId`");
|
|
121
|
-
if (body.status === "completed" || body.status === "failed" || body.status === "skipped") {
|
|
122
|
-
return {
|
|
123
|
-
method: "POST",
|
|
124
|
-
path: `/api/tasks/${encodeURIComponent(taskId)}/finish`,
|
|
125
|
-
body: {
|
|
126
|
-
status: body.status,
|
|
127
|
-
output: body.output,
|
|
128
|
-
failureReason: body.failureReason,
|
|
129
|
-
force: body.force,
|
|
130
|
-
},
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
return {
|
|
134
|
-
method: "POST",
|
|
135
|
-
path: `/api/tasks/${encodeURIComponent(taskId)}/progress`,
|
|
136
|
-
body: { progress: body.progress ?? "" },
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
135
|
case "task_cancel": {
|
|
140
136
|
const taskId = typeof body.taskId === "string" ? body.taskId : undefined;
|
|
141
137
|
if (!taskId) throw new Error("task_cancel requires string `taskId`");
|
|
@@ -497,8 +497,15 @@ declare module "swarm-sdk" {
|
|
|
497
497
|
source?: string;
|
|
498
498
|
keyPrefix?: string;
|
|
499
499
|
}): Promise<unknown>;
|
|
500
|
-
memory_get(args: { memoryId
|
|
501
|
-
memory_rate(args: {
|
|
500
|
+
memory_get(args: { memoryId?: string; id?: string; intent: string }): Promise<unknown>;
|
|
501
|
+
memory_rate(args: {
|
|
502
|
+
id?: string;
|
|
503
|
+
memoryId?: string;
|
|
504
|
+
useful: boolean;
|
|
505
|
+
note?: string;
|
|
506
|
+
taskId?: string;
|
|
507
|
+
referencesSource?: string;
|
|
508
|
+
}): Promise<unknown>;
|
|
502
509
|
// --- tasks ---
|
|
503
510
|
task_list(args?: Record<string, unknown>): Promise<unknown>;
|
|
504
511
|
task_get(args: { taskId: string }): Promise<unknown>;
|
|
@@ -863,6 +870,7 @@ declare module "swarm-sdk" {
|
|
|
863
870
|
agentId?: string;
|
|
864
871
|
workflowId?: string;
|
|
865
872
|
name?: string;
|
|
873
|
+
defaultThreadId?: string;
|
|
866
874
|
}): Promise<unknown>;
|
|
867
875
|
chat_unregisterChannel(args: {
|
|
868
876
|
adapter: "telegram" | "slack" | "discord" | "teams" | "rocketchat";
|
|
@@ -1067,6 +1075,8 @@ declare module "swarm-sdk" {
|
|
|
1067
1075
|
}): Promise<unknown>;
|
|
1068
1076
|
page_create(args: Record<string, unknown>): Promise<unknown>;
|
|
1069
1077
|
page_delete(args: { pageId?: string; slug?: string }): Promise<unknown>;
|
|
1078
|
+
designSystem_get(args?: Record<string, never>): Promise<unknown>;
|
|
1079
|
+
designSystem_set(args: Record<string, unknown>): Promise<unknown>;
|
|
1070
1080
|
metric_create(args: Record<string, unknown>): Promise<unknown>;
|
|
1071
1081
|
|
|
1072
1082
|
// --- human input ---
|
|
@@ -8,6 +8,7 @@ declare module "swarm-extension" {
|
|
|
8
8
|
| "chat"
|
|
9
9
|
| "workflow"
|
|
10
10
|
| "schedule"
|
|
11
|
+
| "system"
|
|
11
12
|
| "slack"
|
|
12
13
|
| "agentmail"
|
|
13
14
|
| "mcp"
|
|
@@ -17,7 +18,6 @@ declare module "swarm-extension" {
|
|
|
17
18
|
| "gitlab"
|
|
18
19
|
| "azure-devops"
|
|
19
20
|
| "bitbucket"
|
|
20
|
-
| "system"
|
|
21
21
|
| "linear"
|
|
22
22
|
| "jira"
|
|
23
23
|
| "comb"
|
|
@@ -159,6 +159,7 @@ declare module "swarm-extension" {
|
|
|
159
159
|
| "chat"
|
|
160
160
|
| "workflow"
|
|
161
161
|
| "schedule"
|
|
162
|
+
| "system"
|
|
162
163
|
| "slack"
|
|
163
164
|
| "agentmail"
|
|
164
165
|
| "mcp"
|
|
@@ -168,7 +169,6 @@ declare module "swarm-extension" {
|
|
|
168
169
|
| "gitlab"
|
|
169
170
|
| "azure-devops"
|
|
170
171
|
| "bitbucket"
|
|
171
|
-
| "system"
|
|
172
172
|
| "linear"
|
|
173
173
|
| "jira"
|
|
174
174
|
| "comb";
|
|
@@ -198,6 +198,23 @@ declare module "swarm-extension" {
|
|
|
198
198
|
rejectionReason?: string | undefined;
|
|
199
199
|
finishedAt?: string | undefined;
|
|
200
200
|
notifiedAt?: string | undefined;
|
|
201
|
+
statusKind?:
|
|
202
|
+
| "error"
|
|
203
|
+
| "workflow"
|
|
204
|
+
| "external"
|
|
205
|
+
| "agent"
|
|
206
|
+
| "runner"
|
|
207
|
+
| "deferred"
|
|
208
|
+
| "cascade"
|
|
209
|
+
| "user"
|
|
210
|
+
| "system"
|
|
211
|
+
| "graceful_shutdown"
|
|
212
|
+
| "context_limits"
|
|
213
|
+
| "manual_supersede"
|
|
214
|
+
| "crash_recovery"
|
|
215
|
+
| "provider_fallback"
|
|
216
|
+
| "workflow_retry"
|
|
217
|
+
| undefined;
|
|
201
218
|
failureReason?: string | undefined;
|
|
202
219
|
output?: string | undefined;
|
|
203
220
|
progress?: string | undefined;
|