@desplega.ai/agent-swarm 1.131.1 → 1.134.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 +3 -3
- package/dist/{actions-jgcy477k.js → actions-7kast243.js} +20 -18
- package/dist/{anthropic-messages-rjmd2e7n.js → anthropic-messages-706yad38.js} +33 -17
- package/dist/app-0g84t8wf.js +28 -0
- package/dist/{artifact-jysj3wrg.js → artifact-dje5ke4h.js} +37 -131
- package/dist/{assistant-f2vkk1hj.js → assistant-ac4htcky.js} +25 -22
- package/dist/{azure-openai-responses-c0yjmbfd.js → azure-openai-responses-be59fbsz.js} +13 -13
- package/dist/{boot-reembed-q7mp8hcr.js → boot-reembed-b1rcqn85.js} +13 -11
- package/dist/{boot-reembed-xmw8wcx6.js → boot-reembed-kw2541c4.js} +14 -12
- package/dist/{boot-scrub-logs-dsqrv79n.js → boot-scrub-logs-ja29t92g.js} +11 -9
- package/dist/{claude-adapter-q6x7yspx.js → claude-adapter-5cg1fv8s.js} +33 -29
- package/dist/{claude-managed-adapter-wsg37bt8.js → claude-managed-adapter-9z9sdytx.js} +9 -9
- package/dist/{claude-managed-setup-52z4mq9w.js → claude-managed-setup-3zqp51cr.js} +5 -5
- package/dist/{claude-1ex232fc.js → claude-wqn3dtca.js} +1 -1
- package/dist/{cli-4wgngmwv.js → cli-00w4hbam.js} +1 -1
- package/dist/{cli-er3a4bb0.js → cli-15429qdw.js} +6 -1
- package/dist/{cli-e5dabkx0.js → cli-1cwhyvta.js} +4 -4
- package/dist/{cli-zsspvvm2.js → cli-1ybr6vw2.js} +237 -237
- package/dist/{cli-xpxde7rm.js → cli-2wv4kj0e.js} +60 -31
- package/dist/cli-34w2584r.js +530 -0
- package/dist/{cli-se2p6rkb.js → cli-38taxznr.js} +6 -6
- package/dist/{cli-9sbhdpvb.js → cli-3cgfyfzm.js} +14 -14
- package/dist/{cli-5n6e5yfn.js → cli-3zmdzfjf.js} +79 -74
- package/dist/{cli-3ty0t082.js → cli-43x36mty.js} +197 -8
- package/dist/{cli-ycrnynpw.js → cli-480nehnh.js} +29 -22
- package/dist/{cli-0258203w.js → cli-492e7ap5.js} +140 -20
- package/dist/{cli-3fj60etf.js → cli-497b685t.js} +3 -3
- package/dist/{cli-pxfxkx5m.js → cli-4bap00k0.js} +1 -1
- package/dist/{cli-w2wxd56v.js → cli-4bc8vmhm.js} +848 -770
- package/dist/{cli-aca5pz9f.js → cli-589599p9.js} +1 -1
- package/dist/{cli-t930g0xh.js → cli-5tnr64pm.js} +1 -1
- package/dist/{cli-jxg3s9ey.js → cli-65d93ves.js} +7 -7
- package/dist/{cli-6dpytdr2.js → cli-6x363v1z.js} +2 -2
- package/dist/{cli-dxak0fqd.js → cli-787ph852.js} +11 -11
- package/dist/{cli-793jvbsh.js → cli-7bv8nckk.js} +16 -11
- package/dist/{cli-zyxs93y9.js → cli-7jcc9y1r.js} +3 -3
- package/dist/{cli-f1am9szv.js → cli-87t2gstf.js} +1 -1
- package/dist/{cli-9aryf9tv.js → cli-95m51ztz.js} +1 -1
- package/dist/{cli-4w4fmq9x.js → cli-9w49enmh.js} +2 -2
- package/dist/{cli-v69vk5h0.js → cli-9y5b02vr.js} +13 -13
- package/dist/{cli-x23me2mg.js → cli-a1rrkrb4.js} +1 -1
- package/dist/{cli-psrqtw2m.js → cli-a3pkfpqs.js} +2 -2
- package/dist/{cli-h0rgxd24.js → cli-a4ajmfvp.js} +6 -6
- package/dist/{cli-ygrbmjja.js → cli-aw8bb6sf.js} +6 -6
- package/dist/{cli-g74vpjp2.js → cli-brm3et47.js} +55 -22
- package/dist/{cli-czkae1fp.js → cli-c5ddbdfj.js} +9 -9
- package/dist/{cli-114fvtmj.js → cli-c79a9zrc.js} +1 -1
- package/dist/{cli-49n9f49x.js → cli-dx3dz0ms.js} +3 -3
- package/dist/{cli-6dp3ydxa.js → cli-e07exmsb.js} +18 -14
- package/dist/cli-et1bbwqf.js +13 -0
- package/dist/{cli-yazx6hap.js → cli-f3s9dry0.js} +14 -14
- package/dist/{cli-t8d349cy.js → cli-f4wj0s3m.js} +3 -3
- package/dist/{cli-d6n0thxw.js → cli-f64gdfxc.js} +1 -1
- package/dist/{cli-pwfsqc2x.js → cli-fyd58xgb.js} +55 -55
- package/dist/{cli-7dm2zqy2.js → cli-g0j14czv.js} +2 -2
- package/dist/{cli-b0p7rfnd.js → cli-g2p9bd1z.js} +14 -14
- package/dist/{cli-z905tvmm.js → cli-g814jbst.js} +2 -2
- package/dist/{cli-5dsbcjjw.js → cli-ghexzd2d.js} +970 -970
- package/dist/{cli-jvv0g8bh.js → cli-gpt9kf01.js} +15 -15
- package/dist/{cli-rgrfzg8z.js → cli-grt6qv91.js} +380 -380
- package/dist/{cli-wz9115x0.js → cli-gtafvdy0.js} +8 -8
- package/dist/{cli-q5dzzak0.js → cli-gy07xk4s.js} +2 -2
- package/dist/{cli-sy7jk3tx.js → cli-h0djenzm.js} +2 -2
- package/dist/{cli-nrkkknat.js → cli-h37gbjbf.js} +2 -281
- package/dist/{cli-jevgrb4w.js → cli-h39xxnq6.js} +1200 -491
- package/dist/{cli-gz9sbyk3.js → cli-jepmgn7r.js} +1 -1
- package/dist/{cli-ccf9vy7q.js → cli-jmvk6et8.js} +7 -7
- package/dist/{cli-2rk0cx7s.js → cli-jxj92gkt.js} +51 -41
- package/dist/{cli-bqw0mt1n.js → cli-k46t4664.js} +18 -3
- package/dist/{cli-50vbt00w.js → cli-m07313tr.js} +1153 -696
- package/dist/{cli-4j2mrzag.js → cli-mkq1rk7b.js} +1 -1
- package/dist/{cli-1z7048dy.js → cli-mnm7w46e.js} +1 -1
- package/dist/{cli-kd1ck4rx.js → cli-mp9sg4cg.js} +14 -8
- package/dist/{cli-jbcva0xj.js → cli-mrammd8c.js} +60 -35
- package/dist/cli-nanaxrz6.js +27 -0
- package/dist/{cli-p9swy5t3.js → cli-pq2ee5ja.js} +8 -6
- package/dist/{cli-2wadx7p2.js → cli-pt43pdp1.js} +2 -2
- package/dist/{cli-7sgrxg9a.js → cli-q6d0vvey.js} +4 -4
- package/dist/{cli-k9qkf1hw.js → cli-qf9kpsve.js} +9 -9
- package/dist/cli-qh4sqfws.js +15 -0
- package/dist/{cli-e15jhafb.js → cli-qntkxysp.js} +14 -14
- package/dist/{cli-sajgpkqg.js → cli-qs9hhsvb.js} +1723 -325
- package/dist/{cli-z2zcxes1.js → cli-qt5bt3vk.js} +1 -1
- package/dist/{cli-wx82tw1k.js → cli-qtekrty1.js} +3 -3
- package/dist/{cli-g1re8r05.js → cli-rh6f3s9n.js} +3 -3
- package/dist/{cli-n0krnc6d.js → cli-rzhcrw2p.js} +2 -2
- package/dist/{cli-gecy3z2s.js → cli-snw62ze5.js} +4 -4
- package/dist/{cli-n6h8qt8n.js → cli-snz3p4yf.js} +15 -10
- package/dist/{cli-r6kqqbj0.js → cli-tkf8n6cw.js} +11 -11
- package/dist/{cli-4rkfg1wx.js → cli-tkrr24mz.js} +14 -9
- package/dist/{cli-9dr5qzc0.js → cli-tv9f1kyb.js} +54 -43
- package/dist/{cli-gm9cbhbq.js → cli-vtz6yj3v.js} +28 -9
- package/dist/{cli-2f07m0xr.js → cli-wf86d5t7.js} +1 -1
- package/dist/{cli-7zd05xb4.js → cli-whrvct19.js} +45 -45
- package/dist/{cli-ap1czx8f.js → cli-wrrea8xm.js} +3 -3
- package/dist/{cli-57khth04.js → cli-xmyqv00z.js} +120 -4
- package/dist/{cli-cwy5hqbq.js → cli-yjmk7tzc.js} +1 -1
- package/dist/{cli-6pcz9h15.js → cli-zykjrwcx.js} +180 -394
- package/dist/cli.js +45 -45
- package/dist/{codex-adapter-htjkn22b.js → codex-adapter-hsq6mz3m.js} +21 -19
- package/dist/{codex-hook-hq54t9ft.js → codex-hook-8c500gq8.js} +8 -7
- package/dist/{codex-login-z6yhbkmk.js → codex-login-x7603481.js} +3 -3
- package/dist/{codex-session-runner-wjfc7smz.js → codex-session-runner-c1x3x143.js} +15 -13
- package/dist/{commands-xhrfwqsk.js → commands-rwtddtst.js} +11 -9
- package/dist/{db-anvwb22f.js → db-j2b355vz.js} +458 -444
- package/dist/{devin-adapter-v1sarqtw.js → devin-adapter-8qmhqpy3.js} +3 -3
- package/dist/{devtools-2y1r7yqk.js → devtools-j2rnj8w7.js} +4 -4
- package/dist/{e2b-jdkwemv2.js → e2b-znpx78eg.js} +16 -16
- package/dist/{es5-vjgtkgp6.js → es5-fmqrjzy3.js} +2 -2
- package/dist/{event-bus-axn823e9.js → event-bus-n8sb35pw.js} +4 -4
- package/dist/{getMachineId-bsd-6tc9wxdj.js → getMachineId-bsd-wpzbhkm6.js} +4 -4
- package/dist/{getMachineId-darwin-sjt9sgnc.js → getMachineId-darwin-45zabjy0.js} +4 -4
- package/dist/{getMachineId-linux-v5n18y9p.js → getMachineId-linux-warnp5pd.js} +3 -3
- package/dist/{getMachineId-unsupported-yrjyqw3d.js → getMachineId-unsupported-5spent2a.js} +3 -3
- package/dist/{getMachineId-win-w3r8063c.js → getMachineId-win-v4bvcw7a.js} +4 -4
- package/dist/{google-generative-ai-hysrd8qx.js → google-generative-ai-b0wzss55.js} +17 -14
- package/dist/{google-vertex-p5arrga0.js → google-vertex-e8q4dpya.js} +18 -15
- package/dist/{handlers-b9kbc621.js → handlers-hchgrxkh.js} +32 -29
- package/dist/{hook-xkvn6c5h.js → hook-p49egqc0.js} +66 -52
- package/dist/hook-spb00w76.js +34 -0
- package/dist/{http-9xh6ta4r.js → http-nh14kkms.js} +663 -181
- package/dist/index-1qthq7vc.js +6 -0
- package/dist/{index-0g68f0p6.js → index-20xqmn3v.js} +3 -3
- package/dist/{index-vdkr5z2w.js → index-3e03k6e4.js} +114 -114
- package/dist/{index-ywds4812.js → index-4cbyhq2g.js} +43 -41
- package/dist/index-67pzqfrb.js +36 -0
- package/dist/{index-bccrkdkn.js → index-7m8yxkw5.js} +16 -16
- package/dist/{index-eaxyqcmj.js → index-dvsk64sm.js} +163 -83
- package/dist/{index-dqkpnmqm.js → index-e19s2m8k.js} +18 -18
- package/dist/{index-j30k5zxn.js → index-emvxcy98.js} +16 -16
- package/dist/{index-7ndw6ecy.js → index-gqnmr60d.js} +9 -9
- package/dist/{index-9znhar3x.js → index-j02xvjtd.js} +184 -185
- package/dist/{index-1s2442yw.js → index-ns5kksc1.js} +7 -7
- package/dist/{index-dpy2hth8.js → index-pdxc8kfh.js} +71 -71
- package/dist/{index-z1m7pw0v.js → index-ptcqm8bc.js} +107 -107
- package/dist/{index-070v4eyb.js → index-pyp7rexm.js} +5 -6
- package/dist/{index-86znjz1p.js → index-shne41sd.js} +13 -13
- package/dist/{index-2qn2qndv.js → index-t36q2v4t.js} +183 -183
- package/dist/index-tcnvv8w6.js +7 -0
- package/dist/index-w91qbfv1.js +7 -0
- package/dist/{index-fzc0mwvj.js → index-yqweff5n.js} +32 -32
- package/dist/index-yrfphye1.js +39 -0
- package/dist/{keepalive-vc7s2aa6.js → keepalive-9k51nqhc.js} +21 -15
- package/dist/lead-2xq3dxbz.js +88 -0
- package/dist/maintenance-0c0g6nym.js +28 -0
- package/dist/mistral-conversations-2njwdwhj.js +717 -0
- package/dist/{multipart-parser-qaktc7p8.js → multipart-parser-6gftesw0.js} +2 -2
- package/dist/{oauth-refresh-sweep-yecgjpk4.js → oauth-refresh-sweep-273a64r2.js} +14 -12
- package/dist/{onboard-xj0f73f9.js → onboard-tsv9wwhz.js} +12 -12
- package/dist/{openai-codex-responses-5g27pd6f.js → openai-codex-responses-kt84eq86.js} +26 -26
- package/dist/{openai-completions-3vkmfz2a.js → openai-completions-mrypq7qp.js} +17 -16
- package/dist/{openai-responses-dg4t7j7a.js → openai-responses-qhrk21ez.js} +20 -17
- package/dist/{opencode-adapter-1gm38aba.js → opencode-adapter-rar9676j.js} +13 -11
- package/dist/{openrouter-images-g3gm8931.js → openrouter-images-684fysx9.js} +5 -5
- package/dist/{otel-impl-nxg0n0b3.js → otel-impl-wp1mfzd2.js} +752 -537
- package/dist/{photon_rs-ky7dj5qw.js → photon_rs-8dwt2pzy.js} +581 -581
- package/dist/{pi-messages-tqj8q6b9.js → pi-messages-txp9f97r.js} +7 -7
- package/dist/{pi-mono-adapter-4g5kby31.js → pi-mono-adapter-yz47kk8e.js} +1910 -1180
- package/dist/pricing-refresh-jw1yw2fn.js +22 -0
- package/dist/rbac-roles-dg964c8p.js +32 -0
- package/dist/{rbac-roles-1hcxdtg7.js → rbac-roles-p53cg5cv.js} +19 -17
- package/dist/{registry-02cy9z5z.js → registry-mh12y17v.js} +4 -4
- package/dist/render-v2-56vn2rk9.js +36 -0
- package/dist/seed-pricing-52xx6z63.js +19 -0
- package/dist/{setup-46xtgq3c.js → setup-e8gp79sy.js} +7 -7
- package/dist/token-util-zy908s1a.js +6 -0
- package/dist/{token-fxkn2zf2.js → token-xg5711x5.js} +4 -4
- package/dist/worker-s17f1g46.js +88 -0
- package/dist/{x-6mg4kfpe.js → x-xkfh0w0v.js} +5 -5
- package/openapi.json +566 -22
- package/package.json +6 -6
- package/src/be/budget-refusal-notify.ts +14 -7
- package/src/be/db-queries/task-artifacts.ts +182 -0
- package/src/be/db.ts +834 -171
- package/src/be/events.ts +5 -0
- package/src/be/migrations/131_session_logs_created_at_index.sql +2 -0
- package/src/be/migrations/132_multi_runtime_instances.sql +44 -0
- package/src/be/migrations/133_workflow_run_trigger_type.sql +12 -0
- package/src/be/migrations/135_backfill_task_pull_request_attachments.sql +228 -0
- package/src/be/migrations/136_task_requester_provenance.sql +37 -0
- package/src/be/migrations/137_memory_retrieval_composite_index.sql +1 -0
- package/src/be/migrations/runner.ts +17 -11
- package/src/be/multi-runtime.ts +430 -0
- package/src/be/scripts/extract-schema.ts +3 -1
- package/src/be/scripts/typecheck.ts +6 -2
- package/src/be/seed-prompt-templates.ts +25 -2
- package/src/be/seed-skills/index.ts +7 -0
- package/src/be/steering.ts +1 -1
- package/src/be/swarm-config-guard.ts +18 -0
- package/src/commands/credential-wait.ts +54 -0
- package/src/commands/onboard/steps/core-credentials.tsx +1 -1
- package/src/commands/onboard/steps/custom-templates.tsx +1 -1
- package/src/commands/onboard/steps/harness-credentials.tsx +1 -1
- package/src/commands/onboard/steps/health-check.tsx +1 -1
- package/src/commands/onboard/steps/start.tsx +1 -1
- package/src/commands/profile-sync-audit.ts +56 -0
- package/src/commands/profile-sync.ts +287 -15
- package/src/commands/provider-credentials.ts +46 -19
- package/src/commands/runner.ts +199 -33
- package/src/commands/templates.ts +22 -0
- package/src/github/handlers.ts +55 -9
- package/src/heartbeat/heartbeat.ts +109 -17
- package/src/hooks/hook.ts +49 -33
- package/src/http/active-sessions.ts +11 -1
- package/src/http/agents.ts +261 -30
- package/src/http/all-routes.ts +1 -0
- package/src/http/config.ts +13 -2
- package/src/http/core.ts +102 -4
- package/src/http/db-query-bounded.ts +313 -0
- package/src/http/db-query-shared.ts +249 -0
- package/src/http/db-query.ts +54 -42
- package/src/http/events.ts +2 -0
- package/src/http/index.ts +23 -2
- package/src/http/mcp-bridge.ts +37 -3
- package/src/http/mcp.ts +12 -0
- package/src/http/memory.ts +13 -2
- package/src/http/openapi.ts +1 -0
- package/src/http/poll.ts +70 -27
- package/src/http/prompt-templates.ts +36 -13
- package/src/http/route-def.ts +43 -9
- package/src/http/schedules.ts +2 -2
- package/src/http/scripts.ts +10 -1
- package/src/http/session-data.ts +44 -0
- package/src/http/tasks.ts +2 -2
- package/src/http/users.ts +74 -52
- package/src/http/webhooks.ts +5 -2
- package/src/http/workflows.ts +1 -4
- package/src/integrations/kapso/inbound.ts +1 -1
- package/src/jira/outbound.ts +39 -8
- package/src/jira/webhook-lifecycle.ts +13 -2
- package/src/linear/outbound.ts +43 -10
- package/src/oauth/keepalive.ts +13 -2
- package/src/prompts/base-prompt.ts +1 -1
- package/src/prompts/default-drift.ts +21 -0
- package/src/prompts/session-templates.ts +56 -7
- package/src/providers/claude-adapter.ts +6 -0
- package/src/providers/codex-adapter.ts +6 -0
- package/src/providers/opencode-adapter.ts +6 -0
- package/src/providers/pi-mono-adapter.ts +8 -0
- package/src/providers/pricing-sources.md +24 -0
- package/src/queue-stall-alarm.ts +216 -0
- package/src/rbac/legacy-policy.ts +3 -0
- package/src/rbac/permissions.ts +12 -0
- package/src/scheduler/scheduler.ts +7 -0
- package/src/script-workflows/executor.ts +2 -1
- package/src/scripts-runtime/executors/native.ts +2 -1
- package/src/scripts-runtime/executors/types.ts +5 -0
- package/src/scripts-runtime/loader.ts +5 -0
- package/src/scripts-runtime/sdk-allowlist.ts +3 -0
- package/src/scripts-runtime/swarm-config.ts +8 -0
- package/src/scripts-runtime/swarm-sdk.ts +7 -0
- package/src/scripts-runtime/types/stdlib.d.ts +4 -0
- package/src/scripts-runtime/types/swarm-sdk.d.ts +4 -0
- package/src/server.ts +6 -0
- package/src/slack/channel-join.ts +22 -3
- package/src/slack/channel-lifecycle.ts +114 -0
- package/src/tests/budget-claim-gate.test.ts +20 -0
- package/src/tests/claude-adapter.test.ts +32 -0
- package/src/tests/codex-adapter.test.ts +30 -0
- package/src/tests/create-task-validation.test.ts +128 -0
- package/src/tests/credential-wait.test.ts +67 -1
- package/src/tests/db-query.test.ts +711 -2
- package/src/tests/heartbeat-checklist.test.ts +28 -0
- package/src/tests/http-api-integration.test.ts +81 -0
- package/src/tests/http-users.test.ts +166 -1
- package/src/tests/identity-field-budget.test.ts +176 -0
- package/src/tests/mcp-tools-user.test.ts +34 -0
- package/src/tests/mcp-user-route.test.ts +17 -0
- package/src/tests/metrics-http.test.ts +44 -0
- package/src/tests/migration-failure.test.ts +86 -0
- package/src/tests/multi-runtime-registration.test.ts +2810 -0
- package/src/tests/openapi-response-contract.test.ts +24 -0
- package/src/tests/openapi-route-headers.test.ts +83 -0
- package/src/tests/opencode-adapter.test.ts +40 -0
- package/src/tests/outbound-listener-rejection.test.ts +138 -0
- package/src/tests/pi-mono-adapter.test.ts +98 -0
- package/src/tests/preload.ts +2 -0
- package/src/tests/profile-sync-warning.test.ts +277 -0
- package/src/tests/profile-sync.test.ts +232 -6
- package/src/tests/prompt-template-resolver.test.ts +177 -6
- package/src/tests/prompt-template-session.test.ts +39 -3
- package/src/tests/queue-stall-alarm.test.ts +226 -0
- package/src/tests/rbac-charact-slack.test.ts +29 -0
- package/src/tests/rbac-engine.test.ts +3 -0
- package/src/tests/requester-comms.test.ts +32 -0
- package/src/tests/runner-requester-profile.test.ts +38 -0
- package/src/tests/schedule-target-type.test.ts +38 -0
- package/src/tests/script-connections.test.ts +13 -1
- package/src/tests/scripts-runtime-identity.test.ts +375 -0
- package/src/tests/scripts-runtime.test.ts +4 -3
- package/src/tests/sdk-allowlist.test.ts +47 -0
- package/src/tests/send-task-requested-by.test.ts +9 -0
- package/src/tests/session-costs.test.ts +506 -1
- package/src/tests/shutdown-error-scrubbing.test.ts +92 -0
- package/src/tests/slack-channel-lifecycle.test.ts +241 -0
- package/src/tests/slack-render-v2.test.ts +43 -0
- package/src/tests/steering-core.test.ts +28 -0
- package/src/tests/swarm-config-reserved-keys.test.ts +22 -0
- package/src/tests/task-artifacts.test.ts +386 -0
- package/src/tests/task-attachments-schema.test.ts +17 -1
- package/src/tests/task-completion-idempotency.test.ts +57 -0
- package/src/tests/task-pull-request-backfill-migration.test.ts +321 -0
- package/src/tests/tool-annotations.test.ts +4 -0
- package/src/tests/update-profile-api.test.ts +67 -39
- package/src/tests/update-profile-auth.test.ts +48 -4
- package/src/tests/user-attribution-migration.test.ts +54 -0
- package/src/tests/user-identity.test.ts +72 -0
- package/src/tests/workflow-async-v2.test.ts +39 -1
- package/src/tests/workflow-http-v2.test.ts +3 -2
- package/src/tests/workflow-mcp-trigger-schema.test.ts +52 -3
- package/src/tests/workflow-retry-v2.test.ts +45 -1
- package/src/tools/db-query.ts +18 -8
- package/src/tools/get-task-details.ts +24 -3
- package/src/tools/manage-user.ts +36 -3
- package/src/tools/poll-task.ts +93 -14
- package/src/tools/script-common.ts +5 -0
- package/src/tools/send-task.ts +1 -4
- package/src/tools/slack-archive-channel.ts +70 -0
- package/src/tools/slack-create-channel.ts +74 -0
- package/src/tools/slack-invite-to-channel.ts +78 -0
- package/src/tools/store-progress.ts +13 -2
- package/src/tools/swarm-config/delete-config.ts +9 -0
- package/src/tools/swarm-config/set-config.ts +3 -2
- package/src/tools/task-action.ts +30 -0
- package/src/tools/task-tool-ctx.ts +8 -1
- package/src/tools/tool-config.ts +4 -1
- package/src/tools/update-profile.ts +16 -21
- package/src/tools/utils.ts +5 -0
- package/src/tools/workflows/trigger-workflow.ts +7 -1
- package/src/types.ts +165 -1
- package/src/utils/github-pull-request.ts +76 -0
- package/src/utils/identity-field-budget.ts +73 -0
- package/src/utils/multi-runtime.ts +20 -0
- package/src/utils/requester-comms.ts +24 -0
- package/src/workflows/engine.ts +22 -2
- package/src/workflows/resume.ts +19 -11
- package/src/workflows/retry-poller.ts +1 -0
- package/src/workflows/triggers.ts +4 -0
- package/templates/skills/db-query-guidance/config.json +14 -0
- package/templates/skills/db-query-guidance/content.md +57 -0
- package/dist/app-5da78bd4.js +0 -26
- package/dist/cli-3te4jdkm.js +0 -225
- package/dist/cli-bmze986d.js +0 -7
- package/dist/cli-kh3ba2zf.js +0 -607
- package/dist/hook-cgk4wxmx.js +0 -31
- package/dist/index-25wjsdv2.js +0 -34
- package/dist/index-76at2ymp.js +0 -7
- package/dist/index-hase6zbe.js +0 -6
- package/dist/index-vg4snay4.js +0 -36
- package/dist/index-vy8edt27.js +0 -7
- package/dist/lead-r2yqfmx7.js +0 -85
- package/dist/maintenance-mw70k468.js +0 -26
- package/dist/mistral-conversations-81fwav0j.js +0 -30578
- package/dist/otel-nqa12wf3.js +0 -3149
- package/dist/pricing-refresh-2cn6effr.js +0 -20
- package/dist/rbac-roles-vynday5g.js +0 -30
- package/dist/render-v2-tc0bh8kk.js +0 -34
- package/dist/seed-pricing-8kceb43f.js +0 -17
- package/dist/token-util-pqyc8kng.js +0 -6
- package/dist/worker-qrbz6hmv.js +0 -85
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import {
|
|
2
2
|
renderSteeringDelivery
|
|
3
|
-
} from "./cli-
|
|
3
|
+
} from "./cli-87t2gstf.js";
|
|
4
4
|
import {
|
|
5
5
|
checkCodexCredentials
|
|
6
|
-
} from "./cli-
|
|
6
|
+
} from "./cli-7bv8nckk.js";
|
|
7
7
|
import {
|
|
8
8
|
checkClaudeManagedCredentials
|
|
9
|
-
} from "./cli-
|
|
9
|
+
} from "./cli-gtafvdy0.js";
|
|
10
10
|
import {
|
|
11
11
|
checkDevinCredentials
|
|
12
12
|
} from "./cli-9b13ggd1.js";
|
|
13
13
|
import {
|
|
14
14
|
checkOpencodeCredentials
|
|
15
|
-
} from "./cli-
|
|
15
|
+
} from "./cli-snz3p4yf.js";
|
|
16
16
|
import {
|
|
17
17
|
checkClaudeCredentials
|
|
18
|
-
} from "./cli-
|
|
18
|
+
} from "./cli-mp9sg4cg.js";
|
|
19
19
|
import {
|
|
20
20
|
MAX_RATE_LIMIT_RESET_MS,
|
|
21
21
|
isCodexCreditsExhaustedMessage,
|
|
22
22
|
isRateLimitMessage,
|
|
23
23
|
parseRateLimitResetTime,
|
|
24
24
|
resolveCodexCreditsExhaustedCooldownMs
|
|
25
|
-
} from "./cli-
|
|
25
|
+
} from "./cli-a3pkfpqs.js";
|
|
26
26
|
import {
|
|
27
27
|
getContextWindowSize
|
|
28
28
|
} from "./cli-cw70hymf.js";
|
|
@@ -35,7 +35,7 @@ import {
|
|
|
35
35
|
withSpan,
|
|
36
36
|
withSpanContext,
|
|
37
37
|
writeSkillsToFilesystem
|
|
38
|
-
} from "./cli-
|
|
38
|
+
} from "./cli-h39xxnq6.js";
|
|
39
39
|
import {
|
|
40
40
|
authJsonToCredentialSelection,
|
|
41
41
|
credentialsToAuthJson,
|
|
@@ -44,10 +44,10 @@ import {
|
|
|
44
44
|
import {
|
|
45
45
|
ensure,
|
|
46
46
|
initialize
|
|
47
|
-
} from "./cli-
|
|
47
|
+
} from "./cli-480nehnh.js";
|
|
48
48
|
import {
|
|
49
49
|
validateJsonSchema
|
|
50
|
-
} from "./cli-
|
|
50
|
+
} from "./cli-mrammd8c.js";
|
|
51
51
|
import {
|
|
52
52
|
getOpenRouterBaseUrl
|
|
53
53
|
} from "./cli-3dpj7atn.js";
|
|
@@ -57,14 +57,15 @@ import {
|
|
|
57
57
|
import {
|
|
58
58
|
contentSha256,
|
|
59
59
|
init_profile_sync,
|
|
60
|
+
prependProfileSyncRejectionBanner,
|
|
60
61
|
resolveClaudeMdPath,
|
|
61
62
|
syncProfileFilesToServer,
|
|
62
63
|
writeIdentityBaselines,
|
|
63
64
|
writeProfileFileFromDb
|
|
64
|
-
} from "./cli-
|
|
65
|
+
} from "./cli-492e7ap5.js";
|
|
65
66
|
import {
|
|
66
67
|
taskAttachmentDisplayUrl
|
|
67
|
-
} from "./cli-
|
|
68
|
+
} from "./cli-5tnr64pm.js";
|
|
68
69
|
import {
|
|
69
70
|
ProviderNameSchema,
|
|
70
71
|
generateDefaultClaudeMd,
|
|
@@ -74,364 +75,44 @@ import {
|
|
|
74
75
|
initTelemetry,
|
|
75
76
|
init_defaults,
|
|
76
77
|
init_telemetry,
|
|
77
|
-
init_templates,
|
|
78
78
|
init_types,
|
|
79
79
|
resolveTaskModelSelection,
|
|
80
80
|
telemetry
|
|
81
|
-
} from "./cli-
|
|
81
|
+
} from "./cli-m07313tr.js";
|
|
82
|
+
import {
|
|
83
|
+
getBasePrompt,
|
|
84
|
+
init_base_prompt,
|
|
85
|
+
init_templates
|
|
86
|
+
} from "./cli-34w2584r.js";
|
|
82
87
|
import {
|
|
83
88
|
configureHttpResolver,
|
|
84
89
|
init_resolver,
|
|
85
|
-
init_session_templates,
|
|
86
90
|
init_steering_enabled,
|
|
87
91
|
init_template,
|
|
88
92
|
interpolate,
|
|
89
93
|
isSteeringEnabled,
|
|
90
94
|
resolveTemplateAsync
|
|
91
|
-
} from "./cli-
|
|
95
|
+
} from "./cli-2wv4kj0e.js";
|
|
92
96
|
import {
|
|
93
97
|
getMcpBaseUrl,
|
|
94
98
|
init_constants
|
|
95
|
-
} from "./cli-
|
|
99
|
+
} from "./cli-a1rrkrb4.js";
|
|
96
100
|
import {
|
|
97
101
|
init_credentials,
|
|
98
102
|
resolveCredentialPools
|
|
99
|
-
} from "./cli-
|
|
103
|
+
} from "./cli-qt5bt3vk.js";
|
|
100
104
|
import {
|
|
101
105
|
init_secret_scrubber,
|
|
102
106
|
scrubSecrets
|
|
103
|
-
} from "./cli-
|
|
107
|
+
} from "./cli-mkq1rk7b.js";
|
|
104
108
|
import {
|
|
105
109
|
__require
|
|
106
|
-
} from "./cli-
|
|
110
|
+
} from "./cli-pq2ee5ja.js";
|
|
107
111
|
|
|
108
112
|
// src/commands/runner.ts
|
|
109
113
|
import { existsSync, statSync } from "node:fs";
|
|
110
114
|
import { mkdir, readFile, stat, writeFile } from "node:fs/promises";
|
|
111
|
-
|
|
112
|
-
// src/prompts/base-prompt.ts
|
|
113
|
-
init_steering_enabled();
|
|
114
|
-
init_resolver();
|
|
115
|
-
init_session_templates();
|
|
116
|
-
var BOOTSTRAP_MAX_CHARS = 20000;
|
|
117
|
-
var BOOTSTRAP_TOTAL_MAX_CHARS = 120000;
|
|
118
|
-
var REPO_CLAUDE_MD_MAX_CHARS = 12000;
|
|
119
|
-
var truncationNotice = (file) => `
|
|
120
|
-
|
|
121
|
-
[...truncated, see /workspace/${file} for full content]
|
|
122
|
-
`;
|
|
123
|
-
function areSlackPromptToolsEnabled(env = process.env) {
|
|
124
|
-
const slackDisable = env.SLACK_DISABLE;
|
|
125
|
-
if (slackDisable === "true" || slackDisable === "1")
|
|
126
|
-
return false;
|
|
127
|
-
return Boolean(env.SLACK_BOT_TOKEN && env.SLACK_APP_TOKEN);
|
|
128
|
-
}
|
|
129
|
-
var getBasePrompt = async (args) => {
|
|
130
|
-
const { role, agentId, swarmUrl, traits } = args;
|
|
131
|
-
const {
|
|
132
|
-
hasMcp = true,
|
|
133
|
-
hasLocalEnvironment: hasLocalEnv = true,
|
|
134
|
-
nativeSkillDiscovery = true
|
|
135
|
-
} = traits ?? {};
|
|
136
|
-
const steerModes = traits?.steerModes ?? [];
|
|
137
|
-
const vars = { role, agentId, swarmUrl };
|
|
138
|
-
let compositeEventType;
|
|
139
|
-
if (!hasMcp) {
|
|
140
|
-
compositeEventType = "system.session.worker.remote";
|
|
141
|
-
} else if (args.provider === "pi") {
|
|
142
|
-
compositeEventType = role === "lead" ? "system.session.lead.pi" : "system.session.worker.pi";
|
|
143
|
-
} else if (role === "lead") {
|
|
144
|
-
compositeEventType = "system.session.lead";
|
|
145
|
-
} else {
|
|
146
|
-
compositeEventType = "system.session.worker";
|
|
147
|
-
}
|
|
148
|
-
const compositeResult = await resolveTemplateAsync(compositeEventType, vars);
|
|
149
|
-
let prompt = compositeResult.text;
|
|
150
|
-
const scriptsOnly = args.scriptsOnly ?? process.env.SCRIPTS_ONLY_MCP === "true";
|
|
151
|
-
const scriptsOnlyMode = hasMcp && scriptsOnly;
|
|
152
|
-
if (scriptsOnlyMode) {
|
|
153
|
-
const scriptsOnlyResult = await resolveTemplateAsync("system.agent.scripts_only_mode", {});
|
|
154
|
-
prompt += `
|
|
155
|
-
${scriptsOnlyResult.text}`;
|
|
156
|
-
}
|
|
157
|
-
const slackPromptToolsEnabled = areSlackPromptToolsEnabled();
|
|
158
|
-
const serverHasCapability = (cap, whenUnknown) => args.serverCapabilities ? args.serverCapabilities.includes(cap) : whenUnknown;
|
|
159
|
-
if (hasMcp && slackPromptToolsEnabled && !scriptsOnlyMode && serverHasCapability("slack", true)) {
|
|
160
|
-
const slackResult = await resolveTemplateAsync("system.agent.slack", {});
|
|
161
|
-
prompt += slackResult.text;
|
|
162
|
-
}
|
|
163
|
-
if (role !== "lead" && args.slackContext && hasMcp && slackPromptToolsEnabled && (scriptsOnlyMode || serverHasCapability("slack", true))) {
|
|
164
|
-
const slackResult = await resolveTemplateAsync(scriptsOnlyMode ? "system.agent.scripts_only_mode.slack" : "system.agent.worker.slack", {
|
|
165
|
-
slackChannelId: args.slackContext.channelId,
|
|
166
|
-
slackThreadTs: args.slackContext.threadTs ?? ""
|
|
167
|
-
});
|
|
168
|
-
prompt += slackResult.text;
|
|
169
|
-
}
|
|
170
|
-
if (hasMcp && !scriptsOnlyMode && serverHasCapability("messaging", true)) {
|
|
171
|
-
const messagingResult = await resolveTemplateAsync("system.agent.messaging", {});
|
|
172
|
-
prompt += messagingResult.text;
|
|
173
|
-
}
|
|
174
|
-
if (hasMcp && isSteeringEnabled() && steerModes.length > 0 && !scriptsOnlyMode && serverHasCapability("core", true)) {
|
|
175
|
-
const steeringResult = await resolveTemplateAsync("system.agent.steering", {});
|
|
176
|
-
prompt += steeringResult.text;
|
|
177
|
-
}
|
|
178
|
-
if (!hasLocalEnv) {
|
|
179
|
-
prompt += `
|
|
180
|
-
|
|
181
|
-
## Your Identity
|
|
182
|
-
|
|
183
|
-
`;
|
|
184
|
-
if (args.name) {
|
|
185
|
-
prompt += `**Name:** ${args.name}
|
|
186
|
-
`;
|
|
187
|
-
if (args.description) {
|
|
188
|
-
prompt += `**Description:** ${args.description}
|
|
189
|
-
`;
|
|
190
|
-
}
|
|
191
|
-
prompt += `
|
|
192
|
-
`;
|
|
193
|
-
}
|
|
194
|
-
prompt += `You are part of an agent swarm managed by the Desplega platform. `;
|
|
195
|
-
prompt += `You receive tasks from the swarm's lead agent and execute them independently. `;
|
|
196
|
-
prompt += `Focus on quality work and clear communication of results.
|
|
197
|
-
`;
|
|
198
|
-
} else if (args.soulMd || args.identityMd || args.name) {
|
|
199
|
-
prompt += `
|
|
200
|
-
|
|
201
|
-
## Your Identity
|
|
202
|
-
|
|
203
|
-
`;
|
|
204
|
-
if (args.name) {
|
|
205
|
-
prompt += `**Name:** ${args.name}
|
|
206
|
-
`;
|
|
207
|
-
if (args.description) {
|
|
208
|
-
prompt += `**Description:** ${args.description}
|
|
209
|
-
`;
|
|
210
|
-
}
|
|
211
|
-
prompt += `
|
|
212
|
-
`;
|
|
213
|
-
}
|
|
214
|
-
if (args.soulMd) {
|
|
215
|
-
prompt += `${args.soulMd}
|
|
216
|
-
`;
|
|
217
|
-
}
|
|
218
|
-
if (args.identityMd) {
|
|
219
|
-
prompt += `${args.identityMd}
|
|
220
|
-
`;
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
if (hasMcp && args.skillsSummary && args.skillsSummary.length > 0) {
|
|
224
|
-
const discovery = "To browse the full catalog use the `skill-list` MCP tool, find one by intent with `skill-search`, and read a skill's content with `skill-get`.";
|
|
225
|
-
if (nativeSkillDiscovery) {
|
|
226
|
-
const count = args.skillsSummary.length;
|
|
227
|
-
const where = hasLocalEnv ? "Your harness loads them from its skills directory (each skill is a folder with a SKILL.md — e.g. ~/.claude/skills/, ~/.codex/skills/, ~/.pi/agent/skills/, ~/.opencode/skills/) and most harnesses surface them natively." : "This session has no local skills directory, so reach them through the MCP tools.";
|
|
228
|
-
prompt += `
|
|
229
|
-
|
|
230
|
-
## Installed Skills
|
|
231
|
-
|
|
232
|
-
You have ${count} skill${count === 1 ? "" : "s"} installed. ${where} ${discovery}
|
|
233
|
-
`;
|
|
234
|
-
} else {
|
|
235
|
-
const summaries = args.skillsSummary.map((s) => `- ${hasLocalEnv ? "/" : ""}${s.name}: ${s.description}`).join(`
|
|
236
|
-
`);
|
|
237
|
-
const howTo = hasLocalEnv ? "To use one, read its SKILL.md from your skills directory and follow its instructions." : "To use one, read its content with the `skill-get` MCP tool and follow its instructions.";
|
|
238
|
-
prompt += `
|
|
239
|
-
|
|
240
|
-
## Installed Skills
|
|
241
|
-
|
|
242
|
-
The following skills are available. ${howTo}
|
|
243
|
-
|
|
244
|
-
${summaries}
|
|
245
|
-
|
|
246
|
-
${discovery}
|
|
247
|
-
`;
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
if (hasMcp && args.mcpServersSummary) {
|
|
251
|
-
prompt += `
|
|
252
|
-
|
|
253
|
-
## Installed MCP Servers
|
|
254
|
-
|
|
255
|
-
The following MCP servers are configured for your use:
|
|
256
|
-
${args.mcpServersSummary}
|
|
257
|
-
`;
|
|
258
|
-
}
|
|
259
|
-
if (args.repoContext) {
|
|
260
|
-
prompt += `
|
|
261
|
-
|
|
262
|
-
## Repository Context
|
|
263
|
-
|
|
264
|
-
`;
|
|
265
|
-
if (args.repoContext.warning) {
|
|
266
|
-
prompt += `WARNING: ${args.repoContext.warning}
|
|
267
|
-
|
|
268
|
-
`;
|
|
269
|
-
}
|
|
270
|
-
if (hasLocalEnv) {
|
|
271
|
-
if (args.repoContext.claudeMd) {
|
|
272
|
-
prompt += `The following CLAUDE.md is from the repository cloned at \`${args.repoContext.clonePath}\`. `;
|
|
273
|
-
prompt += `**IMPORTANT: These instructions apply ONLY when working within the \`${args.repoContext.clonePath}\` directory.** `;
|
|
274
|
-
prompt += `Do NOT apply these rules to files outside that directory.
|
|
275
|
-
|
|
276
|
-
`;
|
|
277
|
-
prompt += `${truncateRepoClaudeMd(args.repoContext.claudeMd, args.repoContext.clonePath, REPO_CLAUDE_MD_MAX_CHARS)}
|
|
278
|
-
`;
|
|
279
|
-
} else if (!args.repoContext.warning) {
|
|
280
|
-
prompt += `Repository is cloned at \`${args.repoContext.clonePath}\` but has no CLAUDE.md file.
|
|
281
|
-
`;
|
|
282
|
-
}
|
|
283
|
-
if (args.repoContext.autoStashes && args.repoContext.autoStashes.length > 0) {
|
|
284
|
-
const stashes = args.repoContext.autoStashes.map((stash) => `- ${stash.ref}: ${stash.message}`).join(`
|
|
285
|
-
`);
|
|
286
|
-
prompt += `
|
|
287
|
-
Pending auto-stashed work exists in this repo:
|
|
288
|
-
${stashes}
|
|
289
|
-
Restore if relevant with \`git stash apply <ref>\` or \`git stash pop <ref>\`.
|
|
290
|
-
`;
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
const g = args.repoContext.guidelines;
|
|
294
|
-
if (g === null || g === undefined) {
|
|
295
|
-
prompt += `
|
|
296
|
-
### Repository Guidelines
|
|
297
|
-
|
|
298
|
-
No repository guidelines defined. If you need to push code, ask the lead or user to define guidelines first.
|
|
299
|
-
`;
|
|
300
|
-
} else {
|
|
301
|
-
const hasAnyContent = g.prChecks.length > 0 || g.mergeChecks.length > 0 || g.review.length > 0 || g.allowMerge;
|
|
302
|
-
if (hasAnyContent) {
|
|
303
|
-
prompt += `
|
|
304
|
-
### Repository Guidelines (MANDATORY)
|
|
305
|
-
|
|
306
|
-
`;
|
|
307
|
-
if (g.prChecks.length > 0) {
|
|
308
|
-
prompt += `**PR Checks — Run ALL before pushing code or creating a PR:**
|
|
309
|
-
`;
|
|
310
|
-
g.prChecks.forEach((check, i) => {
|
|
311
|
-
prompt += `${i + 1}. \`${check}\`
|
|
312
|
-
`;
|
|
313
|
-
});
|
|
314
|
-
prompt += `If ANY check fails, fix the issue before pushing. Do NOT push code with failing checks.
|
|
315
|
-
Do NOT use \`--no-verify\` or any flag that bypasses git hooks.
|
|
316
|
-
|
|
317
|
-
`;
|
|
318
|
-
}
|
|
319
|
-
prompt += `**Merge Policy:**
|
|
320
|
-
`;
|
|
321
|
-
prompt += `- Auto-merge: ${g.allowMerge ? "Allowed" : "Not allowed (default)"}
|
|
322
|
-
`;
|
|
323
|
-
if (g.mergeChecks.length > 0) {
|
|
324
|
-
prompt += `- Before merging, verify:
|
|
325
|
-
`;
|
|
326
|
-
g.mergeChecks.forEach((check) => {
|
|
327
|
-
prompt += ` - ${check}
|
|
328
|
-
`;
|
|
329
|
-
});
|
|
330
|
-
}
|
|
331
|
-
prompt += `
|
|
332
|
-
`;
|
|
333
|
-
if (g.review.length > 0) {
|
|
334
|
-
prompt += `**Review Guidance:**
|
|
335
|
-
`;
|
|
336
|
-
g.review.forEach((item) => {
|
|
337
|
-
prompt += `- ${item}
|
|
338
|
-
`;
|
|
339
|
-
});
|
|
340
|
-
prompt += `
|
|
341
|
-
`;
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
if (hasLocalEnv) {
|
|
347
|
-
let conditionalSuffix = "";
|
|
348
|
-
if (process.env.AGENT_FS_API_URL) {
|
|
349
|
-
const sharedOrgId = process.env.AGENT_FS_SHARED_ORG_ID || "YOUR_SHARED_ORG_ID";
|
|
350
|
-
const agentFsResult = await resolveTemplateAsync("system.agent.agent_fs", {
|
|
351
|
-
agentId,
|
|
352
|
-
sharedOrgId
|
|
353
|
-
});
|
|
354
|
-
conditionalSuffix += agentFsResult.text;
|
|
355
|
-
}
|
|
356
|
-
if (args.serverCapabilities ? args.serverCapabilities.includes("services") : !args.capabilities || args.capabilities.includes("services")) {
|
|
357
|
-
const servicesResult = await resolveTemplateAsync("system.agent.services", {
|
|
358
|
-
agentId,
|
|
359
|
-
swarmUrl
|
|
360
|
-
});
|
|
361
|
-
conditionalSuffix += servicesResult.text;
|
|
362
|
-
}
|
|
363
|
-
if (!args.capabilities || args.capabilities.includes("artifacts")) {
|
|
364
|
-
const artifactsResult = await resolveTemplateAsync("system.agent.artifacts", {});
|
|
365
|
-
conditionalSuffix += artifactsResult.text;
|
|
366
|
-
}
|
|
367
|
-
if (serverHasCapability("pages", !args.capabilities || args.capabilities.includes("pages"))) {
|
|
368
|
-
const appsResult = await resolveTemplateAsync("system.agent.apps", {});
|
|
369
|
-
conditionalSuffix += appsResult.text;
|
|
370
|
-
}
|
|
371
|
-
if (args.capabilities) {
|
|
372
|
-
conditionalSuffix += `
|
|
373
|
-
### Capabilities enabled for this agent:
|
|
374
|
-
|
|
375
|
-
- ${args.capabilities.join(`
|
|
376
|
-
- `)}
|
|
377
|
-
`;
|
|
378
|
-
}
|
|
379
|
-
const protectedLength = prompt.length + conditionalSuffix.length;
|
|
380
|
-
const totalBudget = Math.max(0, BOOTSTRAP_TOTAL_MAX_CHARS - protectedLength);
|
|
381
|
-
let totalUsed = 0;
|
|
382
|
-
if (args.claudeMd) {
|
|
383
|
-
const perSectionBudget = Math.min(BOOTSTRAP_MAX_CHARS, totalBudget - totalUsed);
|
|
384
|
-
const section = truncateSection(args.claudeMd, "## Agent Instructions", "CLAUDE.md", perSectionBudget);
|
|
385
|
-
prompt += section;
|
|
386
|
-
totalUsed += section.length;
|
|
387
|
-
}
|
|
388
|
-
if (args.toolsMd) {
|
|
389
|
-
const perSectionBudget = Math.min(BOOTSTRAP_MAX_CHARS, totalBudget - totalUsed);
|
|
390
|
-
const section = truncateSection(args.toolsMd, "## Your Tools & Capabilities", "TOOLS.md", perSectionBudget);
|
|
391
|
-
prompt += section;
|
|
392
|
-
totalUsed += section.length;
|
|
393
|
-
}
|
|
394
|
-
prompt += conditionalSuffix;
|
|
395
|
-
}
|
|
396
|
-
return prompt;
|
|
397
|
-
};
|
|
398
|
-
function truncateRepoClaudeMd(content, clonePath, budget) {
|
|
399
|
-
if (content.length <= budget)
|
|
400
|
-
return content;
|
|
401
|
-
const notice = `
|
|
402
|
-
|
|
403
|
-
[...truncated — see ${clonePath}/CLAUDE.md for full content]
|
|
404
|
-
`;
|
|
405
|
-
const contentBudget = budget - notice.length;
|
|
406
|
-
if (contentBudget <= 0)
|
|
407
|
-
return notice.trimStart();
|
|
408
|
-
return content.slice(0, contentBudget) + notice;
|
|
409
|
-
}
|
|
410
|
-
function truncateSection(content, header, fileName, budget) {
|
|
411
|
-
if (!content || budget <= 0)
|
|
412
|
-
return "";
|
|
413
|
-
const fullSection = `
|
|
414
|
-
|
|
415
|
-
${header}
|
|
416
|
-
|
|
417
|
-
${content}
|
|
418
|
-
`;
|
|
419
|
-
if (fullSection.length <= budget)
|
|
420
|
-
return fullSection;
|
|
421
|
-
const headerStr = `
|
|
422
|
-
|
|
423
|
-
${header}
|
|
424
|
-
|
|
425
|
-
`;
|
|
426
|
-
const notice = truncationNotice(fileName);
|
|
427
|
-
const contentBudget = budget - headerStr.length - notice.length;
|
|
428
|
-
if (contentBudget > 0) {
|
|
429
|
-
return headerStr + content.slice(0, contentBudget) + notice;
|
|
430
|
-
}
|
|
431
|
-
return "";
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
// src/commands/runner.ts
|
|
115
|
+
init_base_prompt();
|
|
435
116
|
init_defaults();
|
|
436
117
|
|
|
437
118
|
// src/prompts/memories.ts
|
|
@@ -495,27 +176,27 @@ async function materializeCodexAuthJson(_slot, creds, deps = {}) {
|
|
|
495
176
|
async function createProviderAdapter(provider) {
|
|
496
177
|
switch (provider) {
|
|
497
178
|
case "claude": {
|
|
498
|
-
const { ClaudeAdapter } = await import("./claude-adapter-
|
|
179
|
+
const { ClaudeAdapter } = await import("./claude-adapter-5cg1fv8s.js");
|
|
499
180
|
return new ClaudeAdapter;
|
|
500
181
|
}
|
|
501
182
|
case "pi": {
|
|
502
|
-
const { PiMonoAdapter } = await import("./pi-mono-adapter-
|
|
183
|
+
const { PiMonoAdapter } = await import("./pi-mono-adapter-yz47kk8e.js");
|
|
503
184
|
return new PiMonoAdapter;
|
|
504
185
|
}
|
|
505
186
|
case "codex": {
|
|
506
|
-
const { CodexAdapter } = await import("./codex-adapter-
|
|
187
|
+
const { CodexAdapter } = await import("./codex-adapter-hsq6mz3m.js");
|
|
507
188
|
return new CodexAdapter;
|
|
508
189
|
}
|
|
509
190
|
case "claude-managed": {
|
|
510
|
-
const { ClaudeManagedAdapter } = await import("./claude-managed-adapter-
|
|
191
|
+
const { ClaudeManagedAdapter } = await import("./claude-managed-adapter-9z9sdytx.js");
|
|
511
192
|
return new ClaudeManagedAdapter;
|
|
512
193
|
}
|
|
513
194
|
case "devin": {
|
|
514
|
-
const { DevinAdapter } = await import("./devin-adapter-
|
|
195
|
+
const { DevinAdapter } = await import("./devin-adapter-8qmhqpy3.js");
|
|
515
196
|
return new DevinAdapter;
|
|
516
197
|
}
|
|
517
198
|
case "opencode": {
|
|
518
|
-
const { OpencodeAdapter } = await import("./opencode-adapter-
|
|
199
|
+
const { OpencodeAdapter } = await import("./opencode-adapter-rar9676j.js");
|
|
519
200
|
return new OpencodeAdapter;
|
|
520
201
|
}
|
|
521
202
|
default:
|
|
@@ -1201,7 +882,7 @@ async function checkProviderCredentials(provider, env, opts) {
|
|
|
1201
882
|
case "opencode":
|
|
1202
883
|
return checkOpencodeCredentials(env, opts);
|
|
1203
884
|
case "pi": {
|
|
1204
|
-
const { checkPiMonoCredentials } = await import("./pi-mono-adapter-
|
|
885
|
+
const { checkPiMonoCredentials } = await import("./pi-mono-adapter-yz47kk8e.js");
|
|
1205
886
|
return checkPiMonoCredentials(env, opts);
|
|
1206
887
|
}
|
|
1207
888
|
default:
|
|
@@ -1417,20 +1098,32 @@ async function buildCredStatusReport(provider, env, opts = {}, kind) {
|
|
|
1417
1098
|
bedrock
|
|
1418
1099
|
};
|
|
1419
1100
|
}
|
|
1420
|
-
async function
|
|
1101
|
+
async function sendCredStatusReport(apiUrl, apiKey, agentId, runtimeInstanceId, report) {
|
|
1102
|
+
const res = await fetch(`${apiUrl}/api/agents/${encodeURIComponent(agentId)}/credential-status`, {
|
|
1103
|
+
method: "PUT",
|
|
1104
|
+
headers: {
|
|
1105
|
+
Authorization: `Bearer ${apiKey}`,
|
|
1106
|
+
"X-Agent-ID": agentId,
|
|
1107
|
+
...runtimeInstanceId ? { "X-Runtime-Instance-ID": runtimeInstanceId } : {},
|
|
1108
|
+
"Content-Type": "application/json"
|
|
1109
|
+
},
|
|
1110
|
+
body: JSON.stringify({
|
|
1111
|
+
ready: report.ready,
|
|
1112
|
+
missing: report.missing,
|
|
1113
|
+
...report.credStatus ? { cred_status: report.credStatus } : {}
|
|
1114
|
+
})
|
|
1115
|
+
});
|
|
1116
|
+
if (!res.ok) {
|
|
1117
|
+
const body = await res.text().catch(() => "");
|
|
1118
|
+
throw new Error(`credential-status report failed: ${res.status} ${body}`.trim());
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
async function reportCredStatus(apiUrl, apiKey, agentId, runtimeInstanceId, credStatus) {
|
|
1421
1122
|
try {
|
|
1422
|
-
await
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
"X-Agent-ID": agentId,
|
|
1427
|
-
"Content-Type": "application/json"
|
|
1428
|
-
},
|
|
1429
|
-
body: JSON.stringify({
|
|
1430
|
-
ready: credStatus.ready,
|
|
1431
|
-
missing: credStatus.missing,
|
|
1432
|
-
cred_status: credStatus
|
|
1433
|
-
})
|
|
1123
|
+
await sendCredStatusReport(apiUrl, apiKey, agentId, runtimeInstanceId, {
|
|
1124
|
+
ready: credStatus.ready,
|
|
1125
|
+
missing: credStatus.missing,
|
|
1126
|
+
credStatus
|
|
1434
1127
|
});
|
|
1435
1128
|
} catch (err) {
|
|
1436
1129
|
console.warn(`[cred-status] POST failed (non-fatal): ${err}`);
|
|
@@ -1557,6 +1250,29 @@ async function awaitCredentials(opts) {
|
|
|
1557
1250
|
} catch {}
|
|
1558
1251
|
return status;
|
|
1559
1252
|
}
|
|
1253
|
+
async function retryBootStep(step, opts = {}) {
|
|
1254
|
+
const label = opts.label ?? "boot step";
|
|
1255
|
+
const attempts = opts.attempts ?? 5;
|
|
1256
|
+
const sleep = opts.sleep ?? ((ms) => Bun.sleep(ms));
|
|
1257
|
+
const log = opts.log ?? ((line) => console.warn(line));
|
|
1258
|
+
const maxDelayMs = opts.maxDelayMs ?? 1e4;
|
|
1259
|
+
let delayMs = opts.initialDelayMs ?? 1000;
|
|
1260
|
+
let lastError;
|
|
1261
|
+
for (let attempt = 1;attempt <= attempts; attempt++) {
|
|
1262
|
+
try {
|
|
1263
|
+
await step();
|
|
1264
|
+
return;
|
|
1265
|
+
} catch (err) {
|
|
1266
|
+
lastError = err;
|
|
1267
|
+
if (attempt < attempts) {
|
|
1268
|
+
log(`[boot] ${label} failed (attempt ${attempt}/${attempts}, retry in ${delayMs}ms): ${err}`);
|
|
1269
|
+
await sleep(delayMs);
|
|
1270
|
+
delayMs = Math.min(delayMs * 2, maxDelayMs);
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1273
|
+
}
|
|
1274
|
+
throw lastError instanceof Error ? lastError : new Error(`${label} failed after ${attempts} attempt(s): ${lastError}`);
|
|
1275
|
+
}
|
|
1560
1276
|
|
|
1561
1277
|
// src/commands/runner.ts
|
|
1562
1278
|
init_profile_sync();
|
|
@@ -1856,6 +1572,9 @@ async function pingServer(config, _role) {
|
|
|
1856
1572
|
if (config.apiKey) {
|
|
1857
1573
|
headers.Authorization = `Bearer ${config.apiKey}`;
|
|
1858
1574
|
}
|
|
1575
|
+
if (config.runtimeInstanceId) {
|
|
1576
|
+
headers["X-Runtime-Instance-ID"] = config.runtimeInstanceId;
|
|
1577
|
+
}
|
|
1859
1578
|
try {
|
|
1860
1579
|
await fetch(`${config.apiUrl}/ping`, {
|
|
1861
1580
|
method: "POST",
|
|
@@ -1870,6 +1589,9 @@ async function closeAgent(config, role) {
|
|
|
1870
1589
|
if (config.apiKey) {
|
|
1871
1590
|
headers.Authorization = `Bearer ${config.apiKey}`;
|
|
1872
1591
|
}
|
|
1592
|
+
if (config.runtimeInstanceId) {
|
|
1593
|
+
headers["X-Runtime-Instance-ID"] = config.runtimeInstanceId;
|
|
1594
|
+
}
|
|
1873
1595
|
try {
|
|
1874
1596
|
console.log(`[${role}] Marking agent as offline...`);
|
|
1875
1597
|
await fetch(`${config.apiUrl}/close`, {
|
|
@@ -2017,6 +1739,9 @@ var SWARM_TOOL_LABELS = {
|
|
|
2017
1739
|
"kv-incr": "\uD83D\uDD11 Incrementing KV value",
|
|
2018
1740
|
"slack-post": "\uD83D\uDCAC Posting to Slack",
|
|
2019
1741
|
"slack-start-thread": "\uD83D\uDCAC Starting Slack thread",
|
|
1742
|
+
"slack-create-channel": "\uD83D\uDCAC Creating Slack channel",
|
|
1743
|
+
"slack-invite-to-channel": "\uD83D\uDCAC Inviting to Slack channel",
|
|
1744
|
+
"slack-archive-channel": "\uD83D\uDCAC Archiving Slack channel",
|
|
2020
1745
|
"slack-reply": "\uD83D\uDCAC Replying in Slack",
|
|
2021
1746
|
"slack-read": "\uD83D\uDCAC Reading Slack",
|
|
2022
1747
|
"slack-list-channels": "\uD83D\uDCAC Listing Slack channels",
|
|
@@ -2883,7 +2608,8 @@ async function registerActiveSession(config, session) {
|
|
|
2883
2608
|
taskId: session.taskId,
|
|
2884
2609
|
triggerType: session.triggerType,
|
|
2885
2610
|
taskDescription: session.taskDescription,
|
|
2886
|
-
runnerSessionId: session.runnerSessionId
|
|
2611
|
+
runnerSessionId: session.runnerSessionId,
|
|
2612
|
+
runtimeInstanceId: config.runtimeInstanceId
|
|
2887
2613
|
})
|
|
2888
2614
|
});
|
|
2889
2615
|
} catch {}
|
|
@@ -2957,15 +2683,24 @@ async function triggerHeartbeatSweep(config) {
|
|
|
2957
2683
|
}
|
|
2958
2684
|
}
|
|
2959
2685
|
async function buildRequesterProfilePrompt(requestedBy) {
|
|
2960
|
-
|
|
2686
|
+
const comms = requestedBy?.comms;
|
|
2687
|
+
const commsParts = [
|
|
2688
|
+
comms?.tone ? `tone: ${comms.tone}` : undefined,
|
|
2689
|
+
comms?.language ? `language: ${comms.language}` : undefined,
|
|
2690
|
+
comms?.verbosity ? `verbosity: ${comms.verbosity}` : undefined
|
|
2691
|
+
].filter((part) => Boolean(part));
|
|
2692
|
+
if (!requestedBy?.role && !requestedBy?.notes && commsParts.length === 0)
|
|
2961
2693
|
return "";
|
|
2962
|
-
const
|
|
2694
|
+
const commsSection = commsParts.length > 0 ? `
|
|
2695
|
+
Their communication preferences: ${commsParts.join(", ")}.` : "";
|
|
2696
|
+
const notes = requestedBy?.notes?.trim();
|
|
2963
2697
|
const notesSection = notes ? `
|
|
2964
2698
|
Their stated notes for how you should respond and act:
|
|
2965
2699
|
${notes}` : "";
|
|
2966
2700
|
const result = await resolveTemplateAsync("task.requester.profile", {
|
|
2967
|
-
requester_name: requestedBy
|
|
2968
|
-
requester_role_suffix: requestedBy
|
|
2701
|
+
requester_name: requestedBy?.name ?? "",
|
|
2702
|
+
requester_role_suffix: requestedBy?.role ? ` (${requestedBy.role})` : "",
|
|
2703
|
+
requester_comms_section: commsSection,
|
|
2969
2704
|
requester_notes_section: notesSection
|
|
2970
2705
|
});
|
|
2971
2706
|
return result.skipped ? "" : result.text.trim();
|
|
@@ -2990,7 +2725,8 @@ async function registerAgent(opts) {
|
|
|
2990
2725
|
capabilities: opts.capabilities,
|
|
2991
2726
|
maxTasks: opts.maxTasks,
|
|
2992
2727
|
provider,
|
|
2993
|
-
harness_provider: harnessProvider
|
|
2728
|
+
harness_provider: harnessProvider,
|
|
2729
|
+
runtimeInstanceId: opts.runtimeInstanceId
|
|
2994
2730
|
})
|
|
2995
2731
|
});
|
|
2996
2732
|
if (!response.ok) {
|
|
@@ -3025,6 +2761,9 @@ async function pollForTriggerOnce(opts) {
|
|
|
3025
2761
|
const headers = {
|
|
3026
2762
|
"X-Agent-ID": opts.agentId
|
|
3027
2763
|
};
|
|
2764
|
+
if (opts.runtimeInstanceId) {
|
|
2765
|
+
headers["X-Runtime-Instance-ID"] = opts.runtimeInstanceId;
|
|
2766
|
+
}
|
|
3028
2767
|
if (opts.apiKey) {
|
|
3029
2768
|
headers.Authorization = `Bearer ${opts.apiKey}`;
|
|
3030
2769
|
}
|
|
@@ -3477,7 +3216,7 @@ async function spawnProviderProcess(adapter, opts, logDir, isYolo) {
|
|
|
3477
3216
|
function bufferEvent(evt) {
|
|
3478
3217
|
eventBuffer.push(evt);
|
|
3479
3218
|
if (eventBuffer.length >= EVENT_BUFFER_MAX) {
|
|
3480
|
-
flushEvents();
|
|
3219
|
+
flushEvents().catch((err) => console.error("[runner] event flush failed:", scrubSecrets(err instanceof Error ? err.message : String(err))));
|
|
3481
3220
|
}
|
|
3482
3221
|
}
|
|
3483
3222
|
async function flushEvents() {
|
|
@@ -3989,7 +3728,7 @@ async function checkCompletedProcesses(state, role, apiConfig, cancelledSignaled
|
|
|
3989
3728
|
vcsCheckTimestamps.delete(taskId);
|
|
3990
3729
|
cancelledSignaled?.delete(taskId);
|
|
3991
3730
|
if (apiConfig) {
|
|
3992
|
-
removeActiveSession(apiConfig, taskId);
|
|
3731
|
+
removeActiveSession(apiConfig, taskId).catch((err) => console.error("[runner] active-session removal failed:", scrubSecrets(err instanceof Error ? err.message : String(err))));
|
|
3993
3732
|
}
|
|
3994
3733
|
if (apiConfig && workingDir && !vcsDetectedTasks.has(taskId)) {
|
|
3995
3734
|
await detectVcsForTask(apiConfig.apiUrl, apiConfig.apiKey, taskId, workingDir);
|
|
@@ -4365,7 +4104,9 @@ ${additionalSystemPrompt}` : basePrompt;
|
|
|
4365
4104
|
const SERVER_CAPS_REFRESH_INTERVAL_MS = 300000;
|
|
4366
4105
|
let lastBedrockRefreshAt = 0;
|
|
4367
4106
|
const BEDROCK_REFRESH_INTERVAL_MS = 5 * 60 * 1000;
|
|
4368
|
-
const
|
|
4107
|
+
const runtimeInstanceId = crypto.randomUUID();
|
|
4108
|
+
process.env.SWARM_RUNTIME_INSTANCE_ID = runtimeInstanceId;
|
|
4109
|
+
const apiConfig = { apiUrl, apiKey, agentId, runtimeInstanceId };
|
|
4369
4110
|
setupShutdownHandlers(role, apiConfig, () => state);
|
|
4370
4111
|
const agentName = process.env.AGENT_NAME || cachedTemplate?.config.displayName || `${role}-${agentId.slice(0, 8)}`;
|
|
4371
4112
|
const applySwarmConfigDrift = async (freshEnv, resolvedProvider, nextScriptsOnly) => {
|
|
@@ -4428,21 +4169,25 @@ ${additionalSystemPrompt}` : basePrompt;
|
|
|
4428
4169
|
console.log(`[${role}] [config] Server capabilities updated (${next.length} flags) — system prompt rebuilt`);
|
|
4429
4170
|
}
|
|
4430
4171
|
};
|
|
4172
|
+
const registerCurrentRuntime = async () => {
|
|
4173
|
+
const reg = await registerAgent({
|
|
4174
|
+
apiUrl,
|
|
4175
|
+
apiKey,
|
|
4176
|
+
agentId,
|
|
4177
|
+
name: agentName,
|
|
4178
|
+
role,
|
|
4179
|
+
isLead,
|
|
4180
|
+
capabilities,
|
|
4181
|
+
maxTasks: state.maxConcurrent,
|
|
4182
|
+
harnessProvider: state.harnessProvider,
|
|
4183
|
+
runtimeInstanceId
|
|
4184
|
+
});
|
|
4185
|
+
lastServerCapsRefreshAt = Date.now();
|
|
4186
|
+
await applyServerCapabilities(reg.serverCapabilities);
|
|
4187
|
+
};
|
|
4431
4188
|
const reregisterAgent = async () => {
|
|
4432
4189
|
try {
|
|
4433
|
-
|
|
4434
|
-
apiUrl,
|
|
4435
|
-
apiKey,
|
|
4436
|
-
agentId,
|
|
4437
|
-
name: agentName,
|
|
4438
|
-
role,
|
|
4439
|
-
isLead,
|
|
4440
|
-
capabilities,
|
|
4441
|
-
maxTasks: state.maxConcurrent,
|
|
4442
|
-
harnessProvider: state.harnessProvider
|
|
4443
|
-
});
|
|
4444
|
-
lastServerCapsRefreshAt = Date.now();
|
|
4445
|
-
await applyServerCapabilities(reg.serverCapabilities);
|
|
4190
|
+
await registerCurrentRuntime();
|
|
4446
4191
|
} catch (err) {
|
|
4447
4192
|
console.warn(`[${role}] [config] Re-register failed (non-fatal): ${err}`);
|
|
4448
4193
|
}
|
|
@@ -4457,7 +4202,8 @@ ${additionalSystemPrompt}` : basePrompt;
|
|
|
4457
4202
|
isLead,
|
|
4458
4203
|
capabilities,
|
|
4459
4204
|
maxTasks: maxConcurrent,
|
|
4460
|
-
harnessProvider: bootProvider
|
|
4205
|
+
harnessProvider: bootProvider,
|
|
4206
|
+
runtimeInstanceId
|
|
4461
4207
|
});
|
|
4462
4208
|
lastServerCapsRefreshAt = Date.now();
|
|
4463
4209
|
await applyServerCapabilities(reg.serverCapabilities);
|
|
@@ -4492,6 +4238,7 @@ ${additionalSystemPrompt}` : basePrompt;
|
|
|
4492
4238
|
headers: {
|
|
4493
4239
|
Authorization: `Bearer ${apiKey}`,
|
|
4494
4240
|
"X-Agent-ID": agentId,
|
|
4241
|
+
"X-Runtime-Instance-ID": runtimeInstanceId,
|
|
4495
4242
|
"Content-Type": "application/json"
|
|
4496
4243
|
},
|
|
4497
4244
|
body: JSON.stringify({ ready: status.ready, missing: status.missing })
|
|
@@ -4506,10 +4253,32 @@ ${additionalSystemPrompt}` : basePrompt;
|
|
|
4506
4253
|
throw err;
|
|
4507
4254
|
}
|
|
4508
4255
|
try {
|
|
4509
|
-
|
|
4510
|
-
|
|
4256
|
+
await retryBootStep(registerCurrentRuntime, {
|
|
4257
|
+
label: "runtime re-registration",
|
|
4258
|
+
log: (line) => console.warn(`[${role}] ${line}`)
|
|
4259
|
+
});
|
|
4260
|
+
} catch (error) {
|
|
4261
|
+
console.error(`[${role}] Failed to re-register after credential wait: ${error}`);
|
|
4262
|
+
process.exit(1);
|
|
4263
|
+
}
|
|
4264
|
+
let bootCredSnapshot;
|
|
4265
|
+
try {
|
|
4266
|
+
bootCredSnapshot = await buildCredStatusReport(state.harnessProvider, process.env, {}, "boot");
|
|
4511
4267
|
} catch (err) {
|
|
4512
|
-
console.warn(`[${role}] cred_status boot
|
|
4268
|
+
console.warn(`[${role}] cred_status boot snapshot failed (non-fatal): ${err}`);
|
|
4269
|
+
}
|
|
4270
|
+
try {
|
|
4271
|
+
await retryBootStep(() => sendCredStatusReport(apiUrl, apiKey, agentId, runtimeInstanceId, {
|
|
4272
|
+
ready: bootCredSnapshot?.ready ?? true,
|
|
4273
|
+
missing: bootCredSnapshot?.missing ?? [],
|
|
4274
|
+
credStatus: bootCredSnapshot
|
|
4275
|
+
}), {
|
|
4276
|
+
label: "credential readiness report",
|
|
4277
|
+
log: (line) => console.warn(`[${role}] ${line}`)
|
|
4278
|
+
});
|
|
4279
|
+
} catch (error) {
|
|
4280
|
+
console.error(`[${role}] Failed to report credential readiness after recovery: ${error}`);
|
|
4281
|
+
process.exit(1);
|
|
4513
4282
|
}
|
|
4514
4283
|
}
|
|
4515
4284
|
await cleanupActiveSessions(apiConfig);
|
|
@@ -4759,6 +4528,14 @@ ${additionalSystemPrompt}` : basePrompt;
|
|
|
4759
4528
|
console.log(`[${role}] Injected context preamble into resumed follow-up task prompt (parent: ${task.parentTaskId.slice(0, 8)})`);
|
|
4760
4529
|
}
|
|
4761
4530
|
}
|
|
4531
|
+
const resumeWithSyncWarning = await prependProfileSyncRejectionBanner(resumePrompt, {
|
|
4532
|
+
...apiConfig,
|
|
4533
|
+
claudeMdPath: resolveClaudeMdPath([state.harnessProvider])
|
|
4534
|
+
});
|
|
4535
|
+
resumePrompt = resumeWithSyncWarning.prompt;
|
|
4536
|
+
if (resumeWithSyncWarning.injected) {
|
|
4537
|
+
console.warn(`[${role}] Injected persisted profile sync rejection warning`);
|
|
4538
|
+
}
|
|
4762
4539
|
const resumeCandidates = [
|
|
4763
4540
|
{
|
|
4764
4541
|
source: "task",
|
|
@@ -4862,7 +4639,7 @@ ${additionalSystemPrompt}` : basePrompt;
|
|
|
4862
4639
|
triggerType: "task_resumed",
|
|
4863
4640
|
taskDescription: task.task?.slice(0, 200),
|
|
4864
4641
|
runnerSessionId: resumeRunnerSessionId
|
|
4865
|
-
});
|
|
4642
|
+
}).catch((err) => console.error("[runner] active-session registration failed:", scrubSecrets(err instanceof Error ? err.message : String(err))));
|
|
4866
4643
|
console.log(`[${role}] Resumed task ${task.id.slice(0, 8)} (${state.activeTasks.size}/${state.maxConcurrent} active)`);
|
|
4867
4644
|
}
|
|
4868
4645
|
console.log(`[${role}] All paused tasks resumed. Entering normal polling...`);
|
|
@@ -4911,10 +4688,10 @@ ${additionalSystemPrompt}` : basePrompt;
|
|
|
4911
4688
|
const currentHarness = state.harnessProvider;
|
|
4912
4689
|
if (currentHarness !== cachedCredHarnessProvider) {
|
|
4913
4690
|
cachedCredHarnessProvider = currentHarness;
|
|
4914
|
-
buildCredStatusReport(currentHarness, process.env, {}, "post_task").then((snap) => reportCredStatus(apiUrl, apiKey, agentId, snap)).catch((err) => console.warn(`[${role}] cred_status post_task report failed (non-fatal): ${err}`));
|
|
4691
|
+
buildCredStatusReport(currentHarness, process.env, {}, "post_task").then((snap) => reportCredStatus(apiUrl, apiKey, agentId, runtimeInstanceId, snap)).catch((err) => console.warn(`[${role}] cred_status post_task report failed (non-fatal): ${err}`));
|
|
4915
4692
|
} else if (currentHarness === "pi" && isBedrockSdkMode(process.env) && Date.now() - lastBedrockRefreshAt > BEDROCK_REFRESH_INTERVAL_MS) {
|
|
4916
4693
|
lastBedrockRefreshAt = Date.now();
|
|
4917
|
-
buildCredStatusReport(currentHarness, process.env, {}, "post_task").then((snap) => reportCredStatus(apiUrl, apiKey, agentId, snap)).catch((err) => console.warn(`[${role}] bedrock enumeration refresh failed (non-fatal): ${err}`));
|
|
4694
|
+
buildCredStatusReport(currentHarness, process.env, {}, "post_task").then((snap) => reportCredStatus(apiUrl, apiKey, agentId, runtimeInstanceId, snap)).catch((err) => console.warn(`[${role}] bedrock enumeration refresh failed (non-fatal): ${err}`));
|
|
4918
4695
|
}
|
|
4919
4696
|
}
|
|
4920
4697
|
const now = Date.now();
|
|
@@ -4927,7 +4704,7 @@ ${additionalSystemPrompt}` : basePrompt;
|
|
|
4927
4704
|
if (!task.workingDir)
|
|
4928
4705
|
continue;
|
|
4929
4706
|
vcsCheckTimestamps.set(taskId, now);
|
|
4930
|
-
detectVcsForTask(apiUrl, apiKey, taskId, task.workingDir);
|
|
4707
|
+
detectVcsForTask(apiUrl, apiKey, taskId, task.workingDir).catch((err) => console.error("[runner] VCS detection failed:", scrubSecrets(err instanceof Error ? err.message : String(err))));
|
|
4931
4708
|
}
|
|
4932
4709
|
if (state.activeTasks.size > 0) {
|
|
4933
4710
|
for (const [taskId, task] of state.activeTasks) {
|
|
@@ -4976,6 +4753,7 @@ ${additionalSystemPrompt}` : basePrompt;
|
|
|
4976
4753
|
apiKey,
|
|
4977
4754
|
agentId,
|
|
4978
4755
|
pollInterval: PollIntervalMs,
|
|
4756
|
+
runtimeInstanceId,
|
|
4979
4757
|
pollTimeout: effectiveTimeout
|
|
4980
4758
|
});
|
|
4981
4759
|
if (trigger) {
|
|
@@ -5035,6 +4813,14 @@ ${additionalSystemPrompt}` : basePrompt;
|
|
|
5035
4813
|
console.log(`[${role}] Injected ${isResumeTask ? "resume" : "context"} preamble for ${isResumeTask ? "resume" : "follow-up"} task (parent: ${taskObj.parentTaskId.slice(0, 8)})`);
|
|
5036
4814
|
}
|
|
5037
4815
|
}
|
|
4816
|
+
const triggerWithSyncWarning = await prependProfileSyncRejectionBanner(triggerPrompt, {
|
|
4817
|
+
...apiConfig,
|
|
4818
|
+
claudeMdPath: resolveClaudeMdPath([state.harnessProvider])
|
|
4819
|
+
});
|
|
4820
|
+
triggerPrompt = triggerWithSyncWarning.prompt;
|
|
4821
|
+
if (triggerWithSyncWarning.injected) {
|
|
4822
|
+
console.warn(`[${role}] Injected persisted profile sync rejection warning`);
|
|
4823
|
+
}
|
|
5038
4824
|
let resumeSessionId;
|
|
5039
4825
|
if (taskObj?.parentTaskId) {
|
|
5040
4826
|
const parentSession = await fetchProviderSessionInfo(apiUrl, apiKey, taskObj.parentTaskId);
|
|
@@ -5205,7 +4991,7 @@ Note: The task requested working directory "${taskDir}" but it does not exist. F
|
|
|
5205
4991
|
triggerType: trigger.type,
|
|
5206
4992
|
taskDescription: taskDesc,
|
|
5207
4993
|
runnerSessionId: taskRunnerSessionId
|
|
5208
|
-
});
|
|
4994
|
+
}).catch((err) => console.error("[runner] active-session registration failed:", scrubSecrets(err instanceof Error ? err.message : String(err))));
|
|
5209
4995
|
console.log(`[${role}] Started task ${runningTask.taskId.slice(0, 8)} (${state.activeTasks.size}/${state.maxConcurrent} active, trigger: ${trigger.type})`);
|
|
5210
4996
|
}
|
|
5211
4997
|
} else {
|