wednesdayai 0.4.12-dev.706 → 0.4.12-dev.707
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/dist/{agent-turn-enqueue-V0Vpu538.js → agent-turn-enqueue-B5Uv68lP.js} +4 -4
- package/dist/{agent-turn-enqueue-DUTkQGZf.js → agent-turn-enqueue-DYZlZypS.js} +4 -4
- package/dist/{agent-turn-execute-ykPmYmYL.js → agent-turn-execute-BjsMs4-_.js} +363 -262
- package/dist/{agent-turn-recovery-adapter-DswEzfh0.js → agent-turn-recovery-adapter-B8ZbwTXv.js} +1 -1
- package/dist/{agent-turn-recovery-adapter-Dz8mFaxx.js → agent-turn-recovery-adapter-D3gYLzXI.js} +1 -1
- package/dist/{agent-turn-runner-C2XXPavj.js → agent-turn-runner-BB0xkzVk.js} +1 -1
- package/dist/{agent-turn-runner-Cl_8XxxV.js → agent-turn-runner-ByKxuh9g.js} +1 -1
- package/dist/{agent-turn-runner-Bq0mff7h.js → agent-turn-runner-CIynRYol.js} +1 -1
- package/dist/{agent-turn-runner-D3ztngQh.js → agent-turn-runner-CwI9bK9W.js} +1 -1
- package/dist/{agents-CR6WyXm2.js → agents-BkFCu1XK.js} +4 -4
- package/dist/{agents.config-DftJxDHx.js → agents.config-D7EkOh-d.js} +1 -1
- package/dist/{agents.config-BkP_dcZ1.js → agents.config-M3p53YVD.js} +1 -1
- package/dist/{audio-preflight-BU9oazCN.js → audio-preflight-DKIH97xz.js} +6 -6
- package/dist/{audio-preflight-BadT0aZp.js → audio-preflight-DanEnt5T.js} +6 -6
- package/dist/{audio-transcription-runner-C_D6-5s-.js → audio-transcription-runner-CgQwIVTA.js} +1 -1
- package/dist/{audio-transcription-runner-CRmRAqAD.js → audio-transcription-runner-CsYhC8Ez.js} +1 -1
- package/dist/{audit-DvZv0_HI.js → audit-Ca5lrM3A.js} +3 -3
- package/dist/{audit-9ONcBlGJ.js → audit-DDpr92zr.js} +3 -3
- package/dist/{auth-choice-C92Ys9fl.js → auth-choice-D3xpq5gM.js} +1 -1
- package/dist/{auth-choice-B48ajlb2.js → auth-choice-DfetB5RW.js} +1 -1
- package/dist/{banner-DJ-dtPt4.js → banner-B-eXLAzF.js} +1 -1
- package/dist/build-info.json +3 -3
- package/dist/bundled/boot-md/handler.js +2 -2
- package/dist/bundled/session-journal/handler.js +2 -2
- package/dist/bundled/session-memory/handler.js +2 -2
- package/dist/canvas-host/a2ui/.bundle.hash +1 -1
- package/dist/{channel-options-D0GZl_RV.js → channel-options-BG4Rn7Cf.js} +1 -1
- package/dist/{channel-options-BPy0Kst-.js → channel-options-C8TApl-P.js} +1 -1
- package/dist/{channels-cli-Dw5yfM6M.js → channels-cli-AJKtdDZv.js} +24 -24
- package/dist/{channels-cli-CbqhrPdc.js → channels-cli-DMGDUr_7.js} +24 -24
- package/dist/{cli-DSW3Zmm8.js → cli-Budx9d3_.js} +18 -18
- package/dist/{cli-U-A_086W.js → cli-D9fcfVIN.js} +18 -18
- package/dist/{command-queue-CEw2WosY.js → command-queue-DkA7Zwf6.js} +1 -1
- package/dist/{command-queue-CyYu7b_w.js → command-queue-M5JKutHg.js} +1 -1
- package/dist/{command-registry-BHPuoNDn.js → command-registry-CtaGgjQ_.js} +9 -9
- package/dist/{completion-cli-CJv5xpIh.js → completion-cli-DIZtemFg.js} +2 -2
- package/dist/{completion-cli-CzIqonVH.js → completion-cli-DNprwGQo.js} +1 -1
- package/dist/{config-cli-L99oyek8.js → config-cli-CyvoGF2Q.js} +1 -1
- package/dist/{config-cli-DMQJYHN-.js → config-cli-pWHg8KzQ.js} +1 -1
- package/dist/{configure-BNSgiLsj.js → configure-CWbqSsCT.js} +3 -3
- package/dist/{configure-DF1qbQ90.js → configure-CYuOl1Si.js} +3 -3
- package/dist/{deliver-P4Wm3vMm.js → deliver-B59Njn4n.js} +1 -1
- package/dist/{deliver-0qdgaedO.js → deliver-DNaGsPae.js} +1 -1
- package/dist/{diagnostic-CoiuQPKH.js → diagnostic-DGVkVcyC.js} +1 -1
- package/dist/{diagnostic-DvldRqw-.js → diagnostic-NcPdstx1.js} +1 -1
- package/dist/{dm-policy-shared-BmRyXZxk.js → dm-policy-shared-Cj47AVma.js} +1 -1
- package/dist/{doctor-completion-B187YGTQ.js → doctor-completion-CJWv6Yi8.js} +1 -1
- package/dist/{doctor-completion-CAEqilfu.js → doctor-completion-DRaTmi2S.js} +1 -1
- package/dist/entry.js +2 -2
- package/dist/extensionAPI.js +2 -2
- package/dist/{gateway-cli-CATpS5M1.js → gateway-cli-150xYy7i.js} +41 -41
- package/dist/{gateway-cli-DBisp6Sd.js → gateway-cli-C16Blh0G.js} +41 -41
- package/dist/{health-35lnX8CS.js → health-DVsJWPiL.js} +2 -2
- package/dist/{health-6ASvBiS6.js → health-W07SjXhL.js} +2 -2
- package/dist/{hooks-cli-BdYcpGP0.js → hooks-cli-CjOCv70u.js} +20 -20
- package/dist/{hooks-cli-B03jJjHI.js → hooks-cli-wPb-TiF3.js} +20 -20
- package/dist/index.js +22 -22
- package/dist/{installs-BXhHyHr_.js → installs-BNVJjjgD.js} +1 -1
- package/dist/{installs-qT9b5lFd.js → installs-CIkXZokY.js} +1 -1
- package/dist/llm-slug-generator.js +2 -2
- package/dist/{models-C4cGhUIs.js → models-D20r2c1n.js} +1 -1
- package/dist/{models-cli-CUYwfgEx.js → models-cli-B1DpYwXy.js} +18 -18
- package/dist/{models-cli-AjQALynv.js → models-cli-X4_Uz35o.js} +19 -19
- package/dist/{node-cli-CLMUlFlb.js → node-cli-C5ICC0Mw.js} +3 -3
- package/dist/{node-cli-BWO29Vre.js → node-cli-Cd0KdDZ9.js} +3 -3
- package/dist/{npm-pack-install-CxjdCOiC.js → npm-pack-install-BRQXGSn4.js} +1 -1
- package/dist/{npm-pack-install-Cjg7iStO.js → npm-pack-install-QvhMk_eH.js} +1 -1
- package/dist/{npm-resolution-mcbTS08o.js → npm-resolution-DY6WGqlq.js} +2 -2
- package/dist/{npm-resolution-DmLZ8cl4.js → npm-resolution-DYiXBCBw.js} +2 -2
- package/dist/{onboard-zA8zx3Hs.js → onboard-BJohRNgh.js} +2 -2
- package/dist/{onboard-J9emscLN.js → onboard-CiRt1pZ3.js} +2 -2
- package/dist/{onboard-channels-Bl0KftbA.js → onboard-channels-BkVimqff.js} +2 -2
- package/dist/{onboard-channels-DqkyYqJs.js → onboard-channels-BnWamZcq.js} +2 -2
- package/dist/{onboarding-BHKv8PVj.js → onboarding-CtkXxZ4V.js} +3 -3
- package/dist/{onboarding-BqiFS9np.js → onboarding-DwwhgN_-.js} +3 -3
- package/dist/{onboarding.finalize-OY8Vyswd.js → onboarding.finalize-4JTNGG18.js} +24 -24
- package/dist/{onboarding.finalize-LBEiEThV.js → onboarding.finalize-DqmyK2Zl.js} +23 -23
- package/dist/{operator-commands-Dbvj2iQf.js → operator-commands-CzL-9HCy.js} +2 -2
- package/dist/{operator-commands-DIhjFfW0.js → operator-commands-DIqBfjYT.js} +2 -2
- package/dist/{pi-embedded-CFHNN9oJ.js → pi-embedded-Drx3qiDz.js} +433 -317
- package/dist/{pi-embedded-ByHs-kU2.js → pi-embedded-egNcTcn8.js} +433 -317
- package/dist/{pi-embedded-helpers-BRTG_o2E.js → pi-embedded-helpers-Bdf0msT2.js} +1 -1
- package/dist/{pi-embedded-helpers-DseTaaIm.js → pi-embedded-helpers-D5ZuAV5B.js} +1 -1
- package/dist/{pi-embedded-recovery-adapter-D2_htVri.js → pi-embedded-recovery-adapter-BYsig4Ad.js} +8 -8
- package/dist/{pi-embedded-recovery-adapter-BPT9lnPW.js → pi-embedded-recovery-adapter-Cf6q8n5i.js} +8 -8
- package/dist/{pi-embedded-recovery-adapter-DF3o-MqA.js → pi-embedded-recovery-adapter-DgdLtOGf.js} +2 -2
- package/dist/{pi-embedded-recovery-adapter-0-0NJRF_.js → pi-embedded-recovery-adapter-SvxRUnvP.js} +2 -2
- package/dist/{pi-embedded-utils-BntQ-0Oh.js → pi-embedded-utils-DDGSjA3F.js} +1 -1
- package/dist/{pi-embedded-utils-BCk2SD5y.js → pi-embedded-utils-DWIHcGJr.js} +1 -1
- package/dist/{pi-tools.policy-C3NlA3sD.js → pi-tools.policy-Bx7WTWRE.js} +1 -1
- package/dist/{plugin-registry-BRRnIEGy.js → plugin-registry-BLriGqtI.js} +1 -1
- package/dist/{plugin-registry-BRo7T59U.js → plugin-registry-Mpi7Xbyd.js} +1 -1
- package/dist/plugin-sdk/{agent-turn-execute-CoUpaQcG.js → agent-turn-execute-B_zIGst3.js} +2 -2
- package/dist/plugin-sdk/{agent-turn-execute-D4iQv80C.js → agent-turn-execute-CBIog9rc.js} +2 -2
- package/dist/plugin-sdk/{agent-turn-runner-BUs9rb63.js → agent-turn-runner-BZLZVte0.js} +1 -1
- package/dist/plugin-sdk/{agent-turn-runner-BR2uUVeR.js → agent-turn-runner-BuZraB-G.js} +2 -2
- package/dist/plugin-sdk/{agent-turn-runner-BN0V4J__.js → agent-turn-runner-CKrIkJOo.js} +1 -1
- package/dist/plugin-sdk/{command-detection-wfAMmToR.js → command-detection-rvLsAfnZ.js} +404 -288
- package/dist/plugin-sdk/index.js +2 -2
- package/dist/plugin-sdk/{provider-dispatcher-CCZ0U3qv.js → provider-dispatcher-B4JYNdjt.js} +2 -2
- package/dist/plugin-sdk/{provider-dispatcher-D0-S69GS.js → provider-dispatcher-CkSHbuj1.js} +2 -2
- package/dist/plugin-sdk/provider-media-understanding.js +7 -7
- package/dist/plugin-sdk/src/acp/control-plane/manager.core.d.ts +3 -0
- package/dist/plugin-sdk/src/acp/runtime/registry.d.ts +5 -0
- package/dist/plugin-sdk/src/agents/pi-embedded-runner/workspace-cwd.d.ts +8 -0
- package/dist/plugin-sdk/{subagent-registry-BWIHOyvI.js → subagent-registry-CoP2z-4v.js} +2 -2
- package/dist/plugin-sdk/{subagent-registry-DKnQ_BVA.js → subagent-registry-D22XEgZh.js} +2 -2
- package/dist/plugin-sdk/testing.js +2 -2
- package/dist/plugin-sdk/{tools-C7fDpDC6.js → tools-C53gbWae.js} +407 -291
- package/dist/{plugins-cli-DiXc82SO.js → plugins-cli-CRIdw7Dz.js} +23 -23
- package/dist/{plugins-cli-UCAwk-rk.js → plugins-cli-mCmR3CEl.js} +23 -23
- package/dist/{program-context-BZozJaWV.js → program-context-B3w4xI0v.js} +22 -22
- package/dist/{program-CSHsM0mN.js → program-fvpSjRjQ.js} +24 -24
- package/dist/{prompt-select-styled-C7nKqbr4.js → prompt-select-styled-BGt9dOlR.js} +6 -6
- package/dist/{prompt-select-styled-rjARBru7.js → prompt-select-styled-NkXfaDS4.js} +6 -6
- package/dist/{provider-image-aQISUutb.js → provider-image-22SjivgZ.js} +1 -1
- package/dist/{provider-image-DO_HznGf.js → provider-image-DG4nAiir.js} +1 -1
- package/dist/{push-apns-U-YvRZcJ.js → push-apns-CXMW3CER.js} +2 -2
- package/dist/{push-apns-CUAi4UyY.js → push-apns-y01wF05Z.js} +2 -2
- package/dist/{pw-ai-B5A4Lp_k.js → pw-ai-BbEcMtWh.js} +1 -1
- package/dist/{pw-ai-CqZVjQbv.js → pw-ai-CXdekfq6.js} +1 -1
- package/dist/{reconcile-bundled-AxnVZKWX.js → reconcile-bundled-CL5VFAik.js} +1 -1
- package/dist/{reconcile-bundled-D7d6qLAp.js → reconcile-bundled-O19uQbox.js} +1 -1
- package/dist/{recovery-adapter-BbCCIPN_.js → recovery-adapter-BfGUqpLB.js} +9 -9
- package/dist/{recovery-adapter-DuTIL78B.js → recovery-adapter-CJQVSGCl.js} +1 -1
- package/dist/{recovery-adapter-4iEJpxSF.js → recovery-adapter-D0rTiPKP.js} +9 -9
- package/dist/{recovery-adapter-lM9hSWjB.js → recovery-adapter-KsikWawR.js} +1 -1
- package/dist/{register.agent-qA-oTdaW.js → register.agent-CHURaTpg.js} +23 -23
- package/dist/{register.agent-CkEHSfPv.js → register.agent-CnplxuAf.js} +24 -24
- package/dist/{register.configure-EWwV941Y.js → register.configure-Cuwmu7Px.js} +24 -24
- package/dist/{register.configure-DwcPrhde.js → register.configure-DPZtEcgJ.js} +24 -24
- package/dist/{register.maintenance-BhJi1UgM.js → register.maintenance-ClFkSxzA.js} +25 -25
- package/dist/{register.maintenance-DQtq6l1_.js → register.maintenance-D_tszGHP.js} +24 -24
- package/dist/{register.message-auX519c8.js → register.message-1J6_e4dR.js} +19 -19
- package/dist/{register.message-DC5Kti11.js → register.message-CuxbjIDq.js} +19 -19
- package/dist/{register.onboard-By1QKqJU.js → register.onboard-CkQjScfF.js} +2 -2
- package/dist/{register.onboard-YFYLph6I.js → register.onboard-CwDGzL5G.js} +2 -2
- package/dist/{register.setup-GQV8tSLb.js → register.setup-BZG_BcO1.js} +2 -2
- package/dist/{register.setup-B9mW-na1.js → register.setup-BgYZpfET.js} +2 -2
- package/dist/{register.status-health-sessions-yoSujx0N.js → register.status-health-sessions-CBB4OKN-.js} +21 -21
- package/dist/{register.status-health-sessions-8w9ozxZu.js → register.status-health-sessions-D6zw9jEo.js} +21 -21
- package/dist/{register.subclis-CVoUut4t.js → register.subclis-wD5LH765.js} +14 -14
- package/dist/{registry-CgglAnC7.js → registry-D9ygkK-J.js} +16 -1
- package/dist/{registry-BCJPzWx_.js → registry-DXmhuMNN.js} +16 -1
- package/dist/{reply-CpkHy3wV.js → reply-BPyGc21s.js} +353 -252
- package/dist/{run-main-DVyW2mVM.js → run-main-BO3usZ-A.js} +31 -31
- package/dist/{runs-iCVe22VF.js → runs-CtVQdtCv.js} +3 -3
- package/dist/{runs-Bun_kfif.js → runs-DjV90EYQ.js} +3 -3
- package/dist/{sandbox-pyeWrCaV.js → sandbox-Ccrfvb4b.js} +1 -1
- package/dist/{sandbox-CXLDlrIZ.js → sandbox-DBFMSva5.js} +1 -1
- package/dist/{sandbox-cli-nBppHONP.js → sandbox-cli-DxInKUJI.js} +2 -2
- package/dist/{sandbox-cli-CMnng7eJ.js → sandbox-cli-OTGBxEm_.js} +2 -2
- package/dist/{security-cli-DuNJZ-Ei.js → security-cli-Co10dXWR.js} +4 -4
- package/dist/{security-cli-BpflDIfE.js → security-cli-DSgesPkw.js} +4 -4
- package/dist/{send-CL3duJwW.js → send-BtRCVZMD.js} +1 -1
- package/dist/{send-BwFFAjWq.js → send-BxEC6ayq.js} +1 -1
- package/dist/{server-CMJV3f4W.js → server-BGy6Q3Ax.js} +4 -4
- package/dist/{server-5xIglB3V.js → server-C3Vsqd_E.js} +4 -4
- package/dist/{server-context-Cx2NYfSp.js → server-context-DiEIfJy2.js} +2 -2
- package/dist/{server-context-daohIOGc.js → server-context-r5GX0zkd.js} +2 -2
- package/dist/{server-lifecycle-D0-_LBBT.js → server-lifecycle-BDErerYF.js} +1 -1
- package/dist/{server-lifecycle-CKBiEtss.js → server-lifecycle-DqbPo314.js} +1 -1
- package/dist/{server-node-events-vW0YHKwt.js → server-node-events-ChUVYwTP.js} +19 -19
- package/dist/{server-node-events-BQQYrHHB.js → server-node-events-Db-E97pM.js} +19 -19
- package/dist/{sessions-Dcih4bpg.js → sessions-Dn5cV2Pf.js} +4 -4
- package/dist/{sessions-DchHZ7Jk.js → sessions-DzJqAydH.js} +4 -4
- package/dist/{status-mrMAbwVG.js → status-Bf4zCRwM.js} +4 -4
- package/dist/{status-BjoY6IRI.js → status-CAV6ho-G.js} +4 -4
- package/dist/{task-pipeline-boot-BnDb_vd5.js → task-pipeline-boot-BKmOoIXl.js} +18 -18
- package/dist/{task-pipeline-boot-Dz-2vl8h.js → task-pipeline-boot-pOb3fzno.js} +18 -18
- package/dist/{tui-D38RxYz7.js → tui-CsUcRlyO.js} +1 -1
- package/dist/{tui-cli-BkKp2XZs.js → tui-cli-Cq1Tx-Vn.js} +4 -4
- package/dist/{tui-cli-Is0rb0gd.js → tui-cli-FOxD0i98.js} +4 -4
- package/dist/{tui-CJp8jICV.js → tui-zuajkssQ.js} +1 -1
- package/dist/{update-BUduR5-s.js → update-CACBGz8F.js} +1 -1
- package/dist/{update-cli-BBtLigXU.js → update-cli-Bp7ecypG.js} +27 -27
- package/dist/{update-cli-ClRpFc93.js → update-cli-ClagbSmM.js} +28 -28
- package/dist/{update-ChZwR6OQ.js → update-lhW3ysS7.js} +1 -1
- package/dist/{update-runner-CQ4RhlO2.js → update-runner-BsEMwbDG.js} +1 -1
- package/dist/{update-runner-CjxlBtRb.js → update-runner-DUxab4MB.js} +1 -1
- package/dist/{validation-cli-DK_AzuGz.js → validation-cli-Ct5O6YX2.js} +19 -19
- package/dist/{validation-cli-C2vEL_mG.js → validation-cli-CwePEn-0.js} +19 -19
- package/dist/{with-timeout-kxY3Q2kO.js → with-timeout-DAeX1wSi.js} +2 -2
- package/dist/{with-timeout-B8tTesnN.js → with-timeout-Ef5FGyJ7.js} +2 -2
- package/extensions/acpx/openclaw.plugin.json +1 -1
- package/extensions/acpx/package.json +1 -1
- package/extensions/acpx/src/bundled-acpx.e2e.test.ts +32 -0
- package/extensions/acpx/src/config.pin.test.ts +77 -0
- package/extensions/acpx/src/config.test.ts +14 -0
- package/extensions/acpx/src/config.ts +14 -2
- package/extensions/anthropic/package.json +1 -1
- package/extensions/bifrost/package.json +1 -1
- package/extensions/bluebubbles/package.json +1 -1
- package/extensions/copilot-proxy/package.json +1 -1
- package/extensions/deepgram/package.json +1 -1
- package/extensions/deepinfra/package.json +1 -1
- package/extensions/diagnostics-otel/package.json +1 -1
- package/extensions/diffs/package.json +1 -1
- package/extensions/discord/package.json +1 -1
- package/extensions/dream-cycle/package.json +1 -1
- package/extensions/elevenlabs/package.json +1 -1
- package/extensions/feishu/package.json +1 -1
- package/extensions/gemini-search/package.json +1 -1
- package/extensions/google/package.json +1 -1
- package/extensions/google-gemini-cli-auth/package.json +1 -1
- package/extensions/googlechat/package.json +1 -1
- package/extensions/grok-search/package.json +1 -1
- package/extensions/groq/package.json +1 -1
- package/extensions/imessage/package.json +1 -1
- package/extensions/irc/package.json +1 -1
- package/extensions/kimi-search/package.json +1 -1
- package/extensions/learning-core/package.json +1 -1
- package/extensions/line/package.json +1 -1
- package/extensions/llm-task/package.json +1 -1
- package/extensions/lobster/package.json +1 -1
- package/extensions/matrix/CHANGELOG.md +1 -1
- package/extensions/matrix/package.json +1 -1
- package/extensions/mattermost/package.json +1 -1
- package/extensions/memory-core/package.json +1 -1
- package/extensions/memory-lancedb/package.json +1 -1
- package/extensions/minimax/package.json +1 -1
- package/extensions/minimax-portal-auth/package.json +1 -1
- package/extensions/mistral/package.json +1 -1
- package/extensions/moonshot/package.json +1 -1
- package/extensions/msteams/CHANGELOG.md +1 -1
- package/extensions/msteams/package.json +1 -1
- package/extensions/nextcloud-talk/package.json +1 -1
- package/extensions/nostr/CHANGELOG.md +1 -1
- package/extensions/nostr/package.json +1 -1
- package/extensions/open-prose/package.json +1 -1
- package/extensions/openai/package.json +1 -1
- package/extensions/openai-realtime/package.json +1 -1
- package/extensions/openrouter/package.json +1 -1
- package/extensions/perplexity-search/package.json +1 -1
- package/extensions/searxng-search/package.json +1 -1
- package/extensions/signal/package.json +1 -1
- package/extensions/slack/package.json +1 -1
- package/extensions/synology-chat/package.json +1 -1
- package/extensions/telegram/package.json +1 -1
- package/extensions/tlon/package.json +1 -1
- package/extensions/twitch/CHANGELOG.md +1 -1
- package/extensions/twitch/package.json +1 -1
- package/extensions/voice-call/CHANGELOG.md +1 -1
- package/extensions/voice-call/package.json +1 -1
- package/extensions/whatsapp/package.json +1 -1
- package/extensions/zai/package.json +1 -1
- package/extensions/zalo/CHANGELOG.md +1 -1
- package/extensions/zalo/package.json +1 -1
- package/extensions/zalouser/CHANGELOG.md +1 -1
- package/extensions/zalouser/package.json +1 -1
- package/package.json +1 -1
|
@@ -27,27 +27,27 @@ import { t as runTasksWithConcurrency } from "./run-with-concurrency-o0MDBzAR.js
|
|
|
27
27
|
import { t as PATH_ALIAS_POLICIES } from "./path-alias-guards-evqGxU_Z.js";
|
|
28
28
|
import { i as openFileWithinRoot, l as writeFileWithinRoot, n as copyFileWithinRoot, o as readFileWithinRoot, r as createRootScopedReadFile, t as SafeOpenError } from "./fs-safe-CFXWCabS.js";
|
|
29
29
|
import { r as normalizeInboundTextNewlines, t as finalizeInboundContext } from "./inbound-context-CdwXCKhI.js";
|
|
30
|
-
import { C as normalizeMediaUnderstandingChatType, O as CLI_OUTPUT_MAX_BUFFER, S as resolveTimeoutMs$1, a as resolveAutoImageModel, b as resolveConcurrency, f as stripCarriedTranscriptFromBody, g as registerUnhandledRejectionHandler, i as normalizeMediaAttachments, k as applyTemplate, n as buildProviderRegistry, o as resolveMediaAttachmentLocalRoots, p as buildRandomTempFilePath, r as createMediaAttachmentCache, s as runCapability, t as runAudioTranscription, v as resolveAttachmentKind, w as resolveMediaUnderstandingScope } from "./audio-transcription-runner-
|
|
30
|
+
import { C as normalizeMediaUnderstandingChatType, O as CLI_OUTPUT_MAX_BUFFER, S as resolveTimeoutMs$1, a as resolveAutoImageModel, b as resolveConcurrency, f as stripCarriedTranscriptFromBody, g as registerUnhandledRejectionHandler, i as normalizeMediaAttachments, k as applyTemplate, n as buildProviderRegistry, o as resolveMediaAttachmentLocalRoots, p as buildRandomTempFilePath, r as createMediaAttachmentCache, s as runCapability, t as runAudioTranscription, v as resolveAttachmentKind, w as resolveMediaUnderstandingScope } from "./audio-transcription-runner-CgQwIVTA.js";
|
|
31
31
|
import { n as fetchWithTimeout, t as bindAbortRelay } from "./fetch-timeout-DwpMsAKA.js";
|
|
32
32
|
import { n as withStrictGuardedFetchMode, r as withTrustedEnvProxyGuardedFetchMode, t as fetchWithSsrFGuard } from "./fetch-guard-DsHVh3CH.js";
|
|
33
33
|
import { c as normalizeHostname, i as isBlockedHostnameOrIp, t as SsrFBlockedError } from "./ssrf-DteE35jN.js";
|
|
34
34
|
import { r as makeProxyFetch } from "./proxy-fetch-WIpCY9Rs.js";
|
|
35
35
|
import { t as resolveNetworkSsrFPolicy } from "./ssrf-config-BXebcnwh.js";
|
|
36
|
-
import { A as isLikelyContextOverflowError, B as ensureSessionHeader, C as isAuthAssistantError, D as isContextOverflowError, E as isCompactionFailureError, F as parseImageSizeError, G as estimateBase64DecodedBytes, H as resolveBootstrapTotalMaxChars, I as sanitizeUserFacingText, L as isAuthPermanentErrorMessage, M as isRawApiErrorPayload, N as isTransientHttpError, O as isFailoverAssistantError, P as parseImageDimensionError, R as isTimeoutErrorMessage, S as getApiErrorPayloadFingerprint, T as isCloudCodeAssistFormatError, U as sanitizeGoogleTurnOrdering, V as resolveBootstrapMaxChars, W as canonicalizeBase64, _ as BILLING_ERROR_USER_MESSAGE, a as isMessagingToolDuplicateNormalized, b as formatBillingErrorMessage, c as sanitizeImageBlocks, d as extractToolCallsFromAssistant, f as extractToolResultId, g as isGoogleModelApi, h as downgradeOpenAIReasoningBlocks, j as isRateLimitAssistantError, k as isFailoverErrorMessage, l as sanitizeToolResultImages, m as downgradeOpenAIFunctionCallReasoningPairs, n as validateGeminiTurns, o as normalizeTextForComparison, p as sanitizeToolCallIdsForCloudCodeAssist, r as pickFallbackThinkingLevel, s as sanitizeSessionMessagesImages, t as validateAnthropicTurns, u as resolveImageSanitizationLimits, v as classifyFailoverReason, w as isBillingAssistantError, x as formatRawAssistantErrorForUi, y as formatAssistantErrorText, z as buildBootstrapContextFiles } from "./pi-embedded-helpers-
|
|
36
|
+
import { A as isLikelyContextOverflowError, B as ensureSessionHeader, C as isAuthAssistantError, D as isContextOverflowError, E as isCompactionFailureError, F as parseImageSizeError, G as estimateBase64DecodedBytes, H as resolveBootstrapTotalMaxChars, I as sanitizeUserFacingText, L as isAuthPermanentErrorMessage, M as isRawApiErrorPayload, N as isTransientHttpError, O as isFailoverAssistantError, P as parseImageDimensionError, R as isTimeoutErrorMessage, S as getApiErrorPayloadFingerprint, T as isCloudCodeAssistFormatError, U as sanitizeGoogleTurnOrdering, V as resolveBootstrapMaxChars, W as canonicalizeBase64, _ as BILLING_ERROR_USER_MESSAGE, a as isMessagingToolDuplicateNormalized, b as formatBillingErrorMessage, c as sanitizeImageBlocks, d as extractToolCallsFromAssistant, f as extractToolResultId, g as isGoogleModelApi, h as downgradeOpenAIReasoningBlocks, j as isRateLimitAssistantError, k as isFailoverErrorMessage, l as sanitizeToolResultImages, m as downgradeOpenAIFunctionCallReasoningPairs, n as validateGeminiTurns, o as normalizeTextForComparison, p as sanitizeToolCallIdsForCloudCodeAssist, r as pickFallbackThinkingLevel, s as sanitizeSessionMessagesImages, t as validateAnthropicTurns, u as resolveImageSanitizationLimits, v as classifyFailoverReason, w as isBillingAssistantError, x as formatRawAssistantErrorForUi, y as formatAssistantErrorText, z as buildBootstrapContextFiles } from "./pi-embedded-helpers-D5ZuAV5B.js";
|
|
37
37
|
import { a as readResponseWithLimit, i as fetchRemoteMedia, n as getDefaultMediaLocalRoots, r as MediaFetchError, t as getAgentScopedMediaLocalRoots } from "./local-roots-ngvEfSO3.js";
|
|
38
38
|
import { c as detectMime, d as imageMimeFromFormat, f as isAudioFileName, g as MAX_IMAGE_BYTES, i as getImageMetadata, l as extensionForMime, m as kindFromMime, p as isGifMedia, s as resizeToJpeg, v as mediaKindFromMime } from "./image-ops-BowqCANs.js";
|
|
39
39
|
import { a as testRegexWithBoundedInput, i as compileSafeRegex, n as redactSensitiveText } from "./redact-CQtYLB4a.js";
|
|
40
40
|
import { a as formatUncaughtError, c as readErrorName, i as formatErrorMessage, o as hasErrnoCode, r as formatErrorChainMessage, t as collectErrorGraphCandidates } from "./errors-z_JCBnTo.js";
|
|
41
41
|
import { t as ensureOpenClawModelsJson } from "./models-config-_c2AGLMB.js";
|
|
42
42
|
import { n as loadModelCatalog, r as modelSupportsVision, t as findModelInCatalog } from "./model-catalog-DAQQWV_3.js";
|
|
43
|
-
import { a as decodeDataUrl, i as coerceImageModelConfig, o as resolveProviderVisionModelFromConfig, r as coerceImageAssistantText, s as minimaxUnderstandImage } from "./provider-image-
|
|
43
|
+
import { a as decodeDataUrl, i as coerceImageModelConfig, o as resolveProviderVisionModelFromConfig, r as coerceImageAssistantText, s as minimaxUnderstandImage } from "./provider-image-22SjivgZ.js";
|
|
44
44
|
import { n as discoverModels, t as discoverAuthStorage } from "./pi-model-discovery-wtLK6xpF.js";
|
|
45
|
-
import { a as formatReasoningMessage, d as stripThinkingTagsFromText, f as stripReasoningTagsFromText, h as extractTextFromChatContent, l as stripDowngradedToolCallText, m as isInsideCode, n as extractAssistantThinking, o as inferToolMetaFromArgs, p as findCodeRegions, s as isAssistantMessage, t as extractAssistantText$1, u as stripMinimaxToolCallXml } from "./pi-embedded-utils-
|
|
46
|
-
import { C as resolveToolProfilePolicy, S as normalizeToolName, T as matchesAnyGlobPattern, _ as collectExplicitAllowlist, a as ensureSandboxWorkspaceForSession, b as stripPluginOnlyAllowlist, c as resolveSandboxRuntimeStatus, d as getBridgeAuthForPort, f as resolveSandboxConfigForAgent, g as buildPluginToolGroups, h as applyOwnerOnlyToolPolicy, o as resolveSandboxContext, v as expandPolicyWithPluginGroups, w as compileGlobPatterns, x as expandToolGroups, y as mergeAlsoAllowPolicy } from "./sandbox-
|
|
45
|
+
import { a as formatReasoningMessage, d as stripThinkingTagsFromText, f as stripReasoningTagsFromText, h as extractTextFromChatContent, l as stripDowngradedToolCallText, m as isInsideCode, n as extractAssistantThinking, o as inferToolMetaFromArgs, p as findCodeRegions, s as isAssistantMessage, t as extractAssistantText$1, u as stripMinimaxToolCallXml } from "./pi-embedded-utils-DWIHcGJr.js";
|
|
46
|
+
import { C as resolveToolProfilePolicy, S as normalizeToolName, T as matchesAnyGlobPattern, _ as collectExplicitAllowlist, a as ensureSandboxWorkspaceForSession, b as stripPluginOnlyAllowlist, c as resolveSandboxRuntimeStatus, d as getBridgeAuthForPort, f as resolveSandboxConfigForAgent, g as buildPluginToolGroups, h as applyOwnerOnlyToolPolicy, o as resolveSandboxContext, v as expandPolicyWithPluginGroups, w as compileGlobPatterns, x as expandToolGroups, y as mergeAlsoAllowPolicy } from "./sandbox-DBFMSva5.js";
|
|
47
47
|
import { c as resolveExistingPathsWithinRoot, g as DEFAULT_AI_SNAPSHOT_MAX_CHARS, s as DEFAULT_UPLOAD_DIR } from "./extension-relay-auth-hu5huW-V.js";
|
|
48
48
|
import { i as isLoopbackHost, u as resolveClientIp } from "./ws-DQqtdyj2.js";
|
|
49
49
|
import { r as trimToUndefined, t as resolveGatewayCredentialsFromConfig } from "./credentials-Ciy3bAsI.js";
|
|
50
|
-
import { a as resolveBrowserControlAuth } from "./server-context-
|
|
50
|
+
import { a as resolveBrowserControlAuth } from "./server-context-DiEIfJy2.js";
|
|
51
51
|
import { a as resolveSkillsPromptForRun, d as resolveSandboxInputPath, h as applySkillEnvOverridesFromSnapshot, i as loadWorkspaceSkillEntries, l as assertMediaNotDataUrl, m as applySkillEnvOverrides, p as resolveSandboxedMediaSource, r as buildWorkspaceSkillSnapshot, u as assertSandboxPath } from "./skills-D3298giF.js";
|
|
52
52
|
import { i as saveMediaBuffer, r as getMediaDir, t as MEDIA_MAX_BYTES } from "./store-CkkGo0Uh.js";
|
|
53
53
|
import { r as resolveBrowserConfig } from "./trash-BHEYKIMt.js";
|
|
@@ -59,8 +59,8 @@ import { _ as resolveProviderPromptCacheKey, a as toInternalMessageReceivedConte
|
|
|
59
59
|
import { a as resolveNativeSkillsEnabled, i as resolveNativeCommandsEnabled, n as isNativeCommandsExplicitlyDisabled, r as isRestartEnabled, t as isCommandFlagEnabled } from "./commands-Bml5tD4l.js";
|
|
60
60
|
import { a as listChatCommands, c as listNativeCommandSpecsForConfig, d as parseCommandArgs, f as resolveCommandArgChoices, h as shouldHandleTextCommands, i as isCommandEnabled, l as maybeResolveTextAlias, m as serializeCommandArgs, o as listChatCommandsForConfig, p as resolveCommandArgMenu, r as findCommandByNativeName, s as listNativeCommandSpecs, t as buildCommandTextFromArgs, u as normalizeCommandBody } from "./commands-registry-BGLbCzUF.js";
|
|
61
61
|
import { t as redactIdentifier } from "./redact-identifier-CSPL9LuH.js";
|
|
62
|
-
import { a as
|
|
63
|
-
import { c as enqueueAgentTurn, d as mergeDelayedAgentTurn, f as peekDelayedAgentTurn, i as agentTurnIdempotencyKey, l as isClaimableAgentTurnWorkId, m as KeyedAsyncQueue, o as clearDelayedReleaseHold, p as setDelayedReleaseHold } from "./agent-turn-enqueue-
|
|
62
|
+
import { a as AcpRuntimeError, i as ACP_ERROR_CODES, n as requireAcpRuntimeBackend, o as toAcpRuntimeError, r as waitForAcpRuntimeBackendHealthy, s as withAcpRuntimeErrorBoundary, t as getAcpRuntimeBackend } from "./registry-D9ygkK-J.js";
|
|
63
|
+
import { c as enqueueAgentTurn, d as mergeDelayedAgentTurn, f as peekDelayedAgentTurn, i as agentTurnIdempotencyKey, l as isClaimableAgentTurnWorkId, m as KeyedAsyncQueue, o as clearDelayedReleaseHold, p as setDelayedReleaseHold } from "./agent-turn-enqueue-DYZlZypS.js";
|
|
64
64
|
import { _n as SESSION_LABEL_MAX_LENGTH, t as GatewayClient } from "./client-D9R5Q0-0.js";
|
|
65
65
|
import { n as docsSiteUrl, t as DOCS_SITE_URL } from "./docs-site-CQKzDXJz.js";
|
|
66
66
|
import { b as resolveLeastPrivilegeOperatorScopesForMethod, i as callGatewayLeastPrivilege, n as callGateway, s as randomIdempotencyKey, t as buildGatewayConnectionDetails } from "./call-BlR2U-2i.js";
|
|
@@ -76,12 +76,12 @@ import { n as formatExecCommand } from "./system-run-command-Cld-efhz.js";
|
|
|
76
76
|
import { i as parsePairingList, n as resolveNodeIdFromNodeList, r as parseNodeList, t as resolveNodeFromNodeList } from "./node-resolve-BeyCAGYI.js";
|
|
77
77
|
import { i as formatDurationSeconds, r as formatDurationPrecise, t as formatDurationCompact$1 } from "./format-duration-XLSvPvzN.js";
|
|
78
78
|
import { d as redactChannelCorrelation, o as getDiagnosticSessionState } from "./diagnostic-session-state-C6JXU3l4.js";
|
|
79
|
-
import { C as logToolExecutionStarted, D as recordSystemPromptHashComparison, E as logWebhookReceived, F as resetCommandPollCount, M as stopDiagnosticHeartbeat, N as boundDiagnosticContent, O as refreshRunProgress, P as recordCommandPoll, S as logToolExecutionCompleted, T as logWebhookProcessed, c as logMessageQueued, f as logRunCompleted, j as startDiagnosticHeartbeat, m as logSessionStateChange, p as logRunStarted, s as logMessageProcessed, u as logModelCallError, w as logWebhookError, x as logToolExecutionBlocked } from "./diagnostic-
|
|
79
|
+
import { C as logToolExecutionStarted, D as recordSystemPromptHashComparison, E as logWebhookReceived, F as resetCommandPollCount, M as stopDiagnosticHeartbeat, N as boundDiagnosticContent, O as refreshRunProgress, P as recordCommandPoll, S as logToolExecutionCompleted, T as logWebhookProcessed, c as logMessageQueued, f as logRunCompleted, j as startDiagnosticHeartbeat, m as logSessionStateChange, p as logRunStarted, s as logMessageProcessed, u as logModelCallError, w as logWebhookError, x as logToolExecutionBlocked } from "./diagnostic-NcPdstx1.js";
|
|
80
80
|
import { t as CommandLane } from "./lanes-DA0g5tPR.js";
|
|
81
|
-
import { C as registerAgentRunContext, S as onAgentEvent, _ as createInlineCodeState, a as isEmbeddedPiRunActive, b as emitAgentEvent, c as queueEmbeddedPiMessage, d as waitForEmbeddedPiRunEnd, f as handleMessageEnd, g as buildCodeSpanIndex, h as emitEmbeddedAgentEvent, m as handleMessageUpdate, n as clearActiveEmbeddedRun, p as handleMessageStart, s as isEmbeddedPiRunStreaming, t as abortEmbeddedPiRun, u as setActiveEmbeddedRun, v as endModelCall, y as clearAgentRunContext } from "./runs-
|
|
82
|
-
import { a as getMachineDisplayName, i as startBrowserControlServiceFromConfig, n as createBrowserRouteDispatcher, r as createBrowserControlContext, t as withTimeout$4 } from "./with-timeout-
|
|
83
|
-
import { i as enqueueCommandInLane, n as clearCommandLane, o as getCommandLaneSnapshots, s as getQueueSize, t as CommandLaneAbortedError } from "./command-queue-
|
|
84
|
-
import { $ as resolveTelegramMediaPlaceholder, A as recordUpdate, B as buildTelegramGroupFrom, C as renderTelegramHtmlText, D as getTelegramFleetSupervisor, E as fingerprintTelegramToken, F as splitTelegramCaption, G as describeReplyTarget, H as buildTelegramParentPeer, I as withTelegramApiErrorLogging, J as hasBotMention, K as expandTextLinks, L as buildGroupLabel, M as registerAccount, N as releaseAccountOwner, O as recordApiRequest, P as resolveTelegramFetch, Q as resolveTelegramGroupAllowFromContext, R as buildSenderLabel, S as markdownToTelegramHtml, U as buildTelegramThreadParams, V as buildTelegramGroupPeerId, W as buildTypingThreadParams, X as resolveTelegramDirectPeerId, Y as normalizeForwardedContext, Z as resolveTelegramForumThreadId, _ as isRecoverableTelegramNetworkError, a as reactMessageTelegram, at as normalizeDmAllowFromWithStore$1, b as isTelegramEditMayHaveLandedError, c as sendStickerTelegram, ct as toLocationContext, d as loadCronStore, dt as resolveTelegramTargetChatType, et as resolveTelegramReplyId, f as resolveCronStorePath, g as isDefiniteTelegramRequestNonDeliveryError, h as extractTelegramErrorText, i as editMessageTelegram, it as normalizeAllowFrom$2, j as recordWebhook, k as recordState, lt as isVoiceCompatibleAudio, m as wasSentByBot, n as createForumTopicTelegram, nt as resolveTelegramThreadSpec, o as sendMessageTelegram, ot as resolveSenderAllowMatch$1, q as extractTelegramLocation, r as deleteMessageTelegram, rt as isSenderAllowed$1, s as sendPollTelegram, st as formatLocationText, t as buildInlineKeyboard, tt as resolveTelegramStreamMode, u as resolveTelegramVoiceSend, ut as parseTelegramTarget, v as isSafeToRetrySendError, w as wrapFileReferencesInHtml, x as markdownToTelegramChunks, y as isTelegramClientRejection, z as buildSenderName } from "./send-
|
|
81
|
+
import { C as registerAgentRunContext, S as onAgentEvent, _ as createInlineCodeState, a as isEmbeddedPiRunActive, b as emitAgentEvent, c as queueEmbeddedPiMessage, d as waitForEmbeddedPiRunEnd, f as handleMessageEnd, g as buildCodeSpanIndex, h as emitEmbeddedAgentEvent, m as handleMessageUpdate, n as clearActiveEmbeddedRun, p as handleMessageStart, s as isEmbeddedPiRunStreaming, t as abortEmbeddedPiRun, u as setActiveEmbeddedRun, v as endModelCall, y as clearAgentRunContext } from "./runs-DjV90EYQ.js";
|
|
82
|
+
import { a as getMachineDisplayName, i as startBrowserControlServiceFromConfig, n as createBrowserRouteDispatcher, r as createBrowserControlContext, t as withTimeout$4 } from "./with-timeout-DAeX1wSi.js";
|
|
83
|
+
import { i as enqueueCommandInLane, n as clearCommandLane, o as getCommandLaneSnapshots, s as getQueueSize, t as CommandLaneAbortedError } from "./command-queue-DkA7Zwf6.js";
|
|
84
|
+
import { $ as resolveTelegramMediaPlaceholder, A as recordUpdate, B as buildTelegramGroupFrom, C as renderTelegramHtmlText, D as getTelegramFleetSupervisor, E as fingerprintTelegramToken, F as splitTelegramCaption, G as describeReplyTarget, H as buildTelegramParentPeer, I as withTelegramApiErrorLogging, J as hasBotMention, K as expandTextLinks, L as buildGroupLabel, M as registerAccount, N as releaseAccountOwner, O as recordApiRequest, P as resolveTelegramFetch, Q as resolveTelegramGroupAllowFromContext, R as buildSenderLabel, S as markdownToTelegramHtml, U as buildTelegramThreadParams, V as buildTelegramGroupPeerId, W as buildTypingThreadParams, X as resolveTelegramDirectPeerId, Y as normalizeForwardedContext, Z as resolveTelegramForumThreadId, _ as isRecoverableTelegramNetworkError, a as reactMessageTelegram, at as normalizeDmAllowFromWithStore$1, b as isTelegramEditMayHaveLandedError, c as sendStickerTelegram, ct as toLocationContext, d as loadCronStore, dt as resolveTelegramTargetChatType, et as resolveTelegramReplyId, f as resolveCronStorePath, g as isDefiniteTelegramRequestNonDeliveryError, h as extractTelegramErrorText, i as editMessageTelegram, it as normalizeAllowFrom$2, j as recordWebhook, k as recordState, lt as isVoiceCompatibleAudio, m as wasSentByBot, n as createForumTopicTelegram, nt as resolveTelegramThreadSpec, o as sendMessageTelegram, ot as resolveSenderAllowMatch$1, q as extractTelegramLocation, r as deleteMessageTelegram, rt as isSenderAllowed$1, s as sendPollTelegram, st as formatLocationText, t as buildInlineKeyboard, tt as resolveTelegramStreamMode, u as resolveTelegramVoiceSend, ut as parseTelegramTarget, v as isSafeToRetrySendError, w as wrapFileReferencesInHtml, x as markdownToTelegramChunks, y as isTelegramClientRejection, z as buildSenderName } from "./send-BxEC6ayq.js";
|
|
85
85
|
import { i as buildModelAliasLines, n as resolveModel } from "./model-N_Y5W1BV.js";
|
|
86
86
|
import { n as resolveLearningWorkspaceDir, t as resolveSessionConsumerAgentIds } from "./session-consumer-agents-D5byV1mY.js";
|
|
87
87
|
import { i as resolveModelCostConfig, n as formatTokenCount$2, r as formatUsd, t as estimateUsageCost } from "./usage-format-CRaaWHld.js";
|
|
@@ -91,7 +91,7 @@ import { a as chunkText, c as resolveChunkDelivery, d as resolveTextChunkLimit,
|
|
|
91
91
|
import { n as resolveMarkdownTableMode } from "./markdown-tables-B5qBCQXU.js";
|
|
92
92
|
import { a as loadWebMedia, i as getDefaultLocalRoots, o as loadWebMediaRaw } from "./ir-HuNomy04.js";
|
|
93
93
|
import { n as splitMediaFromOutput, t as parseReplyDirectives } from "./reply-directives-BkJwYaR3.js";
|
|
94
|
-
import { _ as normalizeChannelTargetInput, a as normalizeOutboundPayloadsForJson, b as loadChannelOutboundAdapter, c as applyReplyThreading, d as isRenderablePayload, f as shouldSuppressMessagingToolReplies, g as buildTargetResolverSignature, h as resolveReplyToMode, i as normalizeOutboundPayloads, l as filterMessagingToolDuplicates, m as createReplyToModeFilterForChannel, o as normalizeReplyPayloadsForDelivery, p as shouldSuppressReasoningPayload, r as formatOutboundPayloadLog, s as applyReplyTagsToPayload, t as deliverOutboundPayloads, u as filterMessagingToolMediaDuplicates, v as normalizeTargetForProvider, y as throwIfAborted } from "./deliver-
|
|
94
|
+
import { _ as normalizeChannelTargetInput, a as normalizeOutboundPayloadsForJson, b as loadChannelOutboundAdapter, c as applyReplyThreading, d as isRenderablePayload, f as shouldSuppressMessagingToolReplies, g as buildTargetResolverSignature, h as resolveReplyToMode, i as normalizeOutboundPayloads, l as filterMessagingToolDuplicates, m as createReplyToModeFilterForChannel, o as normalizeReplyPayloadsForDelivery, p as shouldSuppressReasoningPayload, r as formatOutboundPayloadLog, s as applyReplyTagsToPayload, t as deliverOutboundPayloads, u as filterMessagingToolMediaDuplicates, v as normalizeTargetForProvider, y as throwIfAborted } from "./deliver-DNaGsPae.js";
|
|
95
95
|
import { n as resolveMessageChannelSelection, t as listConfiguredMessageChannels } from "./channel-selection-DpIr9fz1.js";
|
|
96
96
|
import { n as recordChannelActivity, o as normalizePollInput, r as createDiscordRetryRunner, t as getChannelActivity } from "./channel-activity-2wNXcvfp.js";
|
|
97
97
|
import { i as applyPluginAutoEnable, r as resolveTelegramPollingTimeout } from "./polling-timeout-D7Q4J23w.js";
|
|
@@ -100,7 +100,7 @@ import { t as buildOutboundMediaLoadOptions } from "./load-options-Ct6g-e1R.js";
|
|
|
100
100
|
import { a as formatIMessageChatTarget, c as parseIMessageTarget, i as DEFAULT_IMESSAGE_PROBE_TIMEOUT_MS, o as isAllowedIMessageSender, r as createIMessageRpcClient, s as normalizeIMessageHandle, t as sendMessageIMessage } from "./send-DF_OS0Df.js";
|
|
101
101
|
import { n as resolveAgentRoute, t as buildAgentSessionKey } from "./resolve-route-DqS1n_Kz.js";
|
|
102
102
|
import { n as isSenderIdAllowed, r as mergeDmAllowFromSources, t as firstDefined$1 } from "./allow-from-CSMqKzZa.js";
|
|
103
|
-
import { a as resolveSubagentToolPolicy, c as readStoreAllowFromForDmPolicy, d as resolvePinnedMainDmOwnerFromAllowlist, f as resolveCommandAuthorizedFromAuthorizers, i as resolveGroupToolPolicy, n as isToolAllowedByPolicies, p as resolveControlCommandGate, r as resolveEffectiveToolPolicy, s as DM_GROUP_ACCESS_REASON, t as filterToolsByPolicy, u as resolveDmGroupAccessWithLists } from "./pi-tools.policy-
|
|
103
|
+
import { a as resolveSubagentToolPolicy, c as readStoreAllowFromForDmPolicy, d as resolvePinnedMainDmOwnerFromAllowlist, f as resolveCommandAuthorizedFromAuthorizers, i as resolveGroupToolPolicy, n as isToolAllowedByPolicies, p as resolveControlCommandGate, r as resolveEffectiveToolPolicy, s as DM_GROUP_ACCESS_REASON, t as filterToolsByPolicy, u as resolveDmGroupAccessWithLists } from "./pi-tools.policy-Bx7WTWRE.js";
|
|
104
104
|
import { t as convertMarkdownTables } from "./tables-bSiouNH6.js";
|
|
105
105
|
import { t as createTelegramPollingTransport } from "./proxy-DQ8K6THv.js";
|
|
106
106
|
import { n as isDangerousNameMatchingEnabled } from "./dangerous-name-matching-BtJNZJcz.js";
|
|
@@ -113,7 +113,7 @@ import { o as resolveSessionRunStore, r as inferSessionRunKind, t as createSessi
|
|
|
113
113
|
import { r as detectBinary } from "./onboard-helpers-BTA9Mr1h.js";
|
|
114
114
|
import { t as resolvePairingIdLabel } from "./pairing-labels-BIAKgiWl.js";
|
|
115
115
|
import { t as recordInboundSessionMetaSafe } from "./session-meta-CP9RuOjX.js";
|
|
116
|
-
import { i as getAgentTurnRuntime, o as tryGetAgentTurnRuntime } from "./agent-turn-runner-
|
|
116
|
+
import { i as getAgentTurnRuntime, o as tryGetAgentTurnRuntime } from "./agent-turn-runner-CIynRYol.js";
|
|
117
117
|
import { i as resolveMemoryBackendConfig, n as registerMemoryCli, r as getMemorySearchManager } from "./memory-cli-B_7Qj7wH.js";
|
|
118
118
|
import { r as resolveMemorySearchConfig } from "./manager-DMezcAFd.js";
|
|
119
119
|
import { i as parseAbsoluteTimeMs, r as resolveDefaultCronStaggerMs, t as normalizeCronStaggerMs } from "./stagger-BIZMWR_z.js";
|
|
@@ -510,7 +510,7 @@ function resolveAgentTimeoutMs(opts) {
|
|
|
510
510
|
|
|
511
511
|
//#endregion
|
|
512
512
|
//#region src/agents/workspace-lanes.ts
|
|
513
|
-
const log$
|
|
513
|
+
const log$35 = createSubsystemLogger("agents/workspace-lanes");
|
|
514
514
|
const DEFAULT_ROOT_TEMPLATE = "~/.openclaw/agents/{agentId}/lanes/{laneId}/workspace";
|
|
515
515
|
const SUPPORTED_STRATEGY = "hybrid";
|
|
516
516
|
const DEFAULT_COPIED_ON_CREATE_FILES = ["USER.md", "BOOTSTRAP.md"];
|
|
@@ -663,7 +663,7 @@ function resolveWorkspaceLane(params) {
|
|
|
663
663
|
actor: params.actor
|
|
664
664
|
});
|
|
665
665
|
if (!keyResult.ok) {
|
|
666
|
-
log$
|
|
666
|
+
log$35.warn("workspace lane key denied", {
|
|
667
667
|
agentId,
|
|
668
668
|
laneKeySource: keyResult.laneKeySource,
|
|
669
669
|
reason: keyResult.reason
|
|
@@ -684,7 +684,7 @@ function resolveWorkspaceLane(params) {
|
|
|
684
684
|
laneId: key.laneId
|
|
685
685
|
});
|
|
686
686
|
if (!rootTemplate.ok) {
|
|
687
|
-
log$
|
|
687
|
+
log$35.warn("workspace lane root template denied", {
|
|
688
688
|
agentId,
|
|
689
689
|
laneId: key.laneId,
|
|
690
690
|
laneKeySource: key.laneKeySource,
|
|
@@ -702,7 +702,7 @@ function resolveWorkspaceLane(params) {
|
|
|
702
702
|
}
|
|
703
703
|
const effectiveWorkspaceDir = rootTemplate.effectiveWorkspaceDir;
|
|
704
704
|
if (strategy !== SUPPORTED_STRATEGY) {
|
|
705
|
-
log$
|
|
705
|
+
log$35.warn("workspace lane strategy denied", {
|
|
706
706
|
agentId,
|
|
707
707
|
strategy
|
|
708
708
|
});
|
|
@@ -797,7 +797,7 @@ async function resolveWorkspaceLaneForTurn(params) {
|
|
|
797
797
|
if ((config?.create ?? "on-first-message") !== "on-first-message") {
|
|
798
798
|
const pathState = await getExistingPathState(resolution.effectiveWorkspaceDir);
|
|
799
799
|
if (pathState !== "directory") {
|
|
800
|
-
log$
|
|
800
|
+
log$35.warn("workspace lane manual creation denied", {
|
|
801
801
|
agentId: resolution.agentId,
|
|
802
802
|
laneId: resolution.laneId,
|
|
803
803
|
laneKeySource: resolution.laneKeySource,
|
|
@@ -823,7 +823,7 @@ async function resolveWorkspaceLaneForTurn(params) {
|
|
|
823
823
|
targetRoot: resolution.effectiveWorkspaceDir,
|
|
824
824
|
relativePath: file
|
|
825
825
|
});
|
|
826
|
-
if (decision === "copied" || !existed) log$
|
|
826
|
+
if (decision === "copied" || !existed) log$35.info("workspace lane seed file decision", {
|
|
827
827
|
agentId: resolution.agentId,
|
|
828
828
|
laneId: resolution.laneId,
|
|
829
829
|
laneKeySource: resolution.laneKeySource,
|
|
@@ -832,7 +832,7 @@ async function resolveWorkspaceLaneForTurn(params) {
|
|
|
832
832
|
});
|
|
833
833
|
}
|
|
834
834
|
const created = !existed;
|
|
835
|
-
if (created) log$
|
|
835
|
+
if (created) log$35.info("workspace lane created", {
|
|
836
836
|
agentId: resolution.agentId,
|
|
837
837
|
laneId: resolution.laneId,
|
|
838
838
|
laneKeySource: resolution.laneKeySource
|
|
@@ -1383,7 +1383,7 @@ async function sendTranscriptEcho(params) {
|
|
|
1383
1383
|
}
|
|
1384
1384
|
const text = formatEchoTranscript(transcript, params.format ?? DEFAULT_ECHO_TRANSCRIPT_FORMAT);
|
|
1385
1385
|
try {
|
|
1386
|
-
const { deliverOutboundPayloads } = await import("./deliver-
|
|
1386
|
+
const { deliverOutboundPayloads } = await import("./deliver-DNaGsPae.js").then((n) => n.n);
|
|
1387
1387
|
await deliverOutboundPayloads({
|
|
1388
1388
|
cfg,
|
|
1389
1389
|
channel: normalizedChannel,
|
|
@@ -2825,6 +2825,9 @@ var SessionActorQueue = class {
|
|
|
2825
2825
|
|
|
2826
2826
|
//#endregion
|
|
2827
2827
|
//#region src/acp/control-plane/manager.core.ts
|
|
2828
|
+
const log$34 = createSubsystemLogger("acp/manager");
|
|
2829
|
+
const STARTUP_RECONCILE_BACKEND_WAIT_MS = 3e4;
|
|
2830
|
+
const STARTUP_RECONCILE_BACKEND_POLL_MS = 250;
|
|
2828
2831
|
var AcpSessionManager = class {
|
|
2829
2832
|
constructor(deps = DEFAULT_DEPS) {
|
|
2830
2833
|
this.deps = deps;
|
|
@@ -2902,34 +2905,54 @@ var AcpSessionManager = class {
|
|
|
2902
2905
|
failed: failed + 1
|
|
2903
2906
|
};
|
|
2904
2907
|
}
|
|
2908
|
+
const logFailure = (sessionKey, acpError) => {
|
|
2909
|
+
const redactedKey = redactIdentifier(sessionKey);
|
|
2910
|
+
log$34.warn(`startup identity reconcile failed for ${redactedKey}: code=${acpError.code} ${acpError.message.replaceAll(sessionKey, redactedKey)}`);
|
|
2911
|
+
};
|
|
2912
|
+
const toReconcileError = (error) => toAcpRuntimeError({
|
|
2913
|
+
error,
|
|
2914
|
+
fallbackCode: "ACP_SESSION_INIT_FAILED",
|
|
2915
|
+
fallbackMessage: "ACP startup identity reconcile failed."
|
|
2916
|
+
});
|
|
2917
|
+
const deferred = [];
|
|
2905
2918
|
for (const session of acpSessions) {
|
|
2906
2919
|
if (!session.acp || !session.sessionKey) continue;
|
|
2907
2920
|
if (!isSessionIdentityPending(resolveSessionIdentityFromMeta(session.acp))) continue;
|
|
2908
2921
|
checked += 1;
|
|
2909
2922
|
try {
|
|
2910
|
-
if (await this.
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
if (resolution.kind !== "ready") return false;
|
|
2916
|
-
const { runtime, handle, meta } = await this.ensureRuntimeHandle({
|
|
2917
|
-
cfg: params.cfg,
|
|
2923
|
+
if (await this.reconcileOneSessionIdentity(params.cfg, session.sessionKey)) resolved += 1;
|
|
2924
|
+
} catch (error) {
|
|
2925
|
+
const acpError = toReconcileError(error);
|
|
2926
|
+
if (acpError.code === "ACP_BACKEND_UNAVAILABLE") {
|
|
2927
|
+
deferred.push({
|
|
2918
2928
|
sessionKey: session.sessionKey,
|
|
2919
|
-
|
|
2929
|
+
backend: (session.acp.backend || params.cfg.acp?.backend || "").trim()
|
|
2920
2930
|
});
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
sessionKey: session.sessionKey,
|
|
2924
|
-
runtime,
|
|
2925
|
-
handle,
|
|
2926
|
-
meta,
|
|
2927
|
-
failOnStatusError: false
|
|
2928
|
-
})).meta));
|
|
2929
|
-
})) resolved += 1;
|
|
2930
|
-
} catch (error) {
|
|
2931
|
+
continue;
|
|
2932
|
+
}
|
|
2931
2933
|
failed += 1;
|
|
2932
|
-
|
|
2934
|
+
logFailure(session.sessionKey, acpError);
|
|
2935
|
+
}
|
|
2936
|
+
}
|
|
2937
|
+
if (deferred.length > 0) {
|
|
2938
|
+
const backendIds = [...new Set(deferred.map(({ backend }) => backend))];
|
|
2939
|
+
const healthyByBackend = new Map(await Promise.all(backendIds.map(async (backend) => [backend, await waitForAcpRuntimeBackendHealthy({
|
|
2940
|
+
id: backend || void 0,
|
|
2941
|
+
timeoutMs: params.backendWaitMs ?? STARTUP_RECONCILE_BACKEND_WAIT_MS,
|
|
2942
|
+
pollMs: params.backendPollMs ?? STARTUP_RECONCILE_BACKEND_POLL_MS
|
|
2943
|
+
})])));
|
|
2944
|
+
for (const { sessionKey, backend } of deferred) {
|
|
2945
|
+
if (!healthyByBackend.get(backend)) {
|
|
2946
|
+
failed += 1;
|
|
2947
|
+
logFailure(sessionKey, new AcpRuntimeError("ACP_BACKEND_UNAVAILABLE", `ACP runtime backend${backend ? ` "${backend}"` : ""} did not become healthy before the startup wait expired.`));
|
|
2948
|
+
continue;
|
|
2949
|
+
}
|
|
2950
|
+
try {
|
|
2951
|
+
if (await this.reconcileOneSessionIdentity(params.cfg, sessionKey)) resolved += 1;
|
|
2952
|
+
} catch (error) {
|
|
2953
|
+
failed += 1;
|
|
2954
|
+
logFailure(sessionKey, toReconcileError(error));
|
|
2955
|
+
}
|
|
2933
2956
|
}
|
|
2934
2957
|
}
|
|
2935
2958
|
return {
|
|
@@ -2938,6 +2961,37 @@ var AcpSessionManager = class {
|
|
|
2938
2961
|
failed
|
|
2939
2962
|
};
|
|
2940
2963
|
}
|
|
2964
|
+
async reconcileOneSessionIdentity(cfg, sessionKey) {
|
|
2965
|
+
return await this.withSessionActor(sessionKey, async () => {
|
|
2966
|
+
const resolution = this.resolveSession({
|
|
2967
|
+
cfg,
|
|
2968
|
+
sessionKey
|
|
2969
|
+
});
|
|
2970
|
+
if (resolution.kind !== "ready") return false;
|
|
2971
|
+
const { runtime, handle, meta } = await this.ensureRuntimeHandle({
|
|
2972
|
+
cfg,
|
|
2973
|
+
sessionKey,
|
|
2974
|
+
meta: resolution.meta
|
|
2975
|
+
});
|
|
2976
|
+
try {
|
|
2977
|
+
return !isSessionIdentityPending(resolveSessionIdentityFromMeta((await this.reconcileRuntimeSessionIdentifiers({
|
|
2978
|
+
cfg,
|
|
2979
|
+
sessionKey,
|
|
2980
|
+
runtime,
|
|
2981
|
+
handle,
|
|
2982
|
+
meta,
|
|
2983
|
+
failOnStatusError: true
|
|
2984
|
+
})).meta));
|
|
2985
|
+
} catch (error) {
|
|
2986
|
+
const stored = this.deps.readSessionEntry({
|
|
2987
|
+
cfg,
|
|
2988
|
+
sessionKey
|
|
2989
|
+
})?.acp;
|
|
2990
|
+
if (stored && !isSessionIdentityPending(resolveSessionIdentityFromMeta(stored))) return true;
|
|
2991
|
+
throw error;
|
|
2992
|
+
}
|
|
2993
|
+
});
|
|
2994
|
+
}
|
|
2941
2995
|
async initializeSession(input) {
|
|
2942
2996
|
const sessionKey = normalizeSessionKey$1(input.sessionKey);
|
|
2943
2997
|
if (!sessionKey) throw new AcpRuntimeError("ACP_SESSION_INIT_FAILED", "ACP session key is required.");
|
|
@@ -8275,7 +8329,7 @@ function createRunRegistry(options) {
|
|
|
8275
8329
|
|
|
8276
8330
|
//#endregion
|
|
8277
8331
|
//#region src/process/supervisor/supervisor.ts
|
|
8278
|
-
const log$
|
|
8332
|
+
const log$33 = createSubsystemLogger("process/supervisor");
|
|
8279
8333
|
function clampTimeout(value) {
|
|
8280
8334
|
if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) return;
|
|
8281
8335
|
return Math.max(1, Math.floor(value));
|
|
@@ -8461,7 +8515,7 @@ function createProcessSupervisor() {
|
|
|
8461
8515
|
exitCode: null,
|
|
8462
8516
|
exitSignal: null
|
|
8463
8517
|
});
|
|
8464
|
-
log$
|
|
8518
|
+
log$33.warn(`spawn failed: runId=${runId} reason=${String(err)}`);
|
|
8465
8519
|
throw err;
|
|
8466
8520
|
}
|
|
8467
8521
|
};
|
|
@@ -13038,7 +13092,7 @@ async function applyBootstrapHookOverrides(params) {
|
|
|
13038
13092
|
|
|
13039
13093
|
//#endregion
|
|
13040
13094
|
//#region src/agents/system-prompt-config.ts
|
|
13041
|
-
const log$
|
|
13095
|
+
const log$32 = createSubsystemLogger("agents/system-prompt-config");
|
|
13042
13096
|
const DEFAULT_PROMPT_SOURCE_MAX_CHARS = 2e4;
|
|
13043
13097
|
const MAX_PROMPT_SOURCE_FILE_BYTES = 512 * 1024;
|
|
13044
13098
|
const MAX_PROMPT_SOURCE_FILE_BYTES_HARD = 8 * 1024 * 1024;
|
|
@@ -13224,7 +13278,7 @@ async function readPromptSourceFile(params) {
|
|
|
13224
13278
|
if (!opened.ok) {
|
|
13225
13279
|
promptSourceCache.delete(absolutePath);
|
|
13226
13280
|
if (params.optional) {
|
|
13227
|
-
if (opened.reason !== "path") log$
|
|
13281
|
+
if (opened.reason !== "path") log$32.warn("skipping optional systemPrompt source: present but unusable", {
|
|
13228
13282
|
file: params.file,
|
|
13229
13283
|
reason: opened.reason
|
|
13230
13284
|
});
|
|
@@ -13248,7 +13302,7 @@ async function readPromptSourceFile(params) {
|
|
|
13248
13302
|
} catch (error) {
|
|
13249
13303
|
promptSourceCache.delete(opened.path);
|
|
13250
13304
|
if (params.optional) {
|
|
13251
|
-
log$
|
|
13305
|
+
log$32.warn("skipping optional systemPrompt source after read error", {
|
|
13252
13306
|
file: params.file,
|
|
13253
13307
|
error
|
|
13254
13308
|
});
|
|
@@ -13827,7 +13881,7 @@ function createPreparedEmbeddedPiSettingsManager(params) {
|
|
|
13827
13881
|
|
|
13828
13882
|
//#endregion
|
|
13829
13883
|
//#region src/plugins/activation-migration.ts
|
|
13830
|
-
const log$
|
|
13884
|
+
const log$31 = createSubsystemLogger("plugins/activation-migration");
|
|
13831
13885
|
/**
|
|
13832
13886
|
* One-time migration from the presence-implies-load model to explicit-enable (ADR 0016).
|
|
13833
13887
|
* Runs synchronously inside loadOpenClawPlugins, before resolveEnableState is applied.
|
|
@@ -13869,7 +13923,7 @@ function runActivationMigrationIfNeeded(config, pluginRecords) {
|
|
|
13869
13923
|
activationMigrationVersion: 1
|
|
13870
13924
|
}
|
|
13871
13925
|
};
|
|
13872
|
-
if (toEnable.size > 0) log$
|
|
13926
|
+
if (toEnable.size > 0) log$31.info(`activation migration v1: auto-enabled ${toEnable.size} previously-active plugin(s)`, { ids: [...toEnable] });
|
|
13873
13927
|
return next;
|
|
13874
13928
|
}
|
|
13875
13929
|
|
|
@@ -13947,7 +14001,7 @@ function resolveEmbeddedSessionLane(key) {
|
|
|
13947
14001
|
|
|
13948
14002
|
//#endregion
|
|
13949
14003
|
//#region src/plugins/runtime/runtime-analysis-direct.ts
|
|
13950
|
-
const log$
|
|
14004
|
+
const log$30 = createSubsystemLogger("plugins/runtime/analysis");
|
|
13951
14005
|
const NEUTRAL_ANALYSIS_SYSTEM_PROMPT = "You are running a focused internal analysis for a WednesdayAI extension. Return only the requested result.";
|
|
13952
14006
|
function isJsonResponseFormat(params) {
|
|
13953
14007
|
return params.responseFormat === "json" || typeof params.responseFormat === "object" && params.responseFormat.type === "json_schema";
|
|
@@ -14007,8 +14061,8 @@ async function runDirectAnalysis(req, overrides) {
|
|
|
14007
14061
|
elapsedMs: full.elapsedMs,
|
|
14008
14062
|
error: full.error
|
|
14009
14063
|
};
|
|
14010
|
-
if (full.status === "ok" || full.status === "empty") log$
|
|
14011
|
-
else log$
|
|
14064
|
+
if (full.status === "ok" || full.status === "empty") log$30.info("direct analysis run", logFields);
|
|
14065
|
+
else log$30.warn("direct analysis run failed", logFields);
|
|
14012
14066
|
return full;
|
|
14013
14067
|
};
|
|
14014
14068
|
const controller = new AbortController();
|
|
@@ -14147,7 +14201,7 @@ async function runDirectAnalysis(req, overrides) {
|
|
|
14147
14201
|
|
|
14148
14202
|
//#endregion
|
|
14149
14203
|
//#region src/plugins/runtime/runtime-analysis.ts
|
|
14150
|
-
const log$
|
|
14204
|
+
const log$29 = createSubsystemLogger("plugins/runtime/analysis");
|
|
14151
14205
|
const DEFAULT_RUN_TIMEOUT_MS = 15e3;
|
|
14152
14206
|
const MIN_TIMEOUT_MS = 250;
|
|
14153
14207
|
const MAX_TIMEOUT_MS = 12e4;
|
|
@@ -14188,7 +14242,7 @@ function finalizeAnalysisResult(result, cfg, transport) {
|
|
|
14188
14242
|
const { costUsd: _untrusted, ...rest } = result;
|
|
14189
14243
|
let usageState = result.usageState;
|
|
14190
14244
|
if (usageState === void 0) {
|
|
14191
|
-
log$
|
|
14245
|
+
log$29.warn("analysis result missing usageState; treating the call as spent", {
|
|
14192
14246
|
transport,
|
|
14193
14247
|
status: result.status,
|
|
14194
14248
|
provider: result.provider,
|
|
@@ -14617,7 +14671,7 @@ async function executeAnalysisTransport(params, deps, fallbackTimeoutMs, lane, c
|
|
|
14617
14671
|
if (err instanceof CommandLaneAbortedError && !providerDispatched) return queuedCancellation();
|
|
14618
14672
|
const message = err instanceof Error ? err.message : String(err);
|
|
14619
14673
|
const status = /timed?\s*out|timeout/i.test(message) ? "timeout" : "error";
|
|
14620
|
-
log$
|
|
14674
|
+
log$29.warn("analysis run failed", {
|
|
14621
14675
|
purpose: params.purpose,
|
|
14622
14676
|
pluginId: params.pluginId,
|
|
14623
14677
|
status,
|
|
@@ -14678,7 +14732,7 @@ function createRuntimeAnalysis(deps = {}, concurrencyConfig) {
|
|
|
14678
14732
|
try {
|
|
14679
14733
|
await onComplete(result);
|
|
14680
14734
|
} catch (err) {
|
|
14681
|
-
log$
|
|
14735
|
+
log$29.warn("analysis enqueue completion failed", {
|
|
14682
14736
|
purpose: params.purpose,
|
|
14683
14737
|
error: err instanceof Error ? err.message : String(err)
|
|
14684
14738
|
});
|
|
@@ -14734,7 +14788,7 @@ function createRuntimeAnalysis(deps = {}, concurrencyConfig) {
|
|
|
14734
14788
|
(async () => {
|
|
14735
14789
|
try {
|
|
14736
14790
|
const result = await executeAnalysis(job.params, mergedDeps, DEFAULT_RUN_TIMEOUT_MS, CommandLane.Analysis);
|
|
14737
|
-
log$
|
|
14791
|
+
log$29.info("analysis run completed", {
|
|
14738
14792
|
pluginId: job.params.pluginId,
|
|
14739
14793
|
purpose: job.params.purpose,
|
|
14740
14794
|
durationMs: result.elapsedMs,
|
|
@@ -14783,7 +14837,7 @@ function createRuntimeAnalysis(deps = {}, concurrencyConfig) {
|
|
|
14783
14837
|
const parallelSlot = activeParallelRuns;
|
|
14784
14838
|
try {
|
|
14785
14839
|
const result = await executeAnalysis(runParams, mergedDeps, DEFAULT_RUN_TIMEOUT_MS, CommandLane.Analysis);
|
|
14786
|
-
log$
|
|
14840
|
+
log$29.info("analysis run completed", {
|
|
14787
14841
|
pluginId: runParams.pluginId,
|
|
14788
14842
|
purpose: params.purpose,
|
|
14789
14843
|
durationMs: result.elapsedMs,
|
|
@@ -14821,7 +14875,7 @@ function createRuntimeAnalysis(deps = {}, concurrencyConfig) {
|
|
|
14821
14875
|
});
|
|
14822
14876
|
}
|
|
14823
14877
|
const admissionBoundary = limitsForPlugin(key).maxSequentialPerPlugin > 0 && readCount(queuedAwaitedAnalysisRunsByPlugin, key) >= limitsForPlugin(key).maxSequentialPerPlugin ? "plugin-queue" : maxSequential > 0 && sequentialQueue.length >= maxSequential ? "global-queue" : readCount(activeAwaitedAnalysisRunsByPlugin, key) >= limitsForPlugin(key).maxParallelPerPlugin ? "plugin-active" : "global-active";
|
|
14824
|
-
log$
|
|
14878
|
+
log$29.info("analysis run rejected", {
|
|
14825
14879
|
pluginId: runParams.pluginId,
|
|
14826
14880
|
purpose: params.purpose,
|
|
14827
14881
|
error: "analysis concurrency limit exceeded",
|
|
@@ -20383,7 +20437,7 @@ async function routeReply(params) {
|
|
|
20383
20437
|
const resolvedReplyToId = replyToId ?? (channelId === "slack" && threadId != null && threadId !== "" ? String(threadId) : void 0);
|
|
20384
20438
|
const resolvedThreadId = channelId === "slack" ? null : threadId ?? null;
|
|
20385
20439
|
try {
|
|
20386
|
-
const { deliverOutboundPayloads } = await import("./deliver-
|
|
20440
|
+
const { deliverOutboundPayloads } = await import("./deliver-DNaGsPae.js").then((n) => n.n);
|
|
20387
20441
|
const outboundSession = buildOutboundSessionContext({
|
|
20388
20442
|
cfg,
|
|
20389
20443
|
agentId: resolvedAgentId,
|
|
@@ -23642,7 +23696,7 @@ async function describeStickerImage(params) {
|
|
|
23642
23696
|
logVerbose(`telegram: describing sticker with ${provider}/${model}`);
|
|
23643
23697
|
try {
|
|
23644
23698
|
const buffer = await fs$1.readFile(imagePath);
|
|
23645
|
-
const { describeImageWithModel } = await import("./provider-image-
|
|
23699
|
+
const { describeImageWithModel } = await import("./provider-image-22SjivgZ.js").then((n) => n.n);
|
|
23646
23700
|
return (await describeImageWithModel({
|
|
23647
23701
|
buffer,
|
|
23648
23702
|
fileName: "sticker.webp",
|
|
@@ -25232,7 +25286,7 @@ async function resolveDiscordPreflightAudioMentionContext(params) {
|
|
|
25232
25286
|
let transcript;
|
|
25233
25287
|
let carry;
|
|
25234
25288
|
if (needsPreflightTranscription) try {
|
|
25235
|
-
const { transcribeFirstAudio } = await import("./audio-preflight-
|
|
25289
|
+
const { transcribeFirstAudio } = await import("./audio-preflight-DKIH97xz.js");
|
|
25236
25290
|
const uploadable = audioAttachments.filter((att) => typeof att.url === "string" && att.url.length > 0);
|
|
25237
25291
|
if (uploadable.length > 0) {
|
|
25238
25292
|
const preflight = await transcribeFirstAudio({
|
|
@@ -30803,7 +30857,7 @@ function toDiscordModelPickerMessagePayload(view) {
|
|
|
30803
30857
|
|
|
30804
30858
|
//#endregion
|
|
30805
30859
|
//#region src/discord/monitor/native-command.ts
|
|
30806
|
-
const log$
|
|
30860
|
+
const log$28 = createSubsystemLogger("discord/native-command");
|
|
30807
30861
|
function buildDiscordCommandOptions(params) {
|
|
30808
30862
|
const { command, cfg } = params;
|
|
30809
30863
|
const args = command.args;
|
|
@@ -31860,7 +31914,7 @@ async function dispatchDiscordCommandInteraction(params) {
|
|
|
31860
31914
|
},
|
|
31861
31915
|
onError: (err, info) => {
|
|
31862
31916
|
const message = err instanceof Error ? err.stack ?? err.message : String(err);
|
|
31863
|
-
log$
|
|
31917
|
+
log$28.error(`discord slash ${info.kind} reply failed: ${message}`);
|
|
31864
31918
|
}
|
|
31865
31919
|
},
|
|
31866
31920
|
replyOptions: {
|
|
@@ -34006,7 +34060,7 @@ function resolveRunWorkspaceDir(params) {
|
|
|
34006
34060
|
|
|
34007
34061
|
//#endregion
|
|
34008
34062
|
//#region src/agents/cli-runner.ts
|
|
34009
|
-
const log$
|
|
34063
|
+
const log$27 = createSubsystemLogger("agent/claude-cli");
|
|
34010
34064
|
async function runCliAgent(params) {
|
|
34011
34065
|
const started = Date.now();
|
|
34012
34066
|
const workspaceResolution = resolveRunWorkspaceDir({
|
|
@@ -34019,7 +34073,7 @@ async function runCliAgent(params) {
|
|
|
34019
34073
|
const redactedSessionId = redactRunIdentifier(params.sessionId);
|
|
34020
34074
|
const redactedSessionKey = redactRunIdentifier(params.sessionKey);
|
|
34021
34075
|
const redactedWorkspace = redactRunIdentifier(resolvedWorkspace);
|
|
34022
|
-
if (workspaceResolution.usedFallback) log$
|
|
34076
|
+
if (workspaceResolution.usedFallback) log$27.warn(`[workspace-fallback] caller=runCliAgent reason=${workspaceResolution.fallbackReason} run=${params.runId} session=${redactedSessionId} sessionKey=${redactedSessionKey} agent=${workspaceResolution.agentId} workspace=${redactedWorkspace}`);
|
|
34023
34077
|
const workspaceDir = resolvedWorkspace;
|
|
34024
34078
|
const backendResolved = resolveCliBackendConfig(params.provider, params.config);
|
|
34025
34079
|
if (!backendResolved) throw new Error(`Unknown CLI backend: ${params.provider}`);
|
|
@@ -34049,7 +34103,7 @@ async function runCliAgent(params) {
|
|
|
34049
34103
|
resolvedSystemPrompt,
|
|
34050
34104
|
warn: makeBootstrapWarn({
|
|
34051
34105
|
sessionLabel,
|
|
34052
|
-
warn: (message) => log$
|
|
34106
|
+
warn: (message) => log$27.warn(message)
|
|
34053
34107
|
})
|
|
34054
34108
|
});
|
|
34055
34109
|
const heartbeatPrompt = sessionAgentId === defaultAgentId ? resolveHeartbeatPrompt$1(params.config?.agents?.defaults?.heartbeat?.prompt) : void 0;
|
|
@@ -34112,7 +34166,7 @@ async function runCliAgent(params) {
|
|
|
34112
34166
|
const queueKey = backend.serialize ?? true ? backendResolved.id : `${backendResolved.id}:${params.runId}`;
|
|
34113
34167
|
try {
|
|
34114
34168
|
return await enqueueCliRun(queueKey, async () => {
|
|
34115
|
-
log$
|
|
34169
|
+
log$27.info(`cli exec: provider=${params.provider} model=${normalizedModel} promptChars=${params.prompt.length}`);
|
|
34116
34170
|
const logOutputText = isTruthyEnvValue(process.env.OPENCLAW_CLAUDE_CLI_LOG_OUTPUT);
|
|
34117
34171
|
if (logOutputText) {
|
|
34118
34172
|
const logArgs = [];
|
|
@@ -34145,7 +34199,7 @@ async function runCliAgent(params) {
|
|
|
34145
34199
|
const promptIndex = logArgs.indexOf(argsPrompt);
|
|
34146
34200
|
if (promptIndex >= 0) logArgs[promptIndex] = `<prompt:${argsPrompt.length} chars>`;
|
|
34147
34201
|
}
|
|
34148
|
-
log$
|
|
34202
|
+
log$27.info(`cli argv: ${backend.command} ${logArgs.join(" ")}`);
|
|
34149
34203
|
}
|
|
34150
34204
|
const env = (() => {
|
|
34151
34205
|
const next = {
|
|
@@ -34183,17 +34237,17 @@ async function runCliAgent(params) {
|
|
|
34183
34237
|
const stdout = result.stdout.trim();
|
|
34184
34238
|
const stderr = result.stderr.trim();
|
|
34185
34239
|
if (logOutputText) {
|
|
34186
|
-
if (stdout) log$
|
|
34187
|
-
if (stderr) log$
|
|
34240
|
+
if (stdout) log$27.info(`cli stdout:\n${stdout}`);
|
|
34241
|
+
if (stderr) log$27.info(`cli stderr:\n${stderr}`);
|
|
34188
34242
|
}
|
|
34189
34243
|
if (shouldLogVerbose()) {
|
|
34190
|
-
if (stdout) log$
|
|
34191
|
-
if (stderr) log$
|
|
34244
|
+
if (stdout) log$27.debug(`cli stdout:\n${stdout}`);
|
|
34245
|
+
if (stderr) log$27.debug(`cli stderr:\n${stderr}`);
|
|
34192
34246
|
}
|
|
34193
34247
|
if (result.exitCode !== 0 || result.reason !== "exit") {
|
|
34194
34248
|
if (result.reason === "no-output-timeout" || result.noOutputTimedOut) {
|
|
34195
34249
|
const timeoutReason = `CLI produced no output for ${Math.round(noOutputTimeoutMs / 1e3)}s and was terminated.`;
|
|
34196
|
-
log$
|
|
34250
|
+
log$27.warn(`cli watchdog timeout: provider=${params.provider} model=${modelId} session=${resolvedSessionId ?? params.sessionId} noOutputTimeoutMs=${noOutputTimeoutMs} pid=${managedRun.pid ?? "unknown"}`);
|
|
34197
34251
|
throw new FailoverError(timeoutReason, {
|
|
34198
34252
|
reason: "timeout",
|
|
34199
34253
|
provider: params.provider,
|
|
@@ -34247,7 +34301,7 @@ async function runCliAgent(params) {
|
|
|
34247
34301
|
} catch (err) {
|
|
34248
34302
|
if (err instanceof FailoverError) {
|
|
34249
34303
|
if (err.reason === "session_expired" && params.cliSessionId && params.sessionKey) {
|
|
34250
|
-
log$
|
|
34304
|
+
log$27.warn(`CLI session expired, clearing session ID and retrying: provider=${params.provider} session=${redactRunIdentifier(params.cliSessionId)}`);
|
|
34251
34305
|
const output = await executeCliWithSession(void 0);
|
|
34252
34306
|
const text = output.text?.trim();
|
|
34253
34307
|
return {
|
|
@@ -34709,7 +34763,7 @@ function createDefaultDeps() {
|
|
|
34709
34763
|
};
|
|
34710
34764
|
},
|
|
34711
34765
|
sendMessageTelegram: async (...args) => {
|
|
34712
|
-
const { sendMessageTelegram } = await import("./send-
|
|
34766
|
+
const { sendMessageTelegram } = await import("./send-BxEC6ayq.js").then((n) => n.l);
|
|
34713
34767
|
return await sendMessageTelegram(...args);
|
|
34714
34768
|
},
|
|
34715
34769
|
sendMessageDiscord: async (...args) => {
|
|
@@ -35161,7 +35215,7 @@ function resolveSession(opts) {
|
|
|
35161
35215
|
|
|
35162
35216
|
//#endregion
|
|
35163
35217
|
//#region src/commands/agent.ts
|
|
35164
|
-
const log$
|
|
35218
|
+
const log$26 = createSubsystemLogger("commands/agent");
|
|
35165
35219
|
const OVERRIDE_FIELDS_CLEARED_BY_DELETE = [
|
|
35166
35220
|
"providerOverride",
|
|
35167
35221
|
"modelOverride",
|
|
@@ -35219,7 +35273,7 @@ function runAgentAttempt(params) {
|
|
|
35219
35273
|
});
|
|
35220
35274
|
return runCliWithSession(cliSessionId).catch(async (err) => {
|
|
35221
35275
|
if (err instanceof FailoverError && err.reason === "session_expired" && cliSessionId && params.sessionKey && params.sessionStore && params.storePath) {
|
|
35222
|
-
log$
|
|
35276
|
+
log$26.warn(`CLI session expired, clearing from session store: provider=${params.providerOverride} sessionKey=${params.sessionKey}`);
|
|
35223
35277
|
const entry = params.sessionStore[params.sessionKey];
|
|
35224
35278
|
if (entry) {
|
|
35225
35279
|
const updatedEntry = { ...entry };
|
|
@@ -53130,7 +53184,7 @@ const buildTelegramMessageContext = async ({ primaryCtx, allMedia, replyMedia =
|
|
|
53130
53184
|
let audioPreflightCarry;
|
|
53131
53185
|
const audioConfigEnabled = cfg.tools?.media?.audio && cfg.tools.media.audio.enabled !== false;
|
|
53132
53186
|
if (hasAudio && !hasUserText && !disableAudioPreflight && (isGroup && requireMention && mentionRegexes.length > 0 || audioConfigEnabled === true)) try {
|
|
53133
|
-
const { transcribeFirstAudio } = await import("./audio-preflight-
|
|
53187
|
+
const { transcribeFirstAudio } = await import("./audio-preflight-DKIH97xz.js");
|
|
53134
53188
|
const preflight = await transcribeFirstAudio({
|
|
53135
53189
|
ctx: {
|
|
53136
53190
|
MediaPaths: allMedia.length > 0 ? allMedia.map((m) => m.path) : void 0,
|
|
@@ -55823,7 +55877,7 @@ const TELEGRAM_WEBHOOK_MAX_BODY_BYTES = 1024 * 1024;
|
|
|
55823
55877
|
const TELEGRAM_WEBHOOK_BODY_TIMEOUT_MS = 3e4;
|
|
55824
55878
|
const TELEGRAM_WEBHOOK_CALLBACK_TIMEOUT_MS = 1e4;
|
|
55825
55879
|
const TELEGRAM_WEBHOOK_DEFAULT_MAX_CONNECTIONS = 40;
|
|
55826
|
-
const log$
|
|
55880
|
+
const log$25 = createSubsystemLogger("telegram/webhook");
|
|
55827
55881
|
let webhookOwnerSequence = 0;
|
|
55828
55882
|
let ephemeralWebhookListenerSequence = 0;
|
|
55829
55883
|
let activeWebhookDiagnosticUsers = 0;
|
|
@@ -56153,7 +56207,7 @@ async function startTelegramWebhook(opts) {
|
|
|
56153
56207
|
recordRequest({ outcome: "received" });
|
|
56154
56208
|
const secretHeader = resolveSingleHeaderValue(req.headers["x-telegram-bot-api-secret-token"]);
|
|
56155
56209
|
if (!hasValidTelegramWebhookSecret(secretHeader, secret)) {
|
|
56156
|
-
log$
|
|
56210
|
+
log$25.warn("telegram webhook secret rejected", {
|
|
56157
56211
|
sourceIp: resolveWebhookSourceIp(req),
|
|
56158
56212
|
reason: typeof secretHeader === "string" ? "secret-mismatch" : "missing-header",
|
|
56159
56213
|
path
|
|
@@ -56248,7 +56302,7 @@ async function startTelegramWebhook(opts) {
|
|
|
56248
56302
|
const unauthorized = async () => {
|
|
56249
56303
|
if (replied) return;
|
|
56250
56304
|
replied = true;
|
|
56251
|
-
log$
|
|
56305
|
+
log$25.warn("telegram webhook secret rejected", {
|
|
56252
56306
|
sourceIp: resolveWebhookSourceIp(req),
|
|
56253
56307
|
reason: typeof secretHeader === "string" ? "secret-mismatch" : "missing-header",
|
|
56254
56308
|
path
|
|
@@ -57280,7 +57334,7 @@ const BACKGROUND_IDLE_RECHECK_MS = 1e3;
|
|
|
57280
57334
|
const BACKGROUND_IDLE_MAX_ATTEMPTS = 30;
|
|
57281
57335
|
const backgroundIdleAttempts = /* @__PURE__ */ new Map();
|
|
57282
57336
|
const SIGNAL_DEADLINE_GRACE_MS = 0;
|
|
57283
|
-
const log$
|
|
57337
|
+
const log$24 = createSubsystemLogger("agent-signals");
|
|
57284
57338
|
function normalizeTrimmed(value) {
|
|
57285
57339
|
return value?.trim() || void 0;
|
|
57286
57340
|
}
|
|
@@ -57566,7 +57620,7 @@ function dispatchHeartbeatSignal(signal, now = Date.now()) {
|
|
|
57566
57620
|
if (!signal.sessionKey) return false;
|
|
57567
57621
|
if (signal.requiresIdle === true) {
|
|
57568
57622
|
if (signal.notBeforeMs !== void 0 && now > signal.notBeforeMs + SIGNAL_DEADLINE_GRACE_MS) {
|
|
57569
|
-
log$
|
|
57623
|
+
log$24.warn("agent-signals: evicting requiresIdle heartbeat signal past its deadline", {
|
|
57570
57624
|
signalId: signal.id,
|
|
57571
57625
|
type: signal.type,
|
|
57572
57626
|
source: signal.source,
|
|
@@ -57916,7 +57970,7 @@ function setBackgroundRunHandler(handler) {
|
|
|
57916
57970
|
|
|
57917
57971
|
//#endregion
|
|
57918
57972
|
//#region src/infra/nudge.ts
|
|
57919
|
-
const log$
|
|
57973
|
+
const log$23 = createSubsystemLogger("infra/nudge");
|
|
57920
57974
|
function renderSummary(text, data) {
|
|
57921
57975
|
if (data && Object.keys(data).length > 0) try {
|
|
57922
57976
|
return `${text}\n\nData:\n${JSON.stringify(data, null, 2)}`;
|
|
@@ -57950,14 +58004,14 @@ function requestNudge(input, cfg = loadConfig(), deps) {
|
|
|
57950
58004
|
const enqueue = deps.enqueueAgentTurn;
|
|
57951
58005
|
try {
|
|
57952
58006
|
enqueue(payload).catch((error) => {
|
|
57953
|
-
log$
|
|
58007
|
+
log$23.warn("nudge enqueue failed", {
|
|
57954
58008
|
error,
|
|
57955
58009
|
sessionKey: redactIdentifier(sessionKey),
|
|
57956
58010
|
signalId
|
|
57957
58011
|
});
|
|
57958
58012
|
});
|
|
57959
58013
|
} catch (error) {
|
|
57960
|
-
log$
|
|
58014
|
+
log$23.warn("nudge enqueue failed", {
|
|
57961
58015
|
error,
|
|
57962
58016
|
sessionKey: redactIdentifier(sessionKey),
|
|
57963
58017
|
signalId
|
|
@@ -57980,14 +58034,14 @@ function requestNudge(input, cfg = loadConfig(), deps) {
|
|
|
57980
58034
|
execute: (claim) => runMainAgentTurn(claim.message.payload)
|
|
57981
58035
|
});
|
|
57982
58036
|
})().catch((error) => {
|
|
57983
|
-
log$
|
|
58037
|
+
log$23.warn("nudge claim chain failed", {
|
|
57984
58038
|
error,
|
|
57985
58039
|
sessionKey: redactIdentifier(sessionKey),
|
|
57986
58040
|
signalId
|
|
57987
58041
|
});
|
|
57988
58042
|
});
|
|
57989
58043
|
} catch (error) {
|
|
57990
|
-
log$
|
|
58044
|
+
log$23.warn("nudge enqueue failed", {
|
|
57991
58045
|
error,
|
|
57992
58046
|
sessionKey: redactIdentifier(sessionKey),
|
|
57993
58047
|
signalId
|
|
@@ -58002,11 +58056,11 @@ function requestNudge(input, cfg = loadConfig(), deps) {
|
|
|
58002
58056
|
|
|
58003
58057
|
//#endregion
|
|
58004
58058
|
//#region src/backbone/authz.ts
|
|
58005
|
-
const log$
|
|
58059
|
+
const log$22 = createSubsystemLogger("backbone/authz");
|
|
58006
58060
|
|
|
58007
58061
|
//#endregion
|
|
58008
58062
|
//#region src/backbone/scoped-plugin-api.ts
|
|
58009
|
-
const log$
|
|
58063
|
+
const log$21 = createSubsystemLogger("backbone/scoped-plugin-api");
|
|
58010
58064
|
|
|
58011
58065
|
//#endregion
|
|
58012
58066
|
//#region src/plugins/runtime/runtime-signals.ts
|
|
@@ -59060,7 +59114,7 @@ function createPluginLoaderLogger(logger) {
|
|
|
59060
59114
|
|
|
59061
59115
|
//#endregion
|
|
59062
59116
|
//#region src/plugins/tools.ts
|
|
59063
|
-
const log$
|
|
59117
|
+
const log$20 = createSubsystemLogger("plugins");
|
|
59064
59118
|
const pluginToolMeta = /* @__PURE__ */ new WeakMap();
|
|
59065
59119
|
function getPluginToolMeta(tool) {
|
|
59066
59120
|
return pluginToolMeta.get(tool);
|
|
@@ -59082,7 +59136,7 @@ function resolvePluginTools(params) {
|
|
|
59082
59136
|
const registry = loadOpenClawPlugins({
|
|
59083
59137
|
config: effectiveConfig,
|
|
59084
59138
|
workspaceDir: params.context.workspaceDir,
|
|
59085
|
-
logger: createPluginLoaderLogger(log$
|
|
59139
|
+
logger: createPluginLoaderLogger(log$20),
|
|
59086
59140
|
activate: false
|
|
59087
59141
|
});
|
|
59088
59142
|
const tools = [];
|
|
@@ -59097,7 +59151,7 @@ function resolvePluginTools(params) {
|
|
|
59097
59151
|
if (existingNormalized.has(pluginIdKey)) {
|
|
59098
59152
|
const message = `plugin id conflicts with core tool name (${entry.pluginId})`;
|
|
59099
59153
|
if (!params.suppressNameConflicts) {
|
|
59100
|
-
log$
|
|
59154
|
+
log$20.error(message);
|
|
59101
59155
|
registry.diagnostics.push({
|
|
59102
59156
|
level: "error",
|
|
59103
59157
|
code: "PLUGIN_REGISTER_ERROR",
|
|
@@ -59114,7 +59168,7 @@ function resolvePluginTools(params) {
|
|
|
59114
59168
|
try {
|
|
59115
59169
|
resolved = entry.factory(params.context);
|
|
59116
59170
|
} catch (err) {
|
|
59117
|
-
log$
|
|
59171
|
+
log$20.error(`plugin tool failed (${entry.pluginId}): ${String(err)}`);
|
|
59118
59172
|
continue;
|
|
59119
59173
|
}
|
|
59120
59174
|
if (!resolved) continue;
|
|
@@ -59131,7 +59185,7 @@ function resolvePluginTools(params) {
|
|
|
59131
59185
|
if (nameSet.has(tool.name) || existing.has(tool.name)) {
|
|
59132
59186
|
const message = `plugin tool name conflict (${entry.pluginId}): ${tool.name}`;
|
|
59133
59187
|
if (!params.suppressNameConflicts) {
|
|
59134
|
-
log$
|
|
59188
|
+
log$20.error(message);
|
|
59135
59189
|
registry.diagnostics.push({
|
|
59136
59190
|
level: "error",
|
|
59137
59191
|
code: "PLUGIN_REGISTER_ERROR",
|
|
@@ -59164,7 +59218,7 @@ function resolvePluginWebSearchProviders(params) {
|
|
|
59164
59218
|
return [...loadOpenClawPlugins({
|
|
59165
59219
|
config: effectiveConfig,
|
|
59166
59220
|
workspaceDir: params.workspaceDir,
|
|
59167
|
-
logger: createPluginLoaderLogger(log$
|
|
59221
|
+
logger: createPluginLoaderLogger(log$20),
|
|
59168
59222
|
activate: false
|
|
59169
59223
|
}).webSearchProviders].toSorted((a, b) => {
|
|
59170
59224
|
return (a.autoDetectOrder ?? Infinity) - (b.autoDetectOrder ?? Infinity);
|
|
@@ -61408,7 +61462,7 @@ const REMINDER_CONTEXT_MESSAGES_MAX = 10;
|
|
|
61408
61462
|
const REMINDER_CONTEXT_PER_MESSAGE_MAX = 220;
|
|
61409
61463
|
const REMINDER_CONTEXT_TOTAL_MAX = 700;
|
|
61410
61464
|
const REMINDER_CONTEXT_MARKER = "\n\nRecent context:\n";
|
|
61411
|
-
const log$
|
|
61465
|
+
const log$19 = createSubsystemLogger("cron-tool");
|
|
61412
61466
|
const AGENT_FORBIDDEN_JOB_FIELDS = new Set(["identity", "state"]);
|
|
61413
61467
|
const JOB_KEYS = new Set([
|
|
61414
61468
|
"name",
|
|
@@ -61544,7 +61598,7 @@ async function buildReminderContextLines(params) {
|
|
|
61544
61598
|
}
|
|
61545
61599
|
return lines;
|
|
61546
61600
|
} catch (err) {
|
|
61547
|
-
log$
|
|
61601
|
+
log$19.warn("reminder context fetch failed", { error: err });
|
|
61548
61602
|
return ["- (context unavailable: gateway unreachable)"];
|
|
61549
61603
|
}
|
|
61550
61604
|
}
|
|
@@ -62352,7 +62406,7 @@ function assertGatewayToolActionAllowed(params) {
|
|
|
62352
62406
|
|
|
62353
62407
|
//#endregion
|
|
62354
62408
|
//#region src/agents/tools/gateway-tool.ts
|
|
62355
|
-
const log$
|
|
62409
|
+
const log$18 = createSubsystemLogger("gateway-tool");
|
|
62356
62410
|
const DEFAULT_UPDATE_TIMEOUT_MS = 20 * 6e4;
|
|
62357
62411
|
const GatewayToolSchema = Type.Object({
|
|
62358
62412
|
action: stringEnum([
|
|
@@ -62420,7 +62474,7 @@ function createGatewayTool(opts) {
|
|
|
62420
62474
|
try {
|
|
62421
62475
|
await writeRestartSentinel(payload);
|
|
62422
62476
|
} catch {}
|
|
62423
|
-
log$
|
|
62477
|
+
log$18.info(`gateway tool: restart requested (delayMs=${delayMs ?? "default"}, reason=${reason ?? "none"})`);
|
|
62424
62478
|
return jsonResult(scheduleGatewaySigusr1Restart({
|
|
62425
62479
|
delayMs,
|
|
62426
62480
|
reason
|
|
@@ -66007,7 +66061,7 @@ async function resolveAnnounceTarget(params) {
|
|
|
66007
66061
|
|
|
66008
66062
|
//#endregion
|
|
66009
66063
|
//#region src/agents/tools/sessions-send-tool.a2a.ts
|
|
66010
|
-
const log$
|
|
66064
|
+
const log$17 = createSubsystemLogger("agents/sessions-send");
|
|
66011
66065
|
async function runSessionsSendA2AFlow(params) {
|
|
66012
66066
|
const runContextId = params.waitRunId ?? "unknown";
|
|
66013
66067
|
try {
|
|
@@ -66102,7 +66156,7 @@ async function runSessionsSendA2AFlow(params) {
|
|
|
66102
66156
|
timeoutMs: 1e4
|
|
66103
66157
|
});
|
|
66104
66158
|
} catch (err) {
|
|
66105
|
-
log$
|
|
66159
|
+
log$17.warn("sessions_send announce delivery failed", {
|
|
66106
66160
|
runId: runContextId,
|
|
66107
66161
|
channel: announceTarget.channel,
|
|
66108
66162
|
to: announceTarget.to,
|
|
@@ -66110,7 +66164,7 @@ async function runSessionsSendA2AFlow(params) {
|
|
|
66110
66164
|
});
|
|
66111
66165
|
}
|
|
66112
66166
|
} catch (err) {
|
|
66113
|
-
log$
|
|
66167
|
+
log$17.warn("sessions_send announce flow failed", {
|
|
66114
66168
|
runId: runContextId,
|
|
66115
66169
|
error: formatErrorMessage(err)
|
|
66116
66170
|
});
|
|
@@ -69275,7 +69329,7 @@ function wrapToolWithAbortSignal(tool, abortSignal) {
|
|
|
69275
69329
|
|
|
69276
69330
|
//#endregion
|
|
69277
69331
|
//#region src/agents/pi-tools.before-tool-call.ts
|
|
69278
|
-
const log$
|
|
69332
|
+
const log$16 = createSubsystemLogger("agents/tools");
|
|
69279
69333
|
const BEFORE_TOOL_CALL_WRAPPED = Symbol("beforeToolCallWrapped");
|
|
69280
69334
|
const adjustedParamsByToolCallId = /* @__PURE__ */ new Map();
|
|
69281
69335
|
const MAX_TRACKED_ADJUSTED_PARAMS = 1024;
|
|
@@ -69313,7 +69367,7 @@ async function recordLoopOutcome(args) {
|
|
|
69313
69367
|
config: args.ctx.loopDetection
|
|
69314
69368
|
});
|
|
69315
69369
|
} catch (err) {
|
|
69316
|
-
log$
|
|
69370
|
+
log$16.warn(`tool loop outcome tracking failed: tool=${args.toolName} error=${String(err)}`);
|
|
69317
69371
|
}
|
|
69318
69372
|
}
|
|
69319
69373
|
var UserCancelledError = class extends Error {
|
|
@@ -69327,7 +69381,7 @@ async function runBeforeToolCallHook(args) {
|
|
|
69327
69381
|
const params = args.params;
|
|
69328
69382
|
if (args.ctx?.sessionKey) {
|
|
69329
69383
|
const { getDiagnosticSessionState } = await import("./diagnostic-session-state-C6JXU3l4.js").then((n) => n.n);
|
|
69330
|
-
const { logToolLoopAction } = await import("./diagnostic-
|
|
69384
|
+
const { logToolLoopAction } = await import("./diagnostic-NcPdstx1.js").then((n) => n.r);
|
|
69331
69385
|
const { detectToolCallLoop, recordToolCall } = await import("./tool-loop-detection-Dpa3SO4M.js");
|
|
69332
69386
|
const sessionState = getDiagnosticSessionState({
|
|
69333
69387
|
sessionKey: args.ctx.sessionKey,
|
|
@@ -69340,7 +69394,7 @@ async function runBeforeToolCallHook(args) {
|
|
|
69340
69394
|
const loopResult = detectToolCallLoop(sessionState, toolName, params, args.ctx.loopDetection);
|
|
69341
69395
|
if (loopResult.stuck) {
|
|
69342
69396
|
if (loopResult.level === "critical") {
|
|
69343
|
-
log$
|
|
69397
|
+
log$16.error(`Blocking ${toolName} due to critical loop: ${loopResult.message}`);
|
|
69344
69398
|
logToolLoopAction({
|
|
69345
69399
|
sessionKey: args.ctx.sessionKey,
|
|
69346
69400
|
sessionId: args.ctx?.agentId,
|
|
@@ -69358,7 +69412,7 @@ async function runBeforeToolCallHook(args) {
|
|
|
69358
69412
|
reason: loopResult.message
|
|
69359
69413
|
};
|
|
69360
69414
|
} else if (shouldEmitLoopWarning(sessionState, loopResult.warningKey ?? `${loopResult.detector}:${toolName}`, loopResult.count)) {
|
|
69361
|
-
log$
|
|
69415
|
+
log$16.warn(`Loop warning for ${toolName}: ${loopResult.message}`);
|
|
69362
69416
|
logToolLoopAction({
|
|
69363
69417
|
sessionKey: args.ctx.sessionKey,
|
|
69364
69418
|
sessionId: args.ctx?.agentId,
|
|
@@ -69417,7 +69471,7 @@ async function runBeforeToolCallHook(args) {
|
|
|
69417
69471
|
}
|
|
69418
69472
|
} catch (err) {
|
|
69419
69473
|
const toolCallId = args.toolCallId ? ` toolCallId=${args.toolCallId}` : "";
|
|
69420
|
-
log$
|
|
69474
|
+
log$16.warn(`before_tool_call hook failed: tool=${toolName}${toolCallId} error=${String(err)}`);
|
|
69421
69475
|
}
|
|
69422
69476
|
return {
|
|
69423
69477
|
blocked: false,
|
|
@@ -71103,7 +71157,7 @@ async function repairSessionFileIfNeeded(params) {
|
|
|
71103
71157
|
|
|
71104
71158
|
//#endregion
|
|
71105
71159
|
//#region src/agents/pi-embedded-runner/logger.ts
|
|
71106
|
-
const log$
|
|
71160
|
+
const log$15 = createSubsystemLogger("agent/embedded");
|
|
71107
71161
|
|
|
71108
71162
|
//#endregion
|
|
71109
71163
|
//#region src/agents/pi-embedded-runner/tool-result-truncation.ts
|
|
@@ -71237,7 +71291,7 @@ async function truncateOversizedToolResultsInSession(params) {
|
|
|
71237
71291
|
const textLength = getToolResultTextLength(msg);
|
|
71238
71292
|
if (textLength > maxChars) {
|
|
71239
71293
|
oversizedIndices.push(i);
|
|
71240
|
-
log$
|
|
71294
|
+
log$15.info(`[tool-result-truncation] Found oversized tool result: entry=${entry.id} chars=${textLength} maxChars=${maxChars} sessionKey=${params.sessionKey ?? params.sessionId ?? "unknown"}`);
|
|
71241
71295
|
}
|
|
71242
71296
|
}
|
|
71243
71297
|
if (oversizedIndices.length === 0) return {
|
|
@@ -71259,7 +71313,7 @@ async function truncateOversizedToolResultsInSession(params) {
|
|
|
71259
71313
|
message = truncateToolResultMessage(message, maxChars);
|
|
71260
71314
|
truncatedCount++;
|
|
71261
71315
|
const newLength = getToolResultTextLength(message);
|
|
71262
|
-
log$
|
|
71316
|
+
log$15.info(`[tool-result-truncation] Truncated tool result: originalEntry=${entry.id} newChars=${newLength} sessionKey=${params.sessionKey ?? params.sessionId ?? "unknown"}`);
|
|
71263
71317
|
}
|
|
71264
71318
|
sessionManager.appendMessage(message);
|
|
71265
71319
|
} else if (entry.type === "compaction") sessionManager.appendCompaction(entry.summary, entry.firstKeptEntryId, entry.tokensBefore, entry.details, entry.fromHook);
|
|
@@ -71273,14 +71327,14 @@ async function truncateOversizedToolResultsInSession(params) {
|
|
|
71273
71327
|
if (entry.name) sessionManager.appendSessionInfo(entry.name);
|
|
71274
71328
|
}
|
|
71275
71329
|
}
|
|
71276
|
-
log$
|
|
71330
|
+
log$15.info(`[tool-result-truncation] Truncated ${truncatedCount} tool result(s) in session (contextWindow=${contextWindowTokens} maxChars=${maxChars}) sessionKey=${params.sessionKey ?? params.sessionId ?? "unknown"}`);
|
|
71277
71331
|
return {
|
|
71278
71332
|
truncated: true,
|
|
71279
71333
|
truncatedCount
|
|
71280
71334
|
};
|
|
71281
71335
|
} catch (err) {
|
|
71282
71336
|
const errMsg = err instanceof Error ? err.message : String(err);
|
|
71283
|
-
log$
|
|
71337
|
+
log$15.warn(`[tool-result-truncation] Failed to truncate: ${errMsg}`);
|
|
71284
71338
|
return {
|
|
71285
71339
|
truncated: false,
|
|
71286
71340
|
truncatedCount: 0,
|
|
@@ -72003,7 +72057,7 @@ function extractSections(content, sectionNames) {
|
|
|
72003
72057
|
|
|
72004
72058
|
//#endregion
|
|
72005
72059
|
//#region src/agents/compaction.ts
|
|
72006
|
-
const log$
|
|
72060
|
+
const log$14 = createSubsystemLogger("compaction");
|
|
72007
72061
|
const BASE_CHUNK_RATIO = .4;
|
|
72008
72062
|
const MIN_CHUNK_RATIO = .15;
|
|
72009
72063
|
const SAFETY_MARGIN = 1.2;
|
|
@@ -72129,7 +72183,7 @@ async function summarizeWithFallback(params) {
|
|
|
72129
72183
|
try {
|
|
72130
72184
|
return await summarizeChunks(params);
|
|
72131
72185
|
} catch (fullError) {
|
|
72132
|
-
log$
|
|
72186
|
+
log$14.warn(`Full summarization failed, trying partial: ${fullError instanceof Error ? fullError.message : String(fullError)}`);
|
|
72133
72187
|
}
|
|
72134
72188
|
const smallMessages = [];
|
|
72135
72189
|
const oversizedNotes = [];
|
|
@@ -72144,7 +72198,7 @@ async function summarizeWithFallback(params) {
|
|
|
72144
72198
|
messages: smallMessages
|
|
72145
72199
|
}) + (oversizedNotes.length > 0 ? `\n\n${oversizedNotes.join("\n")}` : "");
|
|
72146
72200
|
} catch (partialError) {
|
|
72147
|
-
log$
|
|
72201
|
+
log$14.warn(`Partial summarization also failed: ${partialError instanceof Error ? partialError.message : String(partialError)}`);
|
|
72148
72202
|
}
|
|
72149
72203
|
return `Context contained ${messages.length} messages (${oversizedNotes.length} oversized). Summary unavailable due to size limits.`;
|
|
72150
72204
|
}
|
|
@@ -72228,7 +72282,7 @@ function collectTextContentBlocks(content) {
|
|
|
72228
72282
|
|
|
72229
72283
|
//#endregion
|
|
72230
72284
|
//#region src/agents/pi-extensions/compaction-safeguard.ts
|
|
72231
|
-
const log$
|
|
72285
|
+
const log$13 = createSubsystemLogger("compaction-safeguard");
|
|
72232
72286
|
const missedModelWarningSessions = /* @__PURE__ */ new WeakSet();
|
|
72233
72287
|
const TURN_PREFIX_INSTRUCTIONS = "This summary covers the prefix of a split turn. Focus on the original request, early progress, and any details needed to understand the retained suffix.";
|
|
72234
72288
|
const MAX_TOOL_FAILURES = 8;
|
|
@@ -72337,7 +72391,7 @@ function compactionSafeguardExtension(api) {
|
|
|
72337
72391
|
api.on("session_before_compact", async (event, ctx) => {
|
|
72338
72392
|
const { preparation, customInstructions, signal } = event;
|
|
72339
72393
|
if (!preparation.messagesToSummarize.some(isRealConversationMessage)) {
|
|
72340
|
-
log$
|
|
72394
|
+
log$13.warn("Compaction safeguard: cancelling compaction with no real conversation messages to summarize.");
|
|
72341
72395
|
return { cancel: true };
|
|
72342
72396
|
}
|
|
72343
72397
|
const { readFiles, modifiedFiles } = computeFileLists(preparation.fileOps);
|
|
@@ -72345,7 +72399,7 @@ function compactionSafeguardExtension(api) {
|
|
|
72345
72399
|
const toolFailureSection = formatToolFailuresSection(collectToolFailures([...preparation.messagesToSummarize, ...preparation.turnPrefixMessages]));
|
|
72346
72400
|
const runtime = getCompactionSafeguardRuntime(ctx.sessionManager);
|
|
72347
72401
|
if (runtime?.enabled === false) {
|
|
72348
|
-
log$
|
|
72402
|
+
log$13.info("Compaction safeguard: compaction disabled by config; cancelling.");
|
|
72349
72403
|
return { cancel: true };
|
|
72350
72404
|
}
|
|
72351
72405
|
const summarizationInstructions = {
|
|
@@ -72386,7 +72440,7 @@ function compactionSafeguardExtension(api) {
|
|
|
72386
72440
|
});
|
|
72387
72441
|
if (pruned.droppedChunks > 0) {
|
|
72388
72442
|
const newContentRatio = newContentTokens / contextWindowTokens * 100;
|
|
72389
|
-
log$
|
|
72443
|
+
log$13.warn(`Compaction safeguard: new content uses ${newContentRatio.toFixed(1)}% of context; dropped ${pruned.droppedChunks} older chunk(s) (${pruned.droppedMessages} messages) to fit history budget.`);
|
|
72390
72444
|
messagesToSummarize = pruned.messages;
|
|
72391
72445
|
if (pruned.droppedMessagesList.length > 0) try {
|
|
72392
72446
|
const droppedChunkRatio = computeAdaptiveChunkRatio(pruned.droppedMessagesList, contextWindowTokens);
|
|
@@ -72404,7 +72458,7 @@ function compactionSafeguardExtension(api) {
|
|
|
72404
72458
|
previousSummary: preparation.previousSummary
|
|
72405
72459
|
});
|
|
72406
72460
|
} catch (droppedError) {
|
|
72407
|
-
log$
|
|
72461
|
+
log$13.warn(`Compaction safeguard: failed to summarize dropped messages, continuing without: ${droppedError instanceof Error ? droppedError.message : String(droppedError)}`);
|
|
72408
72462
|
}
|
|
72409
72463
|
}
|
|
72410
72464
|
}
|
|
@@ -72452,7 +72506,7 @@ function compactionSafeguardExtension(api) {
|
|
|
72452
72506
|
}
|
|
72453
72507
|
} };
|
|
72454
72508
|
} catch (error) {
|
|
72455
|
-
log$
|
|
72509
|
+
log$13.warn(`Compaction summarization failed; cancelling compaction to preserve history: ${error instanceof Error ? error.message : String(error)}`);
|
|
72456
72510
|
return { cancel: true };
|
|
72457
72511
|
}
|
|
72458
72512
|
});
|
|
@@ -73183,14 +73237,14 @@ function logToolSchemasForGoogle(params) {
|
|
|
73183
73237
|
if (params.provider !== "google-gemini-cli") return;
|
|
73184
73238
|
const toolNames = params.tools.map((tool, index) => `${index}:${tool.name}`);
|
|
73185
73239
|
const tools = sanitizeToolsForGoogle(params);
|
|
73186
|
-
log$
|
|
73240
|
+
log$15.info("google tool schema snapshot", {
|
|
73187
73241
|
provider: params.provider,
|
|
73188
73242
|
toolCount: tools.length,
|
|
73189
73243
|
tools: toolNames
|
|
73190
73244
|
});
|
|
73191
73245
|
for (const [index, tool] of tools.entries()) {
|
|
73192
73246
|
const violations = findUnsupportedSchemaKeywords(tool.parameters, `${tool.name}.parameters`);
|
|
73193
|
-
if (violations.length > 0) log$
|
|
73247
|
+
if (violations.length > 0) log$15.warn("google tool schema has unsupported keywords", {
|
|
73194
73248
|
index,
|
|
73195
73249
|
tool: tool.name,
|
|
73196
73250
|
violations: violations.slice(0, 12),
|
|
@@ -73202,7 +73256,7 @@ const compactionFailureEmitter = new EventEmitter();
|
|
|
73202
73256
|
registerUnhandledRejectionHandler((reason) => {
|
|
73203
73257
|
const message = describeUnknownError(reason);
|
|
73204
73258
|
if (!isCompactionFailureError(message)) return false;
|
|
73205
|
-
log$
|
|
73259
|
+
log$15.error(`Auto-compaction failed (unhandled): ${message}`);
|
|
73206
73260
|
compactionFailureEmitter.emit("failure", message);
|
|
73207
73261
|
return true;
|
|
73208
73262
|
});
|
|
@@ -73254,7 +73308,7 @@ function applyGoogleTurnOrderingFix(params) {
|
|
|
73254
73308
|
const sanitized = sanitizeGoogleTurnOrdering(params.messages);
|
|
73255
73309
|
const didPrepend = sanitized !== params.messages;
|
|
73256
73310
|
if (didPrepend && !hasGoogleTurnOrderingMarker(params.sessionManager)) {
|
|
73257
|
-
(params.warn ?? ((message) => log$
|
|
73311
|
+
(params.warn ?? ((message) => log$15.warn(message)))(`google turn ordering fixup: prepended user bootstrap (sessionId=${params.sessionId})`);
|
|
73258
73312
|
markGoogleTurnOrderingMarker(params.sessionManager);
|
|
73259
73313
|
}
|
|
73260
73314
|
return {
|
|
@@ -73671,6 +73725,57 @@ async function flushPendingToolResultsAfterIdle(opts) {
|
|
|
73671
73725
|
opts.sessionManager?.flushPendingToolResults?.();
|
|
73672
73726
|
}
|
|
73673
73727
|
|
|
73728
|
+
//#endregion
|
|
73729
|
+
//#region src/agents/pi-embedded-runner/workspace-cwd.ts
|
|
73730
|
+
const log$12 = createSubsystemLogger("agents/workspace-cwd");
|
|
73731
|
+
const holders = [];
|
|
73732
|
+
let baselineCwd;
|
|
73733
|
+
function readCwd() {
|
|
73734
|
+
try {
|
|
73735
|
+
return process.cwd();
|
|
73736
|
+
} catch (err) {
|
|
73737
|
+
log$12.warn("process.cwd() failed; the working directory was removed under the process", { error: String(err) });
|
|
73738
|
+
return;
|
|
73739
|
+
}
|
|
73740
|
+
}
|
|
73741
|
+
function tryChdir(target) {
|
|
73742
|
+
if (readCwd() === target) return true;
|
|
73743
|
+
try {
|
|
73744
|
+
process.chdir(target);
|
|
73745
|
+
return true;
|
|
73746
|
+
} catch (err) {
|
|
73747
|
+
log$12.error("cwd restore target is gone", {
|
|
73748
|
+
target,
|
|
73749
|
+
error: String(err)
|
|
73750
|
+
});
|
|
73751
|
+
return false;
|
|
73752
|
+
}
|
|
73753
|
+
}
|
|
73754
|
+
/**
|
|
73755
|
+
* The cwd is process-global while embedded runs overlap (`agents.defaults.maxConcurrent`
|
|
73756
|
+
* defaults to 4). Each holder gets the cwd on acquire; on release the cwd goes to the most
|
|
73757
|
+
* recent surviving holder's workspace, and to the baseline the first holder found once none
|
|
73758
|
+
* remain. The returned release never throws: a throw from a caller's finally would skip the
|
|
73759
|
+
* rest of it (e.g. clearActiveEmbeddedRun) and leak the run registry entry.
|
|
73760
|
+
*/
|
|
73761
|
+
function acquireWorkspaceCwd(workspaceDir) {
|
|
73762
|
+
if (holders.length === 0) baselineCwd = readCwd() ?? os.tmpdir();
|
|
73763
|
+
if (readCwd() !== workspaceDir) process.chdir(workspaceDir);
|
|
73764
|
+
const holder = { workspaceDir };
|
|
73765
|
+
holders.push(holder);
|
|
73766
|
+
let released = false;
|
|
73767
|
+
return () => {
|
|
73768
|
+
if (released) return;
|
|
73769
|
+
released = true;
|
|
73770
|
+
const index = holders.indexOf(holder);
|
|
73771
|
+
if (index !== -1) holders.splice(index, 1);
|
|
73772
|
+
for (let i = holders.length - 1; i >= 0; i -= 1) if (tryChdir(holders[i].workspaceDir)) return;
|
|
73773
|
+
const target = baselineCwd ?? os.tmpdir();
|
|
73774
|
+
if (holders.length === 0) baselineCwd = void 0;
|
|
73775
|
+
if (!tryChdir(target) && !tryChdir(os.tmpdir())) log$12.error("tmpdir chdir failed; leaving the process cwd unchanged");
|
|
73776
|
+
};
|
|
73777
|
+
}
|
|
73778
|
+
|
|
73674
73779
|
//#endregion
|
|
73675
73780
|
//#region src/agents/pi-embedded-runner/compact.ts
|
|
73676
73781
|
function createCompactionDiagId$1() {
|
|
@@ -74081,11 +74186,10 @@ async function compactEmbeddedPiSessionDirect(params) {
|
|
|
74081
74186
|
compacted: false,
|
|
74082
74187
|
reason: "compaction deferred by context.prune handler"
|
|
74083
74188
|
};
|
|
74084
|
-
const prevCwd = process.cwd();
|
|
74085
74189
|
const provider = (params.provider ?? DEFAULT_PROVIDER).trim() || DEFAULT_PROVIDER;
|
|
74086
74190
|
const modelId = (params.model ?? DEFAULT_MODEL).trim() || DEFAULT_MODEL;
|
|
74087
74191
|
const fail = (reason) => {
|
|
74088
|
-
log$
|
|
74192
|
+
log$15.warn(`[compaction-diag] end runId=${runId} sessionKey=${params.sessionKey ?? params.sessionId} diagId=${diagId} trigger=${trigger} provider=${provider}/${modelId} attempt=${attempt} maxAttempts=${maxAttempts} outcome=failed reason=${classifyCompactionReason(reason)} durationMs=${Date.now() - startedAt}`);
|
|
74089
74193
|
return {
|
|
74090
74194
|
ok: false,
|
|
74091
74195
|
compacted: false,
|
|
@@ -74129,7 +74233,7 @@ async function compactEmbeddedPiSessionDirect(params) {
|
|
|
74129
74233
|
cwd: effectiveWorkspace
|
|
74130
74234
|
});
|
|
74131
74235
|
let restoreSkillEnv;
|
|
74132
|
-
|
|
74236
|
+
const releaseWorkspaceCwd = acquireWorkspaceCwd(effectiveWorkspace);
|
|
74133
74237
|
try {
|
|
74134
74238
|
const shouldLoadSkillEntries = !params.skillsSnapshot || !params.skillsSnapshot.resolvedSkills;
|
|
74135
74239
|
const skillEntries = shouldLoadSkillEntries ? loadWorkspaceSkillEntries(effectiveWorkspace) : [];
|
|
@@ -74165,7 +74269,7 @@ async function compactEmbeddedPiSessionDirect(params) {
|
|
|
74165
74269
|
resolvedSystemPrompt,
|
|
74166
74270
|
warn: makeBootstrapWarn({
|
|
74167
74271
|
sessionLabel,
|
|
74168
|
-
warn: (message) => log$
|
|
74272
|
+
warn: (message) => log$15.warn(message)
|
|
74169
74273
|
})
|
|
74170
74274
|
});
|
|
74171
74275
|
const runAbortController = new AbortController();
|
|
@@ -74307,7 +74411,7 @@ async function compactEmbeddedPiSessionDirect(params) {
|
|
|
74307
74411
|
});
|
|
74308
74412
|
try {
|
|
74309
74413
|
if (isPreservationArmed() || !isJsonlSessionBackend()) {
|
|
74310
|
-
log$
|
|
74414
|
+
log$15.warn(`[compaction-diag] refused transcript repair/open runId=${runId} sessionKey=${params.sessionKey ?? params.sessionId} diagId=${diagId} trigger=${trigger} preservationArmed=${isPreservationArmed()} jsonlBackend=${isJsonlSessionBackend()}`);
|
|
74311
74415
|
return {
|
|
74312
74416
|
ok: true,
|
|
74313
74417
|
compacted: false,
|
|
@@ -74316,7 +74420,7 @@ async function compactEmbeddedPiSessionDirect(params) {
|
|
|
74316
74420
|
}
|
|
74317
74421
|
await repairSessionFileIfNeeded({
|
|
74318
74422
|
sessionFile: params.sessionFile,
|
|
74319
|
-
warn: (message) => log$
|
|
74423
|
+
warn: (message) => log$15.warn(message)
|
|
74320
74424
|
});
|
|
74321
74425
|
await prewarmSessionFile(params.sessionFile);
|
|
74322
74426
|
const transcriptPolicy = resolveTranscriptPolicy({
|
|
@@ -74412,7 +74516,7 @@ async function compactEmbeddedPiSessionDirect(params) {
|
|
|
74412
74516
|
const inputStorageCursor = await loadCompactionStorageCursor({
|
|
74413
74517
|
sessionId: params.sessionId,
|
|
74414
74518
|
sessionKey: params.sessionKey,
|
|
74415
|
-
warn: (message) => log$
|
|
74519
|
+
warn: (message) => log$15.warn(message)
|
|
74416
74520
|
});
|
|
74417
74521
|
const truncated = limitHistoryTurns(validated, getDmHistoryLimitFromSessionKey(params.sessionKey, params.config));
|
|
74418
74522
|
const limited = transcriptPolicy.repairToolUseResultPairing ? sanitizeToolUseResultPairing(truncated) : truncated;
|
|
@@ -74424,7 +74528,7 @@ async function compactEmbeddedPiSessionDirect(params) {
|
|
|
74424
74528
|
tokenWindow,
|
|
74425
74529
|
usage,
|
|
74426
74530
|
storageCursor: inputStorageCursor,
|
|
74427
|
-
warn: (message) => log$
|
|
74531
|
+
warn: (message) => log$15.warn(message)
|
|
74428
74532
|
});
|
|
74429
74533
|
const sanitizedHookMessages = await sanitizeHookCompactionMessages({
|
|
74430
74534
|
messages: cloneCompactionMessages(compactionPlan.messages),
|
|
@@ -74447,7 +74551,7 @@ async function compactEmbeddedPiSessionDirect(params) {
|
|
|
74447
74551
|
messages: transcriptPolicy.validateAnthropicTurns ? validateAnthropicTurns(validatedPlannedGemini) : validatedPlannedGemini,
|
|
74448
74552
|
fallbackMessages: limited,
|
|
74449
74553
|
replacedMessages: compactionPlan.replacedMessages,
|
|
74450
|
-
warn: (message) => log$
|
|
74554
|
+
warn: (message) => log$15.warn(message)
|
|
74451
74555
|
});
|
|
74452
74556
|
const compactionInputMessages = compactionInput.messages;
|
|
74453
74557
|
if (compactionInputMessages.length === 0) return fail(compactionInput.abortReason ?? "compaction input is empty");
|
|
@@ -74458,13 +74562,13 @@ async function compactEmbeddedPiSessionDirect(params) {
|
|
|
74458
74562
|
messages: preCompactionMessages,
|
|
74459
74563
|
sessionFile: params.sessionFile
|
|
74460
74564
|
}, hookCtx).catch((hookErr) => {
|
|
74461
|
-
log$
|
|
74565
|
+
log$15.warn(`before_compaction hook failed: ${String(hookErr)}`);
|
|
74462
74566
|
});
|
|
74463
|
-
const diagEnabled = log$
|
|
74567
|
+
const diagEnabled = log$15.isEnabled("debug");
|
|
74464
74568
|
const preMetrics = diagEnabled ? summarizeCompactionMessages(session.messages) : void 0;
|
|
74465
74569
|
if (diagEnabled && preMetrics) {
|
|
74466
|
-
log$
|
|
74467
|
-
log$
|
|
74570
|
+
log$15.debug(`[compaction-diag] start runId=${runId} sessionKey=${params.sessionKey ?? params.sessionId} diagId=${diagId} trigger=${trigger} provider=${provider}/${modelId} attempt=${attempt} maxAttempts=${maxAttempts} pre.messages=${preMetrics.messages} pre.historyTextChars=${preMetrics.historyTextChars} pre.toolResultChars=${preMetrics.toolResultChars} pre.estTokens=${preMetrics.estTokens ?? "unknown"}`);
|
|
74571
|
+
log$15.debug(`[compaction-diag] contributors diagId=${diagId} top=${JSON.stringify(preMetrics.contributors)}`);
|
|
74468
74572
|
}
|
|
74469
74573
|
const compactStartedAt = Date.now();
|
|
74470
74574
|
setContextHooksLastCompactionPreparation(sessionManager, void 0);
|
|
@@ -74474,7 +74578,7 @@ async function compactEmbeddedPiSessionDirect(params) {
|
|
|
74474
74578
|
result = await compactWithAbortOnTimeout({
|
|
74475
74579
|
compact: () => session.compact(params.customInstructions),
|
|
74476
74580
|
abort: () => session.abortCompaction(),
|
|
74477
|
-
onAbortSettleTimeout: (err) => log$
|
|
74581
|
+
onAbortSettleTimeout: (err) => log$15.warn(`compaction did not settle after abort: ${String(err)}`)
|
|
74478
74582
|
});
|
|
74479
74583
|
} finally {
|
|
74480
74584
|
setContextHooksPlannedCompaction(sessionManager, void 0);
|
|
@@ -74502,12 +74606,12 @@ async function compactEmbeddedPiSessionDirect(params) {
|
|
|
74502
74606
|
compactedCount: compactionInputMessages.length - session.messages.length,
|
|
74503
74607
|
sessionFile: params.sessionFile
|
|
74504
74608
|
}, hookCtx).catch((hookErr) => {
|
|
74505
|
-
log$
|
|
74609
|
+
log$15.warn(`after_compaction hook failed: ${hookErr}`);
|
|
74506
74610
|
});
|
|
74507
74611
|
const outputStorageCursor = await loadCompactionStorageCursor({
|
|
74508
74612
|
sessionId: params.sessionId,
|
|
74509
74613
|
sessionKey: params.sessionKey,
|
|
74510
|
-
warn: (message) => log$
|
|
74614
|
+
warn: (message) => log$15.warn(message)
|
|
74511
74615
|
});
|
|
74512
74616
|
const compactionResult = {
|
|
74513
74617
|
summary: result.summary,
|
|
@@ -74537,10 +74641,10 @@ async function compactEmbeddedPiSessionDirect(params) {
|
|
|
74537
74641
|
outputMessageCount: session.messages.length,
|
|
74538
74642
|
replacedMessages: compactionReplacementApplied,
|
|
74539
74643
|
result: compactionResult,
|
|
74540
|
-
warn: (message) => log$
|
|
74644
|
+
warn: (message) => log$15.warn(message)
|
|
74541
74645
|
});
|
|
74542
74646
|
const postMetrics = diagEnabled ? summarizeCompactionMessages(session.messages) : void 0;
|
|
74543
|
-
if (diagEnabled && preMetrics && postMetrics) log$
|
|
74647
|
+
if (diagEnabled && preMetrics && postMetrics) log$15.debug(`[compaction-diag] end runId=${runId} sessionKey=${params.sessionKey ?? params.sessionId} diagId=${diagId} trigger=${trigger} provider=${provider}/${modelId} attempt=${attempt} maxAttempts=${maxAttempts} outcome=compacted reason=none durationMs=${Date.now() - compactStartedAt} retrying=false post.messages=${postMetrics.messages} post.historyTextChars=${postMetrics.historyTextChars} post.toolResultChars=${postMetrics.toolResultChars} post.estTokens=${postMetrics.estTokens ?? "unknown"} delta.messages=${postMetrics.messages - preMetrics.messages} delta.historyTextChars=${postMetrics.historyTextChars - preMetrics.historyTextChars} delta.toolResultChars=${postMetrics.toolResultChars - preMetrics.toolResultChars} delta.estTokens=${typeof preMetrics.estTokens === "number" && typeof postMetrics.estTokens === "number" ? postMetrics.estTokens - preMetrics.estTokens : "unknown"}`);
|
|
74544
74648
|
return {
|
|
74545
74649
|
ok: true,
|
|
74546
74650
|
compacted: true,
|
|
@@ -74569,7 +74673,7 @@ async function compactEmbeddedPiSessionDirect(params) {
|
|
|
74569
74673
|
return fail(describeUnknownError(err));
|
|
74570
74674
|
} finally {
|
|
74571
74675
|
restoreSkillEnv?.();
|
|
74572
|
-
|
|
74676
|
+
releaseWorkspaceCwd();
|
|
74573
74677
|
}
|
|
74574
74678
|
}
|
|
74575
74679
|
/**
|
|
@@ -74693,15 +74797,15 @@ function createStreamFnWithExtraParams(baseStreamFn, extraParams, provider) {
|
|
|
74693
74797
|
if (transport === "sse" || transport === "websocket" || transport === "auto") streamParams.transport = transport;
|
|
74694
74798
|
else if (transport != null) {
|
|
74695
74799
|
const transportSummary = typeof transport === "string" ? transport : typeof transport;
|
|
74696
|
-
log$
|
|
74800
|
+
log$15.warn(`ignoring invalid transport param: ${transportSummary}`);
|
|
74697
74801
|
}
|
|
74698
74802
|
if (typeof extraParams.openaiWsWarmup === "boolean") streamParams.openaiWsWarmup = extraParams.openaiWsWarmup;
|
|
74699
74803
|
const cacheRetention = resolveCacheRetention(extraParams, provider);
|
|
74700
74804
|
if (cacheRetention) streamParams.cacheRetention = cacheRetention;
|
|
74701
74805
|
const providerRouting = provider === "openrouter" && extraParams.provider != null && typeof extraParams.provider === "object" ? extraParams.provider : void 0;
|
|
74702
74806
|
if (Object.keys(streamParams).length === 0 && !providerRouting) return;
|
|
74703
|
-
log$
|
|
74704
|
-
if (providerRouting) log$
|
|
74807
|
+
log$15.debug(`creating streamFn wrapper with params: ${JSON.stringify(streamParams)}`);
|
|
74808
|
+
if (providerRouting) log$15.debug(`OpenRouter provider routing: ${JSON.stringify(providerRouting)}`);
|
|
74705
74809
|
const underlying = baseStreamFn ?? streamSimple;
|
|
74706
74810
|
const wrappedStreamFn = (model, context, options) => {
|
|
74707
74811
|
return underlying(providerRouting ? {
|
|
@@ -74823,7 +74927,7 @@ function resolveAnthropicBetas(extraParams, provider, modelId) {
|
|
|
74823
74927
|
for (const beta of configured) if (typeof beta === "string" && beta.trim()) betas.add(beta.trim());
|
|
74824
74928
|
}
|
|
74825
74929
|
if (extraParams?.context1m === true) if (isAnthropic1MModel(modelId)) betas.add(ANTHROPIC_CONTEXT_1M_BETA);
|
|
74826
|
-
else log$
|
|
74930
|
+
else log$15.warn(`ignoring context1m for non-opus/sonnet model: ${provider}/${modelId}`);
|
|
74827
74931
|
return betas.size > 0 ? [...betas] : void 0;
|
|
74828
74932
|
}
|
|
74829
74933
|
function mergeAnthropicBetaHeader(headers, betas) {
|
|
@@ -74850,7 +74954,7 @@ function createAnthropicBetaHeadersWrapper(baseStreamFn, betas) {
|
|
|
74850
74954
|
const isOauth = isAnthropicOAuthApiKey(options?.apiKey);
|
|
74851
74955
|
const requestedContext1m = betas.includes(ANTHROPIC_CONTEXT_1M_BETA);
|
|
74852
74956
|
const effectiveBetas = isOauth && requestedContext1m ? betas.filter((beta) => beta !== ANTHROPIC_CONTEXT_1M_BETA) : betas;
|
|
74853
|
-
if (isOauth && requestedContext1m) log$
|
|
74957
|
+
if (isOauth && requestedContext1m) log$15.warn(`ignoring context1m for OAuth token auth on ${model.provider}/${model.id}; Anthropic rejects context-1m beta with OAuth auth`);
|
|
74854
74958
|
const piAiBetas = isOauth ? PI_AI_OAUTH_ANTHROPIC_BETAS : PI_AI_DEFAULT_ANTHROPIC_BETAS;
|
|
74855
74959
|
const allBetas = [...new Set([...piAiBetas, ...effectiveBetas])];
|
|
74856
74960
|
return underlying(model, context, {
|
|
@@ -75211,12 +75315,12 @@ function applyExtraParamsToAgent(agent, cfg, provider, modelId, extraParamsOverr
|
|
|
75211
75315
|
};
|
|
75212
75316
|
const wrappedStreamFn = createStreamFnWithExtraParams(agent.streamFn, merged, provider);
|
|
75213
75317
|
if (wrappedStreamFn) {
|
|
75214
|
-
log$
|
|
75318
|
+
log$15.debug(`applying extraParams to agent streamFn for ${provider}/${modelId}`);
|
|
75215
75319
|
agent.streamFn = wrappedStreamFn;
|
|
75216
75320
|
}
|
|
75217
75321
|
const anthropicBetas = resolveAnthropicBetas(merged, provider, modelId);
|
|
75218
75322
|
if (anthropicBetas?.length) {
|
|
75219
|
-
log$
|
|
75323
|
+
log$15.debug(`applying Anthropic beta header for ${provider}/${modelId}: ${anthropicBetas.join(",")}`);
|
|
75220
75324
|
agent.streamFn = createAnthropicBetaHeadersWrapper(agent.streamFn, anthropicBetas);
|
|
75221
75325
|
}
|
|
75222
75326
|
if (shouldApplySiliconFlowThinkingOffCompat({
|
|
@@ -75224,7 +75328,7 @@ function applyExtraParamsToAgent(agent, cfg, provider, modelId, extraParamsOverr
|
|
|
75224
75328
|
modelId,
|
|
75225
75329
|
thinkingLevel
|
|
75226
75330
|
})) {
|
|
75227
|
-
log$
|
|
75331
|
+
log$15.debug(`normalizing thinking=off to thinking=null for SiliconFlow compatibility (${provider}/${modelId})`);
|
|
75228
75332
|
agent.streamFn = createSiliconFlowThinkingWrapper(agent.streamFn);
|
|
75229
75333
|
}
|
|
75230
75334
|
if (provider === "moonshot") {
|
|
@@ -75232,22 +75336,22 @@ function applyExtraParamsToAgent(agent, cfg, provider, modelId, extraParamsOverr
|
|
|
75232
75336
|
configuredThinking: merged?.thinking,
|
|
75233
75337
|
thinkingLevel
|
|
75234
75338
|
});
|
|
75235
|
-
if (moonshotThinkingType) log$
|
|
75339
|
+
if (moonshotThinkingType) log$15.debug(`applying Moonshot thinking=${moonshotThinkingType} payload wrapper for ${provider}/${modelId}`);
|
|
75236
75340
|
agent.streamFn = createMoonshotThinkingWrapper(agent.streamFn, moonshotThinkingType);
|
|
75237
75341
|
}
|
|
75238
75342
|
if (provider === "openrouter") {
|
|
75239
|
-
log$
|
|
75343
|
+
log$15.debug(`applying OpenRouter app attribution headers for ${provider}/${modelId}`);
|
|
75240
75344
|
const openRouterThinkingLevel = modelId === "auto" || isOpenRouterReasoningUnsupported(modelId) ? void 0 : thinkingLevel;
|
|
75241
75345
|
agent.streamFn = createOpenRouterWrapper(agent.streamFn, openRouterThinkingLevel);
|
|
75242
75346
|
agent.streamFn = createOpenRouterSystemCacheWrapper(agent.streamFn);
|
|
75243
75347
|
}
|
|
75244
75348
|
if (provider === "amazon-bedrock" && !isAnthropicBedrockModel(modelId)) {
|
|
75245
|
-
log$
|
|
75349
|
+
log$15.debug(`disabling prompt caching for non-Anthropic Bedrock model ${provider}/${modelId}`);
|
|
75246
75350
|
agent.streamFn = createBedrockNoCacheWrapper(agent.streamFn);
|
|
75247
75351
|
}
|
|
75248
75352
|
if (provider === "zai" || provider === "z-ai") {
|
|
75249
75353
|
if (merged?.tool_stream !== false) {
|
|
75250
|
-
log$
|
|
75354
|
+
log$15.debug(`enabling Z.AI tool_stream for ${provider}/${modelId}`);
|
|
75251
75355
|
agent.streamFn = createZaiToolStreamWrapper(agent.streamFn, true);
|
|
75252
75356
|
}
|
|
75253
75357
|
}
|
|
@@ -75331,7 +75435,7 @@ function resolveRunSenderIdentity(params) {
|
|
|
75331
75435
|
candidate: params.inheritedCanonicalIdentity
|
|
75332
75436
|
});
|
|
75333
75437
|
if (inherited) {
|
|
75334
|
-
log$
|
|
75438
|
+
log$15.info("runtime identity injected", {
|
|
75335
75439
|
identitySource: "parent-session",
|
|
75336
75440
|
canonicalIdentity: inherited,
|
|
75337
75441
|
trigger: params.trigger,
|
|
@@ -75350,7 +75454,7 @@ function resolveRunSenderIdentity(params) {
|
|
|
75350
75454
|
candidate: params.configuredIdentity
|
|
75351
75455
|
});
|
|
75352
75456
|
if (configured) {
|
|
75353
|
-
log$
|
|
75457
|
+
log$15.info("runtime identity injected", {
|
|
75354
75458
|
identitySource: "job-config",
|
|
75355
75459
|
canonicalIdentity: configured,
|
|
75356
75460
|
trigger: params.trigger,
|
|
@@ -76017,7 +76121,7 @@ function createOpenAIWebSocketStreamFn(apiKey, sessionId, opts = {}) {
|
|
|
76017
76121
|
if (!session.manager.isConnected() && !session.broken) try {
|
|
76018
76122
|
await session.manager.connect(apiKey);
|
|
76019
76123
|
session.everConnected = true;
|
|
76020
|
-
log$
|
|
76124
|
+
log$15.debug(`[ws-stream] connected for session=${sessionId}`);
|
|
76021
76125
|
} catch (connErr) {
|
|
76022
76126
|
try {
|
|
76023
76127
|
session.manager.close();
|
|
@@ -76025,12 +76129,12 @@ function createOpenAIWebSocketStreamFn(apiKey, sessionId, opts = {}) {
|
|
|
76025
76129
|
session.broken = true;
|
|
76026
76130
|
wsRegistry.delete(sessionId);
|
|
76027
76131
|
if (transport === "websocket") throw connErr instanceof Error ? connErr : new Error(String(connErr));
|
|
76028
|
-
log$
|
|
76132
|
+
log$15.warn(`[ws-stream] WebSocket connect failed for session=${sessionId}; falling back to HTTP. error=${String(connErr)}`);
|
|
76029
76133
|
return fallbackToHttp(model, context, options, eventStream, apiKey, opts.signal);
|
|
76030
76134
|
}
|
|
76031
76135
|
if (session.broken || !session.manager.isConnected()) {
|
|
76032
76136
|
if (transport === "websocket") throw new Error("WebSocket session disconnected");
|
|
76033
|
-
log$
|
|
76137
|
+
log$15.warn(`[ws-stream] session=${sessionId} broken/disconnected; falling back to HTTP`);
|
|
76034
76138
|
try {
|
|
76035
76139
|
session.manager.close();
|
|
76036
76140
|
} catch {}
|
|
@@ -76048,10 +76152,10 @@ function createOpenAIWebSocketStreamFn(apiKey, sessionId, opts = {}) {
|
|
|
76048
76152
|
instructions: context.systemPrompt ?? void 0,
|
|
76049
76153
|
signal
|
|
76050
76154
|
});
|
|
76051
|
-
log$
|
|
76155
|
+
log$15.debug(`[ws-stream] warm-up completed for session=${sessionId}`);
|
|
76052
76156
|
} catch (warmErr) {
|
|
76053
76157
|
if (signal?.aborted) throw warmErr instanceof Error ? warmErr : new Error(String(warmErr));
|
|
76054
|
-
log$
|
|
76158
|
+
log$15.warn(`[ws-stream] warm-up failed for session=${sessionId}; continuing without warm-up. error=${String(warmErr)}`);
|
|
76055
76159
|
}
|
|
76056
76160
|
}
|
|
76057
76161
|
const prevResponseId = session.manager.previousResponseId;
|
|
@@ -76059,13 +76163,13 @@ function createOpenAIWebSocketStreamFn(apiKey, sessionId, opts = {}) {
|
|
|
76059
76163
|
if (prevResponseId && session.lastContextLength > 0) {
|
|
76060
76164
|
const toolResults = context.messages.slice(session.lastContextLength).filter((m) => m.role === "toolResult");
|
|
76061
76165
|
if (toolResults.length === 0) {
|
|
76062
|
-
log$
|
|
76166
|
+
log$15.debug(`[ws-stream] session=${sessionId}: no new tool results found; sending full context`);
|
|
76063
76167
|
inputItems = buildFullInput(context);
|
|
76064
76168
|
} else inputItems = convertMessagesToInputItems(toolResults);
|
|
76065
|
-
log$
|
|
76169
|
+
log$15.debug(`[ws-stream] session=${sessionId}: incremental send (${inputItems.length} tool results) previous_response_id=${prevResponseId}`);
|
|
76066
76170
|
} else {
|
|
76067
76171
|
inputItems = buildFullInput(context);
|
|
76068
|
-
log$
|
|
76172
|
+
log$15.debug(`[ws-stream] session=${sessionId}: full context send (${inputItems.length} items)`);
|
|
76069
76173
|
}
|
|
76070
76174
|
const tools = convertTools(context.tools);
|
|
76071
76175
|
const streamOpts = options;
|
|
@@ -76095,7 +76199,7 @@ function createOpenAIWebSocketStreamFn(apiKey, sessionId, opts = {}) {
|
|
|
76095
76199
|
session.manager.send(payload);
|
|
76096
76200
|
} catch (sendErr) {
|
|
76097
76201
|
if (transport === "websocket") throw sendErr instanceof Error ? sendErr : new Error(String(sendErr));
|
|
76098
|
-
log$
|
|
76202
|
+
log$15.warn(`[ws-stream] send failed for session=${sessionId}; falling back to HTTP. error=${String(sendErr)}`);
|
|
76099
76203
|
try {
|
|
76100
76204
|
session.manager.close();
|
|
76101
76205
|
} catch {}
|
|
@@ -76175,7 +76279,7 @@ function createOpenAIWebSocketStreamFn(apiKey, sessionId, opts = {}) {
|
|
|
76175
76279
|
};
|
|
76176
76280
|
queueMicrotask(() => run().catch((err) => {
|
|
76177
76281
|
const errorMessage = err instanceof Error ? err.message : String(err);
|
|
76178
|
-
log$
|
|
76282
|
+
log$15.warn(`[ws-stream] session=${sessionId} run error: ${errorMessage}`);
|
|
76179
76283
|
eventStream.push({
|
|
76180
76284
|
type: "error",
|
|
76181
76285
|
reason: "error",
|
|
@@ -78225,7 +78329,7 @@ function normalizeRefForDedupe(raw) {
|
|
|
78225
78329
|
}
|
|
78226
78330
|
async function sanitizeImagesWithLog(images, label, imageSanitization) {
|
|
78227
78331
|
const { images: sanitized, dropped } = await sanitizeImageBlocks(images, label, imageSanitization);
|
|
78228
|
-
if (dropped > 0) log$
|
|
78332
|
+
if (dropped > 0) log$15.warn(`Native image: dropped ${dropped} image(s) after sanitization (${label}).`);
|
|
78229
78333
|
return sanitized;
|
|
78230
78334
|
}
|
|
78231
78335
|
/**
|
|
@@ -78312,7 +78416,7 @@ async function loadImageFromRef(ref, workspaceDir, options) {
|
|
|
78312
78416
|
mediaPath: targetPath
|
|
78313
78417
|
})).resolved;
|
|
78314
78418
|
} catch (err) {
|
|
78315
|
-
log$
|
|
78419
|
+
log$15.debug(`Native image: sandbox validation failed for ${ref.resolved}: ${err instanceof Error ? err.message : String(err)}`);
|
|
78316
78420
|
return null;
|
|
78317
78421
|
}
|
|
78318
78422
|
else if (!path.isAbsolute(targetPath)) targetPath = path.resolve(workspaceDir, targetPath);
|
|
@@ -78330,7 +78434,7 @@ async function loadImageFromRef(ref, workspaceDir, options) {
|
|
|
78330
78434
|
readFile: createSandboxBridgeReadFile({ sandbox: options.sandbox })
|
|
78331
78435
|
}) : await loadWebMedia(targetPath, options?.maxBytes);
|
|
78332
78436
|
if (media.kind !== "image") {
|
|
78333
|
-
log$
|
|
78437
|
+
log$15.debug(`Native image: not an image file: ${targetPath} (got ${media.kind})`);
|
|
78334
78438
|
return null;
|
|
78335
78439
|
}
|
|
78336
78440
|
const mimeType = media.contentType ?? "image/jpeg";
|
|
@@ -78340,7 +78444,7 @@ async function loadImageFromRef(ref, workspaceDir, options) {
|
|
|
78340
78444
|
mimeType
|
|
78341
78445
|
};
|
|
78342
78446
|
} catch (err) {
|
|
78343
|
-
log$
|
|
78447
|
+
log$15.debug(`Native image: failed to load ${ref.resolved}: ${err instanceof Error ? err.message : String(err)}`);
|
|
78344
78448
|
return null;
|
|
78345
78449
|
}
|
|
78346
78450
|
}
|
|
@@ -78377,7 +78481,7 @@ async function detectAndLoadPromptImages(params) {
|
|
|
78377
78481
|
loadedCount: 0,
|
|
78378
78482
|
skippedCount: 0
|
|
78379
78483
|
};
|
|
78380
|
-
log$
|
|
78484
|
+
log$15.debug(`Native image: detected ${allRefs.length} image refs in prompt`);
|
|
78381
78485
|
const promptImages = [...params.existingImages ?? []];
|
|
78382
78486
|
let loadedCount = 0;
|
|
78383
78487
|
let skippedCount = 0;
|
|
@@ -78390,7 +78494,7 @@ async function detectAndLoadPromptImages(params) {
|
|
|
78390
78494
|
if (image) {
|
|
78391
78495
|
promptImages.push(image);
|
|
78392
78496
|
loadedCount++;
|
|
78393
|
-
log$
|
|
78497
|
+
log$15.debug(`Native image: loaded ${ref.type} ${ref.resolved}`);
|
|
78394
78498
|
} else skippedCount++;
|
|
78395
78499
|
}
|
|
78396
78500
|
return {
|
|
@@ -79005,7 +79109,7 @@ async function buildStreamFn(params) {
|
|
|
79005
79109
|
const wsApiKey = await params.authStorage.getApiKey(params.provider);
|
|
79006
79110
|
if (wsApiKey) streamFn = createOpenAIWebSocketStreamFn(wsApiKey, params.sessionId, { signal: params.abortSignal });
|
|
79007
79111
|
else {
|
|
79008
|
-
log$
|
|
79112
|
+
log$15.warn(`[ws-stream] no API key for provider=${params.provider}; using HTTP transport`);
|
|
79009
79113
|
streamFn = streamSimple;
|
|
79010
79114
|
}
|
|
79011
79115
|
} else {
|
|
@@ -79108,13 +79212,13 @@ async function resolvePromptBuildHookResult(params) {
|
|
|
79108
79212
|
messages: params.messages,
|
|
79109
79213
|
systemPrompt: params.systemPrompt
|
|
79110
79214
|
}, params.hookCtx).catch((hookErr) => {
|
|
79111
|
-
log$
|
|
79215
|
+
log$15.warn(`before_prompt_build hook failed: ${String(hookErr)}`);
|
|
79112
79216
|
}) : void 0;
|
|
79113
79217
|
const legacyResult = params.legacyBeforeAgentStartResult ?? (params.hookRunner?.hasHooks("before_agent_start") ? await params.hookRunner.runBeforeAgentStart({
|
|
79114
79218
|
prompt: params.prompt,
|
|
79115
79219
|
messages: params.messages
|
|
79116
79220
|
}, params.hookCtx).catch((hookErr) => {
|
|
79117
|
-
log$
|
|
79221
|
+
log$15.warn(`before_agent_start hook (legacy prompt build path) failed: ${String(hookErr)}`);
|
|
79118
79222
|
}) : void 0);
|
|
79119
79223
|
return {
|
|
79120
79224
|
systemPrompt: promptBuildResult?.systemPrompt ?? legacyResult?.systemPrompt,
|
|
@@ -79252,7 +79356,7 @@ async function collectAttemptPromptContribution(params) {
|
|
|
79252
79356
|
messages: params.messages,
|
|
79253
79357
|
envelope: params.envelope
|
|
79254
79358
|
}, params.lifecycleCtx).catch((hookErr) => {
|
|
79255
|
-
log$
|
|
79359
|
+
log$15.warn(`context.collect hook failed: ${String(hookErr)}`);
|
|
79256
79360
|
}) : void 0;
|
|
79257
79361
|
return mergePromptContributions([promptBuildResultToContribution(legacyResult), contextCollectResult]);
|
|
79258
79362
|
}
|
|
@@ -79267,7 +79371,7 @@ async function runContextProjectionAndPruningHooks(params) {
|
|
|
79267
79371
|
contributions: params.contributions,
|
|
79268
79372
|
envelope: params.envelope
|
|
79269
79373
|
}, params.lifecycleCtx).catch((hookErr) => {
|
|
79270
|
-
log$
|
|
79374
|
+
log$15.warn(`context.project hook failed: ${String(hookErr)}`);
|
|
79271
79375
|
});
|
|
79272
79376
|
if (result?.messages) currentMessages = result.messages;
|
|
79273
79377
|
if (result?.projection) projection = {
|
|
@@ -79283,7 +79387,7 @@ async function runContextProjectionAndPruningHooks(params) {
|
|
|
79283
79387
|
tokenWindow: params.lifecycleCtx.tokenWindow,
|
|
79284
79388
|
usage: params.lifecycleCtx.usage
|
|
79285
79389
|
}, params.lifecycleCtx).catch((hookErr) => {
|
|
79286
|
-
log$
|
|
79390
|
+
log$15.warn(`context.prune hook failed: ${String(hookErr)}`);
|
|
79287
79391
|
});
|
|
79288
79392
|
if (result?.messages) currentMessages = result.messages;
|
|
79289
79393
|
if (result?.dropped) dropped.push(...result.dropped);
|
|
@@ -79385,7 +79489,7 @@ function installAttemptInputTransform(params) {
|
|
|
79385
79489
|
runtime: params.projectionRuntime,
|
|
79386
79490
|
timeoutMs: params.projectionArtifactTimeoutMs
|
|
79387
79491
|
}).catch((err) => {
|
|
79388
|
-
log$
|
|
79492
|
+
log$15.warn(`context projection artifact persist failed: ${String(err)}`);
|
|
79389
79493
|
});
|
|
79390
79494
|
const finalMessages = await runTransformLlmInputHooks({
|
|
79391
79495
|
messages: currentMessages,
|
|
@@ -79394,7 +79498,7 @@ function installAttemptInputTransform(params) {
|
|
|
79394
79498
|
provider: params.provider,
|
|
79395
79499
|
modelId: params.modelId
|
|
79396
79500
|
}).catch((err) => {
|
|
79397
|
-
log$
|
|
79501
|
+
log$15.warn(`transform_llm_input hook failed: ${String(err)}`);
|
|
79398
79502
|
}) ?? currentMessages;
|
|
79399
79503
|
params.onFinalInputMessages?.(finalMessages);
|
|
79400
79504
|
return finalMessages;
|
|
@@ -79512,11 +79616,10 @@ function summarizeSessionContext(messages) {
|
|
|
79512
79616
|
}
|
|
79513
79617
|
async function runEmbeddedAttempt(params) {
|
|
79514
79618
|
const resolvedWorkspace = resolveUserPath(params.workspaceDir);
|
|
79515
|
-
const prevCwd = process.cwd();
|
|
79516
79619
|
let pendingClearActiveEmbeddedRun;
|
|
79517
79620
|
const runAbortController = new AbortController();
|
|
79518
79621
|
const currentUserTurnForStorage = resolveCurrentUserTurnForStorage(params);
|
|
79519
|
-
log$
|
|
79622
|
+
log$15.debug(`embedded run start: runId=${params.runId} sessionId=${params.sessionId} provider=${params.provider} model=${params.modelId} thinking=${params.thinkLevel} messageChannel=${params.messageChannel ?? params.messageProvider ?? "unknown"}`);
|
|
79520
79623
|
await fs$1.mkdir(resolvedWorkspace, { recursive: true });
|
|
79521
79624
|
const sandboxSessionKey = params.sessionKey?.trim() || params.sessionId;
|
|
79522
79625
|
const toolSessionKey = params.toolSessionKey?.trim() || sandboxSessionKey;
|
|
@@ -79529,7 +79632,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
79529
79632
|
const effectiveWorkspace = sandbox?.enabled ? sandbox.workspaceAccess === "rw" ? resolvedWorkspace : sandbox.workspaceDir : resolvedWorkspace;
|
|
79530
79633
|
await fs$1.mkdir(effectiveWorkspace, { recursive: true });
|
|
79531
79634
|
let restoreSkillEnv;
|
|
79532
|
-
|
|
79635
|
+
const releaseWorkspaceCwd = params.skipCwdChange ? void 0 : acquireWorkspaceCwd(effectiveWorkspace);
|
|
79533
79636
|
try {
|
|
79534
79637
|
const skillWorkspace = params.skillWorkspaceDir ?? effectiveWorkspace;
|
|
79535
79638
|
const shouldLoadSkillEntries = !params.skipSkillEnv && (!params.skillsSnapshot || !params.skillsSnapshot.resolvedSkills);
|
|
@@ -79571,7 +79674,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
79571
79674
|
resolvedSystemPrompt,
|
|
79572
79675
|
warn: makeBootstrapWarn({
|
|
79573
79676
|
sessionLabel,
|
|
79574
|
-
warn: (message) => log$
|
|
79677
|
+
warn: (message) => log$15.warn(message)
|
|
79575
79678
|
}),
|
|
79576
79679
|
contextMode: params.bootstrapContextMode,
|
|
79577
79680
|
runKind: params.bootstrapContextRunKind,
|
|
@@ -79813,7 +79916,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
79813
79916
|
if (queue != null) {
|
|
79814
79917
|
await drainPendingPrimaryWrites(queue, 3e4, storage?.config.fallbackToJsonlOnError ?? false);
|
|
79815
79918
|
if (storage?.runtime?.conversation?.upsertTurn) await storage.runtime.conversation.upsertTurn(params.sessionId).catch((err) => {
|
|
79816
|
-
log$
|
|
79919
|
+
log$15.warn("turn upsert failed (non-fatal)", {
|
|
79817
79920
|
sessionId: params.sessionId,
|
|
79818
79921
|
err
|
|
79819
79922
|
});
|
|
@@ -79881,14 +79984,14 @@ async function runEmbeddedAttempt(params) {
|
|
|
79881
79984
|
sessionManager = _wrapped.sm;
|
|
79882
79985
|
_primaryWriteQueue = _wrapped.queue;
|
|
79883
79986
|
}
|
|
79884
|
-
} else log$
|
|
79987
|
+
} else log$15.error("DB backend detected but conversation store is unavailable — turn will run without history and DB write-through; check that the DB runtime initialised correctly", {
|
|
79885
79988
|
sessionId: params.sessionId,
|
|
79886
79989
|
backend: _configuredStorage?.runtime?.backend
|
|
79887
79990
|
});
|
|
79888
79991
|
} else {
|
|
79889
79992
|
await repairSessionFileIfNeeded({
|
|
79890
79993
|
sessionFile: params.sessionFile,
|
|
79891
|
-
warn: (message) => log$
|
|
79994
|
+
warn: (message) => log$15.warn(message)
|
|
79892
79995
|
});
|
|
79893
79996
|
const hadSessionFile = await fs$1.stat(params.sessionFile).then(() => true).catch(() => false);
|
|
79894
79997
|
if (!params.skipSessionManagerCache) await prewarmSessionFile(params.sessionFile);
|
|
@@ -80029,7 +80132,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
80029
80132
|
const wsApiKey = await params.authStorage.getApiKey(params.provider);
|
|
80030
80133
|
if (wsApiKey) activeSession.agent.streamFn = createOpenAIWebSocketStreamFn(wsApiKey, params.sessionId, { signal: runAbortController.signal });
|
|
80031
80134
|
else {
|
|
80032
|
-
log$
|
|
80135
|
+
log$15.warn(`[ws-stream] no API key for provider=${params.provider}; using HTTP transport`);
|
|
80033
80136
|
activeSession.agent.streamFn = streamSimple;
|
|
80034
80137
|
}
|
|
80035
80138
|
} else {
|
|
@@ -80229,7 +80332,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
80229
80332
|
let abortWarnTimer;
|
|
80230
80333
|
const isProbeSession = params.sessionId?.startsWith("probe-") ?? false;
|
|
80231
80334
|
const abortTimer = setTimeout(() => {
|
|
80232
|
-
if (!isProbeSession) log$
|
|
80335
|
+
if (!isProbeSession) log$15.warn(`embedded run timeout: runId=${params.runId} sessionId=${params.sessionId} timeoutMs=${params.timeoutMs}`);
|
|
80233
80336
|
if (shouldFlagCompactionTimeout({
|
|
80234
80337
|
isTimeout: true,
|
|
80235
80338
|
isCompactionPendingOrRetrying: subscription.isCompacting(),
|
|
@@ -80238,7 +80341,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
80238
80341
|
abortRun(true);
|
|
80239
80342
|
if (!abortWarnTimer) abortWarnTimer = setTimeout(() => {
|
|
80240
80343
|
if (!activeSession.isStreaming) return;
|
|
80241
|
-
if (!isProbeSession) log$
|
|
80344
|
+
if (!isProbeSession) log$15.warn(`embedded run abort still streaming: runId=${params.runId} sessionId=${params.sessionId}`);
|
|
80242
80345
|
}, 1e4);
|
|
80243
80346
|
}, Math.max(1, params.timeoutMs));
|
|
80244
80347
|
let messagesSnapshot = [];
|
|
@@ -80272,7 +80375,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
80272
80375
|
let timeoutHandle;
|
|
80273
80376
|
const timeout = new Promise((resolve) => {
|
|
80274
80377
|
timeoutHandle = setTimeout(() => {
|
|
80275
|
-
log$
|
|
80378
|
+
log$15.warn(`${label} timed out after ${metaTimeoutMs}ms`);
|
|
80276
80379
|
resolve(void 0);
|
|
80277
80380
|
}, metaTimeoutMs);
|
|
80278
80381
|
timeoutHandle.unref?.();
|
|
@@ -80280,7 +80383,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
80280
80383
|
try {
|
|
80281
80384
|
return await Promise.race([p, timeout]);
|
|
80282
80385
|
} catch (err) {
|
|
80283
|
-
log$
|
|
80386
|
+
log$15.warn(`${label} failed: ${String(err)}`);
|
|
80284
80387
|
return;
|
|
80285
80388
|
} finally {
|
|
80286
80389
|
if (timeoutHandle !== void 0) clearTimeout(timeoutHandle);
|
|
@@ -80305,14 +80408,14 @@ async function runEmbeddedAttempt(params) {
|
|
|
80305
80408
|
senderIdentity,
|
|
80306
80409
|
workspaceLane: params.workspaceLane
|
|
80307
80410
|
});
|
|
80308
|
-
log$
|
|
80411
|
+
log$15.debug(`embedded run prompt start: runId=${params.runId} sessionId=${params.sessionId}`);
|
|
80309
80412
|
const leafEntry = sessionManager.getLeafEntry();
|
|
80310
80413
|
if (leafEntry?.type === "message" && leafEntry.message.role === "user") {
|
|
80311
80414
|
if (leafEntry.parentId) sessionManager.branch(leafEntry.parentId);
|
|
80312
80415
|
else sessionManager.resetLeaf();
|
|
80313
80416
|
const sessionContext = sessionManager.buildSessionContext();
|
|
80314
80417
|
activeSession.agent.state.messages = sessionContext.messages;
|
|
80315
|
-
log$
|
|
80418
|
+
log$15.warn(`Removed orphaned user message to prevent consecutive user turns. runId=${params.runId} sessionId=${params.sessionId}`);
|
|
80316
80419
|
}
|
|
80317
80420
|
const cleanUserMessage = createCleanUserMessageFromPrompt(params.prompt);
|
|
80318
80421
|
const baseEnvelope = createCurrentUserPromptEnvelope({ cleanUserMessage });
|
|
@@ -80341,7 +80444,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
80341
80444
|
const contributedSystemPrompt = applySystemPromptContribution(systemPromptText, promptContribution);
|
|
80342
80445
|
if (contributedSystemPrompt !== systemPromptText) {
|
|
80343
80446
|
applySystemPromptOverrideToSession(activeSession, contributedSystemPrompt);
|
|
80344
|
-
log$
|
|
80447
|
+
log$15.debug(`hooks: augmented system prompt (+${contributedSystemPrompt.length - systemPromptText.length} chars)`);
|
|
80345
80448
|
systemPromptText = contributedSystemPrompt;
|
|
80346
80449
|
}
|
|
80347
80450
|
cacheTrace?.recordStage("prompt:before", {
|
|
@@ -80373,12 +80476,12 @@ async function runEmbeddedAttempt(params) {
|
|
|
80373
80476
|
messages: activeSession.messages,
|
|
80374
80477
|
note: `images: prompt=${imageResult.images.length}`
|
|
80375
80478
|
});
|
|
80376
|
-
if (log$
|
|
80479
|
+
if (log$15.isEnabled("debug")) {
|
|
80377
80480
|
const msgCount = activeSession.messages.length;
|
|
80378
80481
|
const systemLen = systemPromptText?.length ?? 0;
|
|
80379
80482
|
const promptLen = effectivePrompt.length;
|
|
80380
80483
|
const sessionSummary = summarizeSessionContext(activeSession.messages);
|
|
80381
|
-
log$
|
|
80484
|
+
log$15.debug(`[context-diag] pre-prompt: sessionKey=${params.sessionKey ?? params.sessionId} messages=${msgCount} roleCounts=${sessionSummary.roleCounts} historyTextChars=${sessionSummary.totalTextChars} maxMessageTextChars=${sessionSummary.maxMessageTextChars} historyImageBlocks=${sessionSummary.totalImageBlocks} systemPromptChars=${systemLen} promptChars=${promptLen} promptImages=${imageResult.images.length} provider=${params.provider}/${params.modelId} sessionFile=${params.sessionFile}`);
|
|
80382
80485
|
}
|
|
80383
80486
|
if (hookRunner?.hasHooks("llm_input")) hookRunner.runLlmInput({
|
|
80384
80487
|
runId: params.runId,
|
|
@@ -80390,7 +80493,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
80390
80493
|
historyMessages: activeSession.messages,
|
|
80391
80494
|
imagesCount: imageResult.images.length
|
|
80392
80495
|
}, hookCtx).catch((err) => {
|
|
80393
|
-
log$
|
|
80496
|
+
log$15.warn(`llm_input hook failed: ${String(err)}`);
|
|
80394
80497
|
});
|
|
80395
80498
|
const modelUserMessage = appendPromptImagesToUserMessage(renderedCurrentUserPrompt.modelUserMessage, imageResult.images);
|
|
80396
80499
|
const currentPromptIndex = activeSession.messages.length;
|
|
@@ -80433,7 +80536,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
80433
80536
|
errorType: String(err instanceof Error ? err.name : "UnknownError")
|
|
80434
80537
|
});
|
|
80435
80538
|
} finally {
|
|
80436
|
-
log$
|
|
80539
|
+
log$15.debug(`embedded run prompt end: runId=${params.runId} sessionId=${params.sessionId} durationMs=${Date.now() - promptStartedAt}`);
|
|
80437
80540
|
}
|
|
80438
80541
|
const wasCompactingBefore = activeSession.isCompacting;
|
|
80439
80542
|
const snapshot = activeSession.messages.slice();
|
|
@@ -80448,7 +80551,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
80448
80551
|
promptError = err;
|
|
80449
80552
|
promptErrorSource = "compaction";
|
|
80450
80553
|
}
|
|
80451
|
-
if (!isProbeSession) log$
|
|
80554
|
+
if (!isProbeSession) log$15.debug(`compaction wait aborted: runId=${params.runId} sessionId=${params.sessionId}`);
|
|
80452
80555
|
} else throw err;
|
|
80453
80556
|
}
|
|
80454
80557
|
const compactionOccurredThisAttempt = getCompactionCount() > 0;
|
|
@@ -80467,7 +80570,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
80467
80570
|
currentSessionId: activeSession.sessionId
|
|
80468
80571
|
});
|
|
80469
80572
|
if (timedOutDuringCompaction) {
|
|
80470
|
-
if (!isProbeSession) log$
|
|
80573
|
+
if (!isProbeSession) log$15.warn(`using ${snapshotSelection.source} snapshot: timed out during compaction runId=${params.runId} sessionId=${params.sessionId}`);
|
|
80471
80574
|
}
|
|
80472
80575
|
messagesSnapshot = snapshotSelection.messagesSnapshot;
|
|
80473
80576
|
sessionIdUsed = snapshotSelection.sessionIdUsed;
|
|
@@ -80482,7 +80585,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
80482
80585
|
error: describeUnknownError(promptError)
|
|
80483
80586
|
});
|
|
80484
80587
|
} catch (entryErr) {
|
|
80485
|
-
log$
|
|
80588
|
+
log$15.warn(`failed to persist prompt error entry: ${String(entryErr)}`);
|
|
80486
80589
|
}
|
|
80487
80590
|
if (!params.skipTranscriptSync) await drainOrSyncTranscript(_primaryWriteQueue, _isDbBackend, _configuredStorage, {
|
|
80488
80591
|
agentId: hookAgentIdForTranscript,
|
|
@@ -80502,16 +80605,16 @@ async function runEmbeddedAttempt(params) {
|
|
|
80502
80605
|
error: promptError ? describeUnknownError(promptError) : void 0,
|
|
80503
80606
|
durationMs: Date.now() - promptStartedAt
|
|
80504
80607
|
}, hookCtx).catch((err) => {
|
|
80505
|
-
log$
|
|
80608
|
+
log$15.warn(`agent_end hook failed: ${err}`);
|
|
80506
80609
|
});
|
|
80507
80610
|
} finally {
|
|
80508
80611
|
clearTimeout(abortTimer);
|
|
80509
80612
|
if (abortWarnTimer) clearTimeout(abortWarnTimer);
|
|
80510
|
-
if (!isProbeSession && (aborted || timedOut) && !timedOutDuringCompaction) log$
|
|
80613
|
+
if (!isProbeSession && (aborted || timedOut) && !timedOutDuringCompaction) log$15.debug(`run cleanup: runId=${params.runId} sessionId=${params.sessionId} aborted=${aborted} timedOut=${timedOut}`);
|
|
80511
80614
|
try {
|
|
80512
80615
|
unsubscribe();
|
|
80513
80616
|
} catch (err) {
|
|
80514
|
-
log$
|
|
80617
|
+
log$15.error(`CRITICAL: unsubscribe failed, possible resource leak: runId=${params.runId} ${String(err)}`);
|
|
80515
80618
|
}
|
|
80516
80619
|
pendingClearActiveEmbeddedRun = () => clearActiveEmbeddedRun(params.sessionId, queueHandle, params.sessionKey, !aborted && !timedOut && !promptError);
|
|
80517
80620
|
params.abortSignal?.removeEventListener?.("abort", onAbort);
|
|
@@ -80549,7 +80652,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
80549
80652
|
workspaceLane: params.workspaceLane,
|
|
80550
80653
|
runId: params.runId
|
|
80551
80654
|
})).catch((err) => {
|
|
80552
|
-
log$
|
|
80655
|
+
log$15.warn(`model_call_ended hook failed: ${String(err)}`);
|
|
80553
80656
|
});
|
|
80554
80657
|
proxyMetadataFromHook = modelCallEndedEvent.proxyMetadata;
|
|
80555
80658
|
}
|
|
@@ -80573,7 +80676,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
80573
80676
|
workspaceLane: params.workspaceLane,
|
|
80574
80677
|
runId: params.runId
|
|
80575
80678
|
})).catch((err) => {
|
|
80576
|
-
log$
|
|
80679
|
+
log$15.warn(`llm_output hook failed: ${String(err)}`);
|
|
80577
80680
|
});
|
|
80578
80681
|
return {
|
|
80579
80682
|
aborted,
|
|
@@ -80616,7 +80719,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
80616
80719
|
if (_primaryWriteQueue != null && _primaryWriteQueue.length > 0) try {
|
|
80617
80720
|
await drainPendingPrimaryWrites(_primaryWriteQueue, 5e3, _configuredStorage?.config.fallbackToJsonlOnError ?? false);
|
|
80618
80721
|
} catch (cleanupDrainErr) {
|
|
80619
|
-
log$
|
|
80722
|
+
log$15.error("cleanup drain failed in finally; session entries may be lost", {
|
|
80620
80723
|
sessionId: params.sessionId,
|
|
80621
80724
|
error: cleanupDrainErr
|
|
80622
80725
|
});
|
|
@@ -80628,7 +80731,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
80628
80731
|
}
|
|
80629
80732
|
} finally {
|
|
80630
80733
|
restoreSkillEnv?.();
|
|
80631
|
-
|
|
80734
|
+
releaseWorkspaceCwd?.();
|
|
80632
80735
|
pendingClearActiveEmbeddedRun?.();
|
|
80633
80736
|
}
|
|
80634
80737
|
}
|
|
@@ -80904,8 +81007,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
80904
81007
|
const redactedSessionId = redactRunIdentifier(params.sessionId);
|
|
80905
81008
|
const redactedSessionKey = redactRunIdentifier(params.sessionKey);
|
|
80906
81009
|
const redactedWorkspace = redactRunIdentifier(resolvedWorkspace);
|
|
80907
|
-
if (workspaceResolution.usedFallback) log$
|
|
80908
|
-
const prevCwd = process.cwd();
|
|
81010
|
+
if (workspaceResolution.usedFallback) log$15.warn(`[workspace-fallback] caller=runEmbeddedPiAgent reason=${workspaceResolution.fallbackReason} run=${params.runId} session=${redactedSessionId} sessionKey=${redactedSessionKey} agent=${workspaceResolution.agentId} workspace=${redactedWorkspace}`);
|
|
80909
81011
|
let provider = (params.provider ?? DEFAULT_PROVIDER).trim() || DEFAULT_PROVIDER;
|
|
80910
81012
|
let modelId = (params.model ?? DEFAULT_MODEL).trim() || DEFAULT_MODEL;
|
|
80911
81013
|
const agentDir = params.agentDir ?? resolveOpenClawAgentDir();
|
|
@@ -80945,7 +81047,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
80945
81047
|
if (hookRunner?.hasHooks("before_model_resolve")) try {
|
|
80946
81048
|
modelResolveOverride = await hookRunner.runBeforeModelResolve({ prompt: params.prompt }, hookCtx);
|
|
80947
81049
|
} catch (hookErr) {
|
|
80948
|
-
log$
|
|
81050
|
+
log$15.warn(`before_model_resolve hook failed: ${String(hookErr)}`);
|
|
80949
81051
|
}
|
|
80950
81052
|
if (hookRunner?.hasHooks("before_agent_start")) try {
|
|
80951
81053
|
legacyBeforeAgentStartResult = await hookRunner.runBeforeAgentStart({ prompt: params.prompt }, hookCtx);
|
|
@@ -80954,15 +81056,15 @@ async function runEmbeddedPiAgent(params) {
|
|
|
80954
81056
|
modelOverride: modelResolveOverride?.modelOverride ?? legacyBeforeAgentStartResult?.modelOverride
|
|
80955
81057
|
};
|
|
80956
81058
|
} catch (hookErr) {
|
|
80957
|
-
log$
|
|
81059
|
+
log$15.warn(`before_agent_start hook (legacy model resolve path) failed: ${String(hookErr)}`);
|
|
80958
81060
|
}
|
|
80959
81061
|
if (modelResolveOverride?.providerOverride) {
|
|
80960
81062
|
provider = modelResolveOverride.providerOverride;
|
|
80961
|
-
log$
|
|
81063
|
+
log$15.info(`[hooks] provider overridden to ${provider}`);
|
|
80962
81064
|
}
|
|
80963
81065
|
if (modelResolveOverride?.modelOverride) {
|
|
80964
81066
|
modelId = modelResolveOverride.modelOverride;
|
|
80965
|
-
log$
|
|
81067
|
+
log$15.info(`[hooks] model overridden to ${modelId}`);
|
|
80966
81068
|
}
|
|
80967
81069
|
const { model, error, authStorage, modelRegistry } = resolveModel(provider, modelId, agentDir, params.config);
|
|
80968
81070
|
if (!model) throw new FailoverError(error ?? `Unknown model: ${provider}/${modelId}`, {
|
|
@@ -80982,9 +81084,9 @@ async function runEmbeddedPiAgent(params) {
|
|
|
80982
81084
|
warnBelowTokens: CONTEXT_WINDOW_WARN_BELOW_TOKENS,
|
|
80983
81085
|
hardMinTokens: CONTEXT_WINDOW_HARD_MIN_TOKENS
|
|
80984
81086
|
});
|
|
80985
|
-
if (ctxGuard.shouldWarn) log$
|
|
81087
|
+
if (ctxGuard.shouldWarn) log$15.warn(`low context window: ${provider}/${modelId} ctx=${ctxGuard.tokens} (warn<${CONTEXT_WINDOW_WARN_BELOW_TOKENS}) source=${ctxGuard.source}`);
|
|
80986
81088
|
if (ctxGuard.shouldBlock) {
|
|
80987
|
-
log$
|
|
81089
|
+
log$15.error(`blocked model (context window too small): ${provider}/${modelId} ctx=${ctxGuard.tokens} (min=${CONTEXT_WINDOW_HARD_MIN_TOKENS}) source=${ctxGuard.source}`);
|
|
80988
81090
|
throw new FailoverError(`Model context window too small (${ctxGuard.tokens} tokens). Minimum is ${CONTEXT_WINDOW_HARD_MIN_TOKENS}.`, {
|
|
80989
81091
|
reason: "unknown",
|
|
80990
81092
|
provider,
|
|
@@ -81038,14 +81140,14 @@ async function runEmbeddedPiAgent(params) {
|
|
|
81038
81140
|
copilotTokenState.refreshInFlight = (async () => {
|
|
81039
81141
|
const githubToken = copilotTokenState.githubToken.trim();
|
|
81040
81142
|
if (!githubToken) throw new Error("Copilot refresh requires a GitHub token.");
|
|
81041
|
-
log$
|
|
81143
|
+
log$15.debug(`Refreshing GitHub Copilot token (${reason})...`);
|
|
81042
81144
|
const copilotToken = await resolveCopilotApiToken({ githubToken });
|
|
81043
81145
|
authStorage.setRuntimeApiKey(model.provider, copilotToken.token);
|
|
81044
81146
|
copilotTokenState.expiresAt = copilotToken.expiresAt;
|
|
81045
81147
|
const remaining = copilotToken.expiresAt - Date.now();
|
|
81046
|
-
log$
|
|
81148
|
+
log$15.debug(`Copilot token refreshed; expires in ${Math.max(0, Math.floor(remaining / 1e3))}s.`);
|
|
81047
81149
|
})().catch((err) => {
|
|
81048
|
-
log$
|
|
81150
|
+
log$15.warn(`Copilot token refresh failed: ${describeUnknownError(err)}`);
|
|
81049
81151
|
throw err;
|
|
81050
81152
|
}).finally(() => {
|
|
81051
81153
|
copilotTokenState.refreshInFlight = void 0;
|
|
@@ -81055,7 +81157,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
81055
81157
|
const scheduleCopilotRefresh = () => {
|
|
81056
81158
|
if (!copilotTokenState || copilotRefreshCancelled) return;
|
|
81057
81159
|
if (!hasCopilotGithubToken()) {
|
|
81058
|
-
log$
|
|
81160
|
+
log$15.warn("Skipping Copilot refresh scheduling; GitHub token missing.");
|
|
81059
81161
|
return;
|
|
81060
81162
|
}
|
|
81061
81163
|
clearCopilotRefreshTimer();
|
|
@@ -81217,7 +81319,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
81217
81319
|
while (true) {
|
|
81218
81320
|
if (runLoopIterations >= MAX_RUN_LOOP_ITERATIONS) {
|
|
81219
81321
|
const message = `Exceeded retry limit after ${runLoopIterations} attempts (max=${MAX_RUN_LOOP_ITERATIONS}).`;
|
|
81220
|
-
log$
|
|
81322
|
+
log$15.error(`[run-retry-limit] sessionKey=${params.sessionKey ?? params.sessionId} provider=${provider}/${modelId} attempts=${runLoopIterations} maxAttempts=${MAX_RUN_LOOP_ITERATIONS}`);
|
|
81221
81323
|
logRunCompleted({
|
|
81222
81324
|
runId: params.runId,
|
|
81223
81325
|
sessionKey: params.sessionKey,
|
|
@@ -81381,21 +81483,21 @@ async function runEmbeddedPiAgent(params) {
|
|
|
81381
81483
|
const errorText = contextOverflowError.text;
|
|
81382
81484
|
const overflowStorage = getConfiguredSessionStorageRuntime();
|
|
81383
81485
|
const msgCount = attempt.messagesSnapshot?.length ?? 0;
|
|
81384
|
-
log$
|
|
81486
|
+
log$15.warn(`[context-overflow-diag] sessionKey=${params.sessionKey ?? params.sessionId} provider=${provider}/${modelId} source=${contextOverflowError.source} messages=${msgCount} sessionFile=${params.sessionFile} diagId=${overflowDiagId} compactionAttempts=${overflowCompactionAttempts} error=${errorText.slice(0, 200)}`);
|
|
81385
81487
|
const isCompactionFailure = isCompactionFailureError(errorText);
|
|
81386
81488
|
const hadAttemptLevelCompaction = attemptCompactionCount > 0;
|
|
81387
81489
|
const explicitOverflowCompactionAllowed = params.trigger !== "analysis" && !params.disablePluginHooks && !params.skipTranscriptSync;
|
|
81388
81490
|
if (explicitOverflowCompactionAllowed && !isCompactionFailure && hadAttemptLevelCompaction && overflowCompactionAttempts < MAX_OVERFLOW_COMPACTION_ATTEMPTS) {
|
|
81389
81491
|
overflowCompactionAttempts++;
|
|
81390
|
-
log$
|
|
81492
|
+
log$15.warn(`context overflow persisted after in-attempt compaction (attempt ${overflowCompactionAttempts}/${MAX_OVERFLOW_COMPACTION_ATTEMPTS}); retrying prompt without additional compaction for ${provider}/${modelId}`);
|
|
81391
81493
|
continue;
|
|
81392
81494
|
}
|
|
81393
81495
|
if (explicitOverflowCompactionAllowed && !isCompactionFailure && !hadAttemptLevelCompaction && overflowCompactionAttempts < MAX_OVERFLOW_COMPACTION_ATTEMPTS) {
|
|
81394
|
-
if (log$
|
|
81496
|
+
if (log$15.isEnabled("debug")) log$15.debug(`[compaction-diag] decision diagId=${overflowDiagId} branch=compact isCompactionFailure=${isCompactionFailure} hasOversizedToolResults=unknown attempt=${overflowCompactionAttempts + 1} maxAttempts=${MAX_OVERFLOW_COMPACTION_ATTEMPTS}`);
|
|
81395
81497
|
overflowCompactionAttempts++;
|
|
81396
|
-
log$
|
|
81498
|
+
log$15.warn(`context overflow detected (attempt ${overflowCompactionAttempts}/${MAX_OVERFLOW_COMPACTION_ATTEMPTS}); attempting auto-compaction for ${provider}/${modelId}`);
|
|
81397
81499
|
const _overflowIsDb = (overflowStorage?.runtime?.backend ?? "fs-jsonl") !== "fs-jsonl";
|
|
81398
|
-
if (_overflowIsDb) log$
|
|
81500
|
+
if (_overflowIsDb) log$15.warn(`context overflow compaction skipped for DB backend session ${params.sessionId}; compact.ts does not yet support DB-backend sessions`);
|
|
81399
81501
|
const compactResult = _overflowIsDb ? {
|
|
81400
81502
|
compacted: false,
|
|
81401
81503
|
reason: "db-backend-not-supported"
|
|
@@ -81428,10 +81530,10 @@ async function runEmbeddedPiAgent(params) {
|
|
|
81428
81530
|
});
|
|
81429
81531
|
if (compactResult.compacted) {
|
|
81430
81532
|
autoCompactionCount += 1;
|
|
81431
|
-
log$
|
|
81533
|
+
log$15.info(`auto-compaction succeeded for ${provider}/${modelId}; retrying prompt`);
|
|
81432
81534
|
continue;
|
|
81433
81535
|
}
|
|
81434
|
-
log$
|
|
81536
|
+
log$15.warn(`auto-compaction failed for ${provider}/${modelId}: ${compactResult.reason ?? "nothing to compact"}`);
|
|
81435
81537
|
}
|
|
81436
81538
|
if (!toolResultTruncationAttempted) {
|
|
81437
81539
|
const contextWindowTokens = ctxInfo.tokens;
|
|
@@ -81440,11 +81542,11 @@ async function runEmbeddedPiAgent(params) {
|
|
|
81440
81542
|
contextWindowTokens
|
|
81441
81543
|
}) : false;
|
|
81442
81544
|
if (hasOversized) {
|
|
81443
|
-
if (log$
|
|
81545
|
+
if (log$15.isEnabled("debug")) log$15.debug(`[compaction-diag] decision diagId=${overflowDiagId} branch=truncate_tool_results isCompactionFailure=${isCompactionFailure} hasOversizedToolResults=${hasOversized} attempt=${overflowCompactionAttempts} maxAttempts=${MAX_OVERFLOW_COMPACTION_ATTEMPTS}`);
|
|
81444
81546
|
toolResultTruncationAttempted = true;
|
|
81445
|
-
if ((overflowStorage?.runtime?.backend ?? "fs-jsonl") !== "fs-jsonl") log$
|
|
81547
|
+
if ((overflowStorage?.runtime?.backend ?? "fs-jsonl") !== "fs-jsonl") log$15.warn(`[context-overflow-recovery] Tool result truncation skipped for DB backend session ${params.sessionId}; tool-result-truncation.ts does not yet support DB-backend sessions`);
|
|
81446
81548
|
else {
|
|
81447
|
-
log$
|
|
81549
|
+
log$15.warn(`[context-overflow-recovery] Attempting tool result truncation for ${provider}/${modelId} (contextWindow=${contextWindowTokens} tokens)`);
|
|
81448
81550
|
const truncResult = await truncateOversizedToolResultsInSession({
|
|
81449
81551
|
sessionFile: params.sessionFile,
|
|
81450
81552
|
contextWindowTokens,
|
|
@@ -81452,14 +81554,14 @@ async function runEmbeddedPiAgent(params) {
|
|
|
81452
81554
|
sessionKey: params.sessionKey
|
|
81453
81555
|
});
|
|
81454
81556
|
if (truncResult.truncated) {
|
|
81455
|
-
log$
|
|
81557
|
+
log$15.info(`[context-overflow-recovery] Truncated ${truncResult.truncatedCount} tool result(s); retrying prompt`);
|
|
81456
81558
|
continue;
|
|
81457
81559
|
}
|
|
81458
|
-
log$
|
|
81560
|
+
log$15.warn(`[context-overflow-recovery] Tool result truncation did not help: ${truncResult.reason ?? "unknown"}`);
|
|
81459
81561
|
}
|
|
81460
|
-
} else if (log$
|
|
81562
|
+
} else if (log$15.isEnabled("debug")) log$15.debug(`[compaction-diag] decision diagId=${overflowDiagId} branch=give_up isCompactionFailure=${isCompactionFailure} hasOversizedToolResults=${hasOversized} attempt=${overflowCompactionAttempts} maxAttempts=${MAX_OVERFLOW_COMPACTION_ATTEMPTS}`);
|
|
81461
81563
|
}
|
|
81462
|
-
if ((isCompactionFailure || overflowCompactionAttempts >= MAX_OVERFLOW_COMPACTION_ATTEMPTS || toolResultTruncationAttempted) && log$
|
|
81564
|
+
if ((isCompactionFailure || overflowCompactionAttempts >= MAX_OVERFLOW_COMPACTION_ATTEMPTS || toolResultTruncationAttempted) && log$15.isEnabled("debug")) log$15.debug(`[compaction-diag] decision diagId=${overflowDiagId} branch=give_up isCompactionFailure=${isCompactionFailure} hasOversizedToolResults=unknown attempt=${overflowCompactionAttempts} maxAttempts=${MAX_OVERFLOW_COMPACTION_ATTEMPTS}`);
|
|
81463
81565
|
const kind = isCompactionFailure ? "compaction_failure" : "context_overflow";
|
|
81464
81566
|
logRunCompleted({
|
|
81465
81567
|
runId: params.runId,
|
|
@@ -81565,7 +81667,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
81565
81667
|
attempted: attemptedThinking
|
|
81566
81668
|
});
|
|
81567
81669
|
if (fallbackThinking) {
|
|
81568
|
-
log$
|
|
81670
|
+
log$15.warn(`unsupported thinking level for ${provider}/${modelId}; retrying with ${fallbackThinking}`);
|
|
81569
81671
|
thinkLevel = fallbackThinking;
|
|
81570
81672
|
continue;
|
|
81571
81673
|
}
|
|
@@ -81583,7 +81685,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
81583
81685
|
attempted: attemptedThinking
|
|
81584
81686
|
});
|
|
81585
81687
|
if (fallbackThinking && !aborted) {
|
|
81586
|
-
log$
|
|
81688
|
+
log$15.warn(`unsupported thinking level for ${provider}/${modelId}; retrying with ${fallbackThinking}`);
|
|
81587
81689
|
thinkLevel = fallbackThinking;
|
|
81588
81690
|
continue;
|
|
81589
81691
|
}
|
|
@@ -81604,7 +81706,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
81604
81706
|
imageDimensionError.contentIndex !== void 0 ? `content=${imageDimensionError.contentIndex}` : null,
|
|
81605
81707
|
imageDimensionError.maxDimensionPx !== void 0 ? `limit=${imageDimensionError.maxDimensionPx}px` : null
|
|
81606
81708
|
].filter(Boolean).join(" ");
|
|
81607
|
-
log$
|
|
81709
|
+
log$15.warn(`Profile ${lastProfileId} rejected image payload${details ? ` (${details})` : ""}.`);
|
|
81608
81710
|
}
|
|
81609
81711
|
if (!aborted && failoverFailure || timedOut && !timedOutDuringCompaction) {
|
|
81610
81712
|
if (lastProfileId) {
|
|
@@ -81612,8 +81714,8 @@ async function runEmbeddedPiAgent(params) {
|
|
|
81612
81714
|
profileId: lastProfileId,
|
|
81613
81715
|
reason: timedOut || assistantFailoverReason === "timeout" ? "timeout" : assistantFailoverReason ?? "unknown"
|
|
81614
81716
|
});
|
|
81615
|
-
if (timedOut && !isProbeSession) log$
|
|
81616
|
-
if (cloudCodeAssistFormatError) log$
|
|
81717
|
+
if (timedOut && !isProbeSession) log$15.warn(`Profile ${lastProfileId} timed out. Trying next account...`);
|
|
81718
|
+
if (cloudCodeAssistFormatError) log$15.warn(`Profile ${lastProfileId} hit Cloud Code Assist format error. Tool calls will be sanitized on retry.`);
|
|
81617
81719
|
}
|
|
81618
81720
|
if (await advanceAuthProfile()) continue;
|
|
81619
81721
|
if (fallbackConfigured) {
|
|
@@ -81658,7 +81760,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
81658
81760
|
}, hookCtx);
|
|
81659
81761
|
if (transformResult?.assistantTexts) finalAssistantTexts = transformResult.assistantTexts;
|
|
81660
81762
|
} catch (err) {
|
|
81661
|
-
log$
|
|
81763
|
+
log$15.warn(`transform_llm_output hook failed: ${String(err)}`);
|
|
81662
81764
|
}
|
|
81663
81765
|
const payloads = buildEmbeddedRunPayloads({
|
|
81664
81766
|
assistantTexts: finalAssistantTexts,
|
|
@@ -81709,7 +81811,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
81709
81811
|
durationMs: Date.now() - started,
|
|
81710
81812
|
exitStatus: aborted || timedOut ? "error" : void 0
|
|
81711
81813
|
});
|
|
81712
|
-
log$
|
|
81814
|
+
log$15.debug(`embedded run done: runId=${params.runId} sessionId=${params.sessionId} durationMs=${Date.now() - started} aborted=${aborted}`);
|
|
81713
81815
|
if (lastProfileId) {
|
|
81714
81816
|
await markAuthProfileGood({
|
|
81715
81817
|
store: authStore,
|
|
@@ -81746,7 +81848,6 @@ async function runEmbeddedPiAgent(params) {
|
|
|
81746
81848
|
}
|
|
81747
81849
|
} finally {
|
|
81748
81850
|
stopCopilotRefreshTimer();
|
|
81749
|
-
if (!params.skipCwdChange) process.chdir(prevCwd);
|
|
81750
81851
|
}
|
|
81751
81852
|
}));
|
|
81752
81853
|
}
|
|
@@ -94992,7 +95093,7 @@ async function deliverSessionMaintenanceWarning(params) {
|
|
|
94992
95093
|
return;
|
|
94993
95094
|
}
|
|
94994
95095
|
try {
|
|
94995
|
-
const { deliverOutboundPayloads } = await import("./deliver-
|
|
95096
|
+
const { deliverOutboundPayloads } = await import("./deliver-DNaGsPae.js").then((n) => n.n);
|
|
94996
95097
|
const outboundSession = buildOutboundSessionContext({
|
|
94997
95098
|
cfg: params.cfg,
|
|
94998
95099
|
sessionKey: params.sessionKey
|