@desplega.ai/agent-swarm 2.13.5 → 2.14.0
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-99n6z9ky.js +17 -0
- package/dist/{acp-targets-w8dbs4nr.js → acp-targets-23exz4z4.js} +10 -10
- package/dist/{actions-8zrcbjrx.js → actions-zcr25x27.js} +60 -39
- package/dist/{agent-fs-provision-cbt2ttds.js → agent-fs-provision-7fa9e12e.js} +4 -4
- package/dist/{amp-adapter-8x6zp8w4.js → amp-adapter-s7ytmv6b.js} +3 -3
- package/dist/{app-zfa9dwjw.js → app-5d3sz1hy.js} +7 -7
- package/dist/{approval-notifications-rv92zmza.js → approval-notifications-7qgkzkzx.js} +8 -8
- package/dist/{assistant-q7s7rm1q.js → assistant-p2yvhc3j.js} +37 -32
- package/dist/{boot-args-schema-g27kpzr1.js → boot-args-schema-ry6cb0p7.js} +1 -1
- package/dist/{boot-reembed-1mjs52nt.js → boot-reembed-2hkm3vz2.js} +1 -1
- package/dist/{boot-reembed-m62dpdkg.js → boot-reembed-c9643ms3.js} +1 -1
- package/dist/{boot-scrub-sweep-ss1vcamw.js → boot-scrub-sweep-3ycxr51t.js} +2 -2
- package/dist/{boot-seeds-hwnvgbb3.js → boot-seeds-2hzvvzg0.js} +4 -4
- package/dist/{boxd-y0szhp0g.js → boxd-9py3x0jb.js} +2 -2
- package/dist/{claude-adapter-0rjmbhjk.js → claude-adapter-dnkww93e.js} +9 -9
- package/dist/{claude-managed-adapter-6k032agg.js → claude-managed-adapter-yk0cr5x6.js} +4 -4
- package/dist/{claude-managed-setup-6czvve8q.js → claude-managed-setup-4byxpp47.js} +5 -5
- package/dist/{claude-sdk-session-pr0znb81.js → claude-sdk-session-4wf3dbvs.js} +12467 -12285
- package/dist/{cli-t0n9svkb.js → cli-096aftq6.js} +12 -7
- package/dist/{cli-2wzkvfgm.js → cli-0e914dp9.js} +3 -3
- package/dist/{cli-vcpyttcw.js → cli-0h6m6z5g.js} +1 -1
- package/dist/{cli-q41qar56.js → cli-0k7ppk9k.js} +130 -8
- package/dist/{cli-ks06cd0n.js → cli-1nfabrt4.js} +8 -8
- package/dist/{cli-ebpq3c5z.js → cli-2414h5r9.js} +8 -8
- package/dist/{cli-nrt048ys.js → cli-24wervhz.js} +37 -0
- package/dist/{cli-pedm2kht.js → cli-2ayk9gn8.js} +2 -2
- package/dist/{cli-kr0jpw9c.js → cli-2ckwgs7q.js} +1 -1
- package/dist/{cli-evy3egte.js → cli-2savn6mm.js} +11 -100
- package/dist/{cli-n79j1vxc.js → cli-2zjxake1.js} +4 -4
- package/dist/{cli-z3x7h79n.js → cli-37p61fcg.js} +9 -9
- package/dist/{cli-2vp0z049.js → cli-39t9d248.js} +1 -1
- package/dist/{cli-sa02jsqt.js → cli-3mhdmcd4.js} +1 -1
- package/dist/{cli-34fygf87.js → cli-3wsabyt0.js} +2 -2
- package/dist/{cli-grbngev5.js → cli-466jjrwe.js} +11 -2
- package/dist/{cli-zxa1vmx7.js → cli-6ajyhxh7.js} +2 -2
- package/dist/{cli-bvamr9g0.js → cli-6yy4fepf.js} +4 -4
- package/dist/{cli-3vw6dd4g.js → cli-73rmgm45.js} +2 -2
- package/dist/{cli-8b4rpnwj.js → cli-7ca8hczj.js} +1 -1
- package/dist/{cli-0h8skzss.js → cli-7g5qj2ca.js} +4 -3
- package/dist/{cli-srre41gb.js → cli-7w1fs01q.js} +2 -2
- package/dist/{cli-tgc1kgg3.js → cli-84wxwt3z.js} +1 -1
- package/dist/{cli-4gaf3tx5.js → cli-84xn7bgz.js} +1 -1
- package/dist/{cli-s8dhq7rj.js → cli-879txsac.js} +5 -5
- package/dist/{cli-9n6g14vs.js → cli-8vbxjzk0.js} +3 -3
- package/dist/{cli-cmbb2t8a.js → cli-91amj3md.js} +2 -2
- package/dist/{cli-ewk3sg68.js → cli-930zbczq.js} +3 -3
- package/dist/{cli-6msnpj1z.js → cli-9fwznq4p.js} +10 -10
- package/dist/{cli-qmx8bnt4.js → cli-9j1t3kf6.js} +2 -2
- package/dist/{cli-t879ww0y.js → cli-9j47sgzy.js} +2 -2
- package/dist/{cli-0qt3epg4.js → cli-ad00h1st.js} +7 -7
- package/dist/{cli-avax5mp9.js → cli-adzmmcvf.js} +19 -7
- package/dist/{cli-ffn0a515.js → cli-ayxxkk3p.js} +68 -25
- package/dist/{cli-4vynxtrb.js → cli-bqfx72e6.js} +10 -3
- package/dist/{cli-887vhew6.js → cli-cbg0j1yt.js} +2716 -2643
- package/dist/{cli-fw67mnyc.js → cli-cg1q8ymp.js} +1 -1
- package/dist/{cli-he5nxaa8.js → cli-dw9rtjm3.js} +1 -1
- package/dist/{cli-emdfd8fh.js → cli-dy754erz.js} +9 -1
- package/dist/{cli-3860pmrq.js → cli-edxfzgah.js} +4 -4
- package/dist/{cli-v09eza21.js → cli-ejnhs815.js} +15 -15
- package/dist/{cli-k0nebh10.js → cli-enavhq6r.js} +1 -1
- package/dist/{cli-b42yfn17.js → cli-f2rwt43y.js} +13 -13
- package/dist/{cli-tvyt8w6n.js → cli-f9g96z28.js} +8 -8
- package/dist/{cli-zbbtp02a.js → cli-fww016hh.js} +457 -70
- package/dist/{cli-vbge4rsp.js → cli-g6a696c0.js} +4 -4
- package/dist/{cli-z1vam71h.js → cli-gc6b94tj.js} +2 -2
- package/dist/{cli-5tq15aa7.js → cli-gcyws2bp.js} +2 -2
- package/dist/{cli-srktrbby.js → cli-hzhv7yac.js} +1 -1
- package/dist/{cli-cp163xga.js → cli-jcnc5ret.js} +44 -32
- package/dist/{cli-j69pzrrz.js → cli-jgq9xptq.js} +5 -5
- package/dist/{cli-kwj3131p.js → cli-jwnac23b.js} +1 -1
- package/dist/{cli-wzecestt.js → cli-kc7vd07m.js} +616 -289
- package/dist/{cli-8pd1t17c.js → cli-kg63yp1r.js} +14 -14
- package/dist/{cli-zzq96q57.js → cli-krk8y8c7.js} +727 -139
- package/dist/{cli-5web09sb.js → cli-m0ea8ggd.js} +8 -10
- package/dist/{cli-qrvk9nka.js → cli-md4tn21h.js} +13 -13
- package/dist/{cli-1jq2em7b.js → cli-mv8ft7b0.js} +10 -9
- package/dist/{cli-ryem5cfq.js → cli-mw1tmn3x.js} +217 -27
- package/dist/{cli-abby987g.js → cli-njvpngc6.js} +3 -3
- package/dist/{cli-55h8m1x3.js → cli-phe2vcw5.js} +6 -6
- package/dist/{cli-prz1p3ft.js → cli-pq0kv31y.js} +5 -5
- package/dist/{cli-q1h041y8.js → cli-q457ga28.js} +6 -6
- package/dist/{cli-z40t85ms.js → cli-q5n3deaf.js} +1 -1
- package/dist/{cli-7ypg8hka.js → cli-qkbevqer.js} +3 -3
- package/dist/{cli-f9xw9pr4.js → cli-qrwjk4xy.js} +5 -5
- package/dist/{cli-kezzteka.js → cli-r04ve9xw.js} +1 -1
- package/dist/{cli-zntvmqmm.js → cli-r495stwd.js} +2 -2
- package/dist/{cli-1kvcsd2f.js → cli-r9d2tya0.js} +71 -3
- package/dist/{cli-ybte1fqc.js → cli-rp1n2xpd.js} +1 -1
- package/dist/{cli-sejvnjvw.js → cli-rs1rzwp4.js} +1 -1
- package/dist/{cli-94mxerrp.js → cli-rzbsh6bw.js} +1 -1
- package/dist/{cli-94gx6ze9.js → cli-s4pccby1.js} +1 -1
- package/dist/{cli-hd5bm1e1.js → cli-shyhb4t5.js} +10 -10
- package/dist/{cli-r3dxpmyt.js → cli-srq69pn1.js} +1 -1
- package/dist/{cli-7r9tvk8v.js → cli-tc165vrb.js} +8 -3
- package/dist/{cli-ced4azn1.js → cli-v4z5v3jd.js} +298 -80
- package/dist/{cli-ehg90jd1.js → cli-vxmmttmt.js} +55 -50
- package/dist/{cli-tt7dkwjj.js → cli-w4bvtxet.js} +7 -7
- package/dist/{cli-x2adbg4j.js → cli-wd7b5hgc.js} +1 -1
- package/dist/{cli-htb5bpz2.js → cli-wvbaq052.js} +1 -1
- package/dist/{cli-ywy8yz6t.js → cli-wvgg7r4j.js} +2 -2
- package/dist/{cli-19d6v8er.js → cli-wym6rxgt.js} +165 -6
- package/dist/{cli-f7b9nyvk.js → cli-yd7e590v.js} +12 -12
- package/dist/{cli-69zzpjgh.js → cli-yjb3cddd.js} +1 -1
- package/dist/{cli-5n9w2xzx.js → cli-z8t4485r.js} +2 -2
- package/dist/{cli-jdq3jmny.js → cli-ze1ndjs4.js} +4 -6
- package/dist/cli.js +28 -28
- package/dist/{codex-adapter-bn7eaxk5.js → codex-adapter-eq61radw.js} +8 -8
- package/dist/{codex-hook-nnmezjg9.js → codex-hook-8nmepvz6.js} +3 -3
- package/dist/{codex-login-ktfg1cxk.js → codex-login-vbd9707w.js} +1 -1
- package/dist/{codex-session-runner-j1e9hffc.js → codex-session-runner-rfx355h4.js} +9 -9
- package/dist/{commands-amhpafrr.js → commands-d1z0sx62.js} +3 -3
- package/dist/{controller-tw7g10j2.js → controller-9hz6d8x3.js} +4 -4
- package/dist/{controllers-connect-2ssqz7f4.js → controllers-connect-tz07d2xr.js} +24 -25
- package/dist/core-dynsv289.js +41 -0
- package/dist/{cursor-adapter-d6knjmwa.js → cursor-adapter-ef22ze3j.js} +2 -2
- package/dist/{db-fd6xxm77.js → db-gd81d68c.js} +3 -3
- package/dist/{db-sc59379z.js → db-vrckks6q.js} +4 -2
- package/dist/{devin-adapter-3bp6rape.js → devin-adapter-kdt6a2bh.js} +1 -1
- package/dist/{dispatcher-a2gdqz8c.js → dispatcher-76as8w2t.js} +21 -22
- package/dist/{docker-a59g3ebm.js → docker-51ta7jsh.js} +2 -2
- package/dist/dsh-adapter-ypfvcdyz.js +11 -0
- package/dist/{e2b-cn7cvjqy.js → e2b-05kn3kpq.js} +16 -5
- package/dist/{e2b-qnxyfea6.js → e2b-dm9r8hpy.js} +3 -3
- package/dist/{easter-egg-3d-a0pphy71.js → easter-egg-3d-sg21j15g.js} +1 -1
- package/dist/{embedding-space-qepzrach.js → embedding-space-zsdw37bb.js} +13 -23
- package/dist/{embeddings-d7vr881x.js → embeddings-p4e3e1m6.js} +1 -1
- package/dist/{event-bus-7gbsr0g4.js → event-bus-tvf2grf4.js} +1 -1
- package/dist/{execute-6afts2bn.js → execute-nztd0af0.js} +1 -1
- package/dist/{external-channel-881zq1x4.js → external-channel-717yzn4d.js} +2 -2
- package/dist/fx-adapter-9k0hptnz.js +20 -0
- package/dist/grok-adapter-skdj2pce.js +20 -0
- package/dist/handlers-5btjqkz6.js +39 -0
- package/dist/{heartbeat-4c022m6a.js → heartbeat-vfb1gy84.js} +24 -25
- package/dist/{hook-a7eh6zty.js → hook-ctz0xmp3.js} +11 -11
- package/dist/{hook-4k84x499.js → hook-eh52p7yd.js} +6 -6
- package/dist/{http-6aw5wanc.js → http-zregegrx.js} +784 -166
- package/dist/{index-xhad0n8m.js → index-5kx15d19.js} +1 -1
- package/dist/index-7w8p6em0.js +41 -0
- package/dist/index-evay0xyk.js +17 -0
- package/dist/{index-yq9hhhhy.js → index-fdym6ryb.js} +25 -26
- package/dist/{index-3j803vnb.js → index-mtnbhe12.js} +20533 -19786
- package/dist/index-vz4semsx.js +38 -0
- package/dist/{index-z2g9469g.js → index-x9qf8dg7.js} +108 -28
- package/dist/index-y3s0xp2v.js +43 -0
- package/dist/{k8s-36gfn847.js → k8s-ejkk0aw7.js} +2 -2
- package/dist/{keepalive-zhbmztqw.js → keepalive-zdqay870.js} +4 -5
- package/dist/lead-6cscw8a5.js +82 -0
- package/dist/{maintenance-rsp0591h.js → maintenance-t5ndg11m.js} +1 -1
- package/dist/{node-rxte5hc6.js → node-jkdd5w7m.js} +1 -1
- package/dist/{oauth-refresh-sweep-w3cqmxq7.js → oauth-refresh-sweep-y9zyd7t6.js} +3 -4
- package/dist/{object-webhooks-331hay92.js → object-webhooks-mkca91s0.js} +7 -7
- package/dist/{onboard-n2w80m2n.js → onboard-ss995244.js} +11 -9
- package/dist/{opencode-adapter-z98127cz.js → opencode-adapter-mwpz0278.js} +8 -8
- package/dist/{otel-impl-xsk35tvf.js → otel-impl-6n6vva3x.js} +2 -2
- package/dist/{pending-2e6trkxd.js → pending-2sxh1t6j.js} +22 -23
- package/dist/{pi-mono-adapter-wh6yndtm.js → pi-mono-adapter-sfb7zy43.js} +13 -13
- package/dist/{pricing-refresh-9355dj1t.js → pricing-refresh-h79bg4cf.js} +2 -2
- package/dist/{rbac-roles-8eajw4s6.js → rbac-roles-ckq0czp4.js} +2 -2
- package/dist/{rbac-roles-58y3m912.js → rbac-roles-jg2e260w.js} +3 -3
- package/dist/{render-v2-7gskkmd4.js → render-v2-ymbshmn0.js} +7 -7
- package/dist/{resume-0drnmpja.js → resume-jdhnt4jk.js} +10 -10
- package/dist/{runtime-d2tcmqte.js → runtime-y28jhhnf.js} +1 -1
- package/dist/{session-access-0ztys6bd.js → session-access-k4ta5hvp.js} +5 -5
- package/dist/{session-source-backfill-cdm5s046.js → session-source-backfill-528j4s8j.js} +3 -3
- package/dist/{setup-pqwb9tcc.js → setup-d6pj82fr.js} +15 -6
- package/dist/thread-buffer-9w6x5zec.js +40 -0
- package/dist/{tree-visibility-rwz67mje.js → tree-visibility-kjxv3nxk.js} +2 -2
- package/dist/{user-merge-jobs-mxrhamwt.js → user-merge-jobs-rabbncf6.js} +3 -3
- package/dist/{virtual-modules-71y1gsmg.js → virtual-modules-22k51txd.js} +3 -3
- package/dist/{work-objects-3k4ykt9j.js → work-objects-xtjbar3r.js} +26 -30
- package/dist/{worker-follow-up-y0h64xpr.js → worker-follow-up-fg48vk6d.js} +21 -22
- package/dist/worker-g4aj93dt.js +82 -0
- package/dist/{x-d27jj7z7.js → x-vfsqypht.js} +2 -2
- package/openapi.json +247 -20
- package/package.json +10 -10
- package/src/apps/definition.ts +76 -24
- package/src/apps/row-store.ts +67 -0
- package/src/apps/script-types.ts +131 -21
- package/src/apps/store.ts +4 -1
- package/src/be/db/script-runs.ts +33 -0
- package/src/be/db/slack-card-groups.ts +147 -0
- package/src/be/db/slack-trees.ts +26 -0
- package/src/be/db/task-idempotency.ts +63 -0
- package/src/be/db/tasks/read.ts +2 -0
- package/src/be/db/tasks/write.ts +4 -2
- package/src/be/db/workflow-idempotency.ts +6 -1
- package/src/be/db/workflows/read.ts +79 -0
- package/src/be/db.ts +51 -147
- package/src/be/improvements.ts +24 -2
- package/src/be/mcp-proxy.ts +45 -11
- package/src/be/memory/embedding-space.ts +10 -20
- package/src/be/memory/index.ts +35 -0
- package/src/be/memory/providers/openai-embedding.ts +10 -0
- package/src/be/migrations/348_task_deferred_until.sql +4 -0
- package/src/be/migrations/354_durable_objects.sql +9 -0
- package/src/be/migrations/356_slack_outcome_card_groups.sql +14 -0
- package/src/be/migrations/357_task_idempotency_keys.sql +27 -0
- package/src/be/migrations/362_favorites_app.sql +36 -0
- package/src/be/repo-checked-update.ts +58 -5
- package/src/be/requester-timezone.ts +10 -0
- package/src/be/script-connections.ts +5 -1
- package/src/be/script-credential-broker.ts +29 -2
- package/src/be/scripts/durable.ts +204 -0
- package/src/be/scripts/extract-schema.ts +29 -4
- package/src/be/scripts/run-credential.ts +1 -8
- package/src/be/scripts/typecheck.ts +32 -7
- package/src/be/seed-scripts/catalog/memory-eval.ts +11 -2
- package/src/be/seed-scripts/catalog/tool-usage.ts +27 -8
- package/src/be/swarm-config-guard.ts +87 -7
- package/src/be/users.ts +33 -12
- package/src/comb/review-batch.ts +16 -5
- package/src/commands/context-preamble.ts +237 -0
- package/src/commands/e2b.ts +14 -0
- package/src/commands/entrypoint-mcp-config.ts +231 -0
- package/src/commands/onboard/agent-fs-version.ts +1 -1
- package/src/commands/onboard/compose-generator.ts +2 -1
- package/src/commands/onboard/env-generator.ts +16 -7
- package/src/commands/runner.ts +23 -7
- package/src/commands/setup.tsx +17 -3
- package/src/extensions/contract-types.generated.ts +1 -1
- package/src/hooks/hook.ts +8 -2
- package/src/hooks/native-tool-hooks.ts +4 -2
- package/src/http/apps.ts +82 -42
- package/src/http/comb.ts +21 -5
- package/src/http/config.ts +8 -4
- package/src/http/heartbeat.ts +5 -0
- package/src/http/index.ts +12 -6
- package/src/http/kv.ts +7 -5
- package/src/http/mcp-oauth.ts +16 -0
- package/src/http/mcp-servers.ts +43 -3
- package/src/http/memory.ts +28 -1
- package/src/http/metrics.ts +11 -4
- package/src/http/onboarding.ts +12 -1
- package/src/http/repos.ts +27 -11
- package/src/http/request-principal.ts +27 -1
- package/src/http/schedules.ts +36 -8
- package/src/http/script-connection-proxy.ts +3 -1
- package/src/http/script-runs.ts +21 -10
- package/src/http/scripts.ts +177 -26
- package/src/http/session-cost-recompute.ts +9 -4
- package/src/http/skills.ts +70 -0
- package/src/http/status.ts +2 -0
- package/src/http/tasks.ts +92 -14
- package/src/http/trackers/jira.ts +18 -3
- package/src/http/trackers/linear.ts +3 -0
- package/src/kv-limits.ts +2 -0
- package/src/kv-reserved-namespaces.ts +25 -2
- package/src/prompts/session-templates.ts +49 -0
- package/src/prompts/session-turns.ts +30 -0
- package/src/providers/amp-adapter.ts +1 -1
- package/src/providers/claude-managed-adapter.ts +14 -0
- package/src/providers/claude-sdk-session.ts +14 -1
- package/src/providers/cursor-adapter.ts +1 -1
- package/src/providers/dsh-adapter.ts +1 -1
- package/src/providers/opencode-adapter.ts +3 -5
- package/src/providers/runtime-dependencies.ts +11 -8
- package/src/rbac/legacy-policy.ts +7 -0
- package/src/rbac/permissions.ts +27 -0
- package/src/scheduler/scheduler.ts +36 -18
- package/src/script-workflows/executor.ts +37 -8
- package/src/script-workflows/supervisor.ts +14 -0
- package/src/scripts-runtime/ctx.ts +5 -1
- package/src/scripts-runtime/durable-object-base.ts +19 -0
- package/src/scripts-runtime/eval-harness.ts +46 -1
- package/src/scripts-runtime/executors/native.ts +13 -1
- package/src/scripts-runtime/executors/quickjs-bundle.ts +20 -1
- package/src/scripts-runtime/executors/quickjs-prelude.ts +40 -1
- package/src/scripts-runtime/executors/quickjs-runner.ts +26 -3
- package/src/scripts-runtime/executors/quickjs-worker.ts +2 -1
- package/src/scripts-runtime/executors/types.ts +26 -0
- package/src/scripts-runtime/extract-signature.ts +96 -1
- package/src/scripts-runtime/loader.ts +11 -5
- package/src/scripts-runtime/mcp-client.ts +1 -1
- package/src/scripts-runtime/sdk-allowlist.ts +1 -0
- package/src/scripts-runtime/swarm-config.ts +7 -0
- package/src/scripts-runtime/swarm-sdk.ts +4 -1
- package/src/scripts-runtime/types/stdlib.d.ts +19 -0
- package/src/scripts-runtime/types/swarm-extension.d.ts +1 -0
- package/src/scripts-runtime/types/swarm-sdk.d.ts +19 -0
- package/src/slack/actions.ts +24 -0
- package/src/slack/assistant.ts +8 -0
- package/src/slack/blocks.ts +35 -0
- package/src/slack/channel-activity.ts +7 -0
- package/src/slack/enrich.ts +46 -54
- package/src/slack/files.ts +173 -23
- package/src/slack/handlers.test.ts +17 -19
- package/src/slack/handlers.ts +15 -14
- package/src/slack/render-v2.ts +264 -19
- package/src/slack/responses.ts +61 -5
- package/src/slack/session-mirror.ts +10 -5
- package/src/slack/task-output.ts +25 -14
- package/src/slack/templates.ts +9 -0
- package/src/slack/thread-participants.ts +64 -24
- package/src/slack/watcher.ts +4 -4
- package/src/slack/work-objects.ts +1 -1
- package/src/stdio.ts +5 -0
- package/src/tests/agents-list-model-display.test.ts +4 -0
- package/src/tests/apps-script-types.test.ts +63 -16
- package/src/tests/apps-sort-order.test.ts +87 -0
- package/src/tests/bedrock-model-groups.test.ts +4 -0
- package/src/tests/channel-activity.test.ts +9 -0
- package/src/tests/chatgpt-subscription-model-groups.test.ts +4 -0
- package/src/tests/claude-hook-output.test.ts +2 -0
- package/src/tests/claude-managed-adapter.test.ts +15 -3
- package/src/tests/claude-sdk-stderr.test.ts +28 -0
- package/src/tests/codex-gpt6-release.test.ts +4 -0
- package/src/tests/comb-review-batch.test.ts +17 -4
- package/src/tests/comb-status.test.ts +1 -0
- package/src/tests/db-client.test.ts +11 -5
- package/src/tests/db-task-read-contract.test.ts +1 -0
- package/src/tests/db-task-write-contract.test.ts +2 -2
- package/src/tests/defer-task.test.ts +23 -1
- package/src/tests/dsh-adapter.test.ts +1 -1
- package/src/tests/e2b-dispatch.test.ts +13 -1
- package/src/tests/entrypoint-mcp-config.test.ts +642 -0
- package/src/tests/fixtures/onboard/content.env.txt +2 -2
- package/src/tests/fixtures/onboard/dev.env.txt +2 -2
- package/src/tests/fixtures/onboard/full-all.env.txt +2 -2
- package/src/tests/fixtures/onboard/full.env.txt +2 -2
- package/src/tests/fixtures/onboard/research.env.txt +2 -2
- package/src/tests/fixtures/onboard/solo.env.txt +2 -2
- package/src/tests/fixtures/runner-missing-dependency.ts +2 -1
- package/src/tests/fx-adapter.test.ts +4 -5
- package/src/tests/hook-mcp-config-precedence.test.ts +59 -0
- package/src/tests/hook-ping-me-order.test.ts +1 -0
- package/src/tests/hook-runtime-close.test.ts +1 -0
- package/src/tests/improvements-payload.test.ts +2 -2
- package/src/tests/model-groups-live-catalog.test.ts +4 -0
- package/src/tests/oauth-credential-bindings.test.ts +8 -3
- package/src/tests/oauth-refresh-failure.test.ts +15 -3
- package/src/tests/onboard-env.test.ts +1 -1
- package/src/tests/openai-compatible-providers.test.ts +5 -0
- package/src/tests/openapi-route-headers.test.ts +2 -1
- package/src/tests/opus-5-5-registry.test.ts +4 -0
- package/src/tests/provider-runtime-dependencies.test.ts +26 -15
- package/src/tests/routing-affinity-inventory.test.ts +11 -0
- package/src/tests/runner-context-preamble.test.ts +202 -0
- package/src/tests/runner-repo-clone-args.test.ts +116 -0
- package/src/tests/scheduler-occurrence.test.ts +60 -9
- package/src/tests/script-connections-mcp.test.ts +6 -3
- package/src/tests/script-connections.test.ts +4 -0
- package/src/tests/scripts-namespaces.test.ts +3 -1
- package/src/tests/secret-scrubber.test.ts +8 -2
- package/src/tests/session-cost-recompute-unit.test.ts +39 -0
- package/src/tests/session-costs-recompute-all-providers.test.ts +6 -3
- package/src/tests/session-route-posture.test.ts +7 -1
- package/src/tests/slack-file-tools-attachments.test.ts +14 -9
- package/src/tests/slack-identity-resolution.test.ts +10 -3
- package/src/tests/slack-inline-output.test.ts +10 -8
- package/src/tests/slack-render-v2.test.ts +9 -4
- package/src/tests/slack-steering.test.ts +8 -2
- package/src/tests/slack-thread-participants.test.ts +11 -1
- package/src/tests/sonnet-5-5-registry.test.ts +4 -0
- package/src/tests/swarm-config-encryption.test.ts +5 -8
- package/src/tests/ui-spec-script-actions-config.test.ts +7 -3
- package/src/tests/workflow-triggers-v2.test.ts +35 -11
- package/src/tools/app-patch.ts +6 -2
- package/src/tools/app-upsert.ts +8 -4
- package/src/tools/defer-task.ts +17 -77
- package/src/tools/kv/kv-get.ts +2 -0
- package/src/tools/kv/kv-list.ts +11 -5
- package/src/tools/kv/kv-set.ts +1 -3
- package/src/tools/repos/update-repo.ts +37 -19
- package/src/tools/schedules/run-schedule-now.ts +21 -1
- package/src/tools/script-apis.ts +9 -4
- package/src/tools/script-common.ts +2 -2
- package/src/tools/script-run.ts +8 -0
- package/src/tools/script-upsert.ts +1 -1
- package/src/tools/slack-download-file.ts +15 -12
- package/src/tools/slack-post.ts +7 -1
- package/src/tools/slack-read.ts +3 -1
- package/src/tools/slack-reply.ts +16 -0
- package/src/tools/slack-start-thread.ts +8 -1
- package/src/tools/slack-upload-file.ts +99 -96
- package/src/tools/swarm-config/set-config.ts +3 -1
- package/src/tools/swarm-x.ts +0 -2
- package/src/tools/utils.ts +3 -0
- package/src/types.ts +8 -2
- package/src/utils/constants.ts +20 -0
- package/src/utils/deferral-time.ts +61 -0
- package/src/utils/request-auth-context.ts +15 -16
- package/src/utils/secret-scrubber.ts +1 -1
- package/src/workflows/engine.ts +6 -11
- package/src/workflows/executors/swarm-script.ts +0 -2
- package/src/workflows/foreach-driver.ts +6 -12
- package/src/workflows/input.ts +24 -1
- package/src/workflows/node-timeout.ts +18 -0
- package/src/workflows/retry-poller.ts +2 -1
- package/src/workflows/triggers.ts +21 -11
- package/src/x/composio.ts +10 -1
- package/templates/skills/apps/SKILL.md +4 -2
- package/templates/skills/apps/content.md +4 -2
- package/templates/skills/code-quality/content.md +4 -4
- package/templates/skills/scheduled-task-resilience/SKILL.md +2 -0
- package/templates/skills/scheduled-task-resilience/content.md +2 -0
- package/templates/skills/swarm-docs/content.md +7 -0
- package/templates/skills/swarm-scripts/SKILL.md +44 -0
- package/templates/skills/swarm-scripts/content.md +44 -0
- package/dist/acp-adapter-tbt61zkm.js +0 -17
- package/dist/cli-b9ygp1kz.js +0 -459
- package/dist/cli-kj0hyr43.js +0 -51
- package/dist/cli-m8f4379k.js +0 -173
- package/dist/core-bwp98v4w.js +0 -42
- package/dist/dsh-adapter-43ygwqn7.js +0 -9
- package/dist/fx-adapter-cr2hq17y.js +0 -20
- package/dist/grok-adapter-ayddnbsc.js +0 -20
- package/dist/handlers-7ghs84x2.js +0 -41
- package/dist/index-dtt0d634.js +0 -44
- package/dist/index-hmszyqkk.js +0 -42
- package/dist/index-j6rm1rtn.js +0 -39
- package/dist/index-rwwhsmjg.js +0 -13
- package/dist/lead-g2j4q39z.js +0 -83
- package/dist/thread-buffer-epx3san4.js +0 -42
- package/dist/worker-09gqn9xy.js +0 -83
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, test } from "bun:test";
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
|
+
import { mkdir, mkdtemp, rm, writeFile } from "node:fs/promises";
|
|
4
|
+
import { tmpdir } from "node:os";
|
|
5
|
+
import { join } from "node:path";
|
|
6
|
+
import { ensureRepoForTask } from "../commands/runner";
|
|
7
|
+
import { CHILD_PROCESS_TEST_BUDGET_MS, expectChildOk, runChild } from "./test-proc";
|
|
8
|
+
|
|
9
|
+
let tempRoot = "";
|
|
10
|
+
|
|
11
|
+
function gitEnv(): Record<string, string | undefined> {
|
|
12
|
+
const env: Record<string, string | undefined> = { ...process.env };
|
|
13
|
+
for (const key of Object.keys(env)) {
|
|
14
|
+
if (key.startsWith("GIT_")) delete env[key];
|
|
15
|
+
}
|
|
16
|
+
return env;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
async function git(cwd: string, args: string[]): Promise<string> {
|
|
20
|
+
const result = await runChild(["git", "-C", cwd, ...args], { env: gitEnv() });
|
|
21
|
+
return expectChildOk(result, `git ${args.join(" ")}`).stdout;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
async function makeUpstream(withFiles: Record<string, string>): Promise<string> {
|
|
25
|
+
const upstream = join(tempRoot, "upstream");
|
|
26
|
+
await mkdir(upstream, { recursive: true });
|
|
27
|
+
await git(upstream, ["init", "-b", "main"]);
|
|
28
|
+
await git(upstream, ["config", "user.email", "test@example.com"]);
|
|
29
|
+
await git(upstream, ["config", "user.name", "Test User"]);
|
|
30
|
+
for (const [name, content] of Object.entries(withFiles)) {
|
|
31
|
+
await mkdir(join(upstream, name, ".."), { recursive: true });
|
|
32
|
+
await writeFile(join(upstream, name), content);
|
|
33
|
+
}
|
|
34
|
+
await git(upstream, ["add", "."]);
|
|
35
|
+
await git(upstream, ["commit", "-m", "initial"]);
|
|
36
|
+
return upstream;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
describe("repo clone arguments and hook install", () => {
|
|
40
|
+
beforeEach(async () => {
|
|
41
|
+
tempRoot = await mkdtemp(join(tmpdir(), "swarm-runner-clone-args-"));
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
afterEach(async () => {
|
|
45
|
+
if (tempRoot) await rm(tempRoot, { recursive: true, force: true });
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
test(
|
|
49
|
+
"refuses a url or clonePath that starts with a dash and still clones a normal repo",
|
|
50
|
+
async () => {
|
|
51
|
+
const upstream = await makeUpstream({ "README.md": "hello\n" });
|
|
52
|
+
|
|
53
|
+
const badUrl = await ensureRepoForTask(
|
|
54
|
+
{
|
|
55
|
+
url: "--upload-pack=touch",
|
|
56
|
+
name: "bad",
|
|
57
|
+
clonePath: join(tempRoot, "bad"),
|
|
58
|
+
defaultBranch: "main",
|
|
59
|
+
},
|
|
60
|
+
"test",
|
|
61
|
+
);
|
|
62
|
+
expect(badUrl.warning).toContain('must not start with "-"');
|
|
63
|
+
expect(badUrl.clonePath).toBe("");
|
|
64
|
+
|
|
65
|
+
const badPath = await ensureRepoForTask(
|
|
66
|
+
{ url: upstream, name: "bad", clonePath: "--template=x", defaultBranch: "main" },
|
|
67
|
+
"test",
|
|
68
|
+
);
|
|
69
|
+
expect(badPath.warning).toContain('must not start with "-"');
|
|
70
|
+
|
|
71
|
+
const clonePath = join(tempRoot, "clone");
|
|
72
|
+
const ok = await ensureRepoForTask(
|
|
73
|
+
{ url: upstream, name: "ok", clonePath, defaultBranch: "main" },
|
|
74
|
+
"test",
|
|
75
|
+
);
|
|
76
|
+
expect(ok.warning).toBeNull();
|
|
77
|
+
expect(ok.clonePath).toBe(clonePath);
|
|
78
|
+
expect(existsSync(join(clonePath, "README.md"))).toBe(true);
|
|
79
|
+
},
|
|
80
|
+
CHILD_PROCESS_TEST_BUDGET_MS,
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
test(
|
|
84
|
+
"installs Husky hooks without running lifecycle scripts",
|
|
85
|
+
async () => {
|
|
86
|
+
const marker = join(tempRoot, "lifecycle-ran");
|
|
87
|
+
const upstream = await makeUpstream({
|
|
88
|
+
".husky/pre-commit": "echo pre-commit\n",
|
|
89
|
+
"fake-husky/package.json": JSON.stringify({
|
|
90
|
+
name: "husky",
|
|
91
|
+
version: "9.0.0",
|
|
92
|
+
bin: { husky: "bin.sh" },
|
|
93
|
+
scripts: { install: `touch ${marker}` },
|
|
94
|
+
}),
|
|
95
|
+
"fake-husky/bin.sh": "#!/bin/sh\ngit config core.hooksPath .husky/_\n",
|
|
96
|
+
"package.json": JSON.stringify({
|
|
97
|
+
name: "fixture",
|
|
98
|
+
version: "1.0.0",
|
|
99
|
+
scripts: { prepare: `touch ${marker}`, postinstall: `touch ${marker}` },
|
|
100
|
+
devDependencies: { husky: "file:./fake-husky" },
|
|
101
|
+
}),
|
|
102
|
+
});
|
|
103
|
+
await runChild(["chmod", "+x", join(upstream, "fake-husky/bin.sh")]);
|
|
104
|
+
|
|
105
|
+
const result = await runChild(
|
|
106
|
+
["bash", join(process.cwd(), "scripts/install-repo-hooks.sh"), upstream, "fixture"],
|
|
107
|
+
{ env: { ...gitEnv(), npm_config_offline: "true", npm_config_audit: "false" } },
|
|
108
|
+
);
|
|
109
|
+
expectChildOk(result, "install-repo-hooks.sh");
|
|
110
|
+
|
|
111
|
+
expect(existsSync(marker)).toBe(false);
|
|
112
|
+
expect((await git(upstream, ["config", "--get", "core.hooksPath"])).trim()).toBe(".husky/_");
|
|
113
|
+
},
|
|
114
|
+
CHILD_PROCESS_TEST_BUDGET_MS,
|
|
115
|
+
);
|
|
116
|
+
});
|
|
@@ -322,26 +322,77 @@ test("a rejected recovery still starts polling", async () => {
|
|
|
322
322
|
}
|
|
323
323
|
});
|
|
324
324
|
|
|
325
|
-
test(
|
|
326
|
-
|
|
325
|
+
test.each([
|
|
326
|
+
["recovery after stop", "recovery", false],
|
|
327
|
+
["polling after stop", "polling", false],
|
|
328
|
+
["recovery after stop and restart", "recovery", true],
|
|
329
|
+
["polling after stop and restart", "polling", true],
|
|
330
|
+
] as const)("%s leaves the rest of the old batch due", async (_label, phase, restart) => {
|
|
331
|
+
const first = await dueSchedule("one_time", true);
|
|
332
|
+
const second = await dueSchedule("one_time", true);
|
|
333
|
+
const batchFinished = Promise.withResolvers<void>();
|
|
334
|
+
const snapshot = [first, second];
|
|
335
|
+
// Observe both exhaustion and early exit without waiting on a timer.
|
|
336
|
+
Object.assign(snapshot, {
|
|
337
|
+
*[Symbol.iterator]() {
|
|
338
|
+
try {
|
|
339
|
+
yield* snapshot.values();
|
|
340
|
+
} finally {
|
|
341
|
+
batchFinished.resolve();
|
|
342
|
+
}
|
|
343
|
+
},
|
|
344
|
+
});
|
|
345
|
+
|
|
327
346
|
const release = Promise.withResolvers<void>();
|
|
328
|
-
|
|
329
|
-
scriptDispatch.mockImplementation(async () => {
|
|
347
|
+
scriptDispatch.mockImplementationOnce(async () => {
|
|
330
348
|
await release.promise;
|
|
331
|
-
finished.resolve();
|
|
332
349
|
return scriptSuccess;
|
|
333
350
|
});
|
|
351
|
+
const getDue = db.getDueScheduledTasks;
|
|
352
|
+
const due = spyOn(db, "getDueScheduledTasks");
|
|
353
|
+
if (phase === "polling") due.mockResolvedValueOnce([]);
|
|
354
|
+
due.mockResolvedValueOnce(snapshot);
|
|
355
|
+
|
|
356
|
+
const restartReading = Promise.withResolvers<void>();
|
|
357
|
+
const releaseRestart = Promise.withResolvers<void>();
|
|
334
358
|
const timers = spyOn(globalThis, "setInterval");
|
|
335
359
|
try {
|
|
336
|
-
startScheduler(new ExecutorRegistry(),
|
|
360
|
+
startScheduler(new ExecutorRegistry(), 60_000);
|
|
337
361
|
await waitUntil(() => scriptDispatch.mock.calls.length === 1);
|
|
338
362
|
stopScheduler();
|
|
363
|
+
|
|
364
|
+
if (restart) {
|
|
365
|
+
// Hold the new recovery read so that any second claim must come from the old batch.
|
|
366
|
+
due.mockImplementationOnce(async () => {
|
|
367
|
+
restartReading.resolve();
|
|
368
|
+
await releaseRestart.promise;
|
|
369
|
+
return getDue();
|
|
370
|
+
});
|
|
371
|
+
startScheduler(new ExecutorRegistry(), 60_001);
|
|
372
|
+
await restartReading.promise;
|
|
373
|
+
}
|
|
374
|
+
|
|
339
375
|
release.resolve();
|
|
340
|
-
await
|
|
341
|
-
|
|
342
|
-
expect(
|
|
376
|
+
await batchFinished.promise;
|
|
377
|
+
expect(scriptDispatch).toHaveBeenCalledTimes(1);
|
|
378
|
+
expect((await db.getScheduledTaskById(first.id))?.enabled).toBe(false);
|
|
379
|
+
expect(await db.getScheduledTaskById(second.id)).toEqual(second);
|
|
380
|
+
expect(timers.mock.calls.filter((call) => call[1] === 60_000)).toHaveLength(
|
|
381
|
+
phase === "polling" ? 1 : 0,
|
|
382
|
+
);
|
|
383
|
+
|
|
384
|
+
if (restart) {
|
|
385
|
+
releaseRestart.resolve();
|
|
386
|
+
// The new timer is installed only after recovery consumes the second occurrence.
|
|
387
|
+
await waitUntil(() => timers.mock.calls.some((call) => call[1] === 60_001));
|
|
388
|
+
expect(scriptDispatch).toHaveBeenCalledTimes(2);
|
|
389
|
+
expect((await db.getScheduledTaskById(second.id))?.enabled).toBe(false);
|
|
390
|
+
}
|
|
343
391
|
} finally {
|
|
392
|
+
stopScheduler();
|
|
344
393
|
release.resolve();
|
|
394
|
+
releaseRestart.resolve();
|
|
395
|
+
due.mockRestore();
|
|
345
396
|
timers.mockRestore();
|
|
346
397
|
}
|
|
347
398
|
});
|
|
@@ -487,9 +487,12 @@ describe("script MCP connections", () => {
|
|
|
487
487
|
result?: { content: Array<{ type: string; text?: string }> };
|
|
488
488
|
};
|
|
489
489
|
expect(body.ok).toBe(true);
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
)
|
|
490
|
+
// The header reaches the server; its echo comes back redacted.
|
|
491
|
+
expect(fake.requests.some((request) => request.secretHeader === SECRET_VALUE)).toBe(true);
|
|
492
|
+
const echoed = JSON.parse(body.result?.content[0]?.text ?? "{}") as Record<string, string>;
|
|
493
|
+
expect(echoed.echo).toBe("hello");
|
|
494
|
+
expect(echoed.secret).toContain("[REDACTED");
|
|
495
|
+
expect(JSON.stringify(body)).not.toContain(SECRET_VALUE);
|
|
493
496
|
expect(fake.requests.some((request) => request.method === "tools/call")).toBe(true);
|
|
494
497
|
|
|
495
498
|
const unauthenticated = await dispatchProxyApi(
|
|
@@ -730,6 +730,10 @@ describe("script connections", () => {
|
|
|
730
730
|
markMigrationApplied(database, "341_user_token_expiry.sql");
|
|
731
731
|
// 342 alters script_runs, which this migration-112-only fixture does not create.
|
|
732
732
|
markMigrationApplied(database, "342_script_run_sources.sql");
|
|
733
|
+
// 354 alters session_tokens and script_runs, which this fixture does not create.
|
|
734
|
+
markMigrationApplied(database, "354_durable_objects.sql");
|
|
735
|
+
// 362 rebuilds user_favorites, which this fixture does not create (see 301).
|
|
736
|
+
markMigrationApplied(database, "362_favorites_app.sql");
|
|
733
737
|
|
|
734
738
|
const id = crypto.randomUUID();
|
|
735
739
|
const now = new Date().toISOString();
|
|
@@ -86,6 +86,7 @@ describe("native ctx namespaces", () => {
|
|
|
86
86
|
[
|
|
87
87
|
...Object.keys(SDK_NAMESPACES),
|
|
88
88
|
"api",
|
|
89
|
+
"caller",
|
|
89
90
|
"fs",
|
|
90
91
|
"logger",
|
|
91
92
|
"mcp",
|
|
@@ -125,7 +126,7 @@ describe("quickjs ctx namespaces", () => {
|
|
|
125
126
|
};`);
|
|
126
127
|
expect(output.error).toBeUndefined();
|
|
127
128
|
expect(output.result).toEqual({
|
|
128
|
-
keys: ["api", "app", "fs", "kv", "logger", "mcp", "sh", "stdlib", "swarm"],
|
|
129
|
+
keys: ["api", "app", "caller", "fs", "kv", "logger", "mcp", "sh", "stdlib", "swarm"],
|
|
129
130
|
frozen: true,
|
|
130
131
|
list: { entries: [{ key: "a" }], total: 1 },
|
|
131
132
|
apps: { message: "1 app", apps: [{ id: "x" }] },
|
|
@@ -163,6 +164,7 @@ describe("quickjs ctx namespaces", () => {
|
|
|
163
164
|
[
|
|
164
165
|
...Object.keys(SDK_NAMESPACES),
|
|
165
166
|
"api",
|
|
167
|
+
"caller",
|
|
166
168
|
"fs",
|
|
167
169
|
"logger",
|
|
168
170
|
"mcp",
|
|
@@ -118,8 +118,14 @@ describe("scrubSecrets — env-based replacement", () => {
|
|
|
118
118
|
version: SCRUBBER_RULES_VERSION,
|
|
119
119
|
keyVars: [...openAICompatibleKeyVars()].sort(),
|
|
120
120
|
}).toEqual({
|
|
121
|
-
version:
|
|
122
|
-
keyVars: [
|
|
121
|
+
version: 16,
|
|
122
|
+
keyVars: [
|
|
123
|
+
"AI_GATEWAY_API_KEY",
|
|
124
|
+
"HELMCODE_API_KEY",
|
|
125
|
+
"HELMCODE_API_NAN",
|
|
126
|
+
"NAN_API_KEY",
|
|
127
|
+
"ZAI_API_KEY",
|
|
128
|
+
],
|
|
123
129
|
});
|
|
124
130
|
});
|
|
125
131
|
|
|
@@ -98,6 +98,45 @@ describe("recomputeSessionCost — pure branch behavior", () => {
|
|
|
98
98
|
);
|
|
99
99
|
expect(openai.totalCostUsd).toBe((600 * 2 + 400 * 0.2) / 1_000_000);
|
|
100
100
|
|
|
101
|
+
// On an OpenAI API key codex also reports cache writes, and they are inside
|
|
102
|
+
// input too: a real gpt-5.6-terra session had input 385,142 = 341,438 read +
|
|
103
|
+
// 43,674 written + 30 uncached. Written tokens bill once, at cache_write.
|
|
104
|
+
const codexRates = lookupFrom({
|
|
105
|
+
"codex:m:input": 2,
|
|
106
|
+
"codex:m:output": 12,
|
|
107
|
+
"codex:m:cached_input": 0.2,
|
|
108
|
+
"codex:m:cache_write": 2.5,
|
|
109
|
+
});
|
|
110
|
+
const written = await recomputeSessionCost(
|
|
111
|
+
{
|
|
112
|
+
...BASE,
|
|
113
|
+
model: "m",
|
|
114
|
+
provider: "codex",
|
|
115
|
+
inputTokens: 385_142,
|
|
116
|
+
cacheReadTokens: 341_438,
|
|
117
|
+
cacheWriteTokens: 43_674,
|
|
118
|
+
outputTokens: 2_037,
|
|
119
|
+
},
|
|
120
|
+
codexRates,
|
|
121
|
+
);
|
|
122
|
+
expect(written.totalCostUsd).toBeCloseTo(
|
|
123
|
+
(30 * 2 + 341_438 * 0.2 + 43_674 * 2.5 + 2_037 * 12) / 1_000_000,
|
|
124
|
+
12,
|
|
125
|
+
);
|
|
126
|
+
// Reads + writes above input clamp the uncached part at zero.
|
|
127
|
+
const clamped = await recomputeSessionCost(
|
|
128
|
+
{
|
|
129
|
+
...BASE,
|
|
130
|
+
model: "m",
|
|
131
|
+
provider: "codex",
|
|
132
|
+
inputTokens: 1_000,
|
|
133
|
+
cacheReadTokens: 800,
|
|
134
|
+
cacheWriteTokens: 300,
|
|
135
|
+
},
|
|
136
|
+
codexRates,
|
|
137
|
+
);
|
|
138
|
+
expect(clamped.totalCostUsd).toBeCloseTo((800 * 0.2 + 300 * 2.5) / 1_000_000, 12);
|
|
139
|
+
|
|
101
140
|
// Opencode reports input disjoint from cache reads (prod-verified:
|
|
102
141
|
// input < cacheRead on every cached message) — no subtraction.
|
|
103
142
|
const opencode = await recomputeSessionCost(
|
|
@@ -179,8 +179,11 @@ describe("Phase 2 — POST /api/session-costs recompute fires for every provider
|
|
|
179
179
|
expect(res.status).toBe(201);
|
|
180
180
|
const body = (await res.json()) as CostResponse;
|
|
181
181
|
expect(body.cost.costSource).toBe("pricing-table");
|
|
182
|
-
// 1M @ 2 + 0.5M @ 10 = $2 + $5 = $7
|
|
183
|
-
|
|
182
|
+
// 1M @ 2 + 0.5M @ 10 = $2 + $5 = $7. Codex input already holds the 100
|
|
183
|
+
// cache-write tokens; they bill at the (zero) cache_write rate instead.
|
|
184
|
+
const billedInputTokens = provider === "codex" ? 1_000_000 - 100 : 1_000_000;
|
|
185
|
+
const expectedCostUsd = (billedInputTokens * 2 + 500_000 * 10) / 1_000_000;
|
|
186
|
+
expect(body.cost.totalCostUsd).toBeCloseTo(expectedCostUsd, 5);
|
|
184
187
|
expect(body.cost.harnessCostUsd).toBe(999.99);
|
|
185
188
|
expect(body.cost.cacheWrite5mTokens).toBe(25);
|
|
186
189
|
expect(body.cost.cacheWrite1hTokens).toBe(75);
|
|
@@ -192,7 +195,7 @@ describe("Phase 2 — POST /api/session-costs recompute fires for every provider
|
|
|
192
195
|
cacheReadTokens: 0,
|
|
193
196
|
cacheWriteTokens: 100,
|
|
194
197
|
harnessCostUsd: 999.99,
|
|
195
|
-
costUsd:
|
|
198
|
+
costUsd: expectedCostUsd,
|
|
196
199
|
},
|
|
197
200
|
]);
|
|
198
201
|
});
|
|
@@ -26,6 +26,7 @@ import { handleActiveSessions } from "../http/active-sessions";
|
|
|
26
26
|
import { handleApiKeys } from "../http/api-keys";
|
|
27
27
|
import { handleApprovalRequests } from "../http/approval-requests";
|
|
28
28
|
import { handleApps } from "../http/apps";
|
|
29
|
+
import { handleComb } from "../http/comb";
|
|
29
30
|
import { handleContext } from "../http/context";
|
|
30
31
|
import { handleCore } from "../http/core";
|
|
31
32
|
import { handleEvents } from "../http/events";
|
|
@@ -72,6 +73,7 @@ const HANDLERS: Handler[] = [
|
|
|
72
73
|
handlePoll,
|
|
73
74
|
handleTasks,
|
|
74
75
|
handleContext,
|
|
76
|
+
handleComb,
|
|
75
77
|
handleSessionData,
|
|
76
78
|
handleEvents,
|
|
77
79
|
handleFs,
|
|
@@ -112,6 +114,7 @@ let writer: { id: string };
|
|
|
112
114
|
let reader: { id: string };
|
|
113
115
|
const tokens = {} as Record<Who, string>;
|
|
114
116
|
let filesDir: string;
|
|
117
|
+
const agentFsUrl = process.env.AGENT_FS_API_URL;
|
|
115
118
|
const multiRuntime = process.env.MULTI_RUNTIME_ENABLED;
|
|
116
119
|
|
|
117
120
|
beforeAll(async () => {
|
|
@@ -119,7 +122,8 @@ beforeAll(async () => {
|
|
|
119
122
|
process.env.MULTI_RUNTIME_ENABLED = "false";
|
|
120
123
|
filesDir = await mkdtemp(join(tmpdir(), "session-posture-"));
|
|
121
124
|
process.env.AGENT_FS_LOCAL_DIR = filesDir;
|
|
122
|
-
|
|
125
|
+
// Enable the Comb route. With no agent-fs credentials, storage still uses the local provider.
|
|
126
|
+
process.env.AGENT_FS_API_URL = "http://agent-fs.invalid";
|
|
123
127
|
delete process.env.API_AGENT_FS_API_KEY;
|
|
124
128
|
delete process.env.AGENT_FS_API_KEY;
|
|
125
129
|
resetFileStorageProvider();
|
|
@@ -141,6 +145,8 @@ beforeAll(async () => {
|
|
|
141
145
|
afterAll(async () => {
|
|
142
146
|
server.closeAllConnections();
|
|
143
147
|
await new Promise<void>((resolve) => server.close(() => resolve()));
|
|
148
|
+
if (agentFsUrl === undefined) delete process.env.AGENT_FS_API_URL;
|
|
149
|
+
else process.env.AGENT_FS_API_URL = agentFsUrl;
|
|
144
150
|
closeDb();
|
|
145
151
|
resetFileStorageProvider();
|
|
146
152
|
if (multiRuntime === undefined) delete process.env.MULTI_RUNTIME_ENABLED;
|
|
@@ -276,17 +276,21 @@ describe("slack-download-file", () => {
|
|
|
276
276
|
expect(await storedBytes(taskId, "by-url.png")).toEqual(PNG);
|
|
277
277
|
});
|
|
278
278
|
|
|
279
|
-
test("without a task it
|
|
279
|
+
test("without a task it refuses a save path outside the download directory", async () => {
|
|
280
280
|
addSlackFile("F0SHOT0001", "screenshot.png", PNG);
|
|
281
281
|
const dir = join(fsDir, "legacy");
|
|
282
|
+
process.env.SLACK_API_URL = host.url.toString();
|
|
283
|
+
try {
|
|
284
|
+
const result = await downloadTool({ fileId: "F0SHOT0001", savePath: `${dir}/` }, extra({}));
|
|
282
285
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
286
|
+
expect(result.isError).toBe(true);
|
|
287
|
+
expect(String(result.structuredContent.message)).toContain(
|
|
288
|
+
"must be inside /workspace/shared/downloads",
|
|
289
|
+
);
|
|
290
|
+
expect(await Bun.file(`${dir}/screenshot.png`).exists()).toBe(false);
|
|
291
|
+
} finally {
|
|
292
|
+
delete process.env.SLACK_API_URL;
|
|
293
|
+
}
|
|
290
294
|
});
|
|
291
295
|
|
|
292
296
|
test("a source-task header for someone else's task falls back instead of attaching there", async () => {
|
|
@@ -297,7 +301,8 @@ describe("slack-download-file", () => {
|
|
|
297
301
|
extra({ "x-source-task-id": othersTaskId }),
|
|
298
302
|
);
|
|
299
303
|
|
|
300
|
-
|
|
304
|
+
// The no-task path runs, and its URL check refuses the local mock host.
|
|
305
|
+
expect(String(result.structuredContent.message)).toContain("not a Slack file URL");
|
|
301
306
|
expect(await getTaskAttachments(othersTaskId)).toEqual([]);
|
|
302
307
|
});
|
|
303
308
|
|
|
@@ -40,6 +40,7 @@ const TEST_DB_PATH = "./test-slack-identity-resolution.sqlite";
|
|
|
40
40
|
interface MockUsersInfoResponse {
|
|
41
41
|
user?: {
|
|
42
42
|
real_name?: string;
|
|
43
|
+
tz?: string;
|
|
43
44
|
profile?: {
|
|
44
45
|
email?: string;
|
|
45
46
|
real_name?: string;
|
|
@@ -143,6 +144,7 @@ describe("resolveSlackUserId — three-step cascade", () => {
|
|
|
143
144
|
U_HUMAN: {
|
|
144
145
|
user: {
|
|
145
146
|
real_name: "Real Human",
|
|
147
|
+
tz: "Asia/Kathmandu",
|
|
146
148
|
profile: { email: "real@example.com", real_name: "Real Human" },
|
|
147
149
|
},
|
|
148
150
|
},
|
|
@@ -154,6 +156,7 @@ describe("resolveSlackUserId — three-step cascade", () => {
|
|
|
154
156
|
});
|
|
155
157
|
|
|
156
158
|
expect(userId).toBeDefined();
|
|
159
|
+
expect((await findUserByExternalId("slack", "U_HUMAN"))?.timezone).toBe("Asia/Kathmandu");
|
|
157
160
|
expect(await countUsers()).toBe(1);
|
|
158
161
|
|
|
159
162
|
const ext = await externalIdRows();
|
|
@@ -257,14 +260,17 @@ describe("resolveSlackUserId — three-step cascade", () => {
|
|
|
257
260
|
test("auto-link merges into an existing user by email", async () => {
|
|
258
261
|
const { client } = makeMockClient({
|
|
259
262
|
U_HUMAN: {
|
|
260
|
-
user: {
|
|
263
|
+
user: {
|
|
264
|
+
tz: "Asia/Kathmandu",
|
|
265
|
+
profile: { email: "shared@example.com", real_name: "Shared Email Human" },
|
|
266
|
+
},
|
|
261
267
|
},
|
|
262
268
|
});
|
|
263
269
|
|
|
264
270
|
// Seed an existing user with the same email — no slack alias yet.
|
|
265
271
|
await getDbClient().run(
|
|
266
|
-
`INSERT INTO users (id, name, email, emailAliases, status, createdAt, lastUpdatedAt)
|
|
267
|
-
VALUES (?, ?, ?, ?, 'active', ?, ?)`,
|
|
272
|
+
`INSERT INTO users (id, name, email, emailAliases, timezone, status, createdAt, lastUpdatedAt)
|
|
273
|
+
VALUES (?, ?, ?, ?, 'America/Chicago', 'active', ?, ?)`,
|
|
268
274
|
[
|
|
269
275
|
"existing-id",
|
|
270
276
|
"Pre-existing",
|
|
@@ -282,6 +288,7 @@ describe("resolveSlackUserId — three-step cascade", () => {
|
|
|
282
288
|
|
|
283
289
|
// Auto-merge: cascade lands on the existing row, no new `users` insert.
|
|
284
290
|
expect(userId).toBe("existing-id");
|
|
291
|
+
expect((await findUserByExternalId("slack", "U_HUMAN"))?.timezone).toBe("America/Chicago");
|
|
285
292
|
expect(await countUsers()).toBe(1);
|
|
286
293
|
|
|
287
294
|
// One slack alias linked to the pre-existing user.
|
|
@@ -64,19 +64,21 @@ describe("Slack inline completion output", () => {
|
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
66
|
|
|
67
|
-
test("posts only truncated completed Slack output that has not already been replied", () => {
|
|
67
|
+
test("posts only truncated completed Slack output that has not already been replied", async () => {
|
|
68
68
|
const longOutput = `Here is the answer. ${"Detailed finding ".repeat(20)}`;
|
|
69
|
-
expect(shouldPostInlineCompletionOutput(task({ output: longOutput }))).toBe(true);
|
|
69
|
+
expect(await shouldPostInlineCompletionOutput(task({ output: longOutput }))).toBe(true);
|
|
70
70
|
expect(
|
|
71
|
-
shouldPostInlineCompletionOutput(task({ output: longOutput, slackReplySent: true })),
|
|
71
|
+
await shouldPostInlineCompletionOutput(task({ output: longOutput, slackReplySent: true })),
|
|
72
72
|
).toBe(false);
|
|
73
|
-
expect(shouldPostInlineCompletionOutput(task({ output: "Short answer" }))).toBe(false);
|
|
73
|
+
expect(await shouldPostInlineCompletionOutput(task({ output: "Short answer" }))).toBe(false);
|
|
74
74
|
expect(
|
|
75
|
-
shouldPostInlineCompletionOutput(
|
|
75
|
+
await shouldPostInlineCompletionOutput(
|
|
76
|
+
task({ output: longOutput, slackChannelId: undefined }),
|
|
77
|
+
),
|
|
78
|
+
).toBe(false);
|
|
79
|
+
expect(
|
|
80
|
+
await shouldPostInlineCompletionOutput(task({ output: longOutput, status: "failed" })),
|
|
76
81
|
).toBe(false);
|
|
77
|
-
expect(shouldPostInlineCompletionOutput(task({ output: longOutput, status: "failed" }))).toBe(
|
|
78
|
-
false,
|
|
79
|
-
);
|
|
80
82
|
});
|
|
81
83
|
|
|
82
84
|
test("formats markdown and preserves the full output in Slack-safe section chunks", () => {
|
|
@@ -2788,13 +2788,14 @@ describe("Slack renderer v2", () => {
|
|
|
2788
2788
|
await completeTask(ask.id, "Checking back today at 18:38", {
|
|
2789
2789
|
addTags: ["deferred"],
|
|
2790
2790
|
deferredAt: new Date().toISOString(),
|
|
2791
|
+
deferredUntil: "2030-01-15T03:00:00.000Z",
|
|
2791
2792
|
});
|
|
2792
2793
|
await backdateLastUpdated([ask.id], 20);
|
|
2793
2794
|
calls.length = 0;
|
|
2794
2795
|
await processSlackRenderV2();
|
|
2795
2796
|
|
|
2796
2797
|
const opening = calls.find((call) => call.method === "chat.startStream");
|
|
2797
|
-
expect(opening?.payload.markdown_text).toBe("⏳ Checking back
|
|
2798
|
+
expect(opening?.payload.markdown_text).toBe("⏳ Checking back 01-15 03:00 UTC");
|
|
2798
2799
|
const card = await getSlackOutcomeMessage(ask.id);
|
|
2799
2800
|
expect(card?.finalizedAt).toBeTruthy();
|
|
2800
2801
|
expect(card?.deferralResolvedAt).toBeUndefined();
|
|
@@ -2996,14 +2997,16 @@ describe("Slack renderer v2", () => {
|
|
|
2996
2997
|
await completeTask(ask.id, "Waiting on Researcher — or today at 18:38 at the latest", {
|
|
2997
2998
|
addTags: ["deferred"],
|
|
2998
2999
|
deferredAt: new Date().toISOString(),
|
|
3000
|
+
deferredUntil: "2030-07-15T16:38:00.000Z",
|
|
2999
3001
|
});
|
|
3000
3002
|
await backdateLastUpdated([ask.id], 20);
|
|
3001
3003
|
calls.length = 0;
|
|
3002
3004
|
await processSlackRenderV2();
|
|
3003
3005
|
const card = await getSlackOutcomeMessage(ask.id);
|
|
3004
|
-
// The event-based card names who it waits on; the ceiling time stays out of Slack.
|
|
3005
3006
|
const opening = calls.find((call) => call.method === "chat.startStream");
|
|
3006
|
-
expect(opening?.payload.markdown_text).toBe(
|
|
3007
|
+
expect(opening?.payload.markdown_text).toBe(
|
|
3008
|
+
"⏳ Waiting on Researcher · resumes by 07-15 16:38 UTC",
|
|
3009
|
+
);
|
|
3007
3010
|
expect(JSON.stringify(calls)).not.toContain("at the latest");
|
|
3008
3011
|
|
|
3009
3012
|
const schedule = await createScheduledTask({
|
|
@@ -3731,8 +3734,10 @@ describe("Slack renderer v2 delegation (SLACK_RENDER_V2_DELEGATION)", () => {
|
|
|
3731
3734
|
});
|
|
3732
3735
|
await startTask(ask.id);
|
|
3733
3736
|
|
|
3737
|
+
// A worker-owned follow-up isolates the child-card filter: a Lead
|
|
3738
|
+
// follow-up gets its own outcome card (e2e slack-lead-follow-up-card).
|
|
3734
3739
|
const followUp = await createTaskExtended("[Thread follow-up] wrap up", {
|
|
3735
|
-
agentId:
|
|
3740
|
+
agentId: worker.id,
|
|
3736
3741
|
source: "system",
|
|
3737
3742
|
taskType: "follow-up",
|
|
3738
3743
|
parentTaskId: ask.id,
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
getLatestActiveTaskInThread,
|
|
11
11
|
getLogsByTaskId,
|
|
12
12
|
getSteeringMessagesForTask,
|
|
13
|
+
getUserById,
|
|
13
14
|
initDb,
|
|
14
15
|
startTask,
|
|
15
16
|
} from "../be/db";
|
|
@@ -248,7 +249,10 @@ describe("Slack thread steering", () => {
|
|
|
248
249
|
info: async ({ user }: { user: string }) => {
|
|
249
250
|
infoUsers.push(user);
|
|
250
251
|
return {
|
|
251
|
-
user: {
|
|
252
|
+
user: {
|
|
253
|
+
tz: user === "U_OTHER_STEER" ? "Asia/Tokyo" : undefined,
|
|
254
|
+
profile: user === "U_TARAS_STEER" ? { email: taras.email } : {},
|
|
255
|
+
},
|
|
252
256
|
};
|
|
253
257
|
},
|
|
254
258
|
},
|
|
@@ -290,7 +294,9 @@ describe("Slack thread steering", () => {
|
|
|
290
294
|
senderLabel: label,
|
|
291
295
|
});
|
|
292
296
|
}
|
|
293
|
-
|
|
297
|
+
// The already-linked sender has no saved timezone and Slack withholds their email.
|
|
298
|
+
expect(infoUsers).toEqual(["U_TARAS_STEER", "U_OTHER_STEER", "U_UNKNOWN_STEER"]);
|
|
299
|
+
expect((await getUserById(other.id))?.timezone).toBe("Asia/Tokyo");
|
|
294
300
|
expect(
|
|
295
301
|
(await getLogsByTaskId(task.id)).filter((log) => log.newValue === "slack_reaction"),
|
|
296
302
|
).toHaveLength(5);
|
|
@@ -22,7 +22,7 @@ const ACTOR = { kind: "system", id: "test" } as const;
|
|
|
22
22
|
let threadMessages: Array<Record<string, unknown>> = [];
|
|
23
23
|
const emails = new Map<string, string>();
|
|
24
24
|
const userTeams = new Map<string, { team_id: string; enterprise_user?: object }>();
|
|
25
|
-
const ourTeam = { ok: true, team_id: "T0OURS" } as Record<string, unknown>;
|
|
25
|
+
const ourTeam = { ok: true, team_id: "T0OURS", bot_id: "B1" } as Record<string, unknown>;
|
|
26
26
|
let authTest = async (): Promise<Record<string, unknown>> => ourTeam;
|
|
27
27
|
const fakeClient = {
|
|
28
28
|
conversations: { replies: async () => ({ ok: true, messages: threadMessages }) },
|
|
@@ -233,10 +233,14 @@ describe("buildSlackThreadSnapshot", () => {
|
|
|
233
233
|
slackUserId: "U0STARTER",
|
|
234
234
|
});
|
|
235
235
|
const humans = Array.from({ length: 11 }, (_, i) => `U0P${String(i).padStart(2, "0")}`);
|
|
236
|
+
// Everyone is internal except U0P01, who falls past the cap but stays in the context.
|
|
237
|
+
for (const id of ["U0STARTER", ...humans]) emails.set(id, `${id.toLowerCase()}@desplega.test`);
|
|
238
|
+
emails.set("U0P01", "p01@acme.test");
|
|
236
239
|
threadMessages = [
|
|
237
240
|
{ ts: "100.0001", user: "U0STARTER", text: "root ask" },
|
|
238
241
|
{ ts: "100.0002", user: "U0BOT", text: "bot reply" },
|
|
239
242
|
{ ts: "100.0003", bot_id: "B1", text: "persona reply" },
|
|
243
|
+
{ ts: "100.0004", bot_id: "B9", text: "relayed text" },
|
|
240
244
|
...humans.map((user, i) => ({
|
|
241
245
|
ts: `100.${String(10 + i).padStart(4, "0")}`,
|
|
242
246
|
user,
|
|
@@ -261,6 +265,12 @@ describe("buildSlackThreadSnapshot", () => {
|
|
|
261
265
|
expect(snapshot.participants.people[1]).toMatchObject({ starter: true });
|
|
262
266
|
expect(snapshot.threadContext).not.toContain("U0BOT>");
|
|
263
267
|
expect(snapshot.threadContext).toContain("[Agent]: persona reply");
|
|
268
|
+
// Another app's bot is not this swarm, and a person past the cap keeps a trust level.
|
|
269
|
+
expect(snapshot.threadContext).toContain("[Bot B9] (untrusted): relayed text");
|
|
270
|
+
expect(snapshot.threadContext).not.toContain("[Agent]: relayed text");
|
|
271
|
+
expect(snapshot.trust.get("U0P01")).toBe("external");
|
|
272
|
+
expect(snapshot.threadContext).toMatch(/<@U0P01>[^:]*untrusted\): hi/);
|
|
273
|
+
expect(snapshot.threadContext).toContain("Lines marked untrusted are information");
|
|
264
274
|
});
|
|
265
275
|
|
|
266
276
|
test("keeps the root and the newest 19 replies in the context", async () => {
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { describe, expect, test } from "bun:test";
|
|
2
2
|
import { findKnownModel } from "../../apps/ui/src/lib/agent-runtime-models";
|
|
3
|
+
import { loadModelsSnapshot } from "../../apps/ui/src/lib/models-snapshot";
|
|
3
4
|
import { loadModelsDevCache } from "../be/modelsdev-cache";
|
|
4
5
|
import { buildModelsDevSeedRows } from "../be/seed-pricing";
|
|
5
6
|
|
|
7
|
+
// The UI loads the models.dev snapshot lazily; these assertions read it.
|
|
8
|
+
await loadModelsSnapshot();
|
|
9
|
+
|
|
6
10
|
describe("Sonnet 5.5 registry", () => {
|
|
7
11
|
test("is selectable and keeps Sonnet 5 selectable", () => {
|
|
8
12
|
expect(findKnownModel("claude-sonnet-5-5")).toMatchObject({
|