@desplega.ai/agent-swarm 1.160.0 → 1.162.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 +4 -3
- package/dist/{acp-adapter-2mjwcsfh.js → acp-adapter-74m73ae9.js} +163 -49
- package/dist/{actions-e43rxskr.js → actions-4sr14gnt.js} +42 -38
- package/dist/{anthropic-messages-5qx80j9k.js → anthropic-messages-8xxrzky9.js} +22 -26
- package/dist/{app-mc7xfagn.js → app-pt68fbwp.js} +17 -14
- package/dist/{artifact-3v5t9jtg.js → artifact-fey7dvj9.js} +3 -2
- package/dist/{assistant-sedkzv3b.js → assistant-cv3jytks.js} +43 -39
- package/dist/{azure-openai-responses-nfb21z9a.js → azure-openai-responses-f5cqsyj8.js} +15 -10
- package/dist/{boot-reembed-m3656j2n.js → boot-reembed-4ht4gqth.js} +17 -14
- package/dist/{boot-reembed-cqz9swn5.js → boot-reembed-nxpcvpj9.js} +16 -13
- package/dist/{boot-scrub-logs-xbxf5d7w.js → boot-scrub-logs-k93kyw8k.js} +13 -10
- package/dist/boot-seeds-1skcrs0e.js +32 -0
- package/dist/{claude-adapter-dc6289mc.js → claude-adapter-r5g0tzge.js} +39 -30
- package/dist/{claude-managed-adapter-naaw51me.js → claude-managed-adapter-yxkfxg8j.js} +6 -5
- package/dist/{claude-managed-setup-eacvchx0.js → claude-managed-setup-pkyrgshb.js} +27 -27
- package/dist/{claude-sdk-session-bqp2xvym.js → claude-sdk-session-jxyxnrwd.js} +8041 -7910
- package/dist/{cli-4derpgyk.js → cli-2hhfhfq5.js} +6 -1
- package/dist/{cli-rykfmgwg.js → cli-2x0e561b.js} +1 -1
- package/dist/{cli-tzx2ke1v.js → cli-2zy95vhm.js} +137 -64
- package/dist/{cli-0x01kwrd.js → cli-4cwxn7gp.js} +47 -186
- package/dist/{cli-xjcywfsf.js → cli-4dcpaefp.js} +12 -11
- package/dist/{cli-v7fn5gms.js → cli-4x0csdjq.js} +164 -76
- package/dist/{cli-12tszpk9.js → cli-5bcd7sfy.js} +91 -29
- package/dist/{cli-jz4w45qt.js → cli-5k6k8ta3.js} +190 -50
- package/dist/{cli-tpq83z89.js → cli-5xhpb3kv.js} +20 -19
- package/dist/{cli-r1mxd1xh.js → cli-7af8yhav.js} +6 -179
- package/dist/{cli-jajnsm8q.js → cli-7tre70zp.js} +18160 -31345
- package/dist/{cli-447dt1h3.js → cli-8ev9xqnx.js} +218 -25
- package/dist/cli-bsky8g7w.js +449 -0
- package/dist/{cli-0z2v4nhw.js → cli-cat6h73s.js} +1 -1
- package/dist/{cli-25fcq4b4.js → cli-cebmgwsc.js} +15 -11
- package/dist/{cli-shkxm1vn.js → cli-cvatsam7.js} +189 -13
- package/dist/{cli-2658f6at.js → cli-cvk6yzw5.js} +6 -8
- package/dist/cli-dbmwby6a.js +9 -0
- package/dist/{cli-ptr8h7kp.js → cli-eg0b3p0k.js} +5 -218
- package/dist/cli-f9w1semm.js +413 -0
- package/dist/{cli-523679eh.js → cli-g739zqzt.js} +6 -5
- package/dist/{cli-dv6cdjs2.js → cli-gd4favx9.js} +28 -7
- package/dist/{cli-c8a36vcc.js → cli-gpqpmns7.js} +2 -2
- package/dist/{cli-5nbmpy8w.js → cli-hb5c2x5y.js} +1 -1
- package/dist/{cli-741yb0xx.js → cli-hmsw1gpy.js} +55 -169
- package/dist/{cli-qydf22qq.js → cli-jf7wmv1r.js} +2562 -735
- package/dist/{cli-mfe5btp9.js → cli-jxs2ygaw.js} +317 -121
- package/dist/{cli-kmcpfwn2.js → cli-jyy6pm2f.js} +19 -3
- package/dist/cli-kdkwd3yr.js +615 -0
- package/dist/{cli-6cs6wzxt.js → cli-kh04eqwe.js} +2 -2
- package/dist/{cli-9hsgwz4w.js → cli-kp42yek0.js} +1309 -391
- package/dist/cli-ma3zvh39.js +10404 -0
- package/dist/{cli-ybgv4kw2.js → cli-mbssg1xv.js} +9 -2
- package/dist/{cli-jsp14b6c.js → cli-mzfth0bp.js} +38 -1
- package/dist/{cli-r2ap2czm.js → cli-nexqx4ve.js} +6 -0
- package/dist/{cli-f8gy6r2r.js → cli-nq7yqw7b.js} +19 -8
- package/dist/{cli-10nhj6xq.js → cli-nt8hecg9.js} +34 -33
- package/dist/cli-p0r8sxj5.js +303 -0
- package/dist/{cli-58e8yr0d.js → cli-pkd6s2wy.js} +4 -2
- package/dist/{cli-a8dvhzrt.js → cli-q24re23n.js} +7 -5
- package/dist/cli-qjjvzwzd.js +222 -0
- package/dist/cli-qrgt5bqf.js +189 -0
- package/dist/{cli-et8m9xsv.js → cli-rfjw9jw2.js} +22 -10
- package/dist/{cli-7e398j1h.js → cli-rj0gqwwp.js} +3 -3
- package/dist/{cli-btfv8y88.js → cli-rnyzn44p.js} +2 -2
- package/dist/{cli-d5czme6m.js → cli-s3hwpt9v.js} +4754 -4945
- package/dist/{cli-0jwe9034.js → cli-sptrj5f5.js} +3 -3
- package/dist/{cli-0q3avq3s.js → cli-sqvfa090.js} +19 -11
- package/dist/{cli-azhgzetg.js → cli-swfmp1fx.js} +27 -27
- package/dist/{cli-jyk0ynw2.js → cli-t845n9xk.js} +23 -10
- package/dist/{cli-zpep9q5e.js → cli-tcen9p5w.js} +20 -15
- package/dist/{cli-74h9hscv.js → cli-tre4bdgq.js} +1 -1
- package/dist/{cli-pm1rst0h.js → cli-twrh04ap.js} +30 -15
- package/dist/{cli-phsaj4xq.js → cli-v0pvvhfq.js} +1 -1
- package/dist/{cli-ydmcgve1.js → cli-vc9bp061.js} +5 -5
- package/dist/{cli-g2whhdrf.js → cli-vxe6qa4h.js} +1 -1
- package/dist/{cli-vctdqs5h.js → cli-vy3ed88x.js} +15 -2
- package/dist/{cli-br0qdrnp.js → cli-vyqs9ya8.js} +18 -18
- package/dist/{cli-cpvsaqsw.js → cli-w0bwte75.js} +8 -5
- package/dist/cli-wbvnn6tk.js +861 -0
- package/dist/{cli-r94z9p1z.js → cli-wgbezhw2.js} +3 -0
- package/dist/{cli-evvtk35y.js → cli-wjgs5wxe.js} +7 -7
- package/dist/cli-wxkkd0e0.js +33 -0
- package/dist/{cli-0wgxmwf6.js → cli-xk79303e.js} +20 -7
- package/dist/{cli-ktmyrtpn.js → cli-xqpk3rp7.js} +33 -10
- package/dist/{cli-ygwm91nt.js → cli-yy6dew39.js} +1 -1
- package/dist/cli-zp38xvtm.js +9487 -0
- package/dist/{cli-tfky2838.js → cli-zvhd3f64.js} +4 -4
- package/dist/{cli-jayjpjmb.js → cli-zxqx25nz.js} +66 -23
- package/dist/cli.js +40 -32
- package/dist/{cloudflare-workers-ai-system-one-k6fbxw9d.js → cloudflare-workers-ai-system-one-k8ddqjkq.js} +8 -6
- package/dist/{codex-adapter-nmxcatww.js → codex-adapter-esvmnhn7.js} +24 -23
- package/dist/{codex-hook-20me6byw.js → codex-hook-m73jmqgx.js} +19 -3
- package/dist/{codex-login-w6fz4xbz.js → codex-login-cf7mzsgg.js} +2 -2
- package/dist/{codex-session-runner-90aa80ev.js → codex-session-runner-ban9excr.js} +24 -23
- package/dist/{commands-8wcq1kn7.js → commands-75413p2n.js} +13 -10
- package/dist/{db-j40kc4se.js → db-7f5pecwg.js} +17 -10
- package/dist/{dispatcher-4zqy768d.js → dispatcher-fh9at8nz.js} +41 -37
- package/dist/dsh-adapter-wpze65d4.js +24 -0
- package/dist/{e2b-ez07znam.js → e2b-gjgdjp91.js} +12 -9
- package/dist/easter-egg-3d-3w5c2n4c.js +1057 -0
- package/dist/{execute-6e7qeyk4.js → execute-f50wg9nh.js} +203 -49
- package/dist/{google-generative-ai-k6n5nbpp.js → google-generative-ai-jxxpnegy.js} +2 -2
- package/dist/{google-vertex-44xxtcvp.js → google-vertex-x7q1angm.js} +5 -5
- package/dist/{handlers-kjdce1w5.js → handlers-w13787bb.js} +44 -40
- package/dist/{hook-r2t4bqfg.js → hook-46g1jrvx.js} +34 -20
- package/dist/{hook-czx13n12.js → hook-4tpts2ry.js} +25 -21
- package/dist/{http-3bbb19be.js → http-19pzbfrt.js} +1440 -283
- package/dist/{index-668me3f0.js → index-8fd4dm4h.js} +42 -38
- package/dist/{index-fg0dsp6c.js → index-dqmp15bq.js} +41 -37
- package/dist/{index-kkv84jq9.js → index-qb4q1y3e.js} +41 -37
- package/dist/index-s75wc4wd.js +33 -0
- package/dist/{index-zg7vp46x.js → index-scptvdxg.js} +64 -38
- package/dist/{keepalive-yra8dy57.js → keepalive-xa5ts9cd.js} +15 -12
- package/dist/{lead-va0pad2c.js → lead-qp4xkvjq.js} +59 -54
- package/dist/{maintenance-hqewtmyg.js → maintenance-rm5885hm.js} +17 -14
- package/dist/{mistral-conversations-pc3ntnxt.js → mistral-conversations-rw7fbt22.js} +4 -4
- package/dist/{node-a5e00qhp.js → node-8zkdq42h.js} +834 -833
- package/dist/node-f0ykebbv.js +2107 -0
- package/dist/node-wyamey5r.js +19 -0
- package/dist/{oauth-refresh-sweep-7rdt1m9n.js → oauth-refresh-sweep-1csdfebf.js} +14 -11
- package/dist/{onboard-j6ms6d0x.js → onboard-r6b78cs4.js} +10 -10
- package/dist/{openai-codex-responses-bbancrr0.js → openai-codex-responses-efvrgrq3.js} +4 -4
- package/dist/{openai-completions-jpaj5g2b.js → openai-completions-bbbrrz4z.js} +12 -8
- package/dist/{openai-responses-200k1wx4.js → openai-responses-9jjyrcm1.js} +15 -10
- package/dist/{opencode-adapter-89rabkw2.js → opencode-adapter-kb3g6pkf.js} +12 -9
- package/dist/{otel-impl-a792rjz0.js → otel-impl-0y9knpky.js} +6 -6
- package/dist/{pi-mono-adapter-g7qzvr3v.js → pi-mono-adapter-z6s1bme2.js} +128 -37
- package/dist/{pricing-refresh-wx0tp7cb.js → pricing-refresh-mth26tgp.js} +15 -12
- package/dist/{rbac-roles-8tzawacv.js → rbac-roles-kwntb23q.js} +17 -12
- package/dist/rbac-roles-vpk4ebm8.js +45 -0
- package/dist/{registry-v5wytg0s.js → registry-km6t1jd2.js} +1 -1
- package/dist/{render-v2-mm7zswb8.js → render-v2-hcm7h00y.js} +17 -14
- package/dist/{runtime-zyssgse0.js → runtime-vfjsfsc5.js} +5 -4
- package/dist/{setup-8y70ys6t.js → setup-hbyzd65h.js} +2 -2
- package/dist/{virtual-modules-6nmk7h3n.js → virtual-modules-9bv7ry91.js} +9 -7
- package/dist/{work-objects-fg6xkb0n.js → work-objects-m09sxnhe.js} +44 -40
- package/dist/{worker-wmwhxsph.js → worker-0h35rvk4.js} +59 -54
- package/dist/{x-n3e0v3xa.js → x-f1gt1pz3.js} +2 -2
- package/openapi.json +699 -26
- package/package.json +19 -11
- package/src/azure-devops/api.ts +121 -0
- package/src/azure-devops/auth.ts +78 -0
- package/src/azure-devops/handlers.ts +413 -0
- package/src/azure-devops/index.ts +27 -0
- package/src/azure-devops/templates.ts +108 -0
- package/src/azure-devops/types.ts +90 -0
- package/src/be/api-drain.ts +184 -0
- package/src/be/db/tasks/read.ts +32 -7
- package/src/be/db/tasks/write.ts +21 -4
- package/src/be/db-client.ts +11 -2
- package/src/be/db-retention.ts +95 -32
- package/src/be/db.ts +44 -19
- package/src/be/memory/constants.ts +16 -0
- package/src/be/memory/graph-expansion.ts +8 -1
- package/src/be/memory/index-content.ts +20 -1
- package/src/be/memory/key-guard.ts +93 -0
- package/src/be/memory/key-paths.ts +103 -0
- package/src/be/memory/link-resolver.ts +29 -3
- package/src/be/memory/providers/sqlite-store.ts +152 -45
- package/src/be/memory/raters/llm-summarizer.ts +10 -4
- package/src/be/memory/raters/llm.ts +15 -5
- package/src/be/memory/raters/store.ts +6 -3
- package/src/be/memory/raters/types.ts +11 -0
- package/src/be/memory/reranker.ts +38 -7
- package/src/be/memory/types.ts +12 -1
- package/src/be/migrations/190_memory_rating_model.sql +7 -0
- package/src/be/migrations/191_context_versions_previous_index.sql +8 -0
- package/src/be/migrations/192_favorites_agent_fs_path.sql +36 -0
- package/src/be/onboarding.ts +7 -1
- package/src/be/pricing-normalize.ts +4 -2
- package/src/be/scripts/typecheck.ts +4 -3
- package/src/be/seed-pricing.ts +16 -0
- package/src/be/seed-prompt-templates.ts +1 -0
- package/src/be/swarm-config-guard.ts +46 -17
- package/src/be/task-citations.ts +11 -5
- package/src/be/users.ts +3 -0
- package/src/cli.tsx +3 -2
- package/src/comb/agent-fs.ts +39 -0
- package/src/comb/config.ts +37 -0
- package/src/comb/markers.ts +37 -0
- package/src/comb/review-batch.ts +486 -0
- package/src/comb/templates.ts +88 -0
- package/src/commands/claude-managed-setup.ts +33 -31
- package/src/commands/context-preamble.ts +4 -1
- package/src/commands/hook.ts +2 -1
- package/src/commands/provider-credentials.ts +28 -15
- package/src/commands/runner.ts +458 -110
- package/src/commands/templates.ts +10 -0
- package/src/e2b/env.ts +2 -0
- package/src/extensions/catalog.generated.json +17 -0
- package/src/extensions/contract-types.generated.ts +1 -1
- package/src/fs/agent-fs-provider.ts +106 -2
- package/src/github/handlers.ts +10 -74
- package/src/github/reactions.ts +119 -138
- package/src/github/task-reactions.ts +34 -11
- package/src/heartbeat/heartbeat.ts +4 -0
- package/src/hooks/codex-hook.ts +25 -1
- package/src/hooks/hook.ts +14 -1
- package/src/hooks/pr-body-guard.ts +983 -0
- package/src/http/agents.ts +1 -1
- package/src/http/all-routes.ts +1 -0
- package/src/http/assets.ts +5 -17
- package/src/http/comb.ts +131 -0
- package/src/http/core.ts +14 -1
- package/src/http/extensions.ts +51 -27
- package/src/http/fs.ts +9 -17
- package/src/http/index.ts +27 -9
- package/src/http/mcp-user.ts +8 -13
- package/src/http/mcp.ts +19 -12
- package/src/http/memory.ts +80 -14
- package/src/http/onboarding.ts +21 -2
- package/src/http/poll.ts +30 -3
- package/src/http/realtime.ts +62 -0
- package/src/http/request-principal.ts +22 -0
- package/src/http/session-data.ts +6 -4
- package/src/http/stats.ts +1 -0
- package/src/http/status.ts +34 -2
- package/src/http/tasks.ts +17 -3
- package/src/http/users.ts +1 -1
- package/src/http/webhooks.ts +120 -2
- package/src/kv-reserved-namespaces.ts +10 -5
- package/src/providers/claude-adapter.ts +84 -16
- package/src/providers/claude-managed-adapter.ts +29 -2
- package/src/providers/codex-adapter.ts +1 -1
- package/src/providers/codex-skill-resolver.ts +6 -0
- package/src/providers/dsh-adapter.ts +204 -7
- package/src/providers/opencode-adapter.ts +24 -3
- package/src/providers/pi-mono-adapter.ts +154 -5
- package/src/providers/pi-mono-extension.ts +1 -1
- package/src/providers/pricing-sources.md +5 -1
- package/src/providers/reasoning-effort.ts +10 -2
- package/src/providers/types.ts +1 -1
- package/src/rbac/legacy-policy.ts +3 -0
- package/src/rbac/permissions.ts +14 -0
- package/src/realtime/auth.ts +63 -1
- package/src/realtime/tickets.ts +52 -0
- package/src/realtime/transport.ts +51 -22
- package/src/scripts-runtime/types/stdlib.d.ts +13 -5
- package/src/scripts-runtime/types/swarm-extension.d.ts +7 -3
- package/src/scripts-runtime/types/swarm-sdk.d.ts +13 -5
- package/src/tasks/context-key.ts +38 -1
- package/src/telemetry-context.ts +175 -0
- package/src/telemetry-contract/EVENTS.md +81 -0
- package/src/telemetry-contract/SOURCE.json +9 -0
- package/src/telemetry-contract/catalog.json +1335 -0
- package/src/telemetry-contract/index.ts +60 -0
- package/src/telemetry-contract/types.gen.ts +1971 -0
- package/src/telemetry-identity.ts +129 -0
- package/src/telemetry-snapshot.ts +211 -0
- package/src/telemetry-trigger.ts +125 -0
- package/src/telemetry-types.typetest.ts +40 -0
- package/src/telemetry.ts +271 -67
- package/src/tests/api-drain-e2e.test.ts +249 -0
- package/src/tests/api-drain-worker-e2e.test.ts +216 -0
- package/src/tests/api-drain.test.ts +351 -0
- package/src/tests/azure-devops-auth.test.ts +100 -0
- package/src/tests/azure-devops-handlers.test.ts +324 -0
- package/src/tests/azure-devops-webhook-malformed.test.ts +96 -0
- package/src/tests/claude-default-route.test.ts +260 -0
- package/src/tests/claude-managed-adapter.test.ts +47 -0
- package/src/tests/claude-managed-setup.test.ts +48 -0
- package/src/tests/claude-prompt-body-once.test.ts +117 -0
- package/src/tests/claude-routes-e2e.test.ts +316 -0
- package/src/tests/comb-config-guard.test.ts +38 -0
- package/src/tests/comb-links.test.ts +162 -0
- package/src/tests/comb-markers.test.ts +68 -0
- package/src/tests/comb-review-batch.test.ts +770 -0
- package/src/tests/comb-status.test.ts +152 -0
- package/src/tests/context-versions-retention.test.ts +314 -0
- package/src/tests/core-auth.test.ts +7 -0
- package/src/tests/db-retention.test.ts +14 -14
- package/src/tests/db-task-read-contract.test.ts +3 -0
- package/src/tests/db-task-write-contract.test.ts +3 -0
- package/src/tests/docs-index-footprint.test.js +3 -3
- package/src/tests/dsh-adapter.test.ts +134 -2
- package/src/tests/dsh-usage.test.ts +153 -0
- package/src/tests/extensions-catalog.test.ts +1 -0
- package/src/tests/extensions-example-deploy-awareness.test.ts +301 -0
- package/src/tests/extensions-http.test.ts +137 -10
- package/src/tests/extensions-mcp-tools.test.ts +28 -0
- package/src/tests/favorites-agent-fs-path.test.ts +226 -0
- package/src/tests/fetch-resolved-env.test.ts +24 -0
- package/src/tests/fixtures/azure-devops/pull-request-commented.json +129 -0
- package/src/tests/fixtures/azure-devops/pull-request-created.json +88 -0
- package/src/tests/fixtures/fake-claude-routes.ts +229 -0
- package/src/tests/github-handlers-reactions.test.ts +486 -0
- package/src/tests/github-reactions.test.ts +280 -0
- package/src/tests/harness-cli-version.test.ts +62 -0
- package/src/tests/http-api-integration.test.ts +21 -0
- package/src/tests/http-task-write-ownership.test.ts +24 -1
- package/src/tests/internal-ai/complete-structured.test.ts +94 -0
- package/src/tests/internal-ai/credentials.test.ts +22 -0
- package/src/tests/internal-ai/models.test.ts +36 -2
- package/src/tests/internal-ai/schema-parity.test.ts +25 -1
- package/src/tests/internal-ai/summarize-session.test.ts +23 -7
- package/src/tests/mcp-user-route.test.ts +133 -0
- package/src/tests/memory-key-paths.test.ts +1055 -0
- package/src/tests/memory-link-resolver.test.ts +34 -0
- package/src/tests/memory-rate-endpoint.test.ts +66 -0
- package/src/tests/memory-rater-llm-summarizer.test.ts +2 -1
- package/src/tests/memory-rater-llm.test.ts +73 -0
- package/src/tests/memory-rater-store.test.ts +31 -0
- package/src/tests/memory-reranker.test.ts +40 -0
- package/src/tests/onboarding.test.ts +108 -0
- package/src/tests/opencode-adapter.test.ts +57 -0
- package/src/tests/opencode-plugin.test.ts +4 -0
- package/src/tests/pi-codemode.test.ts +82 -4
- package/src/tests/pi-mono-adapter.test.ts +265 -2
- package/src/tests/pr-body-leaks.test.ts +789 -0
- package/src/tests/preload.ts +14 -0
- package/src/tests/provider-registration.test.ts +0 -2
- package/src/tests/providers/pi-cost.test.ts +190 -4
- package/src/tests/rbac-engine.test.ts +25 -1
- package/src/tests/realtime-room-auth.test.ts +104 -1
- package/src/tests/realtime-tickets.test.ts +74 -0
- package/src/tests/realtime-transport.test.ts +131 -4
- package/src/tests/runner-api-drain.test.ts +301 -0
- package/src/tests/runner-fallback-output.test.ts +61 -0
- package/src/tests/runner-fenced-json-output.test.ts +178 -0
- package/src/tests/runner-slot-reconcile.test.ts +199 -0
- package/src/tests/script-connections.test.ts +6 -0
- package/src/tests/send-task-requested-by.test.ts +133 -15
- package/src/tests/session-costs-recompute-all-providers.test.ts +23 -0
- package/src/tests/task-lifecycle-telemetry.test.ts +8 -3
- package/src/tests/task-reactions.test.ts +29 -6
- package/src/tests/telemetry-context.test.ts +314 -0
- package/src/tests/telemetry-init.test.ts +51 -19
- package/src/tests/telemetry-snapshot.test.ts +229 -0
- package/src/tests/telemetry-trigger.test.ts +200 -0
- package/src/tests/template-registry-helpers.ts +1 -0
- package/src/tests/vcs-azure-devops.test.ts +73 -0
- package/src/tests/webhooks-task-blocked.test.ts +23 -0
- package/src/tests/workflow-agent-task-retry.test.ts +363 -0
- package/src/tests/workflow-definition-telemetry.test.ts +4 -4
- package/src/tests/workflow-llm.test.ts +14 -0
- package/src/tools/context-diff.ts +20 -0
- package/src/tools/extension-install.ts +27 -16
- package/src/tools/memory-edit.ts +47 -3
- package/src/tools/memory-search.ts +13 -1
- package/src/tools/memory-store.ts +55 -3
- package/src/tools/poll-task.ts +20 -1
- package/src/tools/send-task.ts +9 -1
- package/src/tools/task-action.ts +11 -0
- package/src/types.ts +45 -8
- package/src/utils/api-drain.ts +24 -0
- package/src/utils/constants.ts +57 -16
- package/src/utils/credentials.test.ts +31 -1
- package/src/utils/credentials.ts +20 -9
- package/src/utils/dsh-usage.ts +53 -0
- package/src/utils/harness-cli-version.ts +6 -4
- package/src/utils/internal-ai/complete-structured.ts +26 -3
- package/src/utils/internal-ai/credentials.ts +23 -9
- package/src/utils/internal-ai/index.ts +8 -1
- package/src/utils/internal-ai/models.ts +34 -8
- package/src/utils/internal-ai/summarize-session.ts +22 -8
- package/src/utils/pr-body-leaks.ts +172 -0
- package/src/utils/secret-scrubber.ts +8 -0
- package/src/utils/task-attachment-links.ts +14 -8
- package/src/vcs/azure-devops.ts +80 -0
- package/src/vcs/index.ts +5 -1
- package/src/vcs/types.ts +2 -2
- package/src/workflows/recovery.ts +26 -1
- package/src/workflows/resume.ts +31 -4
- package/src/workflows/task-step-routing.ts +75 -2
- package/templates/community/open-prompt-showreel/PLAYBOOK.md +336 -0
- package/templates/community/open-prompt-showreel/README.md +33 -0
- package/templates/community/open-prompt-showreel/example/tla-races/facts.ts +145 -0
- package/templates/community/open-prompt-showreel/example/tla-races/facts.v3.json +140 -0
- package/templates/community/open-prompt-showreel/example/tla-races/music.mist-city.json +8 -0
- package/templates/community/open-prompt-showreel/example/tla-races/reel.html +805 -0
- package/templates/community/open-prompt-showreel/example/tla-races/smoke.sh +48 -0
- package/templates/community/open-prompt-showreel/lead-prompt.md +89 -0
- package/templates/community/open-prompt-showreel/setup.sh +167 -0
- package/templates/community/open-prompt-showreel/skills/motion-design-replication/SKILL.md +85 -0
- package/templates/community/open-prompt-showreel/skills/motion-design-video-analysis/SKILL.md +115 -0
- package/templates/community/open-prompt-showreel/skills/open-prompt-showreel/SKILL.md +147 -0
- package/templates/community/open-prompt-showreel/skills/video-generation/SKILL.md +195 -0
- package/templates/community/open-prompt-showreel/tools/fetch-music.sh +65 -0
- package/templates/community/open-prompt-showreel/tools/music-analyze.py +69 -0
- package/templates/community/open-prompt-showreel/tools/music-current.sh +34 -0
- package/templates/community/open-prompt-showreel/tools/music-cut.sh +36 -0
- package/templates/community/open-prompt-showreel/tools/music-refine.py +39 -0
- package/templates/community/open-prompt-showreel/tools/render.mjs +157 -0
- package/templates/community/open-prompt-showreel/tools/sheet.sh +44 -0
- package/templates/community/open-prompt-showreel/tools/web-compress.sh +17 -0
- package/templates/community/open-prompt-showreel/tools/x-reencode.sh +21 -0
- package/templates/extensions/README.md +1 -0
- package/templates/extensions/deploy-awareness/README.md +28 -0
- package/templates/extensions/deploy-awareness/hooks.ts +152 -0
- package/templates/extensions/deploy-awareness/manifest.json +8 -0
- package/templates/skills/memory/config.json +2 -2
- package/templates/skills/memory/content.md +59 -5
- package/templates/skills/swarm-extensions/config.json +1 -1
- package/templates/skills/swarm-extensions/content.md +28 -5
- package/tsconfig.json +3 -0
- package/dist/boot-seeds-gsetbs5y.js +0 -28
- package/dist/cli-j490egb5.js +0 -5632
- package/dist/cli-tjf4cn8z.js +0 -9119
- package/dist/cli-tmqt7dpj.js +0 -572
- package/dist/dsh-adapter-mpnzgztj.js +0 -19
- package/dist/index-7aj368tw.js +0 -30
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__esm
|
|
3
|
+
} from "./cli-bc05qbss.js";
|
|
4
|
+
|
|
5
|
+
// packages/model-routing/src/env.ts
|
|
6
|
+
function envValue(env, key) {
|
|
7
|
+
const value = env[key]?.trim();
|
|
8
|
+
return value ? value : undefined;
|
|
9
|
+
}
|
|
10
|
+
function isEnvTruthy(env, key) {
|
|
11
|
+
const value = envValue(env, key)?.toLowerCase();
|
|
12
|
+
return value === "1" || value === "true" || value === "yes" || value === "on";
|
|
13
|
+
}
|
|
14
|
+
var init_env = () => {};
|
|
15
|
+
|
|
16
|
+
// packages/model-routing/src/protocols.ts
|
|
17
|
+
function defineRouteProvider(p) {
|
|
18
|
+
return {
|
|
19
|
+
...p,
|
|
20
|
+
isHarnessDefaultProtocol: p.isHarnessDefaultProtocol ?? ((harness, protocol) => HARNESS_DEFAULT_PROTOCOL[harness] === protocol)
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
var HARNESS_DEFAULT_PROTOCOL;
|
|
24
|
+
var init_protocols = __esm(() => {
|
|
25
|
+
HARNESS_DEFAULT_PROTOCOL = {
|
|
26
|
+
claude: "anthropic-messages",
|
|
27
|
+
codex: "openai-responses",
|
|
28
|
+
pi: "openai-chat",
|
|
29
|
+
opencode: "openai-chat",
|
|
30
|
+
dsh: "openai-chat"
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
// packages/model-routing/src/providers/anthropic-models.ts
|
|
35
|
+
function routeAuthHeaders(ctx) {
|
|
36
|
+
const { auth } = ctx.route;
|
|
37
|
+
if (auth.kind !== "bearer" && auth.kind !== "x-api-key" && auth.kind !== "header")
|
|
38
|
+
return {};
|
|
39
|
+
const secret = envValue(ctx.env, auth.secretKey);
|
|
40
|
+
if (!secret)
|
|
41
|
+
return {};
|
|
42
|
+
if (auth.kind === "bearer")
|
|
43
|
+
return { Authorization: `Bearer ${secret}` };
|
|
44
|
+
if (auth.kind === "x-api-key")
|
|
45
|
+
return { "x-api-key": secret };
|
|
46
|
+
return { [auth.header]: secret };
|
|
47
|
+
}
|
|
48
|
+
async function readBody(res) {
|
|
49
|
+
try {
|
|
50
|
+
return await res.text();
|
|
51
|
+
} catch {
|
|
52
|
+
return "";
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function modelIds(body) {
|
|
56
|
+
try {
|
|
57
|
+
const parsed = JSON.parse(body);
|
|
58
|
+
if (!Array.isArray(parsed.data))
|
|
59
|
+
return;
|
|
60
|
+
return parsed.data.flatMap((m) => typeof m.id === "string" ? [m.id] : []);
|
|
61
|
+
} catch {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
async function checkAnthropicModels(ctx, opts = {}) {
|
|
66
|
+
const res = await ctx.fetch("/v1/models", {
|
|
67
|
+
method: "GET",
|
|
68
|
+
headers: {
|
|
69
|
+
"anthropic-version": ANTHROPIC_VERSION,
|
|
70
|
+
...opts.extraHeaders,
|
|
71
|
+
...routeAuthHeaders(ctx)
|
|
72
|
+
},
|
|
73
|
+
signal: ctx.signal
|
|
74
|
+
});
|
|
75
|
+
const body = await readBody(res);
|
|
76
|
+
if (res.ok)
|
|
77
|
+
return { status: "verified", models: modelIds(body) };
|
|
78
|
+
if (opts.notFoundIsConfigured && (res.status === 404 || res.status === 405)) {
|
|
79
|
+
return {
|
|
80
|
+
status: "configured",
|
|
81
|
+
reason: `HTTP ${res.status}: the endpoint does not list models, so the key was not checked`
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
return { status: "failed", reason: `HTTP ${res.status}: ${body.slice(0, 200)}` };
|
|
85
|
+
}
|
|
86
|
+
var ANTHROPIC_VERSION = "2023-06-01";
|
|
87
|
+
var init_anthropic_models = __esm(() => {
|
|
88
|
+
init_env();
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
// packages/model-routing/src/providers/secret-env.ts
|
|
92
|
+
function secretEnv(route) {
|
|
93
|
+
const { auth } = route;
|
|
94
|
+
return "secretKey" in auth ? [auth.secretKey] : [];
|
|
95
|
+
}
|
|
96
|
+
var init_secret_env = () => {};
|
|
97
|
+
|
|
98
|
+
// packages/model-routing/src/providers/anthropic.ts
|
|
99
|
+
var ANTHROPIC_API_BASE_URL = "https://api.anthropic.com", anthropicProvider;
|
|
100
|
+
var init_anthropic = __esm(() => {
|
|
101
|
+
init_protocols();
|
|
102
|
+
init_anthropic_models();
|
|
103
|
+
init_secret_env();
|
|
104
|
+
anthropicProvider = defineRouteProvider({
|
|
105
|
+
id: "anthropic",
|
|
106
|
+
name: "Anthropic API",
|
|
107
|
+
protocols: ["anthropic-messages"],
|
|
108
|
+
defaultBaseUrl: ANTHROPIC_API_BASE_URL,
|
|
109
|
+
requiredEnv: (route) => secretEnv(route),
|
|
110
|
+
validate: (ctx) => checkAnthropicModels(ctx)
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
// packages/model-routing/src/providers/anthropic-gateway.ts
|
|
115
|
+
function customHeaders(route, env) {
|
|
116
|
+
if (route.source !== "default")
|
|
117
|
+
return {};
|
|
118
|
+
const raw = envValue(env, "ANTHROPIC_CUSTOM_HEADERS");
|
|
119
|
+
if (!raw)
|
|
120
|
+
return {};
|
|
121
|
+
const headers = {};
|
|
122
|
+
for (const line of raw.split(`
|
|
123
|
+
`)) {
|
|
124
|
+
const colon = line.indexOf(":");
|
|
125
|
+
if (colon <= 0)
|
|
126
|
+
continue;
|
|
127
|
+
const name = line.slice(0, colon).trim();
|
|
128
|
+
const value = line.slice(colon + 1).trim();
|
|
129
|
+
if (name && value)
|
|
130
|
+
headers[name] = value;
|
|
131
|
+
}
|
|
132
|
+
return headers;
|
|
133
|
+
}
|
|
134
|
+
var anthropicGatewayProvider;
|
|
135
|
+
var init_anthropic_gateway = __esm(() => {
|
|
136
|
+
init_env();
|
|
137
|
+
init_protocols();
|
|
138
|
+
init_anthropic_models();
|
|
139
|
+
init_secret_env();
|
|
140
|
+
anthropicGatewayProvider = defineRouteProvider({
|
|
141
|
+
id: "anthropic-gateway",
|
|
142
|
+
name: "Anthropic-compatible gateway",
|
|
143
|
+
protocols: ["anthropic-messages"],
|
|
144
|
+
requiredEnv: (route) => secretEnv(route),
|
|
145
|
+
validate: (ctx) => checkAnthropicModels(ctx, {
|
|
146
|
+
extraHeaders: customHeaders(ctx.route, ctx.env),
|
|
147
|
+
notFoundIsConfigured: true
|
|
148
|
+
})
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
// packages/model-routing/src/providers/bedrock.ts
|
|
153
|
+
var bedrockProvider;
|
|
154
|
+
var init_bedrock = __esm(() => {
|
|
155
|
+
init_protocols();
|
|
156
|
+
init_secret_env();
|
|
157
|
+
bedrockProvider = defineRouteProvider({
|
|
158
|
+
id: "bedrock",
|
|
159
|
+
name: "Amazon Bedrock",
|
|
160
|
+
protocols: ["bedrock"],
|
|
161
|
+
requiredEnv: (route) => ["AWS_REGION", ...secretEnv(route)]
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
// packages/model-routing/src/providers/claude-subscription.ts
|
|
166
|
+
var claudeSubscriptionProvider;
|
|
167
|
+
var init_claude_subscription = __esm(() => {
|
|
168
|
+
init_protocols();
|
|
169
|
+
init_anthropic();
|
|
170
|
+
claudeSubscriptionProvider = defineRouteProvider({
|
|
171
|
+
id: "claude-subscription",
|
|
172
|
+
name: "Claude subscription",
|
|
173
|
+
protocols: ["anthropic-messages"],
|
|
174
|
+
harnesses: ["claude"],
|
|
175
|
+
defaultBaseUrl: ANTHROPIC_API_BASE_URL,
|
|
176
|
+
requiredEnv: () => ["CLAUDE_CODE_OAUTH_TOKEN"],
|
|
177
|
+
validate: async () => ({ status: "verified" })
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
// packages/model-routing/src/providers/foundry.ts
|
|
182
|
+
function foundryBaseUrl(resource) {
|
|
183
|
+
return `https://${resource}.services.ai.azure.com/anthropic`;
|
|
184
|
+
}
|
|
185
|
+
var foundryProvider;
|
|
186
|
+
var init_foundry = __esm(() => {
|
|
187
|
+
init_protocols();
|
|
188
|
+
init_secret_env();
|
|
189
|
+
foundryProvider = defineRouteProvider({
|
|
190
|
+
id: "foundry",
|
|
191
|
+
name: "Microsoft Foundry",
|
|
192
|
+
protocols: ["foundry"],
|
|
193
|
+
requiredEnv: (route) => [
|
|
194
|
+
...route.baseUrl ? [] : ["ANTHROPIC_FOUNDRY_RESOURCE"],
|
|
195
|
+
...secretEnv(route)
|
|
196
|
+
]
|
|
197
|
+
});
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
// packages/model-routing/src/providers/vertex.ts
|
|
201
|
+
var vertexProvider;
|
|
202
|
+
var init_vertex = __esm(() => {
|
|
203
|
+
init_protocols();
|
|
204
|
+
vertexProvider = defineRouteProvider({
|
|
205
|
+
id: "vertex",
|
|
206
|
+
name: "Google Vertex AI",
|
|
207
|
+
protocols: ["vertex"],
|
|
208
|
+
requiredEnv: () => ["CLOUD_ML_REGION", "ANTHROPIC_VERTEX_PROJECT_ID"]
|
|
209
|
+
});
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
// packages/model-routing/src/providers/index.ts
|
|
213
|
+
function getRouteProvider(id) {
|
|
214
|
+
return ROUTE_PROVIDERS.find((p) => p.id === id);
|
|
215
|
+
}
|
|
216
|
+
var ROUTE_PROVIDERS;
|
|
217
|
+
var init_providers = __esm(() => {
|
|
218
|
+
init_anthropic();
|
|
219
|
+
init_anthropic_gateway();
|
|
220
|
+
init_bedrock();
|
|
221
|
+
init_claude_subscription();
|
|
222
|
+
init_foundry();
|
|
223
|
+
init_vertex();
|
|
224
|
+
ROUTE_PROVIDERS = [
|
|
225
|
+
anthropicProvider,
|
|
226
|
+
claudeSubscriptionProvider,
|
|
227
|
+
anthropicGatewayProvider,
|
|
228
|
+
foundryProvider,
|
|
229
|
+
bedrockProvider,
|
|
230
|
+
vertexProvider
|
|
231
|
+
];
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
// packages/model-routing/src/scoped-fetch.ts
|
|
235
|
+
function isAbsolute(path) {
|
|
236
|
+
return /^[a-z][a-z0-9+.-]*:/i.test(path) || path.startsWith("//");
|
|
237
|
+
}
|
|
238
|
+
function createScopedFetch(baseUrl, impl) {
|
|
239
|
+
let base;
|
|
240
|
+
try {
|
|
241
|
+
base = new URL(baseUrl);
|
|
242
|
+
} catch {
|
|
243
|
+
throw new ScopedFetchError(`Invalid route base URL: ${baseUrl}`);
|
|
244
|
+
}
|
|
245
|
+
const prefix = base.href.replace(/\/+$/, "");
|
|
246
|
+
return (path, init) => {
|
|
247
|
+
let target;
|
|
248
|
+
try {
|
|
249
|
+
target = isAbsolute(path) ? new URL(path, base) : new URL(`${prefix}/${path.replace(/^\/+/, "")}`);
|
|
250
|
+
} catch {
|
|
251
|
+
return Promise.reject(new ScopedFetchError(`Invalid route path: ${path}`));
|
|
252
|
+
}
|
|
253
|
+
if (target.origin !== base.origin) {
|
|
254
|
+
return Promise.reject(new ScopedFetchError(`Refusing request to ${target.origin}: route is scoped to ${base.origin}`));
|
|
255
|
+
}
|
|
256
|
+
const doFetch = impl ?? globalThis.fetch;
|
|
257
|
+
return doFetch(target.href, { ...init, redirect: "manual" });
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
var ScopedFetchError;
|
|
261
|
+
var init_scoped_fetch = __esm(() => {
|
|
262
|
+
ScopedFetchError = class ScopedFetchError extends Error {
|
|
263
|
+
name = "ScopedFetchError";
|
|
264
|
+
};
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
// packages/model-routing/src/credential-status.ts
|
|
268
|
+
function describeRoute(route, providerName) {
|
|
269
|
+
return route.baseUrl ? `${providerName} at ${route.baseUrl}` : providerName;
|
|
270
|
+
}
|
|
271
|
+
function routeCredentialStatus(route, env) {
|
|
272
|
+
const provider = getRouteProvider(route.provider);
|
|
273
|
+
if (!provider) {
|
|
274
|
+
return { ready: false, missing: [], hint: `Unknown route provider "${route.provider}".` };
|
|
275
|
+
}
|
|
276
|
+
const missing = provider.requiredEnv(route).filter((key) => !envValue(env, key));
|
|
277
|
+
const where = describeRoute(route, provider.name);
|
|
278
|
+
return missing.length === 0 ? { ready: true, missing: [], hint: `Routing through ${where}.` } : { ready: false, missing, hint: `${where} needs ${missing.join(", ")}.` };
|
|
279
|
+
}
|
|
280
|
+
async function validateRoute(route, env, opts = {}) {
|
|
281
|
+
const provider = getRouteProvider(route.provider);
|
|
282
|
+
const status = routeCredentialStatus(route, env);
|
|
283
|
+
if (!provider || !status.ready) {
|
|
284
|
+
return { status: "failed", reason: status.hint, missing: status.missing };
|
|
285
|
+
}
|
|
286
|
+
if (!provider.validate) {
|
|
287
|
+
return {
|
|
288
|
+
status: "configured",
|
|
289
|
+
reason: `${provider.name} has no free credential check; the first task proves the route.`
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
const baseUrl = route.baseUrl ?? provider.defaultBaseUrl;
|
|
293
|
+
const controller = new AbortController;
|
|
294
|
+
const timer = setTimeout(() => controller.abort(), opts.timeoutMs ?? VALIDATE_TIMEOUT_MS);
|
|
295
|
+
try {
|
|
296
|
+
const scopedFetch = baseUrl ? createScopedFetch(baseUrl) : () => Promise.reject(new ScopedFetchError(`Route "${route.name}" has no base URL.`));
|
|
297
|
+
return await provider.validate({ route, env, fetch: scopedFetch, signal: controller.signal });
|
|
298
|
+
} catch (err) {
|
|
299
|
+
return { status: "failed", reason: err instanceof Error ? err.message : String(err) };
|
|
300
|
+
} finally {
|
|
301
|
+
clearTimeout(timer);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
var VALIDATE_TIMEOUT_MS = 5000;
|
|
305
|
+
var init_credential_status = __esm(() => {
|
|
306
|
+
init_env();
|
|
307
|
+
init_protocols();
|
|
308
|
+
init_providers();
|
|
309
|
+
init_scoped_fetch();
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
// packages/model-routing/src/default-route.ts
|
|
313
|
+
function isFirstPartyAnthropicUrl(url) {
|
|
314
|
+
try {
|
|
315
|
+
return new URL(url).origin === ANTHROPIC_API_BASE_URL;
|
|
316
|
+
} catch {
|
|
317
|
+
return false;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
function defaultRoute(harness, route) {
|
|
321
|
+
return { id: `default:${harness}`, name: `default:${harness}`, source: "default", ...route };
|
|
322
|
+
}
|
|
323
|
+
function deriveClaudeDefaultRoute(env) {
|
|
324
|
+
if (isEnvTruthy(env, "CLAUDE_CODE_USE_FOUNDRY")) {
|
|
325
|
+
const resource = envValue(env, "ANTHROPIC_FOUNDRY_RESOURCE");
|
|
326
|
+
const auth = envValue(env, "ANTHROPIC_FOUNDRY_AUTH_TOKEN") ? { kind: "bearer", secretKey: "ANTHROPIC_FOUNDRY_AUTH_TOKEN" } : envValue(env, "ANTHROPIC_FOUNDRY_API_KEY") ? { kind: "x-api-key", secretKey: "ANTHROPIC_FOUNDRY_API_KEY" } : { kind: "cloud-chain" };
|
|
327
|
+
return defaultRoute("claude", {
|
|
328
|
+
provider: "foundry",
|
|
329
|
+
protocol: "foundry",
|
|
330
|
+
baseUrl: envValue(env, "ANTHROPIC_FOUNDRY_BASE_URL") ?? (resource ? foundryBaseUrl(resource) : undefined),
|
|
331
|
+
auth,
|
|
332
|
+
cloud: { resource }
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
if (isEnvTruthy(env, "CLAUDE_CODE_USE_BEDROCK")) {
|
|
336
|
+
const region = envValue(env, "AWS_REGION");
|
|
337
|
+
return defaultRoute("claude", {
|
|
338
|
+
provider: "bedrock",
|
|
339
|
+
protocol: "bedrock",
|
|
340
|
+
baseUrl: envValue(env, "ANTHROPIC_BEDROCK_BASE_URL") ?? (region ? `https://bedrock-runtime.${region}.amazonaws.com` : undefined),
|
|
341
|
+
auth: envValue(env, "AWS_BEARER_TOKEN_BEDROCK") ? { kind: "bearer", secretKey: "AWS_BEARER_TOKEN_BEDROCK" } : { kind: "cloud-chain" },
|
|
342
|
+
cloud: { region }
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
if (isEnvTruthy(env, "CLAUDE_CODE_USE_VERTEX")) {
|
|
346
|
+
const region = envValue(env, "CLOUD_ML_REGION");
|
|
347
|
+
const vertexHost = region === "global" ? "aiplatform.googleapis.com" : `${region}-aiplatform.googleapis.com`;
|
|
348
|
+
return defaultRoute("claude", {
|
|
349
|
+
provider: "vertex",
|
|
350
|
+
protocol: "vertex",
|
|
351
|
+
baseUrl: envValue(env, "ANTHROPIC_VERTEX_BASE_URL") ?? (region ? `https://${vertexHost}` : undefined),
|
|
352
|
+
auth: { kind: "cloud-chain" },
|
|
353
|
+
cloud: { region, project: envValue(env, "ANTHROPIC_VERTEX_PROJECT_ID") }
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
const oauthToken = envValue(env, "CLAUDE_CODE_OAUTH_TOKEN");
|
|
357
|
+
const baseUrl = envValue(env, "ANTHROPIC_BASE_URL");
|
|
358
|
+
if (baseUrl && !isFirstPartyAnthropicUrl(baseUrl)) {
|
|
359
|
+
const authToken = envValue(env, "ANTHROPIC_AUTH_TOKEN");
|
|
360
|
+
const apiKey = envValue(env, "ANTHROPIC_API_KEY");
|
|
361
|
+
return defaultRoute("claude", {
|
|
362
|
+
provider: "anthropic-gateway",
|
|
363
|
+
protocol: "anthropic-messages",
|
|
364
|
+
baseUrl,
|
|
365
|
+
auth: authToken || !apiKey ? { kind: "bearer", secretKey: "ANTHROPIC_AUTH_TOKEN" } : { kind: "x-api-key", secretKey: "ANTHROPIC_API_KEY" }
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
if (oauthToken) {
|
|
369
|
+
return defaultRoute("claude", {
|
|
370
|
+
provider: "claude-subscription",
|
|
371
|
+
protocol: "anthropic-messages",
|
|
372
|
+
baseUrl: baseUrl ?? ANTHROPIC_API_BASE_URL,
|
|
373
|
+
auth: { kind: "subscription", plan: "claude" }
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
if (envValue(env, "ANTHROPIC_API_KEY")) {
|
|
377
|
+
return defaultRoute("claude", {
|
|
378
|
+
provider: "anthropic",
|
|
379
|
+
protocol: "anthropic-messages",
|
|
380
|
+
baseUrl: baseUrl ?? ANTHROPIC_API_BASE_URL,
|
|
381
|
+
auth: { kind: "x-api-key", secretKey: "ANTHROPIC_API_KEY" }
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
return null;
|
|
385
|
+
}
|
|
386
|
+
function deriveDefaultRoute(harness, env) {
|
|
387
|
+
if (harness === "claude")
|
|
388
|
+
return deriveClaudeDefaultRoute(env);
|
|
389
|
+
return null;
|
|
390
|
+
}
|
|
391
|
+
function routeUnsetEnv(harness, route) {
|
|
392
|
+
if (harness === "claude" && route.provider !== "claude-subscription") {
|
|
393
|
+
return ["CLAUDE_CODE_OAUTH_TOKEN"];
|
|
394
|
+
}
|
|
395
|
+
return [];
|
|
396
|
+
}
|
|
397
|
+
var init_default_route = __esm(() => {
|
|
398
|
+
init_env();
|
|
399
|
+
init_anthropic();
|
|
400
|
+
init_foundry();
|
|
401
|
+
});
|
|
402
|
+
|
|
403
|
+
// packages/model-routing/src/index.ts
|
|
404
|
+
var init_src = __esm(() => {
|
|
405
|
+
init_credential_status();
|
|
406
|
+
init_default_route();
|
|
407
|
+
init_protocols();
|
|
408
|
+
init_anthropic();
|
|
409
|
+
init_providers();
|
|
410
|
+
init_scoped_fetch();
|
|
411
|
+
});
|
|
412
|
+
|
|
413
|
+
export { routeCredentialStatus, validateRoute, isFirstPartyAnthropicUrl, deriveDefaultRoute, routeUnsetEnv, init_src };
|
|
@@ -8,13 +8,10 @@ import {
|
|
|
8
8
|
resolveGrammarConstrainedSampling,
|
|
9
9
|
resolveJsonSchemaStrictSampling,
|
|
10
10
|
transformMessages
|
|
11
|
-
} from "./cli-
|
|
11
|
+
} from "./cli-mbssg1xv.js";
|
|
12
12
|
import {
|
|
13
13
|
sanitizeSurrogates
|
|
14
14
|
} from "./cli-y2apkfe2.js";
|
|
15
|
-
import {
|
|
16
|
-
parseStreamingJson
|
|
17
|
-
} from "./cli-1m2e086m.js";
|
|
18
15
|
import {
|
|
19
16
|
calculateCost,
|
|
20
17
|
getSystemMessageText,
|
|
@@ -22,6 +19,9 @@ import {
|
|
|
22
19
|
resolveTranscript,
|
|
23
20
|
resolveTranscriptTools
|
|
24
21
|
} from "./cli-ykk5jaax.js";
|
|
22
|
+
import {
|
|
23
|
+
parseStreamingJson
|
|
24
|
+
} from "./cli-1m2e086m.js";
|
|
25
25
|
|
|
26
26
|
// node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.js
|
|
27
27
|
function encodeTextSignatureV1(id, phase) {
|
|
@@ -206,7 +206,8 @@ function convertResponsesMessages(model, context, allowedToolCallProviders, opti
|
|
|
206
206
|
const [callId, itemIdRaw] = toolCall.id.split("|");
|
|
207
207
|
const customInputProperty = options?.grammarToolInputProperties?.get(toolCall.name);
|
|
208
208
|
let itemId = itemIdRaw;
|
|
209
|
-
|
|
209
|
+
const itemIdPrefix = customInputProperty === undefined ? "fc_" : "ctc_";
|
|
210
|
+
if (isDifferentModel || !itemId?.startsWith(itemIdPrefix)) {
|
|
210
211
|
itemId = undefined;
|
|
211
212
|
}
|
|
212
213
|
if (customInputProperty !== undefined) {
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import {
|
|
2
|
+
init_env_flag,
|
|
3
|
+
isEnvFlagEnabled
|
|
4
|
+
} from "./cli-ej6gbxfb.js";
|
|
1
5
|
import {
|
|
2
6
|
__esm
|
|
3
7
|
} from "./cli-bc05qbss.js";
|
|
@@ -29,7 +33,7 @@ function getAgentFsDefaultDriveId() {
|
|
|
29
33
|
const raw = process.env.AGENT_FS_DEFAULT_DRIVE_ID?.trim();
|
|
30
34
|
return raw || undefined;
|
|
31
35
|
}
|
|
32
|
-
function
|
|
36
|
+
function agentFsFileRoute(opts) {
|
|
33
37
|
const path = opts.path?.trim();
|
|
34
38
|
if (!path)
|
|
35
39
|
return null;
|
|
@@ -40,14 +44,31 @@ function buildAgentFsLiveUrl(opts) {
|
|
|
40
44
|
const driveId = hasRowId ? rowDriveId : getAgentFsDefaultDriveId();
|
|
41
45
|
if (!orgId || !driveId)
|
|
42
46
|
return null;
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
+
const segments = path.replace(/^\/+/, "").split("/");
|
|
48
|
+
if (segments.some((segment) => DOT_SEGMENT_RE.test(segment)))
|
|
49
|
+
return null;
|
|
50
|
+
const encodedPath = segments.map((segment) => encodeURIComponent(segment).replace(/%25([0-9a-f]{2})/gi, "%$1")).join("/");
|
|
51
|
+
return `${orgId}/${driveId}/${encodedPath}`;
|
|
52
|
+
}
|
|
53
|
+
function buildAgentFsLiveUrl(opts) {
|
|
54
|
+
const route = agentFsFileRoute(opts);
|
|
55
|
+
return route ? `${getAgentFsLiveUrl()}/file/~/${route}` : null;
|
|
56
|
+
}
|
|
57
|
+
function isCombEnabled() {
|
|
58
|
+
const apiUrl = process.env.AGENT_FS_API_URL?.trim().replace(/\/+$/, "");
|
|
59
|
+
return isEnvFlagEnabled("COMB_ENABLED", false) && Boolean(apiUrl);
|
|
60
|
+
}
|
|
61
|
+
function buildCombFileUrl(opts) {
|
|
62
|
+
if (!isCombEnabled() || getConfiguredAppUrls().length === 0)
|
|
63
|
+
return null;
|
|
64
|
+
const route = agentFsFileRoute(opts);
|
|
65
|
+
return route ? `${getAppUrl()}/file/~/${route}` : null;
|
|
47
66
|
}
|
|
48
|
-
var MAX_PROFILE_FILE_LENGTH, DEFAULT_APP_URL = "https://app.agent-swarm.dev", DEFAULT_AGENT_FS_LIVE_URL = "https://live.agent-fs.dev";
|
|
67
|
+
var MAX_PROFILE_FILE_LENGTH, DEFAULT_APP_URL = "https://app.agent-swarm.dev", DEFAULT_AGENT_FS_LIVE_URL = "https://live.agent-fs.dev", DOT_SEGMENT_RE;
|
|
49
68
|
var init_constants = __esm(() => {
|
|
69
|
+
init_env_flag();
|
|
50
70
|
MAX_PROFILE_FILE_LENGTH = 256 * 1024;
|
|
71
|
+
DOT_SEGMENT_RE = /^(?:\.|%2e){1,2}$/i;
|
|
51
72
|
});
|
|
52
73
|
|
|
53
|
-
export { MAX_PROFILE_FILE_LENGTH, getConfiguredAppUrls, getAppUrl, getMcpBaseUrl, getPublicMcpBaseUrl, buildAgentFsLiveUrl, init_constants };
|
|
74
|
+
export { MAX_PROFILE_FILE_LENGTH, getConfiguredAppUrls, getAppUrl, getMcpBaseUrl, getPublicMcpBaseUrl, getAgentFsLiveUrl, getAgentFsDefaultOrgId, getAgentFsDefaultDriveId, agentFsFileRoute, buildAgentFsLiveUrl, isCombEnabled, buildCombFileUrl, init_constants };
|
|
@@ -4,12 +4,12 @@ import {
|
|
|
4
4
|
linkIdentity,
|
|
5
5
|
recordUnmappedIdentity,
|
|
6
6
|
resolveIdentity
|
|
7
|
-
} from "./cli-
|
|
7
|
+
} from "./cli-kp42yek0.js";
|
|
8
8
|
import {
|
|
9
9
|
getKv,
|
|
10
10
|
init_db,
|
|
11
11
|
upsertKv
|
|
12
|
-
} from "./cli-
|
|
12
|
+
} from "./cli-jf7wmv1r.js";
|
|
13
13
|
|
|
14
14
|
// src/slack/enrich.ts
|
|
15
15
|
init_db();
|