@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
package/src/jira/adf.ts
CHANGED
|
@@ -8,9 +8,10 @@
|
|
|
8
8
|
* Reference: https://developer.atlassian.com/cloud/jira/platform/apis/document/structure/
|
|
9
9
|
*
|
|
10
10
|
* Supported node types: paragraph, heading, bulletList, orderedList, listItem,
|
|
11
|
-
* text, mention, hardBreak, codeBlock, blockquote
|
|
12
|
-
* `content` if present, else are skipped
|
|
13
|
-
* debug line is emitted so unhandled cases
|
|
11
|
+
* text, mention, hardBreak, codeBlock, blockquote, inlineCard, blockCard,
|
|
12
|
+
* embedCard. Unknown types descend into `content` if present, else are skipped
|
|
13
|
+
* silently. In non-prod environments a debug line is emitted so unhandled cases
|
|
14
|
+
* surface during dev.
|
|
14
15
|
*/
|
|
15
16
|
|
|
16
17
|
import { getNodeEnv } from "../utils/node-env";
|
|
@@ -33,17 +34,22 @@ function asNodeArray(value: unknown): AdfNode[] {
|
|
|
33
34
|
|
|
34
35
|
/**
|
|
35
36
|
* Recursively concatenate text from an ADF tree. Mentions are inlined as
|
|
36
|
-
* `@<displayName>` (or `@<accountId>` if no displayName is present).
|
|
37
|
+
* `@<displayName>` (or `@<accountId>` if no displayName is present). Card nodes
|
|
38
|
+
* emit their `attrs.url`, since a pasted Confluence or GitHub link carries no
|
|
39
|
+
* text content of its own.
|
|
37
40
|
*
|
|
38
41
|
* Block-level nodes insert a trailing newline so consecutive paragraphs render
|
|
39
|
-
* as separate lines. Hard breaks and list items also produce newlines.
|
|
42
|
+
* as separate lines. Hard breaks and list items also produce newlines. Ordered
|
|
43
|
+
* list items are numbered from `attrs.order` (default 1).
|
|
40
44
|
*/
|
|
41
45
|
export function extractText(adf: unknown): string {
|
|
42
46
|
if (!isNode(adf)) return "";
|
|
43
47
|
|
|
44
48
|
const out: string[] = [];
|
|
45
49
|
|
|
46
|
-
|
|
50
|
+
// A list passes each listItem its marker ("- " or "3. "); every other node
|
|
51
|
+
// visits its children without one.
|
|
52
|
+
const visit = (node: AdfNode, marker?: string): void => {
|
|
47
53
|
const type = typeof node.type === "string" ? node.type : "";
|
|
48
54
|
|
|
49
55
|
switch (type) {
|
|
@@ -73,13 +79,23 @@ export function extractText(adf: unknown): string {
|
|
|
73
79
|
out.push("\n");
|
|
74
80
|
return;
|
|
75
81
|
}
|
|
76
|
-
case "bulletList":
|
|
82
|
+
case "bulletList": {
|
|
83
|
+
for (const child of asNodeArray(node.content)) visit(child, "- ");
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
77
86
|
case "orderedList": {
|
|
78
|
-
|
|
87
|
+
// ADF allows an `order` of 0 or more, so a zero-start list keeps its 0;
|
|
88
|
+
// only a missing or non-integer value falls back to 1.
|
|
89
|
+
const order = node.attrs?.order;
|
|
90
|
+
const start =
|
|
91
|
+
typeof order === "number" && Number.isInteger(order) && order >= 0 ? order : 1;
|
|
92
|
+
asNodeArray(node.content).forEach((child, index) => {
|
|
93
|
+
visit(child, `${start + index}. `);
|
|
94
|
+
});
|
|
79
95
|
return;
|
|
80
96
|
}
|
|
81
97
|
case "listItem": {
|
|
82
|
-
out.push("- ");
|
|
98
|
+
out.push(marker ?? "- ");
|
|
83
99
|
for (const child of asNodeArray(node.content)) visit(child);
|
|
84
100
|
// Block children inside a listItem already trail a newline, so we don't
|
|
85
101
|
// double-add. But if the listItem only contained inline content, ensure
|
|
@@ -89,6 +105,16 @@ export function extractText(adf: unknown): string {
|
|
|
89
105
|
}
|
|
90
106
|
return;
|
|
91
107
|
}
|
|
108
|
+
case "inlineCard":
|
|
109
|
+
case "blockCard":
|
|
110
|
+
case "embedCard": {
|
|
111
|
+
const url = node.attrs?.url;
|
|
112
|
+
if (typeof url === "string" && url.length > 0) out.push(url);
|
|
113
|
+
// Block and embed cards stand alone on their own line; an inline card
|
|
114
|
+
// sits inside a line of text.
|
|
115
|
+
if (type !== "inlineCard") out.push("\n");
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
92
118
|
case "doc": {
|
|
93
119
|
for (const child of asNodeArray(node.content)) visit(child);
|
|
94
120
|
return;
|
|
@@ -8,6 +8,11 @@ const RESERVED_FAMILIES = new Map([
|
|
|
8
8
|
["apps", "namespace is reserved for swarm apps; use the app row endpoints"],
|
|
9
9
|
// step-9: Comb's "Send to swarm" claims (`comb:sent`).
|
|
10
10
|
["comb", "namespace is reserved for Comb; use POST /api/comb/review-batches"],
|
|
11
|
+
// The org design system (src/themes/design-system.ts): writes must pass its token checks.
|
|
12
|
+
[
|
|
13
|
+
"design-system",
|
|
14
|
+
"namespace is reserved for the org design system; use design-system-set or PUT /api/design-system",
|
|
15
|
+
],
|
|
11
16
|
["heartbeat-checklist", "namespace is reserved for heartbeat checklist receipts"],
|
|
12
17
|
["worker", "namespace is reserved for worker nudges"],
|
|
13
18
|
// Durable dedupe for SLACK_BLOCK_EXTERNAL_CHANNELS alerts (src/slack/external-channel.ts).
|
package/src/pages/page-head.ts
CHANGED
|
@@ -111,6 +111,13 @@ const FONT_LINKS = `<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
|
111
111
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
112
112
|
<link href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Space+Mono:wght@400;700&display=swap" rel="stylesheet">`;
|
|
113
113
|
|
|
114
|
+
function fontLinks(href: string): string {
|
|
115
|
+
const escaped = href.replaceAll("&", "&").replaceAll('"', """);
|
|
116
|
+
return `<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
117
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
118
|
+
<link href="${escaped}" rel="stylesheet">`;
|
|
119
|
+
}
|
|
120
|
+
|
|
114
121
|
/**
|
|
115
122
|
* The Tailwind source. Theme and utilities only: Preflight stays off, so the
|
|
116
123
|
* element defaults below survive. `inline reference` maps each token utility
|
|
@@ -748,15 +755,18 @@ ${TONE_RULES}
|
|
|
748
755
|
export function buildPageHeadV2({
|
|
749
756
|
theme,
|
|
750
757
|
mode,
|
|
758
|
+
fontsHref,
|
|
751
759
|
}: {
|
|
752
760
|
theme: ResolvedPageTheme;
|
|
753
761
|
mode: "light" | "dark";
|
|
762
|
+
/** The org design system's Google Fonts stylesheet, already checked to be on fonts.googleapis.com. */
|
|
763
|
+
fontsHref?: string;
|
|
754
764
|
}): string {
|
|
755
765
|
return [
|
|
756
766
|
'<base target="_blank">',
|
|
757
767
|
IN_PAGE_LINK_SCRIPT,
|
|
758
768
|
"<style>@layer properties, theme, base, components, utilities;</style>",
|
|
759
|
-
FONT_LINKS,
|
|
769
|
+
fontsHref ? fontLinks(fontsHref) : FONT_LINKS,
|
|
760
770
|
`<style id="swarm-theme">\n${renderPageThemeCss(theme)}\n</style>`,
|
|
761
771
|
`<style id="swarm-design">\n${PAGE_DESIGN_CSS}\n</style>`,
|
|
762
772
|
TAILWIND_SOURCE_SCRIPT,
|
|
@@ -84,7 +84,7 @@ const REPO_CLAUDE_MD_INLINE_PROVIDERS: ReadonlySet<string> = new Set(["opencode"
|
|
|
84
84
|
/**
|
|
85
85
|
* Template event for the tool-discovery line. Amp, Codex and OpenCode run MCP
|
|
86
86
|
* tools inside their own code sandbox (`code_exec`, `exec`, `execute`), each
|
|
87
|
-
* with its own call shape, and fx defers them behind `
|
|
87
|
+
* with its own call shape, and fx defers them behind `toolbox` (search, then run) under
|
|
88
88
|
* `mcp_<server>_<tool>` names, so the generic lines are wrong for them.
|
|
89
89
|
*/
|
|
90
90
|
function toolDiscoveryEvent(provider: string, hasToolSearch: boolean): string {
|
|
@@ -525,7 +525,7 @@ registerTemplate({
|
|
|
525
525
|
eventType: "system.agent.tool_discovery.fx",
|
|
526
526
|
header: "",
|
|
527
527
|
defaultBody:
|
|
528
|
-
"Most swarm tools are deferred behind `
|
|
528
|
+
"Most swarm tools are deferred behind `toolbox`. Each one is named `mcp_swarm_<tool>`, so `store-progress` is `mcp_swarm_store-progress`. Call a tool in your tool list directly. A deferred tool fails when called directly: find it with `toolbox` `search`, then call `toolbox` with `run` set to its name and `arguments` set to its arguments.",
|
|
529
529
|
variables: [],
|
|
530
530
|
category: "system",
|
|
531
531
|
});
|
|
@@ -427,7 +427,7 @@ const copilotTargetProfile: AcpTargetProfile = {
|
|
|
427
427
|
},
|
|
428
428
|
};
|
|
429
429
|
|
|
430
|
-
/** Qwen Code's `--auth-type` choices (0.27.
|
|
430
|
+
/** Qwen Code's `--auth-type` choices (0.27.4). `qwen-oauth` and `qwen-subscription` need an interactive sign-in, so they are left out. */
|
|
431
431
|
const QWEN_AUTH_TYPES = ["openai", "openai-responses", "anthropic", "gemini", "vertex-ai"] as const;
|
|
432
432
|
|
|
433
433
|
// Qwen Code is a Gemini CLI fork: QWEN_SYSTEM_MD replaces its built-in prompt
|
|
@@ -844,7 +844,7 @@ type FxToolCallMeta = { fx?: { toolCall?: { mcp?: { server?: unknown; tool?: unk
|
|
|
844
844
|
|
|
845
845
|
/**
|
|
846
846
|
* fx's display adjustments:
|
|
847
|
-
* - The `[context] …
|
|
847
|
+
* - The `[context] … toolbox` notice arrives as its own assistant
|
|
848
848
|
* chunk. It becomes an `fx_context_notice` custom event, so it never reaches
|
|
849
849
|
* the task output.
|
|
850
850
|
* - A `tool_call` titles the action ("Running", "Get the agent swarm") and
|
|
@@ -45,7 +45,7 @@ import type {
|
|
|
45
45
|
* default; the image installs exactly this version and the per-task settings
|
|
46
46
|
* set `amp.updates.mode: "disabled"`. Bump it deliberately, with a live run.
|
|
47
47
|
*/
|
|
48
|
-
export const AMP_PACKAGE = "@ampcode/cli@0.0.
|
|
48
|
+
export const AMP_PACKAGE = "@ampcode/cli@0.0.1794838312-g371aa5";
|
|
49
49
|
|
|
50
50
|
/** MCP server name. Amp exposes its tools as `agent_swarm` / `store_progress` (dashes become underscores). */
|
|
51
51
|
const AMP_MCP_SERVER_NAME = "agent-swarm";
|
|
@@ -54,7 +54,7 @@ import {
|
|
|
54
54
|
MIN_CLAUDE_THINKING_DISPLAY_VERSION,
|
|
55
55
|
mergeClaudeSettingsArgs,
|
|
56
56
|
} from "./claude-flag-settings";
|
|
57
|
-
import { normalizeClaudeMessage } from "./claude-session-events";
|
|
57
|
+
import { ClaudeUsageAccumulator, normalizeClaudeMessage } from "./claude-session-events";
|
|
58
58
|
import { resolveSlashSkillPrompt } from "./codex-skill-resolver";
|
|
59
59
|
import { buildOtelTraceparentEnv, isHarnessOtelEnabled } from "./otel-env";
|
|
60
60
|
import { applyReasoningEffort, type ReasoningEffort } from "./reasoning-effort";
|
|
@@ -917,6 +917,9 @@ class ClaudeSession implements ProviderSession {
|
|
|
917
917
|
private transcript: string[];
|
|
918
918
|
/** Keeps the session heartbeat fresh while Claude idles on background tasks. */
|
|
919
919
|
private backgroundKeepalive: ClaudeBackgroundKeepalive;
|
|
920
|
+
/** Per-message usage, the cost fallback for a session killed before its result. */
|
|
921
|
+
private usage = new ClaudeUsageAccumulator();
|
|
922
|
+
private readonly startedAt = Date.now();
|
|
920
923
|
readonly deliverSteering?: (delivery: SteerDelivery) => Promise<SteerDeliveryResult>;
|
|
921
924
|
|
|
922
925
|
constructor(
|
|
@@ -1216,6 +1219,13 @@ class ClaudeSession implements ProviderSession {
|
|
|
1216
1219
|
);
|
|
1217
1220
|
}
|
|
1218
1221
|
|
|
1222
|
+
// A session killed before its `result` event (its task turned terminal
|
|
1223
|
+
// and the grace ran out) still bills its tokens: report them as estimated.
|
|
1224
|
+
lastCost ??= this.usage.toCost(
|
|
1225
|
+
{ taskId: this.config.taskId, agentId: this.config.agentId, model: this.model },
|
|
1226
|
+
{ durationMs: Date.now() - this.startedAt, isError: (exitCode ?? 1) !== 0 },
|
|
1227
|
+
);
|
|
1228
|
+
|
|
1219
1229
|
let failureReason: string | undefined;
|
|
1220
1230
|
if (exitCode !== 0 && this.errorTracker.hasErrors()) {
|
|
1221
1231
|
failureReason = this.errorTracker.buildFailureReason(exitCode ?? 1);
|
|
@@ -1241,6 +1251,7 @@ class ClaudeSession implements ProviderSession {
|
|
|
1241
1251
|
const json = JSON.parse(trimmed);
|
|
1242
1252
|
|
|
1243
1253
|
this.backgroundKeepalive.observe(json);
|
|
1254
|
+
this.usage.observe(json, this.model);
|
|
1244
1255
|
// In stream-json input mode Claude waits for EOF even after emitting a
|
|
1245
1256
|
// successful result. End stdin at that turn boundary so normal tasks can
|
|
1246
1257
|
// exit; steering messages written during the turn are already buffered
|
|
@@ -1304,6 +1315,15 @@ class ClaudeSession implements ProviderSession {
|
|
|
1304
1315
|
return this.completionPromise;
|
|
1305
1316
|
}
|
|
1306
1317
|
|
|
1318
|
+
/**
|
|
1319
|
+
* End input so Claude exits after its current turn and emits its `result`
|
|
1320
|
+
* (the cost report). Used when the task already turned terminal server-side.
|
|
1321
|
+
*/
|
|
1322
|
+
finishInput(): void {
|
|
1323
|
+
this.backgroundKeepalive.stop();
|
|
1324
|
+
this.closeStdin();
|
|
1325
|
+
}
|
|
1326
|
+
|
|
1307
1327
|
async abort(): Promise<void> {
|
|
1308
1328
|
this.closeStdin();
|
|
1309
1329
|
try {
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
import { ClaudeBackgroundKeepalive } from "./claude-background-keepalive";
|
|
34
34
|
import type { ClaudeFlagSettings } from "./claude-flag-settings";
|
|
35
35
|
import type { ClaudeProtocolMessage } from "./claude-session-events";
|
|
36
|
-
import { normalizeClaudeMessage } from "./claude-session-events";
|
|
36
|
+
import { ClaudeUsageAccumulator, normalizeClaudeMessage } from "./claude-session-events";
|
|
37
37
|
import type {
|
|
38
38
|
CostData,
|
|
39
39
|
ProviderEvent,
|
|
@@ -321,6 +321,9 @@ class ClaudeSdkSession implements ProviderSession {
|
|
|
321
321
|
/** Last value written to the context state file read by the context-bound note hook. */
|
|
322
322
|
private lastContextTokens: number | undefined;
|
|
323
323
|
private lastCost: CostData | undefined;
|
|
324
|
+
/** Per-message usage, the cost fallback for a session aborted before its result. */
|
|
325
|
+
private usage = new ClaudeUsageAccumulator();
|
|
326
|
+
private readonly startedAt = Date.now();
|
|
324
327
|
private aborted = false;
|
|
325
328
|
private abortReason = "cancelled";
|
|
326
329
|
private acceptingInput = true;
|
|
@@ -363,6 +366,21 @@ class ClaudeSdkSession implements ProviderSession {
|
|
|
363
366
|
return this.completionPromise;
|
|
364
367
|
}
|
|
365
368
|
|
|
369
|
+
/** The result's cost, else per-message usage reported as estimated. */
|
|
370
|
+
private costOrEstimate(isError: boolean): CostData | undefined {
|
|
371
|
+
return (
|
|
372
|
+
this.lastCost ??
|
|
373
|
+
this.usage.toCost(
|
|
374
|
+
{
|
|
375
|
+
taskId: this.options.config.taskId,
|
|
376
|
+
agentId: this.options.config.agentId,
|
|
377
|
+
model: this.model,
|
|
378
|
+
},
|
|
379
|
+
{ durationMs: Date.now() - this.startedAt, isError },
|
|
380
|
+
)
|
|
381
|
+
);
|
|
382
|
+
}
|
|
383
|
+
|
|
366
384
|
async abort(reason?: string): Promise<void> {
|
|
367
385
|
if (this.aborted) return;
|
|
368
386
|
this.aborted = true;
|
|
@@ -533,6 +551,7 @@ class ClaudeSdkSession implements ProviderSession {
|
|
|
533
551
|
this.turnActive = true;
|
|
534
552
|
}
|
|
535
553
|
this.backgroundKeepalive.observe(json);
|
|
554
|
+
this.usage.observe(json, this.model);
|
|
536
555
|
const normalized = normalizeClaudeMessage(json, {
|
|
537
556
|
taskId: this.options.config.taskId,
|
|
538
557
|
agentId: this.options.config.agentId,
|
|
@@ -682,7 +701,7 @@ class ClaudeSdkSession implements ProviderSession {
|
|
|
682
701
|
return {
|
|
683
702
|
exitCode: 130,
|
|
684
703
|
sessionId: this._sessionId,
|
|
685
|
-
cost: this.
|
|
704
|
+
cost: this.costOrEstimate(true),
|
|
686
705
|
output: this.lastAssistantText || undefined,
|
|
687
706
|
isError: true,
|
|
688
707
|
errorCategory: "cancelled",
|
|
@@ -712,7 +731,7 @@ class ClaudeSdkSession implements ProviderSession {
|
|
|
712
731
|
return {
|
|
713
732
|
exitCode: resultIsError ? 1 : 0,
|
|
714
733
|
sessionId: this._sessionId,
|
|
715
|
-
cost: this.
|
|
734
|
+
cost: this.costOrEstimate(resultIsError),
|
|
716
735
|
output:
|
|
717
736
|
this.lastAssistantText ||
|
|
718
737
|
(terminalResult && "result" in terminalResult ? terminalResult.result : undefined),
|
|
@@ -49,7 +49,7 @@ export type ClaudeProtocolMessage = {
|
|
|
49
49
|
num_turns?: number;
|
|
50
50
|
is_error?: boolean;
|
|
51
51
|
parent_tool_use_id?: string | null;
|
|
52
|
-
message?: { content?: ClaudeContentBlock[]; usage?: ClaudeUsage };
|
|
52
|
+
message?: { id?: string; model?: string; content?: ClaudeContentBlock[]; usage?: ClaudeUsage };
|
|
53
53
|
};
|
|
54
54
|
|
|
55
55
|
export type NormalizedClaudeMessage = {
|
|
@@ -145,6 +145,81 @@ function costFromResult(
|
|
|
145
145
|
};
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
+
/**
|
|
149
|
+
* Sums the usage of every assistant message so a session that ends without a
|
|
150
|
+
* `result` event (killed after its task turned terminal) still reports cost.
|
|
151
|
+
* Claude splits one API message across stream lines that share `message.id`
|
|
152
|
+
* and repeat its usage, so the last usage seen per id wins. Subagent messages
|
|
153
|
+
* are billed too, so they count.
|
|
154
|
+
*/
|
|
155
|
+
export class ClaudeUsageAccumulator {
|
|
156
|
+
private readonly byMessage = new Map<string, { model: string; usage: ClaudeUsage }>();
|
|
157
|
+
private unnamed = 0;
|
|
158
|
+
|
|
159
|
+
observe(json: ClaudeProtocolMessage, fallbackModel: string): void {
|
|
160
|
+
if (json.type !== "assistant" || !json.message?.usage) return;
|
|
161
|
+
const id = json.message.id || `unnamed-${this.unnamed++}`;
|
|
162
|
+
const model = json.message.model || fallbackModel;
|
|
163
|
+
this.byMessage.set(id, { model, usage: json.message.usage });
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/** Estimated cost for the session, or undefined when no message carried usage. */
|
|
167
|
+
toCost(
|
|
168
|
+
state: Pick<ClaudeMessageState, "taskId" | "agentId" | "model">,
|
|
169
|
+
opts: { durationMs: number; isError: boolean },
|
|
170
|
+
): CostData | undefined {
|
|
171
|
+
const perModel = new Map<string, NonNullable<CostData["models"]>[number]>();
|
|
172
|
+
let cacheWrite5mTokens = 0;
|
|
173
|
+
let cacheWrite1hTokens = 0;
|
|
174
|
+
let thinkingTokens = 0;
|
|
175
|
+
for (const { model, usage } of this.byMessage.values()) {
|
|
176
|
+
const entry = perModel.get(model) ?? {
|
|
177
|
+
model,
|
|
178
|
+
inputTokens: 0,
|
|
179
|
+
outputTokens: 0,
|
|
180
|
+
cacheReadTokens: 0,
|
|
181
|
+
cacheWriteTokens: 0,
|
|
182
|
+
};
|
|
183
|
+
entry.inputTokens += tokenCount(usage.input_tokens) ?? 0;
|
|
184
|
+
entry.outputTokens += tokenCount(usage.output_tokens) ?? 0;
|
|
185
|
+
entry.cacheReadTokens += tokenCount(usage.cache_read_input_tokens) ?? 0;
|
|
186
|
+
entry.cacheWriteTokens += tokenCount(usage.cache_creation_input_tokens) ?? 0;
|
|
187
|
+
perModel.set(model, entry);
|
|
188
|
+
cacheWrite5mTokens += tokenCount(usage.cache_creation?.ephemeral_5m_input_tokens) ?? 0;
|
|
189
|
+
cacheWrite1hTokens += tokenCount(usage.cache_creation?.ephemeral_1h_input_tokens) ?? 0;
|
|
190
|
+
thinkingTokens += tokenCount(usage.output_tokens_details?.thinking_tokens) ?? 0;
|
|
191
|
+
}
|
|
192
|
+
// Claude's local error messages (model "<synthetic>") carry all-zero usage.
|
|
193
|
+
const models = [...perModel.values()].filter(
|
|
194
|
+
(m) => m.inputTokens + m.outputTokens + m.cacheReadTokens + m.cacheWriteTokens > 0,
|
|
195
|
+
);
|
|
196
|
+
if (models.length === 0) return undefined;
|
|
197
|
+
const sum = (key: "inputTokens" | "outputTokens" | "cacheReadTokens" | "cacheWriteTokens") =>
|
|
198
|
+
models.reduce((total, m) => total + m[key], 0);
|
|
199
|
+
return {
|
|
200
|
+
sessionId: "",
|
|
201
|
+
taskId: state.taskId,
|
|
202
|
+
agentId: state.agentId,
|
|
203
|
+
totalCostUsd: 0,
|
|
204
|
+
estimated: true,
|
|
205
|
+
inputTokens: sum("inputTokens"),
|
|
206
|
+
outputTokens: sum("outputTokens"),
|
|
207
|
+
cacheReadTokens: sum("cacheReadTokens"),
|
|
208
|
+
cacheWriteTokens: sum("cacheWriteTokens"),
|
|
209
|
+
...(cacheWrite5mTokens + cacheWrite1hTokens > 0
|
|
210
|
+
? { cacheWrite5mTokens, cacheWrite1hTokens }
|
|
211
|
+
: {}),
|
|
212
|
+
thinkingTokens,
|
|
213
|
+
models,
|
|
214
|
+
durationMs: opts.durationMs,
|
|
215
|
+
numTurns: null,
|
|
216
|
+
model: state.model,
|
|
217
|
+
isError: opts.isError,
|
|
218
|
+
provider: "claude",
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
148
223
|
export function normalizeClaudeMessage(
|
|
149
224
|
json: ClaudeProtocolMessage,
|
|
150
225
|
state: ClaudeMessageState,
|
|
@@ -35,7 +35,7 @@ import type {
|
|
|
35
35
|
} from "./types";
|
|
36
36
|
|
|
37
37
|
/** Pinned in package.json and Dockerfile.worker; bump all three together. */
|
|
38
|
-
export const CURSOR_SDK_VERSION = "1.
|
|
38
|
+
export const CURSOR_SDK_VERSION = "1.4.0";
|
|
39
39
|
|
|
40
40
|
/** MCP server name; Cursor reports its tools as `mcp` calls with this `providerIdentifier`. */
|
|
41
41
|
const CURSOR_MCP_SERVER_NAME = "agent-swarm";
|
|
@@ -39,6 +39,28 @@ import type {
|
|
|
39
39
|
// npm's `latest` is older and lacks the JSON/stdin contract used here.
|
|
40
40
|
export const DSH_PACKAGE = "@deepseek-ai/dsh@0.2.2-rc.3";
|
|
41
41
|
|
|
42
|
+
/** Held stderr past this is flushed as is, so a line with no newline cannot grow without bound. */
|
|
43
|
+
const STDERR_HOLD_MAX = 64 * 1024;
|
|
44
|
+
const PEM_PRIVATE_BEGIN_RE = /^-----BEGIN [A-Z0-9 ]{0,32}PRIVATE KEY/;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* How much of the pending stderr text can be scrubbed and emitted now: every
|
|
48
|
+
* complete line, except a private-key PEM block still waiting for its END
|
|
49
|
+
* line. A token split across two pipe chunks, or a PEM body split across
|
|
50
|
+
* lines, is then scrubbed whole. Past `STDERR_HOLD_MAX` everything goes, and
|
|
51
|
+
* the scrubber's truncated-PEM rule still covers a cut block.
|
|
52
|
+
*/
|
|
53
|
+
export function stderrFlushLength(pending: string): number {
|
|
54
|
+
if (pending.length > STDERR_HOLD_MAX) return pending.length;
|
|
55
|
+
let cut = pending.lastIndexOf("\n") + 1;
|
|
56
|
+
const begin = cut > 0 ? pending.lastIndexOf("-----BEGIN ", cut - 1) : -1;
|
|
57
|
+
if (begin >= 0 && !pending.slice(begin, cut).includes("-----END ")) {
|
|
58
|
+
const lineStart = pending.lastIndexOf("\n", begin) + 1;
|
|
59
|
+
if (PEM_PRIVATE_BEGIN_RE.test(pending.slice(begin, begin + 64))) cut = lineStart;
|
|
60
|
+
}
|
|
61
|
+
return cut;
|
|
62
|
+
}
|
|
63
|
+
|
|
42
64
|
export function checkDshCredentials(env: Record<string, string | undefined>): CredStatus {
|
|
43
65
|
return env.DEEPSEEK_API_KEY?.trim() || env.OPENROUTER_API_KEY?.trim()
|
|
44
66
|
? { ready: true, missing: [], satisfiedBy: "env" }
|
|
@@ -234,20 +256,33 @@ class DshSession implements ProviderSession {
|
|
|
234
256
|
|
|
235
257
|
private async readStderr(): Promise<void> {
|
|
236
258
|
const decoder = new TextDecoder();
|
|
259
|
+
// Scrub whole lines, not raw chunks: a chunk boundary can split a token.
|
|
260
|
+
let pending = "";
|
|
237
261
|
for await (const chunk of this.proc.stderr) {
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
262
|
+
pending += decoder.decode(chunk, { stream: true });
|
|
263
|
+
const cut = stderrFlushLength(pending);
|
|
264
|
+
if (cut === 0) continue;
|
|
265
|
+
const text = pending.slice(0, cut);
|
|
266
|
+
pending = pending.slice(cut);
|
|
267
|
+
await this.consumeStderr(text);
|
|
268
|
+
}
|
|
269
|
+
pending += decoder.decode();
|
|
270
|
+
if (pending) await this.consumeStderr(pending);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
private async consumeStderr(text: string): Promise<void> {
|
|
274
|
+
const content = scrubSecrets(text);
|
|
275
|
+
this.stderr = (this.stderr + content).slice(-8000);
|
|
276
|
+
this.emit({ type: "raw_stderr", content });
|
|
277
|
+
// dsh downgrades a failed plugin to a "did not activate" warning even
|
|
278
|
+
// with failOnStartupError, then runs on without the swarm tools. A
|
|
279
|
+
// session that cannot reach store-progress must not pass as healthy.
|
|
280
|
+
if (
|
|
281
|
+
!this.failure &&
|
|
282
|
+
this.stderr.includes(`${DSH_MCP_ENTRY_ID} (@deepseek-ai/dsh-mcp-client)`)
|
|
283
|
+
) {
|
|
284
|
+
this.failure = `dsh could not connect to the swarm MCP server: ${this.stderr.trim().slice(0, 500)}`;
|
|
285
|
+
await terminateProcessGroup(this.proc.pid);
|
|
251
286
|
}
|
|
252
287
|
}
|
|
253
288
|
|
|
@@ -21,7 +21,7 @@ import type {
|
|
|
21
21
|
* Dockerfile.worker; bump the two together). Every ACP shape this adapter
|
|
22
22
|
* relies on was measured against it.
|
|
23
23
|
*/
|
|
24
|
-
export const FX_PINNED_VERSION = "0.0.
|
|
24
|
+
export const FX_PINNED_VERSION = "0.0.17";
|
|
25
25
|
|
|
26
26
|
/** OpenAI's Chat Completions prefix; fx appends `/chat/completions`. */
|
|
27
27
|
export const FX_OPENAI_BASE_URL = "https://api.openai.com/v1";
|
|
@@ -165,7 +165,7 @@ export class FxAdapter implements ProviderAdapter {
|
|
|
165
165
|
|
|
166
166
|
readonly traits: ProviderTraits = {
|
|
167
167
|
hasMcp: true,
|
|
168
|
-
// fx defers swarm tools behind its own `
|
|
168
|
+
// fx defers swarm tools behind its own `toolbox` (search/run); the prompt
|
|
169
169
|
// uses the fx-specific discovery line, not the generic tool-search one.
|
|
170
170
|
hasToolSearch: false,
|
|
171
171
|
// `~/.claude/skills` is a native fx skill root (verified: a planted skill loaded).
|
|
@@ -47,6 +47,9 @@ rate by hand should also update this file.
|
|
|
47
47
|
Shortnames (`opus`, `sonnet`, `haiku`) ALSO get rows keyed by the current
|
|
48
48
|
default full id (e.g. `opus → claude-opus-4-7`). Pi-mono uses the same
|
|
49
49
|
shortname forms, so they're projected under `provider='pi'` as well.
|
|
50
|
+
A `claude` row posted with `estimated: true` (the session was killed
|
|
51
|
+
before its `result` event) carries per-message usage summed per model;
|
|
52
|
+
it is priced from these rows and tagged `estimated`, never recorded as $0.
|
|
50
53
|
- OpenAI models → rows under `provider='codex'`, and `provider='pi'` for
|
|
51
54
|
the ChatGPT subscription route. Pricing accepts `openai-codex/<id>`;
|
|
52
55
|
`session_costs.model` and its per-model breakdown store the bare OpenAI
|
package/src/providers/types.ts
CHANGED
|
@@ -25,6 +25,12 @@ export interface CostData {
|
|
|
25
25
|
* so it wins over the pricing table (opencode on OpenRouter).
|
|
26
26
|
*/
|
|
27
27
|
harnessCostBilled?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* The token counts were summed from per-message usage because the session
|
|
30
|
+
* ended without its final cost report (Claude killed before its `result`
|
|
31
|
+
* event). The API prices them and tags the row `costSource: 'estimated'`.
|
|
32
|
+
*/
|
|
33
|
+
estimated?: boolean;
|
|
28
34
|
inputTokens?: number;
|
|
29
35
|
outputTokens?: number;
|
|
30
36
|
cacheReadTokens?: number;
|
|
@@ -207,6 +213,13 @@ export interface ProviderSession {
|
|
|
207
213
|
onEvent(listener: (event: ProviderEvent) => void): void;
|
|
208
214
|
waitForCompletion(): Promise<ProviderResult>;
|
|
209
215
|
abort(reason?: string): Promise<void>;
|
|
216
|
+
/**
|
|
217
|
+
* Optional. Stop taking input so the session ends after its current turn and
|
|
218
|
+
* still emits its final report (Claude's `result` carries the cost). The
|
|
219
|
+
* runner calls it when the task already turned terminal server-side, then
|
|
220
|
+
* aborts once `RUNNER_TERMINAL_TASK_GRACE_MS` passes. Absent: abort at once.
|
|
221
|
+
*/
|
|
222
|
+
finishInput?(): void;
|
|
210
223
|
/** Optional. Absent means the provider cannot accept mid-run input. */
|
|
211
224
|
deliverSteering?(delivery: SteerDelivery): Promise<SteerDeliveryResult>;
|
|
212
225
|
/**
|
|
@@ -348,6 +348,10 @@ export const LEGACY_POLICY = {
|
|
|
348
348
|
"comb.presence": operatorOrUser,
|
|
349
349
|
"fs.join.own": anyAuthenticated,
|
|
350
350
|
"page.delete.any": leadOrResourceOwner,
|
|
351
|
+
// Any agent records the requester's answer to the first-page ask (src/tools/design-system.ts).
|
|
352
|
+
"design-system.write": anyAuthenticated,
|
|
353
|
+
// Opening a page is a read. Writes from the page session keep their own verbs.
|
|
354
|
+
"page.launch": anyAuthenticated,
|
|
351
355
|
// Humans only: agents edit objects with the board-* and sheet-* tools as themselves.
|
|
352
356
|
"objects.read": operatorOrUser,
|
|
353
357
|
"objects.write": operatorOrUser,
|
package/src/rbac/permissions.ts
CHANGED
|
@@ -356,6 +356,14 @@ export const PERMISSIONS = {
|
|
|
356
356
|
description: "Delete a page the caller does not own.",
|
|
357
357
|
namespace: "page",
|
|
358
358
|
},
|
|
359
|
+
"design-system.write": {
|
|
360
|
+
description: "Set or decline the org design system that restyles every page.",
|
|
361
|
+
namespace: "page",
|
|
362
|
+
},
|
|
363
|
+
"page.launch": {
|
|
364
|
+
description: "Open a public or authed page: mint its page-session cookie.",
|
|
365
|
+
namespace: "page",
|
|
366
|
+
},
|
|
359
367
|
"objects.read": {
|
|
360
368
|
description:
|
|
361
369
|
"Read a board or sheet on the swarm's shared agent-fs drive through the object routes.",
|
package/src/scheduler/index.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
|
2
2
|
import { unlinkSync } from "node:fs";
|
|
3
3
|
import { closeDb, createAgent, createScheduledTask, createTaskExtended, initDb } from "../be/db";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
calculateNextRun,
|
|
6
|
+
createStandaloneScheduleTask,
|
|
7
|
+
parseSchedulerIntervalMs,
|
|
8
|
+
} from "./scheduler";
|
|
5
9
|
|
|
6
10
|
const TEST_DB_PATH = "./test-scheduler.sqlite";
|
|
7
11
|
|
|
@@ -20,6 +24,33 @@ afterAll(() => {
|
|
|
20
24
|
}
|
|
21
25
|
});
|
|
22
26
|
|
|
27
|
+
describe("parseSchedulerIntervalMs", () => {
|
|
28
|
+
test("falls back to 10s unless the value is an integer inside the timer range", () => {
|
|
29
|
+
const unusable = [
|
|
30
|
+
undefined,
|
|
31
|
+
"",
|
|
32
|
+
"abc",
|
|
33
|
+
"NaN",
|
|
34
|
+
"Infinity",
|
|
35
|
+
"-Infinity",
|
|
36
|
+
"0",
|
|
37
|
+
"-1",
|
|
38
|
+
"1.5",
|
|
39
|
+
"2147483648",
|
|
40
|
+
"10000000000",
|
|
41
|
+
];
|
|
42
|
+
for (const raw of unusable) {
|
|
43
|
+
expect(parseSchedulerIntervalMs(raw)).toBe(10_000);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
test("keeps a positive configured interval unchanged", () => {
|
|
48
|
+
expect(parseSchedulerIntervalMs("2500")).toBe(2500);
|
|
49
|
+
expect(parseSchedulerIntervalMs("30000")).toBe(30_000);
|
|
50
|
+
expect(parseSchedulerIntervalMs("2147483647")).toBe(2_147_483_647);
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
|
|
23
54
|
describe("calculateNextRun", () => {
|
|
24
55
|
test("calculates next run with cron expression", async () => {
|
|
25
56
|
const schedule = await createScheduledTask({
|