@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
package/src/http/webhooks.ts
CHANGED
|
@@ -9,6 +9,15 @@ import {
|
|
|
9
9
|
verifyAgentMailWebhook,
|
|
10
10
|
} from "../agentmail";
|
|
11
11
|
import { archiveInboundMessage } from "../agentmail/inbound-archive";
|
|
12
|
+
import type { PullRequestCommentedEvent, PullRequestCreatedEvent } from "../azure-devops";
|
|
13
|
+
import {
|
|
14
|
+
commentedPayloadOf,
|
|
15
|
+
createdPullRequestOf,
|
|
16
|
+
handlePullRequestCommented,
|
|
17
|
+
handlePullRequestCreated,
|
|
18
|
+
isAzureDevOpsEnabled,
|
|
19
|
+
verifyAzureDevOpsWebhook,
|
|
20
|
+
} from "../azure-devops";
|
|
12
21
|
import type {
|
|
13
22
|
CheckRunEvent,
|
|
14
23
|
CheckSuiteEvent,
|
|
@@ -53,6 +62,7 @@ import { getKapsoConfig } from "../integrations/kapso/config";
|
|
|
53
62
|
import type { KapsoWebhookPayload } from "../integrations/kapso/inbound";
|
|
54
63
|
import { resolveKapsoRequestedByUserId, routeKapsoInbound } from "../integrations/kapso/inbound";
|
|
55
64
|
import { TaskCreationBlockedError } from "../tasks/errors";
|
|
65
|
+
import { canonicalAzureDevOpsRepoUrl } from "../vcs/azure-devops";
|
|
56
66
|
import { getExecutorRegistry } from "../workflows";
|
|
57
67
|
import { workflowEventBus } from "../workflows/event-bus";
|
|
58
68
|
import { handleWebhookTrigger, verifyHmacSignature, WebhookError } from "../workflows/triggers";
|
|
@@ -61,8 +71,8 @@ import { route } from "./route-def";
|
|
|
61
71
|
// ─── Route Definitions (documentation only — webhooks handle their own body parsing) ─
|
|
62
72
|
|
|
63
73
|
/**
|
|
64
|
-
* Shared shape returned by the GitHub/GitLab dispatch handlers in
|
|
65
|
-
* ../github/handlers.ts and ../
|
|
74
|
+
* Shared shape returned by the GitHub/GitLab/Azure DevOps dispatch handlers in
|
|
75
|
+
* ../github/handlers.ts, ../gitlab/handlers.ts and ../azure-devops/handlers.ts — `{ created: boolean;
|
|
66
76
|
* taskId?: string }`, echoed back verbatim as the webhook ack body.
|
|
67
77
|
*/
|
|
68
78
|
const WebhookDispatchResultSchema = z.object({
|
|
@@ -127,6 +137,24 @@ const gitlabWebhook = route({
|
|
|
127
137
|
},
|
|
128
138
|
});
|
|
129
139
|
|
|
140
|
+
const azureDevOpsWebhook = route({
|
|
141
|
+
method: "post",
|
|
142
|
+
path: "/api/azure-devops/webhook",
|
|
143
|
+
pattern: ["api", "azure-devops", "webhook"],
|
|
144
|
+
summary: "Handle Azure DevOps service-hook events",
|
|
145
|
+
tags: ["Webhooks"],
|
|
146
|
+
auth: { apiKey: false },
|
|
147
|
+
rbac: {
|
|
148
|
+
ungated:
|
|
149
|
+
"provider webhook: authenticated by the service-hook Basic auth secret, not a swarm principal",
|
|
150
|
+
},
|
|
151
|
+
responses: {
|
|
152
|
+
200: { description: "Event processed", schema: WebhookDispatchResultSchema },
|
|
153
|
+
401: { description: "Invalid Basic auth credentials" },
|
|
154
|
+
503: { description: "Azure DevOps integration not configured" },
|
|
155
|
+
},
|
|
156
|
+
});
|
|
157
|
+
|
|
130
158
|
const agentmailWebhook = route({
|
|
131
159
|
method: "post",
|
|
132
160
|
path: "/api/agentmail/webhook",
|
|
@@ -478,6 +506,96 @@ export async function handleWebhooks(
|
|
|
478
506
|
return true;
|
|
479
507
|
}
|
|
480
508
|
|
|
509
|
+
// Azure DevOps service hook — Basic auth secret, JSON body keyed by eventType
|
|
510
|
+
if (azureDevOpsWebhook.match(req.method, pathSegments)) {
|
|
511
|
+
if (!isAzureDevOpsEnabled()) {
|
|
512
|
+
res.writeHead(503, { "Content-Type": "application/json" });
|
|
513
|
+
res.end(JSON.stringify({ error: "Azure DevOps integration not configured" }));
|
|
514
|
+
return true;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
if (!verifyAzureDevOpsWebhook(req.headers.authorization)) {
|
|
518
|
+
console.log("[AzureDevOps] Invalid webhook credentials");
|
|
519
|
+
res.writeHead(401, { "Content-Type": "application/json" });
|
|
520
|
+
res.end(JSON.stringify({ error: "Invalid credentials" }));
|
|
521
|
+
return true;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
const chunks: Buffer[] = [];
|
|
525
|
+
for await (const chunk of req) {
|
|
526
|
+
chunks.push(chunk);
|
|
527
|
+
}
|
|
528
|
+
const rawBody = Buffer.concat(chunks).toString();
|
|
529
|
+
|
|
530
|
+
let body: Record<string, unknown>;
|
|
531
|
+
try {
|
|
532
|
+
body = JSON.parse(rawBody);
|
|
533
|
+
} catch {
|
|
534
|
+
res.writeHead(400, { "Content-Type": "application/json" });
|
|
535
|
+
res.end(JSON.stringify({ error: "Invalid JSON body" }));
|
|
536
|
+
return true;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
const eventType = body.eventType as string | undefined;
|
|
540
|
+
console.log(`[AzureDevOps] Received ${eventType} event`);
|
|
541
|
+
|
|
542
|
+
let result: WebhookDispatchResult = { created: false };
|
|
543
|
+
|
|
544
|
+
try {
|
|
545
|
+
result = await runBlockableHandler("AzureDevOps", async () => {
|
|
546
|
+
switch (eventType) {
|
|
547
|
+
case "git.pullrequest.created":
|
|
548
|
+
return await handlePullRequestCreated(body as unknown as PullRequestCreatedEvent);
|
|
549
|
+
case "ms.vss-code.git-pullrequest-comment-event":
|
|
550
|
+
return await handlePullRequestCommented(body as unknown as PullRequestCommentedEvent);
|
|
551
|
+
default:
|
|
552
|
+
console.log(`[AzureDevOps] Ignoring unsupported event type: ${eventType}`);
|
|
553
|
+
return { created: false };
|
|
554
|
+
}
|
|
555
|
+
});
|
|
556
|
+
|
|
557
|
+
// Emit workflow trigger events for Azure DevOps
|
|
558
|
+
switch (eventType) {
|
|
559
|
+
case "git.pullrequest.created": {
|
|
560
|
+
const pr = createdPullRequestOf(body as unknown as PullRequestCreatedEvent);
|
|
561
|
+
if (!pr) break;
|
|
562
|
+
workflowEventBus.emit("azure-devops.pull_request.created", {
|
|
563
|
+
repo: canonicalAzureDevOpsRepoUrl(pr.repository.remoteUrl),
|
|
564
|
+
number: pr.pullRequestId,
|
|
565
|
+
title: pr.title,
|
|
566
|
+
body: pr.description,
|
|
567
|
+
action: "created",
|
|
568
|
+
user_login: pr.createdBy.uniqueName ?? pr.createdBy.id,
|
|
569
|
+
});
|
|
570
|
+
break;
|
|
571
|
+
}
|
|
572
|
+
case "ms.vss-code.git-pullrequest-comment-event": {
|
|
573
|
+
const payload = commentedPayloadOf(body as unknown as PullRequestCommentedEvent);
|
|
574
|
+
if (!payload) break;
|
|
575
|
+
const { pullRequest: pr, comment } = payload;
|
|
576
|
+
workflowEventBus.emit("azure-devops.pull_request.commented", {
|
|
577
|
+
repo: canonicalAzureDevOpsRepoUrl(pr.repository.remoteUrl),
|
|
578
|
+
number: pr.pullRequestId,
|
|
579
|
+
action: "commented",
|
|
580
|
+
user_login: comment.author.uniqueName ?? comment.author.id,
|
|
581
|
+
});
|
|
582
|
+
break;
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
azureDevOpsWebhook.respond(res, 200, result);
|
|
587
|
+
} catch (err) {
|
|
588
|
+
const errorMessage = err instanceof Error ? err.message : String(err);
|
|
589
|
+
console.error(`[AzureDevOps] Error handling ${eventType} event: ${errorMessage}`);
|
|
590
|
+
if (err instanceof Error && err.stack) {
|
|
591
|
+
console.error(err.stack);
|
|
592
|
+
}
|
|
593
|
+
res.writeHead(500, { "Content-Type": "application/json" });
|
|
594
|
+
res.end(JSON.stringify({ error: "Internal server error" }));
|
|
595
|
+
}
|
|
596
|
+
return true;
|
|
597
|
+
}
|
|
598
|
+
|
|
481
599
|
// AgentMail webhook — needs raw body for Svix signature verification
|
|
482
600
|
if (agentmailWebhook.match(req.method, pathSegments)) {
|
|
483
601
|
if (!isAgentMailEnabled()) {
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Namespace families owned by internal subsystems which write through the raw
|
|
3
3
|
* DB helpers. Generic HTTP/MCP KV callers may read these namespaces for
|
|
4
|
-
* inspection, but must not mutate them.
|
|
4
|
+
* inspection, but must not mutate them. A family is `<name>` and `<name>:*`,
|
|
5
|
+
* mapped here to the error a generic write gets.
|
|
5
6
|
*/
|
|
7
|
+
const RESERVED_FAMILIES = new Map([
|
|
8
|
+
["apps", "namespace is reserved for swarm apps; use the app row endpoints"],
|
|
9
|
+
// step-9: Comb's "Send to swarm" claims (`comb:sent`).
|
|
10
|
+
["comb", "namespace is reserved for Comb; use POST /api/comb/review-batches"],
|
|
11
|
+
]);
|
|
12
|
+
|
|
6
13
|
export function isReservedNamespace(namespace: string): boolean {
|
|
7
|
-
return namespace
|
|
14
|
+
return reservedNamespaceError(namespace) !== null;
|
|
8
15
|
}
|
|
9
16
|
|
|
10
17
|
export function reservedNamespaceError(namespace: string): string | null {
|
|
11
|
-
return
|
|
12
|
-
? "namespace is reserved for swarm apps; use the app row endpoints"
|
|
13
|
-
: null;
|
|
18
|
+
return RESERVED_FAMILIES.get(namespace.split(":", 1)[0] ?? "") ?? null;
|
|
14
19
|
}
|
|
15
20
|
|
|
16
21
|
export function reservedRoomKeyError(key: string): string | null {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { readFile, unlink, writeFile } from "node:fs/promises";
|
|
2
2
|
import { homedir } from "node:os";
|
|
3
3
|
import { dirname, join } from "node:path";
|
|
4
|
+
import { deriveDefaultRoute, routeCredentialStatus, routeUnsetEnv } from "@desplega/model-routing";
|
|
4
5
|
import { type Span, trace } from "@opentelemetry/api";
|
|
5
6
|
import {
|
|
6
7
|
type RunStopHookSessionSummaryOpts,
|
|
@@ -8,7 +9,7 @@ import {
|
|
|
8
9
|
} from "../hooks/hook";
|
|
9
10
|
import { isClaudeBridgeEffective, resolveClaudeTransport } from "../utils/claude-transport";
|
|
10
11
|
import { getContextWindowSize } from "../utils/context-window";
|
|
11
|
-
import { validateClaudeCredentials } from "../utils/credentials";
|
|
12
|
+
import { CLAUDE_CREDENTIALS_HINT, validateClaudeCredentials } from "../utils/credentials";
|
|
12
13
|
import {
|
|
13
14
|
parseStderrForErrors,
|
|
14
15
|
redactRateLimitEventLine,
|
|
@@ -24,6 +25,7 @@ import {
|
|
|
24
25
|
} from "../utils/process-group";
|
|
25
26
|
import { scrubSecrets } from "../utils/secret-scrubber";
|
|
26
27
|
import { normalizeClaudeMessage } from "./claude-session-events";
|
|
28
|
+
import { resolveSlashSkillPrompt } from "./codex-skill-resolver";
|
|
27
29
|
import { CTX_MODE_NUDGE_EVERY } from "./ctx-mode-env";
|
|
28
30
|
import { buildOtelTraceparentEnv, isHarnessOtelEnabled } from "./otel-env";
|
|
29
31
|
import { applyReasoningEffort, type ReasoningEffort } from "./reasoning-effort";
|
|
@@ -42,18 +44,49 @@ import type {
|
|
|
42
44
|
|
|
43
45
|
/**
|
|
44
46
|
* Predicate used by the worker boot loop and the credential-status endpoint.
|
|
45
|
-
* The claude harness
|
|
46
|
-
*
|
|
47
|
+
* The claude harness is ready when its default route (subscription, API key,
|
|
48
|
+
* gateway, Foundry, Bedrock, or Vertex; see `deriveDefaultRoute`) has every
|
|
49
|
+
* env var it needs. With no route at all, the two first-party credentials are
|
|
50
|
+
* listed as missing.
|
|
47
51
|
*/
|
|
48
52
|
export function checkClaudeCredentials(env: Record<string, string | undefined>): CredStatus {
|
|
49
|
-
|
|
50
|
-
|
|
53
|
+
const route = deriveDefaultRoute("claude", env);
|
|
54
|
+
if (!route) {
|
|
55
|
+
return {
|
|
56
|
+
ready: false,
|
|
57
|
+
missing: ["CLAUDE_CODE_OAUTH_TOKEN", "ANTHROPIC_API_KEY"],
|
|
58
|
+
hint: CLAUDE_CREDENTIALS_HINT,
|
|
59
|
+
};
|
|
51
60
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
61
|
+
const status = routeCredentialStatus(route, env);
|
|
62
|
+
if (status.ready) return { ready: true, missing: [], satisfiedBy: "env" };
|
|
63
|
+
return { ready: false, missing: status.missing, hint: status.hint };
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* `env` without the credentials its claude default route does not use. On a
|
|
68
|
+
* gateway or cloud route this drops `CLAUDE_CODE_OAUTH_TOKEN`: Claude Code
|
|
69
|
+
* 2.1.286 sends that token as `Authorization: Bearer` to ANTHROPIC_BASE_URL
|
|
70
|
+
* whenever no gateway key outranks it, and claude-bridge authenticates from it.
|
|
71
|
+
*
|
|
72
|
+
* Dropped keys are blanked, not deleted, so the `?? process.env` fallbacks in
|
|
73
|
+
* the binary/transport resolvers cannot bring them back. On routes that leave
|
|
74
|
+
* api.anthropic.com they are blanked even when `env` lacks them. Claude Code
|
|
75
|
+
* treats a blank token as unset (verified on 2.1.286).
|
|
76
|
+
*/
|
|
77
|
+
export function withClaudeRouteEnv(
|
|
78
|
+
env: Record<string, string | undefined>,
|
|
79
|
+
): Record<string, string | undefined> {
|
|
80
|
+
const route = deriveDefaultRoute("claude", env);
|
|
81
|
+
if (!route) return env;
|
|
82
|
+
const firstParty = route.provider === "anthropic";
|
|
83
|
+
const unset = routeUnsetEnv("claude", route).filter((key) =>
|
|
84
|
+
firstParty ? env[key] : env[key] !== "",
|
|
85
|
+
);
|
|
86
|
+
if (unset.length === 0) return env;
|
|
87
|
+
const next = { ...env };
|
|
88
|
+
for (const key of unset) next[key] = "";
|
|
89
|
+
return next;
|
|
57
90
|
}
|
|
58
91
|
|
|
59
92
|
/** Task file data written to /tmp for hook to read */
|
|
@@ -535,7 +568,7 @@ export function buildClaudeSessionEnvironment(
|
|
|
535
568
|
model: string,
|
|
536
569
|
taskFilePath: string,
|
|
537
570
|
): { env: Record<string, string>; appliedReasoningEffort: ReasoningEffort | null } {
|
|
538
|
-
const sourceEnv = { ...(config.env || process.env) };
|
|
571
|
+
const sourceEnv = { ...withClaudeRouteEnv(config.env || process.env) };
|
|
539
572
|
// Summaries run in the adapter process. Do not bypass Claude's OAuth filtering for hooks.
|
|
540
573
|
delete sourceEnv.AGENT_SWARM_CLAUDE_OAUTH_TOKEN;
|
|
541
574
|
const reasoningApplication = applyReasoningEffort("claude", model, config.reasoningEffort);
|
|
@@ -572,8 +605,7 @@ export async function runClaudeSessionSummary(
|
|
|
572
605
|
agentId: config.agentId,
|
|
573
606
|
transcript: text,
|
|
574
607
|
env: {
|
|
575
|
-
...process.env,
|
|
576
|
-
...config.env,
|
|
608
|
+
...withClaudeRouteEnv({ ...process.env, ...config.env }),
|
|
577
609
|
AGENT_SWARM_TASK_ID: config.taskId,
|
|
578
610
|
MCP_BASE_URL: config.apiUrl,
|
|
579
611
|
AGENT_SWARM_API_KEY: config.apiKey,
|
|
@@ -608,6 +640,38 @@ export function getSystemPromptFilePath(taskId: string): string {
|
|
|
608
640
|
return `/tmp/agent-swarm-system-prompt-${taskId}.txt`;
|
|
609
641
|
}
|
|
610
642
|
|
|
643
|
+
/**
|
|
644
|
+
* Inline the runner's leading `/<skill>` command before the prompt reaches
|
|
645
|
+
* Claude Code.
|
|
646
|
+
*
|
|
647
|
+
* Claude Code expands `/<skill> <args>` into `<command-args>{args}</command-args>`
|
|
648
|
+
* plus the skill text, and appends `ARGUMENTS: {args}` when the skill has no
|
|
649
|
+
* `$ARGUMENTS` placeholder (a `$ARGUMENTS` placeholder only moves the second
|
|
650
|
+
* copy). The runner puts the whole task body — task text, context preamble,
|
|
651
|
+
* memories — in those args, so every task's first message carried it twice.
|
|
652
|
+
* Inlining the SKILL.md ourselves, with the resolver codex/opencode/dsh already
|
|
653
|
+
* use, keeps the skill text and sends the body once.
|
|
654
|
+
*
|
|
655
|
+
* Commands with no SKILL.md under `<home>/.claude/skills` pass through for
|
|
656
|
+
* Claude Code to expand natively. Exported for unit testing.
|
|
657
|
+
*/
|
|
658
|
+
export async function resolveClaudePrompt(prompt: string, home: string): Promise<string> {
|
|
659
|
+
const resolved = await resolveSlashSkillPrompt(prompt, {
|
|
660
|
+
providerLabel: "claude",
|
|
661
|
+
skillsDir: join(home, ".claude", "skills"),
|
|
662
|
+
// Native expansion drops frontmatter too. It also matters for argv: the
|
|
663
|
+
// `-p` path passes the prompt as a positional, and a leading `---` is
|
|
664
|
+
// parsed as an unknown option.
|
|
665
|
+
stripFrontmatter: true,
|
|
666
|
+
emit: (event) => {
|
|
667
|
+
if (event.type === "raw_stderr") console.warn(event.content.trimEnd());
|
|
668
|
+
},
|
|
669
|
+
});
|
|
670
|
+
// Any other leading dash would hit the same argv parse error; keep the
|
|
671
|
+
// native (duplicated but working) form instead.
|
|
672
|
+
return resolved.startsWith("-") ? prompt : resolved;
|
|
673
|
+
}
|
|
674
|
+
|
|
611
675
|
class ClaudeSession implements ProviderSession {
|
|
612
676
|
private proc: ReturnType<typeof Bun.spawn>;
|
|
613
677
|
private stdinWriter:
|
|
@@ -1035,7 +1099,11 @@ export class ClaudeAdapter implements ProviderAdapter {
|
|
|
1035
1099
|
|
|
1036
1100
|
const model = config.model || "opus";
|
|
1037
1101
|
|
|
1038
|
-
const sourceEnv = config.env || process.env;
|
|
1102
|
+
const sourceEnv = withClaudeRouteEnv(config.env || process.env);
|
|
1103
|
+
const sessionConfig: ProviderSessionConfig = {
|
|
1104
|
+
...config,
|
|
1105
|
+
prompt: await resolveClaudePrompt(config.prompt, process.env.HOME ?? homedir()),
|
|
1106
|
+
};
|
|
1039
1107
|
const transport = resolveClaudeTransport(sourceEnv);
|
|
1040
1108
|
const credType = validateClaudeCredentials(sourceEnv);
|
|
1041
1109
|
console.log(`\x1b[2m[claude]\x1b[0m Using credential: ${credType}`);
|
|
@@ -1212,7 +1280,7 @@ export class ClaudeAdapter implements ProviderAdapter {
|
|
|
1212
1280
|
|
|
1213
1281
|
if (transport === "sdk") {
|
|
1214
1282
|
return claudeSdk!.createClaudeSdkSession({
|
|
1215
|
-
config,
|
|
1283
|
+
config: sessionConfig,
|
|
1216
1284
|
model,
|
|
1217
1285
|
taskFilePath,
|
|
1218
1286
|
taskFileKey,
|
|
@@ -1227,7 +1295,7 @@ export class ClaudeAdapter implements ProviderAdapter {
|
|
|
1227
1295
|
}
|
|
1228
1296
|
|
|
1229
1297
|
return new ClaudeSession(
|
|
1230
|
-
|
|
1298
|
+
sessionConfig,
|
|
1231
1299
|
model,
|
|
1232
1300
|
taskFilePath,
|
|
1233
1301
|
taskFileKey,
|
|
@@ -47,6 +47,7 @@ import type {
|
|
|
47
47
|
BetaManagedAgentsAgentThreadContextCompactedEvent,
|
|
48
48
|
BetaManagedAgentsAgentToolResultEvent,
|
|
49
49
|
BetaManagedAgentsAgentToolUseEvent,
|
|
50
|
+
BetaManagedAgentsRedactedBlock,
|
|
50
51
|
BetaManagedAgentsSessionErrorEvent,
|
|
51
52
|
BetaManagedAgentsSessionStatusIdleEvent,
|
|
52
53
|
BetaManagedAgentsSessionStatusTerminatedEvent,
|
|
@@ -56,7 +57,7 @@ import type {
|
|
|
56
57
|
BetaManagedAgentsSession as Session,
|
|
57
58
|
BetaManagedAgentsSessionEvent as SessionEvent,
|
|
58
59
|
} from "@anthropic-ai/sdk/resources/beta/sessions";
|
|
59
|
-
import type {
|
|
60
|
+
import type { BetaSkill as Skill } from "@anthropic-ai/sdk/resources/beta/skills";
|
|
60
61
|
|
|
61
62
|
import { checkToolLoop } from "../hooks/tool-loop-detection";
|
|
62
63
|
import {
|
|
@@ -177,6 +178,32 @@ export function normalizeRepoUrl(vcsRepo: string): string {
|
|
|
177
178
|
return `https://github.com/${vcsRepo}`;
|
|
178
179
|
}
|
|
179
180
|
|
|
181
|
+
/** Stands in for an `agent.message` block that Anthropic model policy withheld. */
|
|
182
|
+
const REDACTED_BLOCK_PLACEHOLDER = "[content redacted by Anthropic model policy]";
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Render one `agent.message` content block as text. A `redacted` block carries
|
|
186
|
+
* no text, so it becomes a visible placeholder instead of vanishing: a message
|
|
187
|
+
* that was withheld in full must not read as an empty reply.
|
|
188
|
+
*/
|
|
189
|
+
function agentMessageBlockText(
|
|
190
|
+
block: BetaManagedAgentsTextBlock | BetaManagedAgentsRedactedBlock,
|
|
191
|
+
): string {
|
|
192
|
+
switch (block.type) {
|
|
193
|
+
case "text":
|
|
194
|
+
return block.text;
|
|
195
|
+
case "redacted":
|
|
196
|
+
return REDACTED_BLOCK_PLACEHOLDER;
|
|
197
|
+
default: {
|
|
198
|
+
// Compile-time signal when the SDK adds a block type; at runtime an
|
|
199
|
+
// unknown block contributes no text (the raw event is still logged).
|
|
200
|
+
const _unknown: never = block;
|
|
201
|
+
void _unknown;
|
|
202
|
+
return "";
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
180
207
|
/**
|
|
181
208
|
* Build the empty-zero `CostData` shape used at the start of a session and
|
|
182
209
|
* mutated in-place as `span.model_request_end` events accumulate token counts.
|
|
@@ -470,7 +497,7 @@ class ClaudeManagedSession implements ProviderSession {
|
|
|
470
497
|
switch (event.type) {
|
|
471
498
|
case "agent.message": {
|
|
472
499
|
const msg = event as BetaManagedAgentsAgentMessageEvent;
|
|
473
|
-
const text = msg.content.map(
|
|
500
|
+
const text = msg.content.map(agentMessageBlockText).join("");
|
|
474
501
|
if (text) {
|
|
475
502
|
this.emit({ type: "message", role: "assistant", content: text });
|
|
476
503
|
assistantText = text;
|
|
@@ -1858,7 +1858,7 @@ export class CodexSession implements ProviderSession {
|
|
|
1858
1858
|
}
|
|
1859
1859
|
|
|
1860
1860
|
if (wantRatings && result.ratings && result.ratings.length > 0) {
|
|
1861
|
-
const ratingEvents = _buildRatings(result.ratings, retrievals);
|
|
1861
|
+
const ratingEvents = _buildRatings(result.ratings, retrievals, result.model);
|
|
1862
1862
|
if (ratingEvents.length > 0) {
|
|
1863
1863
|
await _postRatings({
|
|
1864
1864
|
apiUrl,
|
|
@@ -77,6 +77,8 @@ export async function resolveSlashSkillPrompt(
|
|
|
77
77
|
providerLabel: string;
|
|
78
78
|
skillsDir: string;
|
|
79
79
|
emit?: (event: ProviderEvent) => void;
|
|
80
|
+
/** Drop a leading YAML frontmatter block from SKILL.md before inlining. */
|
|
81
|
+
stripFrontmatter?: boolean;
|
|
80
82
|
},
|
|
81
83
|
): Promise<string> {
|
|
82
84
|
if (!prompt) {
|
|
@@ -128,6 +130,10 @@ export async function resolveSlashSkillPrompt(
|
|
|
128
130
|
skillContent = skillContent.slice(0, MAX_SKILL_CHARS);
|
|
129
131
|
}
|
|
130
132
|
|
|
133
|
+
if (opts.stripFrontmatter) {
|
|
134
|
+
skillContent = skillContent.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n/, "").trimStart();
|
|
135
|
+
}
|
|
136
|
+
|
|
131
137
|
// Assemble the user-request body: trailing args from the slash line (if any),
|
|
132
138
|
// plus any subsequent lines from the original prompt. Joined with a newline
|
|
133
139
|
// so `/work-on-task foo\n\nproceed` becomes `foo\n\nproceed`.
|