@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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Database } from "bun:sqlite";
|
|
2
|
-
import { afterAll, describe, expect, test } from "bun:test";
|
|
3
|
-
import { mkdtempSync, rmSync } from "node:fs";
|
|
2
|
+
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
|
3
|
+
import { mkdirSync, mkdtempSync, readdirSync, rmSync } from "node:fs";
|
|
4
4
|
import { tmpdir } from "node:os";
|
|
5
5
|
import { join } from "node:path";
|
|
6
6
|
import {
|
|
@@ -106,8 +106,28 @@ describe("assertNotEmptyDatabase", () => {
|
|
|
106
106
|
|
|
107
107
|
describe("compiled binary — the exact failure mode this incident shipped in", () => {
|
|
108
108
|
const workDir = mkdtempSync(join(tmpdir(), "migration-bunfs-"));
|
|
109
|
-
const fixtureBinary = join(
|
|
109
|
+
const fixtureBinary = join(
|
|
110
|
+
workDir,
|
|
111
|
+
`compiled-migrations-boot${process.platform === "win32" ? ".exe" : ""}`,
|
|
112
|
+
);
|
|
110
113
|
const fixtureSrc = join(import.meta.dir, "fixtures", "compiled-migrations-boot.ts");
|
|
114
|
+
const apiBinary = join(
|
|
115
|
+
workDir,
|
|
116
|
+
`compiled-source-schema-boot${process.platform === "win32" ? ".exe" : ""}`,
|
|
117
|
+
);
|
|
118
|
+
const apiFixtureSrc = join(import.meta.dir, "fixtures", "compiled-source-schema-boot.ts");
|
|
119
|
+
const legacyDir = join(workDir, "legacy-migrations");
|
|
120
|
+
const emptyDir = join(workDir, "empty-migrations");
|
|
121
|
+
|
|
122
|
+
beforeAll(async () => {
|
|
123
|
+
mkdirSync(legacyDir);
|
|
124
|
+
mkdirSync(emptyDir);
|
|
125
|
+
for (const file of readdirSync(REPO_MIGRATIONS_DIR)) {
|
|
126
|
+
if (file.endsWith(".sql") && Number.parseInt(file, 10) < 342) {
|
|
127
|
+
await Bun.write(join(legacyDir, file), Bun.file(join(REPO_MIGRATIONS_DIR, file)));
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
});
|
|
111
131
|
|
|
112
132
|
afterAll(() => {
|
|
113
133
|
rmSync(workDir, { recursive: true, force: true });
|
|
@@ -116,13 +136,28 @@ describe("compiled binary — the exact failure mode this incident shipped in",
|
|
|
116
136
|
test(
|
|
117
137
|
"builds",
|
|
118
138
|
async () => {
|
|
119
|
-
const
|
|
120
|
-
[
|
|
121
|
-
|
|
122
|
-
)
|
|
123
|
-
|
|
139
|
+
for (const [source, binary] of [
|
|
140
|
+
[fixtureSrc, fixtureBinary],
|
|
141
|
+
[apiFixtureSrc, apiBinary],
|
|
142
|
+
]) {
|
|
143
|
+
const result = await runChild(
|
|
144
|
+
[
|
|
145
|
+
"bun",
|
|
146
|
+
"build",
|
|
147
|
+
source,
|
|
148
|
+
"--compile",
|
|
149
|
+
"--outfile",
|
|
150
|
+
binary,
|
|
151
|
+
// Exercise the Linux API image's virtual path on Windows too, where
|
|
152
|
+
// Bun otherwise uses B:\\~BUN\\root instead of /$bunfs/root.
|
|
153
|
+
...(process.platform === "win32" ? ["--define", 'import.meta.dir="/$bunfs/root"'] : []),
|
|
154
|
+
],
|
|
155
|
+
{ timeoutMs: CHILD_PROCESS_TEST_BUDGET_MS },
|
|
156
|
+
);
|
|
157
|
+
expectChildOk(result, "bun build --compile of the migrations fixture");
|
|
158
|
+
}
|
|
124
159
|
},
|
|
125
|
-
CHILD_PROCESS_TEST_BUDGET_MS + 5_000,
|
|
160
|
+
CHILD_PROCESS_TEST_BUDGET_MS * 2 + 5_000,
|
|
126
161
|
);
|
|
127
162
|
|
|
128
163
|
test(
|
|
@@ -164,4 +199,89 @@ describe("compiled binary — the exact failure mode this incident shipped in",
|
|
|
164
199
|
},
|
|
165
200
|
CHILD_PROCESS_TEST_BUDGET_MS + 5_000,
|
|
166
201
|
);
|
|
202
|
+
|
|
203
|
+
test.each(["omitted", "empty", "unset", "missing table", "missing hash column"])(
|
|
204
|
+
"refuses a legacy database before runtime reads when migration 342 is %s",
|
|
205
|
+
async (mode) => {
|
|
206
|
+
const dbPath = join(workDir, `legacy-${mode}.sqlite`);
|
|
207
|
+
// The standalone runner can prepare historical schemas. Actual API boot
|
|
208
|
+
// must reject them before handing a handle to its source readers.
|
|
209
|
+
expectChildOk(
|
|
210
|
+
await runChild([fixtureBinary, dbPath], {
|
|
211
|
+
env: { ...process.env, MIGRATIONS_DIR: legacyDir },
|
|
212
|
+
timeoutMs: CHILD_PROCESS_TEST_BUDGET_MS,
|
|
213
|
+
}),
|
|
214
|
+
"prepare pre-342 database",
|
|
215
|
+
);
|
|
216
|
+
if (mode === "missing table" || mode === "missing hash column") {
|
|
217
|
+
const legacy = new Database(dbPath);
|
|
218
|
+
try {
|
|
219
|
+
legacy.run(
|
|
220
|
+
mode === "missing table"
|
|
221
|
+
? "ALTER TABLE script_runs ADD COLUMN sourceHash TEXT"
|
|
222
|
+
: "CREATE TABLE script_run_sources (hash TEXT PRIMARY KEY, source TEXT NOT NULL)",
|
|
223
|
+
);
|
|
224
|
+
} finally {
|
|
225
|
+
legacy.close(true);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
const env = { ...process.env };
|
|
229
|
+
if (mode === "unset") delete env.MIGRATIONS_DIR;
|
|
230
|
+
else env.MIGRATIONS_DIR = mode === "empty" ? emptyDir : legacyDir;
|
|
231
|
+
|
|
232
|
+
const result = await runChild([apiBinary, dbPath], {
|
|
233
|
+
env,
|
|
234
|
+
timeoutMs: CHILD_PROCESS_TEST_BUDGET_MS,
|
|
235
|
+
});
|
|
236
|
+
expectChildOk(result, "compiled fixture with incomplete migrations");
|
|
237
|
+
const parsed = JSON.parse(result.stdout.trim());
|
|
238
|
+
expect(parsed.ok).toBe(false);
|
|
239
|
+
expect(parsed.error).toContain("342_script_run_sources.sql");
|
|
240
|
+
expect(parsed.error).toContain("MIGRATIONS_DIR");
|
|
241
|
+
},
|
|
242
|
+
CHILD_PROCESS_TEST_BUDGET_MS * 2 + 5_000,
|
|
243
|
+
);
|
|
244
|
+
|
|
245
|
+
test.each(["omitted", "empty", "unset"])(
|
|
246
|
+
"reuses and backfills an upgraded database when migration 342 is %s",
|
|
247
|
+
async (mode) => {
|
|
248
|
+
const dbPath = join(workDir, `upgraded-${mode}.sqlite`);
|
|
249
|
+
const seeded = await runChild([apiBinary, dbPath], {
|
|
250
|
+
env: { ...process.env, MIGRATIONS_DIR: REPO_MIGRATIONS_DIR },
|
|
251
|
+
timeoutMs: CHILD_PROCESS_TEST_BUDGET_MS,
|
|
252
|
+
});
|
|
253
|
+
expectChildOk(seeded, "prepare upgraded database");
|
|
254
|
+
expect(JSON.parse(seeded.stdout.trim()).ok).toBe(true);
|
|
255
|
+
const source = "export default () => '雪';\n";
|
|
256
|
+
const legacy = new Database(dbPath);
|
|
257
|
+
try {
|
|
258
|
+
legacy.run("INSERT INTO script_runs (id, agentId, source) VALUES ('legacy', 'agent', ?)", [
|
|
259
|
+
source,
|
|
260
|
+
]);
|
|
261
|
+
} finally {
|
|
262
|
+
legacy.close(true);
|
|
263
|
+
}
|
|
264
|
+
const env = { ...process.env };
|
|
265
|
+
if (mode === "unset") delete env.MIGRATIONS_DIR;
|
|
266
|
+
else env.MIGRATIONS_DIR = mode === "empty" ? emptyDir : legacyDir;
|
|
267
|
+
|
|
268
|
+
const result = await runChild([apiBinary, dbPath], {
|
|
269
|
+
env,
|
|
270
|
+
timeoutMs: CHILD_PROCESS_TEST_BUDGET_MS,
|
|
271
|
+
});
|
|
272
|
+
expectChildOk(result, "compiled fixture reusing upgraded source schema");
|
|
273
|
+
expect(JSON.parse(result.stdout.trim()).ok).toBe(true);
|
|
274
|
+
const reopened = new Database(dbPath);
|
|
275
|
+
const storedSource = reopened.prepare(`SELECT r.source AS legacySource, s.source
|
|
276
|
+
FROM script_runs r LEFT JOIN script_run_sources s ON s.hash = r.sourceHash
|
|
277
|
+
WHERE r.id = 'legacy'`);
|
|
278
|
+
try {
|
|
279
|
+
expect(storedSource.get()).toEqual({ legacySource: "", source });
|
|
280
|
+
} finally {
|
|
281
|
+
storedSource.finalize();
|
|
282
|
+
reopened.close(true);
|
|
283
|
+
}
|
|
284
|
+
},
|
|
285
|
+
CHILD_PROCESS_TEST_BUDGET_MS * 2 + 5_000,
|
|
286
|
+
);
|
|
167
287
|
});
|
|
@@ -38,15 +38,6 @@ describe("resolveServiceName", () => {
|
|
|
38
38
|
expect(resolveServiceName("lead")).toBe("agent-swarm");
|
|
39
39
|
});
|
|
40
40
|
|
|
41
|
-
test("a shared OTEL_SERVICE_NAME cannot collapse API and worker onto one name", () => {
|
|
42
|
-
// This is the SigNoz bug: compose sets OTEL_SERVICE_NAME=agent-swarm on
|
|
43
|
-
// both processes. The API role must still be distinguishable.
|
|
44
|
-
process.env.OTEL_SERVICE_NAME = "agent-swarm";
|
|
45
|
-
expect(resolveServiceName("api")).toBe("agent-swarm-api");
|
|
46
|
-
expect(resolveServiceName("worker")).toBe("agent-swarm");
|
|
47
|
-
expect(resolveServiceName("api")).not.toBe(resolveServiceName("worker"));
|
|
48
|
-
});
|
|
49
|
-
|
|
50
41
|
test("OTEL_SERVICE_NAME is treated as the base name for both roles", () => {
|
|
51
42
|
process.env.OTEL_SERVICE_NAME = "custom-swarm";
|
|
52
43
|
expect(resolveServiceName("api")).toBe("custom-swarm-api");
|
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
//
|
|
2
|
-
// src/http/session-data.ts (recordSessionCost call) and src/otel.ts (facade).
|
|
3
|
-
//
|
|
4
|
-
// Coverage goals:
|
|
5
|
-
// 1. otel.ts recordSessionCost() is a no-op when OTEL_EXPORTER_OTLP_ENDPOINT is unset.
|
|
6
|
-
// 2. handleSessionData() forwards the recomputed totalCostUsd + costSource to
|
|
7
|
-
// recordSessionCost() — not the raw request value.
|
|
8
|
-
// 3. All six token classes map to the expected token_type keys.
|
|
9
|
-
// 4. harness / pricing-table / unpriced / zero-cost cases are all covered.
|
|
1
|
+
// Verify cost drift metrics and forwarding from the real session-data handler.
|
|
10
2
|
|
|
11
3
|
import { afterAll, afterEach, beforeAll, describe, expect, mock, test } from "bun:test";
|
|
12
4
|
import { unlink } from "node:fs/promises";
|
|
@@ -28,33 +20,6 @@ const driftCounterAddSpy = mock((..._args: unknown[]) => {});
|
|
|
28
20
|
const driftCounter = { add: driftCounterAddSpy } as unknown as Counter;
|
|
29
21
|
const metricCounter = { add: mock((..._args: unknown[]) => {}) } as unknown as Counter;
|
|
30
22
|
|
|
31
|
-
// ── 1. Verify the otel.ts facade is a no-op when OTEL is disabled ────────────
|
|
32
|
-
|
|
33
|
-
describe("otel.ts recordSessionCost — no-op when OTEL_EXPORTER_OTLP_ENDPOINT is unset", () => {
|
|
34
|
-
test("does not throw and is a no-op without OTEL_EXPORTER_OTLP_ENDPOINT", async () => {
|
|
35
|
-
// The test environment never sets OTEL_EXPORTER_OTLP_ENDPOINT, so the
|
|
36
|
-
// facade's `enabled` flag is false and realRecordSessionCost is undefined.
|
|
37
|
-
const { recordSessionCost } = await import("../otel");
|
|
38
|
-
expect(() =>
|
|
39
|
-
recordSessionCost({
|
|
40
|
-
totalCostUsd: 0.05,
|
|
41
|
-
harness: "claude",
|
|
42
|
-
model: "claude-sonnet-4-6",
|
|
43
|
-
costSource: "harness",
|
|
44
|
-
isError: false,
|
|
45
|
-
tokens: {
|
|
46
|
-
input: 100,
|
|
47
|
-
output: 50,
|
|
48
|
-
cacheRead: 0,
|
|
49
|
-
cacheWrite: 0,
|
|
50
|
-
reasoning: 0,
|
|
51
|
-
thinking: 0,
|
|
52
|
-
},
|
|
53
|
-
}),
|
|
54
|
-
).not.toThrow();
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
|
|
58
23
|
describe("otel-impl cost drift metric", () => {
|
|
59
24
|
test("records absolute drift with direction and cost dimensions", () => {
|
|
60
25
|
driftCounterAddSpy.mockClear();
|
|
@@ -135,8 +100,6 @@ describe("otel-impl cost drift metric", () => {
|
|
|
135
100
|
});
|
|
136
101
|
});
|
|
137
102
|
|
|
138
|
-
// ── 2-4. handleSessionData() → recordSessionCost() integration ───────────────
|
|
139
|
-
|
|
140
103
|
const recordSessionCostSpy = mock((_m: SessionCostMetric) => {});
|
|
141
104
|
|
|
142
105
|
// `mock.module` is process-global and is never auto-restored, so it leaks into
|
|
@@ -56,23 +56,6 @@ describe("reassociateSessionLogs", () => {
|
|
|
56
56
|
// Verify no logs remain under random UUID
|
|
57
57
|
const oldLogs = await getSessionLogsByTaskId(randomUuid);
|
|
58
58
|
expect(oldLogs.length).toBe(0);
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
test("is idempotent — second call returns 0 changes", async () => {
|
|
62
|
-
const runnerSessionId = "runner-sess-2";
|
|
63
|
-
const randomUuid = crypto.randomUUID();
|
|
64
|
-
const realTaskId = crypto.randomUUID();
|
|
65
|
-
|
|
66
|
-
await createSessionLogs({
|
|
67
|
-
taskId: randomUuid,
|
|
68
|
-
sessionId: runnerSessionId,
|
|
69
|
-
iteration: 1,
|
|
70
|
-
cli: "claude",
|
|
71
|
-
lines: ["line a"],
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
const first = await reassociateSessionLogs(runnerSessionId, realTaskId);
|
|
75
|
-
expect(first).toBe(1);
|
|
76
59
|
|
|
77
60
|
const second = await reassociateSessionLogs(runnerSessionId, realTaskId);
|
|
78
61
|
expect(second).toBe(0);
|
|
@@ -114,30 +97,11 @@ describe("reassociateSessionLogs", () => {
|
|
|
114
97
|
});
|
|
115
98
|
|
|
116
99
|
describe("pool task claim flow", () => {
|
|
117
|
-
test("active
|
|
100
|
+
test("reassociates pool logs through active-session lookup and repeated calls", async () => {
|
|
118
101
|
const agentId = crypto.randomUUID();
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
const session = await insertActiveSession({
|
|
122
|
-
agentId,
|
|
123
|
-
taskId: "effective-task-id",
|
|
124
|
-
triggerType: "pool_tasks_available",
|
|
125
|
-
runnerSessionId: "runner-sess-4",
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
expect(session.runnerSessionId).toBe("runner-sess-4");
|
|
129
|
-
|
|
130
|
-
// Verify it can be retrieved
|
|
131
|
-
const sessions = await getActiveSessions(agentId);
|
|
132
|
-
const found = sessions.find((s) => s.runnerSessionId === "runner-sess-4");
|
|
133
|
-
expect(found).toBeDefined();
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
test("end-to-end: pool task logs are reassociated after claim", async () => {
|
|
137
|
-
const agentId = crypto.randomUUID();
|
|
138
|
-
const runnerSessionId = "runner-sess-e2e";
|
|
102
|
+
const runnerSessionId = "runner-sess-flow";
|
|
139
103
|
const effectiveTaskId = crypto.randomUUID();
|
|
140
|
-
await createAgent({ id: agentId, name: "
|
|
104
|
+
await createAgent({ id: agentId, name: "Pool Flow Agent", isLead: false, status: "idle" });
|
|
141
105
|
|
|
142
106
|
// 1. Create an unassigned task (pool task)
|
|
143
107
|
const task = await createTaskExtended("Test pool task", {
|
|
@@ -146,13 +110,15 @@ describe("pool task claim flow", () => {
|
|
|
146
110
|
expect(task.agentId).toBeNull();
|
|
147
111
|
|
|
148
112
|
// 2. Simulate runner creating active session with runnerSessionId
|
|
149
|
-
await insertActiveSession({
|
|
113
|
+
const session = await insertActiveSession({
|
|
150
114
|
agentId,
|
|
151
115
|
taskId: effectiveTaskId,
|
|
152
116
|
triggerType: "pool_tasks_available",
|
|
153
117
|
runnerSessionId,
|
|
154
118
|
});
|
|
155
119
|
|
|
120
|
+
expect(session.runnerSessionId).toBe(runnerSessionId);
|
|
121
|
+
|
|
156
122
|
// 3. Simulate session logs being flushed with the random effectiveTaskId
|
|
157
123
|
await createSessionLogs({
|
|
158
124
|
taskId: effectiveTaskId,
|
|
@@ -179,7 +145,7 @@ describe("pool task claim flow", () => {
|
|
|
179
145
|
expect(afterClaim.length).toBe(3);
|
|
180
146
|
|
|
181
147
|
// 7. Simulate more logs arriving after claim (with old effectiveTaskId)
|
|
182
|
-
//
|
|
148
|
+
// A later reassociation call must include these rows.
|
|
183
149
|
await createSessionLogs({
|
|
184
150
|
taskId: effectiveTaskId,
|
|
185
151
|
sessionId: runnerSessionId,
|
|
@@ -188,7 +154,7 @@ describe("pool task claim flow", () => {
|
|
|
188
154
|
lines: ["Working on the task now..."],
|
|
189
155
|
});
|
|
190
156
|
|
|
191
|
-
// 8.
|
|
157
|
+
// 8. Repeat the database call to include late arrivals.
|
|
192
158
|
const reinforceCount = await reassociateSessionLogs(runnerSessionId, task.id);
|
|
193
159
|
expect(reinforceCount).toBe(1);
|
|
194
160
|
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import { mkdtemp, readdir, rm } from "node:fs/promises";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { join, resolve } from "node:path";
|
|
5
|
+
|
|
6
|
+
// Runs scripts/pre-push-affected-tests.ts against this checkout, so the controls
|
|
7
|
+
// below use files that exist in the repo.
|
|
8
|
+
const REPO_ROOT = resolve(import.meta.dir, "../..");
|
|
9
|
+
const SELECTOR = join(REPO_ROOT, "scripts/pre-push-affected-tests.ts");
|
|
10
|
+
const SELECTOR_BUDGET_MS = 30_000;
|
|
11
|
+
|
|
12
|
+
async function select(...changed: string[]): Promise<string[]> {
|
|
13
|
+
const out = await Bun.$`bun ${SELECTOR} ${changed}`.cwd(REPO_ROOT).quiet().text();
|
|
14
|
+
return out.split("\n").filter(Boolean);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
describe("pre-push affected-test selector", () => {
|
|
18
|
+
test(
|
|
19
|
+
"a changed test selects itself; a deleted one selects nothing",
|
|
20
|
+
async () => {
|
|
21
|
+
expect(await select("src/tests/pre-push-affected-tests.test.ts")).toEqual([
|
|
22
|
+
"./src/tests/pre-push-affected-tests.test.ts",
|
|
23
|
+
]);
|
|
24
|
+
expect(await select("src/tests/does-not-exist.test.ts")).toEqual([]);
|
|
25
|
+
},
|
|
26
|
+
SELECTOR_BUDGET_MS,
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
test(
|
|
30
|
+
"a hub file stays within the budget and keeps its named tests",
|
|
31
|
+
async () => {
|
|
32
|
+
// src/utils/secret-scrubber.ts reaches ~870 test files through the import graph.
|
|
33
|
+
const picked = await select("src/utils/secret-scrubber.ts");
|
|
34
|
+
expect(picked.length).toBeGreaterThan(0);
|
|
35
|
+
expect(picked.length).toBeLessThanOrEqual(40);
|
|
36
|
+
expect(picked).toContain("./src/tests/secret-scrubber.test.ts");
|
|
37
|
+
},
|
|
38
|
+
SELECTOR_BUDGET_MS,
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
test(
|
|
42
|
+
"a level past the budget fills the budget instead of dropping its tests",
|
|
43
|
+
async () => {
|
|
44
|
+
// Fixture repo: src/types.ts has more direct test importers than the budget,
|
|
45
|
+
// and src/mid.ts (which imports types) reaches a second level past what is left.
|
|
46
|
+
const dir = await mkdtemp(join(tmpdir(), "affected-tests-"));
|
|
47
|
+
try {
|
|
48
|
+
await Bun.write(join(dir, "scripts/pre-push-affected-tests.ts"), Bun.file(SELECTOR));
|
|
49
|
+
await Bun.write(join(dir, "src/types.ts"), "export const value = 1;\n");
|
|
50
|
+
await Bun.write(join(dir, "src/hub.ts"), "export const hub = 1;\n");
|
|
51
|
+
await Bun.write(join(dir, "src/mid.ts"), 'export { value } from "./types";\n');
|
|
52
|
+
const write = (name: string, from: string) =>
|
|
53
|
+
Bun.write(join(dir, "tests", name), `import "../src/${from}";\n`);
|
|
54
|
+
for (let i = 0; i < 6; i++) await write(`edge-${i}.test.ts`, "hub");
|
|
55
|
+
for (let i = 0; i < 2; i++) await write(`direct-${i}.test.ts`, "types");
|
|
56
|
+
for (let i = 0; i < 6; i++) await write(`deep-${i}.test.ts`, "mid");
|
|
57
|
+
await write("types-mid.test.ts", "mid");
|
|
58
|
+
await Bun.$`git init -q && git add -A`.cwd(dir).quiet();
|
|
59
|
+
|
|
60
|
+
const run = async (file: string) =>
|
|
61
|
+
(
|
|
62
|
+
await Bun.$`bun scripts/pre-push-affected-tests.ts ${file}`
|
|
63
|
+
.cwd(dir)
|
|
64
|
+
.env({ ...process.env, PRE_PUSH_TESTS_BUDGET: "5" })
|
|
65
|
+
.quiet()
|
|
66
|
+
.text()
|
|
67
|
+
)
|
|
68
|
+
.split("\n")
|
|
69
|
+
.filter(Boolean);
|
|
70
|
+
|
|
71
|
+
// First level alone passes the budget: a stable nonempty sample, not zero.
|
|
72
|
+
const hub = await run("src/hub.ts");
|
|
73
|
+
expect(hub).toEqual([0, 1, 2, 3, 4].map((i) => `./tests/edge-${i}.test.ts`));
|
|
74
|
+
expect(await run("src/hub.ts")).toEqual(hub);
|
|
75
|
+
|
|
76
|
+
// Lower level kept, named test kept, the rest of the overflowing level fills to 5.
|
|
77
|
+
expect(await run("src/types.ts")).toEqual([
|
|
78
|
+
"./tests/deep-0.test.ts",
|
|
79
|
+
"./tests/deep-1.test.ts",
|
|
80
|
+
"./tests/direct-0.test.ts",
|
|
81
|
+
"./tests/direct-1.test.ts",
|
|
82
|
+
"./tests/types-mid.test.ts",
|
|
83
|
+
]);
|
|
84
|
+
} finally {
|
|
85
|
+
await rm(dir, { recursive: true, force: true });
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
SELECTOR_BUDGET_MS,
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
test(
|
|
92
|
+
"a migration selects every migration test",
|
|
93
|
+
async () => {
|
|
94
|
+
const migrations = (await readdir(join(REPO_ROOT, "src/be/migrations"))).filter((f) =>
|
|
95
|
+
f.endsWith(".sql"),
|
|
96
|
+
);
|
|
97
|
+
const picked = await select(`src/be/migrations/${migrations[0]}`);
|
|
98
|
+
const migrationTests = (await readdir(join(REPO_ROOT, "src/tests"))).filter(
|
|
99
|
+
(f) => f.includes("migration") && f.endsWith(".test.ts"),
|
|
100
|
+
);
|
|
101
|
+
expect(migrationTests.length).toBeGreaterThan(0);
|
|
102
|
+
for (const t of migrationTests) expect(picked).toContain(`./src/tests/${t}`);
|
|
103
|
+
},
|
|
104
|
+
SELECTOR_BUDGET_MS,
|
|
105
|
+
);
|
|
106
|
+
});
|
|
@@ -314,6 +314,7 @@ describe("Session templates: MUST pointers", () => {
|
|
|
314
314
|
expect(result.text).toContain(
|
|
315
315
|
"a `card` on `slack-reply` or `chat-reply` (max 1 table of 100 rows, 2 charts), not a file or Page. Bigger or document-shaped: agent-fs.",
|
|
316
316
|
);
|
|
317
|
+
expect(result.text).toContain("See the `boards-and-sheets` skill.");
|
|
317
318
|
expect(result.unresolved).toEqual([]);
|
|
318
319
|
});
|
|
319
320
|
|
|
@@ -321,6 +322,8 @@ describe("Session templates: MUST pointers", () => {
|
|
|
321
322
|
const result = resolveTemplate("system.agent.outputs.no_agent_fs", {});
|
|
322
323
|
expect(result.text).toContain("make a Page only when the requester asks for one");
|
|
323
324
|
expect(result.text).not.toContain("drive path");
|
|
325
|
+
// Sheets and boards are agent-fs files, so this variant does not route to them.
|
|
326
|
+
expect(result.text).not.toContain("boards-and-sheets");
|
|
324
327
|
expect(result.text).toContain("Bigger or document-shaped: a Markdown attachment.");
|
|
325
328
|
});
|
|
326
329
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { expect, test } from "bun:test";
|
|
2
2
|
import { closeSync, openSync } from "node:fs";
|
|
3
3
|
import { mkdtemp, rm } from "node:fs/promises";
|
|
4
|
-
import { createServer } from "node:
|
|
4
|
+
import { createServer } from "node:http";
|
|
5
5
|
import { tmpdir } from "node:os";
|
|
6
6
|
import { join } from "node:path";
|
|
7
7
|
import {
|
|
@@ -105,17 +105,23 @@ test("startOnFreePort retries only PortInUseError, up to its attempt bound", asy
|
|
|
105
105
|
});
|
|
106
106
|
|
|
107
107
|
test(
|
|
108
|
-
"spawnSwarmServer
|
|
108
|
+
"spawnSwarmServer retries when another HTTP server answers on its first port",
|
|
109
109
|
async () => {
|
|
110
110
|
const dir = await makeScratchDir();
|
|
111
|
-
const holder = createServer()
|
|
111
|
+
const holder = createServer((_req, res) => {
|
|
112
|
+
res.writeHead(200, { "Content-Type": "application/json" });
|
|
113
|
+
res.end(JSON.stringify({ ok: true }));
|
|
114
|
+
});
|
|
112
115
|
const heldPort = await listenOnFreePort(holder);
|
|
116
|
+
const logPath = join(dir, "server.log");
|
|
117
|
+
// A reused log can contain a previous boot on the same port.
|
|
118
|
+
await Bun.write(logPath, `MCP HTTP server running on http://localhost:${heldPort}/mcp\n`);
|
|
113
119
|
let server: SwarmServer | undefined;
|
|
114
120
|
try {
|
|
115
121
|
const offered: number[] = [];
|
|
116
122
|
server = await spawnSwarmServer({
|
|
117
123
|
dbPath: join(dir, "test.sqlite"),
|
|
118
|
-
logPath
|
|
124
|
+
logPath,
|
|
119
125
|
getPort: async () => {
|
|
120
126
|
const port = offered.length === 0 ? heldPort : await getFreePort();
|
|
121
127
|
offered.push(port);
|
|
@@ -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);
|
|
@@ -131,9 +131,6 @@ function setup(taskCount = 1) {
|
|
|
131
131
|
return { state, sessions, tasks };
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
-
/** Let the fire-and-forget `session.abort` microtask run. */
|
|
135
|
-
const flush = () => Bun.sleep(5);
|
|
136
|
-
|
|
137
134
|
describe("applyApiDrainSignal", () => {
|
|
138
135
|
test("a draining answer sets the state and a clean answer clears it", () => {
|
|
139
136
|
const { state } = setup(0);
|
|
@@ -203,8 +200,8 @@ describe("pollForTrigger", () => {
|
|
|
203
200
|
describe("handOffTasksForApiDrain", () => {
|
|
204
201
|
test("supersedes with the graceful_shutdown reason and aborts the session once", async () => {
|
|
205
202
|
const { state, sessions, tasks } = setup(2);
|
|
206
|
-
await handOffTasksForApiDrain(state, "worker", apiConfig());
|
|
207
|
-
|
|
203
|
+
for (let i = 0; i < 4; i++) await handOffTasksForApiDrain(state, "worker", apiConfig());
|
|
204
|
+
expect(supersedeCalls()).toHaveLength(2);
|
|
208
205
|
|
|
209
206
|
for (const [i, task] of tasks.entries()) {
|
|
210
207
|
const call = supersedeCalls().find((r) => r.path === `/api/tasks/${task.taskId}/supersede`);
|
|
@@ -216,21 +213,12 @@ describe("handOffTasksForApiDrain", () => {
|
|
|
216
213
|
}
|
|
217
214
|
});
|
|
218
215
|
|
|
219
|
-
test("hands off once: later passes make no call for an answered task", async () => {
|
|
220
|
-
const { state, sessions } = setup(1);
|
|
221
|
-
for (let i = 0; i < 4; i++) await handOffTasksForApiDrain(state, "worker", apiConfig());
|
|
222
|
-
await flush();
|
|
223
|
-
expect(supersedeCalls()).toHaveLength(1);
|
|
224
|
-
expect(sessions[0]?.abortReasons).toHaveLength(1);
|
|
225
|
-
});
|
|
226
|
-
|
|
227
216
|
test("a failed call leaves the task running and retries up to the cap", async () => {
|
|
228
217
|
stub.supersede = [{ status: 503, body: { error: "unavailable" } }];
|
|
229
218
|
const { state, sessions, tasks } = setup(1);
|
|
230
219
|
for (let i = 0; i < API_DRAIN_HANDOFF_MAX_ATTEMPTS + 3; i++) {
|
|
231
220
|
await handOffTasksForApiDrain(state, "worker", apiConfig());
|
|
232
221
|
}
|
|
233
|
-
await flush();
|
|
234
222
|
expect(supersedeCalls()).toHaveLength(API_DRAIN_HANDOFF_MAX_ATTEMPTS);
|
|
235
223
|
expect(sessions[0]?.abortReasons).toEqual([]);
|
|
236
224
|
expect(tasks[0]?.serverTerminalStatus).toBeUndefined();
|
|
@@ -242,7 +230,6 @@ describe("handOffTasksForApiDrain", () => {
|
|
|
242
230
|
const { state, sessions } = setup(1);
|
|
243
231
|
await handOffTasksForApiDrain(state, "worker", apiConfig());
|
|
244
232
|
await handOffTasksForApiDrain(state, "worker", apiConfig());
|
|
245
|
-
await flush();
|
|
246
233
|
expect(supersedeCalls()).toHaveLength(2);
|
|
247
234
|
expect(sessions[0]?.abortReasons).toEqual(["graceful_shutdown"]);
|
|
248
235
|
});
|
|
@@ -253,7 +240,6 @@ describe("handOffTasksForApiDrain", () => {
|
|
|
253
240
|
];
|
|
254
241
|
const { state, sessions, tasks } = setup(1);
|
|
255
242
|
await handOffTasksForApiDrain(state, "worker", apiConfig());
|
|
256
|
-
await flush();
|
|
257
243
|
expect(tasks[0]?.serverTerminalStatus).toBe("failed");
|
|
258
244
|
expect(sessions[0]?.abortReasons).toEqual(["graceful_shutdown"]);
|
|
259
245
|
});
|
|
@@ -269,7 +255,6 @@ describe("handOffTasksForApiDrain", () => {
|
|
|
269
255
|
const { state, sessions, tasks } = setup(1);
|
|
270
256
|
await handOffTasksForApiDrain(state, "worker", apiConfig());
|
|
271
257
|
await handOffTasksForApiDrain(state, "worker", apiConfig());
|
|
272
|
-
await flush();
|
|
273
258
|
expect(supersedeCalls()).toHaveLength(1);
|
|
274
259
|
expect(sessions[0]?.abortReasons).toEqual([]);
|
|
275
260
|
expect(tasks[0]?.serverTerminalStatus).toBeUndefined();
|