@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
|
@@ -5,21 +5,20 @@ import {
|
|
|
5
5
|
postRatings
|
|
6
6
|
} from "./cli-3h26v7yj.js";
|
|
7
7
|
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
} from "./cli-a5ebc95n.js";
|
|
8
|
+
contextBoundNoteThreshold,
|
|
9
|
+
createContextBoundNote
|
|
10
|
+
} from "./cli-nq677csy.js";
|
|
12
11
|
import {
|
|
13
12
|
SessionErrorTracker
|
|
14
|
-
} from "./cli-
|
|
13
|
+
} from "./cli-7enjwya9.js";
|
|
15
14
|
import {
|
|
16
15
|
credentialsToAuthJson,
|
|
17
16
|
CodexOAuthRefreshError,
|
|
18
17
|
getValidCodexOAuth
|
|
19
|
-
} from "./cli-
|
|
18
|
+
} from "./cli-0z1xjzwa.js";
|
|
20
19
|
import {
|
|
21
20
|
summarizeSession
|
|
22
|
-
} from "./cli-
|
|
21
|
+
} from "./cli-ag2yrnt5.js";
|
|
23
22
|
import {
|
|
24
23
|
swarmRuntimeInstanceId
|
|
25
24
|
} from "./cli-e8xyjvfc.js";
|
|
@@ -42,25 +41,40 @@ import {
|
|
|
42
41
|
} from "./cli-vbhgkw9h.js";
|
|
43
42
|
import {
|
|
44
43
|
applyReasoningEffort
|
|
45
|
-
} from "./cli-
|
|
44
|
+
} from "./cli-c081bj3b.js";
|
|
46
45
|
import {
|
|
47
46
|
createSwarmEventHandler
|
|
48
47
|
} from "./cli-4zsenjhy.js";
|
|
48
|
+
import {
|
|
49
|
+
CONTEXT_FORMULA,
|
|
50
|
+
computeContextUsedUnified,
|
|
51
|
+
clampContextPercent,
|
|
52
|
+
init_context_window
|
|
53
|
+
} from "./cli-pfk92eqz.js";
|
|
49
54
|
import {
|
|
50
55
|
hasCodexOAuthPoolSlots
|
|
51
56
|
} from "./cli-j4bwnpkm.js";
|
|
52
57
|
import {
|
|
53
58
|
DEFAULT_MODEL_TIER_MAP,
|
|
54
59
|
init_types
|
|
55
|
-
} from "./cli-
|
|
60
|
+
} from "./cli-4rf0f5vg.js";
|
|
61
|
+
import {
|
|
62
|
+
routeCredentialStatus,
|
|
63
|
+
CODEX_GATEWAY_API_KEY,
|
|
64
|
+
deriveDefaultRoute,
|
|
65
|
+
routeUnsetEnv,
|
|
66
|
+
init_src,
|
|
67
|
+
selectCredential,
|
|
68
|
+
init_credentials
|
|
69
|
+
} from "./cli-1tem6ns9.js";
|
|
56
70
|
import {
|
|
57
71
|
runtimeCatalogModel,
|
|
58
72
|
init_runtime_model_catalog
|
|
59
|
-
} from "./cli-
|
|
73
|
+
} from "./cli-803188pb.js";
|
|
60
74
|
import {
|
|
61
75
|
init_package,
|
|
62
76
|
package_default
|
|
63
|
-
} from "./cli-
|
|
77
|
+
} from "./cli-nn6vx2mq.js";
|
|
64
78
|
import {
|
|
65
79
|
isEnvFlagEnabled,
|
|
66
80
|
isSessionSummarySkipped,
|
|
@@ -73,10 +87,10 @@ import {
|
|
|
73
87
|
import {
|
|
74
88
|
scrubSecrets,
|
|
75
89
|
init_secret_scrubber
|
|
76
|
-
} from "./cli-
|
|
90
|
+
} from "./cli-708wdy32.js";
|
|
77
91
|
import {
|
|
78
92
|
init_src2
|
|
79
|
-
} from "./cli-
|
|
93
|
+
} from "./cli-gxee0bqa.js";
|
|
80
94
|
|
|
81
95
|
// src/providers/codex-oauth/home.ts
|
|
82
96
|
import os from "node:os";
|
|
@@ -85,9 +99,12 @@ function codexUserHome() {
|
|
|
85
99
|
}
|
|
86
100
|
|
|
87
101
|
// src/providers/codex-adapter.ts
|
|
102
|
+
init_src();
|
|
88
103
|
import { existsSync as nodeExistsSync } from "node:fs";
|
|
89
104
|
import { join as join2 } from "node:path";
|
|
90
105
|
init_api_key();
|
|
106
|
+
init_context_window();
|
|
107
|
+
init_credentials();
|
|
91
108
|
init_env_flag();
|
|
92
109
|
init_secret_scrubber();
|
|
93
110
|
|
|
@@ -520,8 +537,28 @@ function createCodexSwarmEventHandler(opts) {
|
|
|
520
537
|
}
|
|
521
538
|
|
|
522
539
|
// src/providers/codex-adapter.ts
|
|
540
|
+
var CODEX_GATEWAY_PROVIDER_ID = "swarm-gateway";
|
|
541
|
+
function codexGatewayConfig(route) {
|
|
542
|
+
return {
|
|
543
|
+
model_provider: CODEX_GATEWAY_PROVIDER_ID,
|
|
544
|
+
model_providers: {
|
|
545
|
+
[CODEX_GATEWAY_PROVIDER_ID]: {
|
|
546
|
+
name: "Swarm gateway",
|
|
547
|
+
base_url: route.baseUrl,
|
|
548
|
+
env_key: CODEX_GATEWAY_API_KEY,
|
|
549
|
+
wire_api: "responses",
|
|
550
|
+
requires_openai_auth: false
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
};
|
|
554
|
+
}
|
|
523
555
|
var CONTEXT_MODE_CODEX_PLUGIN = "context-mode@context-mode";
|
|
524
556
|
function checkCodexCredentials2(env, opts = {}) {
|
|
557
|
+
const gateway = deriveDefaultRoute("codex", env);
|
|
558
|
+
if (gateway) {
|
|
559
|
+
const status = routeCredentialStatus(gateway, env);
|
|
560
|
+
return status.ready ? { ready: true, missing: [], satisfiedBy: "env", hint: status.hint } : { ready: false, missing: status.missing, hint: status.hint };
|
|
561
|
+
}
|
|
525
562
|
const homeDir = opts.homeDir ?? env.HOME ?? "/root";
|
|
526
563
|
const existsSync = opts.fs?.existsSync ?? nodeExistsSync;
|
|
527
564
|
const authFile = `${homeDir}/.codex/auth.json`;
|
|
@@ -1048,6 +1085,7 @@ class CodexSession {
|
|
|
1048
1085
|
errorTracker = new SessionErrorTracker;
|
|
1049
1086
|
appliedReasoningEffort;
|
|
1050
1087
|
pendingResult = null;
|
|
1088
|
+
observeContextBound;
|
|
1051
1089
|
constructor(thread, config, resolvedModel, initialEvents = [], skillsDir, summarizeDeps = {}) {
|
|
1052
1090
|
this.thread = thread;
|
|
1053
1091
|
this.config = config;
|
|
@@ -1056,6 +1094,12 @@ class CodexSession {
|
|
|
1056
1094
|
this.skillsDir = skillsDir ?? process.env.CODEX_SKILLS_DIR ?? join2(codexUserHome(), ".codex", "skills");
|
|
1057
1095
|
this.summarizeDeps = summarizeDeps;
|
|
1058
1096
|
this.logFileHandle = Bun.file(config.logFile).writer();
|
|
1097
|
+
this.observeContextBound = createContextBoundNote({
|
|
1098
|
+
threshold: contextBoundNoteThreshold(config.env ?? process.env),
|
|
1099
|
+
model: () => this.resolvedModel,
|
|
1100
|
+
canDeliver: () => this.acceptsSteering && !this.settled && !this.aborted,
|
|
1101
|
+
inject: (note) => this.deliverSteering({ mode: "steer", text: note })
|
|
1102
|
+
});
|
|
1059
1103
|
const reasoningApplication = applyReasoningEffort("codex", resolvedModel, config.reasoningEffort);
|
|
1060
1104
|
this.appliedReasoningEffort = reasoningApplication.kind === "codex-config" ? config.reasoningEffort ?? null : null;
|
|
1061
1105
|
this.completionPromise = new Promise((resolve) => {
|
|
@@ -1361,6 +1405,7 @@ class CodexSession {
|
|
|
1361
1405
|
break;
|
|
1362
1406
|
case "context.updated":
|
|
1363
1407
|
this.emitContextUsage(event.usage, event.contextWindow ?? this.contextWindow);
|
|
1408
|
+
this.observeContextBound(event.usage.input_tokens);
|
|
1364
1409
|
break;
|
|
1365
1410
|
case "error": {
|
|
1366
1411
|
const { message } = this.formatTerminalError(event.message, event.codexErrorInfo);
|
|
@@ -1721,8 +1766,13 @@ async function createInProcessCodexSession2(config, opts = {}) {
|
|
|
1721
1766
|
const bufferedEmit = (event) => {
|
|
1722
1767
|
preSessionEvents.push(event);
|
|
1723
1768
|
};
|
|
1724
|
-
const
|
|
1725
|
-
const
|
|
1769
|
+
const routeEnv = config.env ?? process.env;
|
|
1770
|
+
const gateway = deriveDefaultRoute("codex", routeEnv);
|
|
1771
|
+
const mergedConfig = {
|
|
1772
|
+
...await buildCodexConfig(config, resolvedModel, bufferedEmit),
|
|
1773
|
+
...gateway ? codexGatewayConfig(gateway) : {}
|
|
1774
|
+
};
|
|
1775
|
+
const authMode = gateway ? null : await resolveCodexAuthMode(config, bufferedEmit);
|
|
1726
1776
|
const env = {
|
|
1727
1777
|
PATH: process.env.PATH ?? "",
|
|
1728
1778
|
HOME: process.env.HOME ?? "",
|
|
@@ -1733,8 +1783,17 @@ async function createInProcessCodexSession2(config, opts = {}) {
|
|
|
1733
1783
|
...buildOtelTraceparentEnv(config.env ?? process.env),
|
|
1734
1784
|
SWARM_CODEX_APP_SERVER: "1"
|
|
1735
1785
|
};
|
|
1736
|
-
if (
|
|
1786
|
+
if (gateway) {
|
|
1787
|
+
for (const key of routeUnsetEnv("codex", gateway))
|
|
1788
|
+
delete env[key];
|
|
1789
|
+
const gatewayKey = routeEnv[CODEX_GATEWAY_API_KEY];
|
|
1790
|
+
if (gatewayKey)
|
|
1791
|
+
env[CODEX_GATEWAY_API_KEY] = gatewayKey;
|
|
1792
|
+
} else if (authMode === "chatgpt")
|
|
1737
1793
|
delete env.OPENAI_API_KEY;
|
|
1794
|
+
else if (env.OPENAI_API_KEY) {
|
|
1795
|
+
env.OPENAI_API_KEY = selectCredential(env.OPENAI_API_KEY, undefined, "OPENAI_API_KEY").selected;
|
|
1796
|
+
}
|
|
1738
1797
|
const codexPathOverride = process.env.CODEX_PATH_OVERRIDE;
|
|
1739
1798
|
if (config.resumeSessionId) {
|
|
1740
1799
|
console.warn("[codex-adapter] resumeSessionId ignored — native resume is disabled by deprecation plan");
|
|
@@ -1816,6 +1875,12 @@ class CodexSubprocessSession {
|
|
|
1816
1875
|
parentOtelEnv: buildOtelTraceparentEnv(config.env ?? process.env)
|
|
1817
1876
|
};
|
|
1818
1877
|
const apiKey = getApiKey();
|
|
1878
|
+
const providerKeys = {};
|
|
1879
|
+
for (const keyVar of ["OPENAI_API_KEY", "OPENROUTER_API_KEY", "ANTHROPIC_API_KEY"]) {
|
|
1880
|
+
const value = config.env?.[keyVar] ?? process.env[keyVar];
|
|
1881
|
+
if (value)
|
|
1882
|
+
providerKeys[keyVar] = selectCredential(value, undefined, keyVar).selected;
|
|
1883
|
+
}
|
|
1819
1884
|
this.proc = registerProcessGroup(Bun.spawn(argv, {
|
|
1820
1885
|
detached: detachedProcessGroup,
|
|
1821
1886
|
env: {
|
|
@@ -1824,9 +1889,7 @@ class CodexSubprocessSession {
|
|
|
1824
1889
|
...process.env.NODE_EXTRA_CA_CERTS ? { NODE_EXTRA_CA_CERTS: process.env.NODE_EXTRA_CA_CERTS } : {},
|
|
1825
1890
|
...process.env.MCP_BASE_URL ? { MCP_BASE_URL: process.env.MCP_BASE_URL } : {},
|
|
1826
1891
|
...apiKey ? { AGENT_SWARM_API_KEY: apiKey, API_KEY: apiKey } : {},
|
|
1827
|
-
...
|
|
1828
|
-
...process.env.OPENROUTER_API_KEY ? { OPENROUTER_API_KEY: process.env.OPENROUTER_API_KEY } : {},
|
|
1829
|
-
...process.env.ANTHROPIC_API_KEY ? { ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY } : {},
|
|
1892
|
+
...providerKeys,
|
|
1830
1893
|
...process.env.CODEX_PATH_OVERRIDE ? { CODEX_PATH_OVERRIDE: process.env.CODEX_PATH_OVERRIDE } : {},
|
|
1831
1894
|
...process.env.CODEX_SKILLS_DIR ? { CODEX_SKILLS_DIR: process.env.CODEX_SKILLS_DIR } : {},
|
|
1832
1895
|
CONTEXT_MODE_EXTERNAL_MCP_NUDGE_EVERY: CTX_MODE_NUDGE_EVERY,
|
|
@@ -2056,6 +2119,9 @@ class CodexAdapter2 {
|
|
|
2056
2119
|
this.threadFactory = opts.threadFactory;
|
|
2057
2120
|
}
|
|
2058
2121
|
async createSession(config) {
|
|
2122
|
+
if (deriveDefaultRoute("codex", config.env ?? process.env)) {
|
|
2123
|
+
console.log("\x1B[2m[codex]\x1B[0m Using credential: gateway");
|
|
2124
|
+
}
|
|
2059
2125
|
if (this.bypassSubprocess) {
|
|
2060
2126
|
return createInProcessCodexSession2(config, {
|
|
2061
2127
|
skillsDir: this.skillsDir,
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getContextWindowSize,
|
|
3
|
-
clampContextPercent
|
|
4
|
-
} from "./cli-a5ebc95n.js";
|
|
5
1
|
import {
|
|
6
2
|
swarmRuntimeInstanceId
|
|
7
3
|
} from "./cli-e8xyjvfc.js";
|
|
@@ -10,17 +6,22 @@ import {
|
|
|
10
6
|
} from "./cli-jc1g9ndz.js";
|
|
11
7
|
import {
|
|
12
8
|
applyReasoningEffort
|
|
13
|
-
} from "./cli-
|
|
9
|
+
} from "./cli-c081bj3b.js";
|
|
10
|
+
import {
|
|
11
|
+
getContextWindowSize,
|
|
12
|
+
clampContextPercent,
|
|
13
|
+
init_context_window
|
|
14
|
+
} from "./cli-pfk92eqz.js";
|
|
14
15
|
import {
|
|
15
16
|
DEFAULT_MODEL_TIER_MAP,
|
|
16
17
|
init_types
|
|
17
|
-
} from "./cli-
|
|
18
|
+
} from "./cli-4rf0f5vg.js";
|
|
18
19
|
import {
|
|
19
20
|
resolveTemplateFromCode,
|
|
20
21
|
resolveTemplateAsync,
|
|
21
22
|
init_resolver,
|
|
22
23
|
init_session_templates
|
|
23
|
-
} from "./cli-
|
|
24
|
+
} from "./cli-dqygeeh5.js";
|
|
24
25
|
import {
|
|
25
26
|
parseEnvFlag,
|
|
26
27
|
init_env_flag
|
|
@@ -29,21 +30,22 @@ import {
|
|
|
29
30
|
scrubSecrets,
|
|
30
31
|
registerVolatileSecret,
|
|
31
32
|
init_secret_scrubber
|
|
32
|
-
} from "./cli-
|
|
33
|
+
} from "./cli-708wdy32.js";
|
|
33
34
|
import {
|
|
34
35
|
cursorCatalogRef,
|
|
35
36
|
init_src2
|
|
36
|
-
} from "./cli-
|
|
37
|
+
} from "./cli-gxee0bqa.js";
|
|
37
38
|
|
|
38
39
|
// src/providers/cursor-adapter.ts
|
|
39
40
|
init_src2();
|
|
40
41
|
init_session_templates();
|
|
41
42
|
init_resolver();
|
|
42
43
|
init_types();
|
|
44
|
+
init_context_window();
|
|
45
|
+
init_env_flag();
|
|
43
46
|
import { mkdtemp, rm } from "node:fs/promises";
|
|
44
47
|
import { tmpdir } from "node:os";
|
|
45
48
|
import { join } from "node:path";
|
|
46
|
-
init_env_flag();
|
|
47
49
|
init_secret_scrubber();
|
|
48
50
|
var CURSOR_MCP_SERVER_NAME = "agent-swarm";
|
|
49
51
|
var NATIVE_SYSTEM_PROMPT_ENV = "CURSOR_NATIVE_SYSTEM_PROMPT";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
RuntimeProviderKindSchema,
|
|
3
3
|
init_types
|
|
4
|
-
} from "./cli-
|
|
4
|
+
} from "./cli-4rf0f5vg.js";
|
|
5
5
|
import {
|
|
6
6
|
init_zod
|
|
7
7
|
} from "./cli-4chz1hye.js";
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
import {
|
|
22
22
|
scrubSecrets,
|
|
23
23
|
init_secret_scrubber
|
|
24
|
-
} from "./cli-
|
|
24
|
+
} from "./cli-708wdy32.js";
|
|
25
25
|
|
|
26
26
|
// src/runtime-providers/controller.ts
|
|
27
27
|
init_secret_scrubber();
|
|
@@ -385,7 +385,7 @@ agent-fs is the shared drive between agents and people. Documents (reports, dige
|
|
|
385
385
|
Pages: only for polished artifacts shared with a wider audience or explicitly requested; see \`pages\` skill.
|
|
386
386
|
A tool a person will use, with data and actions: build an app. See the \`apps\` skill.
|
|
387
387
|
Link env: \`APP_URL\` for pages, \`MCP_BASE_URL\` for the API, \`AGENT_FS_LIVE_URL\` for files. Report missing variables.
|
|
388
|
-
|
|
388
|
+
Give people the live app link \`\${AGENT_FS_LIVE_URL}/file/~/<org>/<drive>/<path>\`. Make an \`agent-fs share-create\` link only when the requester asks for one or the reader has no agent-fs login.
|
|
389
389
|
`,
|
|
390
390
|
variables: [],
|
|
391
391
|
category: "system"
|
|
@@ -482,6 +482,22 @@ Task: {{task}}{{progressLine}}
|
|
|
482
482
|
],
|
|
483
483
|
category: "system"
|
|
484
484
|
});
|
|
485
|
+
registerTemplate({
|
|
486
|
+
eventType: "system.agent.context.bound_note",
|
|
487
|
+
header: "",
|
|
488
|
+
defaultBody: "Context is {{contextTokens}} tokens{{contextShare}}. Keep this task bounded: finish the current step, store-progress, and complete or defer instead of starting new exploration.",
|
|
489
|
+
variables: [
|
|
490
|
+
{
|
|
491
|
+
name: "contextTokens",
|
|
492
|
+
description: "Prompt size of the latest request (input + cache read + cache write tokens)"
|
|
493
|
+
},
|
|
494
|
+
{
|
|
495
|
+
name: "contextShare",
|
|
496
|
+
description: `How full the model's context window is, e.g. " (21% of the 1,000,000-token window)". Empty when the window is unknown`
|
|
497
|
+
}
|
|
498
|
+
],
|
|
499
|
+
category: "system"
|
|
500
|
+
});
|
|
485
501
|
registerTemplate({
|
|
486
502
|
eventType: "system.agent.cursor.first_message",
|
|
487
503
|
header: "",
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
workflowEventBus2,
|
|
6
6
|
init_event_bus
|
|
7
|
-
} from "./cli-
|
|
7
|
+
} from "./cli-kt907da6.js";
|
|
8
8
|
import {
|
|
9
9
|
getDbClient2,
|
|
10
10
|
isRuntimePoolsEnabled,
|
|
@@ -66,7 +66,7 @@ import {
|
|
|
66
66
|
getStaleApprovalRequests2,
|
|
67
67
|
upsertKv2,
|
|
68
68
|
init_db3
|
|
69
|
-
} from "./cli-
|
|
69
|
+
} from "./cli-g8ka5j4j.js";
|
|
70
70
|
import {
|
|
71
71
|
poolTaskRunsOnHarness,
|
|
72
72
|
isRuntimePoolWakeable,
|
|
@@ -87,48 +87,48 @@ import {
|
|
|
87
87
|
createRerouteDecisionTask,
|
|
88
88
|
createPoolStarvationDecisionTask,
|
|
89
89
|
canClaim
|
|
90
|
-
} from "./cli-
|
|
90
|
+
} from "./cli-4hxrf0p4.js";
|
|
91
91
|
import {
|
|
92
92
|
runtimeStaleThresholdMinutes,
|
|
93
93
|
countActiveRuntimeInstancesForAgent,
|
|
94
94
|
agentsWithLiveRuntime,
|
|
95
95
|
expireStaleRuntimeInstances,
|
|
96
96
|
createApprovalFollowUpTask
|
|
97
|
-
} from "./cli-
|
|
97
|
+
} from "./cli-3fwqy71j.js";
|
|
98
98
|
import {
|
|
99
99
|
listRuntimePools2,
|
|
100
100
|
init_db
|
|
101
|
-
} from "./cli-
|
|
101
|
+
} from "./cli-gf95q3bm.js";
|
|
102
102
|
import {
|
|
103
103
|
remediateStalledRuntime
|
|
104
|
-
} from "./cli-
|
|
104
|
+
} from "./cli-c2habvsf.js";
|
|
105
105
|
import {
|
|
106
106
|
runSavedScriptAsAgent
|
|
107
|
-
} from "./cli-
|
|
107
|
+
} from "./cli-3gfvmzht.js";
|
|
108
108
|
import {
|
|
109
109
|
mintToken,
|
|
110
110
|
init_users
|
|
111
|
-
} from "./cli-
|
|
111
|
+
} from "./cli-esakngh8.js";
|
|
112
112
|
import {
|
|
113
113
|
TERMINAL_TASK_STATUSES,
|
|
114
114
|
SUPERSEDED_WORKFLOW_TASK_REASON,
|
|
115
115
|
init_types
|
|
116
|
-
} from "./cli-
|
|
117
|
-
import {
|
|
118
|
-
registerTemplate,
|
|
119
|
-
init_registry,
|
|
120
|
-
resolveTemplate,
|
|
121
|
-
init_resolver
|
|
122
|
-
} from "./cli-tx00c0h6.js";
|
|
116
|
+
} from "./cli-4rf0f5vg.js";
|
|
123
117
|
import {
|
|
124
118
|
DEFAULT_OPENROUTER_BASE_URL,
|
|
125
119
|
getOpenRouterBaseUrl,
|
|
126
120
|
init_openrouter_base_url
|
|
127
121
|
} from "./cli-dfyv0jdy.js";
|
|
122
|
+
import {
|
|
123
|
+
registerTemplate,
|
|
124
|
+
init_registry,
|
|
125
|
+
resolveTemplate,
|
|
126
|
+
init_resolver
|
|
127
|
+
} from "./cli-dqygeeh5.js";
|
|
128
128
|
import {
|
|
129
129
|
init_package,
|
|
130
130
|
package_default
|
|
131
|
-
} from "./cli-
|
|
131
|
+
} from "./cli-nn6vx2mq.js";
|
|
132
132
|
import {
|
|
133
133
|
isEnvFlagEnabled,
|
|
134
134
|
init_env_flag
|
|
@@ -136,7 +136,7 @@ import {
|
|
|
136
136
|
import {
|
|
137
137
|
scrubSecrets,
|
|
138
138
|
init_secret_scrubber
|
|
139
|
-
} from "./cli-
|
|
139
|
+
} from "./cli-708wdy32.js";
|
|
140
140
|
|
|
141
141
|
// src/be/runtime-pools/routing.ts
|
|
142
142
|
init_runtime_pools_flag();
|
|
@@ -5,12 +5,12 @@ import {
|
|
|
5
5
|
validateRuntimeTokenTtlHours,
|
|
6
6
|
init_swarm_config_guard,
|
|
7
7
|
init_db3
|
|
8
|
-
} from "./cli-
|
|
8
|
+
} from "./cli-g8ka5j4j.js";
|
|
9
9
|
import {
|
|
10
10
|
registerVolatileSecret,
|
|
11
11
|
unregisterVolatileSecret,
|
|
12
12
|
init_secret_scrubber
|
|
13
|
-
} from "./cli-
|
|
13
|
+
} from "./cli-708wdy32.js";
|
|
14
14
|
import {
|
|
15
15
|
__esm
|
|
16
16
|
} from "./cli-242037k3.js";
|
|
@@ -285,6 +285,10 @@ async function mintRuntimeToken(agentId, runtimeId, ttlMs = runtimeTokenTtlMs())
|
|
|
285
285
|
async function mintScriptRunToken(agentId, ttlMs) {
|
|
286
286
|
return await insertSessionToken(agentId, null, null, ttlMs, null, undefined, null, null, true);
|
|
287
287
|
}
|
|
288
|
+
async function isScriptRunToken(tokenId) {
|
|
289
|
+
const row = await getDbClient2().get("SELECT scriptRun FROM session_tokens WHERE id = ?", [tokenId]);
|
|
290
|
+
return row?.scriptRun === 1;
|
|
291
|
+
}
|
|
288
292
|
async function insertSessionToken(agentId, taskId, runtimeId, ttlMs, parentRuntimeId = null, expiresAtCeiling, controllerId = null, parentTokenId = null, scriptRun = false) {
|
|
289
293
|
const plaintext = `${SESSION_TOKEN_PREFIX}${base62(randomBytes(24))}`;
|
|
290
294
|
const tokenId = randomUUID().replace(/-/g, "");
|
|
@@ -449,4 +453,4 @@ var init_users = __esm(() => {
|
|
|
449
453
|
};
|
|
450
454
|
});
|
|
451
455
|
|
|
452
|
-
export { registerSessionTokenConnection, closeSessionTokenConnections, init_session_token_connections, findUserById, findUserByExternalId, findUserByEmail, findUsersByName, getUserIdentities, listUserEvents, listUserTokens, recordIdentityEvent, findOrCreateUserByEmail, linkIdentity, unlinkIdentity, mintToken, revokeToken, resolveUserByToken, InvalidRuntimeTokenError, mintSessionToken, mintRuntimeToken, mintScriptRunToken, insertSessionToken, revokeSessionToken, revokeRuntimeTokensForRuntime, AgentTokenExistsError, mintAgentToken, rotateAgentToken, revokeAgentTokens, resolveSessionToken, fingerprintApiKey, init_users };
|
|
456
|
+
export { registerSessionTokenConnection, closeSessionTokenConnections, init_session_token_connections, findUserById, findUserByExternalId, findUserByEmail, findUsersByName, getUserIdentities, listUserEvents, listUserTokens, recordIdentityEvent, findOrCreateUserByEmail, linkIdentity, unlinkIdentity, mintToken, revokeToken, resolveUserByToken, InvalidRuntimeTokenError, mintSessionToken, mintRuntimeToken, mintScriptRunToken, isScriptRunToken, insertSessionToken, revokeSessionToken, revokeRuntimeTokensForRuntime, AgentTokenExistsError, mintAgentToken, rotateAgentToken, revokeAgentTokens, resolveSessionToken, fingerprintApiKey, init_users };
|
|
@@ -6,12 +6,12 @@ import {
|
|
|
6
6
|
isSensitiveKey,
|
|
7
7
|
scrubSecrets,
|
|
8
8
|
init_secret_scrubber
|
|
9
|
-
} from "./cli-
|
|
9
|
+
} from "./cli-708wdy32.js";
|
|
10
10
|
import {
|
|
11
11
|
openAICompatibleKeyVars,
|
|
12
12
|
openAICompatibleBaseUrlVars,
|
|
13
13
|
init_src2
|
|
14
|
-
} from "./cli-
|
|
14
|
+
} from "./cli-gxee0bqa.js";
|
|
15
15
|
import {
|
|
16
16
|
__esm
|
|
17
17
|
} from "./cli-242037k3.js";
|
|
@@ -1,34 +1,45 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Anthropic
|
|
3
|
-
} from "./cli-
|
|
3
|
+
} from "./cli-rr7zx19j.js";
|
|
4
|
+
import {
|
|
5
|
+
contextBoundNoteThreshold,
|
|
6
|
+
createContextBoundNote
|
|
7
|
+
} from "./cli-nq677csy.js";
|
|
4
8
|
import {
|
|
5
9
|
checkToolLoop
|
|
6
10
|
} from "./cli-0726awxw.js";
|
|
7
|
-
import {
|
|
8
|
-
CONTEXT_FORMULA,
|
|
9
|
-
getContextWindowSize,
|
|
10
|
-
computeContextUsedUnified,
|
|
11
|
-
clampContextPercent
|
|
12
|
-
} from "./cli-a5ebc95n.js";
|
|
13
11
|
import {
|
|
14
12
|
readPkgVersion
|
|
15
13
|
} from "./cli-kr5tjjtz.js";
|
|
16
14
|
import {
|
|
17
15
|
createSwarmEventHandler
|
|
18
16
|
} from "./cli-4zsenjhy.js";
|
|
17
|
+
import {
|
|
18
|
+
CONTEXT_FORMULA,
|
|
19
|
+
getContextWindowSize,
|
|
20
|
+
computeContextUsedUnified,
|
|
21
|
+
clampContextPercent,
|
|
22
|
+
init_context_window
|
|
23
|
+
} from "./cli-pfk92eqz.js";
|
|
24
|
+
import {
|
|
25
|
+
selectCredential,
|
|
26
|
+
init_credentials
|
|
27
|
+
} from "./cli-1tem6ns9.js";
|
|
19
28
|
import {
|
|
20
29
|
runtimeCatalogModel,
|
|
21
30
|
init_runtime_model_catalog
|
|
22
|
-
} from "./cli-
|
|
31
|
+
} from "./cli-803188pb.js";
|
|
23
32
|
import {
|
|
24
33
|
scrubSecrets,
|
|
25
34
|
init_secret_scrubber
|
|
26
|
-
} from "./cli-
|
|
35
|
+
} from "./cli-708wdy32.js";
|
|
27
36
|
import {
|
|
28
37
|
init_src2
|
|
29
|
-
} from "./cli-
|
|
38
|
+
} from "./cli-gxee0bqa.js";
|
|
30
39
|
|
|
31
40
|
// src/providers/claude-managed-adapter.ts
|
|
41
|
+
init_context_window();
|
|
42
|
+
init_credentials();
|
|
32
43
|
init_secret_scrubber();
|
|
33
44
|
|
|
34
45
|
// src/providers/claude-managed-models.ts
|
|
@@ -183,6 +194,9 @@ class ClaudeManagedSession {
|
|
|
183
194
|
taskId;
|
|
184
195
|
aborted = false;
|
|
185
196
|
settled = false;
|
|
197
|
+
lastRequestContextTokens;
|
|
198
|
+
observeContextBound;
|
|
199
|
+
openToolCalls = new Set;
|
|
186
200
|
constructor(client, sessionId, config, userMessageContent, seenEventIds = new Set) {
|
|
187
201
|
this.client = client;
|
|
188
202
|
this._sessionId = sessionId;
|
|
@@ -194,6 +208,12 @@ class ClaudeManagedSession {
|
|
|
194
208
|
this.completionPromise = new Promise((resolve) => {
|
|
195
209
|
this.resolveCompletion = resolve;
|
|
196
210
|
});
|
|
211
|
+
this.observeContextBound = createContextBoundNote({
|
|
212
|
+
threshold: contextBoundNoteThreshold(config.env ?? process.env),
|
|
213
|
+
model: () => this.cost.model,
|
|
214
|
+
canDeliver: () => !this.settled && !this.aborted && this.openToolCalls.size > 0,
|
|
215
|
+
inject: (note) => this.deliverSteering({ mode: "steer", text: note })
|
|
216
|
+
});
|
|
197
217
|
if (config.taskId && config.apiUrl && config.apiKey) {
|
|
198
218
|
const abortRef = { current: this.abortController };
|
|
199
219
|
const handler = createClaudeManagedSwarmEventHandler({
|
|
@@ -308,6 +328,8 @@ class ClaudeManagedSession {
|
|
|
308
328
|
case "agent.tool_use": {
|
|
309
329
|
const tu = event;
|
|
310
330
|
this.runToolLoopCheck(tu.name, tu.input);
|
|
331
|
+
this.openToolCalls.add(tu.id);
|
|
332
|
+
this.observeContextBound(this.lastRequestContextTokens);
|
|
311
333
|
this.emit({
|
|
312
334
|
type: "tool_start",
|
|
313
335
|
toolCallId: tu.id,
|
|
@@ -320,6 +342,8 @@ class ClaudeManagedSession {
|
|
|
320
342
|
const tu = event;
|
|
321
343
|
const fqToolName = `${tu.mcp_server_name}:${tu.name}`;
|
|
322
344
|
this.runToolLoopCheck(fqToolName, tu.input);
|
|
345
|
+
this.openToolCalls.add(tu.id);
|
|
346
|
+
this.observeContextBound(this.lastRequestContextTokens);
|
|
323
347
|
this.emit({
|
|
324
348
|
type: "tool_start",
|
|
325
349
|
toolCallId: tu.id,
|
|
@@ -330,6 +354,7 @@ class ClaudeManagedSession {
|
|
|
330
354
|
}
|
|
331
355
|
case "agent.tool_result": {
|
|
332
356
|
const tr = event;
|
|
357
|
+
this.openToolCalls.delete(tr.tool_use_id);
|
|
333
358
|
this.emit({
|
|
334
359
|
type: "tool_end",
|
|
335
360
|
toolCallId: tr.tool_use_id,
|
|
@@ -341,6 +366,7 @@ class ClaudeManagedSession {
|
|
|
341
366
|
}
|
|
342
367
|
case "agent.mcp_tool_result": {
|
|
343
368
|
const tr = event;
|
|
369
|
+
this.openToolCalls.delete(tr.mcp_tool_use_id);
|
|
344
370
|
this.emit({
|
|
345
371
|
type: "tool_end",
|
|
346
372
|
toolCallId: tr.mcp_tool_use_id,
|
|
@@ -372,6 +398,7 @@ class ClaudeManagedSession {
|
|
|
372
398
|
case "span.model_request_end": {
|
|
373
399
|
const sp = event;
|
|
374
400
|
const usage = sp.model_usage;
|
|
401
|
+
this.lastRequestContextTokens = usage.input_tokens + usage.cache_read_input_tokens + usage.cache_creation_input_tokens;
|
|
375
402
|
this.cost.inputTokens = (this.cost.inputTokens ?? 0) + usage.input_tokens;
|
|
376
403
|
this.cost.outputTokens = (this.cost.outputTokens ?? 0) + usage.output_tokens;
|
|
377
404
|
this.cost.cacheReadTokens = (this.cost.cacheReadTokens ?? 0) + usage.cache_read_input_tokens;
|
|
@@ -570,7 +597,7 @@ class ClaudeManagedAdapter2 {
|
|
|
570
597
|
if (missing.length > 0) {
|
|
571
598
|
throw new Error(`[claude-managed] Missing required env var(s): ${missing.join(", ")}. ` + `Run \`bun run src/cli.tsx claude-managed-setup\` to create an Anthropic-side ` + `agent + environment and persist their IDs to swarm_config.`);
|
|
572
599
|
}
|
|
573
|
-
this.apiKey = process.env.ANTHROPIC_API_KEY;
|
|
600
|
+
this.apiKey = selectCredential(process.env.ANTHROPIC_API_KEY, undefined, "ANTHROPIC_API_KEY").selected;
|
|
574
601
|
this.agentId = process.env.MANAGED_AGENT_ID;
|
|
575
602
|
this.environmentId = process.env.MANAGED_ENVIRONMENT_ID;
|
|
576
603
|
if (opts.client) {
|
|
@@ -580,6 +607,10 @@ class ClaudeManagedAdapter2 {
|
|
|
580
607
|
}
|
|
581
608
|
}
|
|
582
609
|
async createSession(config) {
|
|
610
|
+
const taskKey = config.env?.ANTHROPIC_API_KEY;
|
|
611
|
+
const client = taskKey && this.client instanceof Anthropic ? this.client.withOptions({
|
|
612
|
+
apiKey: selectCredential(taskKey, undefined, "ANTHROPIC_API_KEY").selected
|
|
613
|
+
}) : this.client;
|
|
583
614
|
if (config.resumeSessionId) {
|
|
584
615
|
console.warn("[claude-managed-adapter] resumeSessionId ignored — native resume is disabled by deprecation plan");
|
|
585
616
|
}
|
|
@@ -611,9 +642,9 @@ class ClaudeManagedAdapter2 {
|
|
|
611
642
|
if (vaultIds.length > 0) {
|
|
612
643
|
createParams.vault_ids = Array.from(new Set(vaultIds));
|
|
613
644
|
}
|
|
614
|
-
const created = await Promise.resolve(
|
|
645
|
+
const created = await Promise.resolve(client.beta.sessions.create(createParams));
|
|
615
646
|
const sessionId = created.id;
|
|
616
|
-
return new ClaudeManagedSession(
|
|
647
|
+
return new ClaudeManagedSession(client, sessionId, config, userMessageContent, seenEventIds);
|
|
617
648
|
}
|
|
618
649
|
async canResume(sessionId) {
|
|
619
650
|
try {
|