@desplega.ai/agent-swarm 2.5.3 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/{acp-adapter-gr2fcyyj.js → acp-adapter-dgfakfpw.js} +9 -9
- package/dist/{actions-wv766ghf.js → actions-fbqma8aa.js} +21 -21
- package/dist/{amp-adapter-speb906t.js → amp-adapter-en0jy6hs.js} +4 -4
- package/dist/{app-ag29n14f.js → app-k8a5cgpp.js} +3 -3
- package/dist/{assistant-3x8bz3eg.js → assistant-a16433gr.js} +30 -26
- package/dist/{boot-reembed-jsmfrpzf.js → boot-reembed-6c1sjfnr.js} +1 -1
- package/dist/{boot-reembed-5b3d2eea.js → boot-reembed-f4nn561n.js} +1 -1
- package/dist/{boot-scrub-sweep-s73gerxy.js → boot-scrub-sweep-d4w9gajf.js} +4 -4
- package/dist/{boot-seeds-5zmax2wr.js → boot-seeds-9bmkspyw.js} +4 -4
- package/dist/{claude-adapter-hswdnm3t.js → claude-adapter-nys1kjxa.js} +9 -9
- package/dist/{claude-managed-adapter-cvbzj1h6.js → claude-managed-adapter-55207973.js} +3 -3
- package/dist/{claude-managed-setup-3k8m3hhc.js → claude-managed-setup-3cm35gey.js} +11 -4
- package/dist/{claude-sdk-session-fkbyk66x.js → claude-sdk-session-nw5yd8cp.js} +9313 -9260
- package/dist/{cli-210xd1f4.js → cli-03gg9pd1.js} +4 -4
- package/dist/{cli-kxpfx2xr.js → cli-0z1xjzwa.js} +2 -2
- package/dist/cli-1tem6ns9.js +894 -0
- package/dist/{cli-25j01dpj.js → cli-24j1jeeb.js} +3 -3
- package/dist/{cli-ta8bd7th.js → cli-2sjhpsns.js} +2 -2
- package/dist/{cli-p859hcc8.js → cli-39aet655.js} +2 -2
- package/dist/{cli-g1cw7xtt.js → cli-39rrw8yp.js} +1 -1
- package/dist/{cli-e2ar4bp1.js → cli-3aqd4jaa.js} +121 -47
- package/dist/{cli-jjznk3f7.js → cli-3fwqy71j.js} +69 -35
- package/dist/{cli-p9rafdrb.js → cli-3gfvmzht.js} +7 -7
- package/dist/{cli-03vpq45j.js → cli-3ndmpxxv.js} +2 -2
- package/dist/{cli-aecdcr77.js → cli-4hxrf0p4.js} +228 -74
- package/dist/{cli-mz9afxxf.js → cli-4rf0f5vg.js} +15 -3
- package/dist/{cli-qzme5949.js → cli-5rj83bam.js} +284 -202
- package/dist/{cli-fsdprwrg.js → cli-5sckpqcx.js} +2 -2
- package/dist/{cli-cz5nmdxt.js → cli-683y0b3a.js} +2 -2
- package/dist/{cli-3ngdk5te.js → cli-6y51ryva.js} +2 -2
- package/dist/{cli-n4c8e3s5.js → cli-708wdy32.js} +1 -1
- package/dist/{cli-pasyvjmm.js → cli-737pyqxr.js} +1 -1
- package/dist/{cli-gx4rm0qx.js → cli-7enjwya9.js} +1 -1
- package/dist/{cli-6x9ma5w5.js → cli-803188pb.js} +1 -1
- package/dist/{cli-avdvgcay.js → cli-9abdgn5t.js} +28 -9
- package/dist/{cli-99xgw26r.js → cli-a2rr0fmg.js} +1 -1
- package/dist/{cli-e5bxnjps.js → cli-a34pr3w1.js} +7 -7
- package/dist/{cli-502eqv93.js → cli-abkm71vr.js} +1 -1
- package/dist/{cli-mmhj8vd7.js → cli-ag2yrnt5.js} +11 -2
- package/dist/{cli-n45mr7zh.js → cli-aj8djyqt.js} +5 -5
- package/dist/{cli-1fc85mvt.js → cli-art7c1zh.js} +5 -5
- package/dist/{cli-40jsnrjm.js → cli-az25fn5f.js} +10 -8
- package/dist/{cli-9s05422w.js → cli-bqztfyve.js} +1 -1
- package/dist/{cli-bn0rewsy.js → cli-c081bj3b.js} +2 -2
- package/dist/{cli-svrj71pg.js → cli-c2habvsf.js} +12 -12
- package/dist/{cli-s49hpn37.js → cli-ca6banwz.js} +85 -19
- package/dist/{cli-hhxjnjzs.js → cli-cz37jqss.js} +12 -10
- package/dist/{cli-6n8axjv1.js → cli-d2dpf95n.js} +2 -2
- package/dist/{cli-tx00c0h6.js → cli-dqygeeh5.js} +17 -1
- package/dist/{cli-z21whrrg.js → cli-emhjcj2y.js} +17 -17
- package/dist/{cli-e8jyq7d8.js → cli-esakngh8.js} +7 -3
- package/dist/{cli-ha9rmwgq.js → cli-fb8m699c.js} +2 -2
- package/dist/{cli-35gtk1p6.js → cli-ffvsj2qw.js} +44 -13
- package/dist/{cli-ce0ak9ms.js → cli-g20jjwt4.js} +26 -26
- package/dist/{cli-kxawjrxg.js → cli-g8ka5j4j.js} +772 -194
- package/dist/{cli-vwn81jbs.js → cli-gf95q3bm.js} +5 -5
- package/dist/{cli-s53vp709.js → cli-gnsb1zxa.js} +2 -2
- package/dist/{cli-nwyw3zhg.js → cli-gxee0bqa.js} +1 -1
- package/dist/{cli-gpv60278.js → cli-hfeb68z4.js} +7 -7
- package/dist/{cli-0ebey9hg.js → cli-j6rktc91.js} +1 -1
- package/dist/{cli-ewm3pwbq.js → cli-k21gx5ht.js} +46 -23
- package/dist/{cli-egjggehm.js → cli-kf4jree9.js} +2 -2
- package/dist/{cli-dabehxhp.js → cli-kt907da6.js} +1 -1
- package/dist/{cli-p0rzjkya.js → cli-m5a9m0ak.js} +32 -13
- package/dist/{cli-fzcn3d87.js → cli-m70bajzr.js} +3 -3
- package/dist/{cli-w1zwctj2.js → cli-mtnj4fwa.js} +11 -5
- package/dist/{cli-gpsz7g88.js → cli-mvjz5an3.js} +16 -12
- package/dist/{cli-hcpj2xqz.js → cli-n7asmce6.js} +225 -3
- package/dist/{cli-y561h5a9.js → cli-nn6vx2mq.js} +5 -5
- package/dist/cli-nq677csy.js +140 -0
- package/dist/{cli-a5ebc95n.js → cli-pfk92eqz.js} +18 -15
- package/dist/{cli-p6zs9h4y.js → cli-rr7zx19j.js} +767 -249
- package/dist/{cli-qgf8emrn.js → cli-sqma6vw1.js} +10 -7
- package/dist/{cli-0xk505e8.js → cli-sxgtf5fw.js} +1 -1
- package/dist/{cli-nzfnt2gs.js → cli-tf1n0r0b.js} +1 -1
- package/dist/{cli-qqzmjxkf.js → cli-v49fkghp.js} +11 -6
- package/dist/{cli-x77gen2p.js → cli-w2656ka1.js} +7 -7
- package/dist/{cli-5kqnemen.js → cli-yvy48785.js} +1 -1
- package/dist/{cli-8s5wx3nz.js → cli-zqne1qcj.js} +44 -17
- package/dist/cli.js +22 -22
- package/dist/{codex-adapter-n8ka66vf.js → codex-adapter-d95q4qsn.js} +7 -7
- package/dist/{codex-hook-e2he7aca.js → codex-hook-brpnycn5.js} +1 -1
- package/dist/{codex-login-rn7c5gxt.js → codex-login-8cg0vhf2.js} +1 -1
- package/dist/{codex-session-runner-fsebts37.js → codex-session-runner-gdwd8h0c.js} +8 -8
- package/dist/{commands-t04rt2pc.js → commands-jqmgk54b.js} +2 -2
- package/dist/{controller-rgna04r2.js → controller-z3jq589f.js} +30 -4
- package/dist/{controllers-connect-bqm1rtft.js → controllers-connect-r2za39ef.js} +23 -23
- package/dist/{cursor-adapter-swr2k95y.js → cursor-adapter-4mr4jgkw.js} +2 -3
- package/dist/{db-a4m7haw0.js → db-ppv2tze7.js} +3 -3
- package/dist/{db-24ck09xy.js → db-w36wwb5g.js} +4 -2
- package/dist/{devin-adapter-4ycy4vrf.js → devin-adapter-byen2cxt.js} +1 -1
- package/dist/{dispatcher-nwf9ss0q.js → dispatcher-pv5h77vf.js} +20 -20
- package/dist/{docker-nfy2gc8t.js → docker-fdzyewpz.js} +4 -4
- package/dist/{dsh-adapter-kpdnhjst.js → dsh-adapter-d4pdpb3r.js} +2 -3
- package/dist/{e2b-9gkdhm3c.js → e2b-222hsajc.js} +2 -2
- package/dist/{e2b-cjtf8k1z.js → e2b-fn3zacvt.js} +2 -2
- package/dist/{easter-egg-3d-e4qv8dxj.js → easter-egg-3d-4sp4dvmc.js} +1 -1
- package/dist/{event-bus-3z78ep5n.js → event-bus-pghg8hqy.js} +1 -1
- package/dist/{execute-0xpz8950.js → execute-jev839y1.js} +1 -1
- package/dist/{external-channel-j1e2p34p.js → external-channel-y6nkzhnn.js} +2 -2
- package/dist/{grok-adapter-qtjz0whk.js → grok-adapter-t08b9ntm.js} +10 -10
- package/dist/handlers-eqsnmv95.js +41 -0
- package/dist/{heartbeat-vtesda5d.js → heartbeat-vn31xwdk.js} +23 -23
- package/dist/{hook-b2hhj6rd.js → hook-6d0zbvvt.js} +6 -5
- package/dist/{hook-8wqaszda.js → hook-cpjs8q51.js} +13 -7
- package/dist/{http-mxcqhhcs.js → http-9c6medda.js} +1085 -136
- package/dist/{index-spwxjgay.js → index-38t35h0n.js} +20 -20
- package/dist/{index-1r8wfpzs.js → index-g6k9tctj.js} +1 -1
- package/dist/{index-srg522m6.js → index-k0yt1tvq.js} +20 -20
- package/dist/{index-31ceyf42.js → index-pkma1yf8.js} +1 -1
- package/dist/{index-n1vbvta9.js → index-qhjf2htm.js} +29 -24
- package/dist/index-yqgbfgaj.js +43 -0
- package/dist/{keepalive-dsd8rtgx.js → keepalive-em0117bp.js} +4 -4
- package/dist/lead-23e7z59t.js +79 -0
- package/dist/{maintenance-jqmqwnet.js → maintenance-kbme3qy9.js} +1 -1
- package/dist/{oauth-refresh-sweep-q2c3bnvm.js → oauth-refresh-sweep-xysj4yse.js} +3 -3
- package/dist/{onboard-w4yd7s8t.js → onboard-p6q0vz97.js} +3 -3
- package/dist/{opencode-adapter-9tppvxar.js → opencode-adapter-esv3k9yn.js} +7 -7
- package/dist/{otel-impl-f36byzbd.js → otel-impl-54qhqh1z.js} +2 -2
- package/dist/{pi-mono-adapter-tqsge1ay.js → pi-mono-adapter-mymbwhj0.js} +41 -14
- package/dist/{pricing-refresh-xvak5p4v.js → pricing-refresh-yb75wv33.js} +3 -3
- package/dist/{rbac-roles-gfn30fb8.js → rbac-roles-1vp2mw4p.js} +2 -2
- package/dist/{rbac-roles-682k2mt5.js → rbac-roles-dexhc9x8.js} +1 -1
- package/dist/render-v2-tjay5hhf.js +16 -0
- package/dist/{resume-2dvq348g.js → resume-8ayf37g5.js} +11 -9
- package/dist/{runtime-bt5pkpm1.js → runtime-hqe5cqcd.js} +1 -1
- package/dist/{session-access-7f21ekq9.js → session-access-fdhp987s.js} +4 -4
- package/dist/session-source-backfill-qgtc86z1.js +110 -0
- package/dist/{setup-epffxtbk.js → setup-4rrmqcq3.js} +1 -1
- package/dist/{virtual-modules-mnfbh5mr.js → virtual-modules-52km00d6.js} +2 -2
- package/dist/{work-objects-xz1a5rqk.js → work-objects-p28fgd70.js} +23 -23
- package/dist/worker-e3w7vye1.js +79 -0
- package/dist/{x-pbpezr0s.js → x-wxrzvzx8.js} +2 -2
- package/openapi.json +1323 -16
- package/package.json +5 -5
- package/plugin/commands/create-pr.md +2 -2
- package/plugin/pi-skills/create-pr/SKILL.md +2 -2
- package/src/assets/source-key.ts +95 -0
- package/src/be/db/api-keys.ts +80 -0
- package/src/be/db/approvals.ts +48 -0
- package/src/be/db/session-labels.ts +28 -0
- package/src/be/db/session-moves.ts +5 -6
- package/src/be/db/session-tree.ts +153 -14
- package/src/be/db/tasks/read.ts +11 -0
- package/src/be/db/tasks/write.ts +21 -6
- package/src/be/db/workflow-idempotency.ts +183 -0
- package/src/be/db/workflow-runs.ts +500 -7
- package/src/be/db-retention.ts +61 -6
- package/src/be/db.ts +126 -131
- package/src/be/memory/providers/openai-embedding.ts +5 -1
- package/src/be/migrations/242_workflow_idempotency_keys.sql +40 -0
- package/src/be/migrations/244_api_key_validation.sql +4 -0
- package/src/be/onboarding.ts +4 -0
- package/src/be/scripts/typecheck.ts +1 -1
- package/src/be/sealed-json.ts +1 -0
- package/src/be/seed-scripts/catalog/compound-insights.inline.ts +2 -2
- package/src/be/seed-scripts/catalog/compound-insights.ts +2 -2
- package/src/be/seed-skills/bundled-files.generated.json +1 -1
- package/src/be/session-source-backfill.ts +163 -0
- package/src/be/sql-connections.ts +7 -1
- package/src/be/swarm-config-guard.ts +3 -0
- package/src/be/users.ts +9 -0
- package/src/comb/review-batch.ts +28 -1
- package/src/comb/templates.ts +7 -2
- package/src/commands/claude-managed-setup.ts +7 -1
- package/src/commands/controller.ts +33 -0
- package/src/commands/credential-refresh.ts +76 -1
- package/src/commands/credential-wait.ts +2 -2
- package/src/commands/provider-credentials.ts +210 -170
- package/src/commands/runner.ts +31 -6
- package/src/extensions/apply-task-create.ts +64 -11
- package/src/extensions/contract-types.generated.ts +1 -1
- package/src/extensions/contract.ts +30 -0
- package/src/extensions/dispatcher.ts +4 -0
- package/src/extensions/post-bridge.ts +8 -0
- package/src/hooks/context-bound-note.ts +196 -0
- package/src/hooks/hook.ts +12 -0
- package/src/http/all-routes.ts +2 -0
- package/src/http/api-keys.ts +53 -0
- package/src/http/assets.ts +15 -0
- package/src/http/codex-oauth-accounts.ts +191 -0
- package/src/http/comb.ts +15 -2
- package/src/http/config.ts +49 -17
- package/src/http/core.ts +6 -0
- package/src/http/fleet-benchmark.ts +5 -2
- package/src/http/idempotency-key.ts +117 -0
- package/src/http/index.ts +11 -0
- package/src/http/integrations.ts +5 -1
- package/src/http/kv.ts +8 -3
- package/src/http/onboarding.ts +6 -1
- package/src/http/pool-keys.ts +354 -0
- package/src/http/sessions.ts +37 -12
- package/src/http/stats.ts +1 -0
- package/src/http/status.ts +26 -12
- package/src/http/tasks.ts +3 -0
- package/src/http/used-by.ts +7 -2
- package/src/http/workflows.ts +207 -33
- package/src/integrations/chat-sdk/inbound.ts +27 -0
- package/src/kv-reserved-namespaces.ts +19 -0
- package/src/prompts/context-bound-note.ts +48 -0
- package/src/prompts/session-templates.ts +25 -1
- package/src/providers/acp-targets.ts +1 -1
- package/src/providers/amp-adapter.ts +30 -8
- package/src/providers/claude-adapter.ts +34 -5
- package/src/providers/claude-managed-adapter.ts +42 -9
- package/src/providers/claude-sdk-session.ts +10 -0
- package/src/providers/claude-session-events.ts +13 -0
- package/src/providers/codex-adapter.ts +83 -11
- package/src/providers/opencode-adapter.ts +18 -0
- package/src/providers/pi-mono-adapter.ts +35 -0
- package/src/runtime-providers/docker.ts +6 -2
- package/src/scheduler/scheduler.ts +3 -2
- package/src/scripts-runtime/swarm-sdk.ts +7 -1
- package/src/scripts-runtime/types/stdlib.d.ts +1 -1
- package/src/scripts-runtime/types/swarm-extension.d.ts +52 -8
- package/src/scripts-runtime/types/swarm-sdk.d.ts +1 -1
- package/src/slack/assistant.ts +7 -0
- package/src/slack/channel-labels.ts +74 -0
- package/src/slack/handlers.ts +8 -0
- package/src/slack/inbound-files.ts +5 -2
- package/src/slack/thread-buffer.ts +4 -0
- package/src/tasks/sibling-awareness.ts +12 -3
- package/src/telemetry-context.ts +5 -6
- package/src/telemetry-identity.ts +3 -3
- package/src/tests/amp-adapter.test.ts +97 -0
- package/src/tests/api-keys-validation.test.ts +170 -0
- package/src/tests/approval-requests.test.ts +10 -7
- package/src/tests/approval-sweeps.test.ts +12 -6
- package/src/tests/base-prompt.test.ts +1 -1
- package/src/tests/claude-hook-output.test.ts +79 -1
- package/src/tests/claude-managed-adapter.test.ts +321 -0
- package/src/tests/claude-routes-e2e.test.ts +7 -2
- package/src/tests/codex-adapter.test.ts +163 -0
- package/src/tests/codex-credential-pools.test.ts +120 -0
- package/src/tests/codex-gateway-route.test.ts +165 -0
- package/src/tests/codex-oauth-accounts.test.ts +357 -0
- package/src/tests/comb-review-batch.test.ts +63 -2
- package/src/tests/config-pool-keys.test.ts +533 -0
- package/src/tests/context-bound-note.test.ts +269 -0
- package/src/tests/credential-check.test.ts +290 -2
- package/src/tests/credential-refresh.test.ts +172 -1
- package/src/tests/db-retention.test.ts +9 -3
- package/src/tests/db-task-read-contract.test.ts +1 -0
- package/src/tests/db-task-write-contract.test.ts +1 -3
- package/src/tests/docs-index-footprint.test.js +3 -3
- package/src/tests/extensions-pre-task.test.ts +325 -0
- package/src/tests/fetch-resolved-env.test.ts +17 -0
- package/src/tests/fixtures/extensions/record-blocks/hooks.ts +10 -0
- package/src/tests/fixtures/extensions/record-blocks/manifest.json +7 -0
- package/src/tests/fixtures/extensions/record-task-create/hooks.ts +9 -0
- package/src/tests/fixtures/extensions/record-task-create/manifest.json +7 -0
- package/src/tests/fixtures/fake-amp.ts +22 -8
- package/src/tests/fixtures/held-template-render.ts +42 -0
- package/src/tests/fixtures/workflow-idempotency-trigger.child.ts +73 -0
- package/src/tests/fleet-benchmark.test.ts +8 -0
- package/src/tests/get-workflow-run-tool.test.ts +98 -0
- package/src/tests/integrations-http.test.ts +32 -2
- package/src/tests/internal-ai/complete-structured.test.ts +37 -1
- package/src/tests/internal-ai/credentials.test.ts +23 -0
- package/src/tests/kv-http.test.ts +32 -0
- package/src/tests/kv-tool.test.ts +25 -0
- package/src/tests/multi-runtime-registration.test.ts +12 -12
- package/src/tests/onboarding.test.ts +108 -1
- package/src/tests/openai-embedding-credentials.test.ts +35 -0
- package/src/tests/openapi-route-headers.test.ts +2 -0
- package/src/tests/opencode-adapter.test.ts +134 -0
- package/src/tests/openrouter-attribution-call-sites.test.ts +2 -2
- package/src/tests/org-website.test.ts +36 -0
- package/src/tests/pi-mono-adapter.test.ts +105 -0
- package/src/tests/prompt-template-session.test.ts +4 -3
- package/src/tests/provider-key-probes.test.ts +181 -0
- package/src/tests/rbac-e2e-helpers.test.ts +88 -1
- package/src/tests/rbac-e2e-helpers.ts +36 -11
- package/src/tests/runner-push-delivery.test.ts +25 -0
- package/src/tests/runtime-controller-liveness.test.ts +133 -0
- package/src/tests/runtime-providers-docker.test.ts +2 -0
- package/src/tests/script-connections.test.ts +5 -0
- package/src/tests/script-run-config-scope.test.ts +91 -3
- package/src/tests/script-runs-retention.test.ts +212 -0
- package/src/tests/sdk-allowlist.test.ts +39 -0
- package/src/tests/session-logs.test.ts +70 -0
- package/src/tests/session-source-backfill.test.ts +429 -0
- package/src/tests/session-source-keys.test.ts +236 -0
- package/src/tests/session-source-labels.test.ts +419 -0
- package/src/tests/sessions-detail-batch.test.ts +2 -0
- package/src/tests/sessions-move.test.ts +131 -0
- package/src/tests/sessions-tree.test.ts +336 -2
- package/src/tests/slack-inbound-files.test.ts +103 -23
- package/src/tests/status.test.ts +101 -18
- package/src/tests/tasks-workflow-run-filter.test.ts +146 -0
- package/src/tests/test-net.ts +31 -0
- package/src/tests/transcription.test.ts +8 -0
- package/src/tests/used-by-route.test.ts +11 -0
- package/src/tests/workflow-cascade-cancel.test.ts +1341 -0
- package/src/tests/workflow-foreach-supersede-retry.test.ts +488 -0
- package/src/tests/workflow-http-v2.test.ts +131 -0
- package/src/tests/workflow-idempotency.test.ts +915 -0
- package/src/tests/workflow-step-order.test.ts +92 -0
- package/src/tests/workflow-sub-workflow.test.ts +30 -0
- package/src/tools/get-tasks.ts +8 -0
- package/src/tools/kv/kv-read-auth.ts +4 -2
- package/src/tools/task-action.ts +1 -1
- package/src/tools/workflows/cancel-workflow-run.ts +1 -1
- package/src/tools/workflows/get-workflow-run.ts +14 -4
- package/src/types.ts +24 -0
- package/src/utils/company-profile.ts +51 -1
- package/src/utils/context-window.ts +8 -6
- package/src/utils/credentials.ts +5 -2
- package/src/utils/internal-ai/complete-structured.ts +5 -0
- package/src/utils/internal-ai/credentials.ts +4 -3
- package/src/utils/provider-key-probes.ts +328 -0
- package/src/utils/transcription.ts +4 -1
- package/src/workflows/approval-cancel.ts +15 -13
- package/src/workflows/approval-notifications.ts +5 -1
- package/src/workflows/checkpoint.ts +6 -3
- package/src/workflows/engine.ts +30 -8
- package/src/workflows/executors/foreach.ts +2 -2
- package/src/workflows/executors/sub-workflow.ts +8 -1
- package/src/workflows/foreach-driver.ts +10 -3
- package/src/workflows/foreach-join.ts +29 -6
- package/src/workflows/recovery.ts +6 -1
- package/src/workflows/resume.ts +168 -56
- package/src/workflows/retry-poller.ts +49 -3
- package/src/workflows/task-step-routing.ts +29 -7
- package/templates/ai-toolbox.manifest.json +8 -8
- package/templates/community/open-prompt-showreel/PLAYBOOK.md +5 -6
- package/templates/community/open-prompt-showreel/lead-prompt.md +1 -1
- package/templates/community/open-prompt-showreel/skills/open-prompt-showreel/SKILL.md +4 -4
- package/templates/skills/agent-browser/SKILL.md +4 -4
- package/templates/skills/agent-browser/content.md +4 -4
- package/templates/skills/code-quality/config.json +1 -1
- package/templates/skills/code-quality/content.md +2 -2
- package/templates/skills/delegate-work/content.md +29 -25
- package/templates/skills/delegate-work/files/scripts/codex-exec.sh +5 -5
- package/templates/skills/qa/content.md +2 -2
- package/templates/skills/researching/content.md +4 -0
- package/templates/skills/swarm-scripts/SKILL.md +1 -0
- package/templates/skills/swarm-scripts/content.md +1 -0
- package/templates/skills/work-on-task/SKILL.md +1 -1
- package/templates/skills/work-on-task/content.md +1 -1
- package/dist/cli-7421jzsw.js +0 -84
- package/dist/cli-e45e4m6b.js +0 -413
- package/dist/cli-zw88zjba.js +0 -307
- package/dist/handlers-19xr6dnz.js +0 -41
- package/dist/index-kw2mmat7.js +0 -43
- package/dist/lead-zyerk1x2.js +0 -79
- package/dist/render-v2-hgytz8nn.js +0 -12
- package/dist/worker-42t8emjt.js +0 -79
|
@@ -1,10 +1,34 @@
|
|
|
1
|
+
import {
|
|
2
|
+
publicEndpointSsrfOptions
|
|
3
|
+
} from "./cli-3gfvmzht.js";
|
|
1
4
|
import {
|
|
2
5
|
getMemoryRaterNames
|
|
3
6
|
} from "./cli-3h26v7yj.js";
|
|
4
7
|
import {
|
|
5
8
|
normalizeOrgWebsite,
|
|
6
|
-
init_org_website
|
|
7
|
-
|
|
9
|
+
init_org_website,
|
|
10
|
+
assertUrlSafe
|
|
11
|
+
} from "./cli-g8ka5j4j.js";
|
|
12
|
+
import {
|
|
13
|
+
getRouteProvider,
|
|
14
|
+
createScopedFetch,
|
|
15
|
+
deriveDefaultRoute,
|
|
16
|
+
init_src
|
|
17
|
+
} from "./cli-1tem6ns9.js";
|
|
18
|
+
import {
|
|
19
|
+
getOpenRouterBaseUrl,
|
|
20
|
+
getOpenRouterAttributionHeaders,
|
|
21
|
+
init_openrouter_base_url
|
|
22
|
+
} from "./cli-dfyv0jdy.js";
|
|
23
|
+
import {
|
|
24
|
+
scrubSecrets,
|
|
25
|
+
init_secret_scrubber
|
|
26
|
+
} from "./cli-708wdy32.js";
|
|
27
|
+
import {
|
|
28
|
+
providerBaseUrl,
|
|
29
|
+
providerForKeyVar,
|
|
30
|
+
init_src2
|
|
31
|
+
} from "./cli-gxee0bqa.js";
|
|
8
32
|
|
|
9
33
|
// src/utils/lead-monitor-channels.ts
|
|
10
34
|
function isLeadChannelMonitoringEnabled(env = process.env) {
|
|
@@ -117,6 +141,204 @@ function isUnknownModelError(text, modelId) {
|
|
|
117
141
|
});
|
|
118
142
|
}
|
|
119
143
|
|
|
144
|
+
// src/utils/provider-key-probes.ts
|
|
145
|
+
init_src2();
|
|
146
|
+
init_src();
|
|
147
|
+
init_openrouter_base_url();
|
|
148
|
+
init_secret_scrubber();
|
|
149
|
+
var LIVE_TEST_TIMEOUT_MS = 5000;
|
|
150
|
+
function scrubProbeBody(body, init) {
|
|
151
|
+
const headers = new Headers(init.headers);
|
|
152
|
+
const apiKey = headers.get("x-api-key") ?? headers.get("authorization")?.replace(/^Bearer\s+/i, "");
|
|
153
|
+
return scrubSecrets(apiKey ? body.replaceAll(apiKey, "[REDACTED]") : body);
|
|
154
|
+
}
|
|
155
|
+
async function timedFetch(url, init, options = {}) {
|
|
156
|
+
const controller = new AbortController;
|
|
157
|
+
const timer = setTimeout(() => controller.abort(), LIVE_TEST_TIMEOUT_MS);
|
|
158
|
+
const start = Date.now();
|
|
159
|
+
try {
|
|
160
|
+
if (options.publicEndpoint)
|
|
161
|
+
assertUrlSafe(url, publicEndpointSsrfOptions());
|
|
162
|
+
const res = await fetch(url, {
|
|
163
|
+
...init,
|
|
164
|
+
...options.publicEndpoint ? { redirect: "manual" } : {},
|
|
165
|
+
signal: controller.signal
|
|
166
|
+
});
|
|
167
|
+
let bodyText = "";
|
|
168
|
+
try {
|
|
169
|
+
bodyText = scrubProbeBody(await res.text(), init);
|
|
170
|
+
} catch {}
|
|
171
|
+
return {
|
|
172
|
+
ok: res.ok,
|
|
173
|
+
status: res.status,
|
|
174
|
+
bodyText,
|
|
175
|
+
latency_ms: Date.now() - start
|
|
176
|
+
};
|
|
177
|
+
} finally {
|
|
178
|
+
clearTimeout(timer);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
async function checkAnthropicApiKey(apiKey, options = {}) {
|
|
182
|
+
const r = await timedFetch("https://api.anthropic.com/v1/models", {
|
|
183
|
+
method: "GET",
|
|
184
|
+
headers: { "x-api-key": apiKey, "anthropic-version": "2023-06-01" }
|
|
185
|
+
}, options);
|
|
186
|
+
if (r.ok)
|
|
187
|
+
return { ok: true, latency_ms: r.latency_ms };
|
|
188
|
+
return {
|
|
189
|
+
ok: false,
|
|
190
|
+
error: scrubSecrets(`HTTP ${r.status}: ${r.bodyText.slice(0, 200)}`),
|
|
191
|
+
httpStatus: r.status,
|
|
192
|
+
latency_ms: r.latency_ms
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
async function checkOpenAiApiKey(apiKey, options = {}) {
|
|
196
|
+
const r = await timedFetch("https://api.openai.com/v1/models", {
|
|
197
|
+
method: "GET",
|
|
198
|
+
headers: { Authorization: `Bearer ${apiKey}` }
|
|
199
|
+
}, options);
|
|
200
|
+
if (r.ok)
|
|
201
|
+
return { ok: true, latency_ms: r.latency_ms };
|
|
202
|
+
return {
|
|
203
|
+
ok: false,
|
|
204
|
+
error: scrubSecrets(`HTTP ${r.status}: ${r.bodyText.slice(0, 200)}`),
|
|
205
|
+
httpStatus: r.status,
|
|
206
|
+
latency_ms: r.latency_ms
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
async function checkXaiApiKey(apiKey, options = {}) {
|
|
210
|
+
const r = await timedFetch("https://api.x.ai/v1/models", {
|
|
211
|
+
method: "GET",
|
|
212
|
+
headers: { Authorization: `Bearer ${apiKey}` }
|
|
213
|
+
}, options);
|
|
214
|
+
if (r.ok)
|
|
215
|
+
return { ok: true, latency_ms: r.latency_ms };
|
|
216
|
+
return {
|
|
217
|
+
ok: false,
|
|
218
|
+
error: scrubSecrets(`HTTP ${r.status}: ${r.bodyText.slice(0, 200)}`),
|
|
219
|
+
httpStatus: r.status,
|
|
220
|
+
latency_ms: r.latency_ms
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
async function checkBearerGet(url, init, options = {}) {
|
|
224
|
+
const r = await timedFetch(url, { method: "GET", ...init }, options);
|
|
225
|
+
if (r.ok)
|
|
226
|
+
return { ok: true, latency_ms: r.latency_ms };
|
|
227
|
+
return {
|
|
228
|
+
ok: false,
|
|
229
|
+
error: scrubSecrets(`HTTP ${r.status}: ${r.bodyText.slice(0, 200)}`),
|
|
230
|
+
httpStatus: r.status,
|
|
231
|
+
latency_ms: r.latency_ms
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
async function checkOpenRouter(apiKey, options = {}) {
|
|
235
|
+
const base = getOpenRouterBaseUrl(options.env);
|
|
236
|
+
const get = (url) => checkBearerGet(url, {
|
|
237
|
+
headers: {
|
|
238
|
+
...getOpenRouterAttributionHeaders(url, options.env),
|
|
239
|
+
Authorization: `Bearer ${apiKey}`
|
|
240
|
+
}
|
|
241
|
+
}, options);
|
|
242
|
+
const keyResult = await get(`${base}/key`);
|
|
243
|
+
if (keyResult.httpStatus === 404 || keyResult.httpStatus === 405)
|
|
244
|
+
return get(`${base}/models`);
|
|
245
|
+
return keyResult;
|
|
246
|
+
}
|
|
247
|
+
function checkDeepSeekApiKey(apiKey, options = {}) {
|
|
248
|
+
return checkBearerGet("https://api.deepseek.com/models", {
|
|
249
|
+
headers: { Authorization: `Bearer ${apiKey}` }
|
|
250
|
+
}, options);
|
|
251
|
+
}
|
|
252
|
+
async function checkOpenAICompatibleProvider(provider, apiKey, baseUrl = provider.baseUrl, options = {}) {
|
|
253
|
+
const r = await timedFetch(`${baseUrl.replace(/\/+$/, "")}/models`, {
|
|
254
|
+
method: "GET",
|
|
255
|
+
headers: { Authorization: `Bearer ${apiKey}` }
|
|
256
|
+
}, options);
|
|
257
|
+
if (r.ok)
|
|
258
|
+
return { ok: true, latency_ms: r.latency_ms };
|
|
259
|
+
return {
|
|
260
|
+
ok: false,
|
|
261
|
+
error: scrubSecrets(`HTTP ${r.status}: ${r.bodyText.slice(0, 200)}`),
|
|
262
|
+
httpStatus: r.status,
|
|
263
|
+
latency_ms: r.latency_ms
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
async function checkRoute(route, env) {
|
|
267
|
+
const startedAt = Date.now();
|
|
268
|
+
const provider = getRouteProvider(route.provider);
|
|
269
|
+
const baseUrl = route.baseUrl ?? provider?.defaultBaseUrl;
|
|
270
|
+
if (!provider?.validate || !baseUrl)
|
|
271
|
+
return { ok: true, skipped: true, latency_ms: 0 };
|
|
272
|
+
const publicFetch = async (url, init) => {
|
|
273
|
+
assertUrlSafe(String(url), publicEndpointSsrfOptions());
|
|
274
|
+
const res = await fetch(url, init);
|
|
275
|
+
if (res.ok || !res.body)
|
|
276
|
+
return res;
|
|
277
|
+
return new Response(scrubProbeBody(await res.text(), init ?? {}), {
|
|
278
|
+
status: res.status,
|
|
279
|
+
statusText: res.statusText,
|
|
280
|
+
headers: res.headers
|
|
281
|
+
});
|
|
282
|
+
};
|
|
283
|
+
const result = await provider.validate({
|
|
284
|
+
route,
|
|
285
|
+
env,
|
|
286
|
+
signal: AbortSignal.timeout(LIVE_TEST_TIMEOUT_MS),
|
|
287
|
+
fetch: createScopedFetch(baseUrl, publicFetch)
|
|
288
|
+
});
|
|
289
|
+
const latency_ms = Date.now() - startedAt;
|
|
290
|
+
if (result.status === "verified")
|
|
291
|
+
return { ok: true, latency_ms };
|
|
292
|
+
return {
|
|
293
|
+
ok: result.status === "configured",
|
|
294
|
+
...result.status === "configured" ? { skipped: true } : { httpStatus: result.httpStatus },
|
|
295
|
+
error: scrubSecrets(result.reason),
|
|
296
|
+
latency_ms
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
async function checkProviderPoolKey(keyType, apiKey, env = process.env) {
|
|
300
|
+
const startedAt = Date.now();
|
|
301
|
+
const options = { env, publicEndpoint: true };
|
|
302
|
+
try {
|
|
303
|
+
switch (keyType) {
|
|
304
|
+
case "ANTHROPIC_API_KEY": {
|
|
305
|
+
const keyEnv = { ...env, ANTHROPIC_API_KEY: apiKey };
|
|
306
|
+
const route = deriveDefaultRoute("claude", keyEnv);
|
|
307
|
+
if (route?.provider === "anthropic-gateway" && "secretKey" in route.auth && route.auth.secretKey === "ANTHROPIC_API_KEY") {
|
|
308
|
+
return await checkRoute(route, keyEnv);
|
|
309
|
+
}
|
|
310
|
+
return await checkAnthropicApiKey(apiKey, options);
|
|
311
|
+
}
|
|
312
|
+
case "OPENAI_API_KEY":
|
|
313
|
+
return await checkOpenAiApiKey(apiKey, options);
|
|
314
|
+
case "OPENROUTER_API_KEY":
|
|
315
|
+
return await checkOpenRouter(apiKey, options);
|
|
316
|
+
case "DEEPSEEK_API_KEY":
|
|
317
|
+
return await checkDeepSeekApiKey(apiKey, options);
|
|
318
|
+
case "XAI_API_KEY":
|
|
319
|
+
return await checkXaiApiKey(apiKey, options);
|
|
320
|
+
case "CLAUDE_CODE_OAUTH_TOKEN": {
|
|
321
|
+
const tokenEnv = { CLAUDE_CODE_OAUTH_TOKEN: apiKey };
|
|
322
|
+
return await checkRoute(deriveDefaultRoute("claude", tokenEnv), tokenEnv);
|
|
323
|
+
}
|
|
324
|
+
default: {
|
|
325
|
+
const provider = providerForKeyVar(keyType);
|
|
326
|
+
if (provider) {
|
|
327
|
+
return await checkOpenAICompatibleProvider(provider, apiKey, providerBaseUrl(provider, env), options);
|
|
328
|
+
}
|
|
329
|
+
return { ok: true, skipped: true, latency_ms: 0 };
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
} catch (err) {
|
|
333
|
+
const raw = err instanceof Error ? err.message : String(err);
|
|
334
|
+
return {
|
|
335
|
+
ok: false,
|
|
336
|
+
error: scrubSecrets(raw.split(apiKey).join("[REDACTED]")) || "Unknown error",
|
|
337
|
+
latency_ms: Date.now() - startedAt
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
|
|
120
342
|
// src/utils/skill-fs-writer.ts
|
|
121
343
|
import { existsSync, mkdirSync, readdirSync, rmSync, writeFileSync } from "node:fs";
|
|
122
344
|
import { dirname, join } from "node:path";
|
|
@@ -256,4 +478,4 @@ function writeSkillsToFilesystem(entries, harnessType = "all", home) {
|
|
|
256
478
|
return { synced, removed, errors };
|
|
257
479
|
}
|
|
258
480
|
|
|
259
|
-
export { isLeadChannelMonitoringEnabled, ORG_IDENTITY_KEYS, orgIdentityStatus, SIMILARITY_THRESHOLD, memoryRelevance, renderMemoriesPrompt, isUnknownModelError, writeSkillsToFilesystem };
|
|
481
|
+
export { isLeadChannelMonitoringEnabled, ORG_IDENTITY_KEYS, orgIdentityStatus, SIMILARITY_THRESHOLD, memoryRelevance, renderMemoriesPrompt, isUnknownModelError, timedFetch, checkAnthropicApiKey, checkOpenAiApiKey, checkXaiApiKey, checkOpenRouter, checkDeepSeekApiKey, checkOpenAICompatibleProvider, checkProviderPoolKey, writeSkillsToFilesystem };
|
|
@@ -7,7 +7,7 @@ var package_default;
|
|
|
7
7
|
var init_package = __esm(() => {
|
|
8
8
|
package_default = {
|
|
9
9
|
name: "@desplega.ai/agent-swarm",
|
|
10
|
-
version: "2.
|
|
10
|
+
version: "2.6.0",
|
|
11
11
|
description: "agent-swarm.dev — an open-source operating system for AI work: a lead agent breaks goals into tasks, routes them to specialized workers such as Claude Code or Codex, runs each worker in an isolated container, and preserves shared memory, tools, schedules, and review gates so delegated work compounds across sessions.",
|
|
12
12
|
keywords: [
|
|
13
13
|
"agent-swarm.dev",
|
|
@@ -61,7 +61,7 @@ var init_package = __esm(() => {
|
|
|
61
61
|
config: {
|
|
62
62
|
name: "agent-swarm"
|
|
63
63
|
},
|
|
64
|
-
packageManager: "bun@1.4.
|
|
64
|
+
packageManager: "bun@1.4.4",
|
|
65
65
|
workspaces: [
|
|
66
66
|
"apps/ui",
|
|
67
67
|
"apps/templates-ui",
|
|
@@ -206,10 +206,10 @@ var init_package = __esm(() => {
|
|
|
206
206
|
bun: ">=1.3.12"
|
|
207
207
|
},
|
|
208
208
|
dependencies: {
|
|
209
|
-
"@agentclientprotocol/sdk": "2.0.
|
|
209
|
+
"@agentclientprotocol/sdk": "2.0.2",
|
|
210
210
|
"@ai-sdk/openai": "^3.0.41",
|
|
211
|
-
"@anthropic-ai/claude-agent-sdk": "0.3.
|
|
212
|
-
"@anthropic-ai/sdk": "^1.
|
|
211
|
+
"@anthropic-ai/claude-agent-sdk": "0.3.310",
|
|
212
|
+
"@anthropic-ai/sdk": "^1.3.0",
|
|
213
213
|
"@asteasolutions/zod-to-openapi": "^8.0.0",
|
|
214
214
|
"@aws-sdk/client-bedrock": "3.1048.0",
|
|
215
215
|
"@chat-adapter/discord": "4.41.1",
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getKnownContextWindowSize,
|
|
3
|
+
clampContextPercent,
|
|
4
|
+
init_context_window
|
|
5
|
+
} from "./cli-pfk92eqz.js";
|
|
6
|
+
import {
|
|
7
|
+
resolveTemplateFromCode,
|
|
8
|
+
resolveTemplateAsync,
|
|
9
|
+
init_resolver,
|
|
10
|
+
init_session_templates
|
|
11
|
+
} from "./cli-dqygeeh5.js";
|
|
12
|
+
|
|
13
|
+
// src/hooks/context-bound-note.ts
|
|
14
|
+
import { renameSync, writeFileSync } from "node:fs";
|
|
15
|
+
import { readFile, writeFile } from "node:fs/promises";
|
|
16
|
+
|
|
17
|
+
// src/prompts/context-bound-note.ts
|
|
18
|
+
init_session_templates();
|
|
19
|
+
init_resolver();
|
|
20
|
+
var CONTEXT_BOUND_NOTE_TEMPLATE = "system.agent.context.bound_note";
|
|
21
|
+
function contextShare(contextTokens, model) {
|
|
22
|
+
if (!model)
|
|
23
|
+
return "";
|
|
24
|
+
try {
|
|
25
|
+
init_context_window();
|
|
26
|
+
const window = getKnownContextWindowSize(model);
|
|
27
|
+
const percent = clampContextPercent(contextTokens, window);
|
|
28
|
+
if (!window || percent === null)
|
|
29
|
+
return "";
|
|
30
|
+
return ` (${Math.round(percent)}% of the ${window.toLocaleString("en-US")}-token window)`;
|
|
31
|
+
} catch {
|
|
32
|
+
return "";
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
async function renderContextBoundNote(contextTokens, model) {
|
|
36
|
+
const variables = {
|
|
37
|
+
contextTokens: Math.round(contextTokens).toLocaleString("en-US"),
|
|
38
|
+
contextShare: contextShare(contextTokens, model)
|
|
39
|
+
};
|
|
40
|
+
try {
|
|
41
|
+
const result = await resolveTemplateAsync(CONTEXT_BOUND_NOTE_TEMPLATE, variables);
|
|
42
|
+
return result.skipped ? "" : result.text;
|
|
43
|
+
} catch {
|
|
44
|
+
return resolveTemplateFromCode(CONTEXT_BOUND_NOTE_TEMPLATE, variables).text;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// src/hooks/context-bound-note.ts
|
|
49
|
+
function contextBoundNoteThreshold(env = process.env) {
|
|
50
|
+
const raw = env.CONTEXT_BOUND_NOTE_TOKENS?.trim();
|
|
51
|
+
if (!raw || !/^\d+$/.test(raw))
|
|
52
|
+
return 0;
|
|
53
|
+
const parsed = Number(raw);
|
|
54
|
+
return Number.isSafeInteger(parsed) ? parsed : 0;
|
|
55
|
+
}
|
|
56
|
+
function reachesThreshold(contextTokens, threshold) {
|
|
57
|
+
return threshold > 0 && typeof contextTokens === "number" && Number.isFinite(contextTokens) && contextTokens >= threshold;
|
|
58
|
+
}
|
|
59
|
+
async function deliverContextBoundNote(contextTokens, model, inject) {
|
|
60
|
+
try {
|
|
61
|
+
const note = await renderContextBoundNote(contextTokens, model);
|
|
62
|
+
if (note)
|
|
63
|
+
await inject(note);
|
|
64
|
+
} catch {}
|
|
65
|
+
}
|
|
66
|
+
function contextStatePath(taskFilePath) {
|
|
67
|
+
return `${taskFilePath}.context.json`;
|
|
68
|
+
}
|
|
69
|
+
function contextBoundNoteMarkerPath(taskFilePath) {
|
|
70
|
+
return `${taskFilePath}.bound-note`;
|
|
71
|
+
}
|
|
72
|
+
function recordContextState(taskFilePath, contextTokens, model) {
|
|
73
|
+
const path = contextStatePath(taskFilePath);
|
|
74
|
+
const tmp = `${path}.tmp`;
|
|
75
|
+
try {
|
|
76
|
+
writeFileSync(tmp, JSON.stringify({ contextTokens, model, updatedAt: new Date().toISOString() }));
|
|
77
|
+
renameSync(tmp, path);
|
|
78
|
+
} catch {}
|
|
79
|
+
}
|
|
80
|
+
async function claimContextBoundNote(taskFilePath, threshold) {
|
|
81
|
+
if (!taskFilePath || threshold <= 0)
|
|
82
|
+
return null;
|
|
83
|
+
let contextTokens;
|
|
84
|
+
let model;
|
|
85
|
+
try {
|
|
86
|
+
const state = JSON.parse(await readFile(contextStatePath(taskFilePath), "utf8"));
|
|
87
|
+
contextTokens = state?.contextTokens;
|
|
88
|
+
model = state?.model;
|
|
89
|
+
} catch {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
if (!reachesThreshold(contextTokens, threshold))
|
|
93
|
+
return null;
|
|
94
|
+
try {
|
|
95
|
+
await writeFile(contextBoundNoteMarkerPath(taskFilePath), new Date().toISOString(), {
|
|
96
|
+
flag: "wx"
|
|
97
|
+
});
|
|
98
|
+
} catch {
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
return { contextTokens, model: typeof model === "string" && model ? model : undefined };
|
|
102
|
+
}
|
|
103
|
+
async function injectClaimedContextBoundNote(taskFilePath, threshold, inject) {
|
|
104
|
+
const state = await claimContextBoundNote(taskFilePath, threshold).catch(() => null);
|
|
105
|
+
if (state)
|
|
106
|
+
await deliverContextBoundNote(state.contextTokens, state.model, inject);
|
|
107
|
+
}
|
|
108
|
+
function createContextBoundNote(options) {
|
|
109
|
+
let state = "idle";
|
|
110
|
+
let held = "";
|
|
111
|
+
const tryDeliver = async (note) => {
|
|
112
|
+
try {
|
|
113
|
+
if (!options.canDeliver()) {
|
|
114
|
+
held = note;
|
|
115
|
+
state = "held";
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
state = "done";
|
|
119
|
+
await options.inject(note);
|
|
120
|
+
} catch {}
|
|
121
|
+
};
|
|
122
|
+
return async (contextTokens) => {
|
|
123
|
+
if (state === "held")
|
|
124
|
+
return tryDeliver(held);
|
|
125
|
+
if (state !== "idle" || !reachesThreshold(contextTokens, options.threshold))
|
|
126
|
+
return;
|
|
127
|
+
state = "rendering";
|
|
128
|
+
let note = "";
|
|
129
|
+
try {
|
|
130
|
+
note = await renderContextBoundNote(contextTokens, options.model?.());
|
|
131
|
+
} catch {}
|
|
132
|
+
if (!note) {
|
|
133
|
+
state = "done";
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
await tryDeliver(note);
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export { contextBoundNoteThreshold, contextStatePath, contextBoundNoteMarkerPath, recordContextState, injectClaimedContextBoundNote, createContextBoundNote };
|
|
@@ -2,21 +2,19 @@ import {
|
|
|
2
2
|
runtimeCatalogSection,
|
|
3
3
|
runtimeCatalogModel,
|
|
4
4
|
init_runtime_model_catalog
|
|
5
|
-
} from "./cli-
|
|
5
|
+
} from "./cli-803188pb.js";
|
|
6
6
|
import {
|
|
7
7
|
buildClaudeShortnameMap,
|
|
8
8
|
init_src2
|
|
9
|
-
} from "./cli-
|
|
9
|
+
} from "./cli-gxee0bqa.js";
|
|
10
|
+
import {
|
|
11
|
+
__esm
|
|
12
|
+
} from "./cli-242037k3.js";
|
|
10
13
|
|
|
11
14
|
// src/utils/context-window.ts
|
|
12
|
-
init_src2();
|
|
13
|
-
init_runtime_model_catalog();
|
|
14
|
-
var CONTEXT_FORMULA = "input-cache-output";
|
|
15
|
-
var DEFAULT_CONTEXT_WINDOW = 200000;
|
|
16
15
|
function stripAnthropicDateSuffix(model) {
|
|
17
16
|
return model.replace(/-(\d{8})$/, "");
|
|
18
17
|
}
|
|
19
|
-
var shortnameMap = null;
|
|
20
18
|
function resolveClaudeShortname(model) {
|
|
21
19
|
const section = runtimeCatalogSection("anthropic");
|
|
22
20
|
if (!shortnameMap || shortnameMap.section !== section) {
|
|
@@ -29,8 +27,11 @@ function catalogContext(provider, model) {
|
|
|
29
27
|
return typeof context === "number" && context > 0 ? context : undefined;
|
|
30
28
|
}
|
|
31
29
|
function getContextWindowSize(model) {
|
|
30
|
+
return getKnownContextWindowSize(model) ?? DEFAULT_CONTEXT_WINDOW;
|
|
31
|
+
}
|
|
32
|
+
function getKnownContextWindowSize(model) {
|
|
32
33
|
if (!model)
|
|
33
|
-
return
|
|
34
|
+
return;
|
|
34
35
|
const slash = model.indexOf("/");
|
|
35
36
|
if (slash > 0) {
|
|
36
37
|
const scoped = catalogContext(model.slice(0, slash), model.slice(slash + 1));
|
|
@@ -49,12 +50,9 @@ function getContextWindowSize(model) {
|
|
|
49
50
|
return dated;
|
|
50
51
|
}
|
|
51
52
|
const shortname = resolveClaudeShortname(model);
|
|
52
|
-
if (shortname)
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
return resolved;
|
|
56
|
-
}
|
|
57
|
-
return DEFAULT_CONTEXT_WINDOW;
|
|
53
|
+
if (shortname)
|
|
54
|
+
return catalogContext("anthropic", shortname);
|
|
55
|
+
return;
|
|
58
56
|
}
|
|
59
57
|
function computeContextUsedUnified(parts) {
|
|
60
58
|
return (parts.inputTokens ?? 0) + (parts.cacheReadTokens ?? 0) + (parts.cacheCreateTokens ?? 0) + (parts.outputTokens ?? 0);
|
|
@@ -67,5 +65,10 @@ function clampContextPercent(used, total) {
|
|
|
67
65
|
return null;
|
|
68
66
|
return Math.min(100, Math.max(0, raw));
|
|
69
67
|
}
|
|
68
|
+
var CONTEXT_FORMULA = "input-cache-output", DEFAULT_CONTEXT_WINDOW = 200000, shortnameMap = null;
|
|
69
|
+
var init_context_window = __esm(() => {
|
|
70
|
+
init_src2();
|
|
71
|
+
init_runtime_model_catalog();
|
|
72
|
+
});
|
|
70
73
|
|
|
71
|
-
export { CONTEXT_FORMULA, getContextWindowSize, computeContextUsedUnified, clampContextPercent };
|
|
74
|
+
export { CONTEXT_FORMULA, getContextWindowSize, getKnownContextWindowSize, computeContextUsedUnified, clampContextPercent, init_context_window };
|