@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
|
@@ -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([]);
|
|
@@ -315,8 +349,10 @@ describe("secret corpus", () => {
|
|
|
315
349
|
|
|
316
350
|
describe("pass 5 throughput", () => {
|
|
317
351
|
// Informational budget. Timing-sensitive on a shared CI runner: retry
|
|
318
|
-
// absorbs a spike; a real regression fails every attempt.
|
|
319
|
-
|
|
352
|
+
// absorbs a spike; a real regression fails every attempt. Skipped in the
|
|
353
|
+
// nightly coverage run: instrumentation slows pass 5's JS more than the
|
|
354
|
+
// native regex passes, so the ratio sits near 2x there with no regression.
|
|
355
|
+
test.skipIf(process.env.ROOT_COVERAGE_RUN === "1")(
|
|
320
356
|
"10k lines with pass 5 cost under 2x the run without it",
|
|
321
357
|
() => {
|
|
322
358
|
const lines: string[] = [];
|
|
@@ -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);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { afterEach, beforeEach, describe, expect, test } from "bun:test";
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, spyOn, test } from "bun:test";
|
|
2
2
|
import { openAICompatibleKeyVars } from "@desplega/model-catalog";
|
|
3
3
|
import {
|
|
4
4
|
clearVolatileSecretsForTesting,
|
|
@@ -118,7 +118,7 @@ describe("scrubSecrets — env-based replacement", () => {
|
|
|
118
118
|
version: SCRUBBER_RULES_VERSION,
|
|
119
119
|
keyVars: [...openAICompatibleKeyVars()].sort(),
|
|
120
120
|
}).toEqual({
|
|
121
|
-
version:
|
|
121
|
+
version: 15,
|
|
122
122
|
keyVars: ["AI_GATEWAY_API_KEY", "HELMCODE_API_KEY", "HELMCODE_API_NAN", "NAN_API_KEY"],
|
|
123
123
|
});
|
|
124
124
|
});
|
|
@@ -415,6 +415,47 @@ describe("scrubObject", () => {
|
|
|
415
415
|
});
|
|
416
416
|
});
|
|
417
417
|
|
|
418
|
+
test("scrubs object keys, and two keys that redact alike both survive", () => {
|
|
419
|
+
const a = ["ghp", randomToken(36)].join("_");
|
|
420
|
+
const b = ["ghp", randomToken(36)].join("_");
|
|
421
|
+
const out = scrubObject({ [a]: "first", nested: { [b]: "second" }, [b]: "third", plain: 1 });
|
|
422
|
+
expect(out).toEqual({
|
|
423
|
+
"[REDACTED:github_token]": "first",
|
|
424
|
+
nested: { "[REDACTED:github_token]": "second" },
|
|
425
|
+
"[REDACTED:github_token]#2": "third",
|
|
426
|
+
plain: 1,
|
|
427
|
+
});
|
|
428
|
+
});
|
|
429
|
+
|
|
430
|
+
test("key clashes skip a literal suffixed key and keep every entry", () => {
|
|
431
|
+
const tokens = Array.from({ length: 2000 }, () => ["ghp", randomToken(36)].join("_"));
|
|
432
|
+
const input: Record<string, number> = { [tokens[0] as string]: 0 };
|
|
433
|
+
input["[REDACTED:github_token]#3"] = -1;
|
|
434
|
+
tokens.slice(1).forEach((token, i) => {
|
|
435
|
+
input[token] = i + 1;
|
|
436
|
+
});
|
|
437
|
+
// Cost guard: count the clash probes. A rescan from `#2` on every clash
|
|
438
|
+
// costs ~N^2/2 (about 2M here); the per-marker next-suffix cache keeps it
|
|
439
|
+
// near 2N. The lower bound proves the spy still sees the probe path.
|
|
440
|
+
const hasOwn = spyOn(Object, "hasOwn");
|
|
441
|
+
let out: Record<string, number>;
|
|
442
|
+
let probes: number;
|
|
443
|
+
try {
|
|
444
|
+
out = scrubObject(input);
|
|
445
|
+
probes = hasOwn.mock.calls.length;
|
|
446
|
+
} finally {
|
|
447
|
+
hasOwn.mockRestore();
|
|
448
|
+
}
|
|
449
|
+
expect(probes).toBeGreaterThanOrEqual(2001);
|
|
450
|
+
expect(probes).toBeLessThanOrEqual(4 * 2001);
|
|
451
|
+
expect(Object.keys(out)).toHaveLength(2001);
|
|
452
|
+
expect(out["[REDACTED:github_token]"]).toBe(0);
|
|
453
|
+
expect(out["[REDACTED:github_token]#2"]).toBe(1);
|
|
454
|
+
expect(out["[REDACTED:github_token]#3"]).toBe(-1);
|
|
455
|
+
expect(out["[REDACTED:github_token]#4"]).toBe(2);
|
|
456
|
+
expect(out["[REDACTED:github_token]#2001"]).toBe(1999);
|
|
457
|
+
});
|
|
458
|
+
|
|
418
459
|
test("handles circular references without recursing forever", () => {
|
|
419
460
|
const value: Record<string, unknown> = { a: "ok" };
|
|
420
461
|
value.self = value;
|
|
@@ -677,6 +718,9 @@ describe("scrubSecrets — env dumps and escaped forms", () => {
|
|
|
677
718
|
});
|
|
678
719
|
|
|
679
720
|
// Every credential below is built at runtime; nothing secret-shaped is a literal.
|
|
721
|
+
// The BEGIN line is joined at runtime too, so repo secret scanners never pair it with a later END.
|
|
722
|
+
const PEM_BEGIN = ["-----BEGIN", "PRIVATE KEY-----"].join(" ");
|
|
723
|
+
|
|
680
724
|
function pemBlock(label: string): string {
|
|
681
725
|
const body = Array.from({ length: 5 }, () => randomToken(64)).join("\n");
|
|
682
726
|
return `-----BEGIN ${label}PRIVATE KEY-----\n${body}\n-----END ${label}PRIVATE KEY-----`;
|
|
@@ -756,6 +800,20 @@ function probeCases(): ProbeCase[] {
|
|
|
756
800
|
}),
|
|
757
801
|
'{"type":"service_account","private_key":"-----BEGIN PRIVATE KEY-----[REDACTED:private_key]-----END PRIVATE KEY-----\\n","client_email":"bot@x.example"}',
|
|
758
802
|
);
|
|
803
|
+
const cut = pemBlock("").split("\n").slice(0, 3).join("\n");
|
|
804
|
+
add(
|
|
805
|
+
"PEM cut off before its END line",
|
|
806
|
+
cut.split("\n")[1] ?? "",
|
|
807
|
+
`${cut}\n[truncated 40 lines]`,
|
|
808
|
+
`${PEM_BEGIN}[REDACTED:private_key]\n[truncated 40 lines]`,
|
|
809
|
+
);
|
|
810
|
+
const gcpCut = JSON.stringify({ type: "service_account", private_key: `${pemBlock("")}\n` });
|
|
811
|
+
add(
|
|
812
|
+
"GCP service-account JSON cut off inside private_key",
|
|
813
|
+
gcpCut.split("\\n")[1] ?? "",
|
|
814
|
+
gcpCut.slice(0, 190),
|
|
815
|
+
`{"type":"service_account","private_key":"${PEM_BEGIN}[REDACTED:private_key]`,
|
|
816
|
+
);
|
|
759
817
|
s = `${randomToken(30)}.${randomToken(20)}`;
|
|
760
818
|
add(
|
|
761
819
|
"Authorization: Bearer (raw)",
|
|
@@ -933,6 +991,8 @@ describe("scrubSecrets — over-redaction guards", () => {
|
|
|
933
991
|
() => {
|
|
934
992
|
const inputs = [
|
|
935
993
|
`-----BEGIN RSA PRIVATE KEY-----${"A".repeat(200_000)}`,
|
|
994
|
+
`${PEM_BEGIN}${`${"A".repeat(15)}\n`.repeat(12_000)}`,
|
|
995
|
+
`${PEM_BEGIN}${`\\n${"A".repeat(15)}`.repeat(11_000)}`,
|
|
936
996
|
"-----BEGIN RSA PRIVATE KEY-----\n".repeat(6_000),
|
|
937
997
|
`"password": "${"\\\\".repeat(100_000)}`,
|
|
938
998
|
`\\"password\\": \\"${"\\\\".repeat(100_000)}`,
|
|
@@ -67,8 +67,8 @@ afterAll(async () => {
|
|
|
67
67
|
});
|
|
68
68
|
|
|
69
69
|
describe("seed-scripts catalog", () => {
|
|
70
|
-
test("manifest holds
|
|
71
|
-
expect(SEED_SCRIPTS.length).toBe(
|
|
70
|
+
test("manifest holds 42 unique, well-described scripts", () => {
|
|
71
|
+
expect(SEED_SCRIPTS.length).toBe(42);
|
|
72
72
|
const names = SEED_SCRIPTS.map((s) => s.name);
|
|
73
73
|
expect(new Set(names).size).toBe(names.length);
|
|
74
74
|
for (const s of SEED_SCRIPTS) {
|