@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
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Bm25Ranker,
|
|
3
|
+
CODEMODE_DOCS_PATH,
|
|
3
4
|
CODEMODE_STORE_ENTRY_TYPE,
|
|
4
5
|
DEFAULT_TOOL_SEARCH_LIMIT,
|
|
5
|
-
MODEL_GLOBAL_DECLARATIONS,
|
|
6
6
|
combineUsage,
|
|
7
7
|
createToolSearchDocument,
|
|
8
8
|
getCodemodeCallableTools,
|
|
@@ -10,11 +10,12 @@ import {
|
|
|
10
10
|
renderToolSample,
|
|
11
11
|
toCodemodeDeclaration,
|
|
12
12
|
toCodemodeIdentifier
|
|
13
|
-
} from "./cli-
|
|
13
|
+
} from "./cli-hmsw1gpy.js";
|
|
14
|
+
import"./cli-p0r8sxj5.js";
|
|
14
15
|
import {
|
|
15
16
|
getCodemodeWorkerSpecifier,
|
|
16
17
|
getQuickJSWasmPath
|
|
17
|
-
} from "./cli-
|
|
18
|
+
} from "./cli-s3hwpt9v.js";
|
|
18
19
|
import"./cli-5bfdm1ah.js";
|
|
19
20
|
import"./cli-0m7wct0d.js";
|
|
20
21
|
import"./cli-rb9m6rpe.js";
|
|
@@ -340,6 +341,8 @@ class CodemodeSandbox {
|
|
|
340
341
|
// node_modules/@earendil-works/pi-codemode/dist/runtime/prelude-source.js
|
|
341
342
|
var MAX_STORE_VALUE_CHARS = 256 * 1024;
|
|
342
343
|
var MAX_STORE_TOTAL_CHARS = 1024 * 1024;
|
|
344
|
+
var MAX_OUTPUT_CHARS = 16 * 1024 * 1024;
|
|
345
|
+
var MAX_OUTPUT_ITEMS = 1e5;
|
|
343
346
|
var IMAGE_HELPER_EXPECTS = "image expects a non-empty image URL string, an object with image_url, or a raw MCP image block";
|
|
344
347
|
var PRELUDE_SOURCE = `(function (bridge, toolsJson, globalsJson, storeJson) {
|
|
345
348
|
"use strict";
|
|
@@ -348,6 +351,7 @@ var PRELUDE_SOURCE = `(function (bridge, toolsJson, globalsJson, storeJson) {
|
|
|
348
351
|
const promiseThen = Promise.prototype.then;
|
|
349
352
|
const ErrorCtor = Error;
|
|
350
353
|
const TypeErrorCtor = TypeError;
|
|
354
|
+
const RangeErrorCtor = RangeError;
|
|
351
355
|
const pending = new Map();
|
|
352
356
|
let nextId = 1;
|
|
353
357
|
let finished = false;
|
|
@@ -423,6 +427,34 @@ var PRELUDE_SOURCE = `(function (bridge, toolsJson, globalsJson, storeJson) {
|
|
|
423
427
|
Object.freeze(tools);
|
|
424
428
|
Object.freeze(allTools);
|
|
425
429
|
|
|
430
|
+
// Reading a member that does not exist throws an error that names the close matches, instead of
|
|
431
|
+
// a later "not a function". \`in\` checks still work.
|
|
432
|
+
const comparable = (name) => name.toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
433
|
+
function guard(target, label, names, hint) {
|
|
434
|
+
return new Proxy(target, {
|
|
435
|
+
get(object, property, receiver) {
|
|
436
|
+
if (typeof property !== "string" || property in object || property in Object.prototype || property === "then" || property === "toJSON") {
|
|
437
|
+
return Reflect.get(object, property, receiver);
|
|
438
|
+
}
|
|
439
|
+
const wanted = comparable(property);
|
|
440
|
+
const exact = names.filter((name) => comparable(name) === wanted);
|
|
441
|
+
const close = exact.length > 0 ? exact : names.filter((name) => wanted && (comparable(name).includes(wanted) || wanted.includes(comparable(name))));
|
|
442
|
+
let message = label + "." + property + " does not exist.";
|
|
443
|
+
if (close.length > 0) message += " Did you mean " + close.slice(0, 5).map((name) => label + "." + name).join(", ") + "?";
|
|
444
|
+
else if (names.length <= 20) message += " Available: " + names.join(", ") + ".";
|
|
445
|
+
if (hint) message += " " + hint;
|
|
446
|
+
message += ' Check for a member with "' + property + '" in ' + label + ".";
|
|
447
|
+
throw new TypeErrorCtor(message);
|
|
448
|
+
},
|
|
449
|
+
});
|
|
450
|
+
}
|
|
451
|
+
const toolsProxy = guard(
|
|
452
|
+
tools,
|
|
453
|
+
"tools",
|
|
454
|
+
allTools.map((tool) => tool.name),
|
|
455
|
+
"ALL_TOOLS lists every tool; searchTools(query) finds tools by topic.",
|
|
456
|
+
);
|
|
457
|
+
|
|
426
458
|
const namespaces = new Map();
|
|
427
459
|
for (const { name, spread } of parse(globalsJson)) {
|
|
428
460
|
const fn = caller("global", name, spread);
|
|
@@ -436,7 +468,9 @@ var PRELUDE_SOURCE = `(function (bridge, toolsJson, globalsJson, storeJson) {
|
|
|
436
468
|
namespaces.get(namespace)[name.slice(dot + 1)] = fn;
|
|
437
469
|
}
|
|
438
470
|
for (const [namespace, members] of namespaces) {
|
|
439
|
-
Object.
|
|
471
|
+
Object.freeze(members);
|
|
472
|
+
const value = guard(members, namespace, Object.keys(members));
|
|
473
|
+
Object.defineProperty(globalThis, namespace, { value, enumerable: true });
|
|
440
474
|
}
|
|
441
475
|
|
|
442
476
|
// key -> JSON text. Sizes count key and JSON characters.
|
|
@@ -445,6 +479,9 @@ var PRELUDE_SOURCE = `(function (bridge, toolsJson, globalsJson, storeJson) {
|
|
|
445
479
|
let storedChars = 0;
|
|
446
480
|
for (const [key, json] of stored) storedChars += key.length + json.length;
|
|
447
481
|
|
|
482
|
+
const STORE_HINT =
|
|
483
|
+
"store() is for small state such as IDs or summaries. Show images with image(), keep large data in variables, or write it to a file with a tool.";
|
|
484
|
+
|
|
448
485
|
function checkKey(name, key) {
|
|
449
486
|
if (typeof key !== "string") throw new TypeError(name + "() key must be a string");
|
|
450
487
|
}
|
|
@@ -468,11 +505,17 @@ var PRELUDE_SOURCE = `(function (bridge, toolsJson, globalsJson, storeJson) {
|
|
|
468
505
|
throw new TypeError("store(" + stringify(key) + ") value is not JSON-serializable");
|
|
469
506
|
}
|
|
470
507
|
if (json.length > ${MAX_STORE_VALUE_CHARS}) {
|
|
471
|
-
throw new RangeError(
|
|
508
|
+
throw new RangeError(
|
|
509
|
+
"store(" + stringify(key) + ") value has " + json.length + " characters of JSON, more than the limit of ${MAX_STORE_VALUE_CHARS}. " +
|
|
510
|
+
STORE_HINT,
|
|
511
|
+
);
|
|
472
512
|
}
|
|
473
513
|
const next = storedChars - previous + key.length + json.length;
|
|
474
514
|
if (next > ${MAX_STORE_TOTAL_CHARS}) {
|
|
475
|
-
throw new RangeError(
|
|
515
|
+
throw new RangeError(
|
|
516
|
+
"store is full: stored values would exceed ${MAX_STORE_TOTAL_CHARS} characters of JSON. Delete keys with store(key, undefined). " +
|
|
517
|
+
STORE_HINT,
|
|
518
|
+
);
|
|
476
519
|
}
|
|
477
520
|
stored.set(key, json);
|
|
478
521
|
storedChars = next;
|
|
@@ -494,6 +537,26 @@ var PRELUDE_SOURCE = `(function (bridge, toolsJson, globalsJson, storeJson) {
|
|
|
494
537
|
Object.defineProperty(globalThis, "store", { value: store, enumerable: true });
|
|
495
538
|
Object.defineProperty(globalThis, "load", { value: load, enumerable: true });
|
|
496
539
|
|
|
540
|
+
let outputChars = 0;
|
|
541
|
+
let outputItems = 0;
|
|
542
|
+
|
|
543
|
+
// Past the output limits the script fails: done() reports the error, so catching it does not
|
|
544
|
+
// resume output, and the host ends the script.
|
|
545
|
+
function output(kind, data, mimeType) {
|
|
546
|
+
if (finished) return;
|
|
547
|
+
outputChars += data.length;
|
|
548
|
+
outputItems++;
|
|
549
|
+
if (outputChars > ${MAX_OUTPUT_CHARS} || outputItems > ${MAX_OUTPUT_ITEMS}) {
|
|
550
|
+
const error = new RangeErrorCtor(
|
|
551
|
+
"script output exceeded the limit of ${MAX_OUTPUT_CHARS} characters or ${MAX_OUTPUT_ITEMS} text(), image(), and console calls. " +
|
|
552
|
+
"Print a summary instead, or write large data to a file with a tool.",
|
|
553
|
+
);
|
|
554
|
+
done(false, describeError(error));
|
|
555
|
+
throw error;
|
|
556
|
+
}
|
|
557
|
+
bridge("output", kind, data, mimeType);
|
|
558
|
+
}
|
|
559
|
+
|
|
497
560
|
// Primitives become their string form, everything else JSON.
|
|
498
561
|
function outputText(value) {
|
|
499
562
|
if (value === undefined || value === null || typeof value !== "object" && typeof value !== "function") {
|
|
@@ -510,7 +573,7 @@ var PRELUDE_SOURCE = `(function (bridge, toolsJson, globalsJson, storeJson) {
|
|
|
510
573
|
} catch (error) {
|
|
511
574
|
throw new TypeErrorCtor(error instanceof ErrorCtor ? error.message : String(error));
|
|
512
575
|
}
|
|
513
|
-
|
|
576
|
+
output("text", rendered);
|
|
514
577
|
}
|
|
515
578
|
|
|
516
579
|
function imageUrl(value) {
|
|
@@ -565,7 +628,7 @@ var PRELUDE_SOURCE = `(function (bridge, toolsJson, globalsJson, storeJson) {
|
|
|
565
628
|
if (!signature) {
|
|
566
629
|
throw new TypeErrorCtor("invalid image output. The image data is not a PNG, JPEG, GIF, or WebP image");
|
|
567
630
|
}
|
|
568
|
-
|
|
631
|
+
output("image", data, signature[0]);
|
|
569
632
|
}
|
|
570
633
|
|
|
571
634
|
function exit() {
|
|
@@ -583,12 +646,12 @@ var PRELUDE_SOURCE = `(function (bridge, toolsJson, globalsJson, storeJson) {
|
|
|
583
646
|
const console = {};
|
|
584
647
|
for (const level of ["log", "info", "warn", "error", "debug"]) {
|
|
585
648
|
console[level] = (...args) => {
|
|
586
|
-
|
|
649
|
+
output("text", args.map(format).join(" "));
|
|
587
650
|
};
|
|
588
651
|
}
|
|
589
652
|
Object.freeze(console);
|
|
590
653
|
|
|
591
|
-
Object.defineProperty(globalThis, "tools", { value:
|
|
654
|
+
Object.defineProperty(globalThis, "tools", { value: toolsProxy, enumerable: true });
|
|
592
655
|
Object.defineProperty(globalThis, "ALL_TOOLS", { value: allTools, enumerable: true });
|
|
593
656
|
Object.defineProperty(globalThis, "console", { value: console, enumerable: true });
|
|
594
657
|
Object.defineProperty(globalThis, "text", { value: text, enumerable: true });
|
|
@@ -616,7 +679,7 @@ var PRELUDE_SOURCE = `(function (bridge, toolsJson, globalsJson, storeJson) {
|
|
|
616
679
|
run(fn) {
|
|
617
680
|
let promise;
|
|
618
681
|
try {
|
|
619
|
-
promise = fn(
|
|
682
|
+
promise = fn(toolsProxy, console);
|
|
620
683
|
} catch (error) {
|
|
621
684
|
done(false, describeError(error));
|
|
622
685
|
return;
|
|
@@ -691,6 +754,80 @@ function toModelInfo(model) {
|
|
|
691
754
|
delete info.headers;
|
|
692
755
|
return info;
|
|
693
756
|
}
|
|
757
|
+
function withArticle(word) {
|
|
758
|
+
return `${/^[aeiou]/.test(word) ? "an" : "a"} ${word}`;
|
|
759
|
+
}
|
|
760
|
+
function isRecord(value) {
|
|
761
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
762
|
+
}
|
|
763
|
+
function describeValue(value) {
|
|
764
|
+
if (value === undefined || value === null)
|
|
765
|
+
return String(value);
|
|
766
|
+
if (Array.isArray(value))
|
|
767
|
+
return value.length === 0 ? "an empty array" : "an array";
|
|
768
|
+
if (typeof value === "object") {
|
|
769
|
+
const keys = Object.keys(value);
|
|
770
|
+
if (keys.length === 0)
|
|
771
|
+
return "{}";
|
|
772
|
+
return `{ ${keys.slice(0, 6).join(", ")}${keys.length > 6 ? ", ..." : ""} }`;
|
|
773
|
+
}
|
|
774
|
+
return typeof value === "string" ? "a string" : `a ${typeof value}`;
|
|
775
|
+
}
|
|
776
|
+
var CLASSIFIER_CONTEXT_SHAPE = '{ state: { ... }, questions: { <id>: { type: "choice", instructions, criteria: { <label>: <meaning> } } | { type: "score", instructions, criteria: [<lowest level>, ..., <highest level>] } | { type: "bool", instructions, criteria: { true: <meaning>, false: <meaning> } } } }';
|
|
777
|
+
function checkClassifierContext(context) {
|
|
778
|
+
const fail = (problem) => new Error(`models.classify() ${problem}. Expected context: ${CLASSIFIER_CONTEXT_SHAPE}. See "Classify" in ${CODEMODE_DOCS_PATH}.`);
|
|
779
|
+
if (!isRecord(context))
|
|
780
|
+
throw fail(`expects a context object as its second argument, got ${describeValue(context)}`);
|
|
781
|
+
if (!isRecord(context.state))
|
|
782
|
+
throw fail(`context.state must be an object, got ${describeValue(context.state)}`);
|
|
783
|
+
const { questions } = context;
|
|
784
|
+
if (!isRecord(questions) || Object.keys(questions).length === 0) {
|
|
785
|
+
throw fail(`context.questions must map question IDs to questions, got ${describeValue(questions)}`);
|
|
786
|
+
}
|
|
787
|
+
const isStrings = (values) => values.length > 0 && values.every((value) => typeof value === "string");
|
|
788
|
+
for (const [id, question] of Object.entries(questions)) {
|
|
789
|
+
const at = `context.questions.${id}`;
|
|
790
|
+
if (!isRecord(question))
|
|
791
|
+
throw fail(`${at} must be a question object, got ${describeValue(question)}`);
|
|
792
|
+
if (typeof question.instructions !== "string")
|
|
793
|
+
throw fail(`${at}.instructions must be a string`);
|
|
794
|
+
const { criteria } = question;
|
|
795
|
+
if (question.type === "choice") {
|
|
796
|
+
if (!isRecord(criteria) || !isStrings(Object.values(criteria))) {
|
|
797
|
+
throw fail(`${at} is a "choice" question, so criteria must map each label to its meaning`);
|
|
798
|
+
}
|
|
799
|
+
} else if (question.type === "score") {
|
|
800
|
+
if (!Array.isArray(criteria) || !isStrings(criteria)) {
|
|
801
|
+
throw fail(`${at} is a "score" question, so criteria must list the levels as strings, lowest first`);
|
|
802
|
+
}
|
|
803
|
+
} else if (question.type === "bool") {
|
|
804
|
+
if (!isRecord(criteria) || typeof criteria.true !== "string" || typeof criteria.false !== "string") {
|
|
805
|
+
throw fail(`${at} is a "bool" question, so criteria must be { true: string, false: string }`);
|
|
806
|
+
}
|
|
807
|
+
} else {
|
|
808
|
+
throw fail(`${at}.type must be "choice", "score", or "bool", got ${JSON.stringify(question.type)}`);
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
return context;
|
|
812
|
+
}
|
|
813
|
+
function checkImagesContext(context) {
|
|
814
|
+
const fail = (problem) => new Error(`models.generateImages() ${problem}. Expected context: { input: [{ type: "text", text: <prompt> }, ...optional { type: "image", data: <base64>, mimeType } references] }. See "Generate images" in ${CODEMODE_DOCS_PATH}.`);
|
|
815
|
+
if (!isRecord(context))
|
|
816
|
+
throw fail(`expects a context object as its second argument, got ${describeValue(context)}`);
|
|
817
|
+
const { input } = context;
|
|
818
|
+
if (!Array.isArray(input) || input.length === 0) {
|
|
819
|
+
throw fail(`context.input must be a non-empty array of blocks, got ${describeValue(input)}`);
|
|
820
|
+
}
|
|
821
|
+
input.forEach((block, index) => {
|
|
822
|
+
if (isRecord(block) && block.type === "text" && typeof block.text === "string")
|
|
823
|
+
return;
|
|
824
|
+
if (isRecord(block) && block.type === "image" && typeof block.data === "string" && typeof block.mimeType === "string") {
|
|
825
|
+
return;
|
|
826
|
+
}
|
|
827
|
+
throw fail(`context.input[${index}] must be a text or image block, got ${describeValue(block)}`);
|
|
828
|
+
});
|
|
829
|
+
return context;
|
|
830
|
+
}
|
|
694
831
|
function createLimiter(limit) {
|
|
695
832
|
let active = 0;
|
|
696
833
|
const waiting = [];
|
|
@@ -795,6 +932,10 @@ async function executeCodemode(toolCallId, input, signal, onUpdate, ctx, options
|
|
|
795
932
|
const { code, options: sourceOptions } = parseCodemodeSource(input.code);
|
|
796
933
|
const calls = [];
|
|
797
934
|
let modelUsage;
|
|
935
|
+
let generatedImages = 0;
|
|
936
|
+
const addGeneratedImages = (count) => {
|
|
937
|
+
generatedImages += count;
|
|
938
|
+
};
|
|
798
939
|
const addModelUsage = (usage) => {
|
|
799
940
|
modelUsage = modelUsage ? combineUsage(modelUsage, usage) : usage;
|
|
800
941
|
};
|
|
@@ -834,7 +975,7 @@ async function executeCodemode(toolCallId, input, signal, onUpdate, ctx, options
|
|
|
834
975
|
tools: sandboxTools,
|
|
835
976
|
globals: [
|
|
836
977
|
...createDiscoveryGlobals(callable, samples, options),
|
|
837
|
-
...options.models && ctx ? createModelGlobals(ctx.modelRegistry, toolCallId, calls, publish, addModelUsage) : []
|
|
978
|
+
...options.models && ctx ? createModelGlobals(ctx.modelRegistry, toolCallId, calls, publish, addModelUsage, addGeneratedImages) : []
|
|
838
979
|
],
|
|
839
980
|
timeoutMs: sourceOptions.timeoutMs ?? Number.POSITIVE_INFINITY,
|
|
840
981
|
memoryLimitBytes: CODEMODE_MEMORY_LIMIT_BYTES,
|
|
@@ -864,6 +1005,12 @@ async function executeCodemode(toolCallId, input, signal, onUpdate, ctx, options
|
|
|
864
1005
|
items.push({ type: "text", text: `Script error:
|
|
865
1006
|
${formatError(result, calls)}` });
|
|
866
1007
|
}
|
|
1008
|
+
if (generatedImages > 0 && !items.some((item) => item.type === "image")) {
|
|
1009
|
+
items.push({
|
|
1010
|
+
type: "text",
|
|
1011
|
+
text: `Note: models.generateImages() returned ${generatedImages} image${generatedImages === 1 ? "" : "s"} that the script did not show. Show each image block of result.output with image(block).`
|
|
1012
|
+
});
|
|
1013
|
+
}
|
|
867
1014
|
const truncated = await truncateOutput(items, sourceOptions.maxOutputTokens ?? DEFAULT_MAX_OUTPUT_TOKENS);
|
|
868
1015
|
const wallTime = ((performance.now() - startedAt) / 1000).toFixed(1);
|
|
869
1016
|
const header = `${result.ok ? "Script completed" : "Script failed"}
|
|
@@ -953,9 +1100,44 @@ function createDiscoveryGlobals(tools, samples, options) {
|
|
|
953
1100
|
}
|
|
954
1101
|
];
|
|
955
1102
|
}
|
|
956
|
-
function createModelGlobals(models, toolCallId, calls, publish, addUsage) {
|
|
1103
|
+
function createModelGlobals(models, toolCallId, calls, publish, addUsage, addGeneratedImages) {
|
|
957
1104
|
const limit = createLimiter(MAX_CONCURRENT_MODEL_CALLS);
|
|
958
|
-
let
|
|
1105
|
+
let callCount = 0;
|
|
1106
|
+
const runModelCall = async (name, type, [model, context], checkContext, run) => {
|
|
1107
|
+
const listHint = `List the ${type} models you can use with models.getAvailableOfType("${type}").`;
|
|
1108
|
+
if (!isRecord(model) || typeof model.provider !== "string" || typeof model.id !== "string") {
|
|
1109
|
+
const undefinedHint = model === undefined || model === null ? " models.getModelOfType() returns undefined for an unknown provider or id." : "";
|
|
1110
|
+
throw new Error(`${name}() expects ${withArticle(type)} model as its first argument, got ${describeValue(model)}.${undefinedHint} ${listHint}`);
|
|
1111
|
+
}
|
|
1112
|
+
const { provider, id } = model;
|
|
1113
|
+
const ref = `${provider}/${id}`;
|
|
1114
|
+
const resolved = models.getModelOfType(type, provider, id);
|
|
1115
|
+
if (!resolved) {
|
|
1116
|
+
const actualType = [...MODEL_TYPES].find((other) => other !== type && models.getModelOfType(other, provider, id) !== undefined);
|
|
1117
|
+
throw new Error(actualType ? `"${ref}" is ${withArticle(actualType)} model, not ${withArticle(type)} model. ${listHint}` : `Unknown ${type} model "${ref}". ${listHint}`);
|
|
1118
|
+
}
|
|
1119
|
+
const checked = checkContext(context);
|
|
1120
|
+
const record = {
|
|
1121
|
+
id: `${toolCallId}/${name}/${++callCount}`,
|
|
1122
|
+
name,
|
|
1123
|
+
args: `${resolved.provider}/${resolved.id}`,
|
|
1124
|
+
status: "running"
|
|
1125
|
+
};
|
|
1126
|
+
calls.push(record);
|
|
1127
|
+
publish();
|
|
1128
|
+
const startedAt = performance.now();
|
|
1129
|
+
const result = await limit(() => run(resolved, checked));
|
|
1130
|
+
record.durationMs = performance.now() - startedAt;
|
|
1131
|
+
record.status = result.stopReason === "stop" ? "ok" : result.stopReason === "aborted" ? "cancelled" : "error";
|
|
1132
|
+
if (result.errorMessage)
|
|
1133
|
+
record.error = truncateText(result.errorMessage, ERROR_PREVIEW_CHARS);
|
|
1134
|
+
if (result.usage) {
|
|
1135
|
+
record.cost = result.usage.cost.total;
|
|
1136
|
+
addUsage(result.usage);
|
|
1137
|
+
}
|
|
1138
|
+
publish();
|
|
1139
|
+
return result;
|
|
1140
|
+
};
|
|
959
1141
|
const implementations = {
|
|
960
1142
|
"models.getModelsOfType": (args) => {
|
|
961
1143
|
const [type, provider] = args;
|
|
@@ -969,47 +1151,19 @@ function createModelGlobals(models, toolCallId, calls, publish, addUsage) {
|
|
|
969
1151
|
"models.getModelOfType": (args) => {
|
|
970
1152
|
const [type, provider, id] = args;
|
|
971
1153
|
if (typeof provider !== "string" || typeof id !== "string") {
|
|
972
|
-
throw new Error(
|
|
1154
|
+
throw new Error(`models.getModelOfType(type, provider, id) expects three strings, got (${args.map(describeValue).join(", ")}). The provider and the id are separate arguments, for example models.getModelOfType("classifier", "typesafe", "jev-latest").`);
|
|
973
1155
|
}
|
|
974
1156
|
const model = models.getModelOfType(toModelType(type), provider, id);
|
|
975
1157
|
return model === undefined ? undefined : toModelInfo(model);
|
|
976
1158
|
},
|
|
977
|
-
"models.classify":
|
|
978
|
-
|
|
979
|
-
const
|
|
980
|
-
|
|
981
|
-
throw new Error("models.classify() expects a model from models.getModelOfType() or models.getAvailableOfType()");
|
|
982
|
-
}
|
|
983
|
-
const resolved = models.getModelOfType("classifier", ref.provider, ref.id);
|
|
984
|
-
if (!resolved)
|
|
985
|
-
throw new Error(`Unknown classifier model "${ref.provider}/${ref.id}"`);
|
|
986
|
-
const record = {
|
|
987
|
-
id: `${toolCallId}/models.classify/${++classifyCount}`,
|
|
988
|
-
name: "models.classify",
|
|
989
|
-
args: `${resolved.provider}/${resolved.id}`,
|
|
990
|
-
status: "running"
|
|
991
|
-
};
|
|
992
|
-
calls.push(record);
|
|
993
|
-
publish();
|
|
994
|
-
const startedAt = performance.now();
|
|
995
|
-
const result = await limit(() => models.classify(resolved, context, { signal }));
|
|
996
|
-
record.durationMs = performance.now() - startedAt;
|
|
997
|
-
record.status = result.stopReason === "stop" ? "ok" : result.stopReason === "aborted" ? "cancelled" : "error";
|
|
998
|
-
if (result.errorMessage)
|
|
999
|
-
record.error = truncateText(result.errorMessage, ERROR_PREVIEW_CHARS);
|
|
1000
|
-
if (result.usage) {
|
|
1001
|
-
record.cost = result.usage.cost.total;
|
|
1002
|
-
addUsage(result.usage);
|
|
1003
|
-
}
|
|
1004
|
-
publish();
|
|
1159
|
+
"models.classify": (args, { signal }) => runModelCall("models.classify", "classifier", args, checkClassifierContext, (resolved, context) => models.classify(resolved, context, { signal })),
|
|
1160
|
+
"models.generateImages": (args, { signal }) => runModelCall("models.generateImages", "image", args, checkImagesContext, async (resolved, context) => {
|
|
1161
|
+
const result = await models.generateImages(resolved, context, { signal });
|
|
1162
|
+
addGeneratedImages(result.output.filter((block) => block.type === "image").length);
|
|
1005
1163
|
return result;
|
|
1006
|
-
}
|
|
1164
|
+
})
|
|
1007
1165
|
};
|
|
1008
|
-
return
|
|
1009
|
-
name: declaration.name,
|
|
1010
|
-
spread: true,
|
|
1011
|
-
execute: implementations[declaration.name]
|
|
1012
|
-
}));
|
|
1166
|
+
return Object.entries(implementations).map(([name, execute]) => ({ name, spread: true, execute }));
|
|
1013
1167
|
}
|
|
1014
1168
|
export {
|
|
1015
1169
|
executeCodemode,
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
toGoogleSdkThinkingLevel,
|
|
14
14
|
toGoogleThinkingLevel,
|
|
15
15
|
usesGoogleThinkingLevel
|
|
16
|
-
} from "./cli-
|
|
16
|
+
} from "./cli-hb5c2x5y.js";
|
|
17
17
|
import {
|
|
18
18
|
getPiUserAgent
|
|
19
19
|
} from "./cli-et1bbwqf.js";
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
} from "./cli-6map995v.js";
|
|
26
26
|
import {
|
|
27
27
|
buildBaseOptions
|
|
28
|
-
} from "./cli-
|
|
28
|
+
} from "./cli-mbssg1xv.js";
|
|
29
29
|
import {
|
|
30
30
|
sanitizeSurrogates
|
|
31
31
|
} from "./cli-y2apkfe2.js";
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
toGoogleSdkThinkingLevel,
|
|
15
15
|
toGoogleThinkingLevel,
|
|
16
16
|
usesGoogleThinkingLevel
|
|
17
|
-
} from "./cli-
|
|
17
|
+
} from "./cli-hb5c2x5y.js";
|
|
18
18
|
import {
|
|
19
19
|
getPiUserAgent
|
|
20
20
|
} from "./cli-et1bbwqf.js";
|
|
@@ -26,16 +26,13 @@ import {
|
|
|
26
26
|
} from "./cli-6map995v.js";
|
|
27
27
|
import {
|
|
28
28
|
buildBaseOptions
|
|
29
|
-
} from "./cli-
|
|
29
|
+
} from "./cli-mbssg1xv.js";
|
|
30
30
|
import {
|
|
31
31
|
sanitizeSurrogates
|
|
32
32
|
} from "./cli-y2apkfe2.js";
|
|
33
33
|
import {
|
|
34
34
|
providerHeadersToRecord
|
|
35
35
|
} from "./cli-7kyk9jr3.js";
|
|
36
|
-
import {
|
|
37
|
-
getProviderEnvValue
|
|
38
|
-
} from "./cli-btbzvq95.js";
|
|
39
36
|
import {
|
|
40
37
|
calculateCost,
|
|
41
38
|
clampThinkingLevel,
|
|
@@ -44,6 +41,9 @@ import {
|
|
|
44
41
|
getInitialSystemMessage,
|
|
45
42
|
getSystemMessageText
|
|
46
43
|
} from "./cli-ykk5jaax.js";
|
|
44
|
+
import {
|
|
45
|
+
getProviderEnvValue
|
|
46
|
+
} from "./cli-btbzvq95.js";
|
|
47
47
|
import {
|
|
48
48
|
AssistantMessageEventStream
|
|
49
49
|
} from "./cli-bzr0ftht.js";
|
|
@@ -5,64 +5,68 @@ import {
|
|
|
5
5
|
isUserAllowed,
|
|
6
6
|
registerMessageHandler,
|
|
7
7
|
resetSlackHandlerCachesForTesting
|
|
8
|
-
} from "./cli-
|
|
9
|
-
import"./cli-
|
|
10
|
-
import"./cli-
|
|
11
|
-
import"./cli-
|
|
12
|
-
import"./cli-
|
|
13
|
-
import"./cli-
|
|
8
|
+
} from "./cli-wjgs5wxe.js";
|
|
9
|
+
import"./cli-vc9bp061.js";
|
|
10
|
+
import"./cli-gpqpmns7.js";
|
|
11
|
+
import"./cli-kp42yek0.js";
|
|
12
|
+
import"./cli-cat6h73s.js";
|
|
13
|
+
import"./cli-w0bwte75.js";
|
|
14
14
|
import"./cli-re8z5p8p.js";
|
|
15
|
-
import"./cli-
|
|
16
|
-
import"./cli-
|
|
17
|
-
import"./cli-
|
|
18
|
-
import"./cli-
|
|
19
|
-
import"./cli-vctdqs5h.js";
|
|
20
|
-
import"./cli-tpq83z89.js";
|
|
15
|
+
import"./cli-wxkkd0e0.js";
|
|
16
|
+
import"./cli-zvhd3f64.js";
|
|
17
|
+
import"./cli-vy3ed88x.js";
|
|
18
|
+
import"./cli-5xhpb3kv.js";
|
|
21
19
|
import"./cli-epan13p1.js";
|
|
22
|
-
import"./cli-y89t4nca.js";
|
|
23
20
|
import"./cli-f14fvzag.js";
|
|
24
|
-
import"./cli-
|
|
25
|
-
import"./cli-
|
|
21
|
+
import"./cli-y89t4nca.js";
|
|
22
|
+
import"./cli-5bcd7sfy.js";
|
|
23
|
+
import"./cli-yy6dew39.js";
|
|
26
24
|
import"./cli-3dpj7atn.js";
|
|
27
|
-
import"./cli-
|
|
25
|
+
import"./cli-2x0e561b.js";
|
|
26
|
+
import"./cli-nt8hecg9.js";
|
|
28
27
|
import"./cli-rb9m6rpe.js";
|
|
29
|
-
import"./cli-
|
|
30
|
-
import"./cli-
|
|
31
|
-
import"./cli-
|
|
28
|
+
import"./cli-mzfth0bp.js";
|
|
29
|
+
import"./cli-sptrj5f5.js";
|
|
30
|
+
import"./cli-5k6k8ta3.js";
|
|
31
|
+
import"./cli-cebmgwsc.js";
|
|
32
|
+
import"./cli-kh04eqwe.js";
|
|
32
33
|
import"./cli-fad8m16k.js";
|
|
33
|
-
import"./cli-jz4w45qt.js";
|
|
34
|
-
import"./cli-25fcq4b4.js";
|
|
35
34
|
import"./cli-bsakbbkm.js";
|
|
36
35
|
import"./cli-trc24wk2.js";
|
|
37
36
|
import"./cli-51tf7ac3.js";
|
|
38
|
-
import"./cli-
|
|
37
|
+
import"./cli-swfmp1fx.js";
|
|
39
38
|
import"./cli-q51yprfq.js";
|
|
40
39
|
import"./cli-3er6gcsn.js";
|
|
41
|
-
import"./cli-
|
|
40
|
+
import"./cli-cvk6yzw5.js";
|
|
42
41
|
import"./cli-yatxqynm.js";
|
|
43
|
-
import"./cli-qydf22qq.js";
|
|
44
|
-
import"./cli-3qhyh31j.js";
|
|
45
|
-
import"./cli-ktmyrtpn.js";
|
|
46
|
-
import"./cli-r1mxd1xh.js";
|
|
47
|
-
import"./cli-n7h1kqpf.js";
|
|
48
|
-
import"./cli-ptr8h7kp.js";
|
|
49
|
-
import"./cli-dv6cdjs2.js";
|
|
50
|
-
import"./cli-1a2j50m0.js";
|
|
51
|
-
import"./cli-0wgxmwf6.js";
|
|
52
|
-
import"./cli-ywybs5as.js";
|
|
53
|
-
import"./cli-ej6gbxfb.js";
|
|
54
|
-
import"./cli-kmcpfwn2.js";
|
|
55
|
-
import"./cli-sd0mxa3c.js";
|
|
56
|
-
import"./cli-w5e1d1vv.js";
|
|
57
|
-
import"./cli-0q3avq3s.js";
|
|
58
|
-
import"./cli-r2ap2czm.js";
|
|
59
42
|
import"./cli-13hw4z91.js";
|
|
43
|
+
import"./cli-ykk5jaax.js";
|
|
60
44
|
import"./cli-btbzvq95.js";
|
|
61
45
|
import"./cli-1m2e086m.js";
|
|
62
|
-
import"./cli-ykk5jaax.js";
|
|
63
46
|
import"./cli-bzr0ftht.js";
|
|
64
47
|
import"./cli-bd957dgb.js";
|
|
65
48
|
import"./cli-pzxba7gw.js";
|
|
49
|
+
import"./cli-2zy95vhm.js";
|
|
50
|
+
import"./cli-kdkwd3yr.js";
|
|
51
|
+
import"./cli-jf7wmv1r.js";
|
|
52
|
+
import"./cli-xqpk3rp7.js";
|
|
53
|
+
import"./cli-3qhyh31j.js";
|
|
54
|
+
import"./cli-7af8yhav.js";
|
|
55
|
+
import"./cli-n7h1kqpf.js";
|
|
56
|
+
import"./cli-eg0b3p0k.js";
|
|
57
|
+
import"./cli-xk79303e.js";
|
|
58
|
+
import"./cli-ywybs5as.js";
|
|
59
|
+
import"./cli-gd4favx9.js";
|
|
60
|
+
import"./cli-qrgt5bqf.js";
|
|
61
|
+
import"./cli-qjjvzwzd.js";
|
|
62
|
+
import"./cli-1a2j50m0.js";
|
|
63
|
+
import"./cli-f9w1semm.js";
|
|
64
|
+
import"./cli-ej6gbxfb.js";
|
|
65
|
+
import"./cli-jyy6pm2f.js";
|
|
66
|
+
import"./cli-sd0mxa3c.js";
|
|
67
|
+
import"./cli-w5e1d1vv.js";
|
|
68
|
+
import"./cli-sqvfa090.js";
|
|
69
|
+
import"./cli-nexqx4ve.js";
|
|
66
70
|
import"./cli-f7kvq46p.js";
|
|
67
71
|
import"./cli-zf8jjwex.js";
|
|
68
72
|
import"./cli-bc05qbss.js";
|
|
@@ -2,10 +2,13 @@
|
|
|
2
2
|
import {
|
|
3
3
|
materializeClaudeMd,
|
|
4
4
|
stopClaudeMd
|
|
5
|
-
} from "./cli-
|
|
5
|
+
} from "./cli-rnyzn44p.js";
|
|
6
|
+
import {
|
|
7
|
+
guardGhPrBody
|
|
8
|
+
} from "./cli-wbvnn6tk.js";
|
|
6
9
|
import {
|
|
7
10
|
summarizeSession
|
|
8
|
-
} from "./cli-
|
|
11
|
+
} from "./cli-4dcpaefp.js";
|
|
9
12
|
import {
|
|
10
13
|
checkToolLoop,
|
|
11
14
|
clearToolHistory
|
|
@@ -16,16 +19,16 @@ import {
|
|
|
16
19
|
fetchRetrievalsForTask,
|
|
17
20
|
isLlmRaterEnabled,
|
|
18
21
|
postRatings
|
|
19
|
-
} from "./cli-
|
|
22
|
+
} from "./cli-w0bwte75.js";
|
|
20
23
|
import {
|
|
21
24
|
getApiKey
|
|
22
25
|
} from "./cli-f14fvzag.js";
|
|
23
|
-
import"./cli-
|
|
24
|
-
import"./cli-
|
|
26
|
+
import"./cli-5bcd7sfy.js";
|
|
27
|
+
import"./cli-yy6dew39.js";
|
|
25
28
|
import"./cli-3dpj7atn.js";
|
|
26
|
-
import"./cli-
|
|
29
|
+
import"./cli-2x0e561b.js";
|
|
30
|
+
import"./cli-nt8hecg9.js";
|
|
27
31
|
import"./cli-rb9m6rpe.js";
|
|
28
|
-
import"./cli-rykfmgwg.js";
|
|
29
32
|
import {
|
|
30
33
|
buildIndependentIdentityPayloads,
|
|
31
34
|
contentSha256,
|
|
@@ -33,35 +36,38 @@ import {
|
|
|
33
36
|
init_profile_sync,
|
|
34
37
|
readIdentityBaselines,
|
|
35
38
|
warnProfileFileTooLarge
|
|
36
|
-
} from "./cli-
|
|
39
|
+
} from "./cli-cebmgwsc.js";
|
|
37
40
|
import"./cli-bsakbbkm.js";
|
|
38
41
|
import"./cli-trc24wk2.js";
|
|
39
|
-
import"./cli-
|
|
40
|
-
import"./cli-
|
|
42
|
+
import"./cli-cvk6yzw5.js";
|
|
43
|
+
import"./cli-13hw4z91.js";
|
|
44
|
+
import"./cli-ykk5jaax.js";
|
|
45
|
+
import"./cli-btbzvq95.js";
|
|
46
|
+
import"./cli-1m2e086m.js";
|
|
47
|
+
import"./cli-bzr0ftht.js";
|
|
48
|
+
import"./cli-7af8yhav.js";
|
|
41
49
|
import"./cli-n7h1kqpf.js";
|
|
42
|
-
import"./cli-
|
|
50
|
+
import"./cli-eg0b3p0k.js";
|
|
43
51
|
import {
|
|
44
52
|
MAX_PROFILE_FILE_LENGTH,
|
|
45
53
|
getMcpBaseUrl,
|
|
46
54
|
init_constants
|
|
47
|
-
} from "./cli-
|
|
55
|
+
} from "./cli-gd4favx9.js";
|
|
56
|
+
import"./cli-qrgt5bqf.js";
|
|
57
|
+
import"./cli-qjjvzwzd.js";
|
|
48
58
|
import"./cli-1a2j50m0.js";
|
|
59
|
+
import"./cli-f9w1semm.js";
|
|
49
60
|
import"./cli-ej6gbxfb.js";
|
|
50
61
|
import"./cli-sd0mxa3c.js";
|
|
51
62
|
import"./cli-w5e1d1vv.js";
|
|
52
63
|
import {
|
|
53
64
|
init_package,
|
|
54
65
|
package_default
|
|
55
|
-
} from "./cli-
|
|
66
|
+
} from "./cli-sqvfa090.js";
|
|
56
67
|
import {
|
|
57
68
|
init_secret_scrubber,
|
|
58
69
|
scrubSecrets
|
|
59
|
-
} from "./cli-
|
|
60
|
-
import"./cli-13hw4z91.js";
|
|
61
|
-
import"./cli-btbzvq95.js";
|
|
62
|
-
import"./cli-1m2e086m.js";
|
|
63
|
-
import"./cli-ykk5jaax.js";
|
|
64
|
-
import"./cli-bzr0ftht.js";
|
|
70
|
+
} from "./cli-nexqx4ve.js";
|
|
65
71
|
import"./cli-bc05qbss.js";
|
|
66
72
|
|
|
67
73
|
// src/hooks/hook.ts
|
|
@@ -258,7 +264,7 @@ async function runStopHookSessionSummary(opts, deps = {}) {
|
|
|
258
264
|
}
|
|
259
265
|
if (llmRaterEnabled && taskId && ratings.length > 0) {
|
|
260
266
|
try {
|
|
261
|
-
const events = _buildRatings(ratings, retrievals);
|
|
267
|
+
const events = _buildRatings(ratings, retrievals, result.model);
|
|
262
268
|
if (events.length > 0) {
|
|
263
269
|
await _postRatings({
|
|
264
270
|
apiUrl,
|
|
@@ -727,6 +733,14 @@ You do not have a pre-defined agent ID, you will receive one when you join the s
|
|
|
727
733
|
return;
|
|
728
734
|
}
|
|
729
735
|
}
|
|
736
|
+
if (msg.tool_name === "Bash") {
|
|
737
|
+
const prBodyBlock = await guardGhPrBody(msg.tool_input, msg.cwd ?? process.cwd());
|
|
738
|
+
if (prBodyBlock) {
|
|
739
|
+
console.error(prBodyBlock);
|
|
740
|
+
process.exitCode = 2;
|
|
741
|
+
return;
|
|
742
|
+
}
|
|
743
|
+
}
|
|
730
744
|
if (agentInfo && !agentInfo.isLead && agentInfo.status === "busy") {
|
|
731
745
|
const loopTaskFile = await readTaskFile();
|
|
732
746
|
if (loopTaskFile?.taskId && msg.tool_name && msg.tool_input) {
|