@desplega.ai/agent-swarm 1.160.0 → 1.162.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -3
- package/dist/{acp-adapter-2mjwcsfh.js → acp-adapter-74m73ae9.js} +163 -49
- package/dist/{actions-e43rxskr.js → actions-4sr14gnt.js} +42 -38
- package/dist/{anthropic-messages-5qx80j9k.js → anthropic-messages-8xxrzky9.js} +22 -26
- package/dist/{app-mc7xfagn.js → app-pt68fbwp.js} +17 -14
- package/dist/{artifact-3v5t9jtg.js → artifact-fey7dvj9.js} +3 -2
- package/dist/{assistant-sedkzv3b.js → assistant-cv3jytks.js} +43 -39
- package/dist/{azure-openai-responses-nfb21z9a.js → azure-openai-responses-f5cqsyj8.js} +15 -10
- package/dist/{boot-reembed-m3656j2n.js → boot-reembed-4ht4gqth.js} +17 -14
- package/dist/{boot-reembed-cqz9swn5.js → boot-reembed-nxpcvpj9.js} +16 -13
- package/dist/{boot-scrub-logs-xbxf5d7w.js → boot-scrub-logs-k93kyw8k.js} +13 -10
- package/dist/boot-seeds-1skcrs0e.js +32 -0
- package/dist/{claude-adapter-dc6289mc.js → claude-adapter-r5g0tzge.js} +39 -30
- package/dist/{claude-managed-adapter-naaw51me.js → claude-managed-adapter-yxkfxg8j.js} +6 -5
- package/dist/{claude-managed-setup-eacvchx0.js → claude-managed-setup-pkyrgshb.js} +27 -27
- package/dist/{claude-sdk-session-bqp2xvym.js → claude-sdk-session-jxyxnrwd.js} +8041 -7910
- package/dist/{cli-4derpgyk.js → cli-2hhfhfq5.js} +6 -1
- package/dist/{cli-rykfmgwg.js → cli-2x0e561b.js} +1 -1
- package/dist/{cli-tzx2ke1v.js → cli-2zy95vhm.js} +137 -64
- package/dist/{cli-0x01kwrd.js → cli-4cwxn7gp.js} +47 -186
- package/dist/{cli-xjcywfsf.js → cli-4dcpaefp.js} +12 -11
- package/dist/{cli-v7fn5gms.js → cli-4x0csdjq.js} +164 -76
- package/dist/{cli-12tszpk9.js → cli-5bcd7sfy.js} +91 -29
- package/dist/{cli-jz4w45qt.js → cli-5k6k8ta3.js} +190 -50
- package/dist/{cli-tpq83z89.js → cli-5xhpb3kv.js} +20 -19
- package/dist/{cli-r1mxd1xh.js → cli-7af8yhav.js} +6 -179
- package/dist/{cli-jajnsm8q.js → cli-7tre70zp.js} +18160 -31345
- package/dist/{cli-447dt1h3.js → cli-8ev9xqnx.js} +218 -25
- package/dist/cli-bsky8g7w.js +449 -0
- package/dist/{cli-0z2v4nhw.js → cli-cat6h73s.js} +1 -1
- package/dist/{cli-25fcq4b4.js → cli-cebmgwsc.js} +15 -11
- package/dist/{cli-shkxm1vn.js → cli-cvatsam7.js} +189 -13
- package/dist/{cli-2658f6at.js → cli-cvk6yzw5.js} +6 -8
- package/dist/cli-dbmwby6a.js +9 -0
- package/dist/{cli-ptr8h7kp.js → cli-eg0b3p0k.js} +5 -218
- package/dist/cli-f9w1semm.js +413 -0
- package/dist/{cli-523679eh.js → cli-g739zqzt.js} +6 -5
- package/dist/{cli-dv6cdjs2.js → cli-gd4favx9.js} +28 -7
- package/dist/{cli-c8a36vcc.js → cli-gpqpmns7.js} +2 -2
- package/dist/{cli-5nbmpy8w.js → cli-hb5c2x5y.js} +1 -1
- package/dist/{cli-741yb0xx.js → cli-hmsw1gpy.js} +55 -169
- package/dist/{cli-qydf22qq.js → cli-jf7wmv1r.js} +2562 -735
- package/dist/{cli-mfe5btp9.js → cli-jxs2ygaw.js} +317 -121
- package/dist/{cli-kmcpfwn2.js → cli-jyy6pm2f.js} +19 -3
- package/dist/cli-kdkwd3yr.js +615 -0
- package/dist/{cli-6cs6wzxt.js → cli-kh04eqwe.js} +2 -2
- package/dist/{cli-9hsgwz4w.js → cli-kp42yek0.js} +1309 -391
- package/dist/cli-ma3zvh39.js +10404 -0
- package/dist/{cli-ybgv4kw2.js → cli-mbssg1xv.js} +9 -2
- package/dist/{cli-jsp14b6c.js → cli-mzfth0bp.js} +38 -1
- package/dist/{cli-r2ap2czm.js → cli-nexqx4ve.js} +6 -0
- package/dist/{cli-f8gy6r2r.js → cli-nq7yqw7b.js} +19 -8
- package/dist/{cli-10nhj6xq.js → cli-nt8hecg9.js} +34 -33
- package/dist/cli-p0r8sxj5.js +303 -0
- package/dist/{cli-58e8yr0d.js → cli-pkd6s2wy.js} +4 -2
- package/dist/{cli-a8dvhzrt.js → cli-q24re23n.js} +7 -5
- package/dist/cli-qjjvzwzd.js +222 -0
- package/dist/cli-qrgt5bqf.js +189 -0
- package/dist/{cli-et8m9xsv.js → cli-rfjw9jw2.js} +22 -10
- package/dist/{cli-7e398j1h.js → cli-rj0gqwwp.js} +3 -3
- package/dist/{cli-btfv8y88.js → cli-rnyzn44p.js} +2 -2
- package/dist/{cli-d5czme6m.js → cli-s3hwpt9v.js} +4754 -4945
- package/dist/{cli-0jwe9034.js → cli-sptrj5f5.js} +3 -3
- package/dist/{cli-0q3avq3s.js → cli-sqvfa090.js} +19 -11
- package/dist/{cli-azhgzetg.js → cli-swfmp1fx.js} +27 -27
- package/dist/{cli-jyk0ynw2.js → cli-t845n9xk.js} +23 -10
- package/dist/{cli-zpep9q5e.js → cli-tcen9p5w.js} +20 -15
- package/dist/{cli-74h9hscv.js → cli-tre4bdgq.js} +1 -1
- package/dist/{cli-pm1rst0h.js → cli-twrh04ap.js} +30 -15
- package/dist/{cli-phsaj4xq.js → cli-v0pvvhfq.js} +1 -1
- package/dist/{cli-ydmcgve1.js → cli-vc9bp061.js} +5 -5
- package/dist/{cli-g2whhdrf.js → cli-vxe6qa4h.js} +1 -1
- package/dist/{cli-vctdqs5h.js → cli-vy3ed88x.js} +15 -2
- package/dist/{cli-br0qdrnp.js → cli-vyqs9ya8.js} +18 -18
- package/dist/{cli-cpvsaqsw.js → cli-w0bwte75.js} +8 -5
- package/dist/cli-wbvnn6tk.js +861 -0
- package/dist/{cli-r94z9p1z.js → cli-wgbezhw2.js} +3 -0
- package/dist/{cli-evvtk35y.js → cli-wjgs5wxe.js} +7 -7
- package/dist/cli-wxkkd0e0.js +33 -0
- package/dist/{cli-0wgxmwf6.js → cli-xk79303e.js} +20 -7
- package/dist/{cli-ktmyrtpn.js → cli-xqpk3rp7.js} +33 -10
- package/dist/{cli-ygwm91nt.js → cli-yy6dew39.js} +1 -1
- package/dist/cli-zp38xvtm.js +9487 -0
- package/dist/{cli-tfky2838.js → cli-zvhd3f64.js} +4 -4
- package/dist/{cli-jayjpjmb.js → cli-zxqx25nz.js} +66 -23
- package/dist/cli.js +40 -32
- package/dist/{cloudflare-workers-ai-system-one-k6fbxw9d.js → cloudflare-workers-ai-system-one-k8ddqjkq.js} +8 -6
- package/dist/{codex-adapter-nmxcatww.js → codex-adapter-esvmnhn7.js} +24 -23
- package/dist/{codex-hook-20me6byw.js → codex-hook-m73jmqgx.js} +19 -3
- package/dist/{codex-login-w6fz4xbz.js → codex-login-cf7mzsgg.js} +2 -2
- package/dist/{codex-session-runner-90aa80ev.js → codex-session-runner-ban9excr.js} +24 -23
- package/dist/{commands-8wcq1kn7.js → commands-75413p2n.js} +13 -10
- package/dist/{db-j40kc4se.js → db-7f5pecwg.js} +17 -10
- package/dist/{dispatcher-4zqy768d.js → dispatcher-fh9at8nz.js} +41 -37
- package/dist/dsh-adapter-wpze65d4.js +24 -0
- package/dist/{e2b-ez07znam.js → e2b-gjgdjp91.js} +12 -9
- package/dist/easter-egg-3d-3w5c2n4c.js +1057 -0
- package/dist/{execute-6e7qeyk4.js → execute-f50wg9nh.js} +203 -49
- package/dist/{google-generative-ai-k6n5nbpp.js → google-generative-ai-jxxpnegy.js} +2 -2
- package/dist/{google-vertex-44xxtcvp.js → google-vertex-x7q1angm.js} +5 -5
- package/dist/{handlers-kjdce1w5.js → handlers-w13787bb.js} +44 -40
- package/dist/{hook-r2t4bqfg.js → hook-46g1jrvx.js} +34 -20
- package/dist/{hook-czx13n12.js → hook-4tpts2ry.js} +25 -21
- package/dist/{http-3bbb19be.js → http-19pzbfrt.js} +1440 -283
- package/dist/{index-668me3f0.js → index-8fd4dm4h.js} +42 -38
- package/dist/{index-fg0dsp6c.js → index-dqmp15bq.js} +41 -37
- package/dist/{index-kkv84jq9.js → index-qb4q1y3e.js} +41 -37
- package/dist/index-s75wc4wd.js +33 -0
- package/dist/{index-zg7vp46x.js → index-scptvdxg.js} +64 -38
- package/dist/{keepalive-yra8dy57.js → keepalive-xa5ts9cd.js} +15 -12
- package/dist/{lead-va0pad2c.js → lead-qp4xkvjq.js} +59 -54
- package/dist/{maintenance-hqewtmyg.js → maintenance-rm5885hm.js} +17 -14
- package/dist/{mistral-conversations-pc3ntnxt.js → mistral-conversations-rw7fbt22.js} +4 -4
- package/dist/{node-a5e00qhp.js → node-8zkdq42h.js} +834 -833
- package/dist/node-f0ykebbv.js +2107 -0
- package/dist/node-wyamey5r.js +19 -0
- package/dist/{oauth-refresh-sweep-7rdt1m9n.js → oauth-refresh-sweep-1csdfebf.js} +14 -11
- package/dist/{onboard-j6ms6d0x.js → onboard-r6b78cs4.js} +10 -10
- package/dist/{openai-codex-responses-bbancrr0.js → openai-codex-responses-efvrgrq3.js} +4 -4
- package/dist/{openai-completions-jpaj5g2b.js → openai-completions-bbbrrz4z.js} +12 -8
- package/dist/{openai-responses-200k1wx4.js → openai-responses-9jjyrcm1.js} +15 -10
- package/dist/{opencode-adapter-89rabkw2.js → opencode-adapter-kb3g6pkf.js} +12 -9
- package/dist/{otel-impl-a792rjz0.js → otel-impl-0y9knpky.js} +6 -6
- package/dist/{pi-mono-adapter-g7qzvr3v.js → pi-mono-adapter-z6s1bme2.js} +128 -37
- package/dist/{pricing-refresh-wx0tp7cb.js → pricing-refresh-mth26tgp.js} +15 -12
- package/dist/{rbac-roles-8tzawacv.js → rbac-roles-kwntb23q.js} +17 -12
- package/dist/rbac-roles-vpk4ebm8.js +45 -0
- package/dist/{registry-v5wytg0s.js → registry-km6t1jd2.js} +1 -1
- package/dist/{render-v2-mm7zswb8.js → render-v2-hcm7h00y.js} +17 -14
- package/dist/{runtime-zyssgse0.js → runtime-vfjsfsc5.js} +5 -4
- package/dist/{setup-8y70ys6t.js → setup-hbyzd65h.js} +2 -2
- package/dist/{virtual-modules-6nmk7h3n.js → virtual-modules-9bv7ry91.js} +9 -7
- package/dist/{work-objects-fg6xkb0n.js → work-objects-m09sxnhe.js} +44 -40
- package/dist/{worker-wmwhxsph.js → worker-0h35rvk4.js} +59 -54
- package/dist/{x-n3e0v3xa.js → x-f1gt1pz3.js} +2 -2
- package/openapi.json +699 -26
- package/package.json +19 -11
- package/src/azure-devops/api.ts +121 -0
- package/src/azure-devops/auth.ts +78 -0
- package/src/azure-devops/handlers.ts +413 -0
- package/src/azure-devops/index.ts +27 -0
- package/src/azure-devops/templates.ts +108 -0
- package/src/azure-devops/types.ts +90 -0
- package/src/be/api-drain.ts +184 -0
- package/src/be/db/tasks/read.ts +32 -7
- package/src/be/db/tasks/write.ts +21 -4
- package/src/be/db-client.ts +11 -2
- package/src/be/db-retention.ts +95 -32
- package/src/be/db.ts +44 -19
- package/src/be/memory/constants.ts +16 -0
- package/src/be/memory/graph-expansion.ts +8 -1
- package/src/be/memory/index-content.ts +20 -1
- package/src/be/memory/key-guard.ts +93 -0
- package/src/be/memory/key-paths.ts +103 -0
- package/src/be/memory/link-resolver.ts +29 -3
- package/src/be/memory/providers/sqlite-store.ts +152 -45
- package/src/be/memory/raters/llm-summarizer.ts +10 -4
- package/src/be/memory/raters/llm.ts +15 -5
- package/src/be/memory/raters/store.ts +6 -3
- package/src/be/memory/raters/types.ts +11 -0
- package/src/be/memory/reranker.ts +38 -7
- package/src/be/memory/types.ts +12 -1
- package/src/be/migrations/190_memory_rating_model.sql +7 -0
- package/src/be/migrations/191_context_versions_previous_index.sql +8 -0
- package/src/be/migrations/192_favorites_agent_fs_path.sql +36 -0
- package/src/be/onboarding.ts +7 -1
- package/src/be/pricing-normalize.ts +4 -2
- package/src/be/scripts/typecheck.ts +4 -3
- package/src/be/seed-pricing.ts +16 -0
- package/src/be/seed-prompt-templates.ts +1 -0
- package/src/be/swarm-config-guard.ts +46 -17
- package/src/be/task-citations.ts +11 -5
- package/src/be/users.ts +3 -0
- package/src/cli.tsx +3 -2
- package/src/comb/agent-fs.ts +39 -0
- package/src/comb/config.ts +37 -0
- package/src/comb/markers.ts +37 -0
- package/src/comb/review-batch.ts +486 -0
- package/src/comb/templates.ts +88 -0
- package/src/commands/claude-managed-setup.ts +33 -31
- package/src/commands/context-preamble.ts +4 -1
- package/src/commands/hook.ts +2 -1
- package/src/commands/provider-credentials.ts +28 -15
- package/src/commands/runner.ts +458 -110
- package/src/commands/templates.ts +10 -0
- package/src/e2b/env.ts +2 -0
- package/src/extensions/catalog.generated.json +17 -0
- package/src/extensions/contract-types.generated.ts +1 -1
- package/src/fs/agent-fs-provider.ts +106 -2
- package/src/github/handlers.ts +10 -74
- package/src/github/reactions.ts +119 -138
- package/src/github/task-reactions.ts +34 -11
- package/src/heartbeat/heartbeat.ts +4 -0
- package/src/hooks/codex-hook.ts +25 -1
- package/src/hooks/hook.ts +14 -1
- package/src/hooks/pr-body-guard.ts +983 -0
- package/src/http/agents.ts +1 -1
- package/src/http/all-routes.ts +1 -0
- package/src/http/assets.ts +5 -17
- package/src/http/comb.ts +131 -0
- package/src/http/core.ts +14 -1
- package/src/http/extensions.ts +51 -27
- package/src/http/fs.ts +9 -17
- package/src/http/index.ts +27 -9
- package/src/http/mcp-user.ts +8 -13
- package/src/http/mcp.ts +19 -12
- package/src/http/memory.ts +80 -14
- package/src/http/onboarding.ts +21 -2
- package/src/http/poll.ts +30 -3
- package/src/http/realtime.ts +62 -0
- package/src/http/request-principal.ts +22 -0
- package/src/http/session-data.ts +6 -4
- package/src/http/stats.ts +1 -0
- package/src/http/status.ts +34 -2
- package/src/http/tasks.ts +17 -3
- package/src/http/users.ts +1 -1
- package/src/http/webhooks.ts +120 -2
- package/src/kv-reserved-namespaces.ts +10 -5
- package/src/providers/claude-adapter.ts +84 -16
- package/src/providers/claude-managed-adapter.ts +29 -2
- package/src/providers/codex-adapter.ts +1 -1
- package/src/providers/codex-skill-resolver.ts +6 -0
- package/src/providers/dsh-adapter.ts +204 -7
- package/src/providers/opencode-adapter.ts +24 -3
- package/src/providers/pi-mono-adapter.ts +154 -5
- package/src/providers/pi-mono-extension.ts +1 -1
- package/src/providers/pricing-sources.md +5 -1
- package/src/providers/reasoning-effort.ts +10 -2
- package/src/providers/types.ts +1 -1
- package/src/rbac/legacy-policy.ts +3 -0
- package/src/rbac/permissions.ts +14 -0
- package/src/realtime/auth.ts +63 -1
- package/src/realtime/tickets.ts +52 -0
- package/src/realtime/transport.ts +51 -22
- package/src/scripts-runtime/types/stdlib.d.ts +13 -5
- package/src/scripts-runtime/types/swarm-extension.d.ts +7 -3
- package/src/scripts-runtime/types/swarm-sdk.d.ts +13 -5
- package/src/tasks/context-key.ts +38 -1
- package/src/telemetry-context.ts +175 -0
- package/src/telemetry-contract/EVENTS.md +81 -0
- package/src/telemetry-contract/SOURCE.json +9 -0
- package/src/telemetry-contract/catalog.json +1335 -0
- package/src/telemetry-contract/index.ts +60 -0
- package/src/telemetry-contract/types.gen.ts +1971 -0
- package/src/telemetry-identity.ts +129 -0
- package/src/telemetry-snapshot.ts +211 -0
- package/src/telemetry-trigger.ts +125 -0
- package/src/telemetry-types.typetest.ts +40 -0
- package/src/telemetry.ts +271 -67
- package/src/tests/api-drain-e2e.test.ts +249 -0
- package/src/tests/api-drain-worker-e2e.test.ts +216 -0
- package/src/tests/api-drain.test.ts +351 -0
- package/src/tests/azure-devops-auth.test.ts +100 -0
- package/src/tests/azure-devops-handlers.test.ts +324 -0
- package/src/tests/azure-devops-webhook-malformed.test.ts +96 -0
- package/src/tests/claude-default-route.test.ts +260 -0
- package/src/tests/claude-managed-adapter.test.ts +47 -0
- package/src/tests/claude-managed-setup.test.ts +48 -0
- package/src/tests/claude-prompt-body-once.test.ts +117 -0
- package/src/tests/claude-routes-e2e.test.ts +316 -0
- package/src/tests/comb-config-guard.test.ts +38 -0
- package/src/tests/comb-links.test.ts +162 -0
- package/src/tests/comb-markers.test.ts +68 -0
- package/src/tests/comb-review-batch.test.ts +770 -0
- package/src/tests/comb-status.test.ts +152 -0
- package/src/tests/context-versions-retention.test.ts +314 -0
- package/src/tests/core-auth.test.ts +7 -0
- package/src/tests/db-retention.test.ts +14 -14
- package/src/tests/db-task-read-contract.test.ts +3 -0
- package/src/tests/db-task-write-contract.test.ts +3 -0
- package/src/tests/docs-index-footprint.test.js +3 -3
- package/src/tests/dsh-adapter.test.ts +134 -2
- package/src/tests/dsh-usage.test.ts +153 -0
- package/src/tests/extensions-catalog.test.ts +1 -0
- package/src/tests/extensions-example-deploy-awareness.test.ts +301 -0
- package/src/tests/extensions-http.test.ts +137 -10
- package/src/tests/extensions-mcp-tools.test.ts +28 -0
- package/src/tests/favorites-agent-fs-path.test.ts +226 -0
- package/src/tests/fetch-resolved-env.test.ts +24 -0
- package/src/tests/fixtures/azure-devops/pull-request-commented.json +129 -0
- package/src/tests/fixtures/azure-devops/pull-request-created.json +88 -0
- package/src/tests/fixtures/fake-claude-routes.ts +229 -0
- package/src/tests/github-handlers-reactions.test.ts +486 -0
- package/src/tests/github-reactions.test.ts +280 -0
- package/src/tests/harness-cli-version.test.ts +62 -0
- package/src/tests/http-api-integration.test.ts +21 -0
- package/src/tests/http-task-write-ownership.test.ts +24 -1
- package/src/tests/internal-ai/complete-structured.test.ts +94 -0
- package/src/tests/internal-ai/credentials.test.ts +22 -0
- package/src/tests/internal-ai/models.test.ts +36 -2
- package/src/tests/internal-ai/schema-parity.test.ts +25 -1
- package/src/tests/internal-ai/summarize-session.test.ts +23 -7
- package/src/tests/mcp-user-route.test.ts +133 -0
- package/src/tests/memory-key-paths.test.ts +1055 -0
- package/src/tests/memory-link-resolver.test.ts +34 -0
- package/src/tests/memory-rate-endpoint.test.ts +66 -0
- package/src/tests/memory-rater-llm-summarizer.test.ts +2 -1
- package/src/tests/memory-rater-llm.test.ts +73 -0
- package/src/tests/memory-rater-store.test.ts +31 -0
- package/src/tests/memory-reranker.test.ts +40 -0
- package/src/tests/onboarding.test.ts +108 -0
- package/src/tests/opencode-adapter.test.ts +57 -0
- package/src/tests/opencode-plugin.test.ts +4 -0
- package/src/tests/pi-codemode.test.ts +82 -4
- package/src/tests/pi-mono-adapter.test.ts +265 -2
- package/src/tests/pr-body-leaks.test.ts +789 -0
- package/src/tests/preload.ts +14 -0
- package/src/tests/provider-registration.test.ts +0 -2
- package/src/tests/providers/pi-cost.test.ts +190 -4
- package/src/tests/rbac-engine.test.ts +25 -1
- package/src/tests/realtime-room-auth.test.ts +104 -1
- package/src/tests/realtime-tickets.test.ts +74 -0
- package/src/tests/realtime-transport.test.ts +131 -4
- package/src/tests/runner-api-drain.test.ts +301 -0
- package/src/tests/runner-fallback-output.test.ts +61 -0
- package/src/tests/runner-fenced-json-output.test.ts +178 -0
- package/src/tests/runner-slot-reconcile.test.ts +199 -0
- package/src/tests/script-connections.test.ts +6 -0
- package/src/tests/send-task-requested-by.test.ts +133 -15
- package/src/tests/session-costs-recompute-all-providers.test.ts +23 -0
- package/src/tests/task-lifecycle-telemetry.test.ts +8 -3
- package/src/tests/task-reactions.test.ts +29 -6
- package/src/tests/telemetry-context.test.ts +314 -0
- package/src/tests/telemetry-init.test.ts +51 -19
- package/src/tests/telemetry-snapshot.test.ts +229 -0
- package/src/tests/telemetry-trigger.test.ts +200 -0
- package/src/tests/template-registry-helpers.ts +1 -0
- package/src/tests/vcs-azure-devops.test.ts +73 -0
- package/src/tests/webhooks-task-blocked.test.ts +23 -0
- package/src/tests/workflow-agent-task-retry.test.ts +363 -0
- package/src/tests/workflow-definition-telemetry.test.ts +4 -4
- package/src/tests/workflow-llm.test.ts +14 -0
- package/src/tools/context-diff.ts +20 -0
- package/src/tools/extension-install.ts +27 -16
- package/src/tools/memory-edit.ts +47 -3
- package/src/tools/memory-search.ts +13 -1
- package/src/tools/memory-store.ts +55 -3
- package/src/tools/poll-task.ts +20 -1
- package/src/tools/send-task.ts +9 -1
- package/src/tools/task-action.ts +11 -0
- package/src/types.ts +45 -8
- package/src/utils/api-drain.ts +24 -0
- package/src/utils/constants.ts +57 -16
- package/src/utils/credentials.test.ts +31 -1
- package/src/utils/credentials.ts +20 -9
- package/src/utils/dsh-usage.ts +53 -0
- package/src/utils/harness-cli-version.ts +6 -4
- package/src/utils/internal-ai/complete-structured.ts +26 -3
- package/src/utils/internal-ai/credentials.ts +23 -9
- package/src/utils/internal-ai/index.ts +8 -1
- package/src/utils/internal-ai/models.ts +34 -8
- package/src/utils/internal-ai/summarize-session.ts +22 -8
- package/src/utils/pr-body-leaks.ts +172 -0
- package/src/utils/secret-scrubber.ts +8 -0
- package/src/utils/task-attachment-links.ts +14 -8
- package/src/vcs/azure-devops.ts +80 -0
- package/src/vcs/index.ts +5 -1
- package/src/vcs/types.ts +2 -2
- package/src/workflows/recovery.ts +26 -1
- package/src/workflows/resume.ts +31 -4
- package/src/workflows/task-step-routing.ts +75 -2
- package/templates/community/open-prompt-showreel/PLAYBOOK.md +336 -0
- package/templates/community/open-prompt-showreel/README.md +33 -0
- package/templates/community/open-prompt-showreel/example/tla-races/facts.ts +145 -0
- package/templates/community/open-prompt-showreel/example/tla-races/facts.v3.json +140 -0
- package/templates/community/open-prompt-showreel/example/tla-races/music.mist-city.json +8 -0
- package/templates/community/open-prompt-showreel/example/tla-races/reel.html +805 -0
- package/templates/community/open-prompt-showreel/example/tla-races/smoke.sh +48 -0
- package/templates/community/open-prompt-showreel/lead-prompt.md +89 -0
- package/templates/community/open-prompt-showreel/setup.sh +167 -0
- package/templates/community/open-prompt-showreel/skills/motion-design-replication/SKILL.md +85 -0
- package/templates/community/open-prompt-showreel/skills/motion-design-video-analysis/SKILL.md +115 -0
- package/templates/community/open-prompt-showreel/skills/open-prompt-showreel/SKILL.md +147 -0
- package/templates/community/open-prompt-showreel/skills/video-generation/SKILL.md +195 -0
- package/templates/community/open-prompt-showreel/tools/fetch-music.sh +65 -0
- package/templates/community/open-prompt-showreel/tools/music-analyze.py +69 -0
- package/templates/community/open-prompt-showreel/tools/music-current.sh +34 -0
- package/templates/community/open-prompt-showreel/tools/music-cut.sh +36 -0
- package/templates/community/open-prompt-showreel/tools/music-refine.py +39 -0
- package/templates/community/open-prompt-showreel/tools/render.mjs +157 -0
- package/templates/community/open-prompt-showreel/tools/sheet.sh +44 -0
- package/templates/community/open-prompt-showreel/tools/web-compress.sh +17 -0
- package/templates/community/open-prompt-showreel/tools/x-reencode.sh +21 -0
- package/templates/extensions/README.md +1 -0
- package/templates/extensions/deploy-awareness/README.md +28 -0
- package/templates/extensions/deploy-awareness/hooks.ts +152 -0
- package/templates/extensions/deploy-awareness/manifest.json +8 -0
- package/templates/skills/memory/config.json +2 -2
- package/templates/skills/memory/content.md +59 -5
- package/templates/skills/swarm-extensions/config.json +1 -1
- package/templates/skills/swarm-extensions/content.md +28 -5
- package/tsconfig.json +3 -0
- package/dist/boot-seeds-gsetbs5y.js +0 -28
- package/dist/cli-j490egb5.js +0 -5632
- package/dist/cli-tjf4cn8z.js +0 -9119
- package/dist/cli-tmqt7dpj.js +0 -572
- package/dist/dsh-adapter-mpnzgztj.js +0 -19
- package/dist/index-7aj368tw.js +0 -30
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A provider session whose promise never settles must not hold a worker
|
|
3
|
+
* execution slot forever (GitHub issue #1819). These tests drive the runner's
|
|
4
|
+
* real `reconcileActiveTasks` + `checkCompletedProcesses` against a session
|
|
5
|
+
* that never settles, on a fake clock, and check the slot frees within the
|
|
6
|
+
* reconcile interval plus the abort grace.
|
|
7
|
+
*/
|
|
8
|
+
import { afterAll, beforeAll, beforeEach, describe, expect, test } from "bun:test";
|
|
9
|
+
import { createServer as createHttpServer, type Server } from "node:http";
|
|
10
|
+
import {
|
|
11
|
+
ABORT_SETTLE_GRACE_MS,
|
|
12
|
+
type ApiConfig,
|
|
13
|
+
checkCompletedProcesses,
|
|
14
|
+
DEFAULT_TASK_RECONCILE_INTERVAL_MS,
|
|
15
|
+
type RunnerState,
|
|
16
|
+
type RunningTask,
|
|
17
|
+
reconcileActiveTasks,
|
|
18
|
+
resolveTaskReconcileIntervalMs,
|
|
19
|
+
} from "../commands/runner";
|
|
20
|
+
import type { ProviderResult, ProviderSession } from "../providers/types";
|
|
21
|
+
import { listenOnFreePort } from "./test-net";
|
|
22
|
+
|
|
23
|
+
const INTERVAL_MS = 30_000;
|
|
24
|
+
const TICK_MS = 1_000;
|
|
25
|
+
|
|
26
|
+
let api: Server;
|
|
27
|
+
let apiUrl = "";
|
|
28
|
+
/** Worker → API calls, as `METHOD /path`. */
|
|
29
|
+
const requests: string[] = [];
|
|
30
|
+
|
|
31
|
+
beforeAll(async () => {
|
|
32
|
+
api = createHttpServer((req, res) => {
|
|
33
|
+
requests.push(`${req.method} ${new URL(req.url || "/", "http://localhost").pathname}`);
|
|
34
|
+
res.writeHead(200, { "Content-Type": "application/json" });
|
|
35
|
+
res.end("{}");
|
|
36
|
+
});
|
|
37
|
+
apiUrl = `http://127.0.0.1:${await listenOnFreePort(api)}`;
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
afterAll(async () => {
|
|
41
|
+
await new Promise<void>((resolve) => api.close(() => resolve()));
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
beforeEach(() => {
|
|
45
|
+
requests.length = 0;
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
/** A session like the one in #1819: abort() returns, the promise never settles. */
|
|
49
|
+
function hungSession(): ProviderSession & { abortReasons: string[] } {
|
|
50
|
+
const abortReasons: string[] = [];
|
|
51
|
+
return {
|
|
52
|
+
sessionId: "sess-hung",
|
|
53
|
+
abortReasons,
|
|
54
|
+
onEvent: () => {},
|
|
55
|
+
waitForCompletion: () => new Promise<ProviderResult>(() => {}),
|
|
56
|
+
abort: async (reason?: string) => {
|
|
57
|
+
abortReasons.push(reason ?? "");
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function setup(startedAt: number) {
|
|
63
|
+
const session = hungSession();
|
|
64
|
+
const taskId = crypto.randomUUID();
|
|
65
|
+
const task = {
|
|
66
|
+
taskId,
|
|
67
|
+
session,
|
|
68
|
+
logFile: "/tmp/runner-slot-reconcile.log",
|
|
69
|
+
startTime: new Date(startedAt),
|
|
70
|
+
promise: session.waitForCompletion(),
|
|
71
|
+
result: null,
|
|
72
|
+
harnessProvider: "opencode",
|
|
73
|
+
hasLocalEnvironment: false,
|
|
74
|
+
} as RunningTask;
|
|
75
|
+
const state = {
|
|
76
|
+
activeTasks: new Map<string, RunningTask>([[taskId, task]]),
|
|
77
|
+
maxConcurrent: 1,
|
|
78
|
+
startedAt,
|
|
79
|
+
tasksProcessed: 0,
|
|
80
|
+
harnessProvider: "opencode",
|
|
81
|
+
codexCreditsExhaustedCooldownMs: 7_200_000,
|
|
82
|
+
modelWindowBlocks: new Map(),
|
|
83
|
+
} as RunnerState;
|
|
84
|
+
return { session, taskId, task, state };
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Run main-loop iterations (complete → reconcile) on a fake clock until the
|
|
89
|
+
* slot frees or `maxMs` elapses. Returns the elapsed fake time.
|
|
90
|
+
*/
|
|
91
|
+
async function runUntilFree(
|
|
92
|
+
state: RunnerState,
|
|
93
|
+
startedAt: number,
|
|
94
|
+
opts: {
|
|
95
|
+
serverStatus: () => string | null;
|
|
96
|
+
cancelled?: () => boolean;
|
|
97
|
+
apiConfig?: ApiConfig;
|
|
98
|
+
maxMs: number;
|
|
99
|
+
},
|
|
100
|
+
): Promise<{ elapsedMs: number; statusReads: number }> {
|
|
101
|
+
let clock = startedAt;
|
|
102
|
+
let statusReads = 0;
|
|
103
|
+
const cancelledSignaled = new Set<string>();
|
|
104
|
+
while (clock - startedAt <= opts.maxMs) {
|
|
105
|
+
await checkCompletedProcesses(state, "worker", opts.apiConfig, cancelledSignaled);
|
|
106
|
+
if (state.activeTasks.size === 0) break;
|
|
107
|
+
await reconcileActiveTasks(state, "worker", {
|
|
108
|
+
cancelledSignaled,
|
|
109
|
+
isCancelled: async () => opts.cancelled?.() ?? false,
|
|
110
|
+
fetchStatus: async () => {
|
|
111
|
+
statusReads += 1;
|
|
112
|
+
return opts.serverStatus();
|
|
113
|
+
},
|
|
114
|
+
intervalMs: INTERVAL_MS,
|
|
115
|
+
now: () => clock,
|
|
116
|
+
});
|
|
117
|
+
clock += TICK_MS;
|
|
118
|
+
}
|
|
119
|
+
return { elapsedMs: clock - startedAt, statusReads };
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
describe("reconcileActiveTasks: a session that never settles", () => {
|
|
123
|
+
test("server-terminal task: slot frees within interval + grace and the server result is kept", async () => {
|
|
124
|
+
const startedAt = 1_000_000;
|
|
125
|
+
const { session, task, state } = setup(startedAt);
|
|
126
|
+
const apiConfig: ApiConfig = { apiUrl, apiKey: "test-key", agentId: crypto.randomUUID() };
|
|
127
|
+
|
|
128
|
+
const { elapsedMs, statusReads } = await runUntilFree(state, startedAt, {
|
|
129
|
+
serverStatus: () => "failed",
|
|
130
|
+
apiConfig,
|
|
131
|
+
maxMs: 5 * 60_000,
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
expect(state.activeTasks.size).toBe(0);
|
|
135
|
+
expect(elapsedMs).toBeLessThanOrEqual(INTERVAL_MS + ABORT_SETTLE_GRACE_MS + 2 * TICK_MS);
|
|
136
|
+
expect(statusReads).toBe(1);
|
|
137
|
+
expect(session.abortReasons).toEqual(["server task failed"]);
|
|
138
|
+
expect(task.serverTerminalStatus).toBe("failed");
|
|
139
|
+
expect(task.result?.failureReason).toContain("runner exited without result");
|
|
140
|
+
expect(state.tasksProcessed).toBe(1);
|
|
141
|
+
// The server already finished the task: no finish write, no outcome reports.
|
|
142
|
+
expect(requests.some((r) => r.endsWith("/finish"))).toBe(false);
|
|
143
|
+
expect(requests.some((r) => r.startsWith("POST /api/keys/"))).toBe(false);
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
test("cancelled task: the abort is followed by a forced settle once the grace passes", async () => {
|
|
147
|
+
const startedAt = 2_000_000;
|
|
148
|
+
const { session, state } = setup(startedAt);
|
|
149
|
+
|
|
150
|
+
const { elapsedMs } = await runUntilFree(state, startedAt, {
|
|
151
|
+
serverStatus: () => "cancelled",
|
|
152
|
+
cancelled: () => true,
|
|
153
|
+
maxMs: 5 * 60_000,
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
expect(state.activeTasks.size).toBe(0);
|
|
157
|
+
expect(elapsedMs).toBeLessThanOrEqual(ABORT_SETTLE_GRACE_MS + 2 * TICK_MS);
|
|
158
|
+
expect(session.abortReasons).toEqual(["cancelled"]);
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
test("a task still in progress server-side keeps its slot, and status reads are throttled", async () => {
|
|
162
|
+
const startedAt = 3_000_000;
|
|
163
|
+
const { session, state } = setup(startedAt);
|
|
164
|
+
|
|
165
|
+
const { statusReads } = await runUntilFree(state, startedAt, {
|
|
166
|
+
serverStatus: () => "in_progress",
|
|
167
|
+
maxMs: 3 * INTERVAL_MS,
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
expect(state.activeTasks.size).toBe(1);
|
|
171
|
+
expect(session.abortReasons).toEqual([]);
|
|
172
|
+
expect(statusReads).toBe(3);
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
test("an unreadable server status leaves the task alone", async () => {
|
|
176
|
+
const startedAt = 4_000_000;
|
|
177
|
+
const { session, state } = setup(startedAt);
|
|
178
|
+
|
|
179
|
+
await runUntilFree(state, startedAt, { serverStatus: () => null, maxMs: 2 * INTERVAL_MS });
|
|
180
|
+
|
|
181
|
+
expect(state.activeTasks.size).toBe(1);
|
|
182
|
+
expect(session.abortReasons).toEqual([]);
|
|
183
|
+
});
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
describe("resolveTaskReconcileIntervalMs", () => {
|
|
187
|
+
test("reads RUNNER_TASK_RECONCILE_INTERVAL_MS and falls back on unset or invalid values", () => {
|
|
188
|
+
expect(resolveTaskReconcileIntervalMs({ RUNNER_TASK_RECONCILE_INTERVAL_MS: "5000" })).toBe(
|
|
189
|
+
5000,
|
|
190
|
+
);
|
|
191
|
+
expect(resolveTaskReconcileIntervalMs({})).toBe(DEFAULT_TASK_RECONCILE_INTERVAL_MS);
|
|
192
|
+
expect(resolveTaskReconcileIntervalMs({ RUNNER_TASK_RECONCILE_INTERVAL_MS: "0" })).toBe(
|
|
193
|
+
DEFAULT_TASK_RECONCILE_INTERVAL_MS,
|
|
194
|
+
);
|
|
195
|
+
expect(resolveTaskReconcileIntervalMs({ RUNNER_TASK_RECONCILE_INTERVAL_MS: "soon" })).toBe(
|
|
196
|
+
DEFAULT_TASK_RECONCILE_INTERVAL_MS,
|
|
197
|
+
);
|
|
198
|
+
});
|
|
199
|
+
});
|
|
@@ -594,6 +594,12 @@ describe("script connections", () => {
|
|
|
594
594
|
markMigrationApplied(database, "186_api_key_seat_mismatch.sql");
|
|
595
595
|
// 185 alters api_key_status, which this migration-112-only fixture does not create.
|
|
596
596
|
markMigrationApplied(database, "185_api_key_auth_failures.sql");
|
|
597
|
+
// 190 alters memory_rating, which this migration-112-only fixture does not create.
|
|
598
|
+
markMigrationApplied(database, "190_memory_rating_model.sql");
|
|
599
|
+
// 191 indexes context_versions, which this migration-112-only fixture does not create.
|
|
600
|
+
markMigrationApplied(database, "191_context_versions_previous_index.sql");
|
|
601
|
+
// 192 rebuilds user_favorites, which this migration-112-only fixture does not create.
|
|
602
|
+
markMigrationApplied(database, "192_favorites_agent_fs_path.sql");
|
|
597
603
|
|
|
598
604
|
const id = crypto.randomUUID();
|
|
599
605
|
const now = new Date().toISOString();
|
|
@@ -166,28 +166,146 @@ describe("send-task: requestedByUserId inheritance", () => {
|
|
|
166
166
|
expect(await requesterWasInherited(s.task!.id)).toBe(1);
|
|
167
167
|
});
|
|
168
168
|
|
|
169
|
-
test("
|
|
170
|
-
const
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
169
|
+
test("Linear tracker holder delegates two children in a row", async () => {
|
|
170
|
+
for (const variant of ["implicit", "explicit-key", "explicit-parent"]) {
|
|
171
|
+
const parentTask = await createTaskExtended("linear source task", {
|
|
172
|
+
requestedByUserId: userAId,
|
|
173
|
+
contextKey: linearContextKey({ issueIdentifier: `DES-203-${variant}` }),
|
|
174
|
+
});
|
|
175
|
+
const args =
|
|
176
|
+
variant === "explicit-key"
|
|
177
|
+
? { key: "shared/linear-child/" }
|
|
178
|
+
: variant === "explicit-parent"
|
|
179
|
+
? { parentTaskId: parentTask.id }
|
|
180
|
+
: {};
|
|
181
|
+
const result = await callSendTask(
|
|
182
|
+
server,
|
|
183
|
+
{ task: "delegated linear child", allowDuplicate: true, ...args },
|
|
184
|
+
LEAD_ID,
|
|
185
|
+
parentTask.id,
|
|
186
|
+
);
|
|
187
|
+
const s = structuredOf(result);
|
|
188
|
+
expect(s.success).toBe(true);
|
|
189
|
+
expect(s.task?.id).not.toBe(parentTask.id);
|
|
190
|
+
const created = await getTaskById(s.task!.id);
|
|
191
|
+
expect(created?.parentTaskId).toBe(parentTask.id);
|
|
192
|
+
const second = structuredOf(
|
|
193
|
+
await callSendTask(
|
|
194
|
+
server,
|
|
195
|
+
{ task: "second linear child", allowDuplicate: true, ...args },
|
|
196
|
+
LEAD_ID,
|
|
197
|
+
parentTask.id,
|
|
198
|
+
),
|
|
199
|
+
);
|
|
200
|
+
expect(second.success).toBe(true);
|
|
201
|
+
expect(second.task?.id).not.toBe(s.task?.id);
|
|
202
|
+
expect((await getTaskById(second.task!.id))?.parentTaskId).toBe(parentTask.id);
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
test("Linear tracker child delegates a grandchild while the holder is active", async () => {
|
|
207
|
+
const holder = await createTaskExtended("active holder", {
|
|
208
|
+
contextKey: linearContextKey({ issueIdentifier: "DES-206" }),
|
|
209
|
+
});
|
|
210
|
+
const child = structuredOf(
|
|
211
|
+
await callSendTask(server, { task: "child", allowDuplicate: true }, LEAD_ID, holder.id),
|
|
212
|
+
);
|
|
213
|
+
expect(child.success).toBe(true);
|
|
214
|
+
const grandchild = structuredOf(
|
|
215
|
+
await callSendTask(
|
|
216
|
+
server,
|
|
217
|
+
{ task: "grandchild", allowDuplicate: true },
|
|
218
|
+
LEAD_ID,
|
|
219
|
+
child.task!.id,
|
|
220
|
+
),
|
|
221
|
+
);
|
|
222
|
+
expect(grandchild.success).toBe(true);
|
|
223
|
+
expect((await getTaskById(grandchild.task!.id))?.parentTaskId).toBe(child.task!.id);
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
test("Linear tracker holder delegates after its completed child links an open PR", async () => {
|
|
227
|
+
const holder = await createTaskExtended("holder awaiting review", {
|
|
228
|
+
contextKey: linearContextKey({ issueIdentifier: "DES-207" }),
|
|
174
229
|
});
|
|
230
|
+
const child = structuredOf(
|
|
231
|
+
await callSendTask(
|
|
232
|
+
server,
|
|
233
|
+
{ task: "implementation", allowDuplicate: true },
|
|
234
|
+
LEAD_ID,
|
|
235
|
+
holder.id,
|
|
236
|
+
),
|
|
237
|
+
);
|
|
238
|
+
expect(child.success).toBe(true);
|
|
239
|
+
await getDbClient().run(
|
|
240
|
+
"UPDATE agent_tasks SET status = 'completed', vcsProvider = 'github', vcsRepo = 'desplega-ai/agent-swarm', vcsNumber = 875, vcsUrl = 'https://github.com/desplega-ai/agent-swarm/pull/875' WHERE id = ?",
|
|
241
|
+
[child.task!.id],
|
|
242
|
+
);
|
|
243
|
+
const review = structuredOf(
|
|
244
|
+
await callSendTask(
|
|
245
|
+
server,
|
|
246
|
+
{ task: "review implementation", allowDuplicate: true },
|
|
247
|
+
LEAD_ID,
|
|
248
|
+
holder.id,
|
|
249
|
+
),
|
|
250
|
+
);
|
|
251
|
+
expect(review.success).toBe(true);
|
|
252
|
+
expect((await getTaskById(review.task!.id))?.parentTaskId).toBe(holder.id);
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
test("Linear tracker delegation skips a different active task on the same key", async () => {
|
|
256
|
+
const key = linearContextKey({ issueIdentifier: "DES-204" });
|
|
257
|
+
const other = await createTaskExtended("other active linear task", { contextKey: key });
|
|
258
|
+
const parent = await createTaskExtended("delegating linear holder");
|
|
259
|
+
// Fixture bypasses creation dedup to represent two existing holders.
|
|
260
|
+
await getDbClient().run("UPDATE agent_tasks SET contextKey = ? WHERE id = ?", [key, parent.id]);
|
|
261
|
+
const before = await getDbClient().get<{ count: number }>(
|
|
262
|
+
"SELECT COUNT(*) AS count FROM agent_tasks",
|
|
263
|
+
);
|
|
175
264
|
|
|
176
265
|
const result = await callSendTask(
|
|
177
266
|
server,
|
|
178
|
-
{ task: "
|
|
267
|
+
{ task: "blocked linear child", allowDuplicate: true },
|
|
179
268
|
LEAD_ID,
|
|
180
|
-
|
|
269
|
+
parent.id,
|
|
181
270
|
);
|
|
271
|
+
const s = structuredOf(result);
|
|
272
|
+
expect(s.success).toBe(false);
|
|
273
|
+
expect(s.message).toContain("already has active task");
|
|
274
|
+
expect(s.task?.id).toBe(other.id);
|
|
275
|
+
expect(await getDbClient().get("SELECT COUNT(*) AS count FROM agent_tasks")).toEqual(before);
|
|
276
|
+
});
|
|
182
277
|
|
|
278
|
+
test("Linear tracker completed task with an unrelated linked PR blocks delegation", async () => {
|
|
279
|
+
const key = linearContextKey({ issueIdentifier: "DES-205" });
|
|
280
|
+
const parent = await createTaskExtended("linear holder with linked PR", {
|
|
281
|
+
contextKey: key,
|
|
282
|
+
vcsProvider: "github",
|
|
283
|
+
vcsRepo: "desplega-ai/agent-swarm",
|
|
284
|
+
vcsNumber: 875,
|
|
285
|
+
vcsUrl: "https://github.com/desplega-ai/agent-swarm/pull/875",
|
|
286
|
+
});
|
|
287
|
+
await getDbClient().run("UPDATE agent_tasks SET status = 'completed' WHERE id = ?", [
|
|
288
|
+
parent.id,
|
|
289
|
+
]);
|
|
290
|
+
const unrelated = await createTaskExtended("unrelated caller");
|
|
291
|
+
await getDbClient().run("UPDATE agent_tasks SET contextKey = ? WHERE id = ?", [
|
|
292
|
+
key,
|
|
293
|
+
unrelated.id,
|
|
294
|
+
]);
|
|
295
|
+
const before = await getDbClient().get<{ count: number }>(
|
|
296
|
+
"SELECT COUNT(*) AS count FROM agent_tasks",
|
|
297
|
+
);
|
|
298
|
+
|
|
299
|
+
const result = await callSendTask(
|
|
300
|
+
server,
|
|
301
|
+
{ task: "blocked child after PR", allowDuplicate: true },
|
|
302
|
+
LEAD_ID,
|
|
303
|
+
unrelated.id,
|
|
304
|
+
);
|
|
183
305
|
const s = structuredOf(result);
|
|
184
|
-
expect(s.success).toBe(
|
|
185
|
-
expect(s.message).toContain("
|
|
186
|
-
expect(s.task?.id).toBe(
|
|
187
|
-
|
|
188
|
-
"SELECT COUNT(*) AS count FROM agent_tasks WHERE contextKey = ?",
|
|
189
|
-
[key],
|
|
190
|
-
)) as { count: number };
|
|
191
|
-
expect(count.count).toBe(1);
|
|
306
|
+
expect(s.success).toBe(false);
|
|
307
|
+
expect(s.message).toContain("already has linked open PR");
|
|
308
|
+
expect(s.task?.id).toBe(parent.id);
|
|
309
|
+
expect(await getDbClient().get("SELECT COUNT(*) AS count FROM agent_tasks")).toEqual(before);
|
|
192
310
|
});
|
|
193
311
|
});
|
|
@@ -218,6 +218,29 @@ describe("Phase 2 — POST /api/session-costs recompute fires for every provider
|
|
|
218
218
|
expect(body.cost.costSource).toBe("unpriced");
|
|
219
219
|
expect(body.cost.totalCostUsd).toBe(1.23);
|
|
220
220
|
});
|
|
221
|
+
|
|
222
|
+
test("a harness that prices nothing posts 0 and stores no harness cost", async () => {
|
|
223
|
+
await seedTwoClassRates("dsh", "dsh-zero-model", 2, 10);
|
|
224
|
+
const res = await authedFetch(`/api/session-costs`, {
|
|
225
|
+
method: "POST",
|
|
226
|
+
body: JSON.stringify({
|
|
227
|
+
sessionId: "dsh-zero-1",
|
|
228
|
+
agentId: testAgent.id,
|
|
229
|
+
totalCostUsd: 0,
|
|
230
|
+
inputTokens: 1_000_000,
|
|
231
|
+
outputTokens: 0,
|
|
232
|
+
model: "dsh-zero-model",
|
|
233
|
+
provider: "dsh",
|
|
234
|
+
numTurns: 1,
|
|
235
|
+
}),
|
|
236
|
+
});
|
|
237
|
+
expect(res.status).toBe(201);
|
|
238
|
+
const body = (await res.json()) as CostResponse;
|
|
239
|
+
expect(body.cost.costSource).toBe("pricing-table");
|
|
240
|
+
expect(body.cost.totalCostUsd).toBeCloseTo(2, 5);
|
|
241
|
+
// A stored 0 read as a 100% drift against the recomputed $2.
|
|
242
|
+
expect(body.cost.harnessCostUsd).toBeNull();
|
|
243
|
+
});
|
|
221
244
|
});
|
|
222
245
|
|
|
223
246
|
describe("Migration 128 — modelBreakdown persistence", () => {
|
|
@@ -71,7 +71,8 @@ describe("task lifecycle telemetry", () => {
|
|
|
71
71
|
event: "created",
|
|
72
72
|
props: {
|
|
73
73
|
taskId: task.id,
|
|
74
|
-
|
|
74
|
+
task_source: "mcp",
|
|
75
|
+
trigger_surface: "mcp",
|
|
75
76
|
hasParent: false,
|
|
76
77
|
has_repo: false,
|
|
77
78
|
priority: 60,
|
|
@@ -146,7 +147,8 @@ describe("task lifecycle telemetry", () => {
|
|
|
146
147
|
event: "cancelled",
|
|
147
148
|
props: {
|
|
148
149
|
taskId: cancelledTask.id,
|
|
149
|
-
|
|
150
|
+
task_source: "api",
|
|
151
|
+
trigger_surface: "api",
|
|
150
152
|
agentId: WORKER_ID,
|
|
151
153
|
previousStatus: "pending",
|
|
152
154
|
},
|
|
@@ -180,7 +182,8 @@ describe("task lifecycle telemetry", () => {
|
|
|
180
182
|
event: "completed",
|
|
181
183
|
props: {
|
|
182
184
|
taskId: task.id,
|
|
183
|
-
|
|
185
|
+
task_source: "mcp",
|
|
186
|
+
trigger_surface: "mcp",
|
|
184
187
|
agentId: WORKER_ID,
|
|
185
188
|
provider: "codex",
|
|
186
189
|
harnessVariant: "stock",
|
|
@@ -188,5 +191,7 @@ describe("task lifecycle telemetry", () => {
|
|
|
188
191
|
},
|
|
189
192
|
});
|
|
190
193
|
expect(calls[0]?.props.tags).toBeUndefined();
|
|
194
|
+
// The raw per-task source is `task_source`; no event carries a `source` property.
|
|
195
|
+
expect("source" in (calls[0]?.props ?? {})).toBe(false);
|
|
191
196
|
});
|
|
192
197
|
});
|
|
@@ -69,12 +69,21 @@ describe("addEyesReactionOnTaskStart", () => {
|
|
|
69
69
|
expect(mockAddIssueReaction).not.toHaveBeenCalled();
|
|
70
70
|
});
|
|
71
71
|
|
|
72
|
-
test("
|
|
73
|
-
|
|
72
|
+
test("still reacts when vcsInstallationId is missing (GITHUB_TOKEN deployments)", async () => {
|
|
73
|
+
// Plain webhook + PAT deployments never record an installation id. The reaction
|
|
74
|
+
// helpers choose the credential, so the task source must not be skipped here.
|
|
75
|
+
await addEyesReactionOnTaskStart(
|
|
76
|
+
makeTask({ vcsInstallationId: undefined, vcsEventType: "issue_comment", vcsCommentId: 42 }),
|
|
77
|
+
);
|
|
78
|
+
expect(mockAddReaction).toHaveBeenCalledTimes(1);
|
|
79
|
+
expect(mockAddReaction).toHaveBeenCalledWith("desplega-ai/agent-swarm", 42, "eyes", undefined);
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
test("skips when vcsRepo is missing", async () => {
|
|
83
|
+
await addEyesReactionOnTaskStart(
|
|
84
|
+
makeTask({ vcsRepo: undefined, vcsEventType: "issue_comment", vcsCommentId: 42 }),
|
|
85
|
+
);
|
|
74
86
|
expect(mockAddReaction).not.toHaveBeenCalled();
|
|
75
|
-
expect(mockAddPullReviewCommentReaction).not.toHaveBeenCalled();
|
|
76
|
-
expect(mockAddGraphQLReaction).not.toHaveBeenCalled();
|
|
77
|
-
expect(mockAddIssueReaction).not.toHaveBeenCalled();
|
|
78
87
|
});
|
|
79
88
|
|
|
80
89
|
// ── issue_comment ──
|
|
@@ -124,11 +133,25 @@ describe("addEyesReactionOnTaskStart", () => {
|
|
|
124
133
|
expect(mockAddGraphQLReaction).toHaveBeenCalledWith("PRR_abc123", "EYES", 12345);
|
|
125
134
|
});
|
|
126
135
|
|
|
127
|
-
test("pull_request_review without vcsNodeId is a no-op", async () => {
|
|
136
|
+
test("pull_request_review without vcsNodeId or vcsNumber is a no-op", async () => {
|
|
128
137
|
await addEyesReactionOnTaskStart(
|
|
129
138
|
makeTask({ vcsEventType: "pull_request_review", vcsNodeId: undefined }),
|
|
130
139
|
);
|
|
131
140
|
expect(mockAddGraphQLReaction).not.toHaveBeenCalled();
|
|
141
|
+
expect(mockAddIssueReaction).not.toHaveBeenCalled();
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
test("pull_request_review without vcsNodeId falls back to reacting on the PR", async () => {
|
|
145
|
+
await addEyesReactionOnTaskStart(
|
|
146
|
+
makeTask({ vcsEventType: "pull_request_review", vcsNodeId: undefined, vcsNumber: 310 }),
|
|
147
|
+
);
|
|
148
|
+
expect(mockAddGraphQLReaction).not.toHaveBeenCalled();
|
|
149
|
+
expect(mockAddIssueReaction).toHaveBeenCalledWith(
|
|
150
|
+
"desplega-ai/agent-swarm",
|
|
151
|
+
310,
|
|
152
|
+
"eyes",
|
|
153
|
+
12345,
|
|
154
|
+
);
|
|
132
155
|
});
|
|
133
156
|
|
|
134
157
|
// ── pull_request ──
|