@desplega.ai/agent-swarm 2.13.2 → 2.13.4
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-mr4temec.js +17 -0
- package/dist/{acp-targets-mz8c5dnt.js → acp-targets-zrk9k0n7.js} +10 -10
- package/dist/{actions-5ft3qp5a.js → actions-acqqj9jn.js} +236 -26
- package/dist/{agent-fs-provision-6fgz7wvz.js → agent-fs-provision-zmaykqnd.js} +4 -4
- package/dist/{amp-adapter-nthn8ezm.js → amp-adapter-a7ts8tmw.js} +3 -3
- package/dist/{app-535m78qw.js → app-tmwa442h.js} +7 -7
- package/dist/{approval-notifications-dewbk403.js → approval-notifications-6psaaaye.js} +8 -8
- package/dist/{assistant-39zyabv2.js → assistant-564v6emv.js} +25 -25
- package/dist/{boot-args-schema-bqv5bf77.js → boot-args-schema-n099e0f2.js} +1 -1
- package/dist/{boot-reembed-fas7z3zn.js → boot-reembed-chx66qfk.js} +1 -1
- package/dist/{boot-reembed-157c0gcz.js → boot-reembed-epvg4fp9.js} +1 -1
- package/dist/{boot-scrub-sweep-tmec0be2.js → boot-scrub-sweep-dhkfp0a7.js} +2 -2
- package/dist/{boot-seeds-32zm50x2.js → boot-seeds-m74fc07r.js} +4 -4
- package/dist/{boxd-hr8rsxzq.js → boxd-451q55ys.js} +1 -1
- package/dist/{claude-adapter-gwq7x2nj.js → claude-adapter-hw63yj3j.js} +12 -9
- package/dist/{claude-managed-adapter-rkvw6fvq.js → claude-managed-adapter-z5s7fx6p.js} +3 -3
- package/dist/{claude-managed-setup-0vgz4d1j.js → claude-managed-setup-wee1762m.js} +3 -3
- package/dist/{claude-sdk-session-5wbwxy8c.js → claude-sdk-session-cktyqkpk.js} +27 -13
- package/dist/{cli-d528acsw.js → cli-0fgvnb0x.js} +7 -7
- package/dist/{cli-2v4xxnx2.js → cli-0h8skzss.js} +1 -1
- package/dist/{cli-jkkcm72j.js → cli-0p76my9q.js} +31 -16
- package/dist/{cli-fp65jdp2.js → cli-1kvcsd2f.js} +219 -155
- package/dist/{cli-gc7jkf4a.js → cli-1vmhnncj.js} +3 -3
- package/dist/{cli-tceqvv6h.js → cli-29h5239w.js} +5 -5
- package/dist/cli-2ap1the6.js +11 -0
- package/dist/{cli-8fj8yfmk.js → cli-2vp0z049.js} +1 -1
- package/dist/{cli-ewb028rs.js → cli-3bxrrh53.js} +4 -4
- package/dist/{cli-nvqq3232.js → cli-3tzmh38q.js} +9 -9
- package/dist/{cli-0xwb7zpt.js → cli-3xqad83h.js} +2 -2
- package/dist/{cli-0f7n3td3.js → cli-3zrwrnz7.js} +1 -1
- package/dist/{cli-2wde56gv.js → cli-404am6f3.js} +7 -7
- package/dist/{cli-r4fphq38.js → cli-49aq3cyn.js} +4 -4
- package/dist/{cli-8qvte9hn.js → cli-4fpa0zns.js} +3 -3
- package/dist/{cli-x5yb8zc8.js → cli-4pbwg7sn.js} +2 -2
- package/dist/{cli-s08zsqva.js → cli-4q2c8rxw.js} +76 -10
- package/dist/{cli-3mf04tkh.js → cli-4vynxtrb.js} +1 -1
- package/dist/{cli-tbdw3f92.js → cli-5ashycw3.js} +3 -3
- package/dist/{cli-c9bwawf9.js → cli-5rgm8p39.js} +3 -3
- package/dist/{cli-g0b3ma7r.js → cli-5rxsb3wq.js} +6 -6
- package/dist/{cli-a6rzw649.js → cli-60dwk8tx.js} +3 -3
- package/dist/{cli-xhkek467.js → cli-7by7vp6m.js} +30 -4
- package/dist/{cli-62fjschk.js → cli-7g3fg4gf.js} +7 -7
- package/dist/{cli-ka13xx6b.js → cli-7gbff32z.js} +2 -2
- package/dist/{cli-q8aq48v1.js → cli-8b4rpnwj.js} +1 -1
- package/dist/{cli-1f48qdnb.js → cli-8cas2xvp.js} +3 -3
- package/dist/{cli-dnvmwsvc.js → cli-904wk98s.js} +799 -371
- package/dist/{cli-m1wddksc.js → cli-93n305hm.js} +2 -2
- package/dist/{cli-31vt7baf.js → cli-944w9wb4.js} +21 -17
- package/dist/{cli-je587f74.js → cli-94gx6ze9.js} +1 -1
- package/dist/{cli-fcwrd7bh.js → cli-9ah37a8a.js} +6 -6
- package/dist/{cli-rfejbpe1.js → cli-akm6y2a8.js} +1 -1
- package/dist/{cli-f8rcvf2x.js → cli-azj9t1f9.js} +37 -2
- package/dist/{cli-mwxez0pz.js → cli-b768ek79.js} +1 -1
- package/dist/{cli-cmgdptmx.js → cli-bv4vvnmg.js} +31 -7
- package/dist/{cli-1gevjrc1.js → cli-bzcwwebm.js} +1 -1
- package/dist/{cli-sjk85d7v.js → cli-cq4am6vg.js} +3 -3
- package/dist/{cli-f1sdh8ca.js → cli-d5pc8ep0.js} +103 -9
- package/dist/{cli-7m6bbtab.js → cli-ea7nz50q.js} +12 -12
- package/dist/{cli-zkbz8m2q.js → cli-fkpnx3vf.js} +1 -1
- package/dist/{cli-ya1cj689.js → cli-fw67mnyc.js} +1 -1
- package/dist/{cli-5basv0e7.js → cli-gkv0r2hq.js} +1 -1
- package/dist/{cli-nkfv398a.js → cli-gse7bp3z.js} +12 -10
- package/dist/{cli-4djg31jh.js → cli-gtj12v95.js} +1 -1
- package/dist/{cli-qn79645p.js → cli-h9d3sdnc.js} +1 -1
- package/dist/{cli-tgmate57.js → cli-hdhpdrka.js} +6 -23
- package/dist/{cli-fgm2mad9.js → cli-hhtbandk.js} +2 -2
- package/dist/cli-hyqksecw.js +1907 -0
- package/dist/{cli-t25rq8mg.js → cli-ja450998.js} +40 -11
- package/dist/{cli-43dsqhcp.js → cli-jbrc98qb.js} +4 -4
- package/dist/{cli-82j36f2m.js → cli-jjzxsk47.js} +9 -3
- package/dist/{cli-xerdrnqs.js → cli-jyhbvdga.js} +3 -3
- package/dist/{cli-t9nxq30h.js → cli-jzerrzgc.js} +8 -8
- package/dist/{cli-hv3820ez.js → cli-k0nebh10.js} +1 -1
- package/dist/{cli-s6fhqbz1.js → cli-ka48vpev.js} +6 -6
- package/dist/{cli-d2epqm0y.js → cli-kezzteka.js} +1 -1
- package/dist/{cli-getrvmtx.js → cli-kj84fqxz.js} +2 -2
- package/dist/{cli-h0ewec3d.js → cli-kr0jpw9c.js} +1 -1
- package/dist/{cli-gq6qhmrr.js → cli-m1sns1da.js} +3 -3
- package/dist/{cli-bp2rt28p.js → cli-n1kjs58m.js} +5 -5
- package/dist/{cli-rvhaahfv.js → cli-nc4pbwmp.js} +9 -9
- package/dist/{cli-d0jb2qnt.js → cli-p3knvk62.js} +74 -47
- package/dist/{cli-50whymxq.js → cli-p436yrzp.js} +2 -2
- package/dist/{cli-cs26ed89.js → cli-phdzn699.js} +8 -8
- package/dist/{cli-b0kqw55g.js → cli-pz1dp12c.js} +1 -1
- package/dist/{cli-8a4qg44m.js → cli-pz1nq5xm.js} +6 -6
- package/dist/{cli-e87fg3en.js → cli-qzz6tz8s.js} +1 -1
- package/dist/{cli-69eq6gdk.js → cli-rmgvwcmy.js} +38 -29
- package/dist/{cli-5k1hvycs.js → cli-rv3y60bt.js} +4 -4
- package/dist/cli-s33bzmk0.js +27 -0
- package/dist/{cli-at67kvnp.js → cli-srktrbby.js} +1 -1
- package/dist/{cli-6rmryz03.js → cli-t0jmkcah.js} +14 -14
- package/dist/{cli-eetzmsy5.js → cli-t9pzz2eq.js} +2 -2
- package/dist/{cli-wdtqkqnq.js → cli-tr19nyn9.js} +4 -4
- package/dist/{cli-erh1rgh4.js → cli-ts5yv7dn.js} +165 -88
- package/dist/{cli-zqy28rwx.js → cli-tsc3pdfd.js} +4 -4
- package/dist/{cli-x7aqhxj5.js → cli-tzw1jr2t.js} +2 -2
- package/dist/{cli-n14r8h4n.js → cli-x2cem5vy.js} +6 -4
- package/dist/{cli-vx9acp12.js → cli-ybte1fqc.js} +1 -1
- package/dist/{cli-xysy1g8x.js → cli-ysv0k1we.js} +2 -2
- package/dist/{cli-vdfngx2g.js → cli-ywy8yz6t.js} +2 -2
- package/dist/{cli-cpkxh68d.js → cli-z1vam71h.js} +2 -2
- package/dist/{cli-zm6bkx3e.js → cli-zexwhj3f.js} +3 -3
- package/dist/{cli-j2ybkdk2.js → cli-zhwjdhjr.js} +2 -2
- package/dist/{cli-gedf48yw.js → cli-zjdhrzm0.js} +8 -8
- package/dist/cli.js +20 -20
- package/dist/{codex-adapter-x25xfbnh.js → codex-adapter-2fs2c0n6.js} +8 -8
- package/dist/{codex-hook-c0nvm30r.js → codex-hook-jxjv6dy5.js} +10 -3
- package/dist/{codex-login-ven5cz5j.js → codex-login-ktfg1cxk.js} +1 -1
- package/dist/{codex-session-runner-kn5xnrvp.js → codex-session-runner-r55tmx4c.js} +9 -9
- package/dist/{commands-8n59gxmy.js → commands-0mxdy9x8.js} +3 -3
- package/dist/{controller-wn3vd217.js → controller-g3vkfhr4.js} +4 -4
- package/dist/{controllers-connect-09gvkrhc.js → controllers-connect-4wdmncqt.js} +25 -25
- package/dist/core-gsvj5f3z.js +42 -0
- package/dist/{cursor-adapter-w1681kp1.js → cursor-adapter-t9qb96q2.js} +2 -2
- package/dist/{db-e71keqxk.js → db-487vvyv9.js} +3 -3
- package/dist/{db-spg81qtr.js → db-76p7w3gr.js} +2 -2
- package/dist/{devin-adapter-fs90ab4v.js → devin-adapter-3bp6rape.js} +1 -1
- package/dist/{dispatcher-fr4vawwb.js → dispatcher-64rp6w67.js} +22 -22
- package/dist/{docker-1h33jvh9.js → docker-a59g3ebm.js} +2 -2
- package/dist/{dsh-adapter-g9yqv09y.js → dsh-adapter-8abzqk5c.js} +2 -2
- package/dist/{e2b-y7e5kmzf.js → e2b-3ykbe805.js} +2 -2
- package/dist/{e2b-jnk0yeva.js → e2b-dc8f6ctq.js} +2 -2
- package/dist/{easter-egg-3d-ac9tv9a6.js → easter-egg-3d-jrrwyf55.js} +1 -1
- package/dist/{embedding-space-an77f45k.js → embedding-space-001hhhpk.js} +6 -6
- package/dist/{embeddings-jkrehejr.js → embeddings-esj19cnw.js} +1 -1
- package/dist/{event-bus-08t2b4y2.js → event-bus-7gbsr0g4.js} +1 -1
- package/dist/{execute-3mys4nta.js → execute-301hkxqg.js} +1 -1
- package/dist/{external-channel-s6zxpts9.js → external-channel-w10e2j05.js} +2 -2
- package/dist/fx-adapter-4sjrbdne.js +20 -0
- package/dist/grok-adapter-3a0ezfee.js +20 -0
- package/dist/handlers-ef3k11hb.js +41 -0
- package/dist/{heartbeat-jjpb44e5.js → heartbeat-tbrj7vhq.js} +25 -25
- package/dist/hook-3am1sq68.js +22 -0
- package/dist/{hook-y6n23zzj.js → hook-tx917rqw.js} +11 -8
- package/dist/{http-8c6y008s.js → http-3rmemtqy.js} +340 -1841
- package/dist/{index-mbpxhc4w.js → index-126v2d0t.js} +1 -4
- package/dist/{index-xcw7hjt5.js → index-2jw11t8s.js} +26 -26
- package/dist/{index-p2f5xg64.js → index-3j803vnb.js} +36259 -34299
- package/dist/{index-we3nd2t0.js → index-aetfyx6p.js} +1 -1
- package/dist/index-e6bq0exk.js +42 -0
- package/dist/{index-0vthtbc2.js → index-gfnq66t1.js} +231 -25
- package/dist/index-hf2k1vge.js +39 -0
- package/dist/{index-6h3r0vpe.js → index-s7xtvc0f.js} +1 -1
- package/dist/index-taxmejj3.js +44 -0
- package/dist/{k8s-8326q0rq.js → k8s-36gfn847.js} +2 -2
- package/dist/{keepalive-7e9r5dvp.js → keepalive-9px3t7qj.js} +5 -5
- package/dist/lead-5vt6f174.js +83 -0
- package/dist/{maintenance-d3erjvcg.js → maintenance-vwqjwst6.js} +1 -1
- package/dist/{oauth-refresh-sweep-0qh70988.js → oauth-refresh-sweep-yqry3wn4.js} +4 -4
- package/dist/{object-webhooks-ac7v2q5p.js → object-webhooks-8s1wtths.js} +7 -7
- package/dist/{onboard-5yphtken.js → onboard-hb8czx0p.js} +7 -7
- package/dist/{opencode-adapter-0xvyba4m.js → opencode-adapter-djd6m6dk.js} +8 -8
- package/dist/{otel-impl-svqp691q.js → otel-impl-2ymwyczz.js} +2 -2
- package/dist/{pending-bn4xe5br.js → pending-nxavtvx7.js} +23 -23
- package/dist/{pi-mono-adapter-763s8a3w.js → pi-mono-adapter-d2cpmcy4.js} +13 -13
- package/dist/{pricing-refresh-kfc215mf.js → pricing-refresh-1yz8jkqv.js} +2 -2
- package/dist/{rbac-roles-6r4h2ghj.js → rbac-roles-7s6m31xw.js} +6 -4
- package/dist/{rbac-roles-3bznvkpt.js → rbac-roles-dbpx0x9v.js} +3 -3
- package/dist/{render-v2-f3qedbpy.js → render-v2-7y20rjrn.js} +7 -7
- package/dist/{resume-vcag4ann.js → resume-wz546x47.js} +10 -10
- package/dist/{runtime-x0s55z2t.js → runtime-cb5bd9tz.js} +1 -1
- package/dist/{session-access-nwzve8q2.js → session-access-4vcft8kq.js} +5 -5
- package/dist/{session-source-backfill-jpqfzmgz.js → session-source-backfill-57b50tpw.js} +3 -3
- package/dist/{setup-d2smwaem.js → setup-e1tevjyj.js} +1 -1
- package/dist/thread-buffer-686pa1p1.js +42 -0
- package/dist/{tree-visibility-dwzc8en0.js → tree-visibility-07wf1nct.js} +2 -2
- package/dist/{user-merge-jobs-4ce7kma2.js → user-merge-jobs-n20qpv6s.js} +3 -3
- package/dist/{virtual-modules-78a6yw71.js → virtual-modules-6fxmn1yv.js} +3 -3
- package/dist/{work-objects-m0w1e7q8.js → work-objects-eg7y48pe.js} +25 -25
- package/dist/worker-4vp616ms.js +83 -0
- package/dist/{worker-follow-up-e3t6f895.js → worker-follow-up-jnvnnf2b.js} +22 -22
- package/dist/{x-asbrnafg.js → x-d27jj7z7.js} +2 -2
- package/openapi.json +478 -28
- package/package.json +3 -3
- 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-retention.ts +1 -1
- package/src/be/db.ts +71 -62
- package/src/be/design-system.ts +63 -0
- package/src/be/migrations/342_script_run_sources.sql +20 -0
- package/src/be/migrations/runner.ts +8 -0
- package/src/be/migrations/script-run-sources.ts +51 -0
- package/src/be/rbac-roles.ts +2 -0
- package/src/be/scripts/typecheck.ts +4 -2
- 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 +21 -1
- package/src/commands/onboard/agent-fs-version.ts +1 -1
- package/src/commands/runner.ts +62 -6
- package/src/heartbeat/heartbeat.ts +18 -4
- package/src/hooks/codex-hook.ts +15 -4
- package/src/hooks/hook.ts +7 -0
- package/src/http/all-routes.ts +1 -0
- package/src/http/approval-chat-answer.ts +99 -0
- package/src/http/approval-requests.ts +280 -225
- package/src/http/design-system.ts +103 -0
- package/src/http/index.ts +10 -6
- package/src/http/pages-public.ts +25 -10
- package/src/http/pages.ts +17 -0
- package/src/http/person-responder.ts +28 -0
- package/src/http/session-cost-recompute.ts +3 -1
- package/src/http/session-data.ts +3 -0
- package/src/integrations/chat-sdk/adapters.ts +33 -3
- 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/kv-reserved-namespaces.ts +5 -0
- package/src/pages/page-head.ts +11 -1
- package/src/prompts/base-prompt.ts +1 -1
- package/src/prompts/session-templates.ts +1 -1
- package/src/providers/acp-targets.ts +2 -2
- package/src/providers/amp-adapter.ts +1 -1
- package/src/providers/claude-adapter.ts +21 -1
- package/src/providers/claude-sdk-session.ts +22 -3
- package/src/providers/claude-session-events.ts +76 -1
- package/src/providers/cursor-adapter.ts +1 -1
- package/src/providers/dsh-adapter.ts +48 -13
- package/src/providers/fx-adapter.ts +2 -2
- package/src/providers/pricing-sources.md +3 -0
- package/src/providers/types.ts +13 -0
- package/src/rbac/legacy-policy.ts +4 -0
- package/src/rbac/permissions.ts +8 -0
- 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 +12 -23
- package/src/scripts-runtime/types/stdlib.d.ts +4 -1
- package/src/scripts-runtime/types/swarm-sdk.d.ts +4 -1
- package/src/server.ts +2 -0
- package/src/slack/actions.ts +3 -0
- package/src/slack/approval-actions.ts +148 -0
- package/src/slack/approval-buttons.ts +28 -0
- package/src/slack/render-v2.ts +27 -7
- package/src/tests/base-prompt.test.ts +6 -2
- package/src/tests/chat-sdk-mentions.test.ts +183 -0
- package/src/tests/claude-adapter.test.ts +115 -0
- package/src/tests/create-page-tool.test.ts +5 -0
- package/src/tests/dsh-adapter.test.ts +53 -1
- package/src/tests/fixtures/compiled-source-schema-boot.ts +24 -0
- package/src/tests/fixtures/fx/acp-updates-recorded.jsonl +1 -1
- package/src/tests/fixtures/secret-corpus.ts +43 -1
- package/src/tests/heartbeat-stall-thresholds.test.ts +174 -0
- package/src/tests/internal-ai/complete-structured.test.ts +105 -0
- package/src/tests/internal-ai/credentials.test.ts +149 -0
- package/src/tests/internal-ai/task-title.test.ts +78 -0
- package/src/tests/jira-adf.test.ts +42 -2
- package/src/tests/mcp-input-caps.test.ts +16 -11
- package/src/tests/merge-gate-detect-changes.test.ts +208 -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/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-slot-reconcile.test.ts +102 -0
- package/src/tests/runtime-e2b-pools.test.ts +7 -1
- package/src/tests/schedule-target-type.test.ts +4 -1
- package/src/tests/script-connections.test.ts +2 -0
- 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 +34 -0
- 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/slack-render-v2.test.ts +85 -0
- package/src/tests/system-one-hosts-ui-mirror.test.ts +1 -0
- package/src/tests/vcs-azure-devops.test.ts +10 -0
- package/src/tests/vcs-provider.test.ts +8 -0
- package/src/themes/design-system.ts +163 -0
- package/src/themes/page-theme.ts +28 -19
- package/src/tools/chat-post.ts +7 -3
- package/src/tools/create-page.ts +3 -0
- package/src/tools/design-system.ts +102 -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/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 +67 -1
- package/src/utils/internal-ai/complete-structured.ts +36 -5
- package/src/utils/internal-ai/credentials.ts +78 -2
- package/src/utils/internal-ai/models.ts +37 -1
- package/src/utils/internal-ai/task-title.ts +31 -1
- 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/templates/skills/pages/content.md +34 -8
- package/templates/skills/swarm-docs/content.md +13 -0
- package/templates/skills/workflow-iterate/content.md +1 -1
- package/dist/acp-adapter-x1qqgzwx.js +0 -17
- package/dist/cli-n46d87mj.js +0 -98
- package/dist/core-2b8bv6ny.js +0 -42
- package/dist/fx-adapter-4yet1c4f.js +0 -20
- package/dist/grok-adapter-8ge6tw7m.js +0 -20
- package/dist/handlers-0r9evrdj.js +0 -41
- package/dist/hook-68gbs87k.js +0 -19
- package/dist/index-1v23363p.js +0 -39
- package/dist/index-30qw6vyw.js +0 -44
- package/dist/index-6bm3w6cn.js +0 -40
- package/dist/lead-3jpc7kcr.js +0 -79
- package/dist/thread-buffer-8fc703jc.js +0 -42
- package/dist/worker-3p2vq107.js +0 -79
|
@@ -71,7 +71,7 @@ export async function spawnSwarmServer(opts: {
|
|
|
71
71
|
const server = launchSwarmServer(opts, port, logFd);
|
|
72
72
|
if (opts.waitForListen === false) return server;
|
|
73
73
|
try {
|
|
74
|
-
await waitForListen(server);
|
|
74
|
+
await waitForListen(server, undefined, logStart);
|
|
75
75
|
} catch (error) {
|
|
76
76
|
if (server.proc.exitCode !== null) {
|
|
77
77
|
const attemptLog = await Bun.file(opts.logPath).slice(logStart).text();
|
|
@@ -139,7 +139,11 @@ function launchSwarmServer(
|
|
|
139
139
|
};
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
export async function waitForListen(
|
|
142
|
+
export async function waitForListen(
|
|
143
|
+
server: SwarmServer,
|
|
144
|
+
deadlineMs = 90_000,
|
|
145
|
+
logStart = 0,
|
|
146
|
+
): Promise<void> {
|
|
143
147
|
const start = Date.now();
|
|
144
148
|
while (Date.now() - start < deadlineMs) {
|
|
145
149
|
if (server.proc.exitCode !== null) {
|
|
@@ -148,8 +152,13 @@ export async function waitForListen(server: SwarmServer, deadlineMs = 90_000): P
|
|
|
148
152
|
);
|
|
149
153
|
}
|
|
150
154
|
try {
|
|
151
|
-
|
|
152
|
-
|
|
155
|
+
// Another test can take the released port and answer /docs during boot.
|
|
156
|
+
// Wait for this child to bind before trusting an HTTP readiness response.
|
|
157
|
+
const log = await Bun.file(server.logPath).slice(logStart).text();
|
|
158
|
+
if (log.includes(`MCP HTTP server running on http://localhost:${server.port}/mcp`)) {
|
|
159
|
+
const res = await fetch(`${server.base}/docs`, { signal: AbortSignal.timeout(500) });
|
|
160
|
+
if (res.ok) return;
|
|
161
|
+
}
|
|
153
162
|
} catch {
|
|
154
163
|
// not up yet
|
|
155
164
|
}
|
|
@@ -22,6 +22,7 @@ const REQUESTER_VERBS = [
|
|
|
22
22
|
"fs.join.own",
|
|
23
23
|
"objects.read",
|
|
24
24
|
"objects.write",
|
|
25
|
+
"page.launch",
|
|
25
26
|
"session.presence",
|
|
26
27
|
"session.share",
|
|
27
28
|
"task.action.own",
|
|
@@ -206,6 +207,7 @@ describe("ensureRbacSeedsSynced", () => {
|
|
|
206
207
|
"favorite.write.own",
|
|
207
208
|
"fs.join.own",
|
|
208
209
|
"objects.read",
|
|
210
|
+
"page.launch",
|
|
209
211
|
"session.presence",
|
|
210
212
|
]);
|
|
211
213
|
for (const verb of viewerVerbs) expect(REQUESTER_VERBS).toContain(verb);
|
|
@@ -12,10 +12,12 @@ import {
|
|
|
12
12
|
type ApiConfig,
|
|
13
13
|
checkCompletedProcesses,
|
|
14
14
|
DEFAULT_TASK_RECONCILE_INTERVAL_MS,
|
|
15
|
+
DEFAULT_TERMINAL_TASK_GRACE_MS,
|
|
15
16
|
type RunnerState,
|
|
16
17
|
type RunningTask,
|
|
17
18
|
reconcileActiveTasks,
|
|
18
19
|
resolveTaskReconcileIntervalMs,
|
|
20
|
+
resolveTerminalTaskGraceMs,
|
|
19
21
|
} from "../commands/runner";
|
|
20
22
|
import type { ProviderResult, ProviderSession } from "../providers/types";
|
|
21
23
|
import { registerVolatileSecret } from "../utils/secret-scrubber";
|
|
@@ -197,6 +199,106 @@ describe("reconcileActiveTasks: a session that never settles", () => {
|
|
|
197
199
|
});
|
|
198
200
|
});
|
|
199
201
|
|
|
202
|
+
describe("reconcileActiveTasks: a server-terminal task whose session can finish its input", () => {
|
|
203
|
+
/** Like Claude: `finishInput` closes stdin; `endsTurn` says whether the turn then ends. */
|
|
204
|
+
function finishableSetup(startedAt: number, endsTurn: boolean) {
|
|
205
|
+
const ctx = setup(startedAt);
|
|
206
|
+
const finishCalls: number[] = [];
|
|
207
|
+
ctx.session.finishInput = () => {
|
|
208
|
+
finishCalls.push(finishCalls.length);
|
|
209
|
+
if (!endsTurn) return;
|
|
210
|
+
ctx.task.result = {
|
|
211
|
+
exitCode: 0,
|
|
212
|
+
isError: false,
|
|
213
|
+
sessionId: "sess-hung",
|
|
214
|
+
cost: {
|
|
215
|
+
sessionId: "runner-session",
|
|
216
|
+
taskId: ctx.taskId,
|
|
217
|
+
agentId: crypto.randomUUID(),
|
|
218
|
+
totalCostUsd: 0.42,
|
|
219
|
+
durationMs: 1_000,
|
|
220
|
+
numTurns: 3,
|
|
221
|
+
model: "claude-sonnet-5-5",
|
|
222
|
+
isError: false,
|
|
223
|
+
provider: "claude",
|
|
224
|
+
},
|
|
225
|
+
};
|
|
226
|
+
};
|
|
227
|
+
return { ...ctx, finishCalls };
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
test("closes input instead of aborting, so the session's result and cost still land", async () => {
|
|
231
|
+
const startedAt = 6_000_000;
|
|
232
|
+
const { session, task, state, finishCalls } = finishableSetup(startedAt, true);
|
|
233
|
+
const apiConfig: ApiConfig = { apiUrl, apiKey: "test-key", agentId: crypto.randomUUID() };
|
|
234
|
+
|
|
235
|
+
await runUntilFree(state, startedAt, {
|
|
236
|
+
serverStatus: () => "completed",
|
|
237
|
+
apiConfig,
|
|
238
|
+
maxMs: 5 * 60_000,
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
expect(state.activeTasks.size).toBe(0);
|
|
242
|
+
expect(finishCalls).toHaveLength(1);
|
|
243
|
+
expect(session.abortReasons).toEqual([]);
|
|
244
|
+
expect(task.serverTerminalStatus).toBe("completed");
|
|
245
|
+
expect(requests).toContain("POST /api/session-costs");
|
|
246
|
+
expect(requests.some((r) => r.endsWith("/finish"))).toBe(false);
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
test("a session still running when the grace ends is aborted, then force-settled", async () => {
|
|
250
|
+
const startedAt = 7_000_000;
|
|
251
|
+
const { session, task, state, finishCalls } = finishableSetup(startedAt, false);
|
|
252
|
+
|
|
253
|
+
const { elapsedMs, statusReads } = await runUntilFree(state, startedAt, {
|
|
254
|
+
serverStatus: () => "completed",
|
|
255
|
+
maxMs: 5 * 60_000,
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
expect(state.activeTasks.size).toBe(0);
|
|
259
|
+
expect(finishCalls).toHaveLength(1);
|
|
260
|
+
expect(statusReads).toBe(1);
|
|
261
|
+
expect(session.abortReasons).toEqual(["server task completed"]);
|
|
262
|
+
expect(elapsedMs).toBeGreaterThanOrEqual(INTERVAL_MS + DEFAULT_TERMINAL_TASK_GRACE_MS);
|
|
263
|
+
expect(elapsedMs).toBeLessThanOrEqual(
|
|
264
|
+
INTERVAL_MS + DEFAULT_TERMINAL_TASK_GRACE_MS + ABORT_SETTLE_GRACE_MS + 2 * TICK_MS,
|
|
265
|
+
);
|
|
266
|
+
expect(task.result?.failureReason).toContain("runner exited without result");
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
test("a cancelled task is aborted at once, without the grace", async () => {
|
|
270
|
+
const startedAt = 8_000_000;
|
|
271
|
+
const { session, state, finishCalls } = finishableSetup(startedAt, true);
|
|
272
|
+
|
|
273
|
+
const { elapsedMs } = await runUntilFree(state, startedAt, {
|
|
274
|
+
serverStatus: () => "cancelled",
|
|
275
|
+
maxMs: 5 * 60_000,
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
expect(state.activeTasks.size).toBe(0);
|
|
279
|
+
expect(finishCalls).toHaveLength(0);
|
|
280
|
+
expect(session.abortReasons).toEqual(["server task cancelled"]);
|
|
281
|
+
expect(elapsedMs).toBeLessThanOrEqual(INTERVAL_MS + ABORT_SETTLE_GRACE_MS + 2 * TICK_MS);
|
|
282
|
+
});
|
|
283
|
+
});
|
|
284
|
+
|
|
285
|
+
describe("resolveTerminalTaskGraceMs", () => {
|
|
286
|
+
test("reads RUNNER_TERMINAL_TASK_GRACE_MS, accepts 0, and falls back on unset or invalid values", () => {
|
|
287
|
+
expect(resolveTerminalTaskGraceMs({ RUNNER_TERMINAL_TASK_GRACE_MS: "60000" })).toBe(60_000);
|
|
288
|
+
expect(resolveTerminalTaskGraceMs({ RUNNER_TERMINAL_TASK_GRACE_MS: "0" })).toBe(0);
|
|
289
|
+
expect(resolveTerminalTaskGraceMs({})).toBe(DEFAULT_TERMINAL_TASK_GRACE_MS);
|
|
290
|
+
expect(resolveTerminalTaskGraceMs({ RUNNER_TERMINAL_TASK_GRACE_MS: "" })).toBe(
|
|
291
|
+
DEFAULT_TERMINAL_TASK_GRACE_MS,
|
|
292
|
+
);
|
|
293
|
+
expect(resolveTerminalTaskGraceMs({ RUNNER_TERMINAL_TASK_GRACE_MS: "-1" })).toBe(
|
|
294
|
+
DEFAULT_TERMINAL_TASK_GRACE_MS,
|
|
295
|
+
);
|
|
296
|
+
expect(resolveTerminalTaskGraceMs({ RUNNER_TERMINAL_TASK_GRACE_MS: "soon" })).toBe(
|
|
297
|
+
DEFAULT_TERMINAL_TASK_GRACE_MS,
|
|
298
|
+
);
|
|
299
|
+
});
|
|
300
|
+
});
|
|
301
|
+
|
|
200
302
|
describe("resolveTaskReconcileIntervalMs", () => {
|
|
201
303
|
test("reads RUNNER_TASK_RECONCILE_INTERVAL_MS and falls back on unset or invalid values", () => {
|
|
202
304
|
expect(resolveTaskReconcileIntervalMs({ RUNNER_TASK_RECONCILE_INTERVAL_MS: "5000" })).toBe(
|
|
@@ -698,7 +698,13 @@ test("socket grace terminates a busy paused runtime before task recovery", async
|
|
|
698
698
|
fake.runtimes.delete(handle.externalId);
|
|
699
699
|
});
|
|
700
700
|
try {
|
|
701
|
-
|
|
701
|
+
// Recovery supersedes the task before asynchronously clearing its active session.
|
|
702
|
+
await socketGrace(
|
|
703
|
+
runtime,
|
|
704
|
+
async () =>
|
|
705
|
+
(await getTaskById(task.id))?.status === "superseded" &&
|
|
706
|
+
(await getActiveSessionForTask(task.id)) === null,
|
|
707
|
+
);
|
|
702
708
|
expect(fake.terminated).toEqual([runtime.externalHandle!.externalId]);
|
|
703
709
|
expect(fake.resumed).toHaveLength(0);
|
|
704
710
|
expect(await getActiveSessionForTask(task.id)).toBeNull();
|
|
@@ -163,7 +163,10 @@ type ScheduleScriptRunRow = {
|
|
|
163
163
|
|
|
164
164
|
async function scriptRunsFor(scriptName: string): Promise<ScheduleScriptRunRow[]> {
|
|
165
165
|
return getDbClient().query<ScheduleScriptRunRow>(
|
|
166
|
-
|
|
166
|
+
`SELECT r.agentId, r.scriptName, COALESCE(s.source, r.source) AS source,
|
|
167
|
+
r.kind, r.status, r.output, r.error, r.finishedAt
|
|
168
|
+
FROM script_runs r LEFT JOIN script_run_sources s ON s.hash = r.sourceHash
|
|
169
|
+
WHERE r.scriptName = ?`,
|
|
167
170
|
[scriptName],
|
|
168
171
|
);
|
|
169
172
|
}
|
|
@@ -728,6 +728,8 @@ describe("script connections", () => {
|
|
|
728
728
|
markMigrationApplied(database, "340_api_key_spend_cap.sql");
|
|
729
729
|
// 341 alters user_tokens, which this fixture does not create.
|
|
730
730
|
markMigrationApplied(database, "341_user_token_expiry.sql");
|
|
731
|
+
// 342 alters script_runs, which this migration-112-only fixture does not create.
|
|
732
|
+
markMigrationApplied(database, "342_script_run_sources.sql");
|
|
731
733
|
|
|
732
734
|
const id = crypto.randomUUID();
|
|
733
735
|
const now = new Date().toISOString();
|
|
@@ -170,22 +170,49 @@ describe("script_runs age-based retention", () => {
|
|
|
170
170
|
});
|
|
171
171
|
});
|
|
172
172
|
|
|
173
|
-
test("drains a backlog larger than one batch within the batch ceiling", async () => {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
173
|
+
test("drains a backlog larger than one batch within the batch ceiling and reclaims file space", async () => {
|
|
174
|
+
// The preload normally deserializes an in-memory template. Exercise a real
|
|
175
|
+
// fresh file here: vacuum mode must be set before its first schema object.
|
|
176
|
+
const globals = globalThis as typeof globalThis & { __testMigrationTemplate?: Uint8Array };
|
|
177
|
+
const template = globals.__testMigrationTemplate;
|
|
178
|
+
closeDb();
|
|
179
|
+
delete globals.__testMigrationTemplate;
|
|
180
|
+
await removeDbFiles();
|
|
181
|
+
try {
|
|
182
|
+
initDb(TEST_DB_PATH);
|
|
183
|
+
const client = getDbClient();
|
|
184
|
+
expect(await client.get("PRAGMA auto_vacuum")).toEqual({ auto_vacuum: 2 });
|
|
185
|
+
await client.run(
|
|
186
|
+
`WITH RECURSIVE n(v) AS (SELECT 1 UNION ALL SELECT v + 1 FROM n WHERE v < 1200)
|
|
187
|
+
INSERT INTO script_run_sources (hash, source)
|
|
188
|
+
SELECT 'bulk-hash-' || v, printf('%08192d', v) FROM n`,
|
|
189
|
+
);
|
|
190
|
+
await client.run(
|
|
191
|
+
`WITH RECURSIVE n(v) AS (SELECT 1 UNION ALL SELECT v + 1 FROM n WHERE v < 1200)
|
|
192
|
+
INSERT INTO script_runs (id, agentId, source, sourceHash, status, startedAt)
|
|
193
|
+
SELECT 'bulk-' || v, 'agent-1', '', 'bulk-hash-' || v, 'completed', ? FROM n`,
|
|
194
|
+
[OLD_ISO],
|
|
195
|
+
);
|
|
196
|
+
await client.query("PRAGMA wal_checkpoint(TRUNCATE)");
|
|
197
|
+
const before = Bun.file(TEST_DB_PATH).size;
|
|
198
|
+
process.env[DAYS_KEY] = "1";
|
|
199
|
+
|
|
200
|
+
await runDbRetentionTick({ now: NOW });
|
|
201
|
+
|
|
202
|
+
const stats = getDbRetentionStats().scriptRuns;
|
|
203
|
+
expect(await runIds()).toEqual([]);
|
|
204
|
+
expect(await client.get("SELECT COUNT(*) AS n FROM script_run_sources")).toEqual({ n: 0 });
|
|
205
|
+
expect(stats?.rowsDeleted).toBe(1200);
|
|
206
|
+
expect(stats?.batches).toBeGreaterThan(1);
|
|
207
|
+
expect(stats?.batchSize).toBeLessThanOrEqual(500);
|
|
208
|
+
await client.query("PRAGMA wal_checkpoint(TRUNCATE)");
|
|
209
|
+
expect(Bun.file(TEST_DB_PATH).size).toBeLessThan(before);
|
|
210
|
+
} finally {
|
|
211
|
+
closeDb();
|
|
212
|
+
globals.__testMigrationTemplate = template;
|
|
213
|
+
await removeDbFiles();
|
|
214
|
+
initDb(TEST_DB_PATH);
|
|
215
|
+
}
|
|
189
216
|
});
|
|
190
217
|
|
|
191
218
|
test("the delete, the backlog count and the journal cascade all use an index", async () => {
|
|
@@ -23,8 +23,12 @@ import { handleCore } from "../http/core";
|
|
|
23
23
|
import { handleScriptRuns } from "../http/script-runs";
|
|
24
24
|
import { handleScripts } from "../http/scripts";
|
|
25
25
|
import { getPathSegments, parseQueryParams } from "../http/utils";
|
|
26
|
-
import {
|
|
27
|
-
|
|
26
|
+
import {
|
|
27
|
+
localProcessScriptExecutor,
|
|
28
|
+
MAX_ACTIVE_CAPABILITY_DISPATCHES,
|
|
29
|
+
type ScriptExecutionResult,
|
|
30
|
+
} from "../script-workflows/executor";
|
|
31
|
+
import { pauseScriptRunProcess, stopScriptRunSupervisor } from "../script-workflows/supervisor";
|
|
28
32
|
import { refreshSecretScrubberCache } from "../utils/secret-scrubber";
|
|
29
33
|
import { SKIP_SANDBOX_SPAWN_TESTS } from "./sandbox-spawn-test-helpers";
|
|
30
34
|
import { listenOnFreePort } from "./test-net";
|
|
@@ -465,32 +469,62 @@ describe("script workflow runtime", () => {
|
|
|
465
469
|
);
|
|
466
470
|
|
|
467
471
|
spawnTest(
|
|
468
|
-
"pausing
|
|
472
|
+
"pausing and shutdown abort host polling while preserving resumable state and journal",
|
|
469
473
|
async () => {
|
|
470
474
|
holdAgentTaskResponses = true;
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
+
let executionExit: Promise<ScriptExecutionResult> | undefined;
|
|
476
|
+
const originalStart = localProcessScriptExecutor.start;
|
|
477
|
+
const startSpy = spyOn(localProcessScriptExecutor, "start").mockImplementation(
|
|
478
|
+
async (input) => {
|
|
479
|
+
const execution = await originalStart.call(localProcessScriptExecutor, input);
|
|
480
|
+
executionExit = execution.exited;
|
|
481
|
+
return execution;
|
|
482
|
+
},
|
|
483
|
+
);
|
|
484
|
+
try {
|
|
485
|
+
for (const [index, status] of (["paused", "running"] as const).entries()) {
|
|
486
|
+
const created = await api("/api/script-runs", {
|
|
487
|
+
method: "POST",
|
|
488
|
+
body: JSON.stringify({
|
|
489
|
+
source: `
|
|
475
490
|
export default async function main(_args, ctx) {
|
|
491
|
+
await ctx.step.swarmScript("before-stop", {
|
|
492
|
+
source: "export default () => 7;",
|
|
493
|
+
});
|
|
476
494
|
return await ctx.step.agentTask("paused-step", { task: "stay pending" });
|
|
477
495
|
}
|
|
478
496
|
`,
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
497
|
+
background: true,
|
|
498
|
+
}),
|
|
499
|
+
});
|
|
500
|
+
const { id } = (await created.json()) as { id: string };
|
|
501
|
+
await waitUntil(
|
|
502
|
+
() => agentTaskRequestCount === index + 1,
|
|
503
|
+
"Agent task poll did not start",
|
|
504
|
+
);
|
|
505
|
+
const beforeStop = await listScriptRunJournalSteps(id);
|
|
506
|
+
expect(beforeStop).toHaveLength(1);
|
|
507
|
+
expect(beforeStop[0]?.stepKey).toBe("before-stop");
|
|
508
|
+
expect(beforeStop[0]?.status).toBe("completed");
|
|
509
|
+
|
|
510
|
+
if (status === "paused") await pauseScriptRunProcess(id);
|
|
511
|
+
else await stopScriptRunSupervisor();
|
|
512
|
+
await waitUntil(
|
|
513
|
+
() => agentTaskClosedCount === index + 1,
|
|
514
|
+
"Host-side agent task poll was not aborted",
|
|
515
|
+
);
|
|
516
|
+
expect(executionExit).toBeDefined();
|
|
517
|
+
await executionExit;
|
|
518
|
+
|
|
519
|
+
const run = await getScriptRun(id);
|
|
520
|
+
expect(run?.status).toBe(status);
|
|
521
|
+
expect(run?.error).toBeUndefined();
|
|
522
|
+
expect(run?.finishedAt).toBeUndefined();
|
|
523
|
+
expect(await listScriptRunJournalSteps(id)).toEqual(beforeStop);
|
|
524
|
+
}
|
|
525
|
+
} finally {
|
|
526
|
+
startSpy.mockRestore();
|
|
527
|
+
}
|
|
494
528
|
},
|
|
495
529
|
);
|
|
496
530
|
|
|
@@ -715,7 +715,9 @@ describe("/api/scripts HTTP", () => {
|
|
|
715
715
|
});
|
|
716
716
|
const row = async (marker: string) =>
|
|
717
717
|
await getDbClient().get<{ sourceStepId: string | null; parentScriptRunId: string | null }>(
|
|
718
|
-
|
|
718
|
+
`SELECT r.sourceStepId, r.parentScriptRunId FROM script_runs r
|
|
719
|
+
LEFT JOIN script_run_sources s ON s.hash = r.sourceHash
|
|
720
|
+
WHERE COALESCE(s.source, r.source) LIKE ?`,
|
|
719
721
|
[`%${marker}%`],
|
|
720
722
|
);
|
|
721
723
|
|
|
@@ -1003,7 +1005,9 @@ describe("ctx.swarm.config.get through POST /api/scripts/run", () => {
|
|
|
1003
1005
|
expect(JSON.stringify(out.result)).not.toContain(shortSecretValue);
|
|
1004
1006
|
|
|
1005
1007
|
const row = await getDbClient().get<{ output: string | null }>(
|
|
1006
|
-
|
|
1008
|
+
`SELECT r.output FROM script_runs r
|
|
1009
|
+
LEFT JOIN script_run_sources s ON s.hash = r.sourceHash
|
|
1010
|
+
WHERE r.agentId = ? AND COALESCE(s.source, r.source) = ?`,
|
|
1007
1011
|
[workerId, source],
|
|
1008
1012
|
);
|
|
1009
1013
|
expect(row?.output).toBeTruthy();
|
|
@@ -1029,7 +1033,9 @@ describe("ctx.swarm.config.get through POST /api/scripts/run", () => {
|
|
|
1029
1033
|
expect(out.stderr).not.toContain(shortSecretValue);
|
|
1030
1034
|
|
|
1031
1035
|
const row = await getDbClient().get<{ error: string | null }>(
|
|
1032
|
-
|
|
1036
|
+
`SELECT r.error FROM script_runs r
|
|
1037
|
+
LEFT JOIN script_run_sources s ON s.hash = r.sourceHash
|
|
1038
|
+
WHERE r.agentId = ? AND COALESCE(s.source, r.source) = ?`,
|
|
1033
1039
|
[workerId, source],
|
|
1034
1040
|
);
|
|
1035
1041
|
expect(row?.error).toBeTruthy();
|
|
@@ -284,13 +284,17 @@ describe("script SDK allowlist", () => {
|
|
|
284
284
|
expect(mcpToolNameForSdkMethod("kv_del")).toBe("kv-delete");
|
|
285
285
|
});
|
|
286
286
|
|
|
287
|
-
test("task_storeProgress forwards
|
|
288
|
-
let
|
|
287
|
+
test("task_storeProgress forwards the whole completion payload to the store-progress tool", async () => {
|
|
288
|
+
let request: { method: string; path: string; body: Record<string, unknown> } | undefined;
|
|
289
289
|
const httpServer = Bun.serve({
|
|
290
290
|
port: 0,
|
|
291
291
|
async fetch(req) {
|
|
292
|
-
|
|
293
|
-
|
|
292
|
+
request = {
|
|
293
|
+
method: req.method,
|
|
294
|
+
path: new URL(req.url).pathname,
|
|
295
|
+
body: (await req.json()) as Record<string, unknown>,
|
|
296
|
+
};
|
|
297
|
+
return Response.json({ success: true, message: "Task marked as completed." });
|
|
294
298
|
},
|
|
295
299
|
});
|
|
296
300
|
const config = new SwarmConfig({
|
|
@@ -304,17 +308,26 @@ describe("script SDK allowlist", () => {
|
|
|
304
308
|
const sdk = createSwarmSdk(config);
|
|
305
309
|
|
|
306
310
|
try {
|
|
307
|
-
|
|
308
|
-
taskId: "
|
|
311
|
+
const args = {
|
|
312
|
+
taskId: "5f0f0f0f-1111-4111-8111-111111111111",
|
|
309
313
|
status: "completed",
|
|
310
|
-
output: "
|
|
314
|
+
output: "Shipped it [citation:1]",
|
|
315
|
+
attachments: [
|
|
316
|
+
{ kind: "url", url: "https://example.com/report.md", name: "report.md", isPrimary: true },
|
|
317
|
+
],
|
|
318
|
+
citations: [
|
|
319
|
+
{ index: 1, kind: "url", ref: "https://example.com/report.md", label: "Report" },
|
|
320
|
+
],
|
|
321
|
+
learning: "When a script finishes a task, send the artifacts with it.",
|
|
322
|
+
persistMemory: true,
|
|
311
323
|
force: true,
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
324
|
+
};
|
|
325
|
+
await sdk.task_storeProgress(args);
|
|
326
|
+
// No REST shortcut: the tool receives the caller's payload verbatim, so a
|
|
327
|
+
// completion field cannot be dropped by a stale body list here.
|
|
328
|
+
expect(request?.method).toBe("POST");
|
|
329
|
+
expect(request?.path).toBe("/api/mcp-bridge");
|
|
330
|
+
expect(request?.body).toEqual({ tool: "store-progress", args });
|
|
318
331
|
} finally {
|
|
319
332
|
httpServer.stop(true);
|
|
320
333
|
}
|
|
@@ -12,13 +12,15 @@ import {
|
|
|
12
12
|
startTask,
|
|
13
13
|
} from "../be/db";
|
|
14
14
|
import { handleCore } from "../http/core";
|
|
15
|
+
import { handleMcpBridge } from "../http/mcp-bridge";
|
|
15
16
|
import { handleTasks } from "../http/tasks";
|
|
16
17
|
import { getPathSegments, parseQueryParams } from "../http/utils";
|
|
17
18
|
import { SwarmConfig } from "../scripts-runtime/swarm-config";
|
|
18
19
|
import { createSwarmSdk } from "../scripts-runtime/swarm-sdk";
|
|
19
20
|
|
|
20
21
|
// ctx.swarm.task_storeProgress({ status: "skipped" }) must end the task as
|
|
21
|
-
// skipped through the
|
|
22
|
+
// skipped through the store-progress tool, keeping the reason, like a direct
|
|
23
|
+
// MCP call.
|
|
22
24
|
|
|
23
25
|
const TEST_DB_PATH = "./test-sdk-store-progress-skipped.sqlite";
|
|
24
26
|
const API_KEY = "example-test-sdk-store-progress-skipped-key-1234567890";
|
|
@@ -68,7 +70,10 @@ async function handle(request: Request): Promise<Response> {
|
|
|
68
70
|
if (!(await handleCore(req, res, requestAgentId, API_KEY))) {
|
|
69
71
|
const pathSegments = getPathSegments(req.url || "");
|
|
70
72
|
const queryParams = parseQueryParams(req.url || "");
|
|
71
|
-
if (
|
|
73
|
+
if (
|
|
74
|
+
!(await handleMcpBridge(req, res, pathSegments, queryParams, requestAgentId)) &&
|
|
75
|
+
!(await handleTasks(req, res, pathSegments, queryParams, requestAgentId))
|
|
76
|
+
) {
|
|
72
77
|
return new Response("Not Found", { status: 404 });
|
|
73
78
|
}
|
|
74
79
|
}
|
|
@@ -145,11 +150,13 @@ describe("ctx.swarm.task_storeProgress status skipped", () => {
|
|
|
145
150
|
const result = (await sdk().task_storeProgress({ taskId: task.id, status: "skipped" })) as {
|
|
146
151
|
success: boolean;
|
|
147
152
|
status: number;
|
|
148
|
-
|
|
153
|
+
message?: string;
|
|
149
154
|
};
|
|
155
|
+
// The store-progress tool refuses with a tool error, which the bridge
|
|
156
|
+
// reports as an HTTP 200 body carrying `success: false`.
|
|
150
157
|
expect(result.success).toBe(false);
|
|
151
|
-
expect(result.status).toBe(
|
|
152
|
-
expect(result.
|
|
158
|
+
expect(result.status).toBe(200);
|
|
159
|
+
expect(result.message).toContain("needs a one-line reason");
|
|
153
160
|
expect((await getTaskById(task.id))?.status).toBe("in_progress");
|
|
154
161
|
});
|
|
155
162
|
});
|
|
@@ -291,6 +291,40 @@ describe("secret corpus", () => {
|
|
|
291
291
|
}
|
|
292
292
|
});
|
|
293
293
|
|
|
294
|
+
test("redacts a positive followed by punctuation or a URL delimiter", () => {
|
|
295
|
+
// gitleaks ends most rules on a quote, whitespace or `;`. Prose, CSV and
|
|
296
|
+
// URLs put `.`, `,`, `)`, `/` or `&` there, which left 149 rules blind.
|
|
297
|
+
const delimiters = [".", ",", ":", ")", "]", "}", ">", "|", "/", "&", "?", "#"];
|
|
298
|
+
const misses: string[] = [];
|
|
299
|
+
for (const p of positives) {
|
|
300
|
+
if (p.text !== `the response included ${p.secret} in its body`) continue;
|
|
301
|
+
const texts = [
|
|
302
|
+
...delimiters.map((d) => `key ${p.secret}${d} next`),
|
|
303
|
+
`GET /x?q=${p.secret}&page=2`,
|
|
304
|
+
`id,${p.secret},2026`,
|
|
305
|
+
`(${p.secret})`,
|
|
306
|
+
];
|
|
307
|
+
for (const text of texts) {
|
|
308
|
+
if (scrubSecrets(text).includes(p.secret)) {
|
|
309
|
+
misses.push(`${p.name}: ${text.replace(p.secret, "<secret>")}`);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
expect(misses).toEqual([]);
|
|
314
|
+
});
|
|
315
|
+
|
|
316
|
+
test("the widened boundary keeps the delimiter and still stops mid-token", () => {
|
|
317
|
+
const stripe = ["sk", "live", randomToken(24)].join("_");
|
|
318
|
+
expect(scrubSecrets(`The key is ${stripe}.`)).toBe(
|
|
319
|
+
"The key is [REDACTED:gitleaks:stripe-access-token].",
|
|
320
|
+
);
|
|
321
|
+
expect(scrubSecrets(`GET /x?q=${stripe}&page=2`)).toBe(
|
|
322
|
+
"GET /x?q=[REDACTED:gitleaks:stripe-access-token]&page=2",
|
|
323
|
+
);
|
|
324
|
+
// An identifier character after the token is still not a boundary.
|
|
325
|
+
expect(scrubSecrets(`${stripe}_y`)).toBe(`${stripe}_y`);
|
|
326
|
+
});
|
|
327
|
+
|
|
294
328
|
test("leaves every negative untouched", () => {
|
|
295
329
|
const changed = buildNegatives().filter((text) => scrubSecrets(text) !== text);
|
|
296
330
|
expect(changed).toEqual([]);
|
|
@@ -62,6 +62,13 @@ describe("structural rule literals", () => {
|
|
|
62
62
|
lits.some((lit) => lower.includes(lit)),
|
|
63
63
|
`${rule.name} matched without one of its literals`,
|
|
64
64
|
).toBe(true);
|
|
65
|
+
// Pass 2 skips a case-sensitive rule unless a literal occurs in its exact case.
|
|
66
|
+
if (!rule.re.ignoreCase) {
|
|
67
|
+
expect(
|
|
68
|
+
rule.lits.some((lit) => m[0].includes(lit)),
|
|
69
|
+
`${rule.name} matched without one of its literals in its exact case`,
|
|
70
|
+
).toBe(true);
|
|
71
|
+
}
|
|
65
72
|
}
|
|
66
73
|
}
|
|
67
74
|
if (matches === 0) uncovered.push(rule.name);
|