@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
|
@@ -44,8 +44,19 @@ export type RatingEvent = {
|
|
|
44
44
|
* write-site only: non-empty, ≤512 chars, control-char strip, no NUL.
|
|
45
45
|
*/
|
|
46
46
|
referencesSource?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Model that produced this judgement (`provider/model-id`, e.g.
|
|
49
|
+
* `openrouter/deepseek/deepseek-v4.1-flash`). Persisted to
|
|
50
|
+
* `memory_rating.model` for `llm` ratings only so score distributions can be
|
|
51
|
+
* compared across judge changes; `applyRating` ignores it for every other
|
|
52
|
+
* source.
|
|
53
|
+
*/
|
|
54
|
+
model?: string;
|
|
47
55
|
};
|
|
48
56
|
|
|
57
|
+
/** Max length of `RatingEvent.model` accepted at the HTTP boundary. */
|
|
58
|
+
export const RATING_MODEL_MAX_LENGTH = 200;
|
|
59
|
+
|
|
49
60
|
/**
|
|
50
61
|
* Maximum byte length for `referencesSource` strings (Q2 contract). Encoded
|
|
51
62
|
* here once so the HTTP Zod schema, the MCP tool input schema, the LlmRater
|
|
@@ -2,9 +2,13 @@ import type { AgentMemorySource } from "@/types";
|
|
|
2
2
|
import {
|
|
3
3
|
ACCESS_BOOST_RECENCY_WINDOW_HOURS,
|
|
4
4
|
accessBoostMaxMultiplier,
|
|
5
|
+
DECISIONS_ROOT,
|
|
6
|
+
PATH_WEIGHT,
|
|
5
7
|
recencyDecayHalfLifeDays,
|
|
6
8
|
SOURCE_QUALITY_MULTIPLIER,
|
|
9
|
+
SUPERSEDED_DECISION_WEIGHT,
|
|
7
10
|
} from "./constants";
|
|
11
|
+
import { isKeyUnderRoot, tierSource } from "./key-paths";
|
|
8
12
|
import type { MemoryCandidate, RerankOptions } from "./types";
|
|
9
13
|
|
|
10
14
|
const MS_PER_DAY = 1000 * 60 * 60 * 24;
|
|
@@ -14,9 +18,15 @@ const MS_PER_HOUR = 1000 * 60 * 60;
|
|
|
14
18
|
* Exponential decay based on age and memory source.
|
|
15
19
|
* Source-aware: manual memories have no decay (Infinity half-life),
|
|
16
20
|
* file_index = 180d, task_completion = 14d, session_summary = 7d.
|
|
21
|
+
* A memory under /longterm decays like a manual one, whatever its source.
|
|
17
22
|
*/
|
|
18
|
-
export function recencyDecay(
|
|
19
|
-
|
|
23
|
+
export function recencyDecay(
|
|
24
|
+
createdAt: string,
|
|
25
|
+
now: Date,
|
|
26
|
+
source?: AgentMemorySource,
|
|
27
|
+
key?: string | null,
|
|
28
|
+
): number {
|
|
29
|
+
const halfLife = recencyDecayHalfLifeDays(source && tierSource(source, key));
|
|
20
30
|
if (!Number.isFinite(halfLife)) return 1.0;
|
|
21
31
|
const ageDays = (now.getTime() - new Date(createdAt).getTime()) / MS_PER_DAY;
|
|
22
32
|
if (ageDays <= 0) return 1.0;
|
|
@@ -39,9 +49,29 @@ export function accessBoost(accessedAt: string, accessCount: number, now: Date):
|
|
|
39
49
|
/**
|
|
40
50
|
* Source-quality multiplier. Manual memories get a 1.5× boost,
|
|
41
51
|
* session summaries get 0.5×. Unknown sources default to 1.0.
|
|
52
|
+
* A memory under /longterm is weighed as manual, whatever its source.
|
|
42
53
|
*/
|
|
43
|
-
export function sourceQuality(source: AgentMemorySource): number {
|
|
44
|
-
return SOURCE_QUALITY_MULTIPLIER[source] ?? 1.0;
|
|
54
|
+
export function sourceQuality(source: AgentMemorySource, key?: string | null): number {
|
|
55
|
+
return SOURCE_QUALITY_MULTIPLIER[tierSource(source, key)] ?? 1.0;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Path-weight multiplier from the logical path in `key`, by longest matching
|
|
60
|
+
* root. A key under no weighted root (legacy auto keys, file paths, null)
|
|
61
|
+
* weighs 1.0, so existing memories score as before. A `/longterm/decisions` doc tagged
|
|
62
|
+
* `superseded` weighs SUPERSEDED_DECISION_WEIGHT instead of the root's weight.
|
|
63
|
+
*/
|
|
64
|
+
export function pathWeight(key: string | null | undefined, tags: readonly string[] = []): number {
|
|
65
|
+
if (!key) return 1.0;
|
|
66
|
+
let root: string | undefined;
|
|
67
|
+
for (const candidate of Object.keys(PATH_WEIGHT)) {
|
|
68
|
+
if (isKeyUnderRoot(key, candidate) && (!root || candidate.length > root.length)) {
|
|
69
|
+
root = candidate;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if (!root) return 1.0;
|
|
73
|
+
if (root === DECISIONS_ROOT && tags.includes("superseded")) return SUPERSEDED_DECISION_WEIGHT;
|
|
74
|
+
return PATH_WEIGHT[root] ?? 1.0;
|
|
45
75
|
}
|
|
46
76
|
|
|
47
77
|
/**
|
|
@@ -70,17 +100,18 @@ export function usefulness(alpha: number, beta: number): number {
|
|
|
70
100
|
|
|
71
101
|
/**
|
|
72
102
|
* Final score combining similarity, recency decay, access boost,
|
|
73
|
-
* source quality, and Beta-Binomial usefulness.
|
|
103
|
+
* source quality, path weight, and Beta-Binomial usefulness.
|
|
74
104
|
*/
|
|
75
105
|
export function computeScore(candidate: MemoryCandidate, now: Date): number {
|
|
76
106
|
const decay = candidate.recencyDecayApplied
|
|
77
107
|
? 1.0
|
|
78
|
-
: recencyDecay(candidate.createdAt, now, candidate.source);
|
|
108
|
+
: recencyDecay(candidate.createdAt, now, candidate.source, candidate.key);
|
|
79
109
|
return (
|
|
80
110
|
candidate.similarity *
|
|
81
111
|
decay *
|
|
82
112
|
accessBoost(candidate.accessedAt, candidate.accessCount, now) *
|
|
83
|
-
sourceQuality(candidate.source) *
|
|
113
|
+
sourceQuality(candidate.source, candidate.key) *
|
|
114
|
+
pathWeight(candidate.key, candidate.tags) *
|
|
84
115
|
usefulness(candidate.alpha, candidate.beta)
|
|
85
116
|
);
|
|
86
117
|
}
|
package/src/be/memory/types.ts
CHANGED
|
@@ -30,7 +30,8 @@ export interface MemoryStore {
|
|
|
30
30
|
edit(input: MemoryEditInput): Promise<MemoryEditResult>;
|
|
31
31
|
list(agentId: string, options: MemoryListOptions): Promise<AgentMemory[]>;
|
|
32
32
|
count(agentId: string, options: MemoryListOptions): Promise<number>;
|
|
33
|
-
|
|
33
|
+
/** True when automated cleanup must skip the memory: a protected source, or any /longterm key. */
|
|
34
|
+
isSourceProtected(source: AgentMemorySource, key?: string | null): boolean;
|
|
34
35
|
listForCuration(
|
|
35
36
|
agentId?: string,
|
|
36
37
|
): Promise<{ id: string; source: string; name: string; createdAt: string }[]>;
|
|
@@ -93,6 +94,8 @@ export interface MemorySearchOptions {
|
|
|
93
94
|
isLead?: boolean;
|
|
94
95
|
includeExpired?: boolean;
|
|
95
96
|
queryText?: string;
|
|
97
|
+
/** Keep only memories whose `key` starts with this string. Applied inside each SQL arm, before top-K. */
|
|
98
|
+
keyPrefix?: string;
|
|
96
99
|
}
|
|
97
100
|
|
|
98
101
|
/**
|
|
@@ -121,6 +124,12 @@ export interface MemoryEditInput {
|
|
|
121
124
|
intent: string;
|
|
122
125
|
expectedVersion?: number;
|
|
123
126
|
changedByAgentId?: string | null;
|
|
127
|
+
/**
|
|
128
|
+
* Move the document to this key, on every chunk, in the same transaction.
|
|
129
|
+
* Without content fields it is a pure move. Id, posteriors, access counters
|
|
130
|
+
* and author are untouched.
|
|
131
|
+
*/
|
|
132
|
+
newKey?: string;
|
|
124
133
|
}
|
|
125
134
|
|
|
126
135
|
export interface MemoryEditResult {
|
|
@@ -139,6 +148,8 @@ export interface MemoryListOptions {
|
|
|
139
148
|
ownerAgentId?: string;
|
|
140
149
|
source?: AgentMemorySource;
|
|
141
150
|
sourcePath?: string;
|
|
151
|
+
/** Keep only memories whose `key` starts with this string. */
|
|
152
|
+
keyPrefix?: string;
|
|
142
153
|
}
|
|
143
154
|
|
|
144
155
|
export interface MemoryStats {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
-- Record which model produced each `llm` memory rating. The judge comes from a
|
|
2
|
+
-- per-credential default, so it can change without any row-level trace; on
|
|
3
|
+
-- 2026-09-23 it moved from Gemini 3 Flash to DeepSeek v4.1 Flash and the score
|
|
4
|
+
-- distribution shifted with nothing on the rows to explain it.
|
|
5
|
+
-- Holds the resolved "<provider>/<model-id>" string. NULL for every other
|
|
6
|
+
-- rating source, and for `llm` rows written before this column existed.
|
|
7
|
+
ALTER TABLE memory_rating ADD COLUMN model TEXT;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
-- context_versions.previousVersionId is a self-referential foreign key with
|
|
2
|
+
-- ON DELETE SET NULL. With foreign_keys = ON, every deleted row makes SQLite
|
|
3
|
+
-- look up the rows that point at it. Without an index that lookup is a full
|
|
4
|
+
-- table scan, and because previousVersionId sits after the large `content`
|
|
5
|
+
-- column, each scan walks every row's overflow pages. Count-based retention
|
|
6
|
+
-- (CONTEXT_VERSIONS_KEEP_LATEST) deletes old versions in batches, so it needs
|
|
7
|
+
-- this index to keep each child lookup a single index probe.
|
|
8
|
+
CREATE INDEX IF NOT EXISTS idx_cv_previous_version ON context_versions(previousVersionId);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
-- Comb pins: an agent-fs file or folder can be a favorite. The item id is
|
|
2
|
+
-- `<orgId>/<driveId>/<path>` (a folder path ends with "/"). SQLite cannot
|
|
3
|
+
-- change a CHECK in place, so rebuild the table with the 116 shape plus the
|
|
4
|
+
-- new item type. Every row is copied unchanged.
|
|
5
|
+
|
|
6
|
+
CREATE TABLE user_favorites_new (
|
|
7
|
+
id TEXT PRIMARY KEY DEFAULT (lower(hex(randomblob(16)))),
|
|
8
|
+
favoriteScope TEXT NOT NULL,
|
|
9
|
+
userId TEXT REFERENCES users(id) ON DELETE CASCADE,
|
|
10
|
+
itemType TEXT NOT NULL CHECK (itemType IN ('page','workflow','schedule','agent-fs-path')),
|
|
11
|
+
itemId TEXT NOT NULL,
|
|
12
|
+
createdAt TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
13
|
+
lastUpdatedAt TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
14
|
+
created_by TEXT,
|
|
15
|
+
updated_by TEXT,
|
|
16
|
+
UNIQUE (favoriteScope, itemType, itemId)
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
INSERT INTO user_favorites_new (
|
|
20
|
+
id, favoriteScope, userId, itemType, itemId,
|
|
21
|
+
createdAt, lastUpdatedAt, created_by, updated_by
|
|
22
|
+
)
|
|
23
|
+
SELECT
|
|
24
|
+
id, favoriteScope, userId, itemType, itemId,
|
|
25
|
+
createdAt, lastUpdatedAt, created_by, updated_by
|
|
26
|
+
FROM user_favorites;
|
|
27
|
+
|
|
28
|
+
DROP TABLE user_favorites;
|
|
29
|
+
ALTER TABLE user_favorites_new RENAME TO user_favorites;
|
|
30
|
+
|
|
31
|
+
CREATE INDEX idx_user_favorites_scope_type
|
|
32
|
+
ON user_favorites(favoriteScope, itemType);
|
|
33
|
+
CREATE INDEX idx_user_favorites_user_type
|
|
34
|
+
ON user_favorites(userId, itemType);
|
|
35
|
+
CREATE INDEX idx_user_favorites_item
|
|
36
|
+
ON user_favorites(itemType, itemId);
|
package/src/be/onboarding.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { telemetry } from "../telemetry";
|
|
2
2
|
import { ProviderNameSchema } from "../types";
|
|
3
|
+
import { getCurrentRequestUserId } from "../utils/request-auth-context";
|
|
3
4
|
import { z } from "../utils/zod-openapi";
|
|
4
5
|
import { getDbClient, getSwarmConfigs, getTaskById, upsertSwarmConfig } from "./db";
|
|
5
6
|
import { validateConfigValue } from "./swarm-config-guard";
|
|
@@ -23,6 +24,7 @@ export const OnboardingErrorClassSchema = z.enum([
|
|
|
23
24
|
"timeout",
|
|
24
25
|
"dimension",
|
|
25
26
|
"model",
|
|
27
|
+
"endpoint",
|
|
26
28
|
"not_enabled",
|
|
27
29
|
"expired",
|
|
28
30
|
"unknown",
|
|
@@ -48,6 +50,7 @@ export const OnboardingMemoryPresetSchema = z.enum([
|
|
|
48
50
|
"openai",
|
|
49
51
|
"openrouter",
|
|
50
52
|
"vercel",
|
|
53
|
+
"azure",
|
|
51
54
|
"custom",
|
|
52
55
|
"existing",
|
|
53
56
|
]);
|
|
@@ -359,8 +362,11 @@ function addTelemetry<Event extends OnboardingTelemetryEvent>(
|
|
|
359
362
|
}
|
|
360
363
|
|
|
361
364
|
function queueTelemetry(events: PendingTelemetry[]): void {
|
|
365
|
+
// Captured now: the request's user is ambient state, and the post-commit hook
|
|
366
|
+
// may run after it has moved on. Null for an operator (API key) request.
|
|
367
|
+
const actor = { userId: getCurrentRequestUserId() ?? null };
|
|
362
368
|
for (const item of events) {
|
|
363
|
-
getDbClient().afterCommit(() => telemetry.onboarding(item.event, item.properties));
|
|
369
|
+
getDbClient().afterCommit(() => telemetry.onboarding(item.event, item.properties, actor));
|
|
364
370
|
}
|
|
365
371
|
}
|
|
366
372
|
|
|
@@ -55,8 +55,10 @@ const ROUTING_PREFIXES_BY_PROVIDER: Record<PricingProvider, readonly string[]> =
|
|
|
55
55
|
// A generic ACP target reports whatever model id it likes and has no seeded
|
|
56
56
|
// rate rows, so there is no canonical key to collapse onto — no-op.
|
|
57
57
|
acp: [],
|
|
58
|
-
// dsh
|
|
59
|
-
|
|
58
|
+
// dsh reports `openrouter/<vendor>/<id>` for OpenRouter routes and a bare
|
|
59
|
+
// DeepSeek id (`deepseek-v4-pro`) for the direct API. Stripping `openrouter/`
|
|
60
|
+
// lands the former on the openrouter rows; the latter is already canonical.
|
|
61
|
+
dsh: ["openrouter/"],
|
|
60
62
|
};
|
|
61
63
|
|
|
62
64
|
/**
|
|
@@ -165,7 +165,7 @@ export interface RoomDecoded {
|
|
|
165
165
|
|
|
166
166
|
export interface SwarmSdk {
|
|
167
167
|
// --- memory ---
|
|
168
|
-
memory_search(args: { query: string; intent: string; scope?: "all" | "agent" | "swarm"; limit?: number; source?: string }): Promise<unknown>;
|
|
168
|
+
memory_search(args: { query: string; intent: string; scope?: "all" | "agent" | "swarm"; limit?: number; source?: string; keyPrefix?: string }): Promise<unknown>;
|
|
169
169
|
memory_get(args: { memoryId: string; intent: string }): Promise<unknown>;
|
|
170
170
|
memory_rate(args: { id: string; useful: boolean; note?: string }): Promise<unknown>;
|
|
171
171
|
// --- tasks ---
|
|
@@ -238,7 +238,7 @@ export interface SwarmSdk {
|
|
|
238
238
|
|
|
239
239
|
// --- write: memory ---
|
|
240
240
|
memory_delete(args: { id: string }): Promise<unknown>;
|
|
241
|
-
memory_store(args: { content: string; name: string; scope?: "agent" | "swarm"; tags?: string[]; taskId?: string; intent?: string }): Promise<unknown>;
|
|
241
|
+
memory_store(args: { content: string; name: string; scope?: "agent" | "swarm"; tags?: string[]; taskId?: string; intent?: string; key?: string }): Promise<unknown>;
|
|
242
242
|
memory_edit(args: {
|
|
243
243
|
memoryId?: string;
|
|
244
244
|
key?: string;
|
|
@@ -249,6 +249,7 @@ export interface SwarmSdk {
|
|
|
249
249
|
newString?: string;
|
|
250
250
|
intent: string;
|
|
251
251
|
expectedVersion?: number;
|
|
252
|
+
newKey?: string;
|
|
252
253
|
}): Promise<unknown>;
|
|
253
254
|
inject_learning(args: { content: string; name?: string; scope?: "agent" | "swarm"; source?: string; tags?: string[] }): Promise<unknown>;
|
|
254
255
|
|
|
@@ -332,7 +333,7 @@ export interface SwarmSdk {
|
|
|
332
333
|
|
|
333
334
|
// --- write: extensions ---
|
|
334
335
|
extension_catalog(args?: Record<string, never>): Promise<unknown>;
|
|
335
|
-
extension_install(args: { template: string; priority?: number; config?: Record<string, unknown> }): Promise<unknown>;
|
|
336
|
+
extension_install(args: { template: string; priority?: number; config?: Record<string, unknown> } | { manifest: Record<string, unknown>; files: Record<string, string>; priority?: number; config?: Record<string, unknown> }): Promise<unknown>;
|
|
336
337
|
extension_list(args?: { enabledOnly?: boolean }): Promise<unknown>;
|
|
337
338
|
extension_delete(args: { id: string }): Promise<unknown>;
|
|
338
339
|
extension_enable(args: { id: string }): Promise<unknown>;
|
package/src/be/seed-pricing.ts
CHANGED
|
@@ -229,6 +229,15 @@ export function buildModelsDevSeedRows(cache: ModelsDevCache): PricingSeedRow[]
|
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
231
|
|
|
232
|
+
// ---- DeepSeek direct API (dsh with DEEPSEEK_API_KEY, bare ids) ---------
|
|
233
|
+
const deepseek = cache.deepseek?.models ?? {};
|
|
234
|
+
for (const [id, model] of Object.entries(deepseek)) {
|
|
235
|
+
if (!model?.cost) continue;
|
|
236
|
+
for (const row of projectCostBlock("dsh", id, model.cost)) {
|
|
237
|
+
rows.push(row);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
232
241
|
// ---- OpenRouter passthrough (covers gemini + every opencode-routed model)
|
|
233
242
|
const openrouter = cache.openrouter?.models ?? {};
|
|
234
243
|
for (const [id, model] of Object.entries(openrouter)) {
|
|
@@ -247,6 +256,13 @@ export function buildModelsDevSeedRows(cache: ModelsDevCache): PricingSeedRow[]
|
|
|
247
256
|
})) {
|
|
248
257
|
rows.push(row);
|
|
249
258
|
}
|
|
259
|
+
// dsh routes `openrouter/<id>` models (all four tier defaults) through
|
|
260
|
+
// OpenRouter, so it bills at the same rates.
|
|
261
|
+
for (const row of projectCostBlock("dsh", id, model.cost, {
|
|
262
|
+
anthropicBilled: id.startsWith("anthropic/"),
|
|
263
|
+
})) {
|
|
264
|
+
rows.push(row);
|
|
265
|
+
}
|
|
250
266
|
// Gemini specifically: also project under the 'gemini' provider so
|
|
251
267
|
// internal-ai callers that tag with provider='gemini' find a hit.
|
|
252
268
|
if (id.startsWith("google/")) {
|
|
@@ -15,6 +15,7 @@ import { getPromptTemplates, resetPromptTemplateToDefault, upsertPromptTemplate
|
|
|
15
15
|
// handler imports, but runner/session templates are only loaded by the worker. Importing them
|
|
16
16
|
// here ensures all templates are available for the render endpoint and seeded to the DB.
|
|
17
17
|
import "../prompts/session-templates";
|
|
18
|
+
import "../comb/templates";
|
|
18
19
|
import "../commands/templates";
|
|
19
20
|
import "../tools/templates";
|
|
20
21
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { normalizeSlackReactionShortcode } from "../slack/reaction-shortcode";
|
|
2
2
|
import { ProviderNameSchema } from "../types";
|
|
3
|
+
import { API_DRAIN_MAX_MS_LIMIT } from "../utils/api-drain";
|
|
3
4
|
import { parseTaskToolManifest } from "../utils/task-tool-manifest";
|
|
4
5
|
import { isTierConfigKey, validateTierConfigValue } from "./model-tier-keys";
|
|
5
6
|
|
|
@@ -167,6 +168,26 @@ function boundedIntegerValidators(
|
|
|
167
168
|
);
|
|
168
169
|
}
|
|
169
170
|
|
|
171
|
+
/**
|
|
172
|
+
* Blank or an http(s) URL with no query string or fragment. Returns `invalid`
|
|
173
|
+
* for anything else. Blank is allowed: it is how an operator reverts to the
|
|
174
|
+
* key's fallback without deleting the row.
|
|
175
|
+
*/
|
|
176
|
+
function validateHttpBaseUrl(value: unknown, invalid: string): string | null {
|
|
177
|
+
if (typeof value !== "string") return invalid;
|
|
178
|
+
const trimmed = value.trim();
|
|
179
|
+
if (trimmed.length === 0) return null;
|
|
180
|
+
|
|
181
|
+
try {
|
|
182
|
+
const url = new URL(trimmed);
|
|
183
|
+
if (url.protocol !== "https:" && url.protocol !== "http:") return invalid;
|
|
184
|
+
if (url.search || url.hash) return invalid;
|
|
185
|
+
} catch {
|
|
186
|
+
return invalid;
|
|
187
|
+
}
|
|
188
|
+
return null;
|
|
189
|
+
}
|
|
190
|
+
|
|
170
191
|
function validateFloatRange(
|
|
171
192
|
key: string,
|
|
172
193
|
value: unknown,
|
|
@@ -213,22 +234,17 @@ const VALIDATED_KEYS: Record<string, ConfigValidator> = {
|
|
|
213
234
|
// or a fragment would build a nonsense URL — reject those here rather than
|
|
214
235
|
// letting workers fail one request at a time. Blank is meaningful and allowed:
|
|
215
236
|
// it is how an operator reverts to openrouter.ai without deleting the row.
|
|
216
|
-
OPENROUTER_BASE_URL: (value) =>
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
} catch {
|
|
228
|
-
return invalid;
|
|
229
|
-
}
|
|
230
|
-
return null;
|
|
231
|
-
},
|
|
237
|
+
OPENROUTER_BASE_URL: (value) =>
|
|
238
|
+
validateHttpBaseUrl(
|
|
239
|
+
value,
|
|
240
|
+
"Invalid OPENROUTER_BASE_URL (must be an http(s) URL with no query string or fragment, e.g. https://api.example.com/v1. Leave blank for openrouter.ai)",
|
|
241
|
+
),
|
|
242
|
+
// Browser-facing agent-fs URL for Comb. Blank falls back to AGENT_FS_API_URL.
|
|
243
|
+
AGENT_FS_PUBLIC_URL: (value) =>
|
|
244
|
+
validateHttpBaseUrl(
|
|
245
|
+
value,
|
|
246
|
+
"Invalid AGENT_FS_PUBLIC_URL (must be an http(s) URL with no query string or fragment, e.g. https://agent-fs.example.com. Leave blank to use AGENT_FS_API_URL)",
|
|
247
|
+
),
|
|
232
248
|
HARNESS_PROVIDER: (value) => {
|
|
233
249
|
const parsed = ProviderNameSchema.safeParse(value);
|
|
234
250
|
if (parsed.success) return null;
|
|
@@ -287,11 +303,13 @@ const VALIDATED_KEYS: Record<string, ConfigValidator> = {
|
|
|
287
303
|
"TASK_TOOL_PRELOAD_ENABLED",
|
|
288
304
|
"PI_TOOL_DEFERRAL",
|
|
289
305
|
"PI_CODEMODE",
|
|
306
|
+
"PI_CODEMODE_MODELS",
|
|
290
307
|
"SLACK_DISABLE",
|
|
291
308
|
"SLACK_RENDER_V2",
|
|
292
309
|
"SLACK_RENDER_V2_DELEGATION",
|
|
293
310
|
"GITHUB_DISABLE",
|
|
294
311
|
"GITLAB_DISABLE",
|
|
312
|
+
"AZURE_DEVOPS_DISABLE",
|
|
295
313
|
"LINEAR_DISABLE",
|
|
296
314
|
"JIRA_DISABLE",
|
|
297
315
|
"AGENTMAIL_DISABLE",
|
|
@@ -300,6 +318,7 @@ const VALIDATED_KEYS: Record<string, ConfigValidator> = {
|
|
|
300
318
|
"RBAC_ENABLED",
|
|
301
319
|
"SEED_AUTOMATIONS_ENABLED",
|
|
302
320
|
"RBAC_AUDIT_DISABLED",
|
|
321
|
+
"EXTENSION_ALLOW_INLINE_INSTALL",
|
|
303
322
|
"BUDGET_ADMISSION_DISABLED",
|
|
304
323
|
"MCP_OAUTH_ALLOW_PRIVATE_HOSTS",
|
|
305
324
|
"OTEL_TRACE_POLL",
|
|
@@ -309,6 +328,7 @@ const VALIDATED_KEYS: Record<string, ConfigValidator> = {
|
|
|
309
328
|
"DB_QUERY_BOUNDED_ENABLED",
|
|
310
329
|
"DB_RETENTION_DRY_RUN",
|
|
311
330
|
"MODEL_AUTO_UPGRADE",
|
|
331
|
+
"COMB_ENABLED",
|
|
312
332
|
]),
|
|
313
333
|
...enumValidator("SLACK_MODE", ["socket", "http"]),
|
|
314
334
|
...enumValidator("SLACK_THREAD_STEERING", ["off", "lead", "all"]),
|
|
@@ -358,7 +378,14 @@ const VALIDATED_KEYS: Record<string, ConfigValidator> = {
|
|
|
358
378
|
// sweep keep running for the default 30000ms.
|
|
359
379
|
...boundedIntegerValidatorsFor(DB_RETENTION_TUNING_BOUNDS),
|
|
360
380
|
...boundedIntegerValidators(
|
|
361
|
-
[
|
|
381
|
+
[
|
|
382
|
+
"SESSION_LOG_RETENTION_DAYS",
|
|
383
|
+
"AGENT_LOG_RETENTION_DAYS",
|
|
384
|
+
"EVENTS_RETENTION_DAYS",
|
|
385
|
+
// A kept-version count, not days. The floor of 1 is what guarantees the
|
|
386
|
+
// sweep never deletes the newest version of any (agentId, field).
|
|
387
|
+
"CONTEXT_VERSIONS_KEEP_LATEST",
|
|
388
|
+
],
|
|
362
389
|
1,
|
|
363
390
|
MAX_DB_RETENTION_DAYS,
|
|
364
391
|
),
|
|
@@ -368,6 +395,8 @@ const VALIDATED_KEYS: Record<string, ConfigValidator> = {
|
|
|
368
395
|
...integerValidators(["MODEL_LATEST_SOAK_DAYS"], 0),
|
|
369
396
|
// 0 turns approval auto-cancellation off.
|
|
370
397
|
...integerValidators(["APPROVAL_REQUEST_AUTO_CANCELLATION_DAYS"], 0),
|
|
398
|
+
// 0 turns the shutdown drain off; the shutdown path clamps to the same limit.
|
|
399
|
+
...boundedIntegerValidators(["API_DRAIN_MAX_MS"], 0, API_DRAIN_MAX_MS_LIMIT),
|
|
371
400
|
// Below ~100 tokens the preamble can't fit a useful summary; above 20000
|
|
372
401
|
// (~80k chars) it risks the SIGTERM-143 context-saturation failure mode
|
|
373
402
|
// the cap exists to prevent (see context-preamble.ts).
|
package/src/be/task-citations.ts
CHANGED
|
@@ -55,12 +55,18 @@ export function buildCitationUrl(citation: CitationInput): string | null {
|
|
|
55
55
|
if (!ref.trim() || /:\/\//.test(ref)) return null;
|
|
56
56
|
if (kind === "task") return citationHttpUrl(`${getAppUrl()}/tasks/${encodeURIComponent(ref)}`);
|
|
57
57
|
if (kind === "page" || kind === "agent-fs") {
|
|
58
|
+
// Stored, so an agent-fs file keeps its live URL (`comb: false`). The
|
|
59
|
+
// dashboard maps it to Comb when it renders, so turning COMB_ENABLED off
|
|
60
|
+
// later leaves no dead dashboard links behind.
|
|
58
61
|
return citationHttpUrl(
|
|
59
|
-
taskAttachmentDisplayUrl(
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
taskAttachmentDisplayUrl(
|
|
63
|
+
{
|
|
64
|
+
kind,
|
|
65
|
+
pageId: kind === "page" ? encodeURIComponent(ref) : undefined,
|
|
66
|
+
path: kind === "agent-fs" ? ref : undefined,
|
|
67
|
+
} as TaskAttachment,
|
|
68
|
+
{ comb: false },
|
|
69
|
+
),
|
|
64
70
|
);
|
|
65
71
|
}
|
|
66
72
|
// Memory/run routes and Slack workspace permalinks have no canonical builder here.
|
package/src/be/users.ts
CHANGED
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
22
|
import { createHash, randomBytes, randomUUID } from "node:crypto";
|
|
23
|
+
import { scheduleOrgDomainRecompute } from "../telemetry-identity";
|
|
23
24
|
import type { User } from "../types";
|
|
24
25
|
import { getDbClient } from "./db";
|
|
25
26
|
|
|
@@ -369,6 +370,8 @@ export async function findOrCreateUserByEmail(
|
|
|
369
370
|
await recordIdentityEvent(id, "identity_added", actor, null, { email, name });
|
|
370
371
|
return rowToUser(row);
|
|
371
372
|
});
|
|
373
|
+
// The org's email domain may come from this user (debounced, post-commit).
|
|
374
|
+
getDbClient().afterCommit(scheduleOrgDomainRecompute);
|
|
372
375
|
|
|
373
376
|
return { user: created, created: true };
|
|
374
377
|
}
|
package/src/cli.tsx
CHANGED
|
@@ -279,7 +279,7 @@ const COMMAND_HELP: Record<
|
|
|
279
279
|
"codex-hook": {
|
|
280
280
|
usage: `${binName} codex-hook`,
|
|
281
281
|
description:
|
|
282
|
-
"Handle Codex CLI hook events from stdin (steering delivery).\nUsed internally by the codex hooks registered in the worker image.",
|
|
282
|
+
"Handle Codex CLI hook events from stdin (steering delivery, PR body leak guard).\nUsed internally by the codex hooks registered in the worker image.",
|
|
283
283
|
options: " -h, --help Show this help",
|
|
284
284
|
examples: ` ${binName} codex-hook`,
|
|
285
285
|
},
|
|
@@ -745,7 +745,8 @@ if (args.showHelp || args.command === "help" || args.command === undefined) {
|
|
|
745
745
|
} else if (args.command === "codex-hook") {
|
|
746
746
|
const { handleCodexHook } = await import("./hooks/codex-hook.ts");
|
|
747
747
|
await handleCodexHook();
|
|
748
|
-
|
|
748
|
+
// Exit code 2 from the PreToolUse guard blocks the tool call.
|
|
749
|
+
process.exit(process.exitCode ?? 0);
|
|
749
750
|
} else if (args.command === "session-summary-stdin") {
|
|
750
751
|
const { runSessionSummaryFromStdin } = await import("./hooks/hook.ts");
|
|
751
752
|
await runSessionSummaryFromStdin();
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { AgentFsProvider } from "../fs/agent-fs-provider";
|
|
2
|
+
import { getFileStorageProvider } from "../fs/registry";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The agent-fs provider (the swarm's bootstrap key) that Comb uses to read
|
|
6
|
+
* comments and post the "sent" replies. Null when the swarm has no agent-fs
|
|
7
|
+
* provider yet (no key, or the shared drive is not provisioned).
|
|
8
|
+
*/
|
|
9
|
+
export function combAgentFs(): AgentFsProvider | null {
|
|
10
|
+
try {
|
|
11
|
+
const provider = getFileStorageProvider();
|
|
12
|
+
return provider instanceof AgentFsProvider ? provider : null;
|
|
13
|
+
} catch {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// `/status` waits this long for the first lookup. Later calls read the cache.
|
|
19
|
+
const STATUS_LOOKUP_WAIT_MS = 2_000;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The agent-fs user id of the swarm service account, for `/status`
|
|
23
|
+
* (`agent_fs.comb.service_user_id`). The dashboard trusts a "sent" reply only
|
|
24
|
+
* from this author. Null when agent-fs is not set up, the lookup fails, or it
|
|
25
|
+
* takes longer than `STATUS_LOOKUP_WAIT_MS` (the next poll reads the cache).
|
|
26
|
+
*/
|
|
27
|
+
export async function getCombServiceUserId(): Promise<string | null> {
|
|
28
|
+
const agentFs = combAgentFs();
|
|
29
|
+
if (!agentFs) return null;
|
|
30
|
+
let timer: ReturnType<typeof setTimeout> | undefined;
|
|
31
|
+
const timeout = new Promise<null>((resolve) => {
|
|
32
|
+
timer = setTimeout(resolve, STATUS_LOOKUP_WAIT_MS, null);
|
|
33
|
+
});
|
|
34
|
+
try {
|
|
35
|
+
return await Promise.race([agentFs.getServiceUserId().catch(() => null), timeout]);
|
|
36
|
+
} finally {
|
|
37
|
+
clearTimeout(timer);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getAgentFsDefaultDriveId,
|
|
3
|
+
getAgentFsDefaultOrgId,
|
|
4
|
+
getAgentFsLiveUrl,
|
|
5
|
+
isCombEnabled,
|
|
6
|
+
} from "../utils/constants";
|
|
7
|
+
|
|
8
|
+
/** The Comb block of `/status` (`agent_fs.comb`), before snake-casing. */
|
|
9
|
+
export interface CombConfig {
|
|
10
|
+
enabled: boolean;
|
|
11
|
+
/** Browser-facing agent-fs URL. */
|
|
12
|
+
apiUrl: string | null;
|
|
13
|
+
liveUrl: string;
|
|
14
|
+
orgId: string | null;
|
|
15
|
+
driveId: string | null;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function trimUrl(value: string | undefined): string | null {
|
|
19
|
+
const trimmed = value?.trim().replace(/\/+$/, "");
|
|
20
|
+
return trimmed || null;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Comb (the agent-fs review space in the dashboard) settings. Reads
|
|
25
|
+
* `process.env` on every call, because a config upsert reloads the env
|
|
26
|
+
* without a restart.
|
|
27
|
+
*/
|
|
28
|
+
export function getCombConfig(): CombConfig {
|
|
29
|
+
const internalUrl = trimUrl(process.env.AGENT_FS_API_URL);
|
|
30
|
+
return {
|
|
31
|
+
enabled: isCombEnabled(),
|
|
32
|
+
apiUrl: trimUrl(process.env.AGENT_FS_PUBLIC_URL) ?? internalUrl,
|
|
33
|
+
liveUrl: getAgentFsLiveUrl(),
|
|
34
|
+
orgId: getAgentFsDefaultOrgId() ?? null,
|
|
35
|
+
driveId: getAgentFsDefaultDriveId() ?? null,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// The "sent" reply that "Send to swarm" posts on each comment. The dashboard
|
|
2
|
+
// keeps its own copy of the pattern and the rule in
|
|
3
|
+
// `apps/ui/src/lib/comb/markers.ts`. `src/tests/comb-markers.test.ts` checks
|
|
4
|
+
// that both copies agree.
|
|
5
|
+
|
|
6
|
+
export const SENT_MARKER_PREFIX = "[comb:sent task=";
|
|
7
|
+
|
|
8
|
+
/** The machine-readable "sent" reply. Group 1 is the task id. */
|
|
9
|
+
export const SENT_MARKER_RE = /^\[comb:sent task=([0-9a-f-]{36})\]/;
|
|
10
|
+
|
|
11
|
+
/** The opening of a "sent" reply for `taskId`. */
|
|
12
|
+
export function sentMarker(taskId: string): string {
|
|
13
|
+
return `${SENT_MARKER_PREFIX}${taskId}]`;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface Authored {
|
|
17
|
+
body: string;
|
|
18
|
+
author: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The task id of the thread's "sent" reply, or null. The reply starts with
|
|
23
|
+
* the marker, and the swarm service account wrote it. Without a known service
|
|
24
|
+
* account, any author except the thread's own author counts.
|
|
25
|
+
*/
|
|
26
|
+
export function sentTaskId(
|
|
27
|
+
thread: { author: string },
|
|
28
|
+
replies: ReadonlyArray<Authored>,
|
|
29
|
+
serviceUserId: string | null,
|
|
30
|
+
): string | null {
|
|
31
|
+
for (const reply of replies) {
|
|
32
|
+
const bySwarm = serviceUserId ? reply.author === serviceUserId : reply.author !== thread.author;
|
|
33
|
+
const taskId = bySwarm ? SENT_MARKER_RE.exec(reply.body)?.[1] : undefined;
|
|
34
|
+
if (taskId) return taskId;
|
|
35
|
+
}
|
|
36
|
+
return null;
|
|
37
|
+
}
|