@desplega.ai/agent-swarm 2.13.2 → 2.13.4
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-mr4temec.js +17 -0
- package/dist/{acp-targets-mz8c5dnt.js → acp-targets-zrk9k0n7.js} +10 -10
- package/dist/{actions-5ft3qp5a.js → actions-acqqj9jn.js} +236 -26
- package/dist/{agent-fs-provision-6fgz7wvz.js → agent-fs-provision-zmaykqnd.js} +4 -4
- package/dist/{amp-adapter-nthn8ezm.js → amp-adapter-a7ts8tmw.js} +3 -3
- package/dist/{app-535m78qw.js → app-tmwa442h.js} +7 -7
- package/dist/{approval-notifications-dewbk403.js → approval-notifications-6psaaaye.js} +8 -8
- package/dist/{assistant-39zyabv2.js → assistant-564v6emv.js} +25 -25
- package/dist/{boot-args-schema-bqv5bf77.js → boot-args-schema-n099e0f2.js} +1 -1
- package/dist/{boot-reembed-fas7z3zn.js → boot-reembed-chx66qfk.js} +1 -1
- package/dist/{boot-reembed-157c0gcz.js → boot-reembed-epvg4fp9.js} +1 -1
- package/dist/{boot-scrub-sweep-tmec0be2.js → boot-scrub-sweep-dhkfp0a7.js} +2 -2
- package/dist/{boot-seeds-32zm50x2.js → boot-seeds-m74fc07r.js} +4 -4
- package/dist/{boxd-hr8rsxzq.js → boxd-451q55ys.js} +1 -1
- package/dist/{claude-adapter-gwq7x2nj.js → claude-adapter-hw63yj3j.js} +12 -9
- package/dist/{claude-managed-adapter-rkvw6fvq.js → claude-managed-adapter-z5s7fx6p.js} +3 -3
- package/dist/{claude-managed-setup-0vgz4d1j.js → claude-managed-setup-wee1762m.js} +3 -3
- package/dist/{claude-sdk-session-5wbwxy8c.js → claude-sdk-session-cktyqkpk.js} +27 -13
- package/dist/{cli-d528acsw.js → cli-0fgvnb0x.js} +7 -7
- package/dist/{cli-2v4xxnx2.js → cli-0h8skzss.js} +1 -1
- package/dist/{cli-jkkcm72j.js → cli-0p76my9q.js} +31 -16
- package/dist/{cli-fp65jdp2.js → cli-1kvcsd2f.js} +219 -155
- package/dist/{cli-gc7jkf4a.js → cli-1vmhnncj.js} +3 -3
- package/dist/{cli-tceqvv6h.js → cli-29h5239w.js} +5 -5
- package/dist/cli-2ap1the6.js +11 -0
- package/dist/{cli-8fj8yfmk.js → cli-2vp0z049.js} +1 -1
- package/dist/{cli-ewb028rs.js → cli-3bxrrh53.js} +4 -4
- package/dist/{cli-nvqq3232.js → cli-3tzmh38q.js} +9 -9
- package/dist/{cli-0xwb7zpt.js → cli-3xqad83h.js} +2 -2
- package/dist/{cli-0f7n3td3.js → cli-3zrwrnz7.js} +1 -1
- package/dist/{cli-2wde56gv.js → cli-404am6f3.js} +7 -7
- package/dist/{cli-r4fphq38.js → cli-49aq3cyn.js} +4 -4
- package/dist/{cli-8qvte9hn.js → cli-4fpa0zns.js} +3 -3
- package/dist/{cli-x5yb8zc8.js → cli-4pbwg7sn.js} +2 -2
- package/dist/{cli-s08zsqva.js → cli-4q2c8rxw.js} +76 -10
- package/dist/{cli-3mf04tkh.js → cli-4vynxtrb.js} +1 -1
- package/dist/{cli-tbdw3f92.js → cli-5ashycw3.js} +3 -3
- package/dist/{cli-c9bwawf9.js → cli-5rgm8p39.js} +3 -3
- package/dist/{cli-g0b3ma7r.js → cli-5rxsb3wq.js} +6 -6
- package/dist/{cli-a6rzw649.js → cli-60dwk8tx.js} +3 -3
- package/dist/{cli-xhkek467.js → cli-7by7vp6m.js} +30 -4
- package/dist/{cli-62fjschk.js → cli-7g3fg4gf.js} +7 -7
- package/dist/{cli-ka13xx6b.js → cli-7gbff32z.js} +2 -2
- package/dist/{cli-q8aq48v1.js → cli-8b4rpnwj.js} +1 -1
- package/dist/{cli-1f48qdnb.js → cli-8cas2xvp.js} +3 -3
- package/dist/{cli-dnvmwsvc.js → cli-904wk98s.js} +799 -371
- package/dist/{cli-m1wddksc.js → cli-93n305hm.js} +2 -2
- package/dist/{cli-31vt7baf.js → cli-944w9wb4.js} +21 -17
- package/dist/{cli-je587f74.js → cli-94gx6ze9.js} +1 -1
- package/dist/{cli-fcwrd7bh.js → cli-9ah37a8a.js} +6 -6
- package/dist/{cli-rfejbpe1.js → cli-akm6y2a8.js} +1 -1
- package/dist/{cli-f8rcvf2x.js → cli-azj9t1f9.js} +37 -2
- package/dist/{cli-mwxez0pz.js → cli-b768ek79.js} +1 -1
- package/dist/{cli-cmgdptmx.js → cli-bv4vvnmg.js} +31 -7
- package/dist/{cli-1gevjrc1.js → cli-bzcwwebm.js} +1 -1
- package/dist/{cli-sjk85d7v.js → cli-cq4am6vg.js} +3 -3
- package/dist/{cli-f1sdh8ca.js → cli-d5pc8ep0.js} +103 -9
- package/dist/{cli-7m6bbtab.js → cli-ea7nz50q.js} +12 -12
- package/dist/{cli-zkbz8m2q.js → cli-fkpnx3vf.js} +1 -1
- package/dist/{cli-ya1cj689.js → cli-fw67mnyc.js} +1 -1
- package/dist/{cli-5basv0e7.js → cli-gkv0r2hq.js} +1 -1
- package/dist/{cli-nkfv398a.js → cli-gse7bp3z.js} +12 -10
- package/dist/{cli-4djg31jh.js → cli-gtj12v95.js} +1 -1
- package/dist/{cli-qn79645p.js → cli-h9d3sdnc.js} +1 -1
- package/dist/{cli-tgmate57.js → cli-hdhpdrka.js} +6 -23
- package/dist/{cli-fgm2mad9.js → cli-hhtbandk.js} +2 -2
- package/dist/cli-hyqksecw.js +1907 -0
- package/dist/{cli-t25rq8mg.js → cli-ja450998.js} +40 -11
- package/dist/{cli-43dsqhcp.js → cli-jbrc98qb.js} +4 -4
- package/dist/{cli-82j36f2m.js → cli-jjzxsk47.js} +9 -3
- package/dist/{cli-xerdrnqs.js → cli-jyhbvdga.js} +3 -3
- package/dist/{cli-t9nxq30h.js → cli-jzerrzgc.js} +8 -8
- package/dist/{cli-hv3820ez.js → cli-k0nebh10.js} +1 -1
- package/dist/{cli-s6fhqbz1.js → cli-ka48vpev.js} +6 -6
- package/dist/{cli-d2epqm0y.js → cli-kezzteka.js} +1 -1
- package/dist/{cli-getrvmtx.js → cli-kj84fqxz.js} +2 -2
- package/dist/{cli-h0ewec3d.js → cli-kr0jpw9c.js} +1 -1
- package/dist/{cli-gq6qhmrr.js → cli-m1sns1da.js} +3 -3
- package/dist/{cli-bp2rt28p.js → cli-n1kjs58m.js} +5 -5
- package/dist/{cli-rvhaahfv.js → cli-nc4pbwmp.js} +9 -9
- package/dist/{cli-d0jb2qnt.js → cli-p3knvk62.js} +74 -47
- package/dist/{cli-50whymxq.js → cli-p436yrzp.js} +2 -2
- package/dist/{cli-cs26ed89.js → cli-phdzn699.js} +8 -8
- package/dist/{cli-b0kqw55g.js → cli-pz1dp12c.js} +1 -1
- package/dist/{cli-8a4qg44m.js → cli-pz1nq5xm.js} +6 -6
- package/dist/{cli-e87fg3en.js → cli-qzz6tz8s.js} +1 -1
- package/dist/{cli-69eq6gdk.js → cli-rmgvwcmy.js} +38 -29
- package/dist/{cli-5k1hvycs.js → cli-rv3y60bt.js} +4 -4
- package/dist/cli-s33bzmk0.js +27 -0
- package/dist/{cli-at67kvnp.js → cli-srktrbby.js} +1 -1
- package/dist/{cli-6rmryz03.js → cli-t0jmkcah.js} +14 -14
- package/dist/{cli-eetzmsy5.js → cli-t9pzz2eq.js} +2 -2
- package/dist/{cli-wdtqkqnq.js → cli-tr19nyn9.js} +4 -4
- package/dist/{cli-erh1rgh4.js → cli-ts5yv7dn.js} +165 -88
- package/dist/{cli-zqy28rwx.js → cli-tsc3pdfd.js} +4 -4
- package/dist/{cli-x7aqhxj5.js → cli-tzw1jr2t.js} +2 -2
- package/dist/{cli-n14r8h4n.js → cli-x2cem5vy.js} +6 -4
- package/dist/{cli-vx9acp12.js → cli-ybte1fqc.js} +1 -1
- package/dist/{cli-xysy1g8x.js → cli-ysv0k1we.js} +2 -2
- package/dist/{cli-vdfngx2g.js → cli-ywy8yz6t.js} +2 -2
- package/dist/{cli-cpkxh68d.js → cli-z1vam71h.js} +2 -2
- package/dist/{cli-zm6bkx3e.js → cli-zexwhj3f.js} +3 -3
- package/dist/{cli-j2ybkdk2.js → cli-zhwjdhjr.js} +2 -2
- package/dist/{cli-gedf48yw.js → cli-zjdhrzm0.js} +8 -8
- package/dist/cli.js +20 -20
- package/dist/{codex-adapter-x25xfbnh.js → codex-adapter-2fs2c0n6.js} +8 -8
- package/dist/{codex-hook-c0nvm30r.js → codex-hook-jxjv6dy5.js} +10 -3
- package/dist/{codex-login-ven5cz5j.js → codex-login-ktfg1cxk.js} +1 -1
- package/dist/{codex-session-runner-kn5xnrvp.js → codex-session-runner-r55tmx4c.js} +9 -9
- package/dist/{commands-8n59gxmy.js → commands-0mxdy9x8.js} +3 -3
- package/dist/{controller-wn3vd217.js → controller-g3vkfhr4.js} +4 -4
- package/dist/{controllers-connect-09gvkrhc.js → controllers-connect-4wdmncqt.js} +25 -25
- package/dist/core-gsvj5f3z.js +42 -0
- package/dist/{cursor-adapter-w1681kp1.js → cursor-adapter-t9qb96q2.js} +2 -2
- package/dist/{db-e71keqxk.js → db-487vvyv9.js} +3 -3
- package/dist/{db-spg81qtr.js → db-76p7w3gr.js} +2 -2
- package/dist/{devin-adapter-fs90ab4v.js → devin-adapter-3bp6rape.js} +1 -1
- package/dist/{dispatcher-fr4vawwb.js → dispatcher-64rp6w67.js} +22 -22
- package/dist/{docker-1h33jvh9.js → docker-a59g3ebm.js} +2 -2
- package/dist/{dsh-adapter-g9yqv09y.js → dsh-adapter-8abzqk5c.js} +2 -2
- package/dist/{e2b-y7e5kmzf.js → e2b-3ykbe805.js} +2 -2
- package/dist/{e2b-jnk0yeva.js → e2b-dc8f6ctq.js} +2 -2
- package/dist/{easter-egg-3d-ac9tv9a6.js → easter-egg-3d-jrrwyf55.js} +1 -1
- package/dist/{embedding-space-an77f45k.js → embedding-space-001hhhpk.js} +6 -6
- package/dist/{embeddings-jkrehejr.js → embeddings-esj19cnw.js} +1 -1
- package/dist/{event-bus-08t2b4y2.js → event-bus-7gbsr0g4.js} +1 -1
- package/dist/{execute-3mys4nta.js → execute-301hkxqg.js} +1 -1
- package/dist/{external-channel-s6zxpts9.js → external-channel-w10e2j05.js} +2 -2
- package/dist/fx-adapter-4sjrbdne.js +20 -0
- package/dist/grok-adapter-3a0ezfee.js +20 -0
- package/dist/handlers-ef3k11hb.js +41 -0
- package/dist/{heartbeat-jjpb44e5.js → heartbeat-tbrj7vhq.js} +25 -25
- package/dist/hook-3am1sq68.js +22 -0
- package/dist/{hook-y6n23zzj.js → hook-tx917rqw.js} +11 -8
- package/dist/{http-8c6y008s.js → http-3rmemtqy.js} +340 -1841
- package/dist/{index-mbpxhc4w.js → index-126v2d0t.js} +1 -4
- package/dist/{index-xcw7hjt5.js → index-2jw11t8s.js} +26 -26
- package/dist/{index-p2f5xg64.js → index-3j803vnb.js} +36259 -34299
- package/dist/{index-we3nd2t0.js → index-aetfyx6p.js} +1 -1
- package/dist/index-e6bq0exk.js +42 -0
- package/dist/{index-0vthtbc2.js → index-gfnq66t1.js} +231 -25
- package/dist/index-hf2k1vge.js +39 -0
- package/dist/{index-6h3r0vpe.js → index-s7xtvc0f.js} +1 -1
- package/dist/index-taxmejj3.js +44 -0
- package/dist/{k8s-8326q0rq.js → k8s-36gfn847.js} +2 -2
- package/dist/{keepalive-7e9r5dvp.js → keepalive-9px3t7qj.js} +5 -5
- package/dist/lead-5vt6f174.js +83 -0
- package/dist/{maintenance-d3erjvcg.js → maintenance-vwqjwst6.js} +1 -1
- package/dist/{oauth-refresh-sweep-0qh70988.js → oauth-refresh-sweep-yqry3wn4.js} +4 -4
- package/dist/{object-webhooks-ac7v2q5p.js → object-webhooks-8s1wtths.js} +7 -7
- package/dist/{onboard-5yphtken.js → onboard-hb8czx0p.js} +7 -7
- package/dist/{opencode-adapter-0xvyba4m.js → opencode-adapter-djd6m6dk.js} +8 -8
- package/dist/{otel-impl-svqp691q.js → otel-impl-2ymwyczz.js} +2 -2
- package/dist/{pending-bn4xe5br.js → pending-nxavtvx7.js} +23 -23
- package/dist/{pi-mono-adapter-763s8a3w.js → pi-mono-adapter-d2cpmcy4.js} +13 -13
- package/dist/{pricing-refresh-kfc215mf.js → pricing-refresh-1yz8jkqv.js} +2 -2
- package/dist/{rbac-roles-6r4h2ghj.js → rbac-roles-7s6m31xw.js} +6 -4
- package/dist/{rbac-roles-3bznvkpt.js → rbac-roles-dbpx0x9v.js} +3 -3
- package/dist/{render-v2-f3qedbpy.js → render-v2-7y20rjrn.js} +7 -7
- package/dist/{resume-vcag4ann.js → resume-wz546x47.js} +10 -10
- package/dist/{runtime-x0s55z2t.js → runtime-cb5bd9tz.js} +1 -1
- package/dist/{session-access-nwzve8q2.js → session-access-4vcft8kq.js} +5 -5
- package/dist/{session-source-backfill-jpqfzmgz.js → session-source-backfill-57b50tpw.js} +3 -3
- package/dist/{setup-d2smwaem.js → setup-e1tevjyj.js} +1 -1
- package/dist/thread-buffer-686pa1p1.js +42 -0
- package/dist/{tree-visibility-dwzc8en0.js → tree-visibility-07wf1nct.js} +2 -2
- package/dist/{user-merge-jobs-4ce7kma2.js → user-merge-jobs-n20qpv6s.js} +3 -3
- package/dist/{virtual-modules-78a6yw71.js → virtual-modules-6fxmn1yv.js} +3 -3
- package/dist/{work-objects-m0w1e7q8.js → work-objects-eg7y48pe.js} +25 -25
- package/dist/worker-4vp616ms.js +83 -0
- package/dist/{worker-follow-up-e3t6f895.js → worker-follow-up-jnvnnf2b.js} +22 -22
- package/dist/{x-asbrnafg.js → x-d27jj7z7.js} +2 -2
- package/openapi.json +478 -28
- package/package.json +3 -3
- package/src/be/db/approvals.ts +2 -0
- package/src/be/db/runtime.ts +5 -0
- package/src/be/db/script-run-sources.ts +17 -0
- package/src/be/db-retention.ts +1 -1
- package/src/be/db.ts +71 -62
- package/src/be/design-system.ts +63 -0
- package/src/be/migrations/342_script_run_sources.sql +20 -0
- package/src/be/migrations/runner.ts +8 -0
- package/src/be/migrations/script-run-sources.ts +51 -0
- package/src/be/rbac-roles.ts +2 -0
- package/src/be/scripts/typecheck.ts +4 -2
- package/src/be/seed-scripts/catalog/design-system-seed.ts +158 -0
- package/src/be/seed-scripts/index.ts +9 -0
- package/src/be/swarm-config-guard.ts +21 -1
- package/src/commands/onboard/agent-fs-version.ts +1 -1
- package/src/commands/runner.ts +62 -6
- package/src/heartbeat/heartbeat.ts +18 -4
- package/src/hooks/codex-hook.ts +15 -4
- package/src/hooks/hook.ts +7 -0
- package/src/http/all-routes.ts +1 -0
- package/src/http/approval-chat-answer.ts +99 -0
- package/src/http/approval-requests.ts +280 -225
- package/src/http/design-system.ts +103 -0
- package/src/http/index.ts +10 -6
- package/src/http/pages-public.ts +25 -10
- package/src/http/pages.ts +17 -0
- package/src/http/person-responder.ts +28 -0
- package/src/http/session-cost-recompute.ts +3 -1
- package/src/http/session-data.ts +3 -0
- package/src/integrations/chat-sdk/adapters.ts +33 -3
- package/src/integrations/chat-sdk/inbound.ts +6 -18
- package/src/integrations/chat-sdk/mentions.ts +188 -0
- package/src/integrations/chat-sdk/outbound.ts +20 -3
- package/src/integrations/chat-sdk/router.ts +8 -0
- package/src/integrations/chat-sdk/telegram-thread.ts +12 -0
- package/src/jira/adf.ts +35 -9
- package/src/kv-reserved-namespaces.ts +5 -0
- package/src/pages/page-head.ts +11 -1
- package/src/prompts/base-prompt.ts +1 -1
- package/src/prompts/session-templates.ts +1 -1
- package/src/providers/acp-targets.ts +2 -2
- package/src/providers/amp-adapter.ts +1 -1
- package/src/providers/claude-adapter.ts +21 -1
- package/src/providers/claude-sdk-session.ts +22 -3
- package/src/providers/claude-session-events.ts +76 -1
- package/src/providers/cursor-adapter.ts +1 -1
- package/src/providers/dsh-adapter.ts +48 -13
- package/src/providers/fx-adapter.ts +2 -2
- package/src/providers/pricing-sources.md +3 -0
- package/src/providers/types.ts +13 -0
- package/src/rbac/legacy-policy.ts +4 -0
- package/src/rbac/permissions.ts +8 -0
- package/src/scheduler/index.ts +1 -0
- package/src/scheduler/scheduler.test.ts +32 -1
- package/src/scheduler/scheduler.ts +24 -1
- package/src/script-workflows/executor.ts +6 -0
- package/src/script-workflows/supervisor.ts +2 -1
- package/src/scripts-runtime/sdk-allowlist.ts +2 -0
- package/src/scripts-runtime/swarm-sdk.ts +12 -23
- package/src/scripts-runtime/types/stdlib.d.ts +4 -1
- package/src/scripts-runtime/types/swarm-sdk.d.ts +4 -1
- package/src/server.ts +2 -0
- package/src/slack/actions.ts +3 -0
- package/src/slack/approval-actions.ts +148 -0
- package/src/slack/approval-buttons.ts +28 -0
- package/src/slack/render-v2.ts +27 -7
- package/src/tests/base-prompt.test.ts +6 -2
- package/src/tests/chat-sdk-mentions.test.ts +183 -0
- package/src/tests/claude-adapter.test.ts +115 -0
- package/src/tests/create-page-tool.test.ts +5 -0
- package/src/tests/dsh-adapter.test.ts +53 -1
- package/src/tests/fixtures/compiled-source-schema-boot.ts +24 -0
- package/src/tests/fixtures/fx/acp-updates-recorded.jsonl +1 -1
- package/src/tests/fixtures/secret-corpus.ts +43 -1
- package/src/tests/heartbeat-stall-thresholds.test.ts +174 -0
- package/src/tests/internal-ai/complete-structured.test.ts +105 -0
- package/src/tests/internal-ai/credentials.test.ts +149 -0
- package/src/tests/internal-ai/task-title.test.ts +78 -0
- package/src/tests/jira-adf.test.ts +42 -2
- package/src/tests/mcp-input-caps.test.ts +16 -11
- package/src/tests/merge-gate-detect-changes.test.ts +208 -16
- package/src/tests/migration-342-script-run-sources.test.ts +196 -0
- package/src/tests/migration-bunfs-compat.test.ts +129 -9
- package/src/tests/rbac-e2e-helpers.test.ts +10 -4
- package/src/tests/rbac-e2e-helpers.ts +13 -4
- package/src/tests/rbac-roles.test.ts +2 -0
- package/src/tests/runner-slot-reconcile.test.ts +102 -0
- package/src/tests/runtime-e2b-pools.test.ts +7 -1
- package/src/tests/schedule-target-type.test.ts +4 -1
- package/src/tests/script-connections.test.ts +2 -0
- package/src/tests/script-runs-retention.test.ts +43 -16
- package/src/tests/script-workflows-runtime-e2e.test.ts +56 -22
- package/src/tests/scripts-http.test.ts +9 -3
- package/src/tests/sdk-allowlist.test.ts +26 -13
- package/src/tests/sdk-store-progress-skipped.test.ts +12 -5
- package/src/tests/secret-rules.test.ts +34 -0
- package/src/tests/secret-scrub-gate.test.ts +7 -0
- package/src/tests/secret-scrubber.test.ts +62 -2
- package/src/tests/seed-scripts.test.ts +2 -2
- package/src/tests/slack-render-v2.test.ts +85 -0
- package/src/tests/system-one-hosts-ui-mirror.test.ts +1 -0
- package/src/tests/vcs-azure-devops.test.ts +10 -0
- package/src/tests/vcs-provider.test.ts +8 -0
- package/src/themes/design-system.ts +163 -0
- package/src/themes/page-theme.ts +28 -19
- package/src/tools/chat-post.ts +7 -3
- package/src/tools/create-page.ts +3 -0
- package/src/tools/design-system.ts +102 -0
- package/src/tools/mcp-servers/mcp-server-get.ts +1 -1
- package/src/tools/mcp-servers/mcp-server-list.ts +1 -1
- package/src/tools/register-chat-channel.ts +11 -2
- package/src/tools/skills/skill-get-file.ts +1 -1
- package/src/tools/skills/skill-get.ts +1 -1
- package/src/tools/skills/skill-list.ts +1 -1
- package/src/tools/skills/skill-search.ts +1 -1
- package/src/tools/utils.ts +49 -4
- package/src/tools/workflows/get-workflow-run.ts +1 -1
- package/src/tools/workflows/get-workflow.ts +1 -1
- package/src/tools/workflows/list-workflow-runs.ts +1 -1
- package/src/tools/workflows/list-workflows.ts +1 -1
- package/src/types.ts +67 -1
- package/src/utils/internal-ai/complete-structured.ts +36 -5
- package/src/utils/internal-ai/credentials.ts +78 -2
- package/src/utils/internal-ai/models.ts +37 -1
- package/src/utils/internal-ai/task-title.ts +31 -1
- package/src/utils/secret-rules.generated.ts +149 -149
- package/src/utils/secret-scrubber.ts +111 -5
- package/src/vcs/azure-devops.ts +22 -1
- package/src/vcs/index.ts +3 -1
- package/src/workflows/approval-inline.ts +122 -0
- package/src/workflows/approval-notifications.ts +7 -2
- package/src/workflows/engine.ts +6 -5
- package/src/workflows/executors/agent-task.ts +14 -0
- package/src/workflows/executors/system-one-providers.ts +23 -0
- package/templates/skills/pages/content.md +34 -8
- package/templates/skills/swarm-docs/content.md +13 -0
- package/templates/skills/workflow-iterate/content.md +1 -1
- package/dist/acp-adapter-x1qqgzwx.js +0 -17
- package/dist/cli-n46d87mj.js +0 -98
- package/dist/core-2b8bv6ny.js +0 -42
- package/dist/fx-adapter-4yet1c4f.js +0 -20
- package/dist/grok-adapter-8ge6tw7m.js +0 -20
- package/dist/handlers-0r9evrdj.js +0 -41
- package/dist/hook-68gbs87k.js +0 -19
- package/dist/index-1v23363p.js +0 -39
- package/dist/index-30qw6vyw.js +0 -44
- package/dist/index-6bm3w6cn.js +0 -40
- package/dist/lead-3jpc7kcr.js +0 -79
- package/dist/thread-buffer-8fc703jc.js +0 -42
- package/dist/worker-3p2vq107.js +0 -79
|
@@ -25,7 +25,7 @@ export const registerMcpServerListTool = (server: McpServer) => {
|
|
|
25
25
|
"mcp-server-list",
|
|
26
26
|
{
|
|
27
27
|
title: "List MCP Servers",
|
|
28
|
-
annotations: {
|
|
28
|
+
annotations: { readOnlyHint: true },
|
|
29
29
|
description:
|
|
30
30
|
"List MCP servers with optional filters. Use installedOnly to see servers installed for the calling agent.",
|
|
31
31
|
inputSchema: z.object({
|
|
@@ -39,7 +39,7 @@ export const registerRegisterChatChannelTool = (server: McpServer) => {
|
|
|
39
39
|
title: "Route a chat channel to an agent or workflow",
|
|
40
40
|
annotations: { idempotentHint: true },
|
|
41
41
|
description:
|
|
42
|
-
"Lead-only. Route every swarm-addressed message from one Chat SDK channel (a Telegram group, Slack channel, Discord channel or Teams chat) to a fixed agent or workflow instead of the lead. Give exactly one of agentId or workflowId. A swarm#<agentId> token in a message still wins over the mapping. Remove it with unregister-chat-channel.",
|
|
42
|
+
"Lead-only. Route every swarm-addressed message from one Chat SDK channel (a Telegram group, Slack channel, Discord channel or Teams chat) to a fixed agent or workflow instead of the lead. Give exactly one of agentId or workflowId. For Telegram, defaultThreadId sets the topic used by channel-only chat-post calls. Re-registering replaces the mapping; omit defaultThreadId to clear it. A swarm#<agentId> token in a message still wins over the mapping. Remove it with unregister-chat-channel.",
|
|
43
43
|
inputSchema: z.object({
|
|
44
44
|
adapter: z.enum(CHAT_SDK_ADAPTER_NAMES).describe("Chat SDK adapter name."),
|
|
45
45
|
channelId: z
|
|
@@ -52,6 +52,13 @@ export const registerRegisterChatChannelTool = (server: McpServer) => {
|
|
|
52
52
|
.optional()
|
|
53
53
|
.describe("Workflow whose webhook trigger receives the channel's messages."),
|
|
54
54
|
name: z.string().max(200).optional().describe("Display name for the mapping."),
|
|
55
|
+
defaultThreadId: z
|
|
56
|
+
.string()
|
|
57
|
+
.min(1)
|
|
58
|
+
.optional()
|
|
59
|
+
.describe(
|
|
60
|
+
"Telegram topic used when chat-post gives only channelId, such as telegram:-100123:42. Must belong to this channel. Explicit threadId and chat-reply ignore this default.",
|
|
61
|
+
),
|
|
55
62
|
}),
|
|
56
63
|
outputSchema: swarmToolOutputSchema({
|
|
57
64
|
yourAgentId: z.string().optional(),
|
|
@@ -60,13 +67,14 @@ export const registerRegisterChatChannelTool = (server: McpServer) => {
|
|
|
60
67
|
.looseObject({
|
|
61
68
|
agentId: z.string().optional(),
|
|
62
69
|
workflowId: z.string().optional(),
|
|
70
|
+
defaultThreadId: z.string().optional(),
|
|
63
71
|
name: z.string().optional(),
|
|
64
72
|
createdAt: z.string().optional(),
|
|
65
73
|
})
|
|
66
74
|
.optional(),
|
|
67
75
|
}),
|
|
68
76
|
},
|
|
69
|
-
async ({ adapter, channelId, agentId, workflowId, name }, requestInfo) => {
|
|
77
|
+
async ({ adapter, channelId, agentId, workflowId, name, defaultThreadId }, requestInfo) => {
|
|
70
78
|
const data = { yourAgentId: requestInfo.agentId };
|
|
71
79
|
try {
|
|
72
80
|
if (!(await canManageChatChannels(requestInfo))) {
|
|
@@ -87,6 +95,7 @@ export const registerRegisterChatChannelTool = (server: McpServer) => {
|
|
|
87
95
|
...(agentId ? { agentId } : {}),
|
|
88
96
|
...(workflowId ? { workflowId } : {}),
|
|
89
97
|
...(name ? { name } : {}),
|
|
98
|
+
...(defaultThreadId ? { defaultThreadId } : {}),
|
|
90
99
|
createdAt: new Date().toISOString(),
|
|
91
100
|
};
|
|
92
101
|
const key = await putChatChannelMapping(adapter, channelId, mapping);
|
|
@@ -8,7 +8,7 @@ export const registerSkillGetFileTool = (server: McpServer) => {
|
|
|
8
8
|
"skill-get-file",
|
|
9
9
|
{
|
|
10
10
|
title: "Get Skill File",
|
|
11
|
-
annotations: {
|
|
11
|
+
annotations: { readOnlyHint: true },
|
|
12
12
|
description:
|
|
13
13
|
"Fetch a bundled reference file from a complex skill by skillId and relative path. Use this when the file is not available on disk.",
|
|
14
14
|
inputSchema: z.object({
|
|
@@ -9,7 +9,7 @@ export const registerSkillGetTool = (server: McpServer) => {
|
|
|
9
9
|
"skill-get",
|
|
10
10
|
{
|
|
11
11
|
title: "Get Skill",
|
|
12
|
-
annotations: {
|
|
12
|
+
annotations: { readOnlyHint: true },
|
|
13
13
|
description:
|
|
14
14
|
"Get full skill content by ID or name. Name resolution checks agent scope first, then swarm, then global. In swarm scope the ownerless skill wins, then your own, then the only agent-owned one; when several other agents own that name, it errors with their IDs: pass skillId instead.",
|
|
15
15
|
inputSchema: z.object({
|
|
@@ -21,7 +21,7 @@ export const registerSkillListTool = (server: McpServer) => {
|
|
|
21
21
|
"skill-list",
|
|
22
22
|
{
|
|
23
23
|
title: "List Skills",
|
|
24
|
-
annotations: {
|
|
24
|
+
annotations: { readOnlyHint: true },
|
|
25
25
|
description: "List available skills with optional filters.",
|
|
26
26
|
inputSchema: z.object({
|
|
27
27
|
type: z.enum(["remote", "personal"]).optional().describe("Filter by type"),
|
|
@@ -21,7 +21,7 @@ export const registerSkillSearchTool = (server: McpServer) => {
|
|
|
21
21
|
"skill-search",
|
|
22
22
|
{
|
|
23
23
|
title: "Search Skills",
|
|
24
|
-
annotations: {
|
|
24
|
+
annotations: { readOnlyHint: true },
|
|
25
25
|
description: "Search skills by keyword (name and description).",
|
|
26
26
|
inputSchema: z.object({
|
|
27
27
|
query: z.string().min(1).describe("Search query"),
|
package/src/tools/utils.ts
CHANGED
|
@@ -18,7 +18,7 @@ import type {
|
|
|
18
18
|
ToolAnnotations,
|
|
19
19
|
} from "@modelcontextprotocol/sdk/types.js";
|
|
20
20
|
import * as z from "zod";
|
|
21
|
-
import { upsertKv } from "../be/db";
|
|
21
|
+
import { getDbClient, upsertKv } from "../be/db";
|
|
22
22
|
import { bindLoopPath } from "../be/event-loop-lag";
|
|
23
23
|
import { MCP_OVERFLOW_NAMESPACE, mcpOverflowNamespace } from "../kv-overflow";
|
|
24
24
|
import { joinKvPath, type KvShapeEntry, splitKvPath, summarizeKvShape } from "../kv-view";
|
|
@@ -26,7 +26,12 @@ import { withSpan } from "../otel";
|
|
|
26
26
|
import { COLOR_LITERAL_THRESHOLD } from "../pages/color-literals";
|
|
27
27
|
import type { PermissionVerb } from "../rbac/permissions";
|
|
28
28
|
import { SCRIPT_LONG_TIMEOUT_HINT_MS } from "../scripts-runtime/executors/types";
|
|
29
|
-
import {
|
|
29
|
+
import {
|
|
30
|
+
DEFAULT_MODEL_TIER_MAP,
|
|
31
|
+
isTerminalTaskStatus,
|
|
32
|
+
type ModelTier,
|
|
33
|
+
type ProviderName,
|
|
34
|
+
} from "../types";
|
|
30
35
|
import { scrubObject, scrubSecrets } from "../utils/secret-scrubber";
|
|
31
36
|
|
|
32
37
|
type Meta = RequestHandlerExtra<ServerRequest, ServerNotification>;
|
|
@@ -400,10 +405,14 @@ const createPageNudge = (r: SwarmToolResult): string | undefined => {
|
|
|
400
405
|
usesDesignSystem?: unknown;
|
|
401
406
|
lightOnlyColors?: unknown;
|
|
402
407
|
colorLiteralCount?: unknown;
|
|
408
|
+
designSystemStatus?: unknown;
|
|
403
409
|
}
|
|
404
410
|
| undefined;
|
|
405
411
|
const count = data?.colorLiteralCount;
|
|
406
412
|
const sentences = [
|
|
413
|
+
data?.designSystemStatus === "none"
|
|
414
|
+
? "This org has no design system yet, so the page uses the default look. Ask the requester once for a site URL, a preset or a CSS block, build a preview with the design-system-seed script, and save it with design-system-set after they approve; if they say no, call design-system-set with status declined so nobody asks again."
|
|
415
|
+
: undefined,
|
|
407
416
|
data?.designVersion === 1 && data.usesDesignSystem === true
|
|
408
417
|
? "This page is on designVersion 1 (the original look), so design system classes, tokens and themes have no effect. Pass designVersion: 2."
|
|
409
418
|
: undefined,
|
|
@@ -1114,6 +1123,38 @@ async function applyPreToolCall(
|
|
|
1114
1123
|
};
|
|
1115
1124
|
}
|
|
1116
1125
|
|
|
1126
|
+
/** Tools a session may still call after its task reached a terminal status. */
|
|
1127
|
+
const TERMINAL_TASK_EXEMPT_TOOLS = new Set(["store-progress"]);
|
|
1128
|
+
|
|
1129
|
+
/**
|
|
1130
|
+
* Refuse a write from a session whose task already ended. A superseded or
|
|
1131
|
+
* cancelled task's harness can keep running until the worker kills it, and its
|
|
1132
|
+
* late `slack-reply` / `send-task` calls would act for a task the swarm
|
|
1133
|
+
* already moved past. Read-only is the registrar's `readOnlyHint: true`; a
|
|
1134
|
+
* tool without that annotation counts as a write. Scripts and extensions are
|
|
1135
|
+
* not agent sessions and skip the check.
|
|
1136
|
+
*/
|
|
1137
|
+
async function refuseWriteForTerminalTask(
|
|
1138
|
+
name: string,
|
|
1139
|
+
annotations: ToolAnnotations | undefined,
|
|
1140
|
+
requestInfo: RequestInfo,
|
|
1141
|
+
): Promise<SwarmToolResult | undefined> {
|
|
1142
|
+
if (requestInfo.callOrigin !== "mcp" || !requestInfo.sourceTaskId) return undefined;
|
|
1143
|
+
if (annotations?.readOnlyHint === true || TERMINAL_TASK_EXEMPT_TOOLS.has(name)) return undefined;
|
|
1144
|
+
const row = await getDbClient().get<{ status: string }>(
|
|
1145
|
+
"SELECT status FROM agent_tasks WHERE id = ?",
|
|
1146
|
+
[requestInfo.sourceTaskId],
|
|
1147
|
+
);
|
|
1148
|
+
if (!row || !isTerminalTaskStatus(row.status)) return undefined;
|
|
1149
|
+
return toolErr(
|
|
1150
|
+
`Task ${requestInfo.sourceTaskId} is ${row.status}, so this session can no longer call ${name}. Stop working on it.`,
|
|
1151
|
+
{
|
|
1152
|
+
details:
|
|
1153
|
+
"Only store-progress and read-only tools still work for a finished task. Any new work belongs to a new task.",
|
|
1154
|
+
},
|
|
1155
|
+
);
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1117
1158
|
function dispatchPostToolCall(
|
|
1118
1159
|
dispatcher: ExtensionDispatcher | undefined,
|
|
1119
1160
|
name: string,
|
|
@@ -1170,7 +1211,9 @@ export const createToolRegistrar = (server: McpServer) => {
|
|
|
1170
1211
|
async (span) => {
|
|
1171
1212
|
const pre = await applyPreToolCall(name, {}, requestInfo);
|
|
1172
1213
|
let durationMs = 0;
|
|
1173
|
-
let outcome =
|
|
1214
|
+
let outcome =
|
|
1215
|
+
pre.blocked ??
|
|
1216
|
+
(await refuseWriteForTerminalTask(name, config.annotations, requestInfo));
|
|
1174
1217
|
if (!outcome) {
|
|
1175
1218
|
const startedAt = Date.now();
|
|
1176
1219
|
try {
|
|
@@ -1210,7 +1253,9 @@ export const createToolRegistrar = (server: McpServer) => {
|
|
|
1210
1253
|
const pre = await applyPreToolCall(name, args, requestInfo, config.inputSchema);
|
|
1211
1254
|
const effectiveArgs = pre.args as InferInput<InputArgs>;
|
|
1212
1255
|
let durationMs = 0;
|
|
1213
|
-
let outcome =
|
|
1256
|
+
let outcome =
|
|
1257
|
+
pre.blocked ??
|
|
1258
|
+
(await refuseWriteForTerminalTask(name, config.annotations, requestInfo));
|
|
1214
1259
|
if (!outcome) {
|
|
1215
1260
|
const startedAt = Date.now();
|
|
1216
1261
|
try {
|
|
@@ -43,7 +43,7 @@ export const registerGetWorkflowRunTool = (server: McpServer) => {
|
|
|
43
43
|
"get-workflow-run",
|
|
44
44
|
{
|
|
45
45
|
title: "Get Workflow Run",
|
|
46
|
-
annotations: {
|
|
46
|
+
annotations: { readOnlyHint: true },
|
|
47
47
|
description: "Get details of a workflow run by ID, including all steps and their statuses.",
|
|
48
48
|
inputSchema: z.object({
|
|
49
49
|
id: z.string().uuid().describe("Workflow run ID"),
|
|
@@ -9,7 +9,7 @@ export const registerGetWorkflowTool = (server: McpServer) => {
|
|
|
9
9
|
"get-workflow",
|
|
10
10
|
{
|
|
11
11
|
title: "Get Workflow",
|
|
12
|
-
annotations: {
|
|
12
|
+
annotations: { readOnlyHint: true },
|
|
13
13
|
description:
|
|
14
14
|
"Get a workflow by ID, including its definition, triggers, cooldown, input, and auto-generated edges for UI rendering.",
|
|
15
15
|
inputSchema: z.object({
|
|
@@ -102,7 +102,7 @@ export const registerListWorkflowRunsTool = (server: McpServer) => {
|
|
|
102
102
|
"list-workflow-runs",
|
|
103
103
|
{
|
|
104
104
|
title: "List Workflow Runs",
|
|
105
|
-
annotations: {
|
|
105
|
+
annotations: { readOnlyHint: true },
|
|
106
106
|
description:
|
|
107
107
|
"List execution runs for a workflow with offset pagination (default 20, max 100), optionally filtered by status. Returns SLIM rows WITHOUT the full `context` or trigger data — each row carries a bounded `triggerDataSummary` instead. To inspect a run's context and steps, call `get-workflow-run` by id, or pass `includeContext: true` here.",
|
|
108
108
|
inputSchema: listWorkflowRunsInputSchema,
|
|
@@ -9,7 +9,7 @@ export const registerListWorkflowsTool = (server: McpServer) => {
|
|
|
9
9
|
"list-workflows",
|
|
10
10
|
{
|
|
11
11
|
title: "List Workflows",
|
|
12
|
-
annotations: {
|
|
12
|
+
annotations: { readOnlyHint: true },
|
|
13
13
|
description:
|
|
14
14
|
"List all automation workflows, optionally filtered by enabled status. Returns SLIM rows WITHOUT the full `definition` (DAG) — each row carries a `nodeCount` instead. To inspect or patch a workflow's nodes/triggers, call `get-workflow` by id, or pass `includeFull: true` here.",
|
|
15
15
|
inputSchema: z.object({
|
package/src/types.ts
CHANGED
|
@@ -2114,7 +2114,8 @@ export const SessionCostSchema = z
|
|
|
2114
2114
|
// had no matching pricing rows; totalCostUsd is whatever
|
|
2115
2115
|
// the worker submitted (often 0).
|
|
2116
2116
|
// 'estimated' — the API priced fallback token counts at an assumed
|
|
2117
|
-
// model (amp with a failed thread export)
|
|
2117
|
+
// model (amp with a failed thread export), or summed
|
|
2118
|
+
// per-message usage (claude killed before its result).
|
|
2118
2119
|
costSource: SessionCostSourceSchema.default("harness"),
|
|
2119
2120
|
kind: SessionCostKindSchema.default("harness"),
|
|
2120
2121
|
// Migration 128: adapter-reported amount retained for reconciliation only.
|
|
@@ -3330,6 +3331,71 @@ export const PageThemeTokensInputSchema = z.strictObject({
|
|
|
3330
3331
|
});
|
|
3331
3332
|
export type PageThemeTokensInput = z.infer<typeof PageThemeTokensInputSchema>;
|
|
3332
3333
|
|
|
3334
|
+
// The org design system (KV `design-system` / `org`, src/themes/design-system.ts).
|
|
3335
|
+
// It restyles every designVersion 2 page that sets no `theme`.
|
|
3336
|
+
export const DesignSystemStatusSchema = z.enum(["active", "declined"]);
|
|
3337
|
+
export const DesignSystemModeSchema = z.enum(["viewer", "light", "dark"]);
|
|
3338
|
+
export const DesignSystemSourceSchema = z.object({
|
|
3339
|
+
kind: z.enum(["manual", "website", "brand-kit", "preset"]),
|
|
3340
|
+
ref: z.string().max(2048).optional(),
|
|
3341
|
+
extractedAt: z.string().max(64).optional(),
|
|
3342
|
+
});
|
|
3343
|
+
export const DesignSystemLogoSchema = z.object({
|
|
3344
|
+
url: z.string().min(1).max(2048),
|
|
3345
|
+
alt: z.string().min(1).max(200),
|
|
3346
|
+
});
|
|
3347
|
+
|
|
3348
|
+
export const DesignSystemSchema = z
|
|
3349
|
+
.object({
|
|
3350
|
+
v: z.literal(1),
|
|
3351
|
+
status: DesignSystemStatusSchema,
|
|
3352
|
+
basePreset: z.string(),
|
|
3353
|
+
tokens: PageThemeTokensSchema,
|
|
3354
|
+
fontsHref: z.string().optional(),
|
|
3355
|
+
logo: DesignSystemLogoSchema.optional(),
|
|
3356
|
+
mode: DesignSystemModeSchema,
|
|
3357
|
+
chartPalette: z.array(z.string()).optional(),
|
|
3358
|
+
source: DesignSystemSourceSchema,
|
|
3359
|
+
updatedBy: z.string().nullable(),
|
|
3360
|
+
updatedByAgentId: z.string().optional(),
|
|
3361
|
+
updatedAt: z.string(),
|
|
3362
|
+
})
|
|
3363
|
+
.openapi("DesignSystem");
|
|
3364
|
+
export type DesignSystem = z.infer<typeof DesignSystemSchema>;
|
|
3365
|
+
|
|
3366
|
+
export const DesignSystemInputSchema = z.strictObject({
|
|
3367
|
+
status: DesignSystemStatusSchema.optional().describe(
|
|
3368
|
+
'"active" (default) saves the design system. "declined" records that the requester does not want one, so agents stop asking. A declined record keeps only `source`.',
|
|
3369
|
+
),
|
|
3370
|
+
basePreset: z
|
|
3371
|
+
.string()
|
|
3372
|
+
.optional()
|
|
3373
|
+
.describe("Preset id the tokens apply on top of, for example hive or paper. Default hive."),
|
|
3374
|
+
themeTokens: PageThemeTokensInputSchema.optional().describe(
|
|
3375
|
+
'Token overrides on top of the base preset, in the same formats as create_page themeTokens: { light, dark } maps, or { format: "css", css } with a shadcn, tweakcn or Tailwind v4 variable block.',
|
|
3376
|
+
),
|
|
3377
|
+
fontsHref: z
|
|
3378
|
+
.string()
|
|
3379
|
+
.max(2048)
|
|
3380
|
+
.optional()
|
|
3381
|
+
.describe(
|
|
3382
|
+
"Google Fonts stylesheet URL (https://fonts.googleapis.com/...) that loads the fonts the tokens name.",
|
|
3383
|
+
),
|
|
3384
|
+
logo: DesignSystemLogoSchema.optional().describe("https logo URL and its alt text."),
|
|
3385
|
+
mode: DesignSystemModeSchema.optional().describe(
|
|
3386
|
+
'"viewer" (default) follows the viewer\'s light or dark mode. "light" or "dark" locks every page to that mode.',
|
|
3387
|
+
),
|
|
3388
|
+
chartPalette: z
|
|
3389
|
+
.array(z.string())
|
|
3390
|
+
.max(12)
|
|
3391
|
+
.optional()
|
|
3392
|
+
.describe("Ordered chart series colors, as CSS color values."),
|
|
3393
|
+
source: DesignSystemSourceSchema.optional().describe(
|
|
3394
|
+
"Where the design system came from. Default { kind: manual }.",
|
|
3395
|
+
),
|
|
3396
|
+
});
|
|
3397
|
+
export type DesignSystemInput = z.infer<typeof DesignSystemInputSchema>;
|
|
3398
|
+
|
|
3333
3399
|
// PageSnapshot captures the mutable content fields frozen per-version in
|
|
3334
3400
|
// page_versions.snapshot. Omits id / agentId / slug / timestamps (these are
|
|
3335
3401
|
// invariant across versions for a given page id; the slug is a parent-only
|
|
@@ -212,6 +212,24 @@ export interface CompleteStructuredResult<TData> {
|
|
|
212
212
|
model: string;
|
|
213
213
|
}
|
|
214
214
|
|
|
215
|
+
/**
|
|
216
|
+
* Extra pi-ai request options a credential kind needs, or `undefined` for the
|
|
217
|
+
* providers that need none.
|
|
218
|
+
*
|
|
219
|
+
* Only Bedrock: it has no key to pass, so the one thing the adapter cannot
|
|
220
|
+
* derive is the region, and the resolver established that (from `AWS_REGION` or
|
|
221
|
+
* `AWS_DEFAULT_REGION`). It goes in as the documented `region` option rather
|
|
222
|
+
* than an `env` override, because the catalog's model entries carry a
|
|
223
|
+
* `us-east-1` base URL and an explicit region is what stops that default from
|
|
224
|
+
* winning over the deployment's actual region. Credentials are deliberately
|
|
225
|
+
* absent: the AWS SDK reads its own chain from `process.env`, and no AWS
|
|
226
|
+
* variable is in the swarm-config allowlist, so there is nothing extra to
|
|
227
|
+
* forward.
|
|
228
|
+
*/
|
|
229
|
+
function providerRequestOptions(cred: ResolvedCredential): Record<string, unknown> | undefined {
|
|
230
|
+
return cred.kind === "amazon-bedrock" ? { region: cred.region } : undefined;
|
|
231
|
+
}
|
|
232
|
+
|
|
215
233
|
/**
|
|
216
234
|
* Run a structured-output completion. Returns the parsed object on success,
|
|
217
235
|
* `null` on auth-missing or exhausted retries (errors logged, never thrown).
|
|
@@ -304,7 +322,8 @@ export async function completeStructuredWithModel<TZod extends z.ZodTypeAny>(
|
|
|
304
322
|
return null;
|
|
305
323
|
}
|
|
306
324
|
|
|
307
|
-
// 3. pi-ai path (openrouter / anthropic / openai / openai-codex
|
|
325
|
+
// 3. pi-ai path (openrouter / anthropic / openai / openai-codex / fireworks /
|
|
326
|
+
// amazon-bedrock).
|
|
308
327
|
const [provider, modelId] = parseModelStr(cred.modelDefault);
|
|
309
328
|
let model: ReturnType<typeof getModel>;
|
|
310
329
|
try {
|
|
@@ -341,10 +360,18 @@ export async function completeStructuredWithModel<TZod extends z.ZodTypeAny>(
|
|
|
341
360
|
provider === "openrouter" ? getOpenRouterAttributionHeaders(model.baseUrl, env) : {};
|
|
342
361
|
|
|
343
362
|
const completeFn = opts._complete ?? complete;
|
|
363
|
+
// Bedrock's adapter maps a `{type:"tool"}` choice to `toolChoice: {tool:{name}}`,
|
|
364
|
+
// which is the same forcing the Anthropic adapter does. Without it the
|
|
365
|
+
// Converse request carries no toolChoice and the model is free to answer in
|
|
366
|
+
// prose, which costs a retry per call.
|
|
344
367
|
const toolChoice =
|
|
345
|
-
model.api === "anthropic-messages"
|
|
368
|
+
model.api === "anthropic-messages" || model.api === "bedrock-converse-stream"
|
|
346
369
|
? ({ type: "tool", name: opts.toolName } as const)
|
|
347
370
|
: ("required" as const);
|
|
371
|
+
// Bedrock is the one provider whose request config is not a key: the SDK
|
|
372
|
+
// reads its credential chain from the environment, and the region the
|
|
373
|
+
// resolver established has to travel with the request.
|
|
374
|
+
const providerOptions = providerRequestOptions(cred);
|
|
348
375
|
let userPrompt = opts.userPrompt;
|
|
349
376
|
let lastErr: unknown = null;
|
|
350
377
|
for (let attempt = 0; attempt < retries; attempt++) {
|
|
@@ -364,9 +391,13 @@ export async function completeStructuredWithModel<TZod extends z.ZodTypeAny>(
|
|
|
364
391
|
},
|
|
365
392
|
// pi-ai's ProviderStreamOptions type only allows known providers;
|
|
366
393
|
// we pass the validated apiKey through verbatim.
|
|
367
|
-
{
|
|
368
|
-
|
|
369
|
-
|
|
394
|
+
{
|
|
395
|
+
apiKey: "apiKey" in cred ? cred.apiKey : undefined,
|
|
396
|
+
signal: opts.signal,
|
|
397
|
+
toolChoice,
|
|
398
|
+
headers,
|
|
399
|
+
...(providerOptions ?? {}),
|
|
400
|
+
} as Parameters<typeof completeFn>[2],
|
|
370
401
|
);
|
|
371
402
|
|
|
372
403
|
const toolCall = msg.content.find(
|
|
@@ -76,10 +76,14 @@ const resolveOAuthApiKey: OAuthApiKeyResolver = async (providerId, credentials)
|
|
|
76
76
|
* credential kind (`resolveRaterModelString`: `MEMORY_RATER_MODEL` env, else
|
|
77
77
|
* the pinned `MEMORY_RATER_DEFAULT_MODEL`). It is not the general
|
|
78
78
|
* `DEFAULT_MODEL`; callers that want that (workflow LLM nodes) read it directly.
|
|
79
|
+
*
|
|
80
|
+
* `region` exists only on the `amazon-bedrock` variant: the AWS SDK needs a
|
|
81
|
+
* region and there is no honest default to invent, so it is resolved once here
|
|
82
|
+
* and carried to the call site.
|
|
79
83
|
*/
|
|
80
84
|
export type ResolvedCredential =
|
|
81
85
|
| {
|
|
82
|
-
kind: "openrouter" | "anthropic" | "openai" | "openai-codex";
|
|
86
|
+
kind: "openrouter" | "anthropic" | "openai" | "openai-codex" | "fireworks";
|
|
83
87
|
apiKey: string;
|
|
84
88
|
modelDefault: string;
|
|
85
89
|
}
|
|
@@ -87,6 +91,20 @@ export type ResolvedCredential =
|
|
|
87
91
|
kind: "claude-cli";
|
|
88
92
|
modelDefault: string;
|
|
89
93
|
// No apiKey — the `claude` CLI uses CLAUDE_CODE_OAUTH_TOKEN from env directly.
|
|
94
|
+
}
|
|
95
|
+
| {
|
|
96
|
+
/**
|
|
97
|
+
* No `apiKey`: Bedrock authenticates through the AWS SDK's credential
|
|
98
|
+
* chain (profile, IAM keys, ECS task role, IRSA) or the
|
|
99
|
+
* `AWS_BEARER_TOKEN_BEDROCK` bearer identity, both of which the SDK reads
|
|
100
|
+
* from the environment itself. A placeholder key would be a lie that some
|
|
101
|
+
* downstream code could act on; the absence of the field is the honest
|
|
102
|
+
* shape.
|
|
103
|
+
*/
|
|
104
|
+
kind: "amazon-bedrock";
|
|
105
|
+
modelDefault: string;
|
|
106
|
+
/** `AWS_REGION` (or `AWS_DEFAULT_REGION`), the SDK's required region. */
|
|
107
|
+
region: string;
|
|
90
108
|
};
|
|
91
109
|
|
|
92
110
|
export interface ResolveCredentialOptions {
|
|
@@ -111,6 +129,18 @@ export interface ResolveCredentialOptions {
|
|
|
111
129
|
/**
|
|
112
130
|
* Credential kinds in precedence order. `resolveCredentials` walks this list;
|
|
113
131
|
* `resolveCredential` returns the first hit.
|
|
132
|
+
*
|
|
133
|
+
* `fireworks` and `amazon-bedrock` sit AFTER every kind that shipped before
|
|
134
|
+
* them. Both can be present in an environment that already works today (a
|
|
135
|
+
* deployment with an OpenRouter key and an ambient AWS profile, or a worker
|
|
136
|
+
* that sets FIREWORKS_API_KEY for its harness), so putting either of them
|
|
137
|
+
* earlier would silently capture calls that currently go to a key the
|
|
138
|
+
* operator chose explicitly. Adding them at the end keeps every existing
|
|
139
|
+
* caller on its current provider, which is the documented cost of being the
|
|
140
|
+
* newest entries rather than the guide for where they belong by quality.
|
|
141
|
+
*
|
|
142
|
+
* `amazon-bedrock` is last of the two because it resolves from an ambient
|
|
143
|
+
* credential chain rather than a key someone set on purpose for this layer.
|
|
114
144
|
*/
|
|
115
145
|
export const CREDENTIAL_KIND_PRECEDENCE: readonly CredentialKind[] = [
|
|
116
146
|
"openrouter",
|
|
@@ -118,6 +148,8 @@ export const CREDENTIAL_KIND_PRECEDENCE: readonly CredentialKind[] = [
|
|
|
118
148
|
"openai",
|
|
119
149
|
"openai-codex",
|
|
120
150
|
"claude-cli",
|
|
151
|
+
"fireworks",
|
|
152
|
+
"amazon-bedrock",
|
|
121
153
|
];
|
|
122
154
|
|
|
123
155
|
export interface ResolveCredentialsOptions extends ResolveCredentialOptions {
|
|
@@ -144,7 +176,9 @@ export interface ResolveCredentialsOptions extends ResolveCredentialOptions {
|
|
|
144
176
|
* 3. `env.OPENAI_API_KEY` (via pi-ai `getEnvApiKey("openai")`)
|
|
145
177
|
* 4. codex OAuth (only when `apiUrl && apiKey` are provided)
|
|
146
178
|
* 5. `env.CLAUDE_CODE_OAUTH_TOKEN` → claude-cli fallback
|
|
147
|
-
* 6.
|
|
179
|
+
* 6. `env.FIREWORKS_API_KEY` (via pi-ai `getEnvApiKey("fireworks")`)
|
|
180
|
+
* 7. the AWS credential chain **and** a region → `amazon-bedrock`
|
|
181
|
+
* 8. null
|
|
148
182
|
*/
|
|
149
183
|
export async function resolveCredential(
|
|
150
184
|
opts: ResolveCredentialOptions = {},
|
|
@@ -227,9 +261,51 @@ async function resolveKind(
|
|
|
227
261
|
// hook subprocesses (security), so the hook reads the mirror instead.
|
|
228
262
|
if (!env.AGENT_SWARM_CLAUDE_OAUTH_TOKEN && !env.CLAUDE_CODE_OAUTH_TOKEN) return null;
|
|
229
263
|
return { kind, modelDefault: resolveRaterModelString(kind) };
|
|
264
|
+
case "fireworks": {
|
|
265
|
+
const key = env.FIREWORKS_API_KEY ?? getEnvKey("fireworks");
|
|
266
|
+
if (!key) return null;
|
|
267
|
+
return {
|
|
268
|
+
kind,
|
|
269
|
+
apiKey: selectCredential(key, undefined, "FIREWORKS_API_KEY").selected,
|
|
270
|
+
modelDefault: resolveRaterModelString(kind),
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
case "amazon-bedrock":
|
|
274
|
+
return resolveBedrockCredential(env, getEnvKey);
|
|
230
275
|
}
|
|
231
276
|
}
|
|
232
277
|
|
|
278
|
+
/**
|
|
279
|
+
* Bedrock is credential-chain auth, not a key: pi-ai's `getEnvApiKey` returns
|
|
280
|
+
* the sentinel `"<authenticated>"` when any link of the chain is configured
|
|
281
|
+
* (`AWS_PROFILE`, an IAM key pair, `AWS_BEARER_TOKEN_BEDROCK`, ECS task role,
|
|
282
|
+
* IRSA). Nothing in this layer ever sees or handles the actual credential.
|
|
283
|
+
*
|
|
284
|
+
* Region is required as well. pi-ai's adapter would fall back to `us-east-1`
|
|
285
|
+
* via the SDK, which may not be where inference is available; rather than
|
|
286
|
+
* guess, an unset region is treated like an absent key (a clean no-op), so no
|
|
287
|
+
* `region` is ever fabricated and the caller keeps whatever it had.
|
|
288
|
+
*/
|
|
289
|
+
function resolveBedrockCredential(
|
|
290
|
+
env: NodeJS.ProcessEnv,
|
|
291
|
+
getEnvKey: typeof getEnvApiKey,
|
|
292
|
+
): ResolvedCredential | null {
|
|
293
|
+
// `||`, not `??`: an env var set to an empty or whitespace-only value is
|
|
294
|
+
// common (a compose file with `AWS_REGION=${AWS_REGION:-}`), and `??` would
|
|
295
|
+
// keep that empty string and discard a valid `AWS_DEFAULT_REGION`.
|
|
296
|
+
const region = env.AWS_REGION?.trim() || env.AWS_DEFAULT_REGION?.trim();
|
|
297
|
+
if (!region) return null;
|
|
298
|
+
if (!getEnvKey("amazon-bedrock", env as Record<string, string>)) return null;
|
|
299
|
+
// `AWS_BEARER_TOKEN_BEDROCK` is a bearer identity, not a key to hand around;
|
|
300
|
+
// the SDK reads it from the environment on its own. The regional Bedrock
|
|
301
|
+
// endpoint and the region are all the call site needs to add.
|
|
302
|
+
return {
|
|
303
|
+
kind: "amazon-bedrock",
|
|
304
|
+
modelDefault: resolveRaterModelString("amazon-bedrock"),
|
|
305
|
+
region,
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
|
|
233
309
|
async function resolveCodexOAuthCredential(
|
|
234
310
|
opts: ResolveCredentialOptions,
|
|
235
311
|
apiUrl: string,
|
|
@@ -14,12 +14,34 @@
|
|
|
14
14
|
* env (kept for backwards-compat with the claude hook).
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
/**
|
|
18
|
+
* A provider the internal-ai layer can call. The value doubles as the
|
|
19
|
+
* `provider/` prefix a model string carries (`parseModelStr`), so a kind and
|
|
20
|
+
* its provider id are the same string by construction.
|
|
21
|
+
*/
|
|
22
|
+
export type CredentialKind =
|
|
23
|
+
| "openrouter"
|
|
24
|
+
| "anthropic"
|
|
25
|
+
| "openai"
|
|
26
|
+
| "openai-codex"
|
|
27
|
+
| "claude-cli"
|
|
28
|
+
| "fireworks"
|
|
29
|
+
| "amazon-bedrock";
|
|
18
30
|
|
|
19
31
|
/**
|
|
20
32
|
* Per-credential default model strings. The "claude-cli" kind uses the
|
|
21
33
|
* shorthand "haiku" because the only consumer is the `claude -p --model haiku`
|
|
22
34
|
* shellout, not pi-ai's `getModel`.
|
|
35
|
+
*
|
|
36
|
+
* Every `provider/model-id` value here must exist in pi-ai's own catalog
|
|
37
|
+
* (`getBuiltinModel(provider, modelId)`), because `complete-structured.ts`
|
|
38
|
+
* resolves it through that catalog and a miss is a silent no-op.
|
|
39
|
+
*
|
|
40
|
+
* `amazon-bedrock` names a cross-region inference profile
|
|
41
|
+
* (`global.` prefix). A foundation-model id would only be invocable in the one
|
|
42
|
+
* region that owns it, and the profile prefix is what current Claude models on
|
|
43
|
+
* Bedrock actually take. Pin a region-scoped profile (`us.…`, `eu.…`) with
|
|
44
|
+
* `MEMORY_RATER_MODEL` / `TASK_AUTO_TITLE_MODEL` where an account needs one.
|
|
23
45
|
*/
|
|
24
46
|
export const DEFAULT_MODEL: Record<CredentialKind, string> = {
|
|
25
47
|
openrouter: "openrouter/deepseek/deepseek-v4.1-flash",
|
|
@@ -27,6 +49,8 @@ export const DEFAULT_MODEL: Record<CredentialKind, string> = {
|
|
|
27
49
|
openai: "openai/gpt-6-luna",
|
|
28
50
|
"openai-codex": "openai-codex/gpt-6-luna",
|
|
29
51
|
"claude-cli": "haiku",
|
|
52
|
+
fireworks: "fireworks/accounts/fireworks/models/deepseek-v4p1-flash",
|
|
53
|
+
"amazon-bedrock": "amazon-bedrock/global.anthropic.claude-haiku-5-5",
|
|
30
54
|
};
|
|
31
55
|
|
|
32
56
|
/**
|
|
@@ -46,6 +70,16 @@ export const MEMORY_RATER_DEFAULT_MODEL: Record<CredentialKind, string> = {
|
|
|
46
70
|
openai: "openai/gpt-6-luna",
|
|
47
71
|
"openai-codex": "openai-codex/gpt-6-luna",
|
|
48
72
|
"claude-cli": "haiku",
|
|
73
|
+
// Same model family as the OpenRouter judge above (DeepSeek V4.1 Flash), so a
|
|
74
|
+
// Fireworks deployment rates with the model the distribution was tuned on
|
|
75
|
+
// rather than shifting it. `fireworks/accounts/fireworks/models/…` is the
|
|
76
|
+
// provider's native id; the `routers/…` variants cost more per token.
|
|
77
|
+
fireworks: "fireworks/accounts/fireworks/models/deepseek-v4p1-flash",
|
|
78
|
+
// A Haiku, i.e. the same family the Anthropic kind rates with, reached
|
|
79
|
+
// through a global inference profile. Not `anthropic.claude-haiku-4-5`: that
|
|
80
|
+
// generation costs 1.00/5.00 per million on Bedrock, ten times this one, and
|
|
81
|
+
// a new kind has no existing rating distribution to stay consistent with.
|
|
82
|
+
"amazon-bedrock": "amazon-bedrock/global.anthropic.claude-haiku-5-5",
|
|
49
83
|
};
|
|
50
84
|
|
|
51
85
|
/**
|
|
@@ -64,6 +98,8 @@ const PROVIDER_TO_KIND: Record<string, CredentialKind> = {
|
|
|
64
98
|
anthropic: "anthropic",
|
|
65
99
|
openai: "openai",
|
|
66
100
|
"openai-codex": "openai-codex",
|
|
101
|
+
fireworks: "fireworks",
|
|
102
|
+
"amazon-bedrock": "amazon-bedrock",
|
|
67
103
|
};
|
|
68
104
|
|
|
69
105
|
/**
|
|
@@ -40,9 +40,15 @@ export interface TaskTitleCandidateGroup {
|
|
|
40
40
|
* first: pay-per-token API keys before subscription OAuth, and the `claude -p`
|
|
41
41
|
* shellout last (it spawns a full CLI process per call).
|
|
42
42
|
*
|
|
43
|
+
* `fireworks` and `amazon-bedrock` are appended after every kind that shipped
|
|
44
|
+
* before them, matching `CREDENTIAL_KIND_PRECEDENCE`: an environment that
|
|
45
|
+
* already titles through OpenRouter/Anthropic/OpenAI keeps doing so.
|
|
46
|
+
*
|
|
43
47
|
* Model prices (input / output, USD per million tokens, models.dev snapshot):
|
|
44
48
|
* deepseek-v4.1-flash 0.034 / 0.137 · claude-haiku-5.5 0.10 / 0.50 ·
|
|
45
|
-
* gpt-6-luna 0.10 / 0.50 · gpt-5-nano 0.05 / 0.40
|
|
49
|
+
* gpt-6-luna 0.10 / 0.50 · gpt-5-nano 0.05 / 0.40 ·
|
|
50
|
+
* fireworks deepseek-v4p1-flash 0.30 / 1.20 ·
|
|
51
|
+
* bedrock global claude-haiku-5-5 0.10 / 0.50 · nova-micro 0.035 / 0.14
|
|
46
52
|
*/
|
|
47
53
|
export const TASK_TITLE_MODEL_CANDIDATES: readonly TaskTitleCandidateGroup[] = [
|
|
48
54
|
{
|
|
@@ -57,6 +63,25 @@ export const TASK_TITLE_MODEL_CANDIDATES: readonly TaskTitleCandidateGroup[] = [
|
|
|
57
63
|
{ kind: "openai", models: ["openai/gpt-6-luna", "openai/gpt-5-nano"] },
|
|
58
64
|
{ kind: "openai-codex", models: ["openai-codex/gpt-6-luna"] },
|
|
59
65
|
{ kind: "claude-cli", models: ["haiku"] },
|
|
66
|
+
{
|
|
67
|
+
kind: "fireworks",
|
|
68
|
+
// The native (non-router) ids are the cheap ones; `routers/…` costs 8x.
|
|
69
|
+
models: [
|
|
70
|
+
"fireworks/accounts/fireworks/models/deepseek-v4p1-flash",
|
|
71
|
+
"fireworks/accounts/fireworks/models/glm-5p3-flash",
|
|
72
|
+
],
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
kind: "amazon-bedrock",
|
|
76
|
+
// Both ids verified present in pi-ai's catalog (`getBuiltinModel`). The
|
|
77
|
+
// haiku entry is a global inference profile; Nova Micro is a plain
|
|
78
|
+
// foundation model, so it only answers in the region that owns it, which is
|
|
79
|
+
// why it is the fallback rather than the first choice.
|
|
80
|
+
models: [
|
|
81
|
+
"amazon-bedrock/global.anthropic.claude-haiku-5-5",
|
|
82
|
+
"amazon-bedrock/amazon.nova-micro-v1:0",
|
|
83
|
+
],
|
|
84
|
+
},
|
|
60
85
|
];
|
|
61
86
|
|
|
62
87
|
export { kindForModelString };
|
|
@@ -65,6 +90,11 @@ export { kindForModelString };
|
|
|
65
90
|
* The candidate list for one environment. `TASK_AUTO_TITLE_MODEL` moves its
|
|
66
91
|
* provider to the front and puts the pinned model first inside it; the rest of
|
|
67
92
|
* the list stays as fallback. An unknown provider is ignored with a warning.
|
|
93
|
+
*
|
|
94
|
+
* `TASK_AUTO_TITLE_MODEL` that names a model string we do not recognise as a
|
|
95
|
+
* provider prefix is exactly why `kindForModelString` now knows
|
|
96
|
+
* `fireworks/…` and `amazon-bedrock/…`: without that, pinning a Bedrock judge
|
|
97
|
+
* would have logged "unsupported provider" and been silently dropped.
|
|
68
98
|
*/
|
|
69
99
|
export function buildTaskTitlePlan(
|
|
70
100
|
env: Record<string, string | undefined> = process.env,
|