@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,303 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Text,
|
|
3
|
+
getBinDir,
|
|
4
|
+
getCapabilities,
|
|
5
|
+
getImageDimensions,
|
|
6
|
+
hyperlink,
|
|
7
|
+
imageFallback,
|
|
8
|
+
resolvePath,
|
|
9
|
+
truncateToWidth
|
|
10
|
+
} from "./cli-s3hwpt9v.js";
|
|
11
|
+
|
|
12
|
+
// node_modules/@earendil-works/pi-coding-agent/dist/utils/shell.js
|
|
13
|
+
import { existsSync } from "node:fs";
|
|
14
|
+
import { delimiter, join } from "node:path";
|
|
15
|
+
import { spawn, spawnSync } from "child_process";
|
|
16
|
+
function isLegacyWslBashPath(path) {
|
|
17
|
+
const normalized = path.replace(/\//g, "\\").toLowerCase();
|
|
18
|
+
return /^[a-z]:\\windows\\(?:system32|sysnative)\\bash\.exe$/.test(normalized);
|
|
19
|
+
}
|
|
20
|
+
function getBashShellConfig(shell) {
|
|
21
|
+
return isLegacyWslBashPath(shell) ? { shell, args: ["-s"], commandTransport: "stdin" } : { shell, args: ["-c"] };
|
|
22
|
+
}
|
|
23
|
+
function findExecutableOnPath(executable) {
|
|
24
|
+
if (process.platform === "win32") {
|
|
25
|
+
try {
|
|
26
|
+
const result = spawnSync("where", [executable], {
|
|
27
|
+
encoding: "utf-8",
|
|
28
|
+
timeout: 5000,
|
|
29
|
+
windowsHide: true
|
|
30
|
+
});
|
|
31
|
+
if (result.status === 0 && result.stdout) {
|
|
32
|
+
const firstMatch = result.stdout.trim().split(/\r?\n/)[0];
|
|
33
|
+
if (firstMatch && existsSync(firstMatch)) {
|
|
34
|
+
return firstMatch;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
} catch {}
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
try {
|
|
41
|
+
const result = spawnSync("which", [executable], { encoding: "utf-8", timeout: 5000 });
|
|
42
|
+
if (result.status === 0 && result.stdout) {
|
|
43
|
+
const firstMatch = result.stdout.trim().split(/\r?\n/)[0];
|
|
44
|
+
if (firstMatch) {
|
|
45
|
+
return firstMatch;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
} catch {}
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
function getShellConfig(customShellPath) {
|
|
52
|
+
if (customShellPath) {
|
|
53
|
+
if (existsSync(customShellPath)) {
|
|
54
|
+
return getBashShellConfig(customShellPath);
|
|
55
|
+
}
|
|
56
|
+
throw new Error(`Custom shell path not found: ${customShellPath}`);
|
|
57
|
+
}
|
|
58
|
+
if (process.platform === "win32") {
|
|
59
|
+
const paths = [];
|
|
60
|
+
const programFiles = process.env.ProgramFiles;
|
|
61
|
+
if (programFiles) {
|
|
62
|
+
paths.push(`${programFiles}\\Git\\bin\\bash.exe`);
|
|
63
|
+
}
|
|
64
|
+
const programFilesX86 = process.env["ProgramFiles(x86)"];
|
|
65
|
+
if (programFilesX86) {
|
|
66
|
+
paths.push(`${programFilesX86}\\Git\\bin\\bash.exe`);
|
|
67
|
+
}
|
|
68
|
+
for (const path of paths) {
|
|
69
|
+
if (existsSync(path)) {
|
|
70
|
+
return getBashShellConfig(path);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
const bashOnPath2 = findExecutableOnPath("bash.exe");
|
|
74
|
+
if (bashOnPath2) {
|
|
75
|
+
return getBashShellConfig(bashOnPath2);
|
|
76
|
+
}
|
|
77
|
+
throw new Error(`No bash shell found. Options:
|
|
78
|
+
` + ` 1. Install Git for Windows: https://git-scm.com/download/win
|
|
79
|
+
` + ` 2. Add your bash to PATH (Cygwin, MSYS2, etc.)
|
|
80
|
+
` + ` 3. Set shellPath in settings.json
|
|
81
|
+
|
|
82
|
+
` + `Searched Git Bash in:
|
|
83
|
+
${paths.map((p) => ` ${p}`).join(`
|
|
84
|
+
`)}`);
|
|
85
|
+
}
|
|
86
|
+
if (existsSync("/bin/bash")) {
|
|
87
|
+
return getBashShellConfig("/bin/bash");
|
|
88
|
+
}
|
|
89
|
+
const bashOnPath = findExecutableOnPath("bash");
|
|
90
|
+
if (bashOnPath) {
|
|
91
|
+
return getBashShellConfig(bashOnPath);
|
|
92
|
+
}
|
|
93
|
+
return { shell: "sh", args: ["-c"] };
|
|
94
|
+
}
|
|
95
|
+
var POWERSHELL_ARGS = ["-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-Command"];
|
|
96
|
+
function getPowerShellConfig() {
|
|
97
|
+
if (process.platform !== "win32") {
|
|
98
|
+
throw new Error("The powershell tool is only available on Windows.");
|
|
99
|
+
}
|
|
100
|
+
const shell = findExecutableOnPath("pwsh.exe") ?? findExecutableOnPath("powershell.exe");
|
|
101
|
+
if (!shell) {
|
|
102
|
+
throw new Error("No PowerShell executable found. Install PowerShell or add powershell.exe/pwsh.exe to PATH.");
|
|
103
|
+
}
|
|
104
|
+
return { shell, args: [...POWERSHELL_ARGS] };
|
|
105
|
+
}
|
|
106
|
+
function getShellEnv() {
|
|
107
|
+
const binDir = getBinDir();
|
|
108
|
+
const pathKey = Object.keys(process.env).find((key) => key.toLowerCase() === "path") ?? "PATH";
|
|
109
|
+
const currentPath = process.env[pathKey] ?? "";
|
|
110
|
+
const pathEntries = currentPath.split(delimiter).filter(Boolean);
|
|
111
|
+
const hasBinDir = pathEntries.includes(binDir);
|
|
112
|
+
const updatedPath = hasBinDir ? currentPath : [binDir, currentPath].filter(Boolean).join(delimiter);
|
|
113
|
+
return {
|
|
114
|
+
...process.env,
|
|
115
|
+
[pathKey]: updatedPath
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
function sanitizeBinaryOutput(str) {
|
|
119
|
+
return str.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\uFFF9-\uFFFB]/g, "");
|
|
120
|
+
}
|
|
121
|
+
var trackedDetachedChildPids = new Set;
|
|
122
|
+
function trackDetachedChildPid(pid) {
|
|
123
|
+
trackedDetachedChildPids.add(pid);
|
|
124
|
+
}
|
|
125
|
+
function untrackDetachedChildPid(pid) {
|
|
126
|
+
trackedDetachedChildPids.delete(pid);
|
|
127
|
+
}
|
|
128
|
+
function killTrackedDetachedChildren() {
|
|
129
|
+
for (const pid of trackedDetachedChildPids) {
|
|
130
|
+
killProcessTree(pid);
|
|
131
|
+
}
|
|
132
|
+
trackedDetachedChildPids.clear();
|
|
133
|
+
}
|
|
134
|
+
function killProcessTree(pid) {
|
|
135
|
+
if (process.platform === "win32") {
|
|
136
|
+
try {
|
|
137
|
+
const child = spawn(join(process.env.SystemRoot ?? "C:\\Windows", "System32", "taskkill.exe"), ["/F", "/T", "/PID", String(pid)], {
|
|
138
|
+
stdio: "ignore",
|
|
139
|
+
detached: true,
|
|
140
|
+
windowsHide: true
|
|
141
|
+
});
|
|
142
|
+
child.once("error", () => {});
|
|
143
|
+
} catch {}
|
|
144
|
+
} else {
|
|
145
|
+
try {
|
|
146
|
+
process.kill(-pid, "SIGKILL");
|
|
147
|
+
} catch {
|
|
148
|
+
try {
|
|
149
|
+
process.kill(pid, "SIGKILL");
|
|
150
|
+
} catch {}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/visual-truncate.js
|
|
156
|
+
function truncateToVisualLines(text, maxVisualLines, width, paddingX = 0, keep = "end") {
|
|
157
|
+
if (!text) {
|
|
158
|
+
return { visualLines: [], skippedCount: 0 };
|
|
159
|
+
}
|
|
160
|
+
const tempText = new Text(text, paddingX, 0);
|
|
161
|
+
const allVisualLines = tempText.render(width);
|
|
162
|
+
if (allVisualLines.length <= maxVisualLines) {
|
|
163
|
+
return { visualLines: allVisualLines, skippedCount: 0 };
|
|
164
|
+
}
|
|
165
|
+
const truncatedLines = keep === "start" ? allVisualLines.slice(0, maxVisualLines) : allVisualLines.slice(-maxVisualLines);
|
|
166
|
+
const skippedCount = allVisualLines.length - maxVisualLines;
|
|
167
|
+
return { visualLines: truncatedLines, skippedCount };
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
class VisualLinePreview {
|
|
171
|
+
options;
|
|
172
|
+
cachedWidth;
|
|
173
|
+
cachedLines;
|
|
174
|
+
constructor(options) {
|
|
175
|
+
this.options = options;
|
|
176
|
+
}
|
|
177
|
+
render(width) {
|
|
178
|
+
if (this.cachedLines === undefined || this.cachedWidth !== width) {
|
|
179
|
+
const { text, maxVisualLines, keep, formatHint } = this.options;
|
|
180
|
+
const preview = truncateToVisualLines(text, maxVisualLines, width, 0, keep);
|
|
181
|
+
const lines = preview.visualLines;
|
|
182
|
+
if (preview.skippedCount > 0) {
|
|
183
|
+
const hint = truncateToWidth(formatHint(preview.skippedCount), width, "...");
|
|
184
|
+
this.cachedLines = keep === "start" ? [...lines, hint] : [hint, ...lines];
|
|
185
|
+
} else {
|
|
186
|
+
this.cachedLines = lines;
|
|
187
|
+
}
|
|
188
|
+
this.cachedWidth = width;
|
|
189
|
+
}
|
|
190
|
+
return this.cachedLines;
|
|
191
|
+
}
|
|
192
|
+
invalidate() {
|
|
193
|
+
this.cachedWidth = undefined;
|
|
194
|
+
this.cachedLines = undefined;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// node_modules/@earendil-works/pi-coding-agent/dist/utils/ansi.js
|
|
199
|
+
function ansiRegex({ onlyFirst = false } = {}) {
|
|
200
|
+
const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
|
|
201
|
+
const osc = `(?:\\u001B\\][\\s\\S]*?${ST})`;
|
|
202
|
+
const csi = "[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";
|
|
203
|
+
const pattern = `${osc}|${csi}`;
|
|
204
|
+
return new RegExp(pattern, onlyFirst ? undefined : "g");
|
|
205
|
+
}
|
|
206
|
+
var regex = ansiRegex();
|
|
207
|
+
function stripAnsi(value) {
|
|
208
|
+
if (typeof value !== "string") {
|
|
209
|
+
throw new TypeError(`Expected a \`string\`, got \`${typeof value}\``);
|
|
210
|
+
}
|
|
211
|
+
if (!value.includes("\x1B") && !value.includes("")) {
|
|
212
|
+
return value;
|
|
213
|
+
}
|
|
214
|
+
return value.replace(regex, "");
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
// node_modules/@earendil-works/pi-coding-agent/dist/core/tools/render-utils.js
|
|
218
|
+
import * as os from "node:os";
|
|
219
|
+
import { pathToFileURL } from "node:url";
|
|
220
|
+
function shortenPath(path) {
|
|
221
|
+
if (typeof path !== "string")
|
|
222
|
+
return "";
|
|
223
|
+
const home = os.homedir();
|
|
224
|
+
if (path.startsWith(home)) {
|
|
225
|
+
return `~${path.slice(home.length)}`;
|
|
226
|
+
}
|
|
227
|
+
return path;
|
|
228
|
+
}
|
|
229
|
+
function linkPath(styledText, rawPath, cwd) {
|
|
230
|
+
if (!getCapabilities().hyperlinks)
|
|
231
|
+
return styledText;
|
|
232
|
+
const absolutePath = resolvePath(rawPath, cwd);
|
|
233
|
+
return hyperlink(styledText, pathToFileURL(absolutePath).href);
|
|
234
|
+
}
|
|
235
|
+
function str(value) {
|
|
236
|
+
if (typeof value === "string")
|
|
237
|
+
return value;
|
|
238
|
+
if (value == null)
|
|
239
|
+
return "";
|
|
240
|
+
return null;
|
|
241
|
+
}
|
|
242
|
+
function replaceTabs(text) {
|
|
243
|
+
return text.replace(/\t/g, " ");
|
|
244
|
+
}
|
|
245
|
+
function normalizeDisplayText(text) {
|
|
246
|
+
return text.replace(/\r/g, "");
|
|
247
|
+
}
|
|
248
|
+
function getTextOutput(result, showImages) {
|
|
249
|
+
if (!result)
|
|
250
|
+
return "";
|
|
251
|
+
const textBlocks = result.content.filter((c) => c.type === "text");
|
|
252
|
+
const imageBlocks = result.content.filter((c) => c.type === "image");
|
|
253
|
+
let output = textBlocks.map((c) => sanitizeBinaryOutput(stripAnsi(c.text || "")).replace(/\r/g, "")).join(`
|
|
254
|
+
`);
|
|
255
|
+
const caps = getCapabilities();
|
|
256
|
+
if (imageBlocks.length > 0 && (!caps.images || !showImages)) {
|
|
257
|
+
const imageIndicators = imageBlocks.map((img) => {
|
|
258
|
+
const mimeType = img.mimeType ?? "image/unknown";
|
|
259
|
+
const dims = img.data && img.mimeType ? getImageDimensions(img.data, img.mimeType) ?? undefined : undefined;
|
|
260
|
+
return imageFallback(mimeType, dims);
|
|
261
|
+
}).join(`
|
|
262
|
+
`);
|
|
263
|
+
output = output ? `${output}
|
|
264
|
+
${imageIndicators}` : imageIndicators;
|
|
265
|
+
}
|
|
266
|
+
return output;
|
|
267
|
+
}
|
|
268
|
+
var COLLAPSED_ARGS_CHARS = 100;
|
|
269
|
+
function formatToolCallWithArgs(title, args, theme, expanded) {
|
|
270
|
+
const header = theme.fg("toolTitle", theme.bold(title));
|
|
271
|
+
if (args == null)
|
|
272
|
+
return header;
|
|
273
|
+
const entries = typeof args === "object" && !Array.isArray(args) ? Object.entries(args) : [["args", args]];
|
|
274
|
+
if (entries.length === 0)
|
|
275
|
+
return header;
|
|
276
|
+
if (expanded) {
|
|
277
|
+
const lines = entries.map(([key, value]) => {
|
|
278
|
+
const text = typeof value === "string" ? value : JSON.stringify(value, null, 2) ?? String(value);
|
|
279
|
+
return ` ${key}: ${replaceTabs(text).replace(/\r/g, "").split(`
|
|
280
|
+
`).join(`
|
|
281
|
+
`)}`;
|
|
282
|
+
});
|
|
283
|
+
return `${header}
|
|
284
|
+
${theme.fg("muted", lines.join(`
|
|
285
|
+
`))}`;
|
|
286
|
+
}
|
|
287
|
+
const pairs = entries.map(([key, value]) => `${key}=${JSON.stringify(value) ?? String(value)}`).join(" ");
|
|
288
|
+
const preview = pairs.length > COLLAPSED_ARGS_CHARS ? `${pairs.slice(0, COLLAPSED_ARGS_CHARS - 3)}...` : pairs;
|
|
289
|
+
return `${header} ${theme.fg("muted", preview)}`;
|
|
290
|
+
}
|
|
291
|
+
function invalidArgText(theme) {
|
|
292
|
+
return theme.fg("error", "[invalid arg]");
|
|
293
|
+
}
|
|
294
|
+
function renderToolPath(rawPath, theme, cwd, options) {
|
|
295
|
+
if (rawPath === null)
|
|
296
|
+
return invalidArgText(theme);
|
|
297
|
+
const value = rawPath || options?.emptyFallback;
|
|
298
|
+
if (!value)
|
|
299
|
+
return theme.fg("toolOutput", "...");
|
|
300
|
+
return linkPath(theme.fg("accent", shortenPath(value)), value, cwd);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
export { stripAnsi, getShellConfig, getPowerShellConfig, getShellEnv, sanitizeBinaryOutput, trackDetachedChildPid, untrackDetachedChildPid, killTrackedDetachedChildren, killProcessTree, truncateToVisualLines, VisualLinePreview, shortenPath, str, replaceTabs, normalizeDisplayText, getTextOutput, formatToolCallWithArgs, invalidArgText, renderToolPath };
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
init_session_templates
|
|
3
|
+
} from "./cli-eg0b3p0k.js";
|
|
1
4
|
import {
|
|
2
5
|
init_resolver,
|
|
3
|
-
init_session_templates,
|
|
4
6
|
resolveTemplateAsync
|
|
5
|
-
} from "./cli-
|
|
7
|
+
} from "./cli-qjjvzwzd.js";
|
|
6
8
|
|
|
7
9
|
// src/prompts/steering-delivery.ts
|
|
8
10
|
init_session_templates();
|
|
@@ -17,13 +17,13 @@ import {
|
|
|
17
17
|
recoverIncompleteRuns,
|
|
18
18
|
repointTrackerSyncBySwarmId,
|
|
19
19
|
resolveLeadOnlyRecoveryAssignment
|
|
20
|
-
} from "./cli-
|
|
20
|
+
} from "./cli-kp42yek0.js";
|
|
21
21
|
import {
|
|
22
22
|
isMultiRuntimeEnabled
|
|
23
23
|
} from "./cli-re8z5p8p.js";
|
|
24
24
|
import {
|
|
25
25
|
createApprovalFollowUpTask
|
|
26
|
-
} from "./cli-
|
|
26
|
+
} from "./cli-5xhpb3kv.js";
|
|
27
27
|
import {
|
|
28
28
|
MAX_EMPTY_POLLS,
|
|
29
29
|
assignUnassignedTaskPending,
|
|
@@ -74,13 +74,13 @@ import {
|
|
|
74
74
|
settleSupersededTaskDependents,
|
|
75
75
|
supersedeTask,
|
|
76
76
|
updateAgentStatus
|
|
77
|
-
} from "./cli-
|
|
77
|
+
} from "./cli-jf7wmv1r.js";
|
|
78
78
|
import {
|
|
79
79
|
init_registry,
|
|
80
80
|
init_resolver,
|
|
81
81
|
registerTemplate,
|
|
82
82
|
resolveTemplate
|
|
83
|
-
} from "./cli-
|
|
83
|
+
} from "./cli-qjjvzwzd.js";
|
|
84
84
|
import {
|
|
85
85
|
init_env_flag,
|
|
86
86
|
isEnvFlagEnabled
|
|
@@ -88,7 +88,7 @@ import {
|
|
|
88
88
|
import {
|
|
89
89
|
init_secret_scrubber,
|
|
90
90
|
scrubSecrets
|
|
91
|
-
} from "./cli-
|
|
91
|
+
} from "./cli-nexqx4ve.js";
|
|
92
92
|
|
|
93
93
|
// src/be/approval-sweeps.ts
|
|
94
94
|
init_db();
|
|
@@ -1137,6 +1137,7 @@ async function checkHeartbeatChecklist() {
|
|
|
1137
1137
|
agentId: lead.id,
|
|
1138
1138
|
routingReason: "skill",
|
|
1139
1139
|
routingSource: "engine_default",
|
|
1140
|
+
source: "system",
|
|
1140
1141
|
taskType: "heartbeat-checklist",
|
|
1141
1142
|
tags: ["checklist", "auto-generated"],
|
|
1142
1143
|
priority: 60
|
|
@@ -1281,6 +1282,7 @@ async function createBootTriageTask() {
|
|
|
1281
1282
|
agentId: lead.id,
|
|
1282
1283
|
routingReason: "skill",
|
|
1283
1284
|
routingSource: "engine_default",
|
|
1285
|
+
source: "system",
|
|
1284
1286
|
taskType: "boot-triage",
|
|
1285
1287
|
tags: ["boot", "triage", "auto-generated"],
|
|
1286
1288
|
priority: 70
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__esm
|
|
3
|
+
} from "./cli-bc05qbss.js";
|
|
4
|
+
|
|
5
|
+
// src/utils/template.ts
|
|
6
|
+
function findInterpolationTokens(template) {
|
|
7
|
+
return Array.from(template.matchAll(INTERPOLATION_TOKEN_RE), (match) => match[1].trim());
|
|
8
|
+
}
|
|
9
|
+
function interpolate(template, ctx) {
|
|
10
|
+
const unresolved = [];
|
|
11
|
+
const result = template.replace(INTERPOLATION_TOKEN_RE, (_match, path) => {
|
|
12
|
+
const keys = path.trim().split(".");
|
|
13
|
+
let value = ctx;
|
|
14
|
+
for (const key of keys) {
|
|
15
|
+
if (value == null || typeof value !== "object") {
|
|
16
|
+
unresolved.push(path.trim());
|
|
17
|
+
return "";
|
|
18
|
+
}
|
|
19
|
+
value = value[key];
|
|
20
|
+
}
|
|
21
|
+
if (value == null) {
|
|
22
|
+
unresolved.push(path.trim());
|
|
23
|
+
return "";
|
|
24
|
+
}
|
|
25
|
+
return typeof value === "object" ? safeStringify(value) : String(value);
|
|
26
|
+
});
|
|
27
|
+
return { result, unresolved };
|
|
28
|
+
}
|
|
29
|
+
function safeStringify(value) {
|
|
30
|
+
try {
|
|
31
|
+
return JSON.stringify(value);
|
|
32
|
+
} catch {
|
|
33
|
+
return "[Circular]";
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function resolvePath(path, ctx) {
|
|
37
|
+
const keys = path.trim().split(".");
|
|
38
|
+
let value = ctx;
|
|
39
|
+
for (const key of keys) {
|
|
40
|
+
if (value == null || typeof value !== "object")
|
|
41
|
+
return { found: false };
|
|
42
|
+
value = value[key];
|
|
43
|
+
}
|
|
44
|
+
if (value === undefined)
|
|
45
|
+
return { found: false };
|
|
46
|
+
return { found: true, value };
|
|
47
|
+
}
|
|
48
|
+
function deepInterpolate(value, ctx, options = {}) {
|
|
49
|
+
const allUnresolved = [];
|
|
50
|
+
function walk(v) {
|
|
51
|
+
if (typeof v === "string") {
|
|
52
|
+
const exactMatch = options.preserveRawTokens ? EXACT_TOKEN_RE.exec(v) : null;
|
|
53
|
+
if (exactMatch?.[1]) {
|
|
54
|
+
const path = exactMatch[1].trim();
|
|
55
|
+
const resolved = resolvePath(path, ctx);
|
|
56
|
+
if (!resolved.found) {
|
|
57
|
+
allUnresolved.push(path);
|
|
58
|
+
return "";
|
|
59
|
+
}
|
|
60
|
+
return resolved.value;
|
|
61
|
+
}
|
|
62
|
+
const { result, unresolved } = interpolate(v, ctx);
|
|
63
|
+
allUnresolved.push(...unresolved);
|
|
64
|
+
return result;
|
|
65
|
+
}
|
|
66
|
+
if (Array.isArray(v))
|
|
67
|
+
return v.map(walk);
|
|
68
|
+
if (v != null && typeof v === "object") {
|
|
69
|
+
const out = {};
|
|
70
|
+
for (const [k, val] of Object.entries(v)) {
|
|
71
|
+
out[k] = walk(val);
|
|
72
|
+
}
|
|
73
|
+
return out;
|
|
74
|
+
}
|
|
75
|
+
return v;
|
|
76
|
+
}
|
|
77
|
+
return { value: walk(value), unresolved: allUnresolved };
|
|
78
|
+
}
|
|
79
|
+
var INTERPOLATION_TOKEN_RE, EXACT_TOKEN_RE;
|
|
80
|
+
var init_template = __esm(() => {
|
|
81
|
+
INTERPOLATION_TOKEN_RE = /\{\{([^}]+)\}\}/g;
|
|
82
|
+
EXACT_TOKEN_RE = /^\{\{([^}]+)\}\}$/;
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
// src/prompts/registry.ts
|
|
86
|
+
function registerTemplate(def) {
|
|
87
|
+
templateDefinitions.set(def.eventType, def);
|
|
88
|
+
}
|
|
89
|
+
function getTemplateDefinition(eventType) {
|
|
90
|
+
return templateDefinitions.get(eventType);
|
|
91
|
+
}
|
|
92
|
+
function getAllTemplateDefinitions() {
|
|
93
|
+
return Array.from(templateDefinitions.values());
|
|
94
|
+
}
|
|
95
|
+
var templateDefinitions;
|
|
96
|
+
var init_registry = __esm(() => {
|
|
97
|
+
templateDefinitions = new Map;
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
// src/prompts/resolver.ts
|
|
101
|
+
function configureDbResolver(fn) {
|
|
102
|
+
dbResolverFn = fn;
|
|
103
|
+
}
|
|
104
|
+
function configureHttpResolver(apiUrl, apiKey) {
|
|
105
|
+
httpResolverConfig = { apiUrl, apiKey };
|
|
106
|
+
}
|
|
107
|
+
async function resolveTemplateViaHttp(eventType, variables, options) {
|
|
108
|
+
const config = httpResolverConfig;
|
|
109
|
+
const url = `${config.apiUrl}/api/prompt-templates/render`;
|
|
110
|
+
try {
|
|
111
|
+
const resp = await fetch(url, {
|
|
112
|
+
method: "POST",
|
|
113
|
+
headers: {
|
|
114
|
+
Authorization: `Bearer ${config.apiKey}`,
|
|
115
|
+
"Content-Type": "application/json"
|
|
116
|
+
},
|
|
117
|
+
body: JSON.stringify({
|
|
118
|
+
eventType,
|
|
119
|
+
variables,
|
|
120
|
+
agentId: options.agentId,
|
|
121
|
+
repoId: options.repoId
|
|
122
|
+
})
|
|
123
|
+
});
|
|
124
|
+
if (!resp.ok) {
|
|
125
|
+
console.warn(`[prompt-resolver] HTTP render failed (${resp.status}), falling back to code defaults`);
|
|
126
|
+
return resolveTemplateFromCode(eventType, variables);
|
|
127
|
+
}
|
|
128
|
+
return await resp.json();
|
|
129
|
+
} catch (err) {
|
|
130
|
+
console.warn(`[prompt-resolver] HTTP render error, falling back to code defaults:`, err instanceof Error ? err.message : err);
|
|
131
|
+
return resolveTemplateFromCode(eventType, variables);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
function resolveTemplateFromCode(eventType, variables) {
|
|
135
|
+
const definition = getTemplateDefinition(eventType);
|
|
136
|
+
const header = definition?.header ?? "";
|
|
137
|
+
const body = definition?.defaultBody ?? "";
|
|
138
|
+
const composed = header ? `${header}
|
|
139
|
+
|
|
140
|
+
${body}` : body;
|
|
141
|
+
const { result: text, unresolved } = interpolate(composed, variables);
|
|
142
|
+
return { text, skipped: false, unresolved };
|
|
143
|
+
}
|
|
144
|
+
function resolveTemplate(eventType, variables, options = {}) {
|
|
145
|
+
if (httpResolverConfig) {
|
|
146
|
+
return resolveTemplateFromCode(eventType, variables);
|
|
147
|
+
}
|
|
148
|
+
return resolveTemplateViaDb(eventType, variables, options);
|
|
149
|
+
}
|
|
150
|
+
async function resolveTemplateAsync(eventType, variables, options = {}) {
|
|
151
|
+
if (httpResolverConfig) {
|
|
152
|
+
return resolveTemplateViaHttp(eventType, variables, options);
|
|
153
|
+
}
|
|
154
|
+
return resolveTemplateViaDb(eventType, variables, options);
|
|
155
|
+
}
|
|
156
|
+
function resolveTemplateViaDb(eventType, variables, options) {
|
|
157
|
+
const definition = getTemplateDefinition(eventType);
|
|
158
|
+
const header = definition?.header ?? "";
|
|
159
|
+
const defaultBody = definition?.defaultBody ?? "";
|
|
160
|
+
const dbResult = dbResolverFn?.(eventType, options.agentId, options.repoId) ?? null;
|
|
161
|
+
if (dbResult && "skip" in dbResult) {
|
|
162
|
+
return { text: "", skipped: true, unresolved: [] };
|
|
163
|
+
}
|
|
164
|
+
let body;
|
|
165
|
+
let templateId;
|
|
166
|
+
let scope;
|
|
167
|
+
if (dbResult && "template" in dbResult) {
|
|
168
|
+
body = dbResult.template.body;
|
|
169
|
+
templateId = dbResult.template.id;
|
|
170
|
+
scope = dbResult.template.scope;
|
|
171
|
+
} else {
|
|
172
|
+
body = defaultBody;
|
|
173
|
+
}
|
|
174
|
+
body = expandTemplateRefs(body, variables, options, new Set, 0);
|
|
175
|
+
const composed = header ? `${header}
|
|
176
|
+
|
|
177
|
+
${body}` : body;
|
|
178
|
+
const { result: text, unresolved } = interpolate(composed, variables);
|
|
179
|
+
return {
|
|
180
|
+
text,
|
|
181
|
+
templateId,
|
|
182
|
+
scope,
|
|
183
|
+
skipped: false,
|
|
184
|
+
unresolved
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
function expandTemplateRefs(text, variables, options, visited, depth) {
|
|
188
|
+
if (depth > MAX_TEMPLATE_REF_DEPTH) {
|
|
189
|
+
return text;
|
|
190
|
+
}
|
|
191
|
+
return text.replace(TEMPLATE_REF_REGEX, (fullMatch, referencedId) => {
|
|
192
|
+
if (visited.has(referencedId)) {
|
|
193
|
+
console.warn(`[prompt-resolver] Cycle detected for template reference "${referencedId}", leaving token as-is`);
|
|
194
|
+
return fullMatch;
|
|
195
|
+
}
|
|
196
|
+
if (depth + 1 > MAX_TEMPLATE_REF_DEPTH) {
|
|
197
|
+
console.warn(`[prompt-resolver] Max template reference depth (${MAX_TEMPLATE_REF_DEPTH}) exceeded for "${referencedId}", leaving token as-is`);
|
|
198
|
+
return fullMatch;
|
|
199
|
+
}
|
|
200
|
+
const refDef = getTemplateDefinition(referencedId);
|
|
201
|
+
const refDefaultBody = refDef?.defaultBody ?? "";
|
|
202
|
+
const refDbResult = dbResolverFn?.(referencedId, options.agentId, options.repoId) ?? null;
|
|
203
|
+
if (refDbResult && "skip" in refDbResult) {
|
|
204
|
+
return fullMatch;
|
|
205
|
+
}
|
|
206
|
+
const refBody = refDbResult && "template" in refDbResult ? refDbResult.template.body : refDefaultBody;
|
|
207
|
+
if (!refBody) {
|
|
208
|
+
return fullMatch;
|
|
209
|
+
}
|
|
210
|
+
const newVisited = new Set(visited);
|
|
211
|
+
newVisited.add(referencedId);
|
|
212
|
+
return expandTemplateRefs(refBody, variables, options, newVisited, depth + 1);
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
var dbResolverFn = null, httpResolverConfig = null, MAX_TEMPLATE_REF_DEPTH = 3, TEMPLATE_REF_REGEX;
|
|
216
|
+
var init_resolver = __esm(() => {
|
|
217
|
+
init_template();
|
|
218
|
+
init_registry();
|
|
219
|
+
TEMPLATE_REF_REGEX = /\{\{@template\[([^\]]+)\]\}\}/g;
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
export { findInterpolationTokens, interpolate, deepInterpolate, init_template, registerTemplate, getTemplateDefinition, getAllTemplateDefinitions, init_registry, configureDbResolver, configureHttpResolver, resolveTemplate, resolveTemplateAsync, init_resolver };
|