@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
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import { afterAll, describe, expect, test } from "bun:test";
|
|
10
10
|
import { mkdir, mkdtemp, rm, writeFile } from "node:fs/promises";
|
|
11
11
|
import { tmpdir } from "node:os";
|
|
12
|
-
import { dirname, join } from "node:path";
|
|
12
|
+
import { dirname, join, relative, resolve } from "node:path";
|
|
13
13
|
import { CHILD_PROCESS_TEST_BUDGET_MS, expectChildOk, runChild } from "./test-proc";
|
|
14
14
|
|
|
15
15
|
type Workflow = {
|
|
@@ -18,7 +18,42 @@ type Workflow = {
|
|
|
18
18
|
|
|
19
19
|
// The GitHub expression the step uses for the diff base; the test substitutes a local branch.
|
|
20
20
|
const BASE_REF_EXPR = ["$", "{{ steps.base.outputs.ref }}"].join("");
|
|
21
|
-
const
|
|
21
|
+
const REPO_ROOT = resolve(import.meta.dir, "../..");
|
|
22
|
+
const WORKFLOW_PATH = join(REPO_ROOT, ".github/workflows/merge-gate.yml");
|
|
23
|
+
const PRE_PUSH_PATH = join(REPO_ROOT, "scripts/pre-push-tests.sh");
|
|
24
|
+
const PRELOAD_PATH = join(REPO_ROOT, "src/tests/preload.ts");
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Repo-relative files the test preload loads: relative imports plus `new URL("./x", import.meta.url)`
|
|
28
|
+
* worker entries, followed transitively inside src/tests/. `local` = src/tests/ files (reached
|
|
29
|
+
* only through the preload); `external` = the preload's direct imports elsewhere in src/.
|
|
30
|
+
*/
|
|
31
|
+
async function preloadClosure(): Promise<{ local: string[]; external: string[] }> {
|
|
32
|
+
const transpiler = new Bun.Transpiler({ loader: "ts" });
|
|
33
|
+
const testsDir = join(REPO_ROOT, "src/tests");
|
|
34
|
+
const local = new Set<string>();
|
|
35
|
+
const external = new Set<string>();
|
|
36
|
+
const queue = [PRELOAD_PATH];
|
|
37
|
+
while (queue.length > 0) {
|
|
38
|
+
const file = queue.shift() as string;
|
|
39
|
+
const rel = relative(REPO_ROOT, file);
|
|
40
|
+
if (local.has(rel)) continue;
|
|
41
|
+
local.add(rel);
|
|
42
|
+
const src = await Bun.file(file).text();
|
|
43
|
+
const specs = transpiler.scanImports(src).map((i) => i.path);
|
|
44
|
+
for (const m of src.matchAll(/new URL\(\s*["'](\.[^"']+)["']\s*,\s*import\.meta\.url/g)) {
|
|
45
|
+
if (m[1]) specs.push(m[1]);
|
|
46
|
+
}
|
|
47
|
+
for (const spec of specs) {
|
|
48
|
+
if (!spec.startsWith(".")) continue;
|
|
49
|
+
let target = resolve(dirname(file), spec);
|
|
50
|
+
if (!target.endsWith(".ts")) target += ".ts";
|
|
51
|
+
if (target.startsWith(`${testsDir}/`)) queue.push(target);
|
|
52
|
+
else external.add(relative(REPO_ROOT, target));
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return { local: [...local].sort(), external: [...external].sort() };
|
|
56
|
+
}
|
|
22
57
|
|
|
23
58
|
async function loadFlagStep(): Promise<string> {
|
|
24
59
|
const wf = Bun.YAML.parse(await Bun.file(WORKFLOW_PATH).text()) as Workflow;
|
|
@@ -27,6 +62,13 @@ async function loadFlagStep(): Promise<string> {
|
|
|
27
62
|
return step.run.replaceAll(BASE_REF_EXPR, "base");
|
|
28
63
|
}
|
|
29
64
|
|
|
65
|
+
async function loadScopeStep(): Promise<string> {
|
|
66
|
+
const wf = Bun.YAML.parse(await Bun.file(WORKFLOW_PATH).text()) as Workflow;
|
|
67
|
+
const step = wf.jobs["detect-changes"]?.steps.find((s) => s.id === "test-scope");
|
|
68
|
+
if (!step?.run) throw new Error("detect-changes step `test-scope` not found in merge-gate.yml");
|
|
69
|
+
return step.run;
|
|
70
|
+
}
|
|
71
|
+
|
|
30
72
|
// Isolate from the host's git config (a global diff.renames=false would make
|
|
31
73
|
// the positive control pass for the wrong reason).
|
|
32
74
|
const GIT_ENV = {
|
|
@@ -52,18 +94,18 @@ async function git(cwd: string, ...args: string[]) {
|
|
|
52
94
|
// Large enough that git's default rename detection pairs the two sides.
|
|
53
95
|
const BODY = Array.from({ length: 40 }, (_, i) => `export const v${i} = ${i};`).join("\n");
|
|
54
96
|
|
|
55
|
-
/** Builds a repo whose `base` branch holds `files`,
|
|
56
|
-
async function
|
|
57
|
-
files: string[]
|
|
97
|
+
/** Builds a repo whose `base` branch holds `files`, then commits `change` on top as HEAD. */
|
|
98
|
+
async function repoWith(
|
|
99
|
+
files: Array<string | [path: string, body: string]>,
|
|
58
100
|
change: (repo: string) => Promise<void>,
|
|
59
|
-
|
|
60
|
-
): Promise<Record<string, string>> {
|
|
101
|
+
): Promise<string> {
|
|
61
102
|
const repo = await mkdtemp(join(tmpdir(), "merge-gate-flags-"));
|
|
62
103
|
dirs.push(repo);
|
|
63
104
|
await git(repo, "init", "-q", "-b", "base");
|
|
64
|
-
for (const
|
|
105
|
+
for (const entry of files) {
|
|
106
|
+
const [f, body] = typeof entry === "string" ? [entry, `${BODY}\n// ${entry}\n`] : entry;
|
|
65
107
|
await mkdir(dirname(join(repo, f)), { recursive: true });
|
|
66
|
-
await writeFile(join(repo, f),
|
|
108
|
+
await writeFile(join(repo, f), body);
|
|
67
109
|
}
|
|
68
110
|
await git(repo, "add", "-A");
|
|
69
111
|
await git(repo, "commit", "-qm", "base");
|
|
@@ -71,24 +113,65 @@ async function flagsFor(
|
|
|
71
113
|
await change(repo);
|
|
72
114
|
await git(repo, "add", "-A");
|
|
73
115
|
await git(repo, "commit", "-qm", "pr");
|
|
116
|
+
return repo;
|
|
117
|
+
}
|
|
74
118
|
|
|
119
|
+
/** Runs `script` in `repo` and returns what it wrote to GITHUB_OUTPUT. */
|
|
120
|
+
async function runStep(
|
|
121
|
+
repo: string,
|
|
122
|
+
script: string,
|
|
123
|
+
env: Record<string, string> = {},
|
|
124
|
+
): Promise<{ stdout: string; outputs: Record<string, string> }> {
|
|
75
125
|
const out = join(repo, ".gh-output");
|
|
76
126
|
const res = expectChildOk(
|
|
77
|
-
await runChild(["bash", "-c", script
|
|
127
|
+
await runChild(["bash", "-c", script], {
|
|
78
128
|
cwd: repo,
|
|
79
|
-
env: { ...GIT_ENV, GITHUB_OUTPUT: out },
|
|
129
|
+
env: { ...GIT_ENV, ...env, GITHUB_OUTPUT: out },
|
|
80
130
|
}),
|
|
81
|
-
"
|
|
131
|
+
"workflow step",
|
|
82
132
|
);
|
|
83
|
-
|
|
84
|
-
const flags: Record<string, string> = {};
|
|
133
|
+
const outputs: Record<string, string> = {};
|
|
85
134
|
for (const line of (await Bun.file(out).text()).split("\n")) {
|
|
86
135
|
const [k, v] = line.split("=");
|
|
87
|
-
if (k && v)
|
|
136
|
+
if (k && v) outputs[k] = v;
|
|
88
137
|
}
|
|
89
|
-
return
|
|
138
|
+
return { stdout: res.stdout, outputs };
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/** Builds the repo and returns the change-flag step's flags, for `event` when given. */
|
|
142
|
+
async function flagsFor(
|
|
143
|
+
files: string[],
|
|
144
|
+
change: (repo: string) => Promise<void>,
|
|
145
|
+
script?: string,
|
|
146
|
+
event?: string,
|
|
147
|
+
): Promise<Record<string, string>> {
|
|
148
|
+
const repo = await repoWith(files, change);
|
|
149
|
+
const { stdout, outputs } = await runStep(
|
|
150
|
+
repo,
|
|
151
|
+
script ?? (await loadFlagStep()),
|
|
152
|
+
event ? { EVENT_NAME: event } : {},
|
|
153
|
+
);
|
|
154
|
+
expect(stdout).toContain("Changed files:");
|
|
155
|
+
return outputs;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/** Builds the repo and returns the unit-test scope step's outputs for `event`. */
|
|
159
|
+
async function scopeFor(
|
|
160
|
+
files: Array<string | [path: string, body: string]>,
|
|
161
|
+
change: (repo: string) => Promise<void>,
|
|
162
|
+
event = "pull_request",
|
|
163
|
+
): Promise<Record<string, string>> {
|
|
164
|
+
const repo = await repoWith(files, change);
|
|
165
|
+
return (await runStep(repo, await loadScopeStep(), { EVENT_NAME: event })).outputs;
|
|
90
166
|
}
|
|
91
167
|
|
|
168
|
+
const edit =
|
|
169
|
+
(path: string, body = "edited\n") =>
|
|
170
|
+
async (repo: string) => {
|
|
171
|
+
await mkdir(dirname(join(repo, path)), { recursive: true });
|
|
172
|
+
await writeFile(join(repo, path), body);
|
|
173
|
+
};
|
|
174
|
+
|
|
92
175
|
const mv = (from: string, to: string) => async (repo: string) => {
|
|
93
176
|
await mkdir(dirname(join(repo, to)), { recursive: true });
|
|
94
177
|
await git(repo, "mv", from, to);
|
|
@@ -165,3 +248,218 @@ describe("merge-gate detect-changes flags", () => {
|
|
|
165
248
|
CHILD_PROCESS_TEST_BUDGET_MS,
|
|
166
249
|
);
|
|
167
250
|
});
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Repo-relative src/ files the dashboard bundle reads: relative imports in apps/ui/src
|
|
254
|
+
* (tests excluded) and the `../../src/...` paths its vite configs name.
|
|
255
|
+
*/
|
|
256
|
+
async function dashboardSrcInputs(): Promise<string[]> {
|
|
257
|
+
const loaders = {
|
|
258
|
+
ts: new Bun.Transpiler({ loader: "ts" }),
|
|
259
|
+
tsx: new Bun.Transpiler({ loader: "tsx" }),
|
|
260
|
+
};
|
|
261
|
+
const uiRoot = join(REPO_ROOT, "apps/ui");
|
|
262
|
+
const found = new Set<string>();
|
|
263
|
+
const keep = (file: string, spec: string) => {
|
|
264
|
+
const rel = relative(REPO_ROOT, resolve(dirname(file), spec));
|
|
265
|
+
if (rel.startsWith("src/")) found.add(rel);
|
|
266
|
+
};
|
|
267
|
+
for await (const path of new Bun.Glob("src/**/*.{ts,tsx}").scan({ cwd: uiRoot })) {
|
|
268
|
+
if (/\.test\.tsx?$/.test(path)) continue;
|
|
269
|
+
const file = join(uiRoot, path);
|
|
270
|
+
const transpiler = path.endsWith(".tsx") ? loaders.tsx : loaders.ts;
|
|
271
|
+
for (const { path: spec } of transpiler.scanImports(await Bun.file(file).text())) {
|
|
272
|
+
if (spec.startsWith(".")) keep(file, spec);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
for await (const path of new Bun.Glob("vite*.config.ts").scan({ cwd: uiRoot })) {
|
|
276
|
+
const file = join(uiRoot, path);
|
|
277
|
+
for (const m of (await Bun.file(file).text()).matchAll(
|
|
278
|
+
/["'`]((?:\.\.\/)+src\/[^"'`]+)["'`]/g,
|
|
279
|
+
)) {
|
|
280
|
+
if (m[1]) keep(file, m[1]);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
return [...found].sort();
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
describe("merge-gate image builds on a pull request", () => {
|
|
287
|
+
const BASE_FILES = [
|
|
288
|
+
"src/be/db.ts",
|
|
289
|
+
"src/utils/task-citations.ts",
|
|
290
|
+
"scripts/e2e/scenarios/x.ts",
|
|
291
|
+
"scripts/init-local-postgres.sh",
|
|
292
|
+
"apps/ui/src/app.tsx",
|
|
293
|
+
"Dockerfile.worker",
|
|
294
|
+
"Dockerfile.ui",
|
|
295
|
+
"bun.lock",
|
|
296
|
+
".github/workflows/merge-gate.yml",
|
|
297
|
+
];
|
|
298
|
+
|
|
299
|
+
test.each([
|
|
300
|
+
// [changed file, event, docker, ui_image]
|
|
301
|
+
["src/be/db.ts", "pull_request", "false", "false"],
|
|
302
|
+
["src/be/db.ts", "merge_group", "true", "true"],
|
|
303
|
+
["scripts/e2e/scenarios/x.ts", "pull_request", "false", "false"],
|
|
304
|
+
["scripts/e2e/scenarios/x.ts", "merge_group", "true", "false"],
|
|
305
|
+
["scripts/init-local-postgres.sh", "pull_request", "true", "false"],
|
|
306
|
+
["Dockerfile.worker", "pull_request", "true", "false"],
|
|
307
|
+
["Dockerfile.ui", "pull_request", "false", "true"],
|
|
308
|
+
["bun.lock", "pull_request", "true", "true"],
|
|
309
|
+
["apps/ui/src/app.tsx", "pull_request", "false", "true"],
|
|
310
|
+
["src/utils/task-citations.ts", "pull_request", "false", "true"],
|
|
311
|
+
[".github/workflows/merge-gate.yml", "pull_request", "true", "true"],
|
|
312
|
+
])(
|
|
313
|
+
"%s on %s: docker=%s ui_image=%s",
|
|
314
|
+
async (path, event, docker, uiImage) => {
|
|
315
|
+
const flags = await flagsFor(BASE_FILES, edit(path), undefined, event);
|
|
316
|
+
expect(flags.docker).toBe(docker);
|
|
317
|
+
expect(flags.ui_image).toBe(uiImage);
|
|
318
|
+
},
|
|
319
|
+
CHILD_PROCESS_TEST_BUDGET_MS,
|
|
320
|
+
);
|
|
321
|
+
|
|
322
|
+
test(
|
|
323
|
+
"a source change next to an image input still builds on a pull request",
|
|
324
|
+
async () => {
|
|
325
|
+
const flags = await flagsFor(
|
|
326
|
+
BASE_FILES,
|
|
327
|
+
async (repo) => {
|
|
328
|
+
await edit("src/be/db.ts")(repo);
|
|
329
|
+
await edit("Dockerfile.worker")(repo);
|
|
330
|
+
},
|
|
331
|
+
undefined,
|
|
332
|
+
"pull_request",
|
|
333
|
+
);
|
|
334
|
+
expect(flags.docker).toBe("true");
|
|
335
|
+
},
|
|
336
|
+
CHILD_PROCESS_TEST_BUDGET_MS,
|
|
337
|
+
);
|
|
338
|
+
|
|
339
|
+
// The pull-request list names the src/ directories the dashboard imports. A new import
|
|
340
|
+
// from another directory must join it, or a pull request that breaks the bundle goes
|
|
341
|
+
// green until the merge queue.
|
|
342
|
+
test("the pull-request Dashboard Image list covers every src/ file the dashboard reads", async () => {
|
|
343
|
+
const step = await loadFlagStep();
|
|
344
|
+
const pattern = /UI_IMAGE=\$\(match '(\^src\/[^']+)'\)/.exec(step)?.[1];
|
|
345
|
+
expect(pattern).toBeDefined();
|
|
346
|
+
const inputs = await dashboardSrcInputs();
|
|
347
|
+
expect(inputs.length).toBeGreaterThan(0);
|
|
348
|
+
const covered = new RegExp(pattern as string);
|
|
349
|
+
expect(inputs.filter((file) => !covered.test(file))).toEqual([]);
|
|
350
|
+
});
|
|
351
|
+
});
|
|
352
|
+
|
|
353
|
+
describe("merge-gate unit-test scope", () => {
|
|
354
|
+
test(
|
|
355
|
+
"a leaf source change on a pull request runs only the affected tests",
|
|
356
|
+
async () => {
|
|
357
|
+
const scope = await scopeFor(["src/tools/leaf.ts"], edit("src/tools/leaf.ts"));
|
|
358
|
+
expect(scope.scope).toBe("changed");
|
|
359
|
+
expect(scope.base).toMatch(/^[0-9a-f]{40}$/);
|
|
360
|
+
},
|
|
361
|
+
CHILD_PROCESS_TEST_BUDGET_MS,
|
|
362
|
+
);
|
|
363
|
+
|
|
364
|
+
test.each([
|
|
365
|
+
"src/be/migrations/999_new.sql",
|
|
366
|
+
"templates/skills/x/content.md",
|
|
367
|
+
"src/tests/preload.ts",
|
|
368
|
+
"src/tests/hang-watchdog.ts",
|
|
369
|
+
"src/tests/hang-watchdog-worker.ts",
|
|
370
|
+
"bunfig.toml",
|
|
371
|
+
"tsconfig.json",
|
|
372
|
+
"bun.lock",
|
|
373
|
+
".github/workflows/merge-gate.yml",
|
|
374
|
+
])(
|
|
375
|
+
"%s runs the full suite on a pull request",
|
|
376
|
+
async (path) => {
|
|
377
|
+
expect((await scopeFor(["src/x.ts"], edit(path))).scope).toBe("full");
|
|
378
|
+
},
|
|
379
|
+
CHILD_PROCESS_TEST_BUDGET_MS,
|
|
380
|
+
);
|
|
381
|
+
|
|
382
|
+
test(
|
|
383
|
+
"every preload-only bootstrap file runs the full suite in CI and pre-push",
|
|
384
|
+
async () => {
|
|
385
|
+
const { local, external } = await preloadClosure();
|
|
386
|
+
// Positive control: the sweep sees the watchdog thread file only through `new URL`.
|
|
387
|
+
expect(local).toContain("src/tests/hang-watchdog-worker.ts");
|
|
388
|
+
const prePush = (await Bun.file(PRE_PUSH_PATH).text()).match(/^FULL_RUN_PATHS='(.+)'$/m)?.[1];
|
|
389
|
+
if (!prePush) throw new Error("FULL_RUN_PATHS not found in pre-push-tests.sh");
|
|
390
|
+
for (const path of local) {
|
|
391
|
+
expect({ path, scope: (await scopeFor(["src/x.ts"], edit(path))).scope }).toEqual({
|
|
392
|
+
path,
|
|
393
|
+
scope: "full",
|
|
394
|
+
});
|
|
395
|
+
expect({ path, prePush: new RegExp(prePush).test(path) }).toEqual({ path, prePush: true });
|
|
396
|
+
}
|
|
397
|
+
// A preload import outside src/tests/ is safe only while some test imports it too:
|
|
398
|
+
// `--changed` then selects that test, and it fails in the preload.
|
|
399
|
+
const tests = await Promise.all(
|
|
400
|
+
[...new Bun.Glob("src/**/*.test.ts").scanSync(REPO_ROOT)].map((f) =>
|
|
401
|
+
Bun.file(join(REPO_ROOT, f)).text(),
|
|
402
|
+
),
|
|
403
|
+
);
|
|
404
|
+
for (const path of external) {
|
|
405
|
+
const spec = `/${path.replace(/^src\//, "").replace(/\.ts$/, "")}"`;
|
|
406
|
+
expect({ path, testImporter: tests.some((t) => t.includes(spec)) }).toEqual({
|
|
407
|
+
path,
|
|
408
|
+
testImporter: true,
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
},
|
|
412
|
+
CHILD_PROCESS_TEST_BUDGET_MS,
|
|
413
|
+
);
|
|
414
|
+
|
|
415
|
+
test(
|
|
416
|
+
"control: bun test --changed skips every test when only a preload-only import changes",
|
|
417
|
+
async () => {
|
|
418
|
+
const repo = await repoWith(
|
|
419
|
+
[
|
|
420
|
+
["bunfig.toml", '[test]\npreload = ["./preload.ts"]\n'],
|
|
421
|
+
["preload.ts", 'import "./dep";\n'],
|
|
422
|
+
["dep.ts", "export {};\n"],
|
|
423
|
+
["a.test.ts", 'import { test } from "bun:test";\ntest("a", () => {});\n'],
|
|
424
|
+
],
|
|
425
|
+
edit("dep.ts", 'throw new Error("preload dependency regression");\n'),
|
|
426
|
+
);
|
|
427
|
+
const env = { ...GIT_ENV, HOME: process.env.HOME ?? tmpdir() };
|
|
428
|
+
const scoped = await runChild([process.execPath, "test", "--changed=base"], {
|
|
429
|
+
cwd: repo,
|
|
430
|
+
env,
|
|
431
|
+
});
|
|
432
|
+
const full = await runChild([process.execPath, "test"], { cwd: repo, env });
|
|
433
|
+
// Scoped: nothing selected, exit 0. Full: the preload throws.
|
|
434
|
+
expect(scoped.exitCode).toBe(0);
|
|
435
|
+
expect(`${scoped.stdout}${scoped.stderr}`).not.toContain("preload dependency regression");
|
|
436
|
+
expect(full.exitCode).not.toBe(0);
|
|
437
|
+
expect(`${full.stdout}${full.stderr}`).toContain("preload dependency regression");
|
|
438
|
+
},
|
|
439
|
+
CHILD_PROCESS_TEST_BUDGET_MS,
|
|
440
|
+
);
|
|
441
|
+
|
|
442
|
+
test(
|
|
443
|
+
"a package.json version bump alone stays scoped; a dependency change runs everything",
|
|
444
|
+
async () => {
|
|
445
|
+
const pkg = (version: string, dep: string) =>
|
|
446
|
+
`{\n "name": "x",\n "version": "${version}",\n "dependencies": { "a": "${dep}" }\n}\n`;
|
|
447
|
+
const base: Array<[string, string]> = [["package.json", pkg("1.0.0", "1.0.0")]];
|
|
448
|
+
const bump = await scopeFor(base, edit("package.json", pkg("1.0.1", "1.0.0")));
|
|
449
|
+
expect(bump.scope).toBe("changed");
|
|
450
|
+
const dep = await scopeFor(base, edit("package.json", pkg("1.0.0", "2.0.0")));
|
|
451
|
+
expect(dep.scope).toBe("full");
|
|
452
|
+
},
|
|
453
|
+
CHILD_PROCESS_TEST_BUDGET_MS,
|
|
454
|
+
);
|
|
455
|
+
|
|
456
|
+
test(
|
|
457
|
+
"the merge queue always runs the full suite",
|
|
458
|
+
async () => {
|
|
459
|
+
const scope = await scopeFor(["src/tools/leaf.ts"], edit("src/tools/leaf.ts"), "merge_group");
|
|
460
|
+
expect(scope.scope).toBe("full");
|
|
461
|
+
expect(scope.base).toBeUndefined();
|
|
462
|
+
},
|
|
463
|
+
CHILD_PROCESS_TEST_BUDGET_MS,
|
|
464
|
+
);
|
|
465
|
+
});
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { Database } from "bun:sqlite";
|
|
2
|
+
import { afterEach, beforeAll, expect, test } from "bun:test";
|
|
3
|
+
import { runMigrations } from "../be/migrations/runner";
|
|
4
|
+
import { backfillScriptRunSources } from "../be/migrations/script-run-sources";
|
|
5
|
+
|
|
6
|
+
let schema: string;
|
|
7
|
+
let migration: string;
|
|
8
|
+
let db: Database;
|
|
9
|
+
|
|
10
|
+
beforeAll(async () => {
|
|
11
|
+
const dir = `${import.meta.dir}/../be/migrations`;
|
|
12
|
+
schema = await Bun.file(`${dir}/083_script_workflows.sql`).text();
|
|
13
|
+
migration = await Bun.file(`${dir}/342_script_run_sources.sql`).text();
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
afterEach(() => {
|
|
17
|
+
db.close();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
function legacyDatabase(): Database {
|
|
21
|
+
const database = new Database(":memory:");
|
|
22
|
+
database.exec("PRAGMA foreign_keys = ON; CREATE TABLE users (id TEXT PRIMARY KEY)");
|
|
23
|
+
database.exec(schema);
|
|
24
|
+
return database;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function insertRun(id: string, source: string): void {
|
|
28
|
+
db.run("INSERT INTO script_runs (id, agentId, source) VALUES (?, 'agent', ?)", [id, source]);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function hash(source: string): string {
|
|
32
|
+
return new Bun.CryptoHasher("sha256").update(source).digest("hex");
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function count(sql: string): number {
|
|
36
|
+
return db.prepare<{ n: number }, []>(sql).get()?.n ?? 0;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
test("fresh migrations install the source schema and resume backfill on later boots", () => {
|
|
40
|
+
db = new Database(":memory:");
|
|
41
|
+
runMigrations(db);
|
|
42
|
+
expect(db.prepare("PRAGMA table_info(script_run_sources)").all()).toMatchObject([
|
|
43
|
+
{ name: "hash", pk: 1 },
|
|
44
|
+
{ name: "source", notnull: 1 },
|
|
45
|
+
]);
|
|
46
|
+
expect(db.prepare("PRAGMA foreign_key_list(script_runs)").all()).toContainEqual(
|
|
47
|
+
expect.objectContaining({ table: "script_run_sources", from: "sourceHash", to: "hash" }),
|
|
48
|
+
);
|
|
49
|
+
expect(db.prepare("PRAGMA index_list(script_runs)").all()).toContainEqual(
|
|
50
|
+
expect.objectContaining({ name: "idx_script_runs_sourceHash", partial: 0 }),
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
insertRun("legacy", "export default 1");
|
|
54
|
+
// The SQL migration is already recorded; boot must still finish the backfill.
|
|
55
|
+
runMigrations(db);
|
|
56
|
+
expect(
|
|
57
|
+
db.prepare("SELECT source, sourceHash FROM script_runs WHERE id = 'legacy'").get(),
|
|
58
|
+
).toEqual({
|
|
59
|
+
source: "",
|
|
60
|
+
sourceHash: hash("export default 1"),
|
|
61
|
+
});
|
|
62
|
+
expect(count("SELECT count(*) AS n FROM _migrations WHERE version = 342")).toBe(1);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
test("existing runs keep their table and journal while exact UTF-8 sources deduplicate", () => {
|
|
66
|
+
db = legacyDatabase();
|
|
67
|
+
const sources = ["same", "same", "", "你好 🌍\n", "é", "e\u0301", "same\n"];
|
|
68
|
+
sources.forEach((source, i) => {
|
|
69
|
+
insertRun(`run-${i}`, source);
|
|
70
|
+
});
|
|
71
|
+
db.run(
|
|
72
|
+
"INSERT INTO script_run_journal (id, runId, stepKey, stepType, status) VALUES ('journal', 'run-0', 'step', 'script', 'completed')",
|
|
73
|
+
);
|
|
74
|
+
const before = db.prepare("SELECT rootpage FROM sqlite_master WHERE name = 'script_runs'").get();
|
|
75
|
+
const rowids = db.prepare("SELECT rowid, id FROM script_runs ORDER BY rowid").all();
|
|
76
|
+
|
|
77
|
+
db.exec(migration);
|
|
78
|
+
backfillScriptRunSources(db);
|
|
79
|
+
|
|
80
|
+
expect(db.prepare("SELECT rootpage FROM sqlite_master WHERE name = 'script_runs'").get()).toEqual(
|
|
81
|
+
before,
|
|
82
|
+
);
|
|
83
|
+
expect(db.prepare("SELECT rowid, id FROM script_runs ORDER BY rowid").all()).toEqual(rowids);
|
|
84
|
+
expect(count("SELECT count(*) AS n FROM script_run_journal")).toBe(1);
|
|
85
|
+
expect(count("SELECT count(*) AS n FROM script_run_sources")).toBe(6);
|
|
86
|
+
sources.forEach((source, i) => {
|
|
87
|
+
expect(
|
|
88
|
+
db.prepare("SELECT source, sourceHash FROM script_runs WHERE id = ?").get(`run-${i}`),
|
|
89
|
+
).toEqual({
|
|
90
|
+
source: "",
|
|
91
|
+
sourceHash: hash(source),
|
|
92
|
+
});
|
|
93
|
+
expect(
|
|
94
|
+
db.prepare("SELECT source FROM script_run_sources WHERE hash = ?").get(hash(source)),
|
|
95
|
+
).toEqual({
|
|
96
|
+
source,
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
// Neither whitespace nor Unicode normalization may alter content identity.
|
|
100
|
+
expect(hash("é")).not.toBe(hash("e\u0301"));
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
test("backfill commits bounded batches and rolls an interrupted batch back before restart", () => {
|
|
104
|
+
db = new Database(":memory:");
|
|
105
|
+
runMigrations(db);
|
|
106
|
+
for (let i = 0; i < 60; i++) insertRun(`run-${i.toString().padStart(3, "0")}`, `source ${i}`);
|
|
107
|
+
db.exec(`CREATE TRIGGER interrupt_source_backfill BEFORE UPDATE OF sourceHash ON script_runs
|
|
108
|
+
WHEN NEW.id = 'run-026'
|
|
109
|
+
BEGIN SELECT RAISE(ABORT, 'interrupted backfill'); END`);
|
|
110
|
+
|
|
111
|
+
expect(() => runMigrations(db)).toThrow("interrupted backfill");
|
|
112
|
+
expect(count("SELECT count(*) AS n FROM script_runs WHERE sourceHash IS NOT NULL")).toBe(25);
|
|
113
|
+
expect(count("SELECT count(*) AS n FROM script_run_sources")).toBe(25);
|
|
114
|
+
expect(
|
|
115
|
+
db.prepare("SELECT source, sourceHash FROM script_runs WHERE id = 'run-025'").get(),
|
|
116
|
+
).toEqual({
|
|
117
|
+
source: "source 25",
|
|
118
|
+
sourceHash: null,
|
|
119
|
+
});
|
|
120
|
+
expect(
|
|
121
|
+
db.prepare("SELECT source FROM script_run_sources WHERE hash = ?").get(hash("source 25")),
|
|
122
|
+
).toBeNull();
|
|
123
|
+
|
|
124
|
+
// Reopen the committed database state, as after process termination.
|
|
125
|
+
const snapshot = db.serialize();
|
|
126
|
+
db.close();
|
|
127
|
+
db = Database.deserialize(snapshot);
|
|
128
|
+
db.exec("PRAGMA foreign_keys = ON; DROP TRIGGER interrupt_source_backfill");
|
|
129
|
+
runMigrations(db);
|
|
130
|
+
expect(count("SELECT count(*) AS n FROM script_runs WHERE sourceHash IS NOT NULL")).toBe(60);
|
|
131
|
+
expect(count("SELECT count(*) AS n FROM script_run_sources")).toBe(60);
|
|
132
|
+
expect(count("SELECT count(*) AS n FROM script_runs WHERE source <> ''")).toBe(0);
|
|
133
|
+
|
|
134
|
+
const changes = db.prepare("SELECT total_changes() AS n").get();
|
|
135
|
+
backfillScriptRunSources(db);
|
|
136
|
+
expect(db.prepare("SELECT total_changes() AS n").get()).toEqual(changes);
|
|
137
|
+
expect(db.prepare("PRAGMA foreign_key_check").all()).toEqual([]);
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
test("partial upgrades retain already-pinned sources and reuse their content", () => {
|
|
141
|
+
db = legacyDatabase();
|
|
142
|
+
insertRun("pinned", "same");
|
|
143
|
+
insertRun("pending", "same");
|
|
144
|
+
insertRun("unique", "another");
|
|
145
|
+
db.exec(migration);
|
|
146
|
+
db.run("INSERT INTO script_run_sources (hash, source) VALUES (?, 'same')", [hash("same")]);
|
|
147
|
+
db.run("UPDATE script_runs SET sourceHash = ?, source = '' WHERE id = 'pinned'", [hash("same")]);
|
|
148
|
+
|
|
149
|
+
backfillScriptRunSources(db);
|
|
150
|
+
expect(count("SELECT count(*) AS n FROM script_run_sources")).toBe(2);
|
|
151
|
+
expect(count("SELECT count(*) AS n FROM script_runs WHERE sourceHash IS NULL")).toBe(0);
|
|
152
|
+
expect(
|
|
153
|
+
db
|
|
154
|
+
.prepare<{ n: number }, [string]>(
|
|
155
|
+
"SELECT count(*) AS n FROM script_runs WHERE sourceHash = ?",
|
|
156
|
+
)
|
|
157
|
+
.get(hash("same"))?.n,
|
|
158
|
+
).toBe(2);
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
test("foreign keys reject missing sources and retention drops only the final reference", () => {
|
|
162
|
+
db = legacyDatabase();
|
|
163
|
+
insertRun("shared-1", "same");
|
|
164
|
+
insertRun("shared-2", "same");
|
|
165
|
+
insertRun("unique", "unique");
|
|
166
|
+
db.exec(migration);
|
|
167
|
+
backfillScriptRunSources(db);
|
|
168
|
+
db.run(
|
|
169
|
+
"INSERT INTO script_run_journal (id, runId, stepKey, stepType, status) VALUES ('journal', 'shared-2', 'step', 'script', 'completed')",
|
|
170
|
+
);
|
|
171
|
+
expect(() =>
|
|
172
|
+
db.run(
|
|
173
|
+
"INSERT INTO script_runs (id, agentId, source, sourceHash) VALUES ('invalid', 'agent', '', 'missing')",
|
|
174
|
+
),
|
|
175
|
+
).toThrow("FOREIGN KEY constraint failed");
|
|
176
|
+
expect(() => db.run("UPDATE script_runs SET sourceHash = 'missing' WHERE id = 'unique'")).toThrow(
|
|
177
|
+
"FOREIGN KEY constraint failed",
|
|
178
|
+
);
|
|
179
|
+
expect(() => db.run("DELETE FROM script_run_sources WHERE hash = ?", [hash("same")])).toThrow(
|
|
180
|
+
"FOREIGN KEY constraint failed",
|
|
181
|
+
);
|
|
182
|
+
|
|
183
|
+
db.run("DELETE FROM script_runs WHERE id = 'shared-1'");
|
|
184
|
+
expect(
|
|
185
|
+
db.prepare("SELECT source FROM script_run_sources WHERE hash = ?").get(hash("same")),
|
|
186
|
+
).toEqual({ source: "same" });
|
|
187
|
+
db.run("DELETE FROM script_runs WHERE id = 'shared-2'");
|
|
188
|
+
expect(
|
|
189
|
+
db.prepare("SELECT source FROM script_run_sources WHERE hash = ?").get(hash("same")),
|
|
190
|
+
).toBeNull();
|
|
191
|
+
expect(count("SELECT count(*) AS n FROM script_run_journal")).toBe(0);
|
|
192
|
+
expect(count("SELECT count(*) AS n FROM script_run_sources")).toBe(1);
|
|
193
|
+
db.run("DELETE FROM script_runs");
|
|
194
|
+
expect(count("SELECT count(*) AS n FROM script_run_sources")).toBe(0);
|
|
195
|
+
expect(db.prepare("PRAGMA foreign_key_check").all()).toEqual([]);
|
|
196
|
+
});
|