@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
package/dist/cli-b9ygp1kz.js
DELETED
|
@@ -1,459 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createSsrfGuardedFetch,
|
|
3
|
-
init_egress_guard
|
|
4
|
-
} from "./cli-zzq96q57.js";
|
|
5
|
-
import {
|
|
6
|
-
isEnvFlagEnabled,
|
|
7
|
-
init_env_flag
|
|
8
|
-
} from "./cli-cebvbc9t.js";
|
|
9
|
-
import {
|
|
10
|
-
isDevOrTestNodeEnv,
|
|
11
|
-
init_node_env
|
|
12
|
-
} from "./cli-rgeadyvq.js";
|
|
13
|
-
import {
|
|
14
|
-
scrubSecrets,
|
|
15
|
-
registerVolatileSecret,
|
|
16
|
-
init_secret_scrubber
|
|
17
|
-
} from "./cli-1kvcsd2f.js";
|
|
18
|
-
import {
|
|
19
|
-
__esm
|
|
20
|
-
} from "./cli-242037k3.js";
|
|
21
|
-
|
|
22
|
-
// node_modules/oauth4webapi/build/index.js
|
|
23
|
-
function CodedTypeError(message, code, cause) {
|
|
24
|
-
const err = new TypeError(message, { cause });
|
|
25
|
-
Object.assign(err, { code });
|
|
26
|
-
return err;
|
|
27
|
-
}
|
|
28
|
-
function buf(input) {
|
|
29
|
-
if (typeof input === "string") {
|
|
30
|
-
return encoder.encode(input);
|
|
31
|
-
}
|
|
32
|
-
return decoder.decode(input);
|
|
33
|
-
}
|
|
34
|
-
function b64u(input) {
|
|
35
|
-
if (typeof input === "string") {
|
|
36
|
-
return decodeBase64Url(input);
|
|
37
|
-
}
|
|
38
|
-
return encodeBase64Url(input);
|
|
39
|
-
}
|
|
40
|
-
function OPE(message, code, cause) {
|
|
41
|
-
return new OperationProcessingError(message, { code, cause });
|
|
42
|
-
}
|
|
43
|
-
function assertString(input, it, code, cause) {
|
|
44
|
-
try {
|
|
45
|
-
if (typeof input !== "string") {
|
|
46
|
-
throw CodedTypeError(`${it} must be a string`, ERR_INVALID_ARG_TYPE, cause);
|
|
47
|
-
}
|
|
48
|
-
if (input.length === 0) {
|
|
49
|
-
throw CodedTypeError(`${it} must not be empty`, ERR_INVALID_ARG_VALUE, cause);
|
|
50
|
-
}
|
|
51
|
-
} catch (err) {
|
|
52
|
-
if (code) {
|
|
53
|
-
throw OPE(err.message, code, cause);
|
|
54
|
-
}
|
|
55
|
-
throw err;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
function randomBytes() {
|
|
59
|
-
return b64u(crypto.getRandomValues(new Uint8Array(32)));
|
|
60
|
-
}
|
|
61
|
-
function generateRandomCodeVerifier() {
|
|
62
|
-
return randomBytes();
|
|
63
|
-
}
|
|
64
|
-
function generateRandomState() {
|
|
65
|
-
return randomBytes();
|
|
66
|
-
}
|
|
67
|
-
async function calculatePKCECodeChallenge(codeVerifier) {
|
|
68
|
-
assertString(codeVerifier, "codeVerifier");
|
|
69
|
-
return b64u(await crypto.subtle.digest("SHA-256", buf(codeVerifier)));
|
|
70
|
-
}
|
|
71
|
-
var USER_AGENT, ERR_INVALID_ARG_VALUE = "ERR_INVALID_ARG_VALUE", ERR_INVALID_ARG_TYPE = "ERR_INVALID_ARG_TYPE", allowInsecureRequests, clockSkew, clockTolerance, customFetch, modifyAssertion, jweDecrypt, jwksCache, encoder, decoder, encodeBase64Url, decodeBase64Url, OperationProcessingError, URLParse, tokenMatch = "[a-zA-Z0-9!#$%&\\'\\*\\+\\-\\.\\^_`\\|~]+", token68Match = "[a-zA-Z0-9\\-\\._\\~\\+\\/]+={0,2}", quotedMatch = '"((?:[^"\\\\]|\\\\[\\s\\S])*)"', quotedParamMatcher, paramMatcher, schemeRE, quotedParamRE, unquotedParamRE, token68ParamRE, skipSubjectCheck, idTokenClaims, jwtRefs, branded, nopkce, expectNoNonce, skipAuthTimeCheck, skipStateCheck, expectNoState, _nodiscoverycheck, _expectedIssuer;
|
|
72
|
-
var init_build = __esm(() => {
|
|
73
|
-
if (typeof navigator === "undefined" || !navigator.userAgent?.startsWith?.("Mozilla/5.0 ")) {
|
|
74
|
-
const NAME = "oauth4webapi";
|
|
75
|
-
const VERSION = "v3.8.5";
|
|
76
|
-
USER_AGENT = `${NAME}/${VERSION}`;
|
|
77
|
-
}
|
|
78
|
-
allowInsecureRequests = Symbol();
|
|
79
|
-
clockSkew = Symbol();
|
|
80
|
-
clockTolerance = Symbol();
|
|
81
|
-
customFetch = Symbol();
|
|
82
|
-
modifyAssertion = Symbol();
|
|
83
|
-
jweDecrypt = Symbol();
|
|
84
|
-
jwksCache = Symbol();
|
|
85
|
-
encoder = new TextEncoder;
|
|
86
|
-
decoder = new TextDecoder;
|
|
87
|
-
if (Uint8Array.prototype.toBase64) {
|
|
88
|
-
encodeBase64Url = (input) => {
|
|
89
|
-
if (input instanceof ArrayBuffer) {
|
|
90
|
-
input = new Uint8Array(input);
|
|
91
|
-
}
|
|
92
|
-
return input.toBase64({ alphabet: "base64url", omitPadding: true });
|
|
93
|
-
};
|
|
94
|
-
} else {
|
|
95
|
-
const CHUNK_SIZE = 32768;
|
|
96
|
-
encodeBase64Url = (input) => {
|
|
97
|
-
if (input instanceof ArrayBuffer) {
|
|
98
|
-
input = new Uint8Array(input);
|
|
99
|
-
}
|
|
100
|
-
const arr = [];
|
|
101
|
-
for (let i = 0;i < input.byteLength; i += CHUNK_SIZE) {
|
|
102
|
-
arr.push(String.fromCharCode.apply(null, input.subarray(i, i + CHUNK_SIZE)));
|
|
103
|
-
}
|
|
104
|
-
return btoa(arr.join("")).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
if (Uint8Array.fromBase64) {
|
|
108
|
-
decodeBase64Url = (input) => {
|
|
109
|
-
try {
|
|
110
|
-
return Uint8Array.fromBase64(input, { alphabet: "base64url" });
|
|
111
|
-
} catch (cause) {
|
|
112
|
-
throw CodedTypeError("The input to be decoded is not correctly encoded.", ERR_INVALID_ARG_VALUE, cause);
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
} else {
|
|
116
|
-
decodeBase64Url = (input) => {
|
|
117
|
-
try {
|
|
118
|
-
const binary = atob(input.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, ""));
|
|
119
|
-
const bytes = new Uint8Array(binary.length);
|
|
120
|
-
for (let i = 0;i < binary.length; i++) {
|
|
121
|
-
bytes[i] = binary.charCodeAt(i);
|
|
122
|
-
}
|
|
123
|
-
return bytes;
|
|
124
|
-
} catch (cause) {
|
|
125
|
-
throw CodedTypeError("The input to be decoded is not correctly encoded.", ERR_INVALID_ARG_VALUE, cause);
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
OperationProcessingError = class OperationProcessingError extends Error {
|
|
130
|
-
code;
|
|
131
|
-
constructor(message, options) {
|
|
132
|
-
super(message, options);
|
|
133
|
-
this.name = this.constructor.name;
|
|
134
|
-
if (options?.code) {
|
|
135
|
-
this.code = options?.code;
|
|
136
|
-
}
|
|
137
|
-
Error.captureStackTrace?.(this, this.constructor);
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
|
-
URLParse = URL.parse ? (url, base) => URL.parse(url, base) : (url, base) => {
|
|
141
|
-
try {
|
|
142
|
-
return new URL(url, base);
|
|
143
|
-
} catch {
|
|
144
|
-
return null;
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
quotedParamMatcher = "(" + tokenMatch + ")\\s*=\\s*" + quotedMatch;
|
|
148
|
-
paramMatcher = "(" + tokenMatch + ")\\s*=\\s*(" + tokenMatch + ")";
|
|
149
|
-
schemeRE = new RegExp("^[,\\s]*(" + tokenMatch + ")");
|
|
150
|
-
quotedParamRE = new RegExp("^[,\\s]*" + quotedParamMatcher + "[,\\s]*(.*)");
|
|
151
|
-
unquotedParamRE = new RegExp("^[,\\s]*" + paramMatcher + "[,\\s]*(.*)");
|
|
152
|
-
token68ParamRE = new RegExp("^(" + token68Match + ")(?:$|[,\\s])(.*)");
|
|
153
|
-
skipSubjectCheck = Symbol();
|
|
154
|
-
idTokenClaims = new WeakMap;
|
|
155
|
-
jwtRefs = new WeakMap;
|
|
156
|
-
branded = new WeakSet;
|
|
157
|
-
nopkce = Symbol();
|
|
158
|
-
expectNoNonce = Symbol();
|
|
159
|
-
skipAuthTimeCheck = Symbol();
|
|
160
|
-
skipStateCheck = Symbol();
|
|
161
|
-
expectNoState = Symbol();
|
|
162
|
-
_nodiscoverycheck = Symbol();
|
|
163
|
-
_expectedIssuer = Symbol();
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
// src/oauth/mcp-wrapper.ts
|
|
167
|
-
function isInvalidClientError(message) {
|
|
168
|
-
return /invalid_client\b/i.test(message);
|
|
169
|
-
}
|
|
170
|
-
function publicEndpointSsrfOptions() {
|
|
171
|
-
const dev = isDevOrTestNodeEnv() || process.env.ALLOW_PRIVATE_NETWORK_URLS === "true";
|
|
172
|
-
return {
|
|
173
|
-
allowPrivateHosts: dev,
|
|
174
|
-
allowInsecure: dev
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
function mcpOAuthSsrfOptions() {
|
|
178
|
-
return {
|
|
179
|
-
allowPrivateHosts: isEnvFlagEnabled("MCP_OAUTH_ALLOW_PRIVATE_HOSTS", false),
|
|
180
|
-
allowInsecure: isDevOrTestNodeEnv()
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
async function safeFetch(url, init, timeoutMs = DEFAULT_FETCH_TIMEOUT_MS) {
|
|
184
|
-
return createSsrfGuardedFetch(mcpOAuthSsrfOptions())(url, {
|
|
185
|
-
...init,
|
|
186
|
-
signal: init?.signal ?? AbortSignal.timeout(timeoutMs)
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
async function discoverProtectedResourceMetadata(resourceUrl) {
|
|
190
|
-
const base = new URL(resourceUrl);
|
|
191
|
-
const wellKnown = new URL("/.well-known/oauth-protected-resource", base).toString();
|
|
192
|
-
try {
|
|
193
|
-
const res = await safeFetch(wellKnown, {
|
|
194
|
-
headers: { Accept: "application/json" }
|
|
195
|
-
});
|
|
196
|
-
if (res.ok) {
|
|
197
|
-
return await res.json();
|
|
198
|
-
}
|
|
199
|
-
} catch {}
|
|
200
|
-
try {
|
|
201
|
-
const probe = await safeFetch(resourceUrl, { method: "HEAD" });
|
|
202
|
-
const wwwAuth = probe.headers.get("www-authenticate");
|
|
203
|
-
if (wwwAuth) {
|
|
204
|
-
const match = /resource_metadata="([^"]+)"/i.exec(wwwAuth);
|
|
205
|
-
if (match) {
|
|
206
|
-
const metaRes = await safeFetch(match[1], {
|
|
207
|
-
headers: { Accept: "application/json" }
|
|
208
|
-
});
|
|
209
|
-
if (metaRes.ok) {
|
|
210
|
-
return await metaRes.json();
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
} catch {}
|
|
215
|
-
return null;
|
|
216
|
-
}
|
|
217
|
-
async function discoverAuthorizationServerMetadata(issuer) {
|
|
218
|
-
const issuerUrl = new URL(issuer);
|
|
219
|
-
const candidates = [
|
|
220
|
-
new URL("/.well-known/oauth-authorization-server", issuerUrl).toString(),
|
|
221
|
-
new URL("/.well-known/openid-configuration", issuerUrl).toString()
|
|
222
|
-
];
|
|
223
|
-
let lastError = null;
|
|
224
|
-
for (const candidate of candidates) {
|
|
225
|
-
try {
|
|
226
|
-
const res = await safeFetch(candidate, {
|
|
227
|
-
headers: { Accept: "application/json" }
|
|
228
|
-
});
|
|
229
|
-
if (res.ok) {
|
|
230
|
-
return await res.json();
|
|
231
|
-
}
|
|
232
|
-
lastError = new Error(`Metadata fetch ${candidate} → ${res.status}`);
|
|
233
|
-
} catch (err) {
|
|
234
|
-
lastError = err instanceof Error ? err : new Error(String(err));
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
throw lastError ?? new Error(`Authorization server metadata not found at ${issuer}`);
|
|
238
|
-
}
|
|
239
|
-
function normalizeTokenEndpointAuthMethod(value) {
|
|
240
|
-
return KNOWN_TOKEN_ENDPOINT_AUTH_METHODS.includes(value ?? "") ? value : DEFAULT_TOKEN_ENDPOINT_AUTH_METHOD;
|
|
241
|
-
}
|
|
242
|
-
function resolveAdvertisedTokenEndpointAuthMethod(value, source) {
|
|
243
|
-
if (value == null || value === "")
|
|
244
|
-
return DEFAULT_TOKEN_ENDPOINT_AUTH_METHOD;
|
|
245
|
-
if (!KNOWN_TOKEN_ENDPOINT_AUTH_METHODS.includes(value)) {
|
|
246
|
-
throw new UnsupportedTokenEndpointAuthMethodError(value, source);
|
|
247
|
-
}
|
|
248
|
-
return value;
|
|
249
|
-
}
|
|
250
|
-
function authMethodForStoredClient(value) {
|
|
251
|
-
if (value == null || value === "")
|
|
252
|
-
return "client_secret_post";
|
|
253
|
-
return normalizeTokenEndpointAuthMethod(value);
|
|
254
|
-
}
|
|
255
|
-
function selectDcrTokenEndpointAuthMethod(supportedMethods) {
|
|
256
|
-
if (!supportedMethods || supportedMethods.length === 0) {
|
|
257
|
-
return DEFAULT_TOKEN_ENDPOINT_AUTH_METHOD;
|
|
258
|
-
}
|
|
259
|
-
for (const method of KNOWN_TOKEN_ENDPOINT_AUTH_METHODS) {
|
|
260
|
-
if (supportedMethods.includes(method))
|
|
261
|
-
return method;
|
|
262
|
-
}
|
|
263
|
-
throw new UnsupportedTokenEndpointAuthMethodError(supportedMethods.join(", "), "advertises only");
|
|
264
|
-
}
|
|
265
|
-
function formUrlEncodeComponent(value) {
|
|
266
|
-
return new URLSearchParams({ v: value }).toString().slice(2);
|
|
267
|
-
}
|
|
268
|
-
function redactSentCredentials(text, sent) {
|
|
269
|
-
let out = scrubSecrets(text);
|
|
270
|
-
for (const value of sent) {
|
|
271
|
-
if (!value)
|
|
272
|
-
continue;
|
|
273
|
-
for (const shape of new Set([value, formUrlEncodeComponent(value)])) {
|
|
274
|
-
out = out.split(shape).join("[REDACTED]");
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
return out;
|
|
278
|
-
}
|
|
279
|
-
function applyClientAuthentication(method, clientId, clientSecret, body, headers) {
|
|
280
|
-
if (method === "client_secret_basic" && clientSecret) {
|
|
281
|
-
const encodedSecret = formUrlEncodeComponent(clientSecret);
|
|
282
|
-
const credentials = `${formUrlEncodeComponent(clientId)}:${encodedSecret}`;
|
|
283
|
-
const encoded = Buffer.from(credentials).toString("base64");
|
|
284
|
-
registerVolatileSecret(encoded, "mcp_oauth_basic_credential");
|
|
285
|
-
headers.Authorization = `Basic ${encoded}`;
|
|
286
|
-
return [clientSecret, encodedSecret, encoded, credentials];
|
|
287
|
-
}
|
|
288
|
-
body.set("client_id", clientId);
|
|
289
|
-
if (method === "client_secret_post" && clientSecret) {
|
|
290
|
-
body.set("client_secret", clientSecret);
|
|
291
|
-
return [clientSecret, formUrlEncodeComponent(clientSecret)];
|
|
292
|
-
}
|
|
293
|
-
return [];
|
|
294
|
-
}
|
|
295
|
-
async function registerClient(registrationEndpoint, req) {
|
|
296
|
-
const res = await safeFetch(registrationEndpoint, {
|
|
297
|
-
method: "POST",
|
|
298
|
-
headers: {
|
|
299
|
-
"Content-Type": "application/json",
|
|
300
|
-
Accept: "application/json"
|
|
301
|
-
},
|
|
302
|
-
body: JSON.stringify(req)
|
|
303
|
-
});
|
|
304
|
-
if (!res.ok) {
|
|
305
|
-
const body = await res.text().catch(() => "");
|
|
306
|
-
throw new Error(`Dynamic client registration failed (${res.status}): ${body}`);
|
|
307
|
-
}
|
|
308
|
-
return await res.json();
|
|
309
|
-
}
|
|
310
|
-
async function buildAuthorizeUrl(input) {
|
|
311
|
-
const state = input.state ?? generateRandomState();
|
|
312
|
-
const codeVerifier = generateRandomCodeVerifier();
|
|
313
|
-
const codeChallenge = await calculatePKCECodeChallenge(codeVerifier);
|
|
314
|
-
const url = new URL(input.authorizeUrl);
|
|
315
|
-
url.searchParams.set("response_type", "code");
|
|
316
|
-
url.searchParams.set("client_id", input.clientId);
|
|
317
|
-
url.searchParams.set("redirect_uri", input.redirectUri);
|
|
318
|
-
if (input.scopes.length > 0) {
|
|
319
|
-
url.searchParams.set("scope", input.scopes.join(" "));
|
|
320
|
-
}
|
|
321
|
-
url.searchParams.set("state", state);
|
|
322
|
-
url.searchParams.set("code_challenge", codeChallenge);
|
|
323
|
-
url.searchParams.set("code_challenge_method", "S256");
|
|
324
|
-
url.searchParams.set("resource", input.resource);
|
|
325
|
-
if (input.extraParams) {
|
|
326
|
-
const RESERVED = new Set([
|
|
327
|
-
"response_type",
|
|
328
|
-
"client_id",
|
|
329
|
-
"redirect_uri",
|
|
330
|
-
"scope",
|
|
331
|
-
"state",
|
|
332
|
-
"code_challenge",
|
|
333
|
-
"code_challenge_method",
|
|
334
|
-
"resource"
|
|
335
|
-
]);
|
|
336
|
-
for (const [k, v] of Object.entries(input.extraParams)) {
|
|
337
|
-
if (RESERVED.has(k.toLowerCase())) {
|
|
338
|
-
console.warn(`[mcp-oauth] extraParams key "${k}" is reserved and skipped`);
|
|
339
|
-
continue;
|
|
340
|
-
}
|
|
341
|
-
url.searchParams.set(k, v);
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
return { url: url.toString(), state, codeVerifier, codeChallenge };
|
|
345
|
-
}
|
|
346
|
-
async function exchangeCodeForTokens(input) {
|
|
347
|
-
if (input.clientSecret)
|
|
348
|
-
registerVolatileSecret(input.clientSecret, "mcp_oauth_client_secret");
|
|
349
|
-
const method = normalizeTokenEndpointAuthMethod(input.tokenEndpointAuthMethod);
|
|
350
|
-
const body = new URLSearchParams({
|
|
351
|
-
grant_type: "authorization_code",
|
|
352
|
-
code: input.code,
|
|
353
|
-
redirect_uri: input.redirectUri,
|
|
354
|
-
code_verifier: input.codeVerifier,
|
|
355
|
-
resource: input.resource
|
|
356
|
-
});
|
|
357
|
-
const headers = {
|
|
358
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
|
359
|
-
Accept: "application/json"
|
|
360
|
-
};
|
|
361
|
-
const sentCredentials = applyClientAuthentication(method, input.clientId, input.clientSecret, body, headers);
|
|
362
|
-
const res = await safeFetch(input.tokenUrl, {
|
|
363
|
-
method: "POST",
|
|
364
|
-
headers,
|
|
365
|
-
body: body.toString()
|
|
366
|
-
});
|
|
367
|
-
if (!res.ok) {
|
|
368
|
-
const text = await res.text().catch(() => "");
|
|
369
|
-
throw new Error(`Token exchange failed (${res.status}): ${redactSentCredentials(text, [
|
|
370
|
-
...sentCredentials,
|
|
371
|
-
input.code,
|
|
372
|
-
input.codeVerifier
|
|
373
|
-
])}`);
|
|
374
|
-
}
|
|
375
|
-
return await res.json();
|
|
376
|
-
}
|
|
377
|
-
async function refreshMcpToken(input) {
|
|
378
|
-
if (input.clientSecret)
|
|
379
|
-
registerVolatileSecret(input.clientSecret, "mcp_oauth_client_secret");
|
|
380
|
-
registerVolatileSecret(input.refreshToken, "mcp_oauth_refresh_token");
|
|
381
|
-
const method = normalizeTokenEndpointAuthMethod(input.tokenEndpointAuthMethod);
|
|
382
|
-
const body = new URLSearchParams({
|
|
383
|
-
grant_type: "refresh_token",
|
|
384
|
-
refresh_token: input.refreshToken,
|
|
385
|
-
resource: input.resource
|
|
386
|
-
});
|
|
387
|
-
if (input.scopes && input.scopes.length > 0)
|
|
388
|
-
body.set("scope", input.scopes.join(" "));
|
|
389
|
-
const headers = {
|
|
390
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
|
391
|
-
Accept: "application/json"
|
|
392
|
-
};
|
|
393
|
-
const sentCredentials = applyClientAuthentication(method, input.clientId, input.clientSecret, body, headers);
|
|
394
|
-
const res = await safeFetch(input.tokenUrl, {
|
|
395
|
-
method: "POST",
|
|
396
|
-
headers,
|
|
397
|
-
body: body.toString()
|
|
398
|
-
});
|
|
399
|
-
if (!res.ok) {
|
|
400
|
-
const text = await res.text().catch(() => "");
|
|
401
|
-
throw new Error(`Token refresh failed (${res.status}): ${redactSentCredentials(text, [
|
|
402
|
-
...sentCredentials,
|
|
403
|
-
input.refreshToken
|
|
404
|
-
])}`);
|
|
405
|
-
}
|
|
406
|
-
return await res.json();
|
|
407
|
-
}
|
|
408
|
-
async function revokeMcpToken(input) {
|
|
409
|
-
if (input.clientSecret)
|
|
410
|
-
registerVolatileSecret(input.clientSecret, "mcp_oauth_client_secret");
|
|
411
|
-
registerVolatileSecret(input.token, "mcp_oauth_revoked_token");
|
|
412
|
-
const method = normalizeTokenEndpointAuthMethod(input.tokenEndpointAuthMethod);
|
|
413
|
-
const body = new URLSearchParams({ token: input.token });
|
|
414
|
-
if (input.tokenTypeHint)
|
|
415
|
-
body.set("token_type_hint", input.tokenTypeHint);
|
|
416
|
-
const headers = {
|
|
417
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
|
418
|
-
Accept: "application/json"
|
|
419
|
-
};
|
|
420
|
-
const sentCredentials = applyClientAuthentication(method, input.clientId, input.clientSecret, body, headers);
|
|
421
|
-
const res = await safeFetch(input.revocationUrl, {
|
|
422
|
-
method: "POST",
|
|
423
|
-
headers,
|
|
424
|
-
body: body.toString()
|
|
425
|
-
});
|
|
426
|
-
if (!res.ok && res.status !== 200 && res.status !== 204) {
|
|
427
|
-
const text = await res.text().catch(() => "");
|
|
428
|
-
throw new Error(`Token revocation failed (${res.status}): ${redactSentCredentials(text, [
|
|
429
|
-
...sentCredentials,
|
|
430
|
-
input.token
|
|
431
|
-
])}`);
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
function computeExpiresAt(expiresInSeconds) {
|
|
435
|
-
if (!expiresInSeconds || expiresInSeconds <= 0)
|
|
436
|
-
return null;
|
|
437
|
-
return new Date(Date.now() + expiresInSeconds * 1000).toISOString();
|
|
438
|
-
}
|
|
439
|
-
var DEFAULT_FETCH_TIMEOUT_MS = 15000, KNOWN_TOKEN_ENDPOINT_AUTH_METHODS, DEFAULT_TOKEN_ENDPOINT_AUTH_METHOD = "client_secret_basic", UnsupportedTokenEndpointAuthMethodError;
|
|
440
|
-
var init_mcp_wrapper = __esm(() => {
|
|
441
|
-
init_build();
|
|
442
|
-
init_egress_guard();
|
|
443
|
-
init_env_flag();
|
|
444
|
-
init_node_env();
|
|
445
|
-
init_secret_scrubber();
|
|
446
|
-
KNOWN_TOKEN_ENDPOINT_AUTH_METHODS = [
|
|
447
|
-
"client_secret_basic",
|
|
448
|
-
"client_secret_post",
|
|
449
|
-
"none"
|
|
450
|
-
];
|
|
451
|
-
UnsupportedTokenEndpointAuthMethodError = class UnsupportedTokenEndpointAuthMethodError extends Error {
|
|
452
|
-
constructor(value, source) {
|
|
453
|
-
super(`Authorization server ${source} token_endpoint_auth_method "${value}", which agent-swarm cannot perform. ` + `Supported methods: ${KNOWN_TOKEN_ENDPOINT_AUTH_METHODS.join(", ")}. ` + `Register a client manually via POST /api/mcp-oauth/:id/manual-client with a supported method.`);
|
|
454
|
-
this.name = "UnsupportedTokenEndpointAuthMethodError";
|
|
455
|
-
}
|
|
456
|
-
};
|
|
457
|
-
});
|
|
458
|
-
|
|
459
|
-
export { generateRandomCodeVerifier, generateRandomState, calculatePKCECodeChallenge, init_build, isInvalidClientError, publicEndpointSsrfOptions, mcpOAuthSsrfOptions, discoverProtectedResourceMetadata, discoverAuthorizationServerMetadata, normalizeTokenEndpointAuthMethod, resolveAdvertisedTokenEndpointAuthMethod, authMethodForStoredClient, selectDcrTokenEndpointAuthMethod, registerClient, buildAuthorizeUrl, exchangeCodeForTokens, refreshMcpToken, revokeMcpToken, computeExpiresAt, init_mcp_wrapper };
|
package/dist/cli-kj0hyr43.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__esm
|
|
3
|
-
} from "./cli-242037k3.js";
|
|
4
|
-
|
|
5
|
-
// src/slack/event-dedup.ts
|
|
6
|
-
function createCache(ttlMs) {
|
|
7
|
-
return {
|
|
8
|
-
ttlMs,
|
|
9
|
-
entries: new Map,
|
|
10
|
-
cleanupTimer: null
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
function cleanup(cache, now) {
|
|
14
|
-
for (const [key, expiresAt] of cache.entries) {
|
|
15
|
-
if (expiresAt <= now) {
|
|
16
|
-
cache.entries.delete(key);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
function ensureCleanupTimer(cache) {
|
|
21
|
-
if (cache.cleanupTimer)
|
|
22
|
-
return;
|
|
23
|
-
cache.cleanupTimer = setInterval(() => {
|
|
24
|
-
cleanup(cache, Date.now());
|
|
25
|
-
}, CLEANUP_INTERVAL_MS);
|
|
26
|
-
if (typeof cache.cleanupTimer === "object" && cache.cleanupTimer && "unref" in cache.cleanupTimer) {
|
|
27
|
-
cache.cleanupTimer.unref();
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
function checkAndInsert(cache, eventId, now) {
|
|
31
|
-
ensureCleanupTimer(cache);
|
|
32
|
-
const existing = cache.entries.get(eventId);
|
|
33
|
-
if (existing !== undefined && existing > now) {
|
|
34
|
-
return true;
|
|
35
|
-
}
|
|
36
|
-
cache.entries.set(eventId, now + cache.ttlMs);
|
|
37
|
-
return false;
|
|
38
|
-
}
|
|
39
|
-
function wasEventSeen(eventId) {
|
|
40
|
-
if (!eventId)
|
|
41
|
-
return false;
|
|
42
|
-
return checkAndInsert(defaultCache, eventId, Date.now());
|
|
43
|
-
}
|
|
44
|
-
var EVENT_DEDUP_TTL_MS, DEFAULT_TTL_MS, CLEANUP_INTERVAL_MS = 60000, defaultCache;
|
|
45
|
-
var init_event_dedup = __esm(() => {
|
|
46
|
-
EVENT_DEDUP_TTL_MS = 25 * 60 * 60 * 1000;
|
|
47
|
-
DEFAULT_TTL_MS = EVENT_DEDUP_TTL_MS;
|
|
48
|
-
defaultCache = createCache(DEFAULT_TTL_MS);
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
export { wasEventSeen, init_event_dedup };
|
package/dist/cli-m8f4379k.js
DELETED
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getKv2,
|
|
3
|
-
upsertKv2,
|
|
4
|
-
init_db4
|
|
5
|
-
} from "./cli-zzq96q57.js";
|
|
6
|
-
import {
|
|
7
|
-
resolveIdentity,
|
|
8
|
-
init_identity,
|
|
9
|
-
recordUnmappedIdentity,
|
|
10
|
-
init_unmapped_identities
|
|
11
|
-
} from "./cli-wzecestt.js";
|
|
12
|
-
import {
|
|
13
|
-
findUserByExternalId,
|
|
14
|
-
findUserByEmail,
|
|
15
|
-
findOrCreateUserByEmail,
|
|
16
|
-
linkIdentity,
|
|
17
|
-
init_users
|
|
18
|
-
} from "./cli-avax5mp9.js";
|
|
19
|
-
import {
|
|
20
|
-
__esm
|
|
21
|
-
} from "./cli-242037k3.js";
|
|
22
|
-
|
|
23
|
-
// src/slack/enrich.ts
|
|
24
|
-
async function enrichSlackUserEmail(client, slackUserId) {
|
|
25
|
-
const cached = await getKv2(ENRICHMENT_NAMESPACE, slackUserId);
|
|
26
|
-
if (cached !== null) {
|
|
27
|
-
const payload = cached.value;
|
|
28
|
-
if (payload?.email) {
|
|
29
|
-
return payload.email;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
let email = null;
|
|
33
|
-
let name = null;
|
|
34
|
-
try {
|
|
35
|
-
const result = await client.users.info({ user: slackUserId });
|
|
36
|
-
email = result.user?.profile?.email ?? null;
|
|
37
|
-
name = result.user?.profile?.real_name ?? result.user?.real_name ?? null;
|
|
38
|
-
} catch (error) {
|
|
39
|
-
console.error(`[Slack] enrichSlackUserEmail failed for ${slackUserId}:`, error);
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
42
|
-
if (!email) {
|
|
43
|
-
return null;
|
|
44
|
-
}
|
|
45
|
-
await upsertKv2({
|
|
46
|
-
namespace: ENRICHMENT_NAMESPACE,
|
|
47
|
-
key: slackUserId,
|
|
48
|
-
value: {
|
|
49
|
-
email,
|
|
50
|
-
name,
|
|
51
|
-
fetchedAt: new Date().toISOString()
|
|
52
|
-
},
|
|
53
|
-
valueType: "json",
|
|
54
|
-
expiresAt: Date.now() + ENRICHMENT_TTL_MS
|
|
55
|
-
});
|
|
56
|
-
return email;
|
|
57
|
-
}
|
|
58
|
-
function getCompanyEmailDomains() {
|
|
59
|
-
const raw = process.env.COMPANY_EMAIL_DOMAINS?.trim() ? process.env.COMPANY_EMAIL_DOMAINS : process.env.SLACK_ALLOWED_EMAIL_DOMAINS;
|
|
60
|
-
return (raw ?? "").split(",").map((domain) => domain.trim().toLowerCase()).filter(Boolean);
|
|
61
|
-
}
|
|
62
|
-
function isCompanyEmail(email, domains) {
|
|
63
|
-
const domain = email.split("@").pop()?.toLowerCase();
|
|
64
|
-
return !!domain && domains.includes(domain);
|
|
65
|
-
}
|
|
66
|
-
async function resolveSlackParticipant(client, slackUserId, eventContext) {
|
|
67
|
-
const domains = getCompanyEmailDomains();
|
|
68
|
-
const sameTeam = eventContext.userTeam ? await isOurSlackTeam(client, eventContext.userTeam, slackUserId) : undefined;
|
|
69
|
-
const foreignTeam = sameTeam === false;
|
|
70
|
-
let user = await findUserByExternalId("slack", slackUserId);
|
|
71
|
-
const email = user?.email || await enrichSlackUserEmail(client, slackUserId);
|
|
72
|
-
const linkable = !eventContext.userTeam || sameTeam === true;
|
|
73
|
-
if (!user && email && linkable) {
|
|
74
|
-
if (isCompanyEmail(email, domains)) {
|
|
75
|
-
const cached = await getKv2(ENRICHMENT_NAMESPACE, slackUserId);
|
|
76
|
-
const name = cached?.value?.name ?? undefined;
|
|
77
|
-
user = (await findOrCreateUserByEmail(email, { name, role: "member" }, SLACK_WEBHOOK_ACTOR)).user;
|
|
78
|
-
} else {
|
|
79
|
-
user = await findUserByEmail(email);
|
|
80
|
-
}
|
|
81
|
-
if (user) {
|
|
82
|
-
try {
|
|
83
|
-
await linkIdentity(user.id, "slack", slackUserId, SLACK_WEBHOOK_ACTOR);
|
|
84
|
-
} catch (error) {
|
|
85
|
-
console.warn(`[Slack] linkIdentity('slack', ${slackUserId}) failed — likely a concurrent enroll`, error);
|
|
86
|
-
}
|
|
87
|
-
user = await findUserByExternalId("slack", slackUserId) ?? user;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
if (!user && !email) {
|
|
91
|
-
await recordUnmappedIdentity("slack", slackUserId, eventContext);
|
|
92
|
-
}
|
|
93
|
-
const audience = user?.metadata?.audience;
|
|
94
|
-
const trust = audience === "internal" || audience === "external" ? audience : foreignTeam ? "external" : eventContext.userTeam && sameTeam === undefined ? "unknown" : domains.length === 0 ? user ? "internal" : email ? "external" : "unknown" : !email ? "unknown" : isCompanyEmail(email, domains) ? "internal" : "external";
|
|
95
|
-
return { userId: user?.id, trust };
|
|
96
|
-
}
|
|
97
|
-
async function resolveSlackUserId(client, slackUserId, eventContext) {
|
|
98
|
-
return (await resolveSlackParticipant(client, slackUserId, eventContext)).userId;
|
|
99
|
-
}
|
|
100
|
-
async function getOurSlackTeam(client) {
|
|
101
|
-
if (cachedTeam)
|
|
102
|
-
return cachedTeam;
|
|
103
|
-
try {
|
|
104
|
-
const result = await client.auth.test();
|
|
105
|
-
const teamId = result.team_id || undefined;
|
|
106
|
-
const enterpriseId = result.enterprise_id || undefined;
|
|
107
|
-
const orgInstall = result.is_enterprise_install === true || !!enterpriseId && (!teamId || teamId === enterpriseId);
|
|
108
|
-
if (teamId || enterpriseId)
|
|
109
|
-
cachedTeam = { teamId, enterpriseId, orgInstall };
|
|
110
|
-
} catch (error) {
|
|
111
|
-
console.error("[Slack] auth.test failed while reading the team id:", error);
|
|
112
|
-
}
|
|
113
|
-
return cachedTeam;
|
|
114
|
-
}
|
|
115
|
-
async function getSlackUserTeam(client, slackUserId) {
|
|
116
|
-
try {
|
|
117
|
-
const { user } = await client.users.info({ user: slackUserId });
|
|
118
|
-
if (!user)
|
|
119
|
-
return;
|
|
120
|
-
return {
|
|
121
|
-
teamId: user.team_id || undefined,
|
|
122
|
-
enterpriseId: user.enterprise_user?.enterprise_id || undefined
|
|
123
|
-
};
|
|
124
|
-
} catch (error) {
|
|
125
|
-
console.error(`[Slack] users.info failed while reading the team of ${slackUserId}:`, error);
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
async function isOurSlackTeam(client, userTeam, slackUserId) {
|
|
130
|
-
const ours = await getOurSlackTeam(client);
|
|
131
|
-
if (!ours)
|
|
132
|
-
return;
|
|
133
|
-
if (userTeam === ours.teamId)
|
|
134
|
-
return true;
|
|
135
|
-
if (!ours.orgInstall)
|
|
136
|
-
return false;
|
|
137
|
-
const sender = await getSlackUserTeam(client, slackUserId);
|
|
138
|
-
return !!sender?.enterpriseId && sender.enterpriseId === ours.enterpriseId;
|
|
139
|
-
}
|
|
140
|
-
async function rewriteSlackMentions(text, botUserId, trust) {
|
|
141
|
-
const userIds = new Set;
|
|
142
|
-
for (const match of text.matchAll(/<@([A-Z0-9]+)>/g)) {
|
|
143
|
-
const userId = match[1];
|
|
144
|
-
if (userId && userId !== botUserId)
|
|
145
|
-
userIds.add(userId);
|
|
146
|
-
}
|
|
147
|
-
const resolutions = new Map;
|
|
148
|
-
await Promise.all([...userIds].map(async (userId) => {
|
|
149
|
-
resolutions.set(userId, await resolveIdentity("slack", userId));
|
|
150
|
-
}));
|
|
151
|
-
return text.replace(/<@([A-Z0-9]+)>/g, (_match, userId) => {
|
|
152
|
-
if (userId === botUserId)
|
|
153
|
-
return `<@${userId}> (that's you)`;
|
|
154
|
-
const resolution = resolutions.get(userId);
|
|
155
|
-
const level = trust?.get(userId);
|
|
156
|
-
const untrusted = level === "external" || level === "unknown" ? level : undefined;
|
|
157
|
-
if (resolution?.status === "resolved") {
|
|
158
|
-
return untrusted ? `<@${userId}|${resolution.name}> (${untrusted}, untrusted)` : `<@${userId}|${resolution.name}>`;
|
|
159
|
-
}
|
|
160
|
-
return untrusted ? `<@${userId}> (unknown user, untrusted)` : `<@${userId}> (unknown user)`;
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
var ENRICHMENT_NAMESPACE = "integration:user-enrichment:slack", ENRICHMENT_TTL_MS, SLACK_WEBHOOK_ACTOR, cachedTeam;
|
|
164
|
-
var init_enrich = __esm(() => {
|
|
165
|
-
init_db4();
|
|
166
|
-
init_identity();
|
|
167
|
-
init_unmapped_identities();
|
|
168
|
-
init_users();
|
|
169
|
-
ENRICHMENT_TTL_MS = 24 * 60 * 60 * 1000;
|
|
170
|
-
SLACK_WEBHOOK_ACTOR = { kind: "system", id: "webhook:slack" };
|
|
171
|
-
});
|
|
172
|
-
|
|
173
|
-
export { enrichSlackUserEmail, resolveSlackParticipant, resolveSlackUserId, getSlackUserTeam, isOurSlackTeam, rewriteSlackMentions, init_enrich };
|