@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
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* P1: a session whose task the server already holds as completed or failed
|
|
3
|
+
* (the agent finished before its session ended) still reports the usage
|
|
4
|
+
* windows it observed. The finish call and the key outcome stay skipped.
|
|
5
|
+
*/
|
|
6
|
+
import { afterAll, beforeAll, beforeEach, describe, expect, test } from "bun:test";
|
|
7
|
+
import { checkCompletedProcesses, type RunnerState, type RunningTask } from "../commands/runner";
|
|
8
|
+
import type { ProviderSession } from "../providers/types";
|
|
9
|
+
|
|
10
|
+
/** Worker → API calls, as `METHOD /path` plus the parsed body. */
|
|
11
|
+
const requests: Array<{ call: string; body: unknown }> = [];
|
|
12
|
+
let server: ReturnType<typeof Bun.serve>;
|
|
13
|
+
let apiUrl = "";
|
|
14
|
+
|
|
15
|
+
beforeAll(() => {
|
|
16
|
+
server = Bun.serve({
|
|
17
|
+
port: 0,
|
|
18
|
+
async fetch(req) {
|
|
19
|
+
const text = await req.text();
|
|
20
|
+
requests.push({
|
|
21
|
+
call: `${req.method} ${new URL(req.url).pathname}`,
|
|
22
|
+
body: text ? JSON.parse(text) : undefined,
|
|
23
|
+
});
|
|
24
|
+
return Response.json({ success: true });
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
apiUrl = `http://127.0.0.1:${server.port}`;
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
afterAll(() => {
|
|
31
|
+
server.stop(true);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
beforeEach(() => {
|
|
35
|
+
requests.length = 0;
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const WINDOWS_PATH = "POST /api/keys/report-rate-limit-windows";
|
|
39
|
+
|
|
40
|
+
function settledSession(): ProviderSession {
|
|
41
|
+
return {
|
|
42
|
+
sessionId: "s-1",
|
|
43
|
+
onEvent: () => {},
|
|
44
|
+
waitForCompletion: () => new Promise(() => {}),
|
|
45
|
+
abort: async () => {},
|
|
46
|
+
} as unknown as ProviderSession;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function setup(serverTerminalStatus: string, withWindows = true) {
|
|
50
|
+
const taskId = crypto.randomUUID();
|
|
51
|
+
const task = {
|
|
52
|
+
taskId,
|
|
53
|
+
triggerType: "task_assigned",
|
|
54
|
+
session: settledSession(),
|
|
55
|
+
logFile: "/tmp/runner-terminal-window-report.log",
|
|
56
|
+
startTime: new Date(),
|
|
57
|
+
promise: new Promise(() => {}),
|
|
58
|
+
result: {
|
|
59
|
+
exitCode: 0,
|
|
60
|
+
sessionId: "s-1",
|
|
61
|
+
...(withWindows
|
|
62
|
+
? {
|
|
63
|
+
rateLimitWindows: {
|
|
64
|
+
five_hour: {
|
|
65
|
+
status: "allowed",
|
|
66
|
+
utilization: 0.53,
|
|
67
|
+
resetsAt: Math.floor(Date.now() / 1000) + 3600,
|
|
68
|
+
lastSeenAt: new Date().toISOString(),
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
}
|
|
72
|
+
: {}),
|
|
73
|
+
},
|
|
74
|
+
harnessProvider: "claude",
|
|
75
|
+
hasLocalEnvironment: false,
|
|
76
|
+
credentialInfo: { keyType: "CLAUDE_CODE_OAUTH_TOKEN", keySuffix: "DNAAA", keyIndex: 3 },
|
|
77
|
+
serverTerminalStatus,
|
|
78
|
+
} as unknown as RunningTask;
|
|
79
|
+
const state = {
|
|
80
|
+
activeTasks: new Map<string, RunningTask>([[taskId, task]]),
|
|
81
|
+
maxConcurrent: 1,
|
|
82
|
+
startedAt: Date.now(),
|
|
83
|
+
tasksProcessed: 0,
|
|
84
|
+
harnessProvider: "claude",
|
|
85
|
+
codexCreditsExhaustedCooldownMs: 7_200_000,
|
|
86
|
+
modelWindowBlocks: new Map(),
|
|
87
|
+
} as RunnerState;
|
|
88
|
+
return { taskId, state };
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** The window report is fire-and-forget: wait until it lands or the budget runs out. */
|
|
92
|
+
async function waitForCall(call: string, budgetMs = 2_000): Promise<void> {
|
|
93
|
+
const deadline = Date.now() + budgetMs;
|
|
94
|
+
while (Date.now() < deadline && !requests.some((r) => r.call === call)) await Bun.sleep(10);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const apiConfig = () => ({ apiUrl, apiKey: "test-key", agentId: crypto.randomUUID() });
|
|
98
|
+
|
|
99
|
+
describe("checkCompletedProcesses — window telemetry for a task terminal server-side", () => {
|
|
100
|
+
test.each(["completed", "failed"])("%s: one window report, no finish", async (status) => {
|
|
101
|
+
const { taskId, state } = setup(status);
|
|
102
|
+
await checkCompletedProcesses(state, "worker", apiConfig());
|
|
103
|
+
await waitForCall(WINDOWS_PATH);
|
|
104
|
+
|
|
105
|
+
const windowReports = requests.filter((r) => r.call === WINDOWS_PATH);
|
|
106
|
+
expect(windowReports).toHaveLength(1);
|
|
107
|
+
expect(windowReports[0]?.body).toMatchObject({
|
|
108
|
+
keyType: "CLAUDE_CODE_OAUTH_TOKEN",
|
|
109
|
+
keySuffix: "DNAAA",
|
|
110
|
+
keyIndex: 3,
|
|
111
|
+
windows: { five_hour: { utilization: 0.53 } },
|
|
112
|
+
});
|
|
113
|
+
// The server result stands: no finish, no key outcome.
|
|
114
|
+
expect(requests.some((r) => r.call.includes("/finish"))).toBe(false);
|
|
115
|
+
expect(requests.some((r) => r.call === "POST /api/keys/clear-rate-limit")).toBe(false);
|
|
116
|
+
expect(state.activeTasks.has(taskId)).toBe(false);
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
test("cancelled: no window report", async () => {
|
|
120
|
+
const { state } = setup("cancelled");
|
|
121
|
+
await checkCompletedProcesses(state, "worker", apiConfig());
|
|
122
|
+
await Bun.sleep(100);
|
|
123
|
+
expect(requests.some((r) => r.call === WINDOWS_PATH)).toBe(false);
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
test("a session without windows sends no report", async () => {
|
|
127
|
+
const { state } = setup("completed", false);
|
|
128
|
+
await checkCompletedProcesses(state, "worker", apiConfig());
|
|
129
|
+
await Bun.sleep(100);
|
|
130
|
+
expect(requests.some((r) => r.call === WINDOWS_PATH)).toBe(false);
|
|
131
|
+
});
|
|
132
|
+
});
|
|
@@ -698,7 +698,13 @@ test("socket grace terminates a busy paused runtime before task recovery", async
|
|
|
698
698
|
fake.runtimes.delete(handle.externalId);
|
|
699
699
|
});
|
|
700
700
|
try {
|
|
701
|
-
|
|
701
|
+
// Recovery supersedes the task before asynchronously clearing its active session.
|
|
702
|
+
await socketGrace(
|
|
703
|
+
runtime,
|
|
704
|
+
async () =>
|
|
705
|
+
(await getTaskById(task.id))?.status === "superseded" &&
|
|
706
|
+
(await getActiveSessionForTask(task.id)) === null,
|
|
707
|
+
);
|
|
702
708
|
expect(fake.terminated).toEqual([runtime.externalHandle!.externalId]);
|
|
703
709
|
expect(fake.resumed).toHaveLength(0);
|
|
704
710
|
expect(await getActiveSessionForTask(task.id)).toBeNull();
|
|
@@ -78,6 +78,7 @@ test("eight failed concurrent provisions count one attempt and preserve retry de
|
|
|
78
78
|
await reconcileOnce({ now: later(now, 120) });
|
|
79
79
|
expect(state.fake.requests).toHaveLength(10);
|
|
80
80
|
expect((await getTaskById(task.id))?.status).toBe("failed");
|
|
81
|
+
expect((await getTaskById(task.id))?.statusKind).toBe("error");
|
|
81
82
|
expect((await getTaskById(task.id))?.failureReason).toStartWith(
|
|
82
83
|
"provisioning failed after 3 attempts:",
|
|
83
84
|
);
|
|
@@ -17,7 +17,7 @@ import { CHILD_PROCESS_TEST_BUDGET_MS, expectChildOk, runChild } from "./test-pr
|
|
|
17
17
|
|
|
18
18
|
const TEST_ENV = { PATH: process.env.PATH ?? "/usr/bin:/bin", HOME: "/tmp" };
|
|
19
19
|
function sandboxPrelude(command: readonly string[]): string {
|
|
20
|
-
return buildSandboxedCommand(command, TEST_ENV)
|
|
20
|
+
return buildSandboxedCommand(command, TEST_ENV).at(-1) ?? "";
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
/**
|
|
@@ -69,28 +69,33 @@ describe("sandboxSpawnEnv", () => {
|
|
|
69
69
|
});
|
|
70
70
|
});
|
|
71
71
|
|
|
72
|
-
describe("buildSandboxedCommand
|
|
72
|
+
describe("buildSandboxedCommand environment modes", () => {
|
|
73
73
|
test.skipIf(SKIP_SANDBOX_SPAWN_TESTS)(
|
|
74
|
-
"does not execute
|
|
74
|
+
"does not execute startup files before installing the sandbox limits",
|
|
75
75
|
async () => {
|
|
76
|
-
const
|
|
76
|
+
const startupDir = `${process.env.TMPDIR ?? "/tmp"}/sandbox-startup-${crypto.randomUUID()}`;
|
|
77
|
+
const startupFile = `${startupDir}/startup.sh`;
|
|
77
78
|
await Bun.write(startupFile, "exit 37\n");
|
|
79
|
+
await Bun.write(`${startupDir}/.bashrc`, "echo unexpected-startup >&2\n");
|
|
78
80
|
try {
|
|
79
|
-
const env = { ...TEST_ENV, BASH_ENV: startupFile };
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
81
|
+
const env = { ...TEST_ENV, HOME: startupDir, BASH_ENV: startupFile };
|
|
82
|
+
for (const mode of ["inline", "spawn"] as const) {
|
|
83
|
+
const command = buildSandboxedCommand(
|
|
84
|
+
["printf", "ready"],
|
|
85
|
+
env,
|
|
86
|
+
DEFAULT_SANDBOX_LIMITS,
|
|
87
|
+
mode,
|
|
88
|
+
);
|
|
89
|
+
const result = await runChild(command, { env, keepStdinOpen: true });
|
|
90
|
+
expectChildOk(result, `${mode}-mode sandbox startup`);
|
|
91
|
+
expect(result.stdout).toBe("ready");
|
|
92
|
+
expect(result.stderr).toBe("");
|
|
93
|
+
}
|
|
89
94
|
} finally {
|
|
90
|
-
await Bun
|
|
95
|
+
await Bun.$`rm -rf ${startupDir}`;
|
|
91
96
|
}
|
|
92
97
|
},
|
|
93
|
-
CHILD_PROCESS_TEST_BUDGET_MS,
|
|
98
|
+
CHILD_PROCESS_TEST_BUDGET_MS * 2,
|
|
94
99
|
);
|
|
95
100
|
|
|
96
101
|
test("keeps environment values out of every command argument", () => {
|
|
@@ -146,8 +151,8 @@ describe("buildSandboxedCommand runtime-aware limits", () => {
|
|
|
146
151
|
test.each(["bun", "node", "npx"])("raises AS and nproc for direct %s commands", (runtime) => {
|
|
147
152
|
const command = buildSandboxedCommand([runtime, "--version"], TEST_ENV);
|
|
148
153
|
expect(command[0]).toBe("bash");
|
|
149
|
-
expect(command
|
|
150
|
-
expect(command
|
|
154
|
+
expect(command.at(-1)).toContain(`ulimit -v ${BUN_SANDBOX_VIRTUAL_MEMORY_MB * 1024}`);
|
|
155
|
+
expect(command.at(-1)).toContain(`ulimit -u ${JAVASCRIPT_RUNTIME_SANDBOX_MAX_PROCS}`);
|
|
151
156
|
});
|
|
152
157
|
|
|
153
158
|
test.each(["bash", "sh", "dash"])("propagates the runtime profile through %s -c", (shell) => {
|
|
@@ -171,7 +176,7 @@ describe("buildSandboxedCommand runtime-aware limits", () => {
|
|
|
171
176
|
test("keeps strict resource defaults for direct non-interpreter commands, still rendered through bash", () => {
|
|
172
177
|
const command = buildSandboxedCommand(["git", "status", "--short"], TEST_ENV);
|
|
173
178
|
expect(command[0]).toBe("bash");
|
|
174
|
-
const prelude = command
|
|
179
|
+
const prelude = command.at(-1) ?? "";
|
|
175
180
|
expect(prelude).toContain(`ulimit -v ${DEFAULT_SANDBOX_LIMITS.virtualMemoryMb * 1024}`);
|
|
176
181
|
expect(prelude).toContain(`ulimit -u ${DEFAULT_SANDBOX_LIMITS.maxProcs}`);
|
|
177
182
|
});
|
|
@@ -184,7 +189,7 @@ describe("buildSandboxedCommand runtime-aware limits", () => {
|
|
|
184
189
|
test("renders a real ulimit -u for a non-JS, non-shell command (python3) via bash", () => {
|
|
185
190
|
const command = buildSandboxedCommand(["python3", "-c", "print('hi')"], TEST_ENV);
|
|
186
191
|
expect(command[0]).toBe("bash");
|
|
187
|
-
const prelude = command
|
|
192
|
+
const prelude = command.at(-1) ?? "";
|
|
188
193
|
expect(prelude).toContain(`ulimit -u ${DEFAULT_SANDBOX_LIMITS.maxProcs}`);
|
|
189
194
|
});
|
|
190
195
|
|
|
@@ -261,7 +266,7 @@ describe("buildSandboxedCommand runtime-aware limits", () => {
|
|
|
261
266
|
// on behavior that could pass for the wrong reason (e.g. ambient
|
|
262
267
|
// fleet-wide UID pressure happening to be low that run).
|
|
263
268
|
expect(command[0]).toBe("bash");
|
|
264
|
-
expect(command
|
|
269
|
+
expect(command.at(-1)).toContain(`ulimit -u ${tinyLimits.maxProcs}`);
|
|
265
270
|
|
|
266
271
|
const result = await runChild(command, { env: sandboxSpawnEnv(TEST_ENV) });
|
|
267
272
|
|
|
@@ -108,15 +108,18 @@ describe("Schedule HTTP triage tooling", () => {
|
|
|
108
108
|
lastErrorMessage: "boom",
|
|
109
109
|
});
|
|
110
110
|
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
111
|
+
for (const [query, includesFailing] of [
|
|
112
|
+
["lastRunStatus=failed", true],
|
|
113
|
+
["lastRunStatus=failed&consecutiveErrorsMin=2", true],
|
|
114
|
+
["lastRunStatus=failed&consecutiveErrorsMin=3", false],
|
|
115
|
+
] as const) {
|
|
116
|
+
const res = await fetch(`${baseUrl}/api/schedules?${query}`, { headers });
|
|
117
|
+
expect(res.status).toBe(200);
|
|
118
|
+
const body = (await res.json()) as { schedules: ScheduledTaskSummary[] };
|
|
119
|
+
const ids = body.schedules.map((schedule) => schedule.id);
|
|
120
|
+
expect(ids.includes(failing.id)).toBe(includesFailing);
|
|
121
|
+
expect(ids).not.toContain(ok.id);
|
|
122
|
+
}
|
|
120
123
|
});
|
|
121
124
|
test("PUT and PATCH /api/schedules/:id let only the owner, a lead or the operator change a deferral", async () => {
|
|
122
125
|
const owner = await createAgent({ name: "DeferralOwner", isLead: false, status: "idle" });
|
|
@@ -163,7 +163,10 @@ type ScheduleScriptRunRow = {
|
|
|
163
163
|
|
|
164
164
|
async function scriptRunsFor(scriptName: string): Promise<ScheduleScriptRunRow[]> {
|
|
165
165
|
return getDbClient().query<ScheduleScriptRunRow>(
|
|
166
|
-
|
|
166
|
+
`SELECT r.agentId, r.scriptName, COALESCE(s.source, r.source) AS source,
|
|
167
|
+
r.kind, r.status, r.output, r.error, r.finishedAt
|
|
168
|
+
FROM script_runs r LEFT JOIN script_run_sources s ON s.hash = r.sourceHash
|
|
169
|
+
WHERE r.scriptName = ?`,
|
|
167
170
|
[scriptName],
|
|
168
171
|
);
|
|
169
172
|
}
|
|
@@ -176,14 +176,14 @@ describe("Scheduled Tasks Integration", () => {
|
|
|
176
176
|
|
|
177
177
|
test("should list scheduled tasks with filters", async () => {
|
|
178
178
|
// Create enabled and disabled schedules
|
|
179
|
-
await createScheduledTask({
|
|
179
|
+
const enabled = await createScheduledTask({
|
|
180
180
|
name: "test-filter-enabled",
|
|
181
181
|
intervalMs: 60000,
|
|
182
182
|
taskTemplate: "Enabled task",
|
|
183
183
|
enabled: true,
|
|
184
184
|
});
|
|
185
185
|
|
|
186
|
-
await createScheduledTask({
|
|
186
|
+
const disabled = await createScheduledTask({
|
|
187
187
|
name: "test-filter-disabled",
|
|
188
188
|
intervalMs: 60000,
|
|
189
189
|
taskTemplate: "Disabled task",
|
|
@@ -193,6 +193,8 @@ describe("Scheduled Tasks Integration", () => {
|
|
|
193
193
|
const enabledOnly = await getScheduledTasks({ enabled: true });
|
|
194
194
|
const disabledOnly = await getScheduledTasks({ enabled: false });
|
|
195
195
|
|
|
196
|
+
expect(enabledOnly.some((s) => s.id === enabled.id)).toBe(true);
|
|
197
|
+
expect(disabledOnly.some((s) => s.id === disabled.id)).toBe(true);
|
|
196
198
|
expect(enabledOnly.every((s) => s.enabled)).toBe(true);
|
|
197
199
|
expect(disabledOnly.every((s) => !s.enabled)).toBe(true);
|
|
198
200
|
});
|
|
@@ -214,15 +216,18 @@ describe("Scheduled Tasks Integration", () => {
|
|
|
214
216
|
});
|
|
215
217
|
await updateScheduledTask(failing.id, {
|
|
216
218
|
lastRunAt: new Date(Date.now() - 60000).toISOString(),
|
|
217
|
-
consecutiveErrors:
|
|
219
|
+
consecutiveErrors: 2,
|
|
218
220
|
lastErrorAt: new Date().toISOString(),
|
|
219
221
|
lastErrorMessage: "boom",
|
|
220
222
|
});
|
|
221
223
|
|
|
222
|
-
const
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
224
|
+
const belowMinimum = await getScheduledTasks({ consecutiveErrorsMin: 3 });
|
|
225
|
+
expect(belowMinimum.some((s) => s.id === failing.id)).toBe(false);
|
|
226
|
+
const atMinimum = await getScheduledTasks({ consecutiveErrorsMin: 2 });
|
|
227
|
+
expect(atMinimum.some((s) => s.id === failing.id)).toBe(true);
|
|
228
|
+
expect(atMinimum.some((s) => s.id === ok.id)).toBe(false);
|
|
229
|
+
|
|
230
|
+
const failingOnly = await getScheduledTasks({ lastRunStatus: "failed" });
|
|
226
231
|
const succeededOnly = await getScheduledTasks({ lastRunStatus: "succeeded" });
|
|
227
232
|
|
|
228
233
|
expect(failingOnly.some((s) => s.id === failing.id)).toBe(true);
|
|
@@ -437,35 +442,6 @@ describe("Scheduled Tasks Integration", () => {
|
|
|
437
442
|
expect(createdTask.routingSource).toBeNull();
|
|
438
443
|
expect(createdTask.status).toBe("unassigned");
|
|
439
444
|
});
|
|
440
|
-
|
|
441
|
-
test("should be transactional - task and schedule update are atomic", async () => {
|
|
442
|
-
const schedule = await createScheduledTask({
|
|
443
|
-
name: "test-transactional",
|
|
444
|
-
intervalMs: 60000,
|
|
445
|
-
taskTemplate: "Transactional test task",
|
|
446
|
-
enabled: true,
|
|
447
|
-
});
|
|
448
|
-
|
|
449
|
-
const taskCountBefore = (
|
|
450
|
-
(await getDbClient().get("SELECT COUNT(*) as count FROM agent_tasks")) as {
|
|
451
|
-
count: number;
|
|
452
|
-
}
|
|
453
|
-
).count;
|
|
454
|
-
|
|
455
|
-
await runScheduleNow(schedule.id);
|
|
456
|
-
|
|
457
|
-
const taskCountAfter = (
|
|
458
|
-
(await getDbClient().get("SELECT COUNT(*) as count FROM agent_tasks")) as {
|
|
459
|
-
count: number;
|
|
460
|
-
}
|
|
461
|
-
).count;
|
|
462
|
-
|
|
463
|
-
const updatedSchedule = await getScheduledTaskById(schedule.id);
|
|
464
|
-
|
|
465
|
-
// Both operations should have completed
|
|
466
|
-
expect(taskCountAfter).toBe(taskCountBefore + 1);
|
|
467
|
-
expect(updatedSchedule?.lastRunAt).toBeDefined();
|
|
468
|
-
});
|
|
469
445
|
});
|
|
470
446
|
|
|
471
447
|
describe("calculateNextRun", () => {
|
|
@@ -603,7 +579,7 @@ describe("Scheduled Tasks Integration", () => {
|
|
|
603
579
|
});
|
|
604
580
|
|
|
605
581
|
describe("One-Time Schedules", () => {
|
|
606
|
-
test("create one-time schedule
|
|
582
|
+
test("create one-time schedule stores nextRunAt without cadence", async () => {
|
|
607
583
|
const before = Date.now();
|
|
608
584
|
const schedule = await createScheduledTask({
|
|
609
585
|
name: "one-time-delay-test",
|
|
@@ -620,7 +596,7 @@ describe("Scheduled Tasks Integration", () => {
|
|
|
620
596
|
expect(schedule.intervalMs).toBeUndefined();
|
|
621
597
|
});
|
|
622
598
|
|
|
623
|
-
test("create one-time schedule
|
|
599
|
+
test("create one-time schedule preserves exact nextRunAt", async () => {
|
|
624
600
|
const runAt = new Date(Date.now() + 120000).toISOString();
|
|
625
601
|
const schedule = await createScheduledTask({
|
|
626
602
|
name: "one-time-runat-test",
|
|
@@ -634,19 +610,6 @@ describe("Scheduled Tasks Integration", () => {
|
|
|
634
610
|
expect(schedule.nextRunAt).toBe(runAt);
|
|
635
611
|
});
|
|
636
612
|
|
|
637
|
-
test("one-time schedule does not require cronExpression or intervalMs", async () => {
|
|
638
|
-
const schedule = await createScheduledTask({
|
|
639
|
-
name: "one-time-no-cron-test",
|
|
640
|
-
taskTemplate: "No cron needed",
|
|
641
|
-
scheduleType: "one_time",
|
|
642
|
-
nextRunAt: new Date(Date.now() + 60000).toISOString(),
|
|
643
|
-
});
|
|
644
|
-
|
|
645
|
-
expect(schedule.scheduleType).toBe("one_time");
|
|
646
|
-
expect(schedule.cronExpression).toBeUndefined();
|
|
647
|
-
expect(schedule.intervalMs).toBeUndefined();
|
|
648
|
-
});
|
|
649
|
-
|
|
650
613
|
test("executing one-time schedule auto-disables it", async () => {
|
|
651
614
|
const schedule = await createScheduledTask({
|
|
652
615
|
name: "one-time-exec-test",
|
|
@@ -728,6 +728,8 @@ describe("script connections", () => {
|
|
|
728
728
|
markMigrationApplied(database, "340_api_key_spend_cap.sql");
|
|
729
729
|
// 341 alters user_tokens, which this fixture does not create.
|
|
730
730
|
markMigrationApplied(database, "341_user_token_expiry.sql");
|
|
731
|
+
// 342 alters script_runs, which this migration-112-only fixture does not create.
|
|
732
|
+
markMigrationApplied(database, "342_script_run_sources.sql");
|
|
731
733
|
|
|
732
734
|
const id = crypto.randomUUID();
|
|
733
735
|
const now = new Date().toISOString();
|
|
@@ -4,11 +4,7 @@ import { tmpdir } from "node:os";
|
|
|
4
4
|
import { join } from "node:path";
|
|
5
5
|
import { classifyExit, NativeScriptExecutor } from "../scripts-runtime/executors/native";
|
|
6
6
|
import { QuickJSScriptExecutor } from "../scripts-runtime/executors/quickjs";
|
|
7
|
-
import type {
|
|
8
|
-
ExecutorInput,
|
|
9
|
-
ExecutorOutput,
|
|
10
|
-
ScriptExecutor,
|
|
11
|
-
} from "../scripts-runtime/executors/types";
|
|
7
|
+
import type { ExecutorInput, ScriptExecutor } from "../scripts-runtime/executors/types";
|
|
12
8
|
import { DEFAULT_SCRIPT_RESOURCES } from "../scripts-runtime/executors/types";
|
|
13
9
|
import { SKIP_SANDBOX_SPAWN_TESTS } from "./sandbox-spawn-test-helpers";
|
|
14
10
|
import { CHILD_PROCESS_TEST_BUDGET_MS } from "./test-proc";
|
|
@@ -39,49 +35,7 @@ function input(overrides: Partial<ExecutorInput> = {}): ExecutorInput {
|
|
|
39
35
|
};
|
|
40
36
|
}
|
|
41
37
|
|
|
42
|
-
class FakeScriptExecutor implements ScriptExecutor {
|
|
43
|
-
readonly name = "fake";
|
|
44
|
-
|
|
45
|
-
async run(runInput: ExecutorInput): Promise<ExecutorOutput> {
|
|
46
|
-
if (runInput.fsMode === "workspace-rw") {
|
|
47
|
-
return {
|
|
48
|
-
result: undefined,
|
|
49
|
-
stdout: "",
|
|
50
|
-
stderr: "workspace-rw not supported",
|
|
51
|
-
truncated: { stdout: false, stderr: false },
|
|
52
|
-
durationMs: 0,
|
|
53
|
-
exitCode: 1,
|
|
54
|
-
error: "executor_error",
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
if (runInput.signal?.aborted) {
|
|
59
|
-
return {
|
|
60
|
-
result: undefined,
|
|
61
|
-
stdout: "",
|
|
62
|
-
stderr: "",
|
|
63
|
-
truncated: { stdout: false, stderr: false },
|
|
64
|
-
durationMs: 0,
|
|
65
|
-
exitCode: 1,
|
|
66
|
-
error: "killed",
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const stdout = "x".repeat(runInput.resources.maxStdoutBytes + 10);
|
|
71
|
-
return {
|
|
72
|
-
result: runInput.configPayload.system.agentId.value,
|
|
73
|
-
stdout: stdout.slice(0, runInput.resources.maxStdoutBytes),
|
|
74
|
-
stderr: "",
|
|
75
|
-
truncated: { stdout: true, stderr: false },
|
|
76
|
-
durationMs: 1,
|
|
77
|
-
exitCode: 0,
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
38
|
// `spawns` marks whether this executor variant shells out via Bun.spawn.
|
|
83
|
-
// FakeScriptExecutor is plain JS and never touches the sandbox, so it must
|
|
84
|
-
// keep running even when the spawn probe has disabled the native suite.
|
|
85
39
|
function conformance(name: string, makeExecutor: () => ScriptExecutor, spawns: boolean) {
|
|
86
40
|
const spawnTest = test.skipIf(spawns && SKIP_SANDBOX_SPAWN_TESTS);
|
|
87
41
|
|
|
@@ -132,7 +86,6 @@ function conformance(name: string, makeExecutor: () => ScriptExecutor, spawns: b
|
|
|
132
86
|
}
|
|
133
87
|
|
|
134
88
|
conformance("native", () => new NativeScriptExecutor(), true);
|
|
135
|
-
conformance("fake", () => new FakeScriptExecutor(), false);
|
|
136
89
|
// Worker threads and WASM, no Bun.spawn: runs even when the spawn probe fails.
|
|
137
90
|
conformance("quickjs", () => new QuickJSScriptExecutor(), false);
|
|
138
91
|
|
|
@@ -1193,7 +1146,9 @@ describe("native-only executor behavior", () => {
|
|
|
1193
1146
|
describe("classifyExit", () => {
|
|
1194
1147
|
test("timeout and killed take precedence over other exit codes", () => {
|
|
1195
1148
|
expect(classifyExit(1, true, false, false)).toBe("timeout");
|
|
1149
|
+
expect(classifyExit(1, true, false, true)).toBe("timeout");
|
|
1196
1150
|
expect(classifyExit(1, false, true, false)).toBe("killed");
|
|
1151
|
+
expect(classifyExit(1, false, true, true)).toBe("killed");
|
|
1197
1152
|
});
|
|
1198
1153
|
|
|
1199
1154
|
test("exit 134 is authoritative even if the watchdog also fired (our kill can't produce SIGABRT)", () => {
|
|
@@ -1209,6 +1164,7 @@ describe("classifyExit", () => {
|
|
|
1209
1164
|
|
|
1210
1165
|
test("OOM-kill exit codes map to killed", () => {
|
|
1211
1166
|
expect(classifyExit(137, false, false, false)).toBe("killed");
|
|
1167
|
+
expect(classifyExit(137, false, false, true)).toBe("killed");
|
|
1212
1168
|
expect(classifyExit(9, false, false, false)).toBe("killed");
|
|
1213
1169
|
});
|
|
1214
1170
|
|
|
@@ -8,12 +8,16 @@ import { QuickJSScriptExecutor, quickJSWorkerCount } from "./src/scripts-runtime
|
|
|
8
8
|
import { DEFAULT_SCRIPT_RESOURCES } from "./src/scripts-runtime/executors/types";
|
|
9
9
|
let release;
|
|
10
10
|
const gate = new Promise(resolve => { release = resolve; });
|
|
11
|
+
let allStarted;
|
|
12
|
+
const ready = new Promise(resolve => { allStarted = resolve; });
|
|
13
|
+
let workers;
|
|
11
14
|
let started = 0;
|
|
12
15
|
let inFlight = 0;
|
|
13
16
|
let peak = 0;
|
|
14
17
|
const server = Bun.serve({ port: 0, async fetch() {
|
|
15
18
|
started++;
|
|
16
19
|
peak = Math.max(peak, ++inFlight);
|
|
20
|
+
if (started === workers) allStarted();
|
|
17
21
|
await gate;
|
|
18
22
|
inFlight--;
|
|
19
23
|
return new Response("ok");
|
|
@@ -32,15 +36,13 @@ try {
|
|
|
32
36
|
fsMode: "none", network: "open",
|
|
33
37
|
};
|
|
34
38
|
const jobs = Array.from({ length: 10 }, () => executor.run(input));
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
while (started < workers && Date.now() < deadline) await Bun.sleep(10);
|
|
38
|
-
const heldPeak = peak;
|
|
39
|
+
workers = quickJSWorkerCount();
|
|
40
|
+
if (workers > 0) await Promise.race([ready, Promise.all(jobs)]);
|
|
39
41
|
release();
|
|
40
42
|
const outputs = await Promise.all(jobs);
|
|
41
43
|
process.env.SCRIPT_QUICKJS_POOL_SIZE = "16";
|
|
42
44
|
const later = await executor.run(input);
|
|
43
|
-
console.log(JSON.stringify({ workers,
|
|
45
|
+
console.log(JSON.stringify({ workers, peak, results: outputs.map(o => o.result),
|
|
44
46
|
errors: outputs.map(o => o.error), stderr: outputs[0].stderr,
|
|
45
47
|
retainedWorkers: quickJSWorkerCount(), laterResult: later.result }));
|
|
46
48
|
} finally {
|
|
@@ -59,7 +61,7 @@ async function inspectPool(size?: string) {
|
|
|
59
61
|
);
|
|
60
62
|
return JSON.parse(result.stdout.trim()) as {
|
|
61
63
|
workers: number;
|
|
62
|
-
|
|
64
|
+
peak: number;
|
|
63
65
|
results: string[];
|
|
64
66
|
errors: Array<string | null>;
|
|
65
67
|
stderr: string;
|
|
@@ -80,7 +82,7 @@ describe("QuickJS pool configuration", () => {
|
|
|
80
82
|
async () => {
|
|
81
83
|
const result = await inspectPool(size);
|
|
82
84
|
expect(result.workers).toBe(expected);
|
|
83
|
-
expect(result.
|
|
85
|
+
expect(result.peak).toBe(expected);
|
|
84
86
|
expect(result.results).toEqual(Array(10).fill("ok"));
|
|
85
87
|
expect(result.errors).toEqual(Array(10).fill(null));
|
|
86
88
|
expect(result.retainedWorkers).toBe(expected);
|
|
@@ -4,7 +4,6 @@ import { tmpdir } from "node:os";
|
|
|
4
4
|
import { join } from "node:path";
|
|
5
5
|
import { pathToFileURL } from "node:url";
|
|
6
6
|
import {
|
|
7
|
-
classifyExit,
|
|
8
7
|
NativeScriptExecutor,
|
|
9
8
|
writeBareImportShim,
|
|
10
9
|
writeBareImportShims,
|
|
@@ -65,15 +64,6 @@ describe("NativeScriptExecutor startup overhead & shim reuse (#2008)", () => {
|
|
|
65
64
|
}
|
|
66
65
|
});
|
|
67
66
|
|
|
68
|
-
test("classifyExit preserves retry-safety boundary around userCodeStarted and resource signals", () => {
|
|
69
|
-
expect(classifyExit(134, false, false, false)).toBe("capacity_exceeded");
|
|
70
|
-
expect(classifyExit(134, false, false, true)).toBe("eval_error");
|
|
71
|
-
expect(classifyExit(1, true, false, true)).toBe("timeout");
|
|
72
|
-
expect(classifyExit(1, false, true, true)).toBe("killed");
|
|
73
|
-
expect(classifyExit(137, false, false, true)).toBe("killed");
|
|
74
|
-
expect(classifyExit(0, false, false, true)).toBeUndefined();
|
|
75
|
-
});
|
|
76
|
-
|
|
77
67
|
spawnTest(
|
|
78
68
|
"NativeScriptExecutor resolves bare imports across repeated runs and cleans up tmpdir",
|
|
79
69
|
async () => {
|
|
@@ -112,6 +102,7 @@ describe("NativeScriptExecutor startup overhead & shim reuse (#2008)", () => {
|
|
|
112
102
|
expect(second.exitCode).toBe(0);
|
|
113
103
|
expect(typeof second.result).toBe("string");
|
|
114
104
|
},
|
|
105
|
+
defaultResources.wallClockMs * 2 + 5_000,
|
|
115
106
|
);
|
|
116
107
|
|
|
117
108
|
spawnTest(
|
|
@@ -160,6 +151,7 @@ describe("NativeScriptExecutor startup overhead & shim reuse (#2008)", () => {
|
|
|
160
151
|
expect(secondResult.hasMarker).toBe(false);
|
|
161
152
|
expect(secondResult.tmp).not.toBe(firstTmp);
|
|
162
153
|
},
|
|
154
|
+
defaultResources.wallClockMs * 2 + 5_000,
|
|
163
155
|
);
|
|
164
156
|
|
|
165
157
|
spawnTest("NativeScriptExecutor enforces wallClockMs timeout", async () => {
|
|
@@ -226,26 +218,30 @@ describe("NativeScriptExecutor startup overhead & shim reuse (#2008)", () => {
|
|
|
226
218
|
expect(out.result).toBeUndefined();
|
|
227
219
|
});
|
|
228
220
|
|
|
229
|
-
spawnTest(
|
|
230
|
-
|
|
221
|
+
spawnTest(
|
|
222
|
+
"NativeScriptExecutor enforces maxStdoutBytes truncation resource limit",
|
|
223
|
+
async () => {
|
|
224
|
+
const executor = new NativeScriptExecutor();
|
|
231
225
|
|
|
232
|
-
|
|
233
|
-
|
|
226
|
+
const out = await executor.run({
|
|
227
|
+
source: `
|
|
234
228
|
export default async () => {
|
|
235
229
|
console.log("x".repeat(4096));
|
|
236
230
|
return { ok: true };
|
|
237
231
|
};
|
|
238
232
|
`,
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
233
|
+
args: null,
|
|
234
|
+
configPayload: defaultConfigPayload,
|
|
235
|
+
resources: { ...defaultResources, maxStdoutBytes: 512 },
|
|
236
|
+
fsMode: "none",
|
|
237
|
+
network: "full",
|
|
238
|
+
});
|
|
245
239
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
240
|
+
expect(out.error, out.stderr).toBeUndefined();
|
|
241
|
+
expect(out.truncated.stdout).toBe(true);
|
|
242
|
+
expect(out.stdout.length).toBeLessThanOrEqual(512);
|
|
243
|
+
expect(out.result).toEqual({ ok: true });
|
|
244
|
+
},
|
|
245
|
+
defaultResources.wallClockMs + 5_000,
|
|
246
|
+
);
|
|
251
247
|
});
|