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
|
@@ -24,16 +24,16 @@ import { $ as fetchChannelPermissionsDiscord, A as unpinMessageDiscord, B as lis
|
|
|
24
24
|
import { c as derivePromptTokens, d as makeZeroUsageSnapshot, f as normalizeUsage, l as deriveSessionTotalTokens, u as hasNonzeroUsage } from "./chat-envelope-DfuAGxmg.js";
|
|
25
25
|
import { c as isDiagnosticsEnabled, s as emitDiagnosticEvent } from "./task-run-types-B6n0W8Rb.js";
|
|
26
26
|
import { t as redactIdentifier } from "./redact-identifier-BcqQpFrh.js";
|
|
27
|
-
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-
|
|
27
|
+
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-B5Uv68lP.js";
|
|
28
28
|
import { t as CommandLane } from "./lanes-BN1DVTrA.js";
|
|
29
|
-
import { i as getAgentTurnRuntime, o as tryGetAgentTurnRuntime } from "./agent-turn-runner-
|
|
29
|
+
import { i as getAgentTurnRuntime, o as tryGetAgentTurnRuntime } from "./agent-turn-runner-ByKxuh9g.js";
|
|
30
30
|
import { o as resolveSessionRunStore, r as inferSessionRunKind, t as createSessionRunRecorder } from "./recorder-eKqml0IH.js";
|
|
31
|
-
import { A as isFailoverAssistantError, B as isTimeoutErrorMessage, C as formatRawAssistantErrorForUi, D as isCloudCodeAssistFormatError, E as isBillingAssistantError, F as isTransientHttpError, G as sanitizeGoogleTurnOrdering, H as ensureSessionHeader, I as parseImageDimensionError, L as parseImageSizeError, M as isLikelyContextOverflowError, N as isRateLimitAssistantError, O as isCompactionFailureError, P as isRawApiErrorPayload, R as sanitizeUserFacingText, S as formatBillingErrorMessage, T as isAuthAssistantError, U as resolveBootstrapMaxChars, V as buildBootstrapContextFiles, W as resolveBootstrapTotalMaxChars, _ as downgradeOpenAIReasoningBlocks, a as isMessagingToolDuplicateNormalized, b as classifyFailoverReason, c as sanitizeImageBlocks, d as canonicalizeBase64, f as estimateBase64DecodedBytes, g as downgradeOpenAIFunctionCallReasoningPairs, h as sanitizeToolCallIdsForCloudCodeAssist, j as isFailoverErrorMessage, k as isContextOverflowError, l as sanitizeToolResultImages, m as extractToolResultId, n as validateGeminiTurns, o as normalizeTextForComparison, p as extractToolCallsFromAssistant, r as pickFallbackThinkingLevel, s as sanitizeSessionMessagesImages, t as validateAnthropicTurns, u as resolveImageSanitizationLimits, v as isGoogleModelApi, w as getApiErrorPayloadFingerprint, x as formatAssistantErrorText, y as BILLING_ERROR_USER_MESSAGE, z as isAuthPermanentErrorMessage } from "./pi-embedded-helpers-
|
|
32
|
-
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-
|
|
31
|
+
import { A as isFailoverAssistantError, B as isTimeoutErrorMessage, C as formatRawAssistantErrorForUi, D as isCloudCodeAssistFormatError, E as isBillingAssistantError, F as isTransientHttpError, G as sanitizeGoogleTurnOrdering, H as ensureSessionHeader, I as parseImageDimensionError, L as parseImageSizeError, M as isLikelyContextOverflowError, N as isRateLimitAssistantError, O as isCompactionFailureError, P as isRawApiErrorPayload, R as sanitizeUserFacingText, S as formatBillingErrorMessage, T as isAuthAssistantError, U as resolveBootstrapMaxChars, V as buildBootstrapContextFiles, W as resolveBootstrapTotalMaxChars, _ as downgradeOpenAIReasoningBlocks, a as isMessagingToolDuplicateNormalized, b as classifyFailoverReason, c as sanitizeImageBlocks, d as canonicalizeBase64, f as estimateBase64DecodedBytes, g as downgradeOpenAIFunctionCallReasoningPairs, h as sanitizeToolCallIdsForCloudCodeAssist, j as isFailoverErrorMessage, k as isContextOverflowError, l as sanitizeToolResultImages, m as extractToolResultId, n as validateGeminiTurns, o as normalizeTextForComparison, p as extractToolCallsFromAssistant, r as pickFallbackThinkingLevel, s as sanitizeSessionMessagesImages, t as validateAnthropicTurns, u as resolveImageSanitizationLimits, v as isGoogleModelApi, w as getApiErrorPayloadFingerprint, x as formatAssistantErrorText, y as BILLING_ERROR_USER_MESSAGE, z as isAuthPermanentErrorMessage } from "./pi-embedded-helpers-Bdf0msT2.js";
|
|
32
|
+
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-Ccrfvb4b.js";
|
|
33
33
|
import { c as resolveExistingPathsWithinRoot, g as DEFAULT_AI_SNAPSHOT_MAX_CHARS, s as DEFAULT_UPLOAD_DIR } from "./extension-relay-auth-u5ulbRLG.js";
|
|
34
34
|
import { i as isLoopbackHost, u as resolveClientIp } from "./ws-DH-w8hKm.js";
|
|
35
35
|
import { r as trimToUndefined, t as resolveGatewayCredentialsFromConfig } from "./credentials-Ekuuf6fM.js";
|
|
36
|
-
import { a as resolveBrowserControlAuth } from "./server-context-
|
|
36
|
+
import { a as resolveBrowserControlAuth } from "./server-context-r5GX0zkd.js";
|
|
37
37
|
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-DXTDCXha.js";
|
|
38
38
|
import { t as PATH_ALIAS_POLICIES } from "./path-alias-guards-BHUcvjYV.js";
|
|
39
39
|
import { a as testRegexWithBoundedInput, i as compileSafeRegex, n as redactSensitiveText } from "./redact-BWPFahWo.js";
|
|
@@ -49,12 +49,12 @@ import { n as generateSecureUuid, t as generateSecureToken } from "./secure-rand
|
|
|
49
49
|
import { a as normalizeElevatedLevel, c as normalizeUsageDisplay, d as supportsXHighThinking, l as normalizeVerboseLevel, n as formatXHighModelHint, o as normalizeReasoningLevel, s as normalizeThinkLevel, t as formatThinkingLevels, u as resolveResponseUsageMode } from "./thinking-NawgaQgc.js";
|
|
50
50
|
import { a as resolveAgentIdentity, i as resolveAckReaction, o as resolveEffectiveMessagesConfig, r as resolveResponsePrefixTemplate, s as resolveHumanDelayConfig, t as createReplyPrefixOptions } from "./reply-prefix-CVpk9iRA.js";
|
|
51
51
|
import { a as stripSilentToken, i as isSilentReplyText, n as SILENT_REPLY_TOKEN, r as isSilentReplyPrefixText, t as HEARTBEAT_TOKEN } from "./tokens-BQIvJ1Cr.js";
|
|
52
|
-
import { a as getMachineDisplayName, i as startBrowserControlServiceFromConfig, n as createBrowserRouteDispatcher, r as createBrowserControlContext, t as withTimeout$4 } from "./with-timeout-
|
|
52
|
+
import { a as getMachineDisplayName, i as startBrowserControlServiceFromConfig, n as createBrowserRouteDispatcher, r as createBrowserControlContext, t as withTimeout$4 } from "./with-timeout-Ef5FGyJ7.js";
|
|
53
53
|
import { _ as resolveProviderPromptCacheKey, a as toInternalMessageReceivedContext, c as toPluginMessageReceivedEvent, d as initializeGlobalHookRunner, g as buildPluginTurnIdentity, h as buildPluginRuntimeIdentity, i as toInternalMessagePreprocessedContext, l as fireAndForgetHook, m as promptBuildResultToContribution, n as createMessageSentEmitter, o as toInternalMessageTranscribedContext, r as deriveInboundMessageHookContext, s as toPluginMessageContext, t as applyMessageSendingHook, u as getGlobalHookRunner, v as resolveProviderRuntimeIdentity } from "./outbound-message-hooks-BDZ9BewH.js";
|
|
54
|
-
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-
|
|
54
|
+
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-DGVkVcyC.js";
|
|
55
55
|
import { d as redactChannelCorrelation, o as getDiagnosticSessionState } from "./diagnostic-session-state-DCr9T3zW.js";
|
|
56
|
-
import { i as enqueueCommandInLane, n as clearCommandLane, o as getCommandLaneSnapshots, s as getQueueSize, t as CommandLaneAbortedError } from "./command-queue-
|
|
57
|
-
import { $ as resolveTelegramMediaPlaceholder, A as releaseAccountOwner, B as buildTelegramGroupFrom, C as fingerprintTelegramToken, D as recordUpdate, E as recordState, F as resolveCronStorePath, G as describeReplyTarget, H as buildTelegramParentPeer, J as hasBotMention, K as expandTextLinks, L as buildGroupLabel, M as splitTelegramCaption, N as withTelegramApiErrorLogging, O as recordWebhook, P as loadCronStore, Q as resolveTelegramGroupAllowFromContext, R as buildSenderLabel, T as recordApiRequest, U as buildTelegramThreadParams, V as buildTelegramGroupPeerId, W as buildTypingThreadParams, X as resolveTelegramDirectPeerId, Y as normalizeForwardedContext, Z as resolveTelegramForumThreadId, _ as isTelegramEditMayHaveLandedError, a as reactMessageTelegram, at as normalizeDmAllowFromWithStore$1, b as renderTelegramHtmlText, c as sendStickerTelegram, ct as toLocationContext, d as wasSentByBot, dt as resolveTelegramTargetChatType, et as resolveTelegramReplyId, f as extractTelegramErrorText, g as isTelegramClientRejection, h as isSafeToRetrySendError, i as editMessageTelegram, it as normalizeAllowFrom$2, j as resolveTelegramFetch, k as registerAccount, lt as isVoiceCompatibleAudio, m as isRecoverableTelegramNetworkError, n as createForumTopicTelegram, nt as resolveTelegramThreadSpec, o as sendMessageTelegram, ot as resolveSenderAllowMatch$1, p as isDefiniteTelegramRequestNonDeliveryError, 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 markdownToTelegramChunks, w as getTelegramFleetSupervisor, x as wrapFileReferencesInHtml, y as markdownToTelegramHtml, z as buildSenderName } from "./send-
|
|
56
|
+
import { i as enqueueCommandInLane, n as clearCommandLane, o as getCommandLaneSnapshots, s as getQueueSize, t as CommandLaneAbortedError } from "./command-queue-M5JKutHg.js";
|
|
57
|
+
import { $ as resolveTelegramMediaPlaceholder, A as releaseAccountOwner, B as buildTelegramGroupFrom, C as fingerprintTelegramToken, D as recordUpdate, E as recordState, F as resolveCronStorePath, G as describeReplyTarget, H as buildTelegramParentPeer, J as hasBotMention, K as expandTextLinks, L as buildGroupLabel, M as splitTelegramCaption, N as withTelegramApiErrorLogging, O as recordWebhook, P as loadCronStore, Q as resolveTelegramGroupAllowFromContext, R as buildSenderLabel, T as recordApiRequest, U as buildTelegramThreadParams, V as buildTelegramGroupPeerId, W as buildTypingThreadParams, X as resolveTelegramDirectPeerId, Y as normalizeForwardedContext, Z as resolveTelegramForumThreadId, _ as isTelegramEditMayHaveLandedError, a as reactMessageTelegram, at as normalizeDmAllowFromWithStore$1, b as renderTelegramHtmlText, c as sendStickerTelegram, ct as toLocationContext, d as wasSentByBot, dt as resolveTelegramTargetChatType, et as resolveTelegramReplyId, f as extractTelegramErrorText, g as isTelegramClientRejection, h as isSafeToRetrySendError, i as editMessageTelegram, it as normalizeAllowFrom$2, j as resolveTelegramFetch, k as registerAccount, lt as isVoiceCompatibleAudio, m as isRecoverableTelegramNetworkError, n as createForumTopicTelegram, nt as resolveTelegramThreadSpec, o as sendMessageTelegram, ot as resolveSenderAllowMatch$1, p as isDefiniteTelegramRequestNonDeliveryError, 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 markdownToTelegramChunks, w as getTelegramFleetSupervisor, x as wrapFileReferencesInHtml, y as markdownToTelegramHtml, z as buildSenderName } from "./send-BtRCVZMD.js";
|
|
58
58
|
import { i as buildModelAliasLines, n as resolveModel } from "./model-CnV-XnCh.js";
|
|
59
59
|
import { n as discoverModels, t as discoverAuthStorage } from "./pi-model-discovery-0UfvOl3H.js";
|
|
60
60
|
import { n as docsSiteUrl, t as DOCS_SITE_URL } from "./docs-site-CknyeB6K.js";
|
|
@@ -64,12 +64,12 @@ import { n as resolveExecSafeBinRuntimePolicy, r as resolveMergedSafeBinProfileF
|
|
|
64
64
|
import { n as resolveLearningWorkspaceDir, t as resolveSessionConsumerAgentIds } from "./session-consumer-agents-C9QGMBX3.js";
|
|
65
65
|
import { n as loadModelCatalog, r as modelSupportsVision, t as findModelInCatalog } from "./model-catalog-DMNZZ1nR.js";
|
|
66
66
|
import { a as getDefaultMediaLocalRoots, i as getAgentScopedMediaLocalRoots, n as fetchRemoteMedia, r as readResponseWithLimit, t as MediaFetchError } from "./fetch-EtV_LHEq.js";
|
|
67
|
-
import { C as stripCarriedTranscriptFromBody, D as registerUnhandledRejectionHandler, a as resolveAutoImageModel, d as resolveConcurrency, g as CLI_OUTPUT_MAX_BUFFER, h as resolveMediaUnderstandingScope, i as normalizeMediaAttachments, k as resolveAttachmentKind, l as applyTemplate, m as normalizeMediaUnderstandingChatType, n as buildProviderRegistry, o as resolveMediaAttachmentLocalRoots, p as resolveTimeoutMs$1, r as createMediaAttachmentCache, s as runCapability, t as runAudioTranscription, w as buildRandomTempFilePath } from "./audio-transcription-runner-
|
|
67
|
+
import { C as stripCarriedTranscriptFromBody, D as registerUnhandledRejectionHandler, a as resolveAutoImageModel, d as resolveConcurrency, g as CLI_OUTPUT_MAX_BUFFER, h as resolveMediaUnderstandingScope, i as normalizeMediaAttachments, k as resolveAttachmentKind, l as applyTemplate, m as normalizeMediaUnderstandingChatType, n as buildProviderRegistry, o as resolveMediaAttachmentLocalRoots, p as resolveTimeoutMs$1, r as createMediaAttachmentCache, s as runCapability, t as runAudioTranscription, w as buildRandomTempFilePath } from "./audio-transcription-runner-CsYhC8Ez.js";
|
|
68
68
|
import { n as fetchWithTimeout, t as bindAbortRelay } from "./fetch-timeout-Wg2M0G8N.js";
|
|
69
69
|
import { n as withStrictGuardedFetchMode, r as withTrustedEnvProxyGuardedFetchMode, t as fetchWithSsrFGuard } from "./fetch-guard-DjaxNHf0.js";
|
|
70
70
|
import { r as makeProxyFetch } from "./proxy-fetch-B4_sByIQ.js";
|
|
71
|
-
import { a as decodeDataUrl, i as coerceImageModelConfig, o as resolveProviderVisionModelFromConfig, r as coerceImageAssistantText, s as minimaxUnderstandImage } from "./provider-image-
|
|
72
|
-
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-
|
|
71
|
+
import { a as decodeDataUrl, i as coerceImageModelConfig, o as resolveProviderVisionModelFromConfig, r as coerceImageAssistantText, s as minimaxUnderstandImage } from "./provider-image-DG4nAiir.js";
|
|
72
|
+
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-DDGSjA3F.js";
|
|
73
73
|
import { n as formatToolSummary, r as resolveToolDisplay } from "./tool-display-DJ2wCzZ1.js";
|
|
74
74
|
import { i as resolveModelCostConfig, n as formatTokenCount$2, r as formatUsd, t as estimateUsageCost } from "./usage-format-DFNB1c7t.js";
|
|
75
75
|
import { n as isSafeFenceBreak, r as parseFenceSpans, t as findFenceSpanAt } from "./fences-BSm8V_DY.js";
|
|
@@ -78,11 +78,11 @@ import { n as resolveMarkdownTableMode } from "./markdown-tables-BPyLwnBe.js";
|
|
|
78
78
|
import { a as loadWebMedia, i as getDefaultLocalRoots, o as loadWebMediaRaw } from "./ir-B52WLuKY.js";
|
|
79
79
|
import { a as resolveNativeSkillsEnabled, i as resolveNativeCommandsEnabled, n as isNativeCommandsExplicitlyDisabled, r as isRestartEnabled, t as isCommandFlagEnabled } from "./commands-fhgY6SeL.js";
|
|
80
80
|
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-DVJolQ4K.js";
|
|
81
|
-
import { a as
|
|
81
|
+
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-DXmhuMNN.js";
|
|
82
82
|
import { _n as SESSION_LABEL_MAX_LENGTH, t as GatewayClient } from "./client-4U040amS.js";
|
|
83
83
|
import { b as resolveLeastPrivilegeOperatorScopesForMethod, i as callGatewayLeastPrivilege, n as callGateway, s as randomIdempotencyKey, t as buildGatewayConnectionDetails } from "./call-B8iSZzM-.js";
|
|
84
|
-
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-
|
|
85
|
-
import { _ as resolveReplyToMode, a as normalizeOutboundPayloadsForJson, b as normalizeTargetForProvider, c as loadChannelOutboundAdapter, d as filterMessagingToolDuplicates, f as filterMessagingToolMediaDuplicates, g as createReplyToModeFilterForChannel, h as shouldSuppressReasoningPayload, i as normalizeOutboundPayloads, l as applyReplyTagsToPayload, m as shouldSuppressMessagingToolReplies, o as normalizeReplyPayloadsForDelivery, p as isRenderablePayload, r as formatOutboundPayloadLog, s as throwIfAborted, t as deliverOutboundPayloads, u as applyReplyThreading, v as buildTargetResolverSignature, y as normalizeChannelTargetInput } from "./deliver-
|
|
84
|
+
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-CtVQdtCv.js";
|
|
85
|
+
import { _ as resolveReplyToMode, a as normalizeOutboundPayloadsForJson, b as normalizeTargetForProvider, c as loadChannelOutboundAdapter, d as filterMessagingToolDuplicates, f as filterMessagingToolMediaDuplicates, g as createReplyToModeFilterForChannel, h as shouldSuppressReasoningPayload, i as normalizeOutboundPayloads, l as applyReplyTagsToPayload, m as shouldSuppressMessagingToolReplies, o as normalizeReplyPayloadsForDelivery, p as isRenderablePayload, r as formatOutboundPayloadLog, s as throwIfAborted, t as deliverOutboundPayloads, u as applyReplyThreading, v as buildTargetResolverSignature, y as normalizeChannelTargetInput } from "./deliver-B59Njn4n.js";
|
|
86
86
|
import { i as AGENT_LANE_SUBAGENT, r as AGENT_LANE_NESTED, t as startUserSessionRun } from "./user-run-recording-iWHTMeP1.js";
|
|
87
87
|
import { r as normalizeInboundTextNewlines, t as finalizeInboundContext } from "./inbound-context-6eG5oPr9.js";
|
|
88
88
|
import { n as wrapFetchWithAbortSignal, t as resolveFetch } from "./fetch--Fn4tlfW.js";
|
|
@@ -104,7 +104,7 @@ import { p as resolveGatewaySystemdServiceName, u as resolveGatewayLaunchAgentLa
|
|
|
104
104
|
import { n as loadCostUsageSummary, r as loadSessionCostSummary } from "./session-cost-usage-DdiX-o6q.js";
|
|
105
105
|
import { i as parseAbsoluteTimeMs, r as resolveDefaultCronStaggerMs, t as normalizeCronStaggerMs } from "./stagger-CT5G1TCV.js";
|
|
106
106
|
import { a as normalizeHttpWebhookUrl, o as inferLegacyName, r as isPipelineHeartbeatInFlight } from "./heartbeat-tick-DuLXTOc2.js";
|
|
107
|
-
import { a as resolvePinnedMainDmOwnerFromAllowlist, c as filterToolsByPolicy, d as resolveGroupToolPolicy, f as resolveSubagentToolPolicy, i as resolveDmGroupAccessWithLists, l as isToolAllowedByPolicies, n as readStoreAllowFromForDmPolicy, o as resolveCommandAuthorizedFromAuthorizers, s as resolveControlCommandGate, t as DM_GROUP_ACCESS_REASON, u as resolveEffectiveToolPolicy } from "./dm-policy-shared-
|
|
107
|
+
import { a as resolvePinnedMainDmOwnerFromAllowlist, c as filterToolsByPolicy, d as resolveGroupToolPolicy, f as resolveSubagentToolPolicy, i as resolveDmGroupAccessWithLists, l as isToolAllowedByPolicies, n as readStoreAllowFromForDmPolicy, o as resolveCommandAuthorizedFromAuthorizers, s as resolveControlCommandGate, t as DM_GROUP_ACCESS_REASON, u as resolveEffectiveToolPolicy } from "./dm-policy-shared-Cj47AVma.js";
|
|
108
108
|
import { n as splitMediaFromOutput, t as parseReplyDirectives } from "./reply-directives-T2WyMjBh.js";
|
|
109
109
|
import { n as resolveMessageChannelSelection, t as listConfiguredMessageChannels } from "./channel-selection-NgNAWl2N.js";
|
|
110
110
|
import { i as applyPluginAutoEnable, r as resolveTelegramPollingTimeout } from "./polling-timeout-DyienBOH.js";
|
|
@@ -220,7 +220,7 @@ async function applyBootstrapHookOverrides(params) {
|
|
|
220
220
|
|
|
221
221
|
//#endregion
|
|
222
222
|
//#region src/agents/system-prompt-config.ts
|
|
223
|
-
const log$
|
|
223
|
+
const log$35 = createSubsystemLogger("agents/system-prompt-config");
|
|
224
224
|
const DEFAULT_PROMPT_SOURCE_MAX_CHARS = 2e4;
|
|
225
225
|
const MAX_PROMPT_SOURCE_FILE_BYTES = 512 * 1024;
|
|
226
226
|
const MAX_PROMPT_SOURCE_FILE_BYTES_HARD = 8 * 1024 * 1024;
|
|
@@ -406,7 +406,7 @@ async function readPromptSourceFile(params) {
|
|
|
406
406
|
if (!opened.ok) {
|
|
407
407
|
promptSourceCache.delete(absolutePath);
|
|
408
408
|
if (params.optional) {
|
|
409
|
-
if (opened.reason !== "path") log$
|
|
409
|
+
if (opened.reason !== "path") log$35.warn("skipping optional systemPrompt source: present but unusable", {
|
|
410
410
|
file: params.file,
|
|
411
411
|
reason: opened.reason
|
|
412
412
|
});
|
|
@@ -430,7 +430,7 @@ async function readPromptSourceFile(params) {
|
|
|
430
430
|
} catch (error) {
|
|
431
431
|
promptSourceCache.delete(opened.path);
|
|
432
432
|
if (params.optional) {
|
|
433
|
-
log$
|
|
433
|
+
log$35.warn("skipping optional systemPrompt source after read error", {
|
|
434
434
|
file: params.file,
|
|
435
435
|
error
|
|
436
436
|
});
|
|
@@ -537,7 +537,7 @@ async function resolveSystemPromptConfigForRun(params) {
|
|
|
537
537
|
|
|
538
538
|
//#endregion
|
|
539
539
|
//#region src/agents/workspace-lanes.ts
|
|
540
|
-
const log$
|
|
540
|
+
const log$34 = createSubsystemLogger("agents/workspace-lanes");
|
|
541
541
|
const DEFAULT_ROOT_TEMPLATE = "~/.openclaw/agents/{agentId}/lanes/{laneId}/workspace";
|
|
542
542
|
const SUPPORTED_STRATEGY = "hybrid";
|
|
543
543
|
const DEFAULT_COPIED_ON_CREATE_FILES = ["USER.md", "BOOTSTRAP.md"];
|
|
@@ -690,7 +690,7 @@ function resolveWorkspaceLane(params) {
|
|
|
690
690
|
actor: params.actor
|
|
691
691
|
});
|
|
692
692
|
if (!keyResult.ok) {
|
|
693
|
-
log$
|
|
693
|
+
log$34.warn("workspace lane key denied", {
|
|
694
694
|
agentId,
|
|
695
695
|
laneKeySource: keyResult.laneKeySource,
|
|
696
696
|
reason: keyResult.reason
|
|
@@ -711,7 +711,7 @@ function resolveWorkspaceLane(params) {
|
|
|
711
711
|
laneId: key.laneId
|
|
712
712
|
});
|
|
713
713
|
if (!rootTemplate.ok) {
|
|
714
|
-
log$
|
|
714
|
+
log$34.warn("workspace lane root template denied", {
|
|
715
715
|
agentId,
|
|
716
716
|
laneId: key.laneId,
|
|
717
717
|
laneKeySource: key.laneKeySource,
|
|
@@ -729,7 +729,7 @@ function resolveWorkspaceLane(params) {
|
|
|
729
729
|
}
|
|
730
730
|
const effectiveWorkspaceDir = rootTemplate.effectiveWorkspaceDir;
|
|
731
731
|
if (strategy !== SUPPORTED_STRATEGY) {
|
|
732
|
-
log$
|
|
732
|
+
log$34.warn("workspace lane strategy denied", {
|
|
733
733
|
agentId,
|
|
734
734
|
strategy
|
|
735
735
|
});
|
|
@@ -824,7 +824,7 @@ async function resolveWorkspaceLaneForTurn(params) {
|
|
|
824
824
|
if ((config?.create ?? "on-first-message") !== "on-first-message") {
|
|
825
825
|
const pathState = await getExistingPathState(resolution.effectiveWorkspaceDir);
|
|
826
826
|
if (pathState !== "directory") {
|
|
827
|
-
log$
|
|
827
|
+
log$34.warn("workspace lane manual creation denied", {
|
|
828
828
|
agentId: resolution.agentId,
|
|
829
829
|
laneId: resolution.laneId,
|
|
830
830
|
laneKeySource: resolution.laneKeySource,
|
|
@@ -850,7 +850,7 @@ async function resolveWorkspaceLaneForTurn(params) {
|
|
|
850
850
|
targetRoot: resolution.effectiveWorkspaceDir,
|
|
851
851
|
relativePath: file
|
|
852
852
|
});
|
|
853
|
-
if (decision === "copied" || !existed) log$
|
|
853
|
+
if (decision === "copied" || !existed) log$34.info("workspace lane seed file decision", {
|
|
854
854
|
agentId: resolution.agentId,
|
|
855
855
|
laneId: resolution.laneId,
|
|
856
856
|
laneKeySource: resolution.laneKeySource,
|
|
@@ -859,7 +859,7 @@ async function resolveWorkspaceLaneForTurn(params) {
|
|
|
859
859
|
});
|
|
860
860
|
}
|
|
861
861
|
const created = !existed;
|
|
862
|
-
if (created) log$
|
|
862
|
+
if (created) log$34.info("workspace lane created", {
|
|
863
863
|
agentId: resolution.agentId,
|
|
864
864
|
laneId: resolution.laneId,
|
|
865
865
|
laneKeySource: resolution.laneKeySource
|
|
@@ -3787,7 +3787,7 @@ function createPreparedEmbeddedPiSettingsManager(params) {
|
|
|
3787
3787
|
|
|
3788
3788
|
//#endregion
|
|
3789
3789
|
//#region src/plugins/activation-migration.ts
|
|
3790
|
-
const log$
|
|
3790
|
+
const log$33 = createSubsystemLogger("plugins/activation-migration");
|
|
3791
3791
|
/**
|
|
3792
3792
|
* One-time migration from the presence-implies-load model to explicit-enable (ADR 0016).
|
|
3793
3793
|
* Runs synchronously inside loadOpenClawPlugins, before resolveEnableState is applied.
|
|
@@ -3829,7 +3829,7 @@ function runActivationMigrationIfNeeded(config, pluginRecords) {
|
|
|
3829
3829
|
activationMigrationVersion: 1
|
|
3830
3830
|
}
|
|
3831
3831
|
};
|
|
3832
|
-
if (toEnable.size > 0) log$
|
|
3832
|
+
if (toEnable.size > 0) log$33.info(`activation migration v1: auto-enabled ${toEnable.size} previously-active plugin(s)`, { ids: [...toEnable] });
|
|
3833
3833
|
return next;
|
|
3834
3834
|
}
|
|
3835
3835
|
|
|
@@ -3907,7 +3907,7 @@ function resolveEmbeddedSessionLane(key) {
|
|
|
3907
3907
|
|
|
3908
3908
|
//#endregion
|
|
3909
3909
|
//#region src/plugins/runtime/runtime-analysis-direct.ts
|
|
3910
|
-
const log$
|
|
3910
|
+
const log$32 = createSubsystemLogger("plugins/runtime/analysis");
|
|
3911
3911
|
const NEUTRAL_ANALYSIS_SYSTEM_PROMPT = "You are running a focused internal analysis for a WednesdayAI extension. Return only the requested result.";
|
|
3912
3912
|
function isJsonResponseFormat(params) {
|
|
3913
3913
|
return params.responseFormat === "json" || typeof params.responseFormat === "object" && params.responseFormat.type === "json_schema";
|
|
@@ -3967,8 +3967,8 @@ async function runDirectAnalysis(req, overrides) {
|
|
|
3967
3967
|
elapsedMs: full.elapsedMs,
|
|
3968
3968
|
error: full.error
|
|
3969
3969
|
};
|
|
3970
|
-
if (full.status === "ok" || full.status === "empty") log$
|
|
3971
|
-
else log$
|
|
3970
|
+
if (full.status === "ok" || full.status === "empty") log$32.info("direct analysis run", logFields);
|
|
3971
|
+
else log$32.warn("direct analysis run failed", logFields);
|
|
3972
3972
|
return full;
|
|
3973
3973
|
};
|
|
3974
3974
|
const controller = new AbortController();
|
|
@@ -4107,7 +4107,7 @@ async function runDirectAnalysis(req, overrides) {
|
|
|
4107
4107
|
|
|
4108
4108
|
//#endregion
|
|
4109
4109
|
//#region src/plugins/runtime/runtime-analysis.ts
|
|
4110
|
-
const log$
|
|
4110
|
+
const log$31 = createSubsystemLogger("plugins/runtime/analysis");
|
|
4111
4111
|
const DEFAULT_RUN_TIMEOUT_MS = 15e3;
|
|
4112
4112
|
const MIN_TIMEOUT_MS = 250;
|
|
4113
4113
|
const MAX_TIMEOUT_MS = 12e4;
|
|
@@ -4148,7 +4148,7 @@ function finalizeAnalysisResult(result, cfg, transport) {
|
|
|
4148
4148
|
const { costUsd: _untrusted, ...rest } = result;
|
|
4149
4149
|
let usageState = result.usageState;
|
|
4150
4150
|
if (usageState === void 0) {
|
|
4151
|
-
log$
|
|
4151
|
+
log$31.warn("analysis result missing usageState; treating the call as spent", {
|
|
4152
4152
|
transport,
|
|
4153
4153
|
status: result.status,
|
|
4154
4154
|
provider: result.provider,
|
|
@@ -4577,7 +4577,7 @@ async function executeAnalysisTransport(params, deps, fallbackTimeoutMs, lane, c
|
|
|
4577
4577
|
if (err instanceof CommandLaneAbortedError && !providerDispatched) return queuedCancellation();
|
|
4578
4578
|
const message = err instanceof Error ? err.message : String(err);
|
|
4579
4579
|
const status = /timed?\s*out|timeout/i.test(message) ? "timeout" : "error";
|
|
4580
|
-
log$
|
|
4580
|
+
log$31.warn("analysis run failed", {
|
|
4581
4581
|
purpose: params.purpose,
|
|
4582
4582
|
pluginId: params.pluginId,
|
|
4583
4583
|
status,
|
|
@@ -4638,7 +4638,7 @@ function createRuntimeAnalysis(deps = {}, concurrencyConfig) {
|
|
|
4638
4638
|
try {
|
|
4639
4639
|
await onComplete(result);
|
|
4640
4640
|
} catch (err) {
|
|
4641
|
-
log$
|
|
4641
|
+
log$31.warn("analysis enqueue completion failed", {
|
|
4642
4642
|
purpose: params.purpose,
|
|
4643
4643
|
error: err instanceof Error ? err.message : String(err)
|
|
4644
4644
|
});
|
|
@@ -4694,7 +4694,7 @@ function createRuntimeAnalysis(deps = {}, concurrencyConfig) {
|
|
|
4694
4694
|
(async () => {
|
|
4695
4695
|
try {
|
|
4696
4696
|
const result = await executeAnalysis(job.params, mergedDeps, DEFAULT_RUN_TIMEOUT_MS, CommandLane.Analysis);
|
|
4697
|
-
log$
|
|
4697
|
+
log$31.info("analysis run completed", {
|
|
4698
4698
|
pluginId: job.params.pluginId,
|
|
4699
4699
|
purpose: job.params.purpose,
|
|
4700
4700
|
durationMs: result.elapsedMs,
|
|
@@ -4743,7 +4743,7 @@ function createRuntimeAnalysis(deps = {}, concurrencyConfig) {
|
|
|
4743
4743
|
const parallelSlot = activeParallelRuns;
|
|
4744
4744
|
try {
|
|
4745
4745
|
const result = await executeAnalysis(runParams, mergedDeps, DEFAULT_RUN_TIMEOUT_MS, CommandLane.Analysis);
|
|
4746
|
-
log$
|
|
4746
|
+
log$31.info("analysis run completed", {
|
|
4747
4747
|
pluginId: runParams.pluginId,
|
|
4748
4748
|
purpose: params.purpose,
|
|
4749
4749
|
durationMs: result.elapsedMs,
|
|
@@ -4781,7 +4781,7 @@ function createRuntimeAnalysis(deps = {}, concurrencyConfig) {
|
|
|
4781
4781
|
});
|
|
4782
4782
|
}
|
|
4783
4783
|
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";
|
|
4784
|
-
log$
|
|
4784
|
+
log$31.info("analysis run rejected", {
|
|
4785
4785
|
pluginId: runParams.pluginId,
|
|
4786
4786
|
purpose: params.purpose,
|
|
4787
4787
|
error: "analysis concurrency limit exceeded",
|
|
@@ -6524,6 +6524,9 @@ var SessionActorQueue = class {
|
|
|
6524
6524
|
|
|
6525
6525
|
//#endregion
|
|
6526
6526
|
//#region src/acp/control-plane/manager.core.ts
|
|
6527
|
+
const log$30 = createSubsystemLogger("acp/manager");
|
|
6528
|
+
const STARTUP_RECONCILE_BACKEND_WAIT_MS = 3e4;
|
|
6529
|
+
const STARTUP_RECONCILE_BACKEND_POLL_MS = 250;
|
|
6527
6530
|
var AcpSessionManager = class {
|
|
6528
6531
|
constructor(deps = DEFAULT_DEPS) {
|
|
6529
6532
|
this.deps = deps;
|
|
@@ -6601,34 +6604,54 @@ var AcpSessionManager = class {
|
|
|
6601
6604
|
failed: failed + 1
|
|
6602
6605
|
};
|
|
6603
6606
|
}
|
|
6607
|
+
const logFailure = (sessionKey, acpError) => {
|
|
6608
|
+
const redactedKey = redactIdentifier(sessionKey);
|
|
6609
|
+
log$30.warn(`startup identity reconcile failed for ${redactedKey}: code=${acpError.code} ${acpError.message.replaceAll(sessionKey, redactedKey)}`);
|
|
6610
|
+
};
|
|
6611
|
+
const toReconcileError = (error) => toAcpRuntimeError({
|
|
6612
|
+
error,
|
|
6613
|
+
fallbackCode: "ACP_SESSION_INIT_FAILED",
|
|
6614
|
+
fallbackMessage: "ACP startup identity reconcile failed."
|
|
6615
|
+
});
|
|
6616
|
+
const deferred = [];
|
|
6604
6617
|
for (const session of acpSessions) {
|
|
6605
6618
|
if (!session.acp || !session.sessionKey) continue;
|
|
6606
6619
|
if (!isSessionIdentityPending(resolveSessionIdentityFromMeta(session.acp))) continue;
|
|
6607
6620
|
checked += 1;
|
|
6608
6621
|
try {
|
|
6609
|
-
if (await this.
|
|
6610
|
-
|
|
6611
|
-
|
|
6612
|
-
|
|
6613
|
-
|
|
6614
|
-
if (resolution.kind !== "ready") return false;
|
|
6615
|
-
const { runtime, handle, meta } = await this.ensureRuntimeHandle({
|
|
6616
|
-
cfg: params.cfg,
|
|
6622
|
+
if (await this.reconcileOneSessionIdentity(params.cfg, session.sessionKey)) resolved += 1;
|
|
6623
|
+
} catch (error) {
|
|
6624
|
+
const acpError = toReconcileError(error);
|
|
6625
|
+
if (acpError.code === "ACP_BACKEND_UNAVAILABLE") {
|
|
6626
|
+
deferred.push({
|
|
6617
6627
|
sessionKey: session.sessionKey,
|
|
6618
|
-
|
|
6628
|
+
backend: (session.acp.backend || params.cfg.acp?.backend || "").trim()
|
|
6619
6629
|
});
|
|
6620
|
-
|
|
6621
|
-
|
|
6622
|
-
sessionKey: session.sessionKey,
|
|
6623
|
-
runtime,
|
|
6624
|
-
handle,
|
|
6625
|
-
meta,
|
|
6626
|
-
failOnStatusError: false
|
|
6627
|
-
})).meta));
|
|
6628
|
-
})) resolved += 1;
|
|
6629
|
-
} catch (error) {
|
|
6630
|
+
continue;
|
|
6631
|
+
}
|
|
6630
6632
|
failed += 1;
|
|
6631
|
-
|
|
6633
|
+
logFailure(session.sessionKey, acpError);
|
|
6634
|
+
}
|
|
6635
|
+
}
|
|
6636
|
+
if (deferred.length > 0) {
|
|
6637
|
+
const backendIds = [...new Set(deferred.map(({ backend }) => backend))];
|
|
6638
|
+
const healthyByBackend = new Map(await Promise.all(backendIds.map(async (backend) => [backend, await waitForAcpRuntimeBackendHealthy({
|
|
6639
|
+
id: backend || void 0,
|
|
6640
|
+
timeoutMs: params.backendWaitMs ?? STARTUP_RECONCILE_BACKEND_WAIT_MS,
|
|
6641
|
+
pollMs: params.backendPollMs ?? STARTUP_RECONCILE_BACKEND_POLL_MS
|
|
6642
|
+
})])));
|
|
6643
|
+
for (const { sessionKey, backend } of deferred) {
|
|
6644
|
+
if (!healthyByBackend.get(backend)) {
|
|
6645
|
+
failed += 1;
|
|
6646
|
+
logFailure(sessionKey, new AcpRuntimeError("ACP_BACKEND_UNAVAILABLE", `ACP runtime backend${backend ? ` "${backend}"` : ""} did not become healthy before the startup wait expired.`));
|
|
6647
|
+
continue;
|
|
6648
|
+
}
|
|
6649
|
+
try {
|
|
6650
|
+
if (await this.reconcileOneSessionIdentity(params.cfg, sessionKey)) resolved += 1;
|
|
6651
|
+
} catch (error) {
|
|
6652
|
+
failed += 1;
|
|
6653
|
+
logFailure(sessionKey, toReconcileError(error));
|
|
6654
|
+
}
|
|
6632
6655
|
}
|
|
6633
6656
|
}
|
|
6634
6657
|
return {
|
|
@@ -6637,6 +6660,37 @@ var AcpSessionManager = class {
|
|
|
6637
6660
|
failed
|
|
6638
6661
|
};
|
|
6639
6662
|
}
|
|
6663
|
+
async reconcileOneSessionIdentity(cfg, sessionKey) {
|
|
6664
|
+
return await this.withSessionActor(sessionKey, async () => {
|
|
6665
|
+
const resolution = this.resolveSession({
|
|
6666
|
+
cfg,
|
|
6667
|
+
sessionKey
|
|
6668
|
+
});
|
|
6669
|
+
if (resolution.kind !== "ready") return false;
|
|
6670
|
+
const { runtime, handle, meta } = await this.ensureRuntimeHandle({
|
|
6671
|
+
cfg,
|
|
6672
|
+
sessionKey,
|
|
6673
|
+
meta: resolution.meta
|
|
6674
|
+
});
|
|
6675
|
+
try {
|
|
6676
|
+
return !isSessionIdentityPending(resolveSessionIdentityFromMeta((await this.reconcileRuntimeSessionIdentifiers({
|
|
6677
|
+
cfg,
|
|
6678
|
+
sessionKey,
|
|
6679
|
+
runtime,
|
|
6680
|
+
handle,
|
|
6681
|
+
meta,
|
|
6682
|
+
failOnStatusError: true
|
|
6683
|
+
})).meta));
|
|
6684
|
+
} catch (error) {
|
|
6685
|
+
const stored = this.deps.readSessionEntry({
|
|
6686
|
+
cfg,
|
|
6687
|
+
sessionKey
|
|
6688
|
+
})?.acp;
|
|
6689
|
+
if (stored && !isSessionIdentityPending(resolveSessionIdentityFromMeta(stored))) return true;
|
|
6690
|
+
throw error;
|
|
6691
|
+
}
|
|
6692
|
+
});
|
|
6693
|
+
}
|
|
6640
6694
|
async initializeSession(input) {
|
|
6641
6695
|
const sessionKey = normalizeSessionKey$1(input.sessionKey);
|
|
6642
6696
|
if (!sessionKey) throw new AcpRuntimeError("ACP_SESSION_INIT_FAILED", "ACP session key is required.");
|
|
@@ -8104,7 +8158,7 @@ async function routeReply(params) {
|
|
|
8104
8158
|
const resolvedReplyToId = replyToId ?? (channelId === "slack" && threadId != null && threadId !== "" ? String(threadId) : void 0);
|
|
8105
8159
|
const resolvedThreadId = channelId === "slack" ? null : threadId ?? null;
|
|
8106
8160
|
try {
|
|
8107
|
-
const { deliverOutboundPayloads } = await import("./deliver-
|
|
8161
|
+
const { deliverOutboundPayloads } = await import("./deliver-B59Njn4n.js").then((n) => n.n);
|
|
8108
8162
|
const outboundSession = buildOutboundSessionContext({
|
|
8109
8163
|
cfg,
|
|
8110
8164
|
agentId: resolvedAgentId,
|
|
@@ -8907,7 +8961,7 @@ function resolveAgentTimeoutMs(opts) {
|
|
|
8907
8961
|
|
|
8908
8962
|
//#endregion
|
|
8909
8963
|
//#region src/agents/subagent-announce-turn.ts
|
|
8910
|
-
const log$
|
|
8964
|
+
const log$29 = createSubsystemLogger("agents/subagent-announce-turn");
|
|
8911
8965
|
function clearDelayedReleaseHoldIfNoAnnounceIsParked(sessionKey) {
|
|
8912
8966
|
if (!peekDelayedAgentTurn(sessionKey, (payload) => payload.kind === "announce")) clearDelayedReleaseHold(sessionKey);
|
|
8913
8967
|
}
|
|
@@ -8967,7 +9021,7 @@ async function publishSubagentAnnounceTurn(params) {
|
|
|
8967
9021
|
};
|
|
8968
9022
|
} catch (error) {
|
|
8969
9023
|
clearDelayedReleaseHoldIfNoAnnounceIsParked(params.requesterSessionKey);
|
|
8970
|
-
log$
|
|
9024
|
+
log$29.warn("subagent announce turn failed", { error: String(error) });
|
|
8971
9025
|
return {
|
|
8972
9026
|
status: "failed",
|
|
8973
9027
|
error: String(error)
|
|
@@ -13218,7 +13272,7 @@ async function sendTranscriptEcho(params) {
|
|
|
13218
13272
|
}
|
|
13219
13273
|
const text = formatEchoTranscript(transcript, params.format ?? DEFAULT_ECHO_TRANSCRIPT_FORMAT);
|
|
13220
13274
|
try {
|
|
13221
|
-
const { deliverOutboundPayloads } = await import("./deliver-
|
|
13275
|
+
const { deliverOutboundPayloads } = await import("./deliver-B59Njn4n.js").then((n) => n.n);
|
|
13222
13276
|
await deliverOutboundPayloads({
|
|
13223
13277
|
cfg,
|
|
13224
13278
|
channel: normalizedChannel,
|
|
@@ -17683,7 +17737,7 @@ function createRunRegistry(options) {
|
|
|
17683
17737
|
|
|
17684
17738
|
//#endregion
|
|
17685
17739
|
//#region src/process/supervisor/supervisor.ts
|
|
17686
|
-
const log$
|
|
17740
|
+
const log$28 = createSubsystemLogger("process/supervisor");
|
|
17687
17741
|
function clampTimeout(value) {
|
|
17688
17742
|
if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) return;
|
|
17689
17743
|
return Math.max(1, Math.floor(value));
|
|
@@ -17869,7 +17923,7 @@ function createProcessSupervisor() {
|
|
|
17869
17923
|
exitCode: null,
|
|
17870
17924
|
exitSignal: null
|
|
17871
17925
|
});
|
|
17872
|
-
log$
|
|
17926
|
+
log$28.warn(`spawn failed: runId=${runId} reason=${String(err)}`);
|
|
17873
17927
|
throw err;
|
|
17874
17928
|
}
|
|
17875
17929
|
};
|
|
@@ -27200,7 +27254,7 @@ async function handleSubagentsLogAction(ctx) {
|
|
|
27200
27254
|
|
|
27201
27255
|
//#endregion
|
|
27202
27256
|
//#region src/agents/pi-embedded-runner/logger.ts
|
|
27203
|
-
const log$
|
|
27257
|
+
const log$27 = createSubsystemLogger("agent/embedded");
|
|
27204
27258
|
|
|
27205
27259
|
//#endregion
|
|
27206
27260
|
//#region src/agents/pi-embedded-runner/run-sender-identity.ts
|
|
@@ -27245,7 +27299,7 @@ function resolveRunSenderIdentity(params) {
|
|
|
27245
27299
|
candidate: params.inheritedCanonicalIdentity
|
|
27246
27300
|
});
|
|
27247
27301
|
if (inherited) {
|
|
27248
|
-
log$
|
|
27302
|
+
log$27.info("runtime identity injected", {
|
|
27249
27303
|
identitySource: "parent-session",
|
|
27250
27304
|
canonicalIdentity: inherited,
|
|
27251
27305
|
trigger: params.trigger,
|
|
@@ -27264,7 +27318,7 @@ function resolveRunSenderIdentity(params) {
|
|
|
27264
27318
|
candidate: params.configuredIdentity
|
|
27265
27319
|
});
|
|
27266
27320
|
if (configured) {
|
|
27267
|
-
log$
|
|
27321
|
+
log$27.info("runtime identity injected", {
|
|
27268
27322
|
identitySource: "job-config",
|
|
27269
27323
|
canonicalIdentity: configured,
|
|
27270
27324
|
trigger: params.trigger,
|
|
@@ -33051,7 +33105,7 @@ const REMINDER_CONTEXT_MESSAGES_MAX = 10;
|
|
|
33051
33105
|
const REMINDER_CONTEXT_PER_MESSAGE_MAX = 220;
|
|
33052
33106
|
const REMINDER_CONTEXT_TOTAL_MAX = 700;
|
|
33053
33107
|
const REMINDER_CONTEXT_MARKER = "\n\nRecent context:\n";
|
|
33054
|
-
const log$
|
|
33108
|
+
const log$26 = createSubsystemLogger("cron-tool");
|
|
33055
33109
|
const AGENT_FORBIDDEN_JOB_FIELDS = new Set(["identity", "state"]);
|
|
33056
33110
|
const JOB_KEYS = new Set([
|
|
33057
33111
|
"name",
|
|
@@ -33187,7 +33241,7 @@ async function buildReminderContextLines(params) {
|
|
|
33187
33241
|
}
|
|
33188
33242
|
return lines;
|
|
33189
33243
|
} catch (err) {
|
|
33190
|
-
log$
|
|
33244
|
+
log$26.warn("reminder context fetch failed", { error: err });
|
|
33191
33245
|
return ["- (context unavailable: gateway unreachable)"];
|
|
33192
33246
|
}
|
|
33193
33247
|
}
|
|
@@ -33589,7 +33643,7 @@ function assertGatewayToolActionAllowed(params) {
|
|
|
33589
33643
|
|
|
33590
33644
|
//#endregion
|
|
33591
33645
|
//#region src/agents/tools/gateway-tool.ts
|
|
33592
|
-
const log$
|
|
33646
|
+
const log$25 = createSubsystemLogger("gateway-tool");
|
|
33593
33647
|
const DEFAULT_UPDATE_TIMEOUT_MS = 20 * 6e4;
|
|
33594
33648
|
const GatewayToolSchema = Type.Object({
|
|
33595
33649
|
action: stringEnum([
|
|
@@ -33657,7 +33711,7 @@ function createGatewayTool(opts) {
|
|
|
33657
33711
|
try {
|
|
33658
33712
|
await writeRestartSentinel(payload);
|
|
33659
33713
|
} catch {}
|
|
33660
|
-
log$
|
|
33714
|
+
log$25.info(`gateway tool: restart requested (delayMs=${delayMs ?? "default"}, reason=${reason ?? "none"})`);
|
|
33661
33715
|
return jsonResult(scheduleGatewaySigusr1Restart({
|
|
33662
33716
|
delayMs,
|
|
33663
33717
|
reason
|
|
@@ -39729,7 +39783,7 @@ async function resolveAnnounceTarget(params) {
|
|
|
39729
39783
|
|
|
39730
39784
|
//#endregion
|
|
39731
39785
|
//#region src/agents/tools/sessions-send-tool.a2a.ts
|
|
39732
|
-
const log$
|
|
39786
|
+
const log$24 = createSubsystemLogger("agents/sessions-send");
|
|
39733
39787
|
async function runSessionsSendA2AFlow(params) {
|
|
39734
39788
|
const runContextId = params.waitRunId ?? "unknown";
|
|
39735
39789
|
try {
|
|
@@ -39824,7 +39878,7 @@ async function runSessionsSendA2AFlow(params) {
|
|
|
39824
39878
|
timeoutMs: 1e4
|
|
39825
39879
|
});
|
|
39826
39880
|
} catch (err) {
|
|
39827
|
-
log$
|
|
39881
|
+
log$24.warn("sessions_send announce delivery failed", {
|
|
39828
39882
|
runId: runContextId,
|
|
39829
39883
|
channel: announceTarget.channel,
|
|
39830
39884
|
to: announceTarget.to,
|
|
@@ -39832,7 +39886,7 @@ async function runSessionsSendA2AFlow(params) {
|
|
|
39832
39886
|
});
|
|
39833
39887
|
}
|
|
39834
39888
|
} catch (err) {
|
|
39835
|
-
log$
|
|
39889
|
+
log$24.warn("sessions_send announce flow failed", {
|
|
39836
39890
|
runId: runContextId,
|
|
39837
39891
|
error: formatErrorMessage(err)
|
|
39838
39892
|
});
|
|
@@ -40612,7 +40666,7 @@ const BACKGROUND_IDLE_RECHECK_MS = 1e3;
|
|
|
40612
40666
|
const BACKGROUND_IDLE_MAX_ATTEMPTS = 30;
|
|
40613
40667
|
const backgroundIdleAttempts = /* @__PURE__ */ new Map();
|
|
40614
40668
|
const SIGNAL_DEADLINE_GRACE_MS = 0;
|
|
40615
|
-
const log$
|
|
40669
|
+
const log$23 = createSubsystemLogger("agent-signals");
|
|
40616
40670
|
function normalizeTrimmed(value) {
|
|
40617
40671
|
return value?.trim() || void 0;
|
|
40618
40672
|
}
|
|
@@ -40898,7 +40952,7 @@ function dispatchHeartbeatSignal(signal, now = Date.now()) {
|
|
|
40898
40952
|
if (!signal.sessionKey) return false;
|
|
40899
40953
|
if (signal.requiresIdle === true) {
|
|
40900
40954
|
if (signal.notBeforeMs !== void 0 && now > signal.notBeforeMs + SIGNAL_DEADLINE_GRACE_MS) {
|
|
40901
|
-
log$
|
|
40955
|
+
log$23.warn("agent-signals: evicting requiresIdle heartbeat signal past its deadline", {
|
|
40902
40956
|
signalId: signal.id,
|
|
40903
40957
|
type: signal.type,
|
|
40904
40958
|
source: signal.source,
|
|
@@ -43810,7 +43864,7 @@ function resolveRunWorkspaceDir(params) {
|
|
|
43810
43864
|
|
|
43811
43865
|
//#endregion
|
|
43812
43866
|
//#region src/agents/cli-runner.ts
|
|
43813
|
-
const log$
|
|
43867
|
+
const log$22 = createSubsystemLogger("agent/claude-cli");
|
|
43814
43868
|
async function runCliAgent(params) {
|
|
43815
43869
|
const started = Date.now();
|
|
43816
43870
|
const workspaceResolution = resolveRunWorkspaceDir({
|
|
@@ -43823,7 +43877,7 @@ async function runCliAgent(params) {
|
|
|
43823
43877
|
const redactedSessionId = redactRunIdentifier(params.sessionId);
|
|
43824
43878
|
const redactedSessionKey = redactRunIdentifier(params.sessionKey);
|
|
43825
43879
|
const redactedWorkspace = redactRunIdentifier(resolvedWorkspace);
|
|
43826
|
-
if (workspaceResolution.usedFallback) log$
|
|
43880
|
+
if (workspaceResolution.usedFallback) log$22.warn(`[workspace-fallback] caller=runCliAgent reason=${workspaceResolution.fallbackReason} run=${params.runId} session=${redactedSessionId} sessionKey=${redactedSessionKey} agent=${workspaceResolution.agentId} workspace=${redactedWorkspace}`);
|
|
43827
43881
|
const workspaceDir = resolvedWorkspace;
|
|
43828
43882
|
const backendResolved = resolveCliBackendConfig(params.provider, params.config);
|
|
43829
43883
|
if (!backendResolved) throw new Error(`Unknown CLI backend: ${params.provider}`);
|
|
@@ -43853,7 +43907,7 @@ async function runCliAgent(params) {
|
|
|
43853
43907
|
resolvedSystemPrompt,
|
|
43854
43908
|
warn: makeBootstrapWarn({
|
|
43855
43909
|
sessionLabel,
|
|
43856
|
-
warn: (message) => log$
|
|
43910
|
+
warn: (message) => log$22.warn(message)
|
|
43857
43911
|
})
|
|
43858
43912
|
});
|
|
43859
43913
|
const heartbeatPrompt = sessionAgentId === defaultAgentId ? resolveHeartbeatPrompt$1(params.config?.agents?.defaults?.heartbeat?.prompt) : void 0;
|
|
@@ -43916,7 +43970,7 @@ async function runCliAgent(params) {
|
|
|
43916
43970
|
const queueKey = backend.serialize ?? true ? backendResolved.id : `${backendResolved.id}:${params.runId}`;
|
|
43917
43971
|
try {
|
|
43918
43972
|
return await enqueueCliRun(queueKey, async () => {
|
|
43919
|
-
log$
|
|
43973
|
+
log$22.info(`cli exec: provider=${params.provider} model=${normalizedModel} promptChars=${params.prompt.length}`);
|
|
43920
43974
|
const logOutputText = isTruthyEnvValue(process.env.OPENCLAW_CLAUDE_CLI_LOG_OUTPUT);
|
|
43921
43975
|
if (logOutputText) {
|
|
43922
43976
|
const logArgs = [];
|
|
@@ -43949,7 +44003,7 @@ async function runCliAgent(params) {
|
|
|
43949
44003
|
const promptIndex = logArgs.indexOf(argsPrompt);
|
|
43950
44004
|
if (promptIndex >= 0) logArgs[promptIndex] = `<prompt:${argsPrompt.length} chars>`;
|
|
43951
44005
|
}
|
|
43952
|
-
log$
|
|
44006
|
+
log$22.info(`cli argv: ${backend.command} ${logArgs.join(" ")}`);
|
|
43953
44007
|
}
|
|
43954
44008
|
const env = (() => {
|
|
43955
44009
|
const next = {
|
|
@@ -43987,17 +44041,17 @@ async function runCliAgent(params) {
|
|
|
43987
44041
|
const stdout = result.stdout.trim();
|
|
43988
44042
|
const stderr = result.stderr.trim();
|
|
43989
44043
|
if (logOutputText) {
|
|
43990
|
-
if (stdout) log$
|
|
43991
|
-
if (stderr) log$
|
|
44044
|
+
if (stdout) log$22.info(`cli stdout:\n${stdout}`);
|
|
44045
|
+
if (stderr) log$22.info(`cli stderr:\n${stderr}`);
|
|
43992
44046
|
}
|
|
43993
44047
|
if (shouldLogVerbose()) {
|
|
43994
|
-
if (stdout) log$
|
|
43995
|
-
if (stderr) log$
|
|
44048
|
+
if (stdout) log$22.debug(`cli stdout:\n${stdout}`);
|
|
44049
|
+
if (stderr) log$22.debug(`cli stderr:\n${stderr}`);
|
|
43996
44050
|
}
|
|
43997
44051
|
if (result.exitCode !== 0 || result.reason !== "exit") {
|
|
43998
44052
|
if (result.reason === "no-output-timeout" || result.noOutputTimedOut) {
|
|
43999
44053
|
const timeoutReason = `CLI produced no output for ${Math.round(noOutputTimeoutMs / 1e3)}s and was terminated.`;
|
|
44000
|
-
log$
|
|
44054
|
+
log$22.warn(`cli watchdog timeout: provider=${params.provider} model=${modelId} session=${resolvedSessionId ?? params.sessionId} noOutputTimeoutMs=${noOutputTimeoutMs} pid=${managedRun.pid ?? "unknown"}`);
|
|
44001
44055
|
throw new FailoverError(timeoutReason, {
|
|
44002
44056
|
reason: "timeout",
|
|
44003
44057
|
provider: params.provider,
|
|
@@ -44051,7 +44105,7 @@ async function runCliAgent(params) {
|
|
|
44051
44105
|
} catch (err) {
|
|
44052
44106
|
if (err instanceof FailoverError) {
|
|
44053
44107
|
if (err.reason === "session_expired" && params.cliSessionId && params.sessionKey) {
|
|
44054
|
-
log$
|
|
44108
|
+
log$22.warn(`CLI session expired, clearing session ID and retrying: provider=${params.provider} session=${redactRunIdentifier(params.cliSessionId)}`);
|
|
44055
44109
|
const output = await executeCliWithSession(void 0);
|
|
44056
44110
|
const text = output.text?.trim();
|
|
44057
44111
|
return {
|
|
@@ -44631,7 +44685,7 @@ function createBlockReplyDeliveryHandler(params) {
|
|
|
44631
44685
|
* every turn the queue-drain path starts later (a `sessions.steer` mode "queue" follow-up and
|
|
44632
44686
|
* every channel follow-up ride the same drain).
|
|
44633
44687
|
*/
|
|
44634
|
-
const log$
|
|
44688
|
+
const log$21 = createSubsystemLogger("auto-reply/session-run-recording");
|
|
44635
44689
|
const NO_RECORDING = {
|
|
44636
44690
|
complete: async () => {},
|
|
44637
44691
|
fail: async () => {},
|
|
@@ -44662,7 +44716,7 @@ async function beginTurnSessionRun(params) {
|
|
|
44662
44716
|
sessionKey
|
|
44663
44717
|
});
|
|
44664
44718
|
} catch (error) {
|
|
44665
|
-
log$
|
|
44719
|
+
log$21.warn("session-run recording unavailable for this turn", {
|
|
44666
44720
|
runId: params.runId,
|
|
44667
44721
|
error: error instanceof Error ? error.message : String(error)
|
|
44668
44722
|
});
|
|
@@ -45495,7 +45549,7 @@ function repairToolUseResultPairing(messages) {
|
|
|
45495
45549
|
|
|
45496
45550
|
//#endregion
|
|
45497
45551
|
//#region src/agents/compaction.ts
|
|
45498
|
-
const log$
|
|
45552
|
+
const log$20 = createSubsystemLogger("compaction");
|
|
45499
45553
|
const BASE_CHUNK_RATIO = .4;
|
|
45500
45554
|
const MIN_CHUNK_RATIO = .15;
|
|
45501
45555
|
const SAFETY_MARGIN = 1.2;
|
|
@@ -45621,7 +45675,7 @@ async function summarizeWithFallback(params) {
|
|
|
45621
45675
|
try {
|
|
45622
45676
|
return await summarizeChunks(params);
|
|
45623
45677
|
} catch (fullError) {
|
|
45624
|
-
log$
|
|
45678
|
+
log$20.warn(`Full summarization failed, trying partial: ${fullError instanceof Error ? fullError.message : String(fullError)}`);
|
|
45625
45679
|
}
|
|
45626
45680
|
const smallMessages = [];
|
|
45627
45681
|
const oversizedNotes = [];
|
|
@@ -45636,7 +45690,7 @@ async function summarizeWithFallback(params) {
|
|
|
45636
45690
|
messages: smallMessages
|
|
45637
45691
|
}) + (oversizedNotes.length > 0 ? `\n\n${oversizedNotes.join("\n")}` : "");
|
|
45638
45692
|
} catch (partialError) {
|
|
45639
|
-
log$
|
|
45693
|
+
log$20.warn(`Partial summarization also failed: ${partialError instanceof Error ? partialError.message : String(partialError)}`);
|
|
45640
45694
|
}
|
|
45641
45695
|
return `Context contained ${messages.length} messages (${oversizedNotes.length} oversized). Summary unavailable due to size limits.`;
|
|
45642
45696
|
}
|
|
@@ -47842,7 +47896,7 @@ async function applyResetModelOverride(params) {
|
|
|
47842
47896
|
//#endregion
|
|
47843
47897
|
//#region src/infra/session-maintenance-warning.ts
|
|
47844
47898
|
const warnedContexts = /* @__PURE__ */ new Map();
|
|
47845
|
-
const log$
|
|
47899
|
+
const log$19 = createSubsystemLogger("session-maintenance-warning");
|
|
47846
47900
|
function shouldSendWarning() {
|
|
47847
47901
|
return !process.env.VITEST && true;
|
|
47848
47902
|
}
|
|
@@ -47898,7 +47952,7 @@ async function deliverSessionMaintenanceWarning(params) {
|
|
|
47898
47952
|
return;
|
|
47899
47953
|
}
|
|
47900
47954
|
try {
|
|
47901
|
-
const { deliverOutboundPayloads } = await import("./deliver-
|
|
47955
|
+
const { deliverOutboundPayloads } = await import("./deliver-B59Njn4n.js").then((n) => n.n);
|
|
47902
47956
|
const outboundSession = buildOutboundSessionContext({
|
|
47903
47957
|
cfg: params.cfg,
|
|
47904
47958
|
sessionKey: params.sessionKey
|
|
@@ -47913,7 +47967,7 @@ async function deliverSessionMaintenanceWarning(params) {
|
|
|
47913
47967
|
session: outboundSession
|
|
47914
47968
|
});
|
|
47915
47969
|
} catch (err) {
|
|
47916
|
-
log$
|
|
47970
|
+
log$19.warn(`Failed to deliver session maintenance warning: ${String(err)}`);
|
|
47917
47971
|
enqueueSystemEvent(text, { sessionKey: params.sessionKey });
|
|
47918
47972
|
}
|
|
47919
47973
|
}
|
|
@@ -48083,7 +48137,7 @@ function buildSessionEndHookPayload(params) {
|
|
|
48083
48137
|
|
|
48084
48138
|
//#endregion
|
|
48085
48139
|
//#region src/auto-reply/reply/session.ts
|
|
48086
|
-
const log$
|
|
48140
|
+
const log$18 = createSubsystemLogger("session-init");
|
|
48087
48141
|
async function initSessionState(params) {
|
|
48088
48142
|
const { ctx, cfg, commandAuthorized } = params;
|
|
48089
48143
|
const targetSessionKey = ctx.CommandSource === "native" ? ctx.CommandTargetSessionKey?.trim() : void 0;
|
|
@@ -48290,10 +48344,10 @@ async function initSessionState(params) {
|
|
|
48290
48344
|
if (parentSessionKey && parentSessionKey !== sessionKey && sessionStore[parentSessionKey] && !alreadyForked) {
|
|
48291
48345
|
const parentTokens = sessionStore[parentSessionKey].totalTokens ?? 0;
|
|
48292
48346
|
if (parentForkMaxTokens > 0 && parentTokens > parentForkMaxTokens) {
|
|
48293
|
-
log$
|
|
48347
|
+
log$18.warn(`skipping parent fork (parent too large): parentKey=${parentSessionKey} → sessionKey=${sessionKey} parentTokens=${parentTokens} maxTokens=${parentForkMaxTokens}`);
|
|
48294
48348
|
sessionEntry.forkedFromParent = true;
|
|
48295
48349
|
} else {
|
|
48296
|
-
log$
|
|
48350
|
+
log$18.warn(`forking from parent session: parentKey=${parentSessionKey} → sessionKey=${sessionKey} parentTokens=${parentTokens}`);
|
|
48297
48351
|
const forked = await forkSessionFromParent({
|
|
48298
48352
|
parentEntry: sessionStore[parentSessionKey],
|
|
48299
48353
|
agentId,
|
|
@@ -48304,7 +48358,7 @@ async function initSessionState(params) {
|
|
|
48304
48358
|
sessionEntry.sessionId = forked.sessionId;
|
|
48305
48359
|
sessionEntry.sessionFile = forked.sessionFile;
|
|
48306
48360
|
sessionEntry.forkedFromParent = true;
|
|
48307
|
-
log$
|
|
48361
|
+
log$18.warn(`forked session created: file=${forked.sessionFile}`);
|
|
48308
48362
|
}
|
|
48309
48363
|
}
|
|
48310
48364
|
}
|
|
@@ -52991,7 +53045,7 @@ async function describeStickerImage(params) {
|
|
|
52991
53045
|
logVerbose(`telegram: describing sticker with ${provider}/${model}`);
|
|
52992
53046
|
try {
|
|
52993
53047
|
const buffer = await fs$1.readFile(imagePath);
|
|
52994
|
-
const { describeImageWithModel } = await import("./provider-image-
|
|
53048
|
+
const { describeImageWithModel } = await import("./provider-image-DG4nAiir.js").then((n) => n.n);
|
|
52995
53049
|
return (await describeImageWithModel({
|
|
52996
53050
|
buffer,
|
|
52997
53051
|
fileName: "sticker.webp",
|
|
@@ -54581,7 +54635,7 @@ async function resolveDiscordPreflightAudioMentionContext(params) {
|
|
|
54581
54635
|
let transcript;
|
|
54582
54636
|
let carry;
|
|
54583
54637
|
if (needsPreflightTranscription) try {
|
|
54584
|
-
const { transcribeFirstAudio } = await import("./audio-preflight-
|
|
54638
|
+
const { transcribeFirstAudio } = await import("./audio-preflight-DanEnt5T.js");
|
|
54585
54639
|
const uploadable = audioAttachments.filter((att) => typeof att.url === "string" && att.url.length > 0);
|
|
54586
54640
|
if (uploadable.length > 0) {
|
|
54587
54641
|
const preflight = await transcribeFirstAudio({
|
|
@@ -57595,7 +57649,7 @@ function toDiscordModelPickerMessagePayload(view) {
|
|
|
57595
57649
|
|
|
57596
57650
|
//#endregion
|
|
57597
57651
|
//#region src/discord/monitor/native-command.ts
|
|
57598
|
-
const log$
|
|
57652
|
+
const log$17 = createSubsystemLogger("discord/native-command");
|
|
57599
57653
|
function buildDiscordCommandOptions(params) {
|
|
57600
57654
|
const { command, cfg } = params;
|
|
57601
57655
|
const args = command.args;
|
|
@@ -58652,7 +58706,7 @@ async function dispatchDiscordCommandInteraction(params) {
|
|
|
58652
58706
|
},
|
|
58653
58707
|
onError: (err, info) => {
|
|
58654
58708
|
const message = err instanceof Error ? err.stack ?? err.message : String(err);
|
|
58655
|
-
log$
|
|
58709
|
+
log$17.error(`discord slash ${info.kind} reply failed: ${message}`);
|
|
58656
58710
|
}
|
|
58657
58711
|
},
|
|
58658
58712
|
replyOptions: {
|
|
@@ -59246,7 +59300,7 @@ function createDefaultDeps() {
|
|
|
59246
59300
|
};
|
|
59247
59301
|
},
|
|
59248
59302
|
sendMessageTelegram: async (...args) => {
|
|
59249
|
-
const { sendMessageTelegram } = await import("./send-
|
|
59303
|
+
const { sendMessageTelegram } = await import("./send-BtRCVZMD.js").then((n) => n.l);
|
|
59250
59304
|
return await sendMessageTelegram(...args);
|
|
59251
59305
|
},
|
|
59252
59306
|
sendMessageDiscord: async (...args) => {
|
|
@@ -59664,7 +59718,7 @@ function resolveSession(opts) {
|
|
|
59664
59718
|
|
|
59665
59719
|
//#endregion
|
|
59666
59720
|
//#region src/commands/agent.ts
|
|
59667
|
-
const log$
|
|
59721
|
+
const log$16 = createSubsystemLogger("commands/agent");
|
|
59668
59722
|
const OVERRIDE_FIELDS_CLEARED_BY_DELETE = [
|
|
59669
59723
|
"providerOverride",
|
|
59670
59724
|
"modelOverride",
|
|
@@ -59722,7 +59776,7 @@ function runAgentAttempt(params) {
|
|
|
59722
59776
|
});
|
|
59723
59777
|
return runCliWithSession(cliSessionId).catch(async (err) => {
|
|
59724
59778
|
if (err instanceof FailoverError && err.reason === "session_expired" && cliSessionId && params.sessionKey && params.sessionStore && params.storePath) {
|
|
59725
|
-
log$
|
|
59779
|
+
log$16.warn(`CLI session expired, clearing from session store: provider=${params.providerOverride} sessionKey=${params.sessionKey}`);
|
|
59726
59780
|
const entry = params.sessionStore[params.sessionKey];
|
|
59727
59781
|
if (entry) {
|
|
59728
59782
|
const updatedEntry = { ...entry };
|
|
@@ -75040,7 +75094,7 @@ const buildTelegramMessageContext = async ({ primaryCtx, allMedia, replyMedia =
|
|
|
75040
75094
|
let audioPreflightCarry;
|
|
75041
75095
|
const audioConfigEnabled = cfg.tools?.media?.audio && cfg.tools.media.audio.enabled !== false;
|
|
75042
75096
|
if (hasAudio && !hasUserText && !disableAudioPreflight && (isGroup && requireMention && mentionRegexes.length > 0 || audioConfigEnabled === true)) try {
|
|
75043
|
-
const { transcribeFirstAudio } = await import("./audio-preflight-
|
|
75097
|
+
const { transcribeFirstAudio } = await import("./audio-preflight-DanEnt5T.js");
|
|
75044
75098
|
const preflight = await transcribeFirstAudio({
|
|
75045
75099
|
ctx: {
|
|
75046
75100
|
MediaPaths: allMedia.length > 0 ? allMedia.map((m) => m.path) : void 0,
|
|
@@ -77733,7 +77787,7 @@ const TELEGRAM_WEBHOOK_MAX_BODY_BYTES = 1024 * 1024;
|
|
|
77733
77787
|
const TELEGRAM_WEBHOOK_BODY_TIMEOUT_MS = 3e4;
|
|
77734
77788
|
const TELEGRAM_WEBHOOK_CALLBACK_TIMEOUT_MS = 1e4;
|
|
77735
77789
|
const TELEGRAM_WEBHOOK_DEFAULT_MAX_CONNECTIONS = 40;
|
|
77736
|
-
const log$
|
|
77790
|
+
const log$15 = createSubsystemLogger("telegram/webhook");
|
|
77737
77791
|
let webhookOwnerSequence = 0;
|
|
77738
77792
|
let ephemeralWebhookListenerSequence = 0;
|
|
77739
77793
|
let activeWebhookDiagnosticUsers = 0;
|
|
@@ -78063,7 +78117,7 @@ async function startTelegramWebhook(opts) {
|
|
|
78063
78117
|
recordRequest({ outcome: "received" });
|
|
78064
78118
|
const secretHeader = resolveSingleHeaderValue(req.headers["x-telegram-bot-api-secret-token"]);
|
|
78065
78119
|
if (!hasValidTelegramWebhookSecret(secretHeader, secret)) {
|
|
78066
|
-
log$
|
|
78120
|
+
log$15.warn("telegram webhook secret rejected", {
|
|
78067
78121
|
sourceIp: resolveWebhookSourceIp(req),
|
|
78068
78122
|
reason: typeof secretHeader === "string" ? "secret-mismatch" : "missing-header",
|
|
78069
78123
|
path
|
|
@@ -78158,7 +78212,7 @@ async function startTelegramWebhook(opts) {
|
|
|
78158
78212
|
const unauthorized = async () => {
|
|
78159
78213
|
if (replied) return;
|
|
78160
78214
|
replied = true;
|
|
78161
|
-
log$
|
|
78215
|
+
log$15.warn("telegram webhook secret rejected", {
|
|
78162
78216
|
sourceIp: resolveWebhookSourceIp(req),
|
|
78163
78217
|
reason: typeof secretHeader === "string" ? "secret-mismatch" : "missing-header",
|
|
78164
78218
|
path
|
|
@@ -79131,7 +79185,7 @@ function createRuntimeMedia() {
|
|
|
79131
79185
|
|
|
79132
79186
|
//#endregion
|
|
79133
79187
|
//#region src/infra/nudge.ts
|
|
79134
|
-
const log$
|
|
79188
|
+
const log$14 = createSubsystemLogger("infra/nudge");
|
|
79135
79189
|
function renderSummary(text, data) {
|
|
79136
79190
|
if (data && Object.keys(data).length > 0) try {
|
|
79137
79191
|
return `${text}\n\nData:\n${JSON.stringify(data, null, 2)}`;
|
|
@@ -79165,14 +79219,14 @@ function requestNudge(input, cfg = loadConfig(), deps) {
|
|
|
79165
79219
|
const enqueue = deps.enqueueAgentTurn;
|
|
79166
79220
|
try {
|
|
79167
79221
|
enqueue(payload).catch((error) => {
|
|
79168
|
-
log$
|
|
79222
|
+
log$14.warn("nudge enqueue failed", {
|
|
79169
79223
|
error,
|
|
79170
79224
|
sessionKey: redactIdentifier(sessionKey),
|
|
79171
79225
|
signalId
|
|
79172
79226
|
});
|
|
79173
79227
|
});
|
|
79174
79228
|
} catch (error) {
|
|
79175
|
-
log$
|
|
79229
|
+
log$14.warn("nudge enqueue failed", {
|
|
79176
79230
|
error,
|
|
79177
79231
|
sessionKey: redactIdentifier(sessionKey),
|
|
79178
79232
|
signalId
|
|
@@ -79195,14 +79249,14 @@ function requestNudge(input, cfg = loadConfig(), deps) {
|
|
|
79195
79249
|
execute: (claim) => runMainAgentTurn(claim.message.payload)
|
|
79196
79250
|
});
|
|
79197
79251
|
})().catch((error) => {
|
|
79198
|
-
log$
|
|
79252
|
+
log$14.warn("nudge claim chain failed", {
|
|
79199
79253
|
error,
|
|
79200
79254
|
sessionKey: redactIdentifier(sessionKey),
|
|
79201
79255
|
signalId
|
|
79202
79256
|
});
|
|
79203
79257
|
});
|
|
79204
79258
|
} catch (error) {
|
|
79205
|
-
log$
|
|
79259
|
+
log$14.warn("nudge enqueue failed", {
|
|
79206
79260
|
error,
|
|
79207
79261
|
sessionKey: redactIdentifier(sessionKey),
|
|
79208
79262
|
signalId
|
|
@@ -79217,11 +79271,11 @@ function requestNudge(input, cfg = loadConfig(), deps) {
|
|
|
79217
79271
|
|
|
79218
79272
|
//#endregion
|
|
79219
79273
|
//#region src/backbone/authz.ts
|
|
79220
|
-
const log$
|
|
79274
|
+
const log$13 = createSubsystemLogger("backbone/authz");
|
|
79221
79275
|
|
|
79222
79276
|
//#endregion
|
|
79223
79277
|
//#region src/backbone/scoped-plugin-api.ts
|
|
79224
|
-
const log$
|
|
79278
|
+
const log$12 = createSubsystemLogger("backbone/scoped-plugin-api");
|
|
79225
79279
|
|
|
79226
79280
|
//#endregion
|
|
79227
79281
|
//#region src/plugins/runtime/runtime-signals.ts
|
|
@@ -80275,7 +80329,7 @@ function createPluginLoaderLogger(logger) {
|
|
|
80275
80329
|
|
|
80276
80330
|
//#endregion
|
|
80277
80331
|
//#region src/plugins/tools.ts
|
|
80278
|
-
const log$
|
|
80332
|
+
const log$11 = createSubsystemLogger("plugins");
|
|
80279
80333
|
const pluginToolMeta = /* @__PURE__ */ new WeakMap();
|
|
80280
80334
|
function getPluginToolMeta(tool) {
|
|
80281
80335
|
return pluginToolMeta.get(tool);
|
|
@@ -80297,7 +80351,7 @@ function resolvePluginTools(params) {
|
|
|
80297
80351
|
const registry = loadOpenClawPlugins({
|
|
80298
80352
|
config: effectiveConfig,
|
|
80299
80353
|
workspaceDir: params.context.workspaceDir,
|
|
80300
|
-
logger: createPluginLoaderLogger(log$
|
|
80354
|
+
logger: createPluginLoaderLogger(log$11),
|
|
80301
80355
|
activate: false
|
|
80302
80356
|
});
|
|
80303
80357
|
const tools = [];
|
|
@@ -80312,7 +80366,7 @@ function resolvePluginTools(params) {
|
|
|
80312
80366
|
if (existingNormalized.has(pluginIdKey)) {
|
|
80313
80367
|
const message = `plugin id conflicts with core tool name (${entry.pluginId})`;
|
|
80314
80368
|
if (!params.suppressNameConflicts) {
|
|
80315
|
-
log$
|
|
80369
|
+
log$11.error(message);
|
|
80316
80370
|
registry.diagnostics.push({
|
|
80317
80371
|
level: "error",
|
|
80318
80372
|
code: "PLUGIN_REGISTER_ERROR",
|
|
@@ -80329,7 +80383,7 @@ function resolvePluginTools(params) {
|
|
|
80329
80383
|
try {
|
|
80330
80384
|
resolved = entry.factory(params.context);
|
|
80331
80385
|
} catch (err) {
|
|
80332
|
-
log$
|
|
80386
|
+
log$11.error(`plugin tool failed (${entry.pluginId}): ${String(err)}`);
|
|
80333
80387
|
continue;
|
|
80334
80388
|
}
|
|
80335
80389
|
if (!resolved) continue;
|
|
@@ -80346,7 +80400,7 @@ function resolvePluginTools(params) {
|
|
|
80346
80400
|
if (nameSet.has(tool.name) || existing.has(tool.name)) {
|
|
80347
80401
|
const message = `plugin tool name conflict (${entry.pluginId}): ${tool.name}`;
|
|
80348
80402
|
if (!params.suppressNameConflicts) {
|
|
80349
|
-
log$
|
|
80403
|
+
log$11.error(message);
|
|
80350
80404
|
registry.diagnostics.push({
|
|
80351
80405
|
level: "error",
|
|
80352
80406
|
code: "PLUGIN_REGISTER_ERROR",
|
|
@@ -80379,7 +80433,7 @@ function resolvePluginWebSearchProviders(params) {
|
|
|
80379
80433
|
return [...loadOpenClawPlugins({
|
|
80380
80434
|
config: effectiveConfig,
|
|
80381
80435
|
workspaceDir: params.workspaceDir,
|
|
80382
|
-
logger: createPluginLoaderLogger(log$
|
|
80436
|
+
logger: createPluginLoaderLogger(log$11),
|
|
80383
80437
|
activate: false
|
|
80384
80438
|
}).webSearchProviders].toSorted((a, b) => {
|
|
80385
80439
|
return (a.autoDetectOrder ?? Infinity) - (b.autoDetectOrder ?? Infinity);
|
|
@@ -80991,7 +81045,7 @@ function wrapToolWithAbortSignal(tool, abortSignal) {
|
|
|
80991
81045
|
|
|
80992
81046
|
//#endregion
|
|
80993
81047
|
//#region src/agents/pi-tools.before-tool-call.ts
|
|
80994
|
-
const log$
|
|
81048
|
+
const log$10 = createSubsystemLogger("agents/tools");
|
|
80995
81049
|
const BEFORE_TOOL_CALL_WRAPPED = Symbol("beforeToolCallWrapped");
|
|
80996
81050
|
const adjustedParamsByToolCallId = /* @__PURE__ */ new Map();
|
|
80997
81051
|
const MAX_TRACKED_ADJUSTED_PARAMS = 1024;
|
|
@@ -81029,7 +81083,7 @@ async function recordLoopOutcome(args) {
|
|
|
81029
81083
|
config: args.ctx.loopDetection
|
|
81030
81084
|
});
|
|
81031
81085
|
} catch (err) {
|
|
81032
|
-
log$
|
|
81086
|
+
log$10.warn(`tool loop outcome tracking failed: tool=${args.toolName} error=${String(err)}`);
|
|
81033
81087
|
}
|
|
81034
81088
|
}
|
|
81035
81089
|
var UserCancelledError = class extends Error {
|
|
@@ -81043,7 +81097,7 @@ async function runBeforeToolCallHook(args) {
|
|
|
81043
81097
|
const params = args.params;
|
|
81044
81098
|
if (args.ctx?.sessionKey) {
|
|
81045
81099
|
const { getDiagnosticSessionState } = await import("./diagnostic-session-state-DCr9T3zW.js").then((n) => n.n);
|
|
81046
|
-
const { logToolLoopAction } = await import("./diagnostic-
|
|
81100
|
+
const { logToolLoopAction } = await import("./diagnostic-DGVkVcyC.js").then((n) => n.r);
|
|
81047
81101
|
const { detectToolCallLoop, recordToolCall } = await import("./tool-loop-detection-CxKO1Zbh.js");
|
|
81048
81102
|
const sessionState = getDiagnosticSessionState({
|
|
81049
81103
|
sessionKey: args.ctx.sessionKey,
|
|
@@ -81056,7 +81110,7 @@ async function runBeforeToolCallHook(args) {
|
|
|
81056
81110
|
const loopResult = detectToolCallLoop(sessionState, toolName, params, args.ctx.loopDetection);
|
|
81057
81111
|
if (loopResult.stuck) {
|
|
81058
81112
|
if (loopResult.level === "critical") {
|
|
81059
|
-
log$
|
|
81113
|
+
log$10.error(`Blocking ${toolName} due to critical loop: ${loopResult.message}`);
|
|
81060
81114
|
logToolLoopAction({
|
|
81061
81115
|
sessionKey: args.ctx.sessionKey,
|
|
81062
81116
|
sessionId: args.ctx?.agentId,
|
|
@@ -81074,7 +81128,7 @@ async function runBeforeToolCallHook(args) {
|
|
|
81074
81128
|
reason: loopResult.message
|
|
81075
81129
|
};
|
|
81076
81130
|
} else if (shouldEmitLoopWarning(sessionState, loopResult.warningKey ?? `${loopResult.detector}:${toolName}`, loopResult.count)) {
|
|
81077
|
-
log$
|
|
81131
|
+
log$10.warn(`Loop warning for ${toolName}: ${loopResult.message}`);
|
|
81078
81132
|
logToolLoopAction({
|
|
81079
81133
|
sessionKey: args.ctx.sessionKey,
|
|
81080
81134
|
sessionId: args.ctx?.agentId,
|
|
@@ -81133,7 +81187,7 @@ async function runBeforeToolCallHook(args) {
|
|
|
81133
81187
|
}
|
|
81134
81188
|
} catch (err) {
|
|
81135
81189
|
const toolCallId = args.toolCallId ? ` toolCallId=${args.toolCallId}` : "";
|
|
81136
|
-
log$
|
|
81190
|
+
log$10.warn(`before_tool_call hook failed: tool=${toolName}${toolCallId} error=${String(err)}`);
|
|
81137
81191
|
}
|
|
81138
81192
|
return {
|
|
81139
81193
|
blocked: false,
|
|
@@ -82949,7 +83003,7 @@ async function truncateOversizedToolResultsInSession(params) {
|
|
|
82949
83003
|
const textLength = getToolResultTextLength(msg);
|
|
82950
83004
|
if (textLength > maxChars) {
|
|
82951
83005
|
oversizedIndices.push(i);
|
|
82952
|
-
log$
|
|
83006
|
+
log$27.info(`[tool-result-truncation] Found oversized tool result: entry=${entry.id} chars=${textLength} maxChars=${maxChars} sessionKey=${params.sessionKey ?? params.sessionId ?? "unknown"}`);
|
|
82953
83007
|
}
|
|
82954
83008
|
}
|
|
82955
83009
|
if (oversizedIndices.length === 0) return {
|
|
@@ -82971,7 +83025,7 @@ async function truncateOversizedToolResultsInSession(params) {
|
|
|
82971
83025
|
message = truncateToolResultMessage(message, maxChars);
|
|
82972
83026
|
truncatedCount++;
|
|
82973
83027
|
const newLength = getToolResultTextLength(message);
|
|
82974
|
-
log$
|
|
83028
|
+
log$27.info(`[tool-result-truncation] Truncated tool result: originalEntry=${entry.id} newChars=${newLength} sessionKey=${params.sessionKey ?? params.sessionId ?? "unknown"}`);
|
|
82975
83029
|
}
|
|
82976
83030
|
sessionManager.appendMessage(message);
|
|
82977
83031
|
} else if (entry.type === "compaction") sessionManager.appendCompaction(entry.summary, entry.firstKeptEntryId, entry.tokensBefore, entry.details, entry.fromHook);
|
|
@@ -82985,14 +83039,14 @@ async function truncateOversizedToolResultsInSession(params) {
|
|
|
82985
83039
|
if (entry.name) sessionManager.appendSessionInfo(entry.name);
|
|
82986
83040
|
}
|
|
82987
83041
|
}
|
|
82988
|
-
log$
|
|
83042
|
+
log$27.info(`[tool-result-truncation] Truncated ${truncatedCount} tool result(s) in session (contextWindow=${contextWindowTokens} maxChars=${maxChars}) sessionKey=${params.sessionKey ?? params.sessionId ?? "unknown"}`);
|
|
82989
83043
|
return {
|
|
82990
83044
|
truncated: true,
|
|
82991
83045
|
truncatedCount
|
|
82992
83046
|
};
|
|
82993
83047
|
} catch (err) {
|
|
82994
83048
|
const errMsg = err instanceof Error ? err.message : String(err);
|
|
82995
|
-
log$
|
|
83049
|
+
log$27.warn(`[tool-result-truncation] Failed to truncate: ${errMsg}`);
|
|
82996
83050
|
return {
|
|
82997
83051
|
truncated: false,
|
|
82998
83052
|
truncatedCount: 0,
|
|
@@ -83300,7 +83354,7 @@ const getCompactionSafeguardRuntime = registry$1.get;
|
|
|
83300
83354
|
|
|
83301
83355
|
//#endregion
|
|
83302
83356
|
//#region src/agents/pi-extensions/compaction-safeguard.ts
|
|
83303
|
-
const log$
|
|
83357
|
+
const log$9 = createSubsystemLogger("compaction-safeguard");
|
|
83304
83358
|
const missedModelWarningSessions = /* @__PURE__ */ new WeakSet();
|
|
83305
83359
|
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.";
|
|
83306
83360
|
const MAX_TOOL_FAILURES = 8;
|
|
@@ -83409,7 +83463,7 @@ function compactionSafeguardExtension(api) {
|
|
|
83409
83463
|
api.on("session_before_compact", async (event, ctx) => {
|
|
83410
83464
|
const { preparation, customInstructions, signal } = event;
|
|
83411
83465
|
if (!preparation.messagesToSummarize.some(isRealConversationMessage)) {
|
|
83412
|
-
log$
|
|
83466
|
+
log$9.warn("Compaction safeguard: cancelling compaction with no real conversation messages to summarize.");
|
|
83413
83467
|
return { cancel: true };
|
|
83414
83468
|
}
|
|
83415
83469
|
const { readFiles, modifiedFiles } = computeFileLists(preparation.fileOps);
|
|
@@ -83417,7 +83471,7 @@ function compactionSafeguardExtension(api) {
|
|
|
83417
83471
|
const toolFailureSection = formatToolFailuresSection(collectToolFailures([...preparation.messagesToSummarize, ...preparation.turnPrefixMessages]));
|
|
83418
83472
|
const runtime = getCompactionSafeguardRuntime(ctx.sessionManager);
|
|
83419
83473
|
if (runtime?.enabled === false) {
|
|
83420
|
-
log$
|
|
83474
|
+
log$9.info("Compaction safeguard: compaction disabled by config; cancelling.");
|
|
83421
83475
|
return { cancel: true };
|
|
83422
83476
|
}
|
|
83423
83477
|
const summarizationInstructions = {
|
|
@@ -83458,7 +83512,7 @@ function compactionSafeguardExtension(api) {
|
|
|
83458
83512
|
});
|
|
83459
83513
|
if (pruned.droppedChunks > 0) {
|
|
83460
83514
|
const newContentRatio = newContentTokens / contextWindowTokens * 100;
|
|
83461
|
-
log$
|
|
83515
|
+
log$9.warn(`Compaction safeguard: new content uses ${newContentRatio.toFixed(1)}% of context; dropped ${pruned.droppedChunks} older chunk(s) (${pruned.droppedMessages} messages) to fit history budget.`);
|
|
83462
83516
|
messagesToSummarize = pruned.messages;
|
|
83463
83517
|
if (pruned.droppedMessagesList.length > 0) try {
|
|
83464
83518
|
const droppedChunkRatio = computeAdaptiveChunkRatio(pruned.droppedMessagesList, contextWindowTokens);
|
|
@@ -83476,7 +83530,7 @@ function compactionSafeguardExtension(api) {
|
|
|
83476
83530
|
previousSummary: preparation.previousSummary
|
|
83477
83531
|
});
|
|
83478
83532
|
} catch (droppedError) {
|
|
83479
|
-
log$
|
|
83533
|
+
log$9.warn(`Compaction safeguard: failed to summarize dropped messages, continuing without: ${droppedError instanceof Error ? droppedError.message : String(droppedError)}`);
|
|
83480
83534
|
}
|
|
83481
83535
|
}
|
|
83482
83536
|
}
|
|
@@ -83524,7 +83578,7 @@ function compactionSafeguardExtension(api) {
|
|
|
83524
83578
|
}
|
|
83525
83579
|
} };
|
|
83526
83580
|
} catch (error) {
|
|
83527
|
-
log$
|
|
83581
|
+
log$9.warn(`Compaction summarization failed; cancelling compaction to preserve history: ${error instanceof Error ? error.message : String(error)}`);
|
|
83528
83582
|
return { cancel: true };
|
|
83529
83583
|
}
|
|
83530
83584
|
});
|
|
@@ -84255,14 +84309,14 @@ function logToolSchemasForGoogle(params) {
|
|
|
84255
84309
|
if (params.provider !== "google-gemini-cli") return;
|
|
84256
84310
|
const toolNames = params.tools.map((tool, index) => `${index}:${tool.name}`);
|
|
84257
84311
|
const tools = sanitizeToolsForGoogle(params);
|
|
84258
|
-
log$
|
|
84312
|
+
log$27.info("google tool schema snapshot", {
|
|
84259
84313
|
provider: params.provider,
|
|
84260
84314
|
toolCount: tools.length,
|
|
84261
84315
|
tools: toolNames
|
|
84262
84316
|
});
|
|
84263
84317
|
for (const [index, tool] of tools.entries()) {
|
|
84264
84318
|
const violations = findUnsupportedSchemaKeywords(tool.parameters, `${tool.name}.parameters`);
|
|
84265
|
-
if (violations.length > 0) log$
|
|
84319
|
+
if (violations.length > 0) log$27.warn("google tool schema has unsupported keywords", {
|
|
84266
84320
|
index,
|
|
84267
84321
|
tool: tool.name,
|
|
84268
84322
|
violations: violations.slice(0, 12),
|
|
@@ -84274,7 +84328,7 @@ const compactionFailureEmitter = new EventEmitter();
|
|
|
84274
84328
|
registerUnhandledRejectionHandler((reason) => {
|
|
84275
84329
|
const message = describeUnknownError(reason);
|
|
84276
84330
|
if (!isCompactionFailureError(message)) return false;
|
|
84277
|
-
log$
|
|
84331
|
+
log$27.error(`Auto-compaction failed (unhandled): ${message}`);
|
|
84278
84332
|
compactionFailureEmitter.emit("failure", message);
|
|
84279
84333
|
return true;
|
|
84280
84334
|
});
|
|
@@ -84326,7 +84380,7 @@ function applyGoogleTurnOrderingFix(params) {
|
|
|
84326
84380
|
const sanitized = sanitizeGoogleTurnOrdering(params.messages);
|
|
84327
84381
|
const didPrepend = sanitized !== params.messages;
|
|
84328
84382
|
if (didPrepend && !hasGoogleTurnOrderingMarker(params.sessionManager)) {
|
|
84329
|
-
(params.warn ?? ((message) => log$
|
|
84383
|
+
(params.warn ?? ((message) => log$27.warn(message)))(`google turn ordering fixup: prepended user bootstrap (sessionId=${params.sessionId})`);
|
|
84330
84384
|
markGoogleTurnOrderingMarker(params.sessionManager);
|
|
84331
84385
|
}
|
|
84332
84386
|
return {
|
|
@@ -84743,6 +84797,57 @@ async function flushPendingToolResultsAfterIdle(opts) {
|
|
|
84743
84797
|
opts.sessionManager?.flushPendingToolResults?.();
|
|
84744
84798
|
}
|
|
84745
84799
|
|
|
84800
|
+
//#endregion
|
|
84801
|
+
//#region src/agents/pi-embedded-runner/workspace-cwd.ts
|
|
84802
|
+
const log$8 = createSubsystemLogger("agents/workspace-cwd");
|
|
84803
|
+
const holders = [];
|
|
84804
|
+
let baselineCwd;
|
|
84805
|
+
function readCwd() {
|
|
84806
|
+
try {
|
|
84807
|
+
return process.cwd();
|
|
84808
|
+
} catch (err) {
|
|
84809
|
+
log$8.warn("process.cwd() failed; the working directory was removed under the process", { error: String(err) });
|
|
84810
|
+
return;
|
|
84811
|
+
}
|
|
84812
|
+
}
|
|
84813
|
+
function tryChdir(target) {
|
|
84814
|
+
if (readCwd() === target) return true;
|
|
84815
|
+
try {
|
|
84816
|
+
process.chdir(target);
|
|
84817
|
+
return true;
|
|
84818
|
+
} catch (err) {
|
|
84819
|
+
log$8.error("cwd restore target is gone", {
|
|
84820
|
+
target,
|
|
84821
|
+
error: String(err)
|
|
84822
|
+
});
|
|
84823
|
+
return false;
|
|
84824
|
+
}
|
|
84825
|
+
}
|
|
84826
|
+
/**
|
|
84827
|
+
* The cwd is process-global while embedded runs overlap (`agents.defaults.maxConcurrent`
|
|
84828
|
+
* defaults to 4). Each holder gets the cwd on acquire; on release the cwd goes to the most
|
|
84829
|
+
* recent surviving holder's workspace, and to the baseline the first holder found once none
|
|
84830
|
+
* remain. The returned release never throws: a throw from a caller's finally would skip the
|
|
84831
|
+
* rest of it (e.g. clearActiveEmbeddedRun) and leak the run registry entry.
|
|
84832
|
+
*/
|
|
84833
|
+
function acquireWorkspaceCwd(workspaceDir) {
|
|
84834
|
+
if (holders.length === 0) baselineCwd = readCwd() ?? os.tmpdir();
|
|
84835
|
+
if (readCwd() !== workspaceDir) process.chdir(workspaceDir);
|
|
84836
|
+
const holder = { workspaceDir };
|
|
84837
|
+
holders.push(holder);
|
|
84838
|
+
let released = false;
|
|
84839
|
+
return () => {
|
|
84840
|
+
if (released) return;
|
|
84841
|
+
released = true;
|
|
84842
|
+
const index = holders.indexOf(holder);
|
|
84843
|
+
if (index !== -1) holders.splice(index, 1);
|
|
84844
|
+
for (let i = holders.length - 1; i >= 0; i -= 1) if (tryChdir(holders[i].workspaceDir)) return;
|
|
84845
|
+
const target = baselineCwd ?? os.tmpdir();
|
|
84846
|
+
if (holders.length === 0) baselineCwd = void 0;
|
|
84847
|
+
if (!tryChdir(target) && !tryChdir(os.tmpdir())) log$8.error("tmpdir chdir failed; leaving the process cwd unchanged");
|
|
84848
|
+
};
|
|
84849
|
+
}
|
|
84850
|
+
|
|
84746
84851
|
//#endregion
|
|
84747
84852
|
//#region src/agents/pi-embedded-runner/compact.ts
|
|
84748
84853
|
function createCompactionDiagId$1() {
|
|
@@ -85153,11 +85258,10 @@ async function compactEmbeddedPiSessionDirect(params) {
|
|
|
85153
85258
|
compacted: false,
|
|
85154
85259
|
reason: "compaction deferred by context.prune handler"
|
|
85155
85260
|
};
|
|
85156
|
-
const prevCwd = process.cwd();
|
|
85157
85261
|
const provider = (params.provider ?? DEFAULT_PROVIDER).trim() || DEFAULT_PROVIDER;
|
|
85158
85262
|
const modelId = (params.model ?? DEFAULT_MODEL).trim() || DEFAULT_MODEL;
|
|
85159
85263
|
const fail = (reason) => {
|
|
85160
|
-
log$
|
|
85264
|
+
log$27.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}`);
|
|
85161
85265
|
return {
|
|
85162
85266
|
ok: false,
|
|
85163
85267
|
compacted: false,
|
|
@@ -85201,7 +85305,7 @@ async function compactEmbeddedPiSessionDirect(params) {
|
|
|
85201
85305
|
cwd: effectiveWorkspace
|
|
85202
85306
|
});
|
|
85203
85307
|
let restoreSkillEnv;
|
|
85204
|
-
|
|
85308
|
+
const releaseWorkspaceCwd = acquireWorkspaceCwd(effectiveWorkspace);
|
|
85205
85309
|
try {
|
|
85206
85310
|
const shouldLoadSkillEntries = !params.skillsSnapshot || !params.skillsSnapshot.resolvedSkills;
|
|
85207
85311
|
const skillEntries = shouldLoadSkillEntries ? loadWorkspaceSkillEntries(effectiveWorkspace) : [];
|
|
@@ -85237,7 +85341,7 @@ async function compactEmbeddedPiSessionDirect(params) {
|
|
|
85237
85341
|
resolvedSystemPrompt,
|
|
85238
85342
|
warn: makeBootstrapWarn({
|
|
85239
85343
|
sessionLabel,
|
|
85240
|
-
warn: (message) => log$
|
|
85344
|
+
warn: (message) => log$27.warn(message)
|
|
85241
85345
|
})
|
|
85242
85346
|
});
|
|
85243
85347
|
const runAbortController = new AbortController();
|
|
@@ -85379,7 +85483,7 @@ async function compactEmbeddedPiSessionDirect(params) {
|
|
|
85379
85483
|
});
|
|
85380
85484
|
try {
|
|
85381
85485
|
if (isPreservationArmed() || !isJsonlSessionBackend()) {
|
|
85382
|
-
log$
|
|
85486
|
+
log$27.warn(`[compaction-diag] refused transcript repair/open runId=${runId} sessionKey=${params.sessionKey ?? params.sessionId} diagId=${diagId} trigger=${trigger} preservationArmed=${isPreservationArmed()} jsonlBackend=${isJsonlSessionBackend()}`);
|
|
85383
85487
|
return {
|
|
85384
85488
|
ok: true,
|
|
85385
85489
|
compacted: false,
|
|
@@ -85388,7 +85492,7 @@ async function compactEmbeddedPiSessionDirect(params) {
|
|
|
85388
85492
|
}
|
|
85389
85493
|
await repairSessionFileIfNeeded({
|
|
85390
85494
|
sessionFile: params.sessionFile,
|
|
85391
|
-
warn: (message) => log$
|
|
85495
|
+
warn: (message) => log$27.warn(message)
|
|
85392
85496
|
});
|
|
85393
85497
|
await prewarmSessionFile(params.sessionFile);
|
|
85394
85498
|
const transcriptPolicy = resolveTranscriptPolicy({
|
|
@@ -85484,7 +85588,7 @@ async function compactEmbeddedPiSessionDirect(params) {
|
|
|
85484
85588
|
const inputStorageCursor = await loadCompactionStorageCursor({
|
|
85485
85589
|
sessionId: params.sessionId,
|
|
85486
85590
|
sessionKey: params.sessionKey,
|
|
85487
|
-
warn: (message) => log$
|
|
85591
|
+
warn: (message) => log$27.warn(message)
|
|
85488
85592
|
});
|
|
85489
85593
|
const truncated = limitHistoryTurns(validated, getDmHistoryLimitFromSessionKey(params.sessionKey, params.config));
|
|
85490
85594
|
const limited = transcriptPolicy.repairToolUseResultPairing ? sanitizeToolUseResultPairing(truncated) : truncated;
|
|
@@ -85496,7 +85600,7 @@ async function compactEmbeddedPiSessionDirect(params) {
|
|
|
85496
85600
|
tokenWindow,
|
|
85497
85601
|
usage,
|
|
85498
85602
|
storageCursor: inputStorageCursor,
|
|
85499
|
-
warn: (message) => log$
|
|
85603
|
+
warn: (message) => log$27.warn(message)
|
|
85500
85604
|
});
|
|
85501
85605
|
const sanitizedHookMessages = await sanitizeHookCompactionMessages({
|
|
85502
85606
|
messages: cloneCompactionMessages(compactionPlan.messages),
|
|
@@ -85519,7 +85623,7 @@ async function compactEmbeddedPiSessionDirect(params) {
|
|
|
85519
85623
|
messages: transcriptPolicy.validateAnthropicTurns ? validateAnthropicTurns(validatedPlannedGemini) : validatedPlannedGemini,
|
|
85520
85624
|
fallbackMessages: limited,
|
|
85521
85625
|
replacedMessages: compactionPlan.replacedMessages,
|
|
85522
|
-
warn: (message) => log$
|
|
85626
|
+
warn: (message) => log$27.warn(message)
|
|
85523
85627
|
});
|
|
85524
85628
|
const compactionInputMessages = compactionInput.messages;
|
|
85525
85629
|
if (compactionInputMessages.length === 0) return fail(compactionInput.abortReason ?? "compaction input is empty");
|
|
@@ -85530,13 +85634,13 @@ async function compactEmbeddedPiSessionDirect(params) {
|
|
|
85530
85634
|
messages: preCompactionMessages,
|
|
85531
85635
|
sessionFile: params.sessionFile
|
|
85532
85636
|
}, hookCtx).catch((hookErr) => {
|
|
85533
|
-
log$
|
|
85637
|
+
log$27.warn(`before_compaction hook failed: ${String(hookErr)}`);
|
|
85534
85638
|
});
|
|
85535
|
-
const diagEnabled = log$
|
|
85639
|
+
const diagEnabled = log$27.isEnabled("debug");
|
|
85536
85640
|
const preMetrics = diagEnabled ? summarizeCompactionMessages(session.messages) : void 0;
|
|
85537
85641
|
if (diagEnabled && preMetrics) {
|
|
85538
|
-
log$
|
|
85539
|
-
log$
|
|
85642
|
+
log$27.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"}`);
|
|
85643
|
+
log$27.debug(`[compaction-diag] contributors diagId=${diagId} top=${JSON.stringify(preMetrics.contributors)}`);
|
|
85540
85644
|
}
|
|
85541
85645
|
const compactStartedAt = Date.now();
|
|
85542
85646
|
setContextHooksLastCompactionPreparation(sessionManager, void 0);
|
|
@@ -85546,7 +85650,7 @@ async function compactEmbeddedPiSessionDirect(params) {
|
|
|
85546
85650
|
result = await compactWithAbortOnTimeout({
|
|
85547
85651
|
compact: () => session.compact(params.customInstructions),
|
|
85548
85652
|
abort: () => session.abortCompaction(),
|
|
85549
|
-
onAbortSettleTimeout: (err) => log$
|
|
85653
|
+
onAbortSettleTimeout: (err) => log$27.warn(`compaction did not settle after abort: ${String(err)}`)
|
|
85550
85654
|
});
|
|
85551
85655
|
} finally {
|
|
85552
85656
|
setContextHooksPlannedCompaction(sessionManager, void 0);
|
|
@@ -85574,12 +85678,12 @@ async function compactEmbeddedPiSessionDirect(params) {
|
|
|
85574
85678
|
compactedCount: compactionInputMessages.length - session.messages.length,
|
|
85575
85679
|
sessionFile: params.sessionFile
|
|
85576
85680
|
}, hookCtx).catch((hookErr) => {
|
|
85577
|
-
log$
|
|
85681
|
+
log$27.warn(`after_compaction hook failed: ${hookErr}`);
|
|
85578
85682
|
});
|
|
85579
85683
|
const outputStorageCursor = await loadCompactionStorageCursor({
|
|
85580
85684
|
sessionId: params.sessionId,
|
|
85581
85685
|
sessionKey: params.sessionKey,
|
|
85582
|
-
warn: (message) => log$
|
|
85686
|
+
warn: (message) => log$27.warn(message)
|
|
85583
85687
|
});
|
|
85584
85688
|
const compactionResult = {
|
|
85585
85689
|
summary: result.summary,
|
|
@@ -85609,10 +85713,10 @@ async function compactEmbeddedPiSessionDirect(params) {
|
|
|
85609
85713
|
outputMessageCount: session.messages.length,
|
|
85610
85714
|
replacedMessages: compactionReplacementApplied,
|
|
85611
85715
|
result: compactionResult,
|
|
85612
|
-
warn: (message) => log$
|
|
85716
|
+
warn: (message) => log$27.warn(message)
|
|
85613
85717
|
});
|
|
85614
85718
|
const postMetrics = diagEnabled ? summarizeCompactionMessages(session.messages) : void 0;
|
|
85615
|
-
if (diagEnabled && preMetrics && postMetrics) log$
|
|
85719
|
+
if (diagEnabled && preMetrics && postMetrics) log$27.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"}`);
|
|
85616
85720
|
return {
|
|
85617
85721
|
ok: true,
|
|
85618
85722
|
compacted: true,
|
|
@@ -85641,7 +85745,7 @@ async function compactEmbeddedPiSessionDirect(params) {
|
|
|
85641
85745
|
return fail(describeUnknownError(err));
|
|
85642
85746
|
} finally {
|
|
85643
85747
|
restoreSkillEnv?.();
|
|
85644
|
-
|
|
85748
|
+
releaseWorkspaceCwd();
|
|
85645
85749
|
}
|
|
85646
85750
|
}
|
|
85647
85751
|
/**
|
|
@@ -85765,15 +85869,15 @@ function createStreamFnWithExtraParams(baseStreamFn, extraParams, provider) {
|
|
|
85765
85869
|
if (transport === "sse" || transport === "websocket" || transport === "auto") streamParams.transport = transport;
|
|
85766
85870
|
else if (transport != null) {
|
|
85767
85871
|
const transportSummary = typeof transport === "string" ? transport : typeof transport;
|
|
85768
|
-
log$
|
|
85872
|
+
log$27.warn(`ignoring invalid transport param: ${transportSummary}`);
|
|
85769
85873
|
}
|
|
85770
85874
|
if (typeof extraParams.openaiWsWarmup === "boolean") streamParams.openaiWsWarmup = extraParams.openaiWsWarmup;
|
|
85771
85875
|
const cacheRetention = resolveCacheRetention(extraParams, provider);
|
|
85772
85876
|
if (cacheRetention) streamParams.cacheRetention = cacheRetention;
|
|
85773
85877
|
const providerRouting = provider === "openrouter" && extraParams.provider != null && typeof extraParams.provider === "object" ? extraParams.provider : void 0;
|
|
85774
85878
|
if (Object.keys(streamParams).length === 0 && !providerRouting) return;
|
|
85775
|
-
log$
|
|
85776
|
-
if (providerRouting) log$
|
|
85879
|
+
log$27.debug(`creating streamFn wrapper with params: ${JSON.stringify(streamParams)}`);
|
|
85880
|
+
if (providerRouting) log$27.debug(`OpenRouter provider routing: ${JSON.stringify(providerRouting)}`);
|
|
85777
85881
|
const underlying = baseStreamFn ?? streamSimple;
|
|
85778
85882
|
const wrappedStreamFn = (model, context, options) => {
|
|
85779
85883
|
return underlying(providerRouting ? {
|
|
@@ -85895,7 +85999,7 @@ function resolveAnthropicBetas(extraParams, provider, modelId) {
|
|
|
85895
85999
|
for (const beta of configured) if (typeof beta === "string" && beta.trim()) betas.add(beta.trim());
|
|
85896
86000
|
}
|
|
85897
86001
|
if (extraParams?.context1m === true) if (isAnthropic1MModel(modelId)) betas.add(ANTHROPIC_CONTEXT_1M_BETA);
|
|
85898
|
-
else log$
|
|
86002
|
+
else log$27.warn(`ignoring context1m for non-opus/sonnet model: ${provider}/${modelId}`);
|
|
85899
86003
|
return betas.size > 0 ? [...betas] : void 0;
|
|
85900
86004
|
}
|
|
85901
86005
|
function mergeAnthropicBetaHeader(headers, betas) {
|
|
@@ -85922,7 +86026,7 @@ function createAnthropicBetaHeadersWrapper(baseStreamFn, betas) {
|
|
|
85922
86026
|
const isOauth = isAnthropicOAuthApiKey(options?.apiKey);
|
|
85923
86027
|
const requestedContext1m = betas.includes(ANTHROPIC_CONTEXT_1M_BETA);
|
|
85924
86028
|
const effectiveBetas = isOauth && requestedContext1m ? betas.filter((beta) => beta !== ANTHROPIC_CONTEXT_1M_BETA) : betas;
|
|
85925
|
-
if (isOauth && requestedContext1m) log$
|
|
86029
|
+
if (isOauth && requestedContext1m) log$27.warn(`ignoring context1m for OAuth token auth on ${model.provider}/${model.id}; Anthropic rejects context-1m beta with OAuth auth`);
|
|
85926
86030
|
const piAiBetas = isOauth ? PI_AI_OAUTH_ANTHROPIC_BETAS : PI_AI_DEFAULT_ANTHROPIC_BETAS;
|
|
85927
86031
|
const allBetas = [...new Set([...piAiBetas, ...effectiveBetas])];
|
|
85928
86032
|
return underlying(model, context, {
|
|
@@ -86283,12 +86387,12 @@ function applyExtraParamsToAgent(agent, cfg, provider, modelId, extraParamsOverr
|
|
|
86283
86387
|
};
|
|
86284
86388
|
const wrappedStreamFn = createStreamFnWithExtraParams(agent.streamFn, merged, provider);
|
|
86285
86389
|
if (wrappedStreamFn) {
|
|
86286
|
-
log$
|
|
86390
|
+
log$27.debug(`applying extraParams to agent streamFn for ${provider}/${modelId}`);
|
|
86287
86391
|
agent.streamFn = wrappedStreamFn;
|
|
86288
86392
|
}
|
|
86289
86393
|
const anthropicBetas = resolveAnthropicBetas(merged, provider, modelId);
|
|
86290
86394
|
if (anthropicBetas?.length) {
|
|
86291
|
-
log$
|
|
86395
|
+
log$27.debug(`applying Anthropic beta header for ${provider}/${modelId}: ${anthropicBetas.join(",")}`);
|
|
86292
86396
|
agent.streamFn = createAnthropicBetaHeadersWrapper(agent.streamFn, anthropicBetas);
|
|
86293
86397
|
}
|
|
86294
86398
|
if (shouldApplySiliconFlowThinkingOffCompat({
|
|
@@ -86296,7 +86400,7 @@ function applyExtraParamsToAgent(agent, cfg, provider, modelId, extraParamsOverr
|
|
|
86296
86400
|
modelId,
|
|
86297
86401
|
thinkingLevel
|
|
86298
86402
|
})) {
|
|
86299
|
-
log$
|
|
86403
|
+
log$27.debug(`normalizing thinking=off to thinking=null for SiliconFlow compatibility (${provider}/${modelId})`);
|
|
86300
86404
|
agent.streamFn = createSiliconFlowThinkingWrapper(agent.streamFn);
|
|
86301
86405
|
}
|
|
86302
86406
|
if (provider === "moonshot") {
|
|
@@ -86304,22 +86408,22 @@ function applyExtraParamsToAgent(agent, cfg, provider, modelId, extraParamsOverr
|
|
|
86304
86408
|
configuredThinking: merged?.thinking,
|
|
86305
86409
|
thinkingLevel
|
|
86306
86410
|
});
|
|
86307
|
-
if (moonshotThinkingType) log$
|
|
86411
|
+
if (moonshotThinkingType) log$27.debug(`applying Moonshot thinking=${moonshotThinkingType} payload wrapper for ${provider}/${modelId}`);
|
|
86308
86412
|
agent.streamFn = createMoonshotThinkingWrapper(agent.streamFn, moonshotThinkingType);
|
|
86309
86413
|
}
|
|
86310
86414
|
if (provider === "openrouter") {
|
|
86311
|
-
log$
|
|
86415
|
+
log$27.debug(`applying OpenRouter app attribution headers for ${provider}/${modelId}`);
|
|
86312
86416
|
const openRouterThinkingLevel = modelId === "auto" || isOpenRouterReasoningUnsupported(modelId) ? void 0 : thinkingLevel;
|
|
86313
86417
|
agent.streamFn = createOpenRouterWrapper(agent.streamFn, openRouterThinkingLevel);
|
|
86314
86418
|
agent.streamFn = createOpenRouterSystemCacheWrapper(agent.streamFn);
|
|
86315
86419
|
}
|
|
86316
86420
|
if (provider === "amazon-bedrock" && !isAnthropicBedrockModel(modelId)) {
|
|
86317
|
-
log$
|
|
86421
|
+
log$27.debug(`disabling prompt caching for non-Anthropic Bedrock model ${provider}/${modelId}`);
|
|
86318
86422
|
agent.streamFn = createBedrockNoCacheWrapper(agent.streamFn);
|
|
86319
86423
|
}
|
|
86320
86424
|
if (provider === "zai" || provider === "z-ai") {
|
|
86321
86425
|
if (merged?.tool_stream !== false) {
|
|
86322
|
-
log$
|
|
86426
|
+
log$27.debug(`enabling Z.AI tool_stream for ${provider}/${modelId}`);
|
|
86323
86427
|
agent.streamFn = createZaiToolStreamWrapper(agent.streamFn, true);
|
|
86324
86428
|
}
|
|
86325
86429
|
}
|
|
@@ -87011,7 +87115,7 @@ function createOpenAIWebSocketStreamFn(apiKey, sessionId, opts = {}) {
|
|
|
87011
87115
|
if (!session.manager.isConnected() && !session.broken) try {
|
|
87012
87116
|
await session.manager.connect(apiKey);
|
|
87013
87117
|
session.everConnected = true;
|
|
87014
|
-
log$
|
|
87118
|
+
log$27.debug(`[ws-stream] connected for session=${sessionId}`);
|
|
87015
87119
|
} catch (connErr) {
|
|
87016
87120
|
try {
|
|
87017
87121
|
session.manager.close();
|
|
@@ -87019,12 +87123,12 @@ function createOpenAIWebSocketStreamFn(apiKey, sessionId, opts = {}) {
|
|
|
87019
87123
|
session.broken = true;
|
|
87020
87124
|
wsRegistry.delete(sessionId);
|
|
87021
87125
|
if (transport === "websocket") throw connErr instanceof Error ? connErr : new Error(String(connErr));
|
|
87022
|
-
log$
|
|
87126
|
+
log$27.warn(`[ws-stream] WebSocket connect failed for session=${sessionId}; falling back to HTTP. error=${String(connErr)}`);
|
|
87023
87127
|
return fallbackToHttp(model, context, options, eventStream, apiKey, opts.signal);
|
|
87024
87128
|
}
|
|
87025
87129
|
if (session.broken || !session.manager.isConnected()) {
|
|
87026
87130
|
if (transport === "websocket") throw new Error("WebSocket session disconnected");
|
|
87027
|
-
log$
|
|
87131
|
+
log$27.warn(`[ws-stream] session=${sessionId} broken/disconnected; falling back to HTTP`);
|
|
87028
87132
|
try {
|
|
87029
87133
|
session.manager.close();
|
|
87030
87134
|
} catch {}
|
|
@@ -87042,10 +87146,10 @@ function createOpenAIWebSocketStreamFn(apiKey, sessionId, opts = {}) {
|
|
|
87042
87146
|
instructions: context.systemPrompt ?? void 0,
|
|
87043
87147
|
signal
|
|
87044
87148
|
});
|
|
87045
|
-
log$
|
|
87149
|
+
log$27.debug(`[ws-stream] warm-up completed for session=${sessionId}`);
|
|
87046
87150
|
} catch (warmErr) {
|
|
87047
87151
|
if (signal?.aborted) throw warmErr instanceof Error ? warmErr : new Error(String(warmErr));
|
|
87048
|
-
log$
|
|
87152
|
+
log$27.warn(`[ws-stream] warm-up failed for session=${sessionId}; continuing without warm-up. error=${String(warmErr)}`);
|
|
87049
87153
|
}
|
|
87050
87154
|
}
|
|
87051
87155
|
const prevResponseId = session.manager.previousResponseId;
|
|
@@ -87053,13 +87157,13 @@ function createOpenAIWebSocketStreamFn(apiKey, sessionId, opts = {}) {
|
|
|
87053
87157
|
if (prevResponseId && session.lastContextLength > 0) {
|
|
87054
87158
|
const toolResults = context.messages.slice(session.lastContextLength).filter((m) => m.role === "toolResult");
|
|
87055
87159
|
if (toolResults.length === 0) {
|
|
87056
|
-
log$
|
|
87160
|
+
log$27.debug(`[ws-stream] session=${sessionId}: no new tool results found; sending full context`);
|
|
87057
87161
|
inputItems = buildFullInput(context);
|
|
87058
87162
|
} else inputItems = convertMessagesToInputItems(toolResults);
|
|
87059
|
-
log$
|
|
87163
|
+
log$27.debug(`[ws-stream] session=${sessionId}: incremental send (${inputItems.length} tool results) previous_response_id=${prevResponseId}`);
|
|
87060
87164
|
} else {
|
|
87061
87165
|
inputItems = buildFullInput(context);
|
|
87062
|
-
log$
|
|
87166
|
+
log$27.debug(`[ws-stream] session=${sessionId}: full context send (${inputItems.length} items)`);
|
|
87063
87167
|
}
|
|
87064
87168
|
const tools = convertTools(context.tools);
|
|
87065
87169
|
const streamOpts = options;
|
|
@@ -87089,7 +87193,7 @@ function createOpenAIWebSocketStreamFn(apiKey, sessionId, opts = {}) {
|
|
|
87089
87193
|
session.manager.send(payload);
|
|
87090
87194
|
} catch (sendErr) {
|
|
87091
87195
|
if (transport === "websocket") throw sendErr instanceof Error ? sendErr : new Error(String(sendErr));
|
|
87092
|
-
log$
|
|
87196
|
+
log$27.warn(`[ws-stream] send failed for session=${sessionId}; falling back to HTTP. error=${String(sendErr)}`);
|
|
87093
87197
|
try {
|
|
87094
87198
|
session.manager.close();
|
|
87095
87199
|
} catch {}
|
|
@@ -87169,7 +87273,7 @@ function createOpenAIWebSocketStreamFn(apiKey, sessionId, opts = {}) {
|
|
|
87169
87273
|
};
|
|
87170
87274
|
queueMicrotask(() => run().catch((err) => {
|
|
87171
87275
|
const errorMessage = err instanceof Error ? err.message : String(err);
|
|
87172
|
-
log$
|
|
87276
|
+
log$27.warn(`[ws-stream] session=${sessionId} run error: ${errorMessage}`);
|
|
87173
87277
|
eventStream.push({
|
|
87174
87278
|
type: "error",
|
|
87175
87279
|
reason: "error",
|
|
@@ -89219,7 +89323,7 @@ function normalizeRefForDedupe(raw) {
|
|
|
89219
89323
|
}
|
|
89220
89324
|
async function sanitizeImagesWithLog(images, label, imageSanitization) {
|
|
89221
89325
|
const { images: sanitized, dropped } = await sanitizeImageBlocks(images, label, imageSanitization);
|
|
89222
|
-
if (dropped > 0) log$
|
|
89326
|
+
if (dropped > 0) log$27.warn(`Native image: dropped ${dropped} image(s) after sanitization (${label}).`);
|
|
89223
89327
|
return sanitized;
|
|
89224
89328
|
}
|
|
89225
89329
|
/**
|
|
@@ -89306,7 +89410,7 @@ async function loadImageFromRef(ref, workspaceDir, options) {
|
|
|
89306
89410
|
mediaPath: targetPath
|
|
89307
89411
|
})).resolved;
|
|
89308
89412
|
} catch (err) {
|
|
89309
|
-
log$
|
|
89413
|
+
log$27.debug(`Native image: sandbox validation failed for ${ref.resolved}: ${err instanceof Error ? err.message : String(err)}`);
|
|
89310
89414
|
return null;
|
|
89311
89415
|
}
|
|
89312
89416
|
else if (!path.isAbsolute(targetPath)) targetPath = path.resolve(workspaceDir, targetPath);
|
|
@@ -89324,7 +89428,7 @@ async function loadImageFromRef(ref, workspaceDir, options) {
|
|
|
89324
89428
|
readFile: createSandboxBridgeReadFile({ sandbox: options.sandbox })
|
|
89325
89429
|
}) : await loadWebMedia(targetPath, options?.maxBytes);
|
|
89326
89430
|
if (media.kind !== "image") {
|
|
89327
|
-
log$
|
|
89431
|
+
log$27.debug(`Native image: not an image file: ${targetPath} (got ${media.kind})`);
|
|
89328
89432
|
return null;
|
|
89329
89433
|
}
|
|
89330
89434
|
const mimeType = media.contentType ?? "image/jpeg";
|
|
@@ -89334,7 +89438,7 @@ async function loadImageFromRef(ref, workspaceDir, options) {
|
|
|
89334
89438
|
mimeType
|
|
89335
89439
|
};
|
|
89336
89440
|
} catch (err) {
|
|
89337
|
-
log$
|
|
89441
|
+
log$27.debug(`Native image: failed to load ${ref.resolved}: ${err instanceof Error ? err.message : String(err)}`);
|
|
89338
89442
|
return null;
|
|
89339
89443
|
}
|
|
89340
89444
|
}
|
|
@@ -89371,7 +89475,7 @@ async function detectAndLoadPromptImages(params) {
|
|
|
89371
89475
|
loadedCount: 0,
|
|
89372
89476
|
skippedCount: 0
|
|
89373
89477
|
};
|
|
89374
|
-
log$
|
|
89478
|
+
log$27.debug(`Native image: detected ${allRefs.length} image refs in prompt`);
|
|
89375
89479
|
const promptImages = [...params.existingImages ?? []];
|
|
89376
89480
|
let loadedCount = 0;
|
|
89377
89481
|
let skippedCount = 0;
|
|
@@ -89384,7 +89488,7 @@ async function detectAndLoadPromptImages(params) {
|
|
|
89384
89488
|
if (image) {
|
|
89385
89489
|
promptImages.push(image);
|
|
89386
89490
|
loadedCount++;
|
|
89387
|
-
log$
|
|
89491
|
+
log$27.debug(`Native image: loaded ${ref.type} ${ref.resolved}`);
|
|
89388
89492
|
} else skippedCount++;
|
|
89389
89493
|
}
|
|
89390
89494
|
return {
|
|
@@ -89999,7 +90103,7 @@ async function buildStreamFn(params) {
|
|
|
89999
90103
|
const wsApiKey = await params.authStorage.getApiKey(params.provider);
|
|
90000
90104
|
if (wsApiKey) streamFn = createOpenAIWebSocketStreamFn(wsApiKey, params.sessionId, { signal: params.abortSignal });
|
|
90001
90105
|
else {
|
|
90002
|
-
log$
|
|
90106
|
+
log$27.warn(`[ws-stream] no API key for provider=${params.provider}; using HTTP transport`);
|
|
90003
90107
|
streamFn = streamSimple;
|
|
90004
90108
|
}
|
|
90005
90109
|
} else {
|
|
@@ -90102,13 +90206,13 @@ async function resolvePromptBuildHookResult(params) {
|
|
|
90102
90206
|
messages: params.messages,
|
|
90103
90207
|
systemPrompt: params.systemPrompt
|
|
90104
90208
|
}, params.hookCtx).catch((hookErr) => {
|
|
90105
|
-
log$
|
|
90209
|
+
log$27.warn(`before_prompt_build hook failed: ${String(hookErr)}`);
|
|
90106
90210
|
}) : void 0;
|
|
90107
90211
|
const legacyResult = params.legacyBeforeAgentStartResult ?? (params.hookRunner?.hasHooks("before_agent_start") ? await params.hookRunner.runBeforeAgentStart({
|
|
90108
90212
|
prompt: params.prompt,
|
|
90109
90213
|
messages: params.messages
|
|
90110
90214
|
}, params.hookCtx).catch((hookErr) => {
|
|
90111
|
-
log$
|
|
90215
|
+
log$27.warn(`before_agent_start hook (legacy prompt build path) failed: ${String(hookErr)}`);
|
|
90112
90216
|
}) : void 0);
|
|
90113
90217
|
return {
|
|
90114
90218
|
systemPrompt: promptBuildResult?.systemPrompt ?? legacyResult?.systemPrompt,
|
|
@@ -90246,7 +90350,7 @@ async function collectAttemptPromptContribution(params) {
|
|
|
90246
90350
|
messages: params.messages,
|
|
90247
90351
|
envelope: params.envelope
|
|
90248
90352
|
}, params.lifecycleCtx).catch((hookErr) => {
|
|
90249
|
-
log$
|
|
90353
|
+
log$27.warn(`context.collect hook failed: ${String(hookErr)}`);
|
|
90250
90354
|
}) : void 0;
|
|
90251
90355
|
return mergePromptContributions([promptBuildResultToContribution(legacyResult), contextCollectResult]);
|
|
90252
90356
|
}
|
|
@@ -90261,7 +90365,7 @@ async function runContextProjectionAndPruningHooks(params) {
|
|
|
90261
90365
|
contributions: params.contributions,
|
|
90262
90366
|
envelope: params.envelope
|
|
90263
90367
|
}, params.lifecycleCtx).catch((hookErr) => {
|
|
90264
|
-
log$
|
|
90368
|
+
log$27.warn(`context.project hook failed: ${String(hookErr)}`);
|
|
90265
90369
|
});
|
|
90266
90370
|
if (result?.messages) currentMessages = result.messages;
|
|
90267
90371
|
if (result?.projection) projection = {
|
|
@@ -90277,7 +90381,7 @@ async function runContextProjectionAndPruningHooks(params) {
|
|
|
90277
90381
|
tokenWindow: params.lifecycleCtx.tokenWindow,
|
|
90278
90382
|
usage: params.lifecycleCtx.usage
|
|
90279
90383
|
}, params.lifecycleCtx).catch((hookErr) => {
|
|
90280
|
-
log$
|
|
90384
|
+
log$27.warn(`context.prune hook failed: ${String(hookErr)}`);
|
|
90281
90385
|
});
|
|
90282
90386
|
if (result?.messages) currentMessages = result.messages;
|
|
90283
90387
|
if (result?.dropped) dropped.push(...result.dropped);
|
|
@@ -90379,7 +90483,7 @@ function installAttemptInputTransform(params) {
|
|
|
90379
90483
|
runtime: params.projectionRuntime,
|
|
90380
90484
|
timeoutMs: params.projectionArtifactTimeoutMs
|
|
90381
90485
|
}).catch((err) => {
|
|
90382
|
-
log$
|
|
90486
|
+
log$27.warn(`context projection artifact persist failed: ${String(err)}`);
|
|
90383
90487
|
});
|
|
90384
90488
|
const finalMessages = await runTransformLlmInputHooks({
|
|
90385
90489
|
messages: currentMessages,
|
|
@@ -90388,7 +90492,7 @@ function installAttemptInputTransform(params) {
|
|
|
90388
90492
|
provider: params.provider,
|
|
90389
90493
|
modelId: params.modelId
|
|
90390
90494
|
}).catch((err) => {
|
|
90391
|
-
log$
|
|
90495
|
+
log$27.warn(`transform_llm_input hook failed: ${String(err)}`);
|
|
90392
90496
|
}) ?? currentMessages;
|
|
90393
90497
|
params.onFinalInputMessages?.(finalMessages);
|
|
90394
90498
|
return finalMessages;
|
|
@@ -90506,11 +90610,10 @@ function summarizeSessionContext(messages) {
|
|
|
90506
90610
|
}
|
|
90507
90611
|
async function runEmbeddedAttempt(params) {
|
|
90508
90612
|
const resolvedWorkspace = resolveUserPath(params.workspaceDir);
|
|
90509
|
-
const prevCwd = process.cwd();
|
|
90510
90613
|
let pendingClearActiveEmbeddedRun;
|
|
90511
90614
|
const runAbortController = new AbortController();
|
|
90512
90615
|
const currentUserTurnForStorage = resolveCurrentUserTurnForStorage(params);
|
|
90513
|
-
log$
|
|
90616
|
+
log$27.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"}`);
|
|
90514
90617
|
await fs$1.mkdir(resolvedWorkspace, { recursive: true });
|
|
90515
90618
|
const sandboxSessionKey = params.sessionKey?.trim() || params.sessionId;
|
|
90516
90619
|
const toolSessionKey = params.toolSessionKey?.trim() || sandboxSessionKey;
|
|
@@ -90523,7 +90626,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
90523
90626
|
const effectiveWorkspace = sandbox?.enabled ? sandbox.workspaceAccess === "rw" ? resolvedWorkspace : sandbox.workspaceDir : resolvedWorkspace;
|
|
90524
90627
|
await fs$1.mkdir(effectiveWorkspace, { recursive: true });
|
|
90525
90628
|
let restoreSkillEnv;
|
|
90526
|
-
|
|
90629
|
+
const releaseWorkspaceCwd = params.skipCwdChange ? void 0 : acquireWorkspaceCwd(effectiveWorkspace);
|
|
90527
90630
|
try {
|
|
90528
90631
|
const skillWorkspace = params.skillWorkspaceDir ?? effectiveWorkspace;
|
|
90529
90632
|
const shouldLoadSkillEntries = !params.skipSkillEnv && (!params.skillsSnapshot || !params.skillsSnapshot.resolvedSkills);
|
|
@@ -90565,7 +90668,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
90565
90668
|
resolvedSystemPrompt,
|
|
90566
90669
|
warn: makeBootstrapWarn({
|
|
90567
90670
|
sessionLabel,
|
|
90568
|
-
warn: (message) => log$
|
|
90671
|
+
warn: (message) => log$27.warn(message)
|
|
90569
90672
|
}),
|
|
90570
90673
|
contextMode: params.bootstrapContextMode,
|
|
90571
90674
|
runKind: params.bootstrapContextRunKind,
|
|
@@ -90807,7 +90910,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
90807
90910
|
if (queue != null) {
|
|
90808
90911
|
await drainPendingPrimaryWrites(queue, 3e4, storage?.config.fallbackToJsonlOnError ?? false);
|
|
90809
90912
|
if (storage?.runtime?.conversation?.upsertTurn) await storage.runtime.conversation.upsertTurn(params.sessionId).catch((err) => {
|
|
90810
|
-
log$
|
|
90913
|
+
log$27.warn("turn upsert failed (non-fatal)", {
|
|
90811
90914
|
sessionId: params.sessionId,
|
|
90812
90915
|
err
|
|
90813
90916
|
});
|
|
@@ -90875,14 +90978,14 @@ async function runEmbeddedAttempt(params) {
|
|
|
90875
90978
|
sessionManager = _wrapped.sm;
|
|
90876
90979
|
_primaryWriteQueue = _wrapped.queue;
|
|
90877
90980
|
}
|
|
90878
|
-
} else log$
|
|
90981
|
+
} else log$27.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", {
|
|
90879
90982
|
sessionId: params.sessionId,
|
|
90880
90983
|
backend: _configuredStorage?.runtime?.backend
|
|
90881
90984
|
});
|
|
90882
90985
|
} else {
|
|
90883
90986
|
await repairSessionFileIfNeeded({
|
|
90884
90987
|
sessionFile: params.sessionFile,
|
|
90885
|
-
warn: (message) => log$
|
|
90988
|
+
warn: (message) => log$27.warn(message)
|
|
90886
90989
|
});
|
|
90887
90990
|
const hadSessionFile = await fs$1.stat(params.sessionFile).then(() => true).catch(() => false);
|
|
90888
90991
|
if (!params.skipSessionManagerCache) await prewarmSessionFile(params.sessionFile);
|
|
@@ -91023,7 +91126,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
91023
91126
|
const wsApiKey = await params.authStorage.getApiKey(params.provider);
|
|
91024
91127
|
if (wsApiKey) activeSession.agent.streamFn = createOpenAIWebSocketStreamFn(wsApiKey, params.sessionId, { signal: runAbortController.signal });
|
|
91025
91128
|
else {
|
|
91026
|
-
log$
|
|
91129
|
+
log$27.warn(`[ws-stream] no API key for provider=${params.provider}; using HTTP transport`);
|
|
91027
91130
|
activeSession.agent.streamFn = streamSimple;
|
|
91028
91131
|
}
|
|
91029
91132
|
} else {
|
|
@@ -91223,7 +91326,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
91223
91326
|
let abortWarnTimer;
|
|
91224
91327
|
const isProbeSession = params.sessionId?.startsWith("probe-") ?? false;
|
|
91225
91328
|
const abortTimer = setTimeout(() => {
|
|
91226
|
-
if (!isProbeSession) log$
|
|
91329
|
+
if (!isProbeSession) log$27.warn(`embedded run timeout: runId=${params.runId} sessionId=${params.sessionId} timeoutMs=${params.timeoutMs}`);
|
|
91227
91330
|
if (shouldFlagCompactionTimeout({
|
|
91228
91331
|
isTimeout: true,
|
|
91229
91332
|
isCompactionPendingOrRetrying: subscription.isCompacting(),
|
|
@@ -91232,7 +91335,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
91232
91335
|
abortRun(true);
|
|
91233
91336
|
if (!abortWarnTimer) abortWarnTimer = setTimeout(() => {
|
|
91234
91337
|
if (!activeSession.isStreaming) return;
|
|
91235
|
-
if (!isProbeSession) log$
|
|
91338
|
+
if (!isProbeSession) log$27.warn(`embedded run abort still streaming: runId=${params.runId} sessionId=${params.sessionId}`);
|
|
91236
91339
|
}, 1e4);
|
|
91237
91340
|
}, Math.max(1, params.timeoutMs));
|
|
91238
91341
|
let messagesSnapshot = [];
|
|
@@ -91266,7 +91369,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
91266
91369
|
let timeoutHandle;
|
|
91267
91370
|
const timeout = new Promise((resolve) => {
|
|
91268
91371
|
timeoutHandle = setTimeout(() => {
|
|
91269
|
-
log$
|
|
91372
|
+
log$27.warn(`${label} timed out after ${metaTimeoutMs}ms`);
|
|
91270
91373
|
resolve(void 0);
|
|
91271
91374
|
}, metaTimeoutMs);
|
|
91272
91375
|
timeoutHandle.unref?.();
|
|
@@ -91274,7 +91377,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
91274
91377
|
try {
|
|
91275
91378
|
return await Promise.race([p, timeout]);
|
|
91276
91379
|
} catch (err) {
|
|
91277
|
-
log$
|
|
91380
|
+
log$27.warn(`${label} failed: ${String(err)}`);
|
|
91278
91381
|
return;
|
|
91279
91382
|
} finally {
|
|
91280
91383
|
if (timeoutHandle !== void 0) clearTimeout(timeoutHandle);
|
|
@@ -91299,14 +91402,14 @@ async function runEmbeddedAttempt(params) {
|
|
|
91299
91402
|
senderIdentity,
|
|
91300
91403
|
workspaceLane: params.workspaceLane
|
|
91301
91404
|
});
|
|
91302
|
-
log$
|
|
91405
|
+
log$27.debug(`embedded run prompt start: runId=${params.runId} sessionId=${params.sessionId}`);
|
|
91303
91406
|
const leafEntry = sessionManager.getLeafEntry();
|
|
91304
91407
|
if (leafEntry?.type === "message" && leafEntry.message.role === "user") {
|
|
91305
91408
|
if (leafEntry.parentId) sessionManager.branch(leafEntry.parentId);
|
|
91306
91409
|
else sessionManager.resetLeaf();
|
|
91307
91410
|
const sessionContext = sessionManager.buildSessionContext();
|
|
91308
91411
|
activeSession.agent.state.messages = sessionContext.messages;
|
|
91309
|
-
log$
|
|
91412
|
+
log$27.warn(`Removed orphaned user message to prevent consecutive user turns. runId=${params.runId} sessionId=${params.sessionId}`);
|
|
91310
91413
|
}
|
|
91311
91414
|
const cleanUserMessage = createCleanUserMessageFromPrompt(params.prompt);
|
|
91312
91415
|
const baseEnvelope = createCurrentUserPromptEnvelope({ cleanUserMessage });
|
|
@@ -91335,7 +91438,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
91335
91438
|
const contributedSystemPrompt = applySystemPromptContribution(systemPromptText, promptContribution);
|
|
91336
91439
|
if (contributedSystemPrompt !== systemPromptText) {
|
|
91337
91440
|
applySystemPromptOverrideToSession(activeSession, contributedSystemPrompt);
|
|
91338
|
-
log$
|
|
91441
|
+
log$27.debug(`hooks: augmented system prompt (+${contributedSystemPrompt.length - systemPromptText.length} chars)`);
|
|
91339
91442
|
systemPromptText = contributedSystemPrompt;
|
|
91340
91443
|
}
|
|
91341
91444
|
cacheTrace?.recordStage("prompt:before", {
|
|
@@ -91367,12 +91470,12 @@ async function runEmbeddedAttempt(params) {
|
|
|
91367
91470
|
messages: activeSession.messages,
|
|
91368
91471
|
note: `images: prompt=${imageResult.images.length}`
|
|
91369
91472
|
});
|
|
91370
|
-
if (log$
|
|
91473
|
+
if (log$27.isEnabled("debug")) {
|
|
91371
91474
|
const msgCount = activeSession.messages.length;
|
|
91372
91475
|
const systemLen = systemPromptText?.length ?? 0;
|
|
91373
91476
|
const promptLen = effectivePrompt.length;
|
|
91374
91477
|
const sessionSummary = summarizeSessionContext(activeSession.messages);
|
|
91375
|
-
log$
|
|
91478
|
+
log$27.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}`);
|
|
91376
91479
|
}
|
|
91377
91480
|
if (hookRunner?.hasHooks("llm_input")) hookRunner.runLlmInput({
|
|
91378
91481
|
runId: params.runId,
|
|
@@ -91384,7 +91487,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
91384
91487
|
historyMessages: activeSession.messages,
|
|
91385
91488
|
imagesCount: imageResult.images.length
|
|
91386
91489
|
}, hookCtx).catch((err) => {
|
|
91387
|
-
log$
|
|
91490
|
+
log$27.warn(`llm_input hook failed: ${String(err)}`);
|
|
91388
91491
|
});
|
|
91389
91492
|
const modelUserMessage = appendPromptImagesToUserMessage(renderedCurrentUserPrompt.modelUserMessage, imageResult.images);
|
|
91390
91493
|
const currentPromptIndex = activeSession.messages.length;
|
|
@@ -91427,7 +91530,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
91427
91530
|
errorType: String(err instanceof Error ? err.name : "UnknownError")
|
|
91428
91531
|
});
|
|
91429
91532
|
} finally {
|
|
91430
|
-
log$
|
|
91533
|
+
log$27.debug(`embedded run prompt end: runId=${params.runId} sessionId=${params.sessionId} durationMs=${Date.now() - promptStartedAt}`);
|
|
91431
91534
|
}
|
|
91432
91535
|
const wasCompactingBefore = activeSession.isCompacting;
|
|
91433
91536
|
const snapshot = activeSession.messages.slice();
|
|
@@ -91442,7 +91545,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
91442
91545
|
promptError = err;
|
|
91443
91546
|
promptErrorSource = "compaction";
|
|
91444
91547
|
}
|
|
91445
|
-
if (!isProbeSession) log$
|
|
91548
|
+
if (!isProbeSession) log$27.debug(`compaction wait aborted: runId=${params.runId} sessionId=${params.sessionId}`);
|
|
91446
91549
|
} else throw err;
|
|
91447
91550
|
}
|
|
91448
91551
|
const compactionOccurredThisAttempt = getCompactionCount() > 0;
|
|
@@ -91461,7 +91564,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
91461
91564
|
currentSessionId: activeSession.sessionId
|
|
91462
91565
|
});
|
|
91463
91566
|
if (timedOutDuringCompaction) {
|
|
91464
|
-
if (!isProbeSession) log$
|
|
91567
|
+
if (!isProbeSession) log$27.warn(`using ${snapshotSelection.source} snapshot: timed out during compaction runId=${params.runId} sessionId=${params.sessionId}`);
|
|
91465
91568
|
}
|
|
91466
91569
|
messagesSnapshot = snapshotSelection.messagesSnapshot;
|
|
91467
91570
|
sessionIdUsed = snapshotSelection.sessionIdUsed;
|
|
@@ -91476,7 +91579,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
91476
91579
|
error: describeUnknownError(promptError)
|
|
91477
91580
|
});
|
|
91478
91581
|
} catch (entryErr) {
|
|
91479
|
-
log$
|
|
91582
|
+
log$27.warn(`failed to persist prompt error entry: ${String(entryErr)}`);
|
|
91480
91583
|
}
|
|
91481
91584
|
if (!params.skipTranscriptSync) await drainOrSyncTranscript(_primaryWriteQueue, _isDbBackend, _configuredStorage, {
|
|
91482
91585
|
agentId: hookAgentIdForTranscript,
|
|
@@ -91496,16 +91599,16 @@ async function runEmbeddedAttempt(params) {
|
|
|
91496
91599
|
error: promptError ? describeUnknownError(promptError) : void 0,
|
|
91497
91600
|
durationMs: Date.now() - promptStartedAt
|
|
91498
91601
|
}, hookCtx).catch((err) => {
|
|
91499
|
-
log$
|
|
91602
|
+
log$27.warn(`agent_end hook failed: ${err}`);
|
|
91500
91603
|
});
|
|
91501
91604
|
} finally {
|
|
91502
91605
|
clearTimeout(abortTimer);
|
|
91503
91606
|
if (abortWarnTimer) clearTimeout(abortWarnTimer);
|
|
91504
|
-
if (!isProbeSession && (aborted || timedOut) && !timedOutDuringCompaction) log$
|
|
91607
|
+
if (!isProbeSession && (aborted || timedOut) && !timedOutDuringCompaction) log$27.debug(`run cleanup: runId=${params.runId} sessionId=${params.sessionId} aborted=${aborted} timedOut=${timedOut}`);
|
|
91505
91608
|
try {
|
|
91506
91609
|
unsubscribe();
|
|
91507
91610
|
} catch (err) {
|
|
91508
|
-
log$
|
|
91611
|
+
log$27.error(`CRITICAL: unsubscribe failed, possible resource leak: runId=${params.runId} ${String(err)}`);
|
|
91509
91612
|
}
|
|
91510
91613
|
pendingClearActiveEmbeddedRun = () => clearActiveEmbeddedRun(params.sessionId, queueHandle, params.sessionKey, !aborted && !timedOut && !promptError);
|
|
91511
91614
|
params.abortSignal?.removeEventListener?.("abort", onAbort);
|
|
@@ -91543,7 +91646,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
91543
91646
|
workspaceLane: params.workspaceLane,
|
|
91544
91647
|
runId: params.runId
|
|
91545
91648
|
})).catch((err) => {
|
|
91546
|
-
log$
|
|
91649
|
+
log$27.warn(`model_call_ended hook failed: ${String(err)}`);
|
|
91547
91650
|
});
|
|
91548
91651
|
proxyMetadataFromHook = modelCallEndedEvent.proxyMetadata;
|
|
91549
91652
|
}
|
|
@@ -91567,7 +91670,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
91567
91670
|
workspaceLane: params.workspaceLane,
|
|
91568
91671
|
runId: params.runId
|
|
91569
91672
|
})).catch((err) => {
|
|
91570
|
-
log$
|
|
91673
|
+
log$27.warn(`llm_output hook failed: ${String(err)}`);
|
|
91571
91674
|
});
|
|
91572
91675
|
return {
|
|
91573
91676
|
aborted,
|
|
@@ -91610,7 +91713,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
91610
91713
|
if (_primaryWriteQueue != null && _primaryWriteQueue.length > 0) try {
|
|
91611
91714
|
await drainPendingPrimaryWrites(_primaryWriteQueue, 5e3, _configuredStorage?.config.fallbackToJsonlOnError ?? false);
|
|
91612
91715
|
} catch (cleanupDrainErr) {
|
|
91613
|
-
log$
|
|
91716
|
+
log$27.error("cleanup drain failed in finally; session entries may be lost", {
|
|
91614
91717
|
sessionId: params.sessionId,
|
|
91615
91718
|
error: cleanupDrainErr
|
|
91616
91719
|
});
|
|
@@ -91622,7 +91725,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
91622
91725
|
}
|
|
91623
91726
|
} finally {
|
|
91624
91727
|
restoreSkillEnv?.();
|
|
91625
|
-
|
|
91728
|
+
releaseWorkspaceCwd?.();
|
|
91626
91729
|
pendingClearActiveEmbeddedRun?.();
|
|
91627
91730
|
}
|
|
91628
91731
|
}
|
|
@@ -91898,8 +92001,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
91898
92001
|
const redactedSessionId = redactRunIdentifier(params.sessionId);
|
|
91899
92002
|
const redactedSessionKey = redactRunIdentifier(params.sessionKey);
|
|
91900
92003
|
const redactedWorkspace = redactRunIdentifier(resolvedWorkspace);
|
|
91901
|
-
if (workspaceResolution.usedFallback) log$
|
|
91902
|
-
const prevCwd = process.cwd();
|
|
92004
|
+
if (workspaceResolution.usedFallback) log$27.warn(`[workspace-fallback] caller=runEmbeddedPiAgent reason=${workspaceResolution.fallbackReason} run=${params.runId} session=${redactedSessionId} sessionKey=${redactedSessionKey} agent=${workspaceResolution.agentId} workspace=${redactedWorkspace}`);
|
|
91903
92005
|
let provider = (params.provider ?? DEFAULT_PROVIDER).trim() || DEFAULT_PROVIDER;
|
|
91904
92006
|
let modelId = (params.model ?? DEFAULT_MODEL).trim() || DEFAULT_MODEL;
|
|
91905
92007
|
const agentDir = params.agentDir ?? resolveOpenClawAgentDir();
|
|
@@ -91939,7 +92041,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
91939
92041
|
if (hookRunner?.hasHooks("before_model_resolve")) try {
|
|
91940
92042
|
modelResolveOverride = await hookRunner.runBeforeModelResolve({ prompt: params.prompt }, hookCtx);
|
|
91941
92043
|
} catch (hookErr) {
|
|
91942
|
-
log$
|
|
92044
|
+
log$27.warn(`before_model_resolve hook failed: ${String(hookErr)}`);
|
|
91943
92045
|
}
|
|
91944
92046
|
if (hookRunner?.hasHooks("before_agent_start")) try {
|
|
91945
92047
|
legacyBeforeAgentStartResult = await hookRunner.runBeforeAgentStart({ prompt: params.prompt }, hookCtx);
|
|
@@ -91948,15 +92050,15 @@ async function runEmbeddedPiAgent(params) {
|
|
|
91948
92050
|
modelOverride: modelResolveOverride?.modelOverride ?? legacyBeforeAgentStartResult?.modelOverride
|
|
91949
92051
|
};
|
|
91950
92052
|
} catch (hookErr) {
|
|
91951
|
-
log$
|
|
92053
|
+
log$27.warn(`before_agent_start hook (legacy model resolve path) failed: ${String(hookErr)}`);
|
|
91952
92054
|
}
|
|
91953
92055
|
if (modelResolveOverride?.providerOverride) {
|
|
91954
92056
|
provider = modelResolveOverride.providerOverride;
|
|
91955
|
-
log$
|
|
92057
|
+
log$27.info(`[hooks] provider overridden to ${provider}`);
|
|
91956
92058
|
}
|
|
91957
92059
|
if (modelResolveOverride?.modelOverride) {
|
|
91958
92060
|
modelId = modelResolveOverride.modelOverride;
|
|
91959
|
-
log$
|
|
92061
|
+
log$27.info(`[hooks] model overridden to ${modelId}`);
|
|
91960
92062
|
}
|
|
91961
92063
|
const { model, error, authStorage, modelRegistry } = resolveModel(provider, modelId, agentDir, params.config);
|
|
91962
92064
|
if (!model) throw new FailoverError(error ?? `Unknown model: ${provider}/${modelId}`, {
|
|
@@ -91976,9 +92078,9 @@ async function runEmbeddedPiAgent(params) {
|
|
|
91976
92078
|
warnBelowTokens: CONTEXT_WINDOW_WARN_BELOW_TOKENS,
|
|
91977
92079
|
hardMinTokens: CONTEXT_WINDOW_HARD_MIN_TOKENS
|
|
91978
92080
|
});
|
|
91979
|
-
if (ctxGuard.shouldWarn) log$
|
|
92081
|
+
if (ctxGuard.shouldWarn) log$27.warn(`low context window: ${provider}/${modelId} ctx=${ctxGuard.tokens} (warn<${CONTEXT_WINDOW_WARN_BELOW_TOKENS}) source=${ctxGuard.source}`);
|
|
91980
92082
|
if (ctxGuard.shouldBlock) {
|
|
91981
|
-
log$
|
|
92083
|
+
log$27.error(`blocked model (context window too small): ${provider}/${modelId} ctx=${ctxGuard.tokens} (min=${CONTEXT_WINDOW_HARD_MIN_TOKENS}) source=${ctxGuard.source}`);
|
|
91982
92084
|
throw new FailoverError(`Model context window too small (${ctxGuard.tokens} tokens). Minimum is ${CONTEXT_WINDOW_HARD_MIN_TOKENS}.`, {
|
|
91983
92085
|
reason: "unknown",
|
|
91984
92086
|
provider,
|
|
@@ -92032,14 +92134,14 @@ async function runEmbeddedPiAgent(params) {
|
|
|
92032
92134
|
copilotTokenState.refreshInFlight = (async () => {
|
|
92033
92135
|
const githubToken = copilotTokenState.githubToken.trim();
|
|
92034
92136
|
if (!githubToken) throw new Error("Copilot refresh requires a GitHub token.");
|
|
92035
|
-
log$
|
|
92137
|
+
log$27.debug(`Refreshing GitHub Copilot token (${reason})...`);
|
|
92036
92138
|
const copilotToken = await resolveCopilotApiToken({ githubToken });
|
|
92037
92139
|
authStorage.setRuntimeApiKey(model.provider, copilotToken.token);
|
|
92038
92140
|
copilotTokenState.expiresAt = copilotToken.expiresAt;
|
|
92039
92141
|
const remaining = copilotToken.expiresAt - Date.now();
|
|
92040
|
-
log$
|
|
92142
|
+
log$27.debug(`Copilot token refreshed; expires in ${Math.max(0, Math.floor(remaining / 1e3))}s.`);
|
|
92041
92143
|
})().catch((err) => {
|
|
92042
|
-
log$
|
|
92144
|
+
log$27.warn(`Copilot token refresh failed: ${describeUnknownError(err)}`);
|
|
92043
92145
|
throw err;
|
|
92044
92146
|
}).finally(() => {
|
|
92045
92147
|
copilotTokenState.refreshInFlight = void 0;
|
|
@@ -92049,7 +92151,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
92049
92151
|
const scheduleCopilotRefresh = () => {
|
|
92050
92152
|
if (!copilotTokenState || copilotRefreshCancelled) return;
|
|
92051
92153
|
if (!hasCopilotGithubToken()) {
|
|
92052
|
-
log$
|
|
92154
|
+
log$27.warn("Skipping Copilot refresh scheduling; GitHub token missing.");
|
|
92053
92155
|
return;
|
|
92054
92156
|
}
|
|
92055
92157
|
clearCopilotRefreshTimer();
|
|
@@ -92211,7 +92313,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
92211
92313
|
while (true) {
|
|
92212
92314
|
if (runLoopIterations >= MAX_RUN_LOOP_ITERATIONS) {
|
|
92213
92315
|
const message = `Exceeded retry limit after ${runLoopIterations} attempts (max=${MAX_RUN_LOOP_ITERATIONS}).`;
|
|
92214
|
-
log$
|
|
92316
|
+
log$27.error(`[run-retry-limit] sessionKey=${params.sessionKey ?? params.sessionId} provider=${provider}/${modelId} attempts=${runLoopIterations} maxAttempts=${MAX_RUN_LOOP_ITERATIONS}`);
|
|
92215
92317
|
logRunCompleted({
|
|
92216
92318
|
runId: params.runId,
|
|
92217
92319
|
sessionKey: params.sessionKey,
|
|
@@ -92375,21 +92477,21 @@ async function runEmbeddedPiAgent(params) {
|
|
|
92375
92477
|
const errorText = contextOverflowError.text;
|
|
92376
92478
|
const overflowStorage = getConfiguredSessionStorageRuntime();
|
|
92377
92479
|
const msgCount = attempt.messagesSnapshot?.length ?? 0;
|
|
92378
|
-
log$
|
|
92480
|
+
log$27.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)}`);
|
|
92379
92481
|
const isCompactionFailure = isCompactionFailureError(errorText);
|
|
92380
92482
|
const hadAttemptLevelCompaction = attemptCompactionCount > 0;
|
|
92381
92483
|
const explicitOverflowCompactionAllowed = params.trigger !== "analysis" && !params.disablePluginHooks && !params.skipTranscriptSync;
|
|
92382
92484
|
if (explicitOverflowCompactionAllowed && !isCompactionFailure && hadAttemptLevelCompaction && overflowCompactionAttempts < MAX_OVERFLOW_COMPACTION_ATTEMPTS) {
|
|
92383
92485
|
overflowCompactionAttempts++;
|
|
92384
|
-
log$
|
|
92486
|
+
log$27.warn(`context overflow persisted after in-attempt compaction (attempt ${overflowCompactionAttempts}/${MAX_OVERFLOW_COMPACTION_ATTEMPTS}); retrying prompt without additional compaction for ${provider}/${modelId}`);
|
|
92385
92487
|
continue;
|
|
92386
92488
|
}
|
|
92387
92489
|
if (explicitOverflowCompactionAllowed && !isCompactionFailure && !hadAttemptLevelCompaction && overflowCompactionAttempts < MAX_OVERFLOW_COMPACTION_ATTEMPTS) {
|
|
92388
|
-
if (log$
|
|
92490
|
+
if (log$27.isEnabled("debug")) log$27.debug(`[compaction-diag] decision diagId=${overflowDiagId} branch=compact isCompactionFailure=${isCompactionFailure} hasOversizedToolResults=unknown attempt=${overflowCompactionAttempts + 1} maxAttempts=${MAX_OVERFLOW_COMPACTION_ATTEMPTS}`);
|
|
92389
92491
|
overflowCompactionAttempts++;
|
|
92390
|
-
log$
|
|
92492
|
+
log$27.warn(`context overflow detected (attempt ${overflowCompactionAttempts}/${MAX_OVERFLOW_COMPACTION_ATTEMPTS}); attempting auto-compaction for ${provider}/${modelId}`);
|
|
92391
92493
|
const _overflowIsDb = (overflowStorage?.runtime?.backend ?? "fs-jsonl") !== "fs-jsonl";
|
|
92392
|
-
if (_overflowIsDb) log$
|
|
92494
|
+
if (_overflowIsDb) log$27.warn(`context overflow compaction skipped for DB backend session ${params.sessionId}; compact.ts does not yet support DB-backend sessions`);
|
|
92393
92495
|
const compactResult = _overflowIsDb ? {
|
|
92394
92496
|
compacted: false,
|
|
92395
92497
|
reason: "db-backend-not-supported"
|
|
@@ -92422,10 +92524,10 @@ async function runEmbeddedPiAgent(params) {
|
|
|
92422
92524
|
});
|
|
92423
92525
|
if (compactResult.compacted) {
|
|
92424
92526
|
autoCompactionCount += 1;
|
|
92425
|
-
log$
|
|
92527
|
+
log$27.info(`auto-compaction succeeded for ${provider}/${modelId}; retrying prompt`);
|
|
92426
92528
|
continue;
|
|
92427
92529
|
}
|
|
92428
|
-
log$
|
|
92530
|
+
log$27.warn(`auto-compaction failed for ${provider}/${modelId}: ${compactResult.reason ?? "nothing to compact"}`);
|
|
92429
92531
|
}
|
|
92430
92532
|
if (!toolResultTruncationAttempted) {
|
|
92431
92533
|
const contextWindowTokens = ctxInfo.tokens;
|
|
@@ -92434,11 +92536,11 @@ async function runEmbeddedPiAgent(params) {
|
|
|
92434
92536
|
contextWindowTokens
|
|
92435
92537
|
}) : false;
|
|
92436
92538
|
if (hasOversized) {
|
|
92437
|
-
if (log$
|
|
92539
|
+
if (log$27.isEnabled("debug")) log$27.debug(`[compaction-diag] decision diagId=${overflowDiagId} branch=truncate_tool_results isCompactionFailure=${isCompactionFailure} hasOversizedToolResults=${hasOversized} attempt=${overflowCompactionAttempts} maxAttempts=${MAX_OVERFLOW_COMPACTION_ATTEMPTS}`);
|
|
92438
92540
|
toolResultTruncationAttempted = true;
|
|
92439
|
-
if ((overflowStorage?.runtime?.backend ?? "fs-jsonl") !== "fs-jsonl") log$
|
|
92541
|
+
if ((overflowStorage?.runtime?.backend ?? "fs-jsonl") !== "fs-jsonl") log$27.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`);
|
|
92440
92542
|
else {
|
|
92441
|
-
log$
|
|
92543
|
+
log$27.warn(`[context-overflow-recovery] Attempting tool result truncation for ${provider}/${modelId} (contextWindow=${contextWindowTokens} tokens)`);
|
|
92442
92544
|
const truncResult = await truncateOversizedToolResultsInSession({
|
|
92443
92545
|
sessionFile: params.sessionFile,
|
|
92444
92546
|
contextWindowTokens,
|
|
@@ -92446,14 +92548,14 @@ async function runEmbeddedPiAgent(params) {
|
|
|
92446
92548
|
sessionKey: params.sessionKey
|
|
92447
92549
|
});
|
|
92448
92550
|
if (truncResult.truncated) {
|
|
92449
|
-
log$
|
|
92551
|
+
log$27.info(`[context-overflow-recovery] Truncated ${truncResult.truncatedCount} tool result(s); retrying prompt`);
|
|
92450
92552
|
continue;
|
|
92451
92553
|
}
|
|
92452
|
-
log$
|
|
92554
|
+
log$27.warn(`[context-overflow-recovery] Tool result truncation did not help: ${truncResult.reason ?? "unknown"}`);
|
|
92453
92555
|
}
|
|
92454
|
-
} else if (log$
|
|
92556
|
+
} else if (log$27.isEnabled("debug")) log$27.debug(`[compaction-diag] decision diagId=${overflowDiagId} branch=give_up isCompactionFailure=${isCompactionFailure} hasOversizedToolResults=${hasOversized} attempt=${overflowCompactionAttempts} maxAttempts=${MAX_OVERFLOW_COMPACTION_ATTEMPTS}`);
|
|
92455
92557
|
}
|
|
92456
|
-
if ((isCompactionFailure || overflowCompactionAttempts >= MAX_OVERFLOW_COMPACTION_ATTEMPTS || toolResultTruncationAttempted) && log$
|
|
92558
|
+
if ((isCompactionFailure || overflowCompactionAttempts >= MAX_OVERFLOW_COMPACTION_ATTEMPTS || toolResultTruncationAttempted) && log$27.isEnabled("debug")) log$27.debug(`[compaction-diag] decision diagId=${overflowDiagId} branch=give_up isCompactionFailure=${isCompactionFailure} hasOversizedToolResults=unknown attempt=${overflowCompactionAttempts} maxAttempts=${MAX_OVERFLOW_COMPACTION_ATTEMPTS}`);
|
|
92457
92559
|
const kind = isCompactionFailure ? "compaction_failure" : "context_overflow";
|
|
92458
92560
|
logRunCompleted({
|
|
92459
92561
|
runId: params.runId,
|
|
@@ -92559,7 +92661,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
92559
92661
|
attempted: attemptedThinking
|
|
92560
92662
|
});
|
|
92561
92663
|
if (fallbackThinking) {
|
|
92562
|
-
log$
|
|
92664
|
+
log$27.warn(`unsupported thinking level for ${provider}/${modelId}; retrying with ${fallbackThinking}`);
|
|
92563
92665
|
thinkLevel = fallbackThinking;
|
|
92564
92666
|
continue;
|
|
92565
92667
|
}
|
|
@@ -92577,7 +92679,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
92577
92679
|
attempted: attemptedThinking
|
|
92578
92680
|
});
|
|
92579
92681
|
if (fallbackThinking && !aborted) {
|
|
92580
|
-
log$
|
|
92682
|
+
log$27.warn(`unsupported thinking level for ${provider}/${modelId}; retrying with ${fallbackThinking}`);
|
|
92581
92683
|
thinkLevel = fallbackThinking;
|
|
92582
92684
|
continue;
|
|
92583
92685
|
}
|
|
@@ -92598,7 +92700,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
92598
92700
|
imageDimensionError.contentIndex !== void 0 ? `content=${imageDimensionError.contentIndex}` : null,
|
|
92599
92701
|
imageDimensionError.maxDimensionPx !== void 0 ? `limit=${imageDimensionError.maxDimensionPx}px` : null
|
|
92600
92702
|
].filter(Boolean).join(" ");
|
|
92601
|
-
log$
|
|
92703
|
+
log$27.warn(`Profile ${lastProfileId} rejected image payload${details ? ` (${details})` : ""}.`);
|
|
92602
92704
|
}
|
|
92603
92705
|
if (!aborted && failoverFailure || timedOut && !timedOutDuringCompaction) {
|
|
92604
92706
|
if (lastProfileId) {
|
|
@@ -92606,8 +92708,8 @@ async function runEmbeddedPiAgent(params) {
|
|
|
92606
92708
|
profileId: lastProfileId,
|
|
92607
92709
|
reason: timedOut || assistantFailoverReason === "timeout" ? "timeout" : assistantFailoverReason ?? "unknown"
|
|
92608
92710
|
});
|
|
92609
|
-
if (timedOut && !isProbeSession) log$
|
|
92610
|
-
if (cloudCodeAssistFormatError) log$
|
|
92711
|
+
if (timedOut && !isProbeSession) log$27.warn(`Profile ${lastProfileId} timed out. Trying next account...`);
|
|
92712
|
+
if (cloudCodeAssistFormatError) log$27.warn(`Profile ${lastProfileId} hit Cloud Code Assist format error. Tool calls will be sanitized on retry.`);
|
|
92611
92713
|
}
|
|
92612
92714
|
if (await advanceAuthProfile()) continue;
|
|
92613
92715
|
if (fallbackConfigured) {
|
|
@@ -92652,7 +92754,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
92652
92754
|
}, hookCtx);
|
|
92653
92755
|
if (transformResult?.assistantTexts) finalAssistantTexts = transformResult.assistantTexts;
|
|
92654
92756
|
} catch (err) {
|
|
92655
|
-
log$
|
|
92757
|
+
log$27.warn(`transform_llm_output hook failed: ${String(err)}`);
|
|
92656
92758
|
}
|
|
92657
92759
|
const payloads = buildEmbeddedRunPayloads({
|
|
92658
92760
|
assistantTexts: finalAssistantTexts,
|
|
@@ -92703,7 +92805,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
92703
92805
|
durationMs: Date.now() - started,
|
|
92704
92806
|
exitStatus: aborted || timedOut ? "error" : void 0
|
|
92705
92807
|
});
|
|
92706
|
-
log$
|
|
92808
|
+
log$27.debug(`embedded run done: runId=${params.runId} sessionId=${params.sessionId} durationMs=${Date.now() - started} aborted=${aborted}`);
|
|
92707
92809
|
if (lastProfileId) {
|
|
92708
92810
|
await markAuthProfileGood({
|
|
92709
92811
|
store: authStore,
|
|
@@ -92740,7 +92842,6 @@ async function runEmbeddedPiAgent(params) {
|
|
|
92740
92842
|
}
|
|
92741
92843
|
} finally {
|
|
92742
92844
|
stopCopilotRefreshTimer();
|
|
92743
|
-
if (!params.skipCwdChange) process.chdir(prevCwd);
|
|
92744
92845
|
}
|
|
92745
92846
|
}));
|
|
92746
92847
|
}
|