@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
|
@@ -623,3 +623,108 @@ describe("completeStructuredWithModel", () => {
|
|
|
623
623
|
expect(result).toEqual({ data: { summary: "cli", count: 1 }, model: "haiku" });
|
|
624
624
|
});
|
|
625
625
|
});
|
|
626
|
+
|
|
627
|
+
describe("credential kinds added for fireworks and amazon-bedrock", () => {
|
|
628
|
+
const baseOpts = {
|
|
629
|
+
zodSchema: ResultZodSchema,
|
|
630
|
+
toolSchema: ResultToolSchema,
|
|
631
|
+
toolName: "record_result",
|
|
632
|
+
toolDescription: "Record the result.",
|
|
633
|
+
systemPrompt: "sys",
|
|
634
|
+
userPrompt: "user",
|
|
635
|
+
};
|
|
636
|
+
const toolCallMsg = () =>
|
|
637
|
+
makeMsg([
|
|
638
|
+
{
|
|
639
|
+
type: "toolCall",
|
|
640
|
+
id: "call_1",
|
|
641
|
+
name: "record_result",
|
|
642
|
+
arguments: { summary: "ok", count: 1 },
|
|
643
|
+
},
|
|
644
|
+
]);
|
|
645
|
+
|
|
646
|
+
test("fireworks goes through the pi-ai path with its own key", async () => {
|
|
647
|
+
let seenApiKey: unknown;
|
|
648
|
+
const result = await completeStructuredWithModel({
|
|
649
|
+
...baseOpts,
|
|
650
|
+
_credentialOverride: {
|
|
651
|
+
kind: "fireworks",
|
|
652
|
+
apiKey: "fw-key",
|
|
653
|
+
modelDefault: "fireworks/accounts/fireworks/models/deepseek-v4p1-flash",
|
|
654
|
+
},
|
|
655
|
+
_complete: async (_model, _ctx, options) => {
|
|
656
|
+
seenApiKey = (options as { apiKey?: unknown })?.apiKey;
|
|
657
|
+
return toolCallMsg();
|
|
658
|
+
},
|
|
659
|
+
});
|
|
660
|
+
expect(result).toEqual({
|
|
661
|
+
data: { summary: "ok", count: 1 },
|
|
662
|
+
model: "fireworks/accounts/fireworks/models/deepseek-v4p1-flash",
|
|
663
|
+
});
|
|
664
|
+
expect(seenApiKey).toBe("fw-key");
|
|
665
|
+
});
|
|
666
|
+
|
|
667
|
+
test("bedrock sends the region, forces the tool, and never sends an apiKey", async () => {
|
|
668
|
+
let options: Record<string, unknown> | undefined;
|
|
669
|
+
let model: { api?: string; id?: string } | undefined;
|
|
670
|
+
const result = await completeStructuredWithModel({
|
|
671
|
+
...baseOpts,
|
|
672
|
+
_credentialOverride: {
|
|
673
|
+
kind: "amazon-bedrock",
|
|
674
|
+
modelDefault: "amazon-bedrock/global.anthropic.claude-haiku-5-5",
|
|
675
|
+
region: "eu-west-1",
|
|
676
|
+
},
|
|
677
|
+
_complete: async (m, _ctx, opts) => {
|
|
678
|
+
model = m as { api?: string; id?: string };
|
|
679
|
+
options = opts as Record<string, unknown>;
|
|
680
|
+
return toolCallMsg();
|
|
681
|
+
},
|
|
682
|
+
});
|
|
683
|
+
|
|
684
|
+
expect(result).toEqual({
|
|
685
|
+
data: { summary: "ok", count: 1 },
|
|
686
|
+
model: "amazon-bedrock/global.anthropic.claude-haiku-5-5",
|
|
687
|
+
});
|
|
688
|
+
// The catalog entry resolves, which is the whole reason the model default is
|
|
689
|
+
// written in pi-ai's own id form.
|
|
690
|
+
expect(model?.api).toBe("bedrock-converse-stream");
|
|
691
|
+
expect(model?.id).toBe("global.anthropic.claude-haiku-5-5");
|
|
692
|
+
expect(options?.apiKey).toBeUndefined();
|
|
693
|
+
// The resolver's region travels as the adapter's own option, which is what
|
|
694
|
+
// keeps the catalog's us-east-1 base URL from overriding it.
|
|
695
|
+
expect(options?.region).toBe("eu-west-1");
|
|
696
|
+
// The adapter needs the tool forced, same as the Anthropic adapter.
|
|
697
|
+
expect(options?.toolChoice).toEqual({ type: "tool", name: "record_result" });
|
|
698
|
+
});
|
|
699
|
+
|
|
700
|
+
test("non-bedrock kinds get no provider-specific options", async () => {
|
|
701
|
+
let options: Record<string, unknown> | undefined;
|
|
702
|
+
await completeStructuredWithModel({
|
|
703
|
+
...baseOpts,
|
|
704
|
+
_credentialOverride: {
|
|
705
|
+
kind: "fireworks",
|
|
706
|
+
apiKey: "fw-key",
|
|
707
|
+
modelDefault: "fireworks/accounts/fireworks/models/deepseek-v4p1-flash",
|
|
708
|
+
},
|
|
709
|
+
_complete: async (_m, _ctx, opts) => {
|
|
710
|
+
options = opts as Record<string, unknown>;
|
|
711
|
+
return toolCallMsg();
|
|
712
|
+
},
|
|
713
|
+
});
|
|
714
|
+
expect(options?.region).toBeUndefined();
|
|
715
|
+
expect(options?.env).toBeUndefined();
|
|
716
|
+
});
|
|
717
|
+
|
|
718
|
+
test("a bedrock catalog miss is a clean null, not a throw", async () => {
|
|
719
|
+
const result = await completeStructuredWithModel({
|
|
720
|
+
...baseOpts,
|
|
721
|
+
_credentialOverride: {
|
|
722
|
+
kind: "amazon-bedrock",
|
|
723
|
+
modelDefault: "amazon-bedrock/not-a-real-model",
|
|
724
|
+
region: "us-east-1",
|
|
725
|
+
},
|
|
726
|
+
_complete: async () => toolCallMsg(),
|
|
727
|
+
});
|
|
728
|
+
expect(result).toBeNull();
|
|
729
|
+
});
|
|
730
|
+
});
|
|
@@ -393,3 +393,152 @@ describe("resolveCredentials", () => {
|
|
|
393
393
|
expect(probed).toBe(2);
|
|
394
394
|
});
|
|
395
395
|
});
|
|
396
|
+
|
|
397
|
+
describe("fireworks", () => {
|
|
398
|
+
test("FIREWORKS_API_KEY resolves through env and through pi-ai's key lookup", async () => {
|
|
399
|
+
for (const source of ["env", "fallback"] as const) {
|
|
400
|
+
const cred = await resolveCredential(
|
|
401
|
+
makeOpts({
|
|
402
|
+
env: source === "env" ? { FIREWORKS_API_KEY: "fw-key" } : {},
|
|
403
|
+
_getEnvApiKey: (provider) =>
|
|
404
|
+
source === "fallback" && provider === "fireworks" ? "fw-key" : undefined,
|
|
405
|
+
}),
|
|
406
|
+
);
|
|
407
|
+
expect(cred?.kind).toBe("fireworks");
|
|
408
|
+
if (cred?.kind === "fireworks") {
|
|
409
|
+
expect(cred.apiKey).toBe("fw-key");
|
|
410
|
+
expect(cred.modelDefault).toBe("fireworks/accounts/fireworks/models/deepseek-v4p1-flash");
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
});
|
|
414
|
+
|
|
415
|
+
test("a comma-separated pool picks one member, never the joined string", async () => {
|
|
416
|
+
const cred = await resolveCredential(
|
|
417
|
+
makeOpts({ env: { FIREWORKS_API_KEY: "fw-first, fw-second" } }),
|
|
418
|
+
);
|
|
419
|
+
expect(cred?.kind).toBe("fireworks");
|
|
420
|
+
if (cred?.kind === "fireworks") {
|
|
421
|
+
expect(["fw-first", "fw-second"]).toContain(cred.apiKey);
|
|
422
|
+
}
|
|
423
|
+
});
|
|
424
|
+
|
|
425
|
+
test("FIREWORKS_API_KEY does not outrank a key an operator set for this layer", async () => {
|
|
426
|
+
// Precedence decision: existing callers keep their provider.
|
|
427
|
+
for (const earlier of ["OPENROUTER_API_KEY", "ANTHROPIC_API_KEY", "OPENAI_API_KEY"]) {
|
|
428
|
+
const cred = await resolveCredential(
|
|
429
|
+
makeOpts({ env: { FIREWORKS_API_KEY: "fw", [earlier]: "earlier-key" } }),
|
|
430
|
+
);
|
|
431
|
+
expect(cred?.kind).not.toBe("fireworks");
|
|
432
|
+
}
|
|
433
|
+
const only = await resolveCredential(makeOpts({ env: { FIREWORKS_API_KEY: "fw" } }));
|
|
434
|
+
expect(only?.kind).toBe("fireworks");
|
|
435
|
+
});
|
|
436
|
+
});
|
|
437
|
+
|
|
438
|
+
describe("amazon-bedrock", () => {
|
|
439
|
+
/** pi-ai's `getEnvApiKey` answers the sentinel when the AWS chain is configured. */
|
|
440
|
+
const awsChain = (provider: string) =>
|
|
441
|
+
provider === "amazon-bedrock" ? "<authenticated>" : undefined;
|
|
442
|
+
|
|
443
|
+
test("resolves from the credential chain plus a region, with no apiKey field", async () => {
|
|
444
|
+
const cred = await resolveCredential(
|
|
445
|
+
makeOpts({
|
|
446
|
+
env: { AWS_PROFILE: "example-profile", AWS_REGION: "eu-west-1" },
|
|
447
|
+
_getEnvApiKey: awsChain,
|
|
448
|
+
}),
|
|
449
|
+
);
|
|
450
|
+
expect(cred).toEqual({
|
|
451
|
+
kind: "amazon-bedrock",
|
|
452
|
+
modelDefault: "amazon-bedrock/global.anthropic.claude-haiku-5-5",
|
|
453
|
+
region: "eu-west-1",
|
|
454
|
+
});
|
|
455
|
+
// The shape is the design decision: there is no apiKey to fabricate.
|
|
456
|
+
expect(cred && "apiKey" in cred).toBe(false);
|
|
457
|
+
});
|
|
458
|
+
|
|
459
|
+
test("AWS_DEFAULT_REGION is accepted when AWS_REGION is unset", async () => {
|
|
460
|
+
const cred = await resolveCredential(
|
|
461
|
+
makeOpts({
|
|
462
|
+
env: { AWS_PROFILE: "p", AWS_DEFAULT_REGION: "us-west-2" },
|
|
463
|
+
_getEnvApiKey: awsChain,
|
|
464
|
+
}),
|
|
465
|
+
);
|
|
466
|
+
expect(cred?.kind).toBe("amazon-bedrock");
|
|
467
|
+
if (cred?.kind === "amazon-bedrock") expect(cred.region).toBe("us-west-2");
|
|
468
|
+
});
|
|
469
|
+
|
|
470
|
+
test("an empty or blank AWS_REGION falls back to AWS_DEFAULT_REGION", async () => {
|
|
471
|
+
// A compose file writes `AWS_REGION=${AWS_REGION:-}`, which sets the var to
|
|
472
|
+
// an empty string. `??` would keep that and discard the real region, and
|
|
473
|
+
// Bedrock would be skipped despite a valid AWS_DEFAULT_REGION.
|
|
474
|
+
for (const blank of ["", " "]) {
|
|
475
|
+
const cred = await resolveCredential(
|
|
476
|
+
makeOpts({
|
|
477
|
+
env: { AWS_PROFILE: "p", AWS_REGION: blank, AWS_DEFAULT_REGION: "eu-west-1" },
|
|
478
|
+
_getEnvApiKey: awsChain,
|
|
479
|
+
}),
|
|
480
|
+
);
|
|
481
|
+
expect(cred?.kind).toBe("amazon-bedrock");
|
|
482
|
+
if (cred?.kind === "amazon-bedrock") expect(cred.region).toBe("eu-west-1");
|
|
483
|
+
}
|
|
484
|
+
});
|
|
485
|
+
|
|
486
|
+
test("no region → clean no-op rather than a guessed us-east-1", async () => {
|
|
487
|
+
const cred = await resolveCredential(
|
|
488
|
+
makeOpts({ env: { AWS_PROFILE: "p" }, _getEnvApiKey: awsChain }),
|
|
489
|
+
);
|
|
490
|
+
expect(cred).toBeNull();
|
|
491
|
+
});
|
|
492
|
+
|
|
493
|
+
test("no credential chain → clean no-op even with a region", async () => {
|
|
494
|
+
expect(await resolveCredential(makeOpts({ env: { AWS_REGION: "us-east-1" } }))).toBeNull();
|
|
495
|
+
});
|
|
496
|
+
|
|
497
|
+
test("region whitespace alone is not a region", async () => {
|
|
498
|
+
const cred = await resolveCredential(
|
|
499
|
+
makeOpts({ env: { AWS_PROFILE: "p", AWS_REGION: " " }, _getEnvApiKey: awsChain }),
|
|
500
|
+
);
|
|
501
|
+
expect(cred).toBeNull();
|
|
502
|
+
});
|
|
503
|
+
|
|
504
|
+
test("sits after fireworks and after every key-based kind", async () => {
|
|
505
|
+
const withKeys = await resolveCredentials(
|
|
506
|
+
makeOpts({
|
|
507
|
+
env: {
|
|
508
|
+
OPENROUTER_API_KEY: "or",
|
|
509
|
+
FIREWORKS_API_KEY: "fw",
|
|
510
|
+
AWS_PROFILE: "p",
|
|
511
|
+
AWS_REGION: "us-east-1",
|
|
512
|
+
},
|
|
513
|
+
_getEnvApiKey: awsChain,
|
|
514
|
+
}),
|
|
515
|
+
);
|
|
516
|
+
expect(withKeys.map((cred) => cred.kind)).toEqual([
|
|
517
|
+
"openrouter",
|
|
518
|
+
"fireworks",
|
|
519
|
+
"amazon-bedrock",
|
|
520
|
+
]);
|
|
521
|
+
|
|
522
|
+
const ambientOnly = await resolveCredentials(
|
|
523
|
+
makeOpts({
|
|
524
|
+
env: { AWS_PROFILE: "p", AWS_REGION: "us-east-1" },
|
|
525
|
+
_getEnvApiKey: awsChain,
|
|
526
|
+
}),
|
|
527
|
+
);
|
|
528
|
+
expect(ambientOnly.map((cred) => cred.kind)).toEqual(["amazon-bedrock"]);
|
|
529
|
+
});
|
|
530
|
+
|
|
531
|
+
test("a pinned rater model applies to the bedrock credential too", async () => {
|
|
532
|
+
const saved = process.env.MEMORY_RATER_MODEL;
|
|
533
|
+
process.env.MEMORY_RATER_MODEL = "amazon-bedrock/us.anthropic.claude-haiku-5-5";
|
|
534
|
+
try {
|
|
535
|
+
const cred = await resolveCredential(
|
|
536
|
+
makeOpts({ env: { AWS_PROFILE: "p", AWS_REGION: "us-east-1" }, _getEnvApiKey: awsChain }),
|
|
537
|
+
);
|
|
538
|
+
expect(cred?.modelDefault).toBe("amazon-bedrock/us.anthropic.claude-haiku-5-5");
|
|
539
|
+
} finally {
|
|
540
|
+
if (saved === undefined) delete process.env.MEMORY_RATER_MODEL;
|
|
541
|
+
else process.env.MEMORY_RATER_MODEL = saved;
|
|
542
|
+
}
|
|
543
|
+
});
|
|
544
|
+
});
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import { getBuiltinModel } from "@earendil-works/pi-ai/providers/all";
|
|
2
3
|
import type { completeStructuredWithModel } from "../../utils/internal-ai/complete-structured.js";
|
|
3
4
|
import type {
|
|
4
5
|
CredentialKind,
|
|
5
6
|
ResolvedCredential,
|
|
6
7
|
resolveCredentials,
|
|
7
8
|
} from "../../utils/internal-ai/credentials.js";
|
|
9
|
+
import {
|
|
10
|
+
DEFAULT_MODEL,
|
|
11
|
+
MEMORY_RATER_DEFAULT_MODEL,
|
|
12
|
+
parseModelStr,
|
|
13
|
+
} from "../../utils/internal-ai/models.js";
|
|
8
14
|
import {
|
|
9
15
|
buildTaskTitlePlan,
|
|
10
16
|
generateTaskTitle,
|
|
@@ -108,6 +114,8 @@ describe("buildTaskTitlePlan", () => {
|
|
|
108
114
|
"anthropic",
|
|
109
115
|
"openai-codex",
|
|
110
116
|
"claude-cli",
|
|
117
|
+
"fireworks",
|
|
118
|
+
"amazon-bedrock",
|
|
111
119
|
]);
|
|
112
120
|
});
|
|
113
121
|
|
|
@@ -132,6 +140,49 @@ describe("buildTaskTitlePlan", () => {
|
|
|
132
140
|
expect(kindForModelString("haiku")).toBe("claude-cli");
|
|
133
141
|
expect(kindForModelString("mistral/ministral-3b")).toBeNull();
|
|
134
142
|
});
|
|
143
|
+
|
|
144
|
+
test("kindForModelString recognises the two new providers", () => {
|
|
145
|
+
expect(kindForModelString("fireworks/accounts/fireworks/models/deepseek-v4p1-flash")).toBe(
|
|
146
|
+
"fireworks",
|
|
147
|
+
);
|
|
148
|
+
expect(kindForModelString("amazon-bedrock/global.anthropic.claude-haiku-5-5")).toBe(
|
|
149
|
+
"amazon-bedrock",
|
|
150
|
+
);
|
|
151
|
+
// No regression on the compound-id and bare-alias shapes.
|
|
152
|
+
expect(kindForModelString("openrouter/anthropic/claude-haiku-5.5")).toBe("openrouter");
|
|
153
|
+
expect(kindForModelString("sonnet")).toBe("claude-cli");
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
test("pinning either new provider moves it first with its own fallbacks", () => {
|
|
157
|
+
const fireworks = buildTaskTitlePlan({
|
|
158
|
+
[TASK_TITLE_MODEL_ENV]: "fireworks/accounts/fireworks/routers/kimi-k3-fast",
|
|
159
|
+
});
|
|
160
|
+
expect(fireworks[0]).toEqual({
|
|
161
|
+
kind: "fireworks",
|
|
162
|
+
models: [
|
|
163
|
+
"fireworks/accounts/fireworks/routers/kimi-k3-fast",
|
|
164
|
+
"fireworks/accounts/fireworks/models/deepseek-v4p1-flash",
|
|
165
|
+
"fireworks/accounts/fireworks/models/glm-5p3-flash",
|
|
166
|
+
],
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
const bedrock = buildTaskTitlePlan({
|
|
170
|
+
[TASK_TITLE_MODEL_ENV]: "amazon-bedrock/eu.anthropic.claude-haiku-5-5",
|
|
171
|
+
});
|
|
172
|
+
expect(bedrock[0].kind).toBe("amazon-bedrock");
|
|
173
|
+
expect(bedrock[0].models[0]).toBe("amazon-bedrock/eu.anthropic.claude-haiku-5-5");
|
|
174
|
+
// A region-scoped pin does not displace the shipped defaults behind it.
|
|
175
|
+
expect(bedrock[0].models).toContain("amazon-bedrock/global.anthropic.claude-haiku-5-5");
|
|
176
|
+
expect(bedrock.map((group) => group.kind)).toEqual([
|
|
177
|
+
"amazon-bedrock",
|
|
178
|
+
"openrouter",
|
|
179
|
+
"anthropic",
|
|
180
|
+
"openai",
|
|
181
|
+
"openai-codex",
|
|
182
|
+
"claude-cli",
|
|
183
|
+
"fireworks",
|
|
184
|
+
]);
|
|
185
|
+
});
|
|
135
186
|
});
|
|
136
187
|
|
|
137
188
|
describe("generateTaskTitle", () => {
|
|
@@ -281,3 +332,30 @@ describe("generateTaskTitle", () => {
|
|
|
281
332
|
expect(models).toEqual([]);
|
|
282
333
|
});
|
|
283
334
|
});
|
|
335
|
+
|
|
336
|
+
describe("catalog verification for the new kinds", () => {
|
|
337
|
+
// Every default the registries name must resolve in pi-ai's own catalog: a
|
|
338
|
+
// miss is a silent null from `completeStructured`, which would leave titling
|
|
339
|
+
// and summarization dead in exactly the deployments this change is for.
|
|
340
|
+
test("DEFAULT_MODEL and MEMORY_RATER_DEFAULT_MODEL all exist in pi-ai's catalog", () => {
|
|
341
|
+
for (const registry of [DEFAULT_MODEL, MEMORY_RATER_DEFAULT_MODEL]) {
|
|
342
|
+
for (const [kind, modelStr] of Object.entries(registry)) {
|
|
343
|
+
if (kind === "claude-cli") continue; // a `claude -p` alias, not a pi-ai model
|
|
344
|
+
const [provider, modelId] = parseModelStr(modelStr);
|
|
345
|
+
expect(provider).toBe(kind);
|
|
346
|
+
expect(getBuiltinModel(provider as never, modelId as never)).toBeTruthy();
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
});
|
|
350
|
+
|
|
351
|
+
test("every titling candidate resolves in pi-ai's catalog", () => {
|
|
352
|
+
for (const group of TASK_TITLE_MODEL_CANDIDATES) {
|
|
353
|
+
if (group.kind === "claude-cli") continue;
|
|
354
|
+
for (const modelStr of group.models) {
|
|
355
|
+
const [provider, modelId] = parseModelStr(modelStr);
|
|
356
|
+
expect(provider).toBe(group.kind);
|
|
357
|
+
expect(getBuiltinModel(provider as never, modelId as never)).toBeTruthy();
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
});
|
|
361
|
+
});
|
|
@@ -65,7 +65,7 @@ describe("jira/adf — extractText", () => {
|
|
|
65
65
|
expect(extractText(adf)).toBe("ping @557058:xyz");
|
|
66
66
|
});
|
|
67
67
|
|
|
68
|
-
test("handles bullet lists", () => {
|
|
68
|
+
test("handles bullet and ordered lists", () => {
|
|
69
69
|
const adf = {
|
|
70
70
|
type: "doc",
|
|
71
71
|
content: [
|
|
@@ -97,9 +97,27 @@ describe("jira/adf — extractText", () => {
|
|
|
97
97
|
const out = extractText(adf);
|
|
98
98
|
expect(out).toContain("- alpha");
|
|
99
99
|
expect(out).toContain("- beta");
|
|
100
|
+
|
|
101
|
+
// An ordered list numbers its items; `attrs.order` sets the first number.
|
|
102
|
+
const ordered = (attrs?: Record<string, unknown>) => ({
|
|
103
|
+
type: "doc",
|
|
104
|
+
content: [
|
|
105
|
+
{
|
|
106
|
+
type: "orderedList",
|
|
107
|
+
...(attrs ? { attrs } : {}),
|
|
108
|
+
content: ["first", "second"].map((text) => ({
|
|
109
|
+
type: "listItem",
|
|
110
|
+
content: [{ type: "paragraph", content: [{ type: "text", text }] }],
|
|
111
|
+
})),
|
|
112
|
+
},
|
|
113
|
+
],
|
|
114
|
+
});
|
|
115
|
+
expect(extractText(ordered())).toBe("1. first\n2. second");
|
|
116
|
+
expect(extractText(ordered({ order: 3 }))).toBe("3. first\n4. second");
|
|
117
|
+
expect(extractText(ordered({ order: 0 }))).toBe("0. first\n1. second");
|
|
100
118
|
});
|
|
101
119
|
|
|
102
|
-
test("handles headings, codeBlock, blockquote, hardBreak", () => {
|
|
120
|
+
test("handles headings, codeBlock, blockquote, hardBreak and link cards", () => {
|
|
103
121
|
const adf = {
|
|
104
122
|
type: "doc",
|
|
105
123
|
content: [
|
|
@@ -136,6 +154,28 @@ describe("jira/adf — extractText", () => {
|
|
|
136
154
|
expect(out).toContain("line1\nline2");
|
|
137
155
|
expect(out).toContain("echo hi");
|
|
138
156
|
expect(out).toContain("quoted");
|
|
157
|
+
|
|
158
|
+
// Cards carry their link in attrs.url and have no content to walk, so the
|
|
159
|
+
// walker used to drop them. Block and embed cards end their own line like a
|
|
160
|
+
// paragraph; an inline card joins the line of text around it.
|
|
161
|
+
const cards = {
|
|
162
|
+
type: "doc",
|
|
163
|
+
content: [
|
|
164
|
+
{
|
|
165
|
+
type: "paragraph",
|
|
166
|
+
content: [
|
|
167
|
+
{ type: "text", text: "Links: " },
|
|
168
|
+
{ type: "inlineCard", attrs: { url: "https://wiki.example/pages/123" } },
|
|
169
|
+
],
|
|
170
|
+
},
|
|
171
|
+
{ type: "blockCard", attrs: { url: "https://github.com/acme/repo/pull/1" } },
|
|
172
|
+
{ type: "embedCard", attrs: { url: "https://embed.example/2" } },
|
|
173
|
+
{ type: "paragraph", content: [{ type: "text", text: "after" }] },
|
|
174
|
+
],
|
|
175
|
+
};
|
|
176
|
+
expect(extractText(cards)).toBe(
|
|
177
|
+
"Links: https://wiki.example/pages/123\nhttps://github.com/acme/repo/pull/1\nhttps://embed.example/2\nafter",
|
|
178
|
+
);
|
|
139
179
|
});
|
|
140
180
|
|
|
141
181
|
test("descends into unknown node content rather than dropping it", () => {
|
|
@@ -166,7 +166,12 @@ async function openSession(path: string, headers: Record<string, string>): Promi
|
|
|
166
166
|
return init.sessionId;
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
-
/**
|
|
169
|
+
/**
|
|
170
|
+
* POST `totalBytes` with no Content-Length (chunked), so only the streaming cap can stop it.
|
|
171
|
+
* The body is never ended: the server answers 413 and closes the socket as soon as the cap is
|
|
172
|
+
* crossed. Bytes still in flight at that point make the close a TCP reset that can drop the
|
|
173
|
+
* response, so callers send exactly one byte over the cap.
|
|
174
|
+
*/
|
|
170
175
|
function postChunked(
|
|
171
176
|
path: string,
|
|
172
177
|
headers: Record<string, string>,
|
|
@@ -188,25 +193,25 @@ function postChunked(
|
|
|
188
193
|
body += chunk;
|
|
189
194
|
});
|
|
190
195
|
res.on("error", reject);
|
|
191
|
-
res.on("end", () =>
|
|
196
|
+
res.on("end", () => {
|
|
197
|
+
resolve({ status: res.statusCode ?? 0, body });
|
|
198
|
+
req.destroy();
|
|
199
|
+
});
|
|
192
200
|
},
|
|
193
201
|
);
|
|
194
|
-
//
|
|
195
|
-
req.on("error",
|
|
196
|
-
if (error.code === "EPIPE") return;
|
|
197
|
-
reject(error);
|
|
198
|
-
});
|
|
202
|
+
// An error after the response is complete is just our own teardown.
|
|
203
|
+
req.on("error", reject);
|
|
199
204
|
const chunk = Buffer.alloc(64 * 1024, 0x20);
|
|
200
205
|
let sent = 0;
|
|
201
206
|
const pump = () => {
|
|
202
207
|
while (sent < totalBytes) {
|
|
203
|
-
|
|
204
|
-
|
|
208
|
+
const part = chunk.subarray(0, Math.min(chunk.byteLength, totalBytes - sent));
|
|
209
|
+
sent += part.byteLength;
|
|
210
|
+
if (!req.write(part)) {
|
|
205
211
|
req.once("drain", pump);
|
|
206
212
|
return;
|
|
207
213
|
}
|
|
208
214
|
}
|
|
209
|
-
req.end();
|
|
210
215
|
};
|
|
211
216
|
pump();
|
|
212
217
|
});
|
|
@@ -282,7 +287,7 @@ for (const surface of surfaces) {
|
|
|
282
287
|
const { status, body } = await postChunked(
|
|
283
288
|
surface.path,
|
|
284
289
|
headers,
|
|
285
|
-
MCP_MAX_REQUEST_BODY_BYTES +
|
|
290
|
+
MCP_MAX_REQUEST_BODY_BYTES + 1,
|
|
286
291
|
);
|
|
287
292
|
expect(status).toBe(413);
|
|
288
293
|
expect(JSON.parse(body)).toEqual({
|