@symerian/symi 2.6.2 → 2.6.4
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/{agents-qLMWAYwU.js → agents-DOW6IsMq.js} +4 -4
- package/dist/{agents.config-BmdFH4J5.js → agents.config-BS_3Q1aC.js} +1 -1
- package/dist/{agents.config-BfjAwFCr.js → agents.config-Begh8fIB.js} +1 -1
- package/dist/{audio-preflight-BVaaZWkg.js → audio-preflight-DHTaS5U1.js} +4 -4
- package/dist/{auth-choice-zFq3WRQ0.js → auth-choice-CfqsNRiL.js} +1 -1
- package/dist/{auth-choice-D1u_GPfQ.js → auth-choice-KBIBWGi5.js} +1 -1
- package/dist/{banner-DpH44qlJ.js → banner-D5oPK3dd.js} +1 -1
- package/dist/build-info.json +3 -3
- package/dist/bundled/boot-md/handler.js +6 -6
- package/dist/bundled/session-memory/handler.js +6 -6
- package/dist/canvas-host/a2ui/.bundle.hash +1 -1
- package/dist/{channel-options-C8tKm8re.js → channel-options-CxTrwgcc.js} +1 -1
- package/dist/{channel-options-0iOfzVR3.js → channel-options-Dk60zDRr.js} +1 -1
- package/dist/{channel-web-DYinYBz4.js → channel-web-DUe1eTrq.js} +1 -1
- package/dist/{channels-cli-93tLT17t.js → channels-cli-BEAJxa39.js} +4 -4
- package/dist/{channels-cli-C8HgSMTH.js → channels-cli-Cezxcj8R.js} +4 -4
- package/dist/{chrome-DkaXoP36.js → chrome-DYZwl5Gv.js} +7 -7
- package/dist/{cli-BYJyRW2M.js → cli-Cg-uzVGj.js} +1 -1
- package/dist/{cli-DapZXGSB.js → cli-CwhdsdYh.js} +1 -1
- package/dist/{command-registry-9EhYc6da.js → command-registry-DUrtuPM6.js} +9 -9
- package/dist/{completion-cli-BFZv3K5D.js → completion-cli-CoZJtRvO.js} +2 -2
- package/dist/{completion-cli-CCeQlMlC.js → completion-cli-DmASMmCq.js} +1 -1
- package/dist/{config-cli-DbWMIBUz.js → config-cli-UoL1dwqb.js} +1 -1
- package/dist/{config-cli-Dv2mtIeM.js → config-cli-m_Qi3Frt.js} +1 -1
- package/dist/{configure-B8zV6Hxj.js → configure-BcBt8XDv.js} +3 -3
- package/dist/{configure-CVQf2UJE.js → configure-DZ47HgAy.js} +3 -3
- package/dist/{deliver-C46-vyqg.js → deliver-dODxSv3b.js} +1 -1
- package/dist/{doctor-completion-BunqvoqZ.js → doctor-completion-CZVgF2O7.js} +1 -1
- package/dist/{doctor-completion-CLeX1kaN.js → doctor-completion-p74nttr9.js} +1 -1
- package/dist/entry.js +1 -1
- package/dist/extensionAPI.js +1 -1
- package/dist/{gateway-cli-DMey_29a.js → gateway-cli-BQvWIuYZ.js} +9 -9
- package/dist/{gateway-cli-Co-tp-WC.js → gateway-cli-CvZ37LY5.js} +9 -9
- package/dist/{glass-ui-ws-C4O227UO.js → glass-ui-ws-CtvmKIGE.js} +7 -7
- package/dist/{glass-ui-ws-CKb1jTZR.js → glass-ui-ws-DpfTN1oc.js} +7 -7
- package/dist/{health-CM1asUG8.js → health-CCtEihH4.js} +1 -1
- package/dist/{health-CDGOsNeD.js → health-DCNAbUwC.js} +1 -1
- package/dist/{hooks-cli-DFKB3Z6X.js → hooks-cli-BBB59b3F.js} +2 -2
- package/dist/{hooks-cli-Tx0TzSju.js → hooks-cli-COSh_mpB.js} +2 -2
- package/dist/{image-CuzFLQWC.js → image-CXu8W39c.js} +1 -1
- package/dist/index.js +6 -6
- package/dist/llm-slug-generator.js +6 -6
- package/dist/{models-CiqHYwje.js → models-BGMa66uX.js} +2 -2
- package/dist/{models-cli-B-b-gBKG.js → models-cli-B2dfKl2c.js} +2 -2
- package/dist/{models-cli-B4ATSsNS.js → models-cli-Blngpmmw.js} +3 -3
- package/dist/{onboard-DcnGZKZX.js → onboard-DNSwJybR.js} +2 -2
- package/dist/{onboard-B_ECX48L.js → onboard-DPyRkUFi.js} +2 -2
- package/dist/{onboard-channels-FFQPpuEN.js → onboard-channels-B6LdRH-G.js} +1 -1
- package/dist/{onboard-channels-pfSGhg_C.js → onboard-channels-CwmO-fIN.js} +1 -1
- package/dist/{onboarding-BU14cspo.js → onboarding-JmJe53N1.js} +3 -3
- package/dist/{onboarding-jhZxQcZ3.js → onboarding-S0W19_rT.js} +3 -3
- package/dist/{onboarding.finalize-ByZT4dF5.js → onboarding.finalize-07S5-W8B.js} +5 -5
- package/dist/{onboarding.finalize-B8oOMfHc.js → onboarding.finalize-DSeh_xzP.js} +6 -6
- package/dist/{pi-embedded-helpers-CfqDGQ9J.js → pi-embedded-helpers-pubKo8HQ.js} +4 -4
- package/dist/{pi-embedded-BY9AnmoP.js → pi-embedded-hzH7U2lh.js} +159 -144
- package/dist/{plugin-registry-DXWJkJX6.js → plugin-registry-CSo-ZnRV.js} +1 -1
- package/dist/{plugin-registry-CNf1_8hj.js → plugin-registry-CzDaYnXD.js} +1 -1
- package/dist/plugin-sdk/{accounts-BToL3HlP.js → accounts-BtaOa4z_.js} +1 -1
- package/dist/plugin-sdk/{accounts-D9zGZU5t.js → accounts-Ddm33hQm.js} +3 -3
- package/dist/plugin-sdk/{accounts-Dtszw3Zn.js → accounts-s-AdhXVR.js} +1 -1
- package/dist/plugin-sdk/{active-listener-bEk__wbB.js → active-listener-BXYeALs0.js} +1 -1
- package/dist/plugin-sdk/{agent-scope-C3gMMKCU.js → agent-scope-CYYpcO9W.js} +2 -2
- package/dist/plugin-sdk/{api-key-rotation-CVBMpnPc.js → api-key-rotation-D_sMvI5W.js} +1 -1
- package/dist/plugin-sdk/{audio-preflight-DoQQKlxa.js → audio-preflight-VpItkiy3.js} +24 -24
- package/dist/plugin-sdk/{bindings-BbwoUGPx.js → bindings-C7hRtgYW.js} +2 -2
- package/dist/plugin-sdk/{channel-activity-Ji7f0gqq.js → channel-activity-DoC1xtDu.js} +1 -1
- package/dist/plugin-sdk/{channel-web-DZQQ0mzN.js → channel-web-ByCyqhUk.js} +22 -22
- package/dist/plugin-sdk/{chrome-C7c_0I5M.js → chrome-B7RdxmJ0.js} +3 -3
- package/dist/plugin-sdk/{chunk-jvk9axTQ.js → chunk-Dw2XBYXv.js} +1 -1
- package/dist/plugin-sdk/{command-format-DSdvQ_M5.js → command-format-GKSevep4.js} +1 -1
- package/dist/plugin-sdk/{commands-registry-CQFbmUMs.js → commands-registry-COIaslGl.js} +4 -4
- package/dist/plugin-sdk/{config-DDkdiUOR.js → config-KlTNfkFF.js} +9 -9
- package/dist/plugin-sdk/{deliver-BZ6iNLl7.js → deliver-BZ99UKQq.js} +10 -10
- package/dist/plugin-sdk/{diagnostic-mFf4i4G9.js → diagnostic-05pm5Rxi.js} +1 -1
- package/dist/plugin-sdk/{image-BOYy0Ump.js → image-CLOPx7yW.js} +4 -4
- package/dist/plugin-sdk/{image-ops-Bnp6LXEx.js → image-ops-BlQR__MN.js} +1 -1
- package/dist/plugin-sdk/index.js +53 -53
- package/dist/plugin-sdk/{ir-Fb3qpcis.js → ir-BJ6BHE5b.js} +4 -4
- package/dist/plugin-sdk/{local-roots-Ckk1QfzI.js → local-roots-BHLNSI8U.js} +3 -3
- package/dist/plugin-sdk/{login-Bh3DZPam.js → login-DQMXuxOk.js} +7 -7
- package/dist/plugin-sdk/{login-qr-DbR7odSr.js → login-qr-BjVZSoCi.js} +9 -9
- package/dist/plugin-sdk/{manager-DckktAQ3.js → manager-CBSBFuFz.js} +8 -8
- package/dist/plugin-sdk/{manifest-registry-B3ugY9-f.js → manifest-registry-CPnHl_K3.js} +1 -1
- package/dist/plugin-sdk/{markdown-tables-Dfaqilz6.js → markdown-tables-BoYFajMu.js} +1 -1
- package/dist/plugin-sdk/{message-channel-BdI5Ra9S.js → message-channel-COTAJzHd.js} +1 -1
- package/dist/plugin-sdk/{model-selection-OpU8HN50.js → model-selection-CsbEfrS0.js} +4 -4
- package/dist/plugin-sdk/{outbound-rF6G8Xpr.js → outbound-B0e8KdaR.js} +7 -7
- package/dist/plugin-sdk/{outbound-attachment-DnVQfTG2.js → outbound-attachment-CnslKL38.js} +2 -2
- package/dist/plugin-sdk/{pi-auth-json-CJk8t14T.js → pi-auth-json-qWi7ZIYV.js} +5 -5
- package/dist/plugin-sdk/{pi-embedded-helpers-BveUP4hk.js → pi-embedded-helpers-CW630epe.js} +17 -17
- package/dist/plugin-sdk/{plugins-BbAvhC25.js → plugins-BNByVCIH.js} +4 -4
- package/dist/plugin-sdk/{pw-ai-DjGUsee-.js → pw-ai-CnbPIPY9.js} +8 -8
- package/dist/plugin-sdk/{qmd-manager-mjKcdwVr.js → qmd-manager-CH0XbIHf.js} +4 -4
- package/dist/plugin-sdk/{registry--_pGht6S.js → registry-D0xTnUWt.js} +2 -2
- package/dist/plugin-sdk/{replies-fI39rPGa.js → replies-LLcQL3w6.js} +3 -3
- package/dist/plugin-sdk/{reply-DvZeyOVA.js → reply-Dcsda8Tt.js} +231 -216
- package/dist/plugin-sdk/{reply-prefix-BHuV5t70.js → reply-prefix-uxfMZW4p.js} +1 -1
- package/dist/plugin-sdk/{resolve-outbound-target-BkCUbYGV.js → resolve-outbound-target-BiyAyTWz.js} +2 -2
- package/dist/plugin-sdk/{resolve-route-D3JH_D2N.js → resolve-route-B3CCBumQ.js} +3 -3
- package/dist/plugin-sdk/{retry-ilSJqnz9.js → retry-CwQ_iIj8.js} +1 -1
- package/dist/plugin-sdk/{runner-BVqnEfNe.js → runner-CGBT7tgF.js} +9 -9
- package/dist/plugin-sdk/{send-BtANzsAo.js → send-B2CEnVLL.js} +6 -6
- package/dist/plugin-sdk/{send-BHbXh8Ly.js → send-C5h_YxNb.js} +7 -7
- package/dist/plugin-sdk/{send-D6LMZJ_h.js → send-CRsR8-vO.js} +10 -10
- package/dist/plugin-sdk/{send-Bxdu6ZZy.js → send-CjOBB3Vo.js} +10 -10
- package/dist/plugin-sdk/{send-BMfJIhCk.js → send-pYqe432l.js} +6 -6
- package/dist/plugin-sdk/{session-kI0tzViQ.js → session-BsOrxiMj.js} +4 -4
- package/dist/plugin-sdk/{skill-commands-DCNXVERE.js → skill-commands-ff_01_r3.js} +5 -5
- package/dist/plugin-sdk/{skills-B1GeRYlu.js → skills-_yTP47Cd.js} +7 -7
- package/dist/plugin-sdk/{sqlite-Cq_7Cg4E.js → sqlite-CxAR5ttJ.js} +1 -1
- package/dist/plugin-sdk/{store-Do3t33-c.js → store-BdrNabcU.js} +2 -2
- package/dist/plugin-sdk/{subsystem-Coz2AgU8.js → subsystem-B2uDN3TV.js} +1 -1
- package/dist/plugin-sdk/{tables-DR0NmBeH.js → tables-DNwXwNFa.js} +1 -1
- package/dist/plugin-sdk/{target-errors-B7YyMnIi.js → target-errors-Paro1BjP.js} +2 -2
- package/dist/plugin-sdk/{thinking-DCNUIAHY.js → thinking-CXqf7WTe.js} +5 -5
- package/dist/plugin-sdk/{tokens-CWMflosr.js → tokens-bC3UVmVH.js} +1 -1
- package/dist/plugin-sdk/{tool-images-D7Lno-TE.js → tool-images-HJ2sfZDV.js} +2 -2
- package/dist/plugin-sdk/{tool-loop-detection-DU5sTIKg.js → tool-loop-detection-at_K42K7.js} +2 -2
- package/dist/plugin-sdk/web-C39eHM3D.js +65 -0
- package/dist/plugin-sdk/{whatsapp-actions-CcBzDuL-.js → whatsapp-actions-DfseosPO.js} +21 -21
- package/dist/{plugins-cli-BiedlZMy.js → plugins-cli-62BU54hk.js} +2 -2
- package/dist/{plugins-cli-C9TYM40P.js → plugins-cli-ClKLriuv.js} +2 -2
- package/dist/{program-bnWda72r.js → program-Cr_6s-Wr.js} +7 -7
- package/dist/{program-context-CY1jWc5A.js → program-context-LakSEswZ.js} +17 -17
- package/dist/{prompt-select-styled-B_lFTtqp.js → prompt-select-styled-Bi_sLB9O.js} +4 -4
- package/dist/{prompt-select-styled-BEnZY8wI.js → prompt-select-styled-Du1GhtB8.js} +4 -4
- package/dist/{provider-auth-helpers-DApJuzBd.js → provider-auth-helpers-ZZn9gWaP.js} +1 -1
- package/dist/{provider-auth-helpers-DcNKxc7D.js → provider-auth-helpers-ywLHg2WA.js} +1 -1
- package/dist/{push-apns-DA7UMNQH.js → push-apns-3aDWyTlU.js} +1 -1
- package/dist/{push-apns-CKKHlj6j.js → push-apns-B49EFYpk.js} +1 -1
- package/dist/{pw-ai-m0mj2KWK.js → pw-ai-B5asscAD.js} +1 -1
- package/dist/{register.agent-ulu0VmOg.js → register.agent-Bq736SbZ.js} +6 -6
- package/dist/{register.agent-8lxVlmzQ.js → register.agent-CL7uT27q.js} +5 -5
- package/dist/{register.configure-rq0h5r3X.js → register.configure-CmkDzzkD.js} +6 -6
- package/dist/{register.configure-45--Sly1.js → register.configure-qTTgDLbM.js} +6 -6
- package/dist/{register.maintenance-DyEJx7NY.js → register.maintenance-C5XnP7dI.js} +7 -7
- package/dist/{register.maintenance-CXbxRtWI.js → register.maintenance-_ZVy0fEd.js} +8 -8
- package/dist/{register.message-C7Yh1uky.js → register.message-2NhFUTcM.js} +2 -2
- package/dist/{register.message-CiN_pt6K.js → register.message-BC4qZya-.js} +2 -2
- package/dist/{register.onboard-BWaRkbei.js → register.onboard-BQOCLgJo.js} +4 -4
- package/dist/{register.onboard-e_2hc2Rm.js → register.onboard-iLXzJM7V.js} +4 -4
- package/dist/{register.setup-zwh90Vn-.js → register.setup-B2-yGr1t.js} +4 -4
- package/dist/{register.setup-BIIFHtF7.js → register.setup-CcyX5j-M.js} +4 -4
- package/dist/{register.status-health-sessions-D6t5maEr.js → register.status-health-sessions-BCK-DpIZ.js} +3 -3
- package/dist/{register.status-health-sessions-O-sVAFHE.js → register.status-health-sessions-Wx568N29.js} +3 -3
- package/dist/{register.subclis-DOiZocR6.js → register.subclis-NhUwrvHD.js} +9 -9
- package/dist/{reply-05js8eGB.js → reply-lB0BEzXe.js} +150 -135
- package/dist/{run-main-u-Eyc8Wm.js → run-main-CaLWEHIe.js} +14 -14
- package/dist/{runner-CU9l0uJh.js → runner-WAG0M5s9.js} +1 -1
- package/dist/{server-methods-Bvl1xubo.js → server-methods-BLMrfe0E.js} +7 -7
- package/dist/{server-methods-Dds-iEoY.js → server-methods-antquo4f.js} +7 -7
- package/dist/{server-node-events-Qp-gJMET.js → server-node-events-CGCf_VrC.js} +2 -2
- package/dist/{server-node-events-qGqpsPxm.js → server-node-events-SU9R43JA.js} +2 -2
- package/dist/{status-CfYa1Q9K.js → status-BC-KwUC9.js} +1 -1
- package/dist/{status-BATOXGRi.js → status-C3aQLr4L.js} +2 -2
- package/dist/{status-BqQ9mm64.js → status-COOFRiRw.js} +1 -1
- package/dist/{status-BRSo-LY3.js → status-OFq7A4LY.js} +2 -2
- package/dist/{subagent-registry-lbDgDwLy.js → subagent-registry-B0mypfy9.js} +153 -138
- package/dist/{unified-runner-B4ICXRlg.js → unified-runner-B3woBNrE.js} +178 -163
- package/dist/{update-cli-BOaP4XyQ.js → update-cli-8VnoOX2I.js} +8 -8
- package/dist/{update-cli-R8-SSkbS.js → update-cli-DCcoGy6P.js} +7 -7
- package/dist/{update-runner-B8UmqtLI.js → update-runner-BOUFaEvf.js} +1 -1
- package/dist/{update-runner-CWJ4pC1b.js → update-runner-Zj0IkuvS.js} +1 -1
- package/dist/{web-CSrDbJJ7.js → web-CNlgAOtg.js} +1 -1
- package/dist/{web-DBFW0ejP.js → web-D6iv7lpW.js} +1 -1
- package/dist/{web-CQH9fSkH.js → web-DnKUPuUb.js} +6 -6
- package/dist/{web-BWybtnEa.js → web-Dtu6w-WL.js} +2 -2
- package/package.json +1 -1
- package/dist/plugin-sdk/web-BCsJFuQu.js +0 -65
|
@@ -20367,7 +20367,7 @@ function createRunRegistry(options) {
|
|
|
20367
20367
|
|
|
20368
20368
|
//#endregion
|
|
20369
20369
|
//#region src/process/supervisor/supervisor.ts
|
|
20370
|
-
const log$
|
|
20370
|
+
const log$9 = createSubsystemLogger("process/supervisor");
|
|
20371
20371
|
function clampTimeout(value) {
|
|
20372
20372
|
if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) return;
|
|
20373
20373
|
return Math.max(1, Math.floor(value));
|
|
@@ -20553,7 +20553,7 @@ function createProcessSupervisor() {
|
|
|
20553
20553
|
exitCode: null,
|
|
20554
20554
|
exitSignal: null
|
|
20555
20555
|
});
|
|
20556
|
-
log$
|
|
20556
|
+
log$9.warn(`spawn failed: runId=${runId} reason=${String(err)}`);
|
|
20557
20557
|
throw err;
|
|
20558
20558
|
}
|
|
20559
20559
|
};
|
|
@@ -21852,7 +21852,7 @@ function resolveRunWorkspaceDir(params) {
|
|
|
21852
21852
|
|
|
21853
21853
|
//#endregion
|
|
21854
21854
|
//#region src/agents/cli-runner.ts
|
|
21855
|
-
const log$
|
|
21855
|
+
const log$8 = createSubsystemLogger("agent/claude-cli");
|
|
21856
21856
|
async function runCliAgent(params) {
|
|
21857
21857
|
const started = Date.now();
|
|
21858
21858
|
const workspaceResolution = resolveRunWorkspaceDir({
|
|
@@ -21865,7 +21865,7 @@ async function runCliAgent(params) {
|
|
|
21865
21865
|
const redactedSessionId = redactRunIdentifier(params.sessionId);
|
|
21866
21866
|
const redactedSessionKey = redactRunIdentifier(params.sessionKey);
|
|
21867
21867
|
const redactedWorkspace = redactRunIdentifier(resolvedWorkspace);
|
|
21868
|
-
if (workspaceResolution.usedFallback) log$
|
|
21868
|
+
if (workspaceResolution.usedFallback) log$8.warn(`[workspace-fallback] caller=runCliAgent reason=${workspaceResolution.fallbackReason} run=${params.runId} session=${redactedSessionId} sessionKey=${redactedSessionKey} agent=${workspaceResolution.agentId} workspace=${redactedWorkspace}`);
|
|
21869
21869
|
const workspaceDir = resolvedWorkspace;
|
|
21870
21870
|
const backendResolved = resolveCliBackendConfig(params.provider, params.config);
|
|
21871
21871
|
if (!backendResolved) throw new Error(`Unknown CLI backend: ${params.provider}`);
|
|
@@ -21882,7 +21882,7 @@ async function runCliAgent(params) {
|
|
|
21882
21882
|
sessionId: params.sessionId,
|
|
21883
21883
|
warn: makeBootstrapWarn({
|
|
21884
21884
|
sessionLabel,
|
|
21885
|
-
warn: (message) => log$
|
|
21885
|
+
warn: (message) => log$8.warn(message)
|
|
21886
21886
|
})
|
|
21887
21887
|
});
|
|
21888
21888
|
const { defaultAgentId, sessionAgentId } = resolveSessionAgentIds({
|
|
@@ -21948,7 +21948,7 @@ async function runCliAgent(params) {
|
|
|
21948
21948
|
const queueKey = backend.serialize ?? true ? backendResolved.id : `${backendResolved.id}:${params.runId}`;
|
|
21949
21949
|
try {
|
|
21950
21950
|
const output = await enqueueCliRun(queueKey, async () => {
|
|
21951
|
-
log$
|
|
21951
|
+
log$8.info(`cli exec: provider=${params.provider} model=${normalizedModel} promptChars=${params.prompt.length}`);
|
|
21952
21952
|
const logOutputText = isTruthyEnvValue(process.env.SYMI_CLAUDE_CLI_LOG_OUTPUT);
|
|
21953
21953
|
if (logOutputText) {
|
|
21954
21954
|
const logArgs = [];
|
|
@@ -21981,7 +21981,7 @@ async function runCliAgent(params) {
|
|
|
21981
21981
|
const promptIndex = logArgs.indexOf(argsPrompt);
|
|
21982
21982
|
if (promptIndex >= 0) logArgs[promptIndex] = `<prompt:${argsPrompt.length} chars>`;
|
|
21983
21983
|
}
|
|
21984
|
-
log$
|
|
21984
|
+
log$8.info(`cli argv: ${backend.command} ${logArgs.join(" ")}`);
|
|
21985
21985
|
}
|
|
21986
21986
|
const env = (() => {
|
|
21987
21987
|
const next = {
|
|
@@ -22019,17 +22019,17 @@ async function runCliAgent(params) {
|
|
|
22019
22019
|
const stdout = result.stdout.trim();
|
|
22020
22020
|
const stderr = result.stderr.trim();
|
|
22021
22021
|
if (logOutputText) {
|
|
22022
|
-
if (stdout) log$
|
|
22023
|
-
if (stderr) log$
|
|
22022
|
+
if (stdout) log$8.info(`cli stdout:\n${stdout}`);
|
|
22023
|
+
if (stderr) log$8.info(`cli stderr:\n${stderr}`);
|
|
22024
22024
|
}
|
|
22025
22025
|
if (shouldLogVerbose()) {
|
|
22026
|
-
if (stdout) log$
|
|
22027
|
-
if (stderr) log$
|
|
22026
|
+
if (stdout) log$8.debug(`cli stdout:\n${stdout}`);
|
|
22027
|
+
if (stderr) log$8.debug(`cli stderr:\n${stderr}`);
|
|
22028
22028
|
}
|
|
22029
22029
|
if (result.exitCode !== 0 || result.reason !== "exit") {
|
|
22030
22030
|
if (result.reason === "no-output-timeout" || result.noOutputTimedOut) {
|
|
22031
22031
|
const timeoutReason = `CLI produced no output for ${Math.round(noOutputTimeoutMs / 1e3)}s and was terminated.`;
|
|
22032
|
-
log$
|
|
22032
|
+
log$8.warn(`cli watchdog timeout: provider=${params.provider} model=${modelId} session=${cliSessionIdToSend ?? params.sessionId} noOutputTimeoutMs=${noOutputTimeoutMs} pid=${managedRun.pid ?? "unknown"}`);
|
|
22033
22033
|
throw new FailoverError(timeoutReason, {
|
|
22034
22034
|
reason: "timeout",
|
|
22035
22035
|
provider: params.provider,
|
|
@@ -22603,7 +22603,7 @@ function resolveEmbeddedSessionLane(key) {
|
|
|
22603
22603
|
|
|
22604
22604
|
//#endregion
|
|
22605
22605
|
//#region src/agents/pi-embedded-runner/logger.ts
|
|
22606
|
-
const log$
|
|
22606
|
+
const log$7 = createSubsystemLogger("agent/embedded");
|
|
22607
22607
|
|
|
22608
22608
|
//#endregion
|
|
22609
22609
|
//#region src/utils/safe-json.ts
|
|
@@ -22649,7 +22649,7 @@ function getQueuedFileWriter(writers, filePath) {
|
|
|
22649
22649
|
//#endregion
|
|
22650
22650
|
//#region src/agents/anthropic-payload-log.ts
|
|
22651
22651
|
const writers$1 = /* @__PURE__ */ new Map();
|
|
22652
|
-
const log$
|
|
22652
|
+
const log$6 = createSubsystemLogger("agent/anthropic-payload");
|
|
22653
22653
|
function resolvePayloadLogConfig(env) {
|
|
22654
22654
|
const enabled = parseBooleanValue$1(env.SYMI_ANTHROPIC_PAYLOAD_LOG) ?? false;
|
|
22655
22655
|
const fileOverride = env.SYMI_ANTHROPIC_PAYLOAD_LOG_FILE?.trim();
|
|
@@ -22739,13 +22739,13 @@ function createAnthropicPayloadLogger(params) {
|
|
|
22739
22739
|
usage,
|
|
22740
22740
|
error: errorMessage
|
|
22741
22741
|
});
|
|
22742
|
-
log$
|
|
22742
|
+
log$6.info("anthropic usage", {
|
|
22743
22743
|
runId: params.runId,
|
|
22744
22744
|
sessionId: params.sessionId,
|
|
22745
22745
|
usage
|
|
22746
22746
|
});
|
|
22747
22747
|
};
|
|
22748
|
-
log$
|
|
22748
|
+
log$6.info("anthropic payload logger enabled", { filePath: writer.filePath });
|
|
22749
22749
|
return {
|
|
22750
22750
|
enabled: true,
|
|
22751
22751
|
wrapStreamFn,
|
|
@@ -24627,7 +24627,7 @@ function createEmbeddedPiSessionEventHandler(ctx) {
|
|
|
24627
24627
|
//#region src/agents/pi-embedded-subscribe.ts
|
|
24628
24628
|
const THINKING_TAG_SCAN_RE = /<\s*(\/?)\s*(?:think(?:ing)?|thought|antthinking)\s*>/gi;
|
|
24629
24629
|
const FINAL_TAG_SCAN_RE = /<\s*(\/?)\s*final\s*>/gi;
|
|
24630
|
-
const log$
|
|
24630
|
+
const log$5 = createSubsystemLogger("agent/embedded");
|
|
24631
24631
|
function subscribeEmbeddedPiSession(params) {
|
|
24632
24632
|
const reasoningMode = params.reasoningMode ?? "off";
|
|
24633
24633
|
const useMarkdown = (params.toolResultFormat ?? "markdown") === "markdown";
|
|
@@ -24784,7 +24784,7 @@ function subscribeEmbeddedPiSession(params) {
|
|
|
24784
24784
|
state.compactionRetryReject = reject;
|
|
24785
24785
|
});
|
|
24786
24786
|
state.compactionRetryPromise.catch((err) => {
|
|
24787
|
-
log$
|
|
24787
|
+
log$5.debug(`compaction promise rejected (no waiter): ${String(err)}`);
|
|
24788
24788
|
});
|
|
24789
24789
|
}
|
|
24790
24790
|
};
|
|
@@ -24936,7 +24936,7 @@ function subscribeEmbeddedPiSession(params) {
|
|
|
24936
24936
|
if (!chunk) return;
|
|
24937
24937
|
if (chunk === state.lastBlockReplyText) return;
|
|
24938
24938
|
if (isMessagingToolDuplicateNormalized(normalizeTextForComparison(chunk), messagingToolSentTextsNormalized)) {
|
|
24939
|
-
log$
|
|
24939
|
+
log$5.debug(`Skipping block reply - already sent via messaging tool: ${chunk.slice(0, 50)}...`);
|
|
24940
24940
|
return;
|
|
24941
24941
|
}
|
|
24942
24942
|
if (shouldSkipAssistantText(chunk)) return;
|
|
@@ -25014,7 +25014,7 @@ function subscribeEmbeddedPiSession(params) {
|
|
|
25014
25014
|
const ctx = {
|
|
25015
25015
|
params,
|
|
25016
25016
|
state,
|
|
25017
|
-
log: log$
|
|
25017
|
+
log: log$5,
|
|
25018
25018
|
blockChunking,
|
|
25019
25019
|
blockChunker,
|
|
25020
25020
|
hookRunner: params.hookRunner,
|
|
@@ -25047,7 +25047,7 @@ function subscribeEmbeddedPiSession(params) {
|
|
|
25047
25047
|
if (state.unsubscribed) return;
|
|
25048
25048
|
state.unsubscribed = true;
|
|
25049
25049
|
if (state.compactionRetryPromise) {
|
|
25050
|
-
log$
|
|
25050
|
+
log$5.debug(`unsubscribe: rejecting compaction wait runId=${params.runId}`);
|
|
25051
25051
|
const reject = state.compactionRetryReject;
|
|
25052
25052
|
state.compactionRetryResolve = void 0;
|
|
25053
25053
|
state.compactionRetryReject = void 0;
|
|
@@ -25057,11 +25057,11 @@ function subscribeEmbeddedPiSession(params) {
|
|
|
25057
25057
|
reject?.(abortErr);
|
|
25058
25058
|
}
|
|
25059
25059
|
if (params.session.isCompacting) {
|
|
25060
|
-
log$
|
|
25060
|
+
log$5.debug(`unsubscribe: aborting in-flight compaction runId=${params.runId}`);
|
|
25061
25061
|
try {
|
|
25062
25062
|
params.session.abortCompaction();
|
|
25063
25063
|
} catch (err) {
|
|
25064
|
-
log$
|
|
25064
|
+
log$5.warn(`unsubscribe: compaction abort failed runId=${params.runId} err=${String(err)}`);
|
|
25065
25065
|
}
|
|
25066
25066
|
}
|
|
25067
25067
|
sessionUnsubscribe();
|
|
@@ -25110,7 +25110,7 @@ function subscribeEmbeddedPiSession(params) {
|
|
|
25110
25110
|
|
|
25111
25111
|
//#endregion
|
|
25112
25112
|
//#region src/agents/pi-tools.before-tool-call.ts
|
|
25113
|
-
const log$
|
|
25113
|
+
const log$4 = createSubsystemLogger("agents/tools");
|
|
25114
25114
|
const BEFORE_TOOL_CALL_WRAPPED = Symbol("beforeToolCallWrapped");
|
|
25115
25115
|
const adjustedParamsByToolCallId = /* @__PURE__ */ new Map();
|
|
25116
25116
|
const MAX_TRACKED_ADJUSTED_PARAMS = 1024;
|
|
@@ -25144,7 +25144,7 @@ async function recordLoopOutcome(args) {
|
|
|
25144
25144
|
config: args.ctx.loopDetection
|
|
25145
25145
|
});
|
|
25146
25146
|
} catch (err) {
|
|
25147
|
-
log$
|
|
25147
|
+
log$4.warn(`tool loop outcome tracking failed: tool=${args.toolName} error=${String(err)}`);
|
|
25148
25148
|
}
|
|
25149
25149
|
}
|
|
25150
25150
|
async function runBeforeToolCallHook(args) {
|
|
@@ -25161,7 +25161,7 @@ async function runBeforeToolCallHook(args) {
|
|
|
25161
25161
|
const loopResult = detectToolCallLoop(sessionState, toolName, params, args.ctx.loopDetection);
|
|
25162
25162
|
if (loopResult.stuck) {
|
|
25163
25163
|
if (loopResult.level === "critical") {
|
|
25164
|
-
log$
|
|
25164
|
+
log$4.error(`Blocking ${toolName} due to critical loop: ${loopResult.message}`);
|
|
25165
25165
|
logToolLoopAction({
|
|
25166
25166
|
sessionKey: args.ctx.sessionKey,
|
|
25167
25167
|
sessionId: args.ctx?.agentId,
|
|
@@ -25178,7 +25178,7 @@ async function runBeforeToolCallHook(args) {
|
|
|
25178
25178
|
reason: loopResult.message
|
|
25179
25179
|
};
|
|
25180
25180
|
} else if (shouldEmitLoopWarning(sessionState, loopResult.warningKey ?? `${loopResult.detector}:${toolName}`, loopResult.count)) {
|
|
25181
|
-
log$
|
|
25181
|
+
log$4.warn(`Loop warning for ${toolName}: ${loopResult.message}`);
|
|
25182
25182
|
logToolLoopAction({
|
|
25183
25183
|
sessionKey: args.ctx.sessionKey,
|
|
25184
25184
|
sessionId: args.ctx?.agentId,
|
|
@@ -25228,7 +25228,7 @@ async function runBeforeToolCallHook(args) {
|
|
|
25228
25228
|
}
|
|
25229
25229
|
} catch (err) {
|
|
25230
25230
|
const toolCallId = args.toolCallId ? ` toolCallId=${args.toolCallId}` : "";
|
|
25231
|
-
log$
|
|
25231
|
+
log$4.warn(`before_tool_call hook failed: tool=${toolName}${toolCallId} error=${String(err)}`);
|
|
25232
25232
|
}
|
|
25233
25233
|
return {
|
|
25234
25234
|
blocked: false,
|
|
@@ -25472,6 +25472,7 @@ function validateShellCommand(command) {
|
|
|
25472
25472
|
|
|
25473
25473
|
//#endregion
|
|
25474
25474
|
//#region src/agents/pi-tools.validate-wrapper.ts
|
|
25475
|
+
const log$3 = createSubsystemLogger("agents/tool-validate");
|
|
25475
25476
|
const EXEC_TOOL_NAMES = new Set(["exec", "bash"]);
|
|
25476
25477
|
const FILE_TOOL_NAMES = new Set([
|
|
25477
25478
|
"write",
|
|
@@ -25496,8 +25497,14 @@ const FILE_PATH_KEYS = [
|
|
|
25496
25497
|
* Call this AFTER tools are created and the model profile is resolved.
|
|
25497
25498
|
*/
|
|
25498
25499
|
function wrapToolsWithArgValidation(tools, profile) {
|
|
25499
|
-
if (!profile.filters?.validateToolArgs)
|
|
25500
|
-
|
|
25500
|
+
if (!profile.filters?.validateToolArgs) {
|
|
25501
|
+
log$3.debug(`[validate] skipped — validateToolArgs=${profile.filters?.validateToolArgs ?? "undefined"} profile=${profile.label}`);
|
|
25502
|
+
return tools;
|
|
25503
|
+
}
|
|
25504
|
+
const wrapped = tools.map((tool) => wrapToolWithArgValidation(tool));
|
|
25505
|
+
const wrappedNames = wrapped.filter((t, i) => t !== tools[i]).map((t) => t.name);
|
|
25506
|
+
log$3.debug(`[validate] applied to ${wrappedNames.length} tools: ${wrappedNames.join(",") || "(none matched)"}`);
|
|
25507
|
+
return wrapped;
|
|
25501
25508
|
}
|
|
25502
25509
|
/**
|
|
25503
25510
|
* Clean a file path by stripping control token fragments.
|
|
@@ -25530,13 +25537,22 @@ function wrapToolWithArgValidation(tool) {
|
|
|
25530
25537
|
execute(toolCallId, params, ...rest) {
|
|
25531
25538
|
if (isExecTool) {
|
|
25532
25539
|
const command = params.command ?? params.cmd;
|
|
25533
|
-
if (typeof command !== "string")
|
|
25540
|
+
if (typeof command !== "string") {
|
|
25541
|
+
log$3.debug(`[validate] exec called without string command: keys=${Object.keys(params).join(",")}`);
|
|
25542
|
+
return originalExecute.call(tool, toolCallId, params, ...rest);
|
|
25543
|
+
}
|
|
25534
25544
|
const result = validateShellCommand(command);
|
|
25535
|
-
if (!result.valid)
|
|
25536
|
-
|
|
25537
|
-
|
|
25538
|
-
|
|
25539
|
-
|
|
25545
|
+
if (!result.valid) {
|
|
25546
|
+
log$3.warn(`[validate] exec command rejected: reason=${result.reason} raw=${command.slice(0, 100)}`);
|
|
25547
|
+
return Promise.resolve({ output: `Error: ${result.reason}. The command appears to contain model control tokens. Please provide a clean shell command without any <|, |>, or XML-like tags. Only valid shell syntax is accepted.` });
|
|
25548
|
+
}
|
|
25549
|
+
if (result.cleaned !== command) {
|
|
25550
|
+
log$3.debug(`[validate] exec command cleaned: raw=${command.slice(0, 80)} → cleaned=${result.cleaned.slice(0, 80)}`);
|
|
25551
|
+
return originalExecute.call(tool, toolCallId, {
|
|
25552
|
+
...params,
|
|
25553
|
+
command: result.cleaned
|
|
25554
|
+
}, ...rest);
|
|
25555
|
+
}
|
|
25540
25556
|
return originalExecute.call(tool, toolCallId, params, ...rest);
|
|
25541
25557
|
}
|
|
25542
25558
|
const pathKey = FILE_PATH_KEYS.find((k) => typeof params[k] === "string");
|
|
@@ -25907,7 +25923,7 @@ async function truncateOversizedToolResultsInSession(params) {
|
|
|
25907
25923
|
const textLength = getToolResultTextLength(msg);
|
|
25908
25924
|
if (textLength > maxChars) {
|
|
25909
25925
|
oversizedIndices.push(i);
|
|
25910
|
-
log$
|
|
25926
|
+
log$7.info(`[tool-result-truncation] Found oversized tool result: entry=${entry.id} chars=${textLength} maxChars=${maxChars} sessionKey=${params.sessionKey ?? params.sessionId ?? "unknown"}`);
|
|
25911
25927
|
}
|
|
25912
25928
|
}
|
|
25913
25929
|
if (oversizedIndices.length === 0) return {
|
|
@@ -25929,7 +25945,7 @@ async function truncateOversizedToolResultsInSession(params) {
|
|
|
25929
25945
|
message = truncateToolResultMessage(message, maxChars);
|
|
25930
25946
|
truncatedCount++;
|
|
25931
25947
|
const newLength = getToolResultTextLength(message);
|
|
25932
|
-
log$
|
|
25948
|
+
log$7.info(`[tool-result-truncation] Truncated tool result: originalEntry=${entry.id} newChars=${newLength} sessionKey=${params.sessionKey ?? params.sessionId ?? "unknown"}`);
|
|
25933
25949
|
}
|
|
25934
25950
|
sessionManager.appendMessage(message);
|
|
25935
25951
|
} else if (entry.type === "compaction") sessionManager.appendCompaction(entry.summary, entry.firstKeptEntryId, entry.tokensBefore, entry.details, entry.fromHook);
|
|
@@ -25943,14 +25959,14 @@ async function truncateOversizedToolResultsInSession(params) {
|
|
|
25943
25959
|
if (entry.name) sessionManager.appendSessionInfo(entry.name);
|
|
25944
25960
|
}
|
|
25945
25961
|
}
|
|
25946
|
-
log$
|
|
25962
|
+
log$7.info(`[tool-result-truncation] Truncated ${truncatedCount} tool result(s) in session (contextWindow=${contextWindowTokens} maxChars=${maxChars}) sessionKey=${params.sessionKey ?? params.sessionId ?? "unknown"}`);
|
|
25947
25963
|
return {
|
|
25948
25964
|
truncated: true,
|
|
25949
25965
|
truncatedCount
|
|
25950
25966
|
};
|
|
25951
25967
|
} catch (err) {
|
|
25952
25968
|
const errMsg = err instanceof Error ? err.message : String(err);
|
|
25953
|
-
log$
|
|
25969
|
+
log$7.warn(`[tool-result-truncation] Failed to truncate: ${errMsg}`);
|
|
25954
25970
|
return {
|
|
25955
25971
|
truncated: false,
|
|
25956
25972
|
truncatedCount: 0,
|
|
@@ -27726,7 +27742,7 @@ function resolveAnthropicBetas(extraParams, provider, modelId) {
|
|
|
27726
27742
|
for (const beta of configured) if (typeof beta === "string" && beta.trim()) betas.add(beta.trim());
|
|
27727
27743
|
}
|
|
27728
27744
|
if (extraParams?.context1m === true) if (isAnthropic1MModel(modelId)) betas.add(ANTHROPIC_CONTEXT_1M_BETA);
|
|
27729
|
-
else log$
|
|
27745
|
+
else log$7.warn(`ignoring context1m for non-opus/sonnet model: ${provider}/${modelId}`);
|
|
27730
27746
|
return betas.size > 0 ? [...betas] : void 0;
|
|
27731
27747
|
}
|
|
27732
27748
|
function mergeAnthropicBetaHeader(headers, betas) {
|
|
@@ -28337,14 +28353,14 @@ function logToolSchemasForGoogle(params) {
|
|
|
28337
28353
|
if (params.provider !== "google-antigravity" && params.provider !== "google-gemini-cli") return;
|
|
28338
28354
|
const toolNames = params.tools.map((tool, index) => `${index}:${tool.name}`);
|
|
28339
28355
|
const tools = sanitizeToolsForGoogle(params);
|
|
28340
|
-
log$
|
|
28356
|
+
log$7.info("google tool schema snapshot", {
|
|
28341
28357
|
provider: params.provider,
|
|
28342
28358
|
toolCount: tools.length,
|
|
28343
28359
|
tools: toolNames
|
|
28344
28360
|
});
|
|
28345
28361
|
for (const [index, tool] of tools.entries()) {
|
|
28346
28362
|
const violations = findUnsupportedSchemaKeywords(tool.parameters, `${tool.name}.parameters`);
|
|
28347
|
-
if (violations.length > 0) log$
|
|
28363
|
+
if (violations.length > 0) log$7.warn("google tool schema has unsupported keywords", {
|
|
28348
28364
|
index,
|
|
28349
28365
|
tool: tool.name,
|
|
28350
28366
|
violations: violations.slice(0, 12),
|
|
@@ -28356,7 +28372,7 @@ const compactionFailureEmitter = new EventEmitter();
|
|
|
28356
28372
|
registerUnhandledRejectionHandler((reason) => {
|
|
28357
28373
|
const message = describeUnknownError(reason);
|
|
28358
28374
|
if (!isCompactionFailureError(message)) return false;
|
|
28359
|
-
log$
|
|
28375
|
+
log$7.error(`Auto-compaction failed (unhandled): ${message}`);
|
|
28360
28376
|
compactionFailureEmitter.emit("failure", message);
|
|
28361
28377
|
return true;
|
|
28362
28378
|
});
|
|
@@ -28408,7 +28424,7 @@ function applyGoogleTurnOrderingFix(params) {
|
|
|
28408
28424
|
const sanitized = sanitizeGoogleTurnOrdering(params.messages);
|
|
28409
28425
|
const didPrepend = sanitized !== params.messages;
|
|
28410
28426
|
if (didPrepend && !hasGoogleTurnOrderingMarker(params.sessionManager)) {
|
|
28411
|
-
(params.warn ?? ((message) => log$
|
|
28427
|
+
(params.warn ?? ((message) => log$7.warn(message)))(`google turn ordering fixup: prepended user bootstrap (sessionId=${params.sessionId})`);
|
|
28412
28428
|
markGoogleTurnOrderingMarker(params.sessionManager);
|
|
28413
28429
|
}
|
|
28414
28430
|
return {
|
|
@@ -29031,7 +29047,7 @@ function isImageExtension(filePath) {
|
|
|
29031
29047
|
}
|
|
29032
29048
|
async function sanitizeImagesWithLog(images, label, imageSanitization) {
|
|
29033
29049
|
const { images: sanitized, dropped } = await sanitizeImageBlocks(images, label, imageSanitization);
|
|
29034
|
-
if (dropped > 0) log$
|
|
29050
|
+
if (dropped > 0) log$7.warn(`Native image: dropped ${dropped} image(s) after sanitization (${label}).`);
|
|
29035
29051
|
return sanitized;
|
|
29036
29052
|
}
|
|
29037
29053
|
/**
|
|
@@ -29106,7 +29122,7 @@ async function loadImageFromRef(ref, workspaceDir, options) {
|
|
|
29106
29122
|
try {
|
|
29107
29123
|
let targetPath = ref.resolved;
|
|
29108
29124
|
if (ref.type === "url") {
|
|
29109
|
-
log$
|
|
29125
|
+
log$7.debug(`Native image: rejecting remote URL (local-only): ${ref.resolved}`);
|
|
29110
29126
|
return null;
|
|
29111
29127
|
}
|
|
29112
29128
|
if (ref.type === "path") {
|
|
@@ -29116,7 +29132,7 @@ async function loadImageFromRef(ref, workspaceDir, options) {
|
|
|
29116
29132
|
cwd: options.sandbox.root
|
|
29117
29133
|
}).hostPath;
|
|
29118
29134
|
} catch (err) {
|
|
29119
|
-
log$
|
|
29135
|
+
log$7.debug(`Native image: sandbox validation failed for ${ref.resolved}: ${err instanceof Error ? err.message : String(err)}`);
|
|
29120
29136
|
return null;
|
|
29121
29137
|
}
|
|
29122
29138
|
else if (!path.isAbsolute(targetPath)) targetPath = path.resolve(workspaceDir, targetPath);
|
|
@@ -29130,7 +29146,7 @@ async function loadImageFromRef(ref, workspaceDir, options) {
|
|
|
29130
29146
|
})
|
|
29131
29147
|
}) : await loadWebMedia(targetPath, options?.maxBytes);
|
|
29132
29148
|
if (media.kind !== "image") {
|
|
29133
|
-
log$
|
|
29149
|
+
log$7.debug(`Native image: not an image file: ${targetPath} (got ${media.kind})`);
|
|
29134
29150
|
return null;
|
|
29135
29151
|
}
|
|
29136
29152
|
const mimeType = media.contentType ?? "image/jpeg";
|
|
@@ -29140,7 +29156,7 @@ async function loadImageFromRef(ref, workspaceDir, options) {
|
|
|
29140
29156
|
mimeType
|
|
29141
29157
|
};
|
|
29142
29158
|
} catch (err) {
|
|
29143
|
-
log$
|
|
29159
|
+
log$7.debug(`Native image: failed to load ${ref.resolved}: ${err instanceof Error ? err.message : String(err)}`);
|
|
29144
29160
|
return null;
|
|
29145
29161
|
}
|
|
29146
29162
|
}
|
|
@@ -29239,7 +29255,7 @@ async function detectAndLoadPromptImages(params) {
|
|
|
29239
29255
|
loadedCount: 0,
|
|
29240
29256
|
skippedCount: 0
|
|
29241
29257
|
};
|
|
29242
|
-
log$
|
|
29258
|
+
log$7.debug(`Native image: detected ${allRefs.length} image refs (${promptRefs.length} in prompt, ${uniqueHistoryRefs.length} in history)`);
|
|
29243
29259
|
const promptImages = [...params.existingImages ?? []];
|
|
29244
29260
|
const historyImagesByIndex = /* @__PURE__ */ new Map();
|
|
29245
29261
|
let loadedCount = 0;
|
|
@@ -29256,7 +29272,7 @@ async function detectAndLoadPromptImages(params) {
|
|
|
29256
29272
|
else historyImagesByIndex.set(ref.messageIndex, [image]);
|
|
29257
29273
|
} else promptImages.push(image);
|
|
29258
29274
|
loadedCount++;
|
|
29259
|
-
log$
|
|
29275
|
+
log$7.debug(`Native image: loaded ${ref.type} ${ref.resolved}`);
|
|
29260
29276
|
} else skippedCount++;
|
|
29261
29277
|
}
|
|
29262
29278
|
const imageSanitization = { maxDimensionPx: params.maxDimensionPx };
|
|
@@ -29352,7 +29368,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
29352
29368
|
const resolvedWorkspace = resolveUserPath(params.workspaceDir);
|
|
29353
29369
|
const prevCwd = process.cwd();
|
|
29354
29370
|
const runAbortController = new AbortController();
|
|
29355
|
-
log$
|
|
29371
|
+
log$7.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"}`);
|
|
29356
29372
|
await fs$1.mkdir(resolvedWorkspace, { recursive: true });
|
|
29357
29373
|
const sandboxSessionKey = params.sessionKey?.trim() || params.sessionId;
|
|
29358
29374
|
const sandbox = await resolveSandboxContext({
|
|
@@ -29388,7 +29404,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
29388
29404
|
sessionId: params.sessionId,
|
|
29389
29405
|
warn: makeBootstrapWarn({
|
|
29390
29406
|
sessionLabel,
|
|
29391
|
-
warn: (message) => log$
|
|
29407
|
+
warn: (message) => log$7.warn(message)
|
|
29392
29408
|
})
|
|
29393
29409
|
});
|
|
29394
29410
|
const workspaceNotes = hookAdjustedBootstrapFiles.some((file) => file.name === DEFAULT_BOOTSTRAP_FILENAME && !file.missing) ? ["Reminder: commit your changes in this workspace after edits."] : void 0;
|
|
@@ -29575,7 +29591,9 @@ async function runEmbeddedAttempt(params) {
|
|
|
29575
29591
|
skillsPrompt,
|
|
29576
29592
|
tools
|
|
29577
29593
|
});
|
|
29578
|
-
const
|
|
29594
|
+
const profileModelKey = params.modelId ?? "";
|
|
29595
|
+
const modelProfile = resolveModelProfile(profileModelKey, params.config?.models?.profiles);
|
|
29596
|
+
log$7.debug(`[profile] resolved: modelId=${profileModelKey} → profile=${modelProfile.label} validateToolArgs=${modelProfile.filters?.validateToolArgs ?? false}`);
|
|
29579
29597
|
const systemPromptText = createSystemPromptOverride(appendPrompt + (modelProfile.promptAdditions.length > 0 ? "\n\n" + modelProfile.promptAdditions.join("\n") : ""))();
|
|
29580
29598
|
const sessionLock = await acquireSessionWriteLock({
|
|
29581
29599
|
sessionFile: params.sessionFile,
|
|
@@ -29587,7 +29605,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
29587
29605
|
try {
|
|
29588
29606
|
await repairSessionFileIfNeeded({
|
|
29589
29607
|
sessionFile: params.sessionFile,
|
|
29590
|
-
warn: (message) => log$
|
|
29608
|
+
warn: (message) => log$7.warn(message)
|
|
29591
29609
|
});
|
|
29592
29610
|
const hadSessionFile = await fs$1.stat(params.sessionFile).then(() => true).catch(() => false);
|
|
29593
29611
|
const transcriptPolicy = resolveTranscriptPolicy({
|
|
@@ -29596,7 +29614,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
29596
29614
|
modelId: params.modelId
|
|
29597
29615
|
});
|
|
29598
29616
|
const versionCheck = await handleSessionVersion(params.sessionFile);
|
|
29599
|
-
if (versionCheck.archived) log$
|
|
29617
|
+
if (versionCheck.archived) log$7.warn(`session archived: created by ${versionCheck.poisonVersion}, known corruption range → ${versionCheck.archivePath}`);
|
|
29600
29618
|
await prewarmSessionFile(params.sessionFile);
|
|
29601
29619
|
sessionManager = guardSessionManager(SessionManager.open(params.sessionFile), {
|
|
29602
29620
|
agentId: sessionAgentId,
|
|
@@ -29640,6 +29658,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
29640
29658
|
sandboxEnabled: !!sandbox?.enabled
|
|
29641
29659
|
});
|
|
29642
29660
|
const builtInTools = wrapToolsWithArgValidation(rawBuiltInTools, modelProfile);
|
|
29661
|
+
log$7.debug(`[tool-validate] profile=${modelProfile.label} validateToolArgs=${modelProfile.filters?.validateToolArgs ?? false} builtInTools=${builtInTools.length} toolNames=${builtInTools.map((t) => t.name).join(",")}`);
|
|
29643
29662
|
let clientToolCallDetected = null;
|
|
29644
29663
|
const clientToolLoopDetection = resolveToolLoopDetectionConfig({
|
|
29645
29664
|
cfg: params.config,
|
|
@@ -29851,7 +29870,6 @@ async function runEmbeddedAttempt(params) {
|
|
|
29851
29870
|
const TOOL_ERROR_ABORT_THRESHOLD = 5;
|
|
29852
29871
|
const TOOL_ERROR_WARN_THRESHOLD = 3;
|
|
29853
29872
|
let consecutiveToolErrors = 0;
|
|
29854
|
-
let lastErrorToolName = "";
|
|
29855
29873
|
const subscription = subscribeEmbeddedPiSession({
|
|
29856
29874
|
session: activeSession,
|
|
29857
29875
|
runId: params.runId,
|
|
@@ -29875,26 +29893,23 @@ async function runEmbeddedAttempt(params) {
|
|
|
29875
29893
|
params.onAgentEvent?.(evt);
|
|
29876
29894
|
if (evt.stream === "tool" && !aborted) {
|
|
29877
29895
|
const phase = typeof evt.data?.phase === "string" ? evt.data.phase : "";
|
|
29878
|
-
const toolName = typeof evt.data?.name === "string" ? evt.data.name : "";
|
|
29879
29896
|
const isError = evt.data?.isError === true;
|
|
29880
|
-
if (phase === "result"
|
|
29881
|
-
if (isError
|
|
29882
|
-
else
|
|
29883
|
-
consecutiveToolErrors = 1;
|
|
29884
|
-
lastErrorToolName = toolName;
|
|
29885
|
-
} else {
|
|
29886
|
-
consecutiveToolErrors = 0;
|
|
29887
|
-
lastErrorToolName = "";
|
|
29888
|
-
}
|
|
29897
|
+
if (phase === "result") {
|
|
29898
|
+
if (isError) consecutiveToolErrors++;
|
|
29899
|
+
else consecutiveToolErrors = 0;
|
|
29889
29900
|
if (consecutiveToolErrors >= TOOL_ERROR_ABORT_THRESHOLD) {
|
|
29890
|
-
|
|
29891
|
-
|
|
29892
|
-
|
|
29901
|
+
const toolName = typeof evt.data?.name === "string" ? evt.data.name : "unknown";
|
|
29902
|
+
log$7.error(`Agent-loop circuit breaker: ${consecutiveToolErrors} consecutive tool errors (last: ${toolName}). Aborting run ${params.runId}.`);
|
|
29903
|
+
abortRun(false, /* @__PURE__ */ new Error(`${consecutiveToolErrors} consecutive tool errors. The model may be generating corrupted tool arguments. Run aborted to prevent infinite loop.`));
|
|
29904
|
+
} else if (consecutiveToolErrors === TOOL_ERROR_WARN_THRESHOLD) {
|
|
29905
|
+
const toolName = typeof evt.data?.name === "string" ? evt.data.name : "unknown";
|
|
29906
|
+
log$7.warn(`Agent-loop tool error warning: ${consecutiveToolErrors} consecutive failures (last: ${toolName}). runId=${params.runId}`);
|
|
29907
|
+
}
|
|
29893
29908
|
}
|
|
29894
29909
|
}
|
|
29895
29910
|
if (evt.stream === "assistant" && typeof evt.data?.text === "string" && !aborted) {
|
|
29896
29911
|
streamMonitor.onChunk(evt.data.text);
|
|
29897
|
-
if (streamMonitor.shouldStop()) log$
|
|
29912
|
+
if (streamMonitor.shouldStop()) log$7.debug(`stream monitor detection (log-only, no abort): runId=${params.runId} reason=${streamMonitor.getStopReason()}`);
|
|
29898
29913
|
}
|
|
29899
29914
|
},
|
|
29900
29915
|
enforceFinalTag: params.enforceFinalTag,
|
|
@@ -29914,7 +29929,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
29914
29929
|
let abortWarnTimer;
|
|
29915
29930
|
const isProbeSession = params.sessionId?.startsWith("probe-") ?? false;
|
|
29916
29931
|
const abortTimer = setTimeout(() => {
|
|
29917
|
-
if (!isProbeSession) log$
|
|
29932
|
+
if (!isProbeSession) log$7.warn(`embedded run timeout: runId=${params.runId} sessionId=${params.sessionId} timeoutMs=${params.timeoutMs}`);
|
|
29918
29933
|
if (shouldFlagCompactionTimeout({
|
|
29919
29934
|
isTimeout: true,
|
|
29920
29935
|
isCompactionPendingOrRetrying: subscription.isCompacting(),
|
|
@@ -29923,7 +29938,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
29923
29938
|
abortRun(true);
|
|
29924
29939
|
if (!abortWarnTimer) abortWarnTimer = setTimeout(() => {
|
|
29925
29940
|
if (!activeSession.isStreaming) return;
|
|
29926
|
-
if (!isProbeSession) log$
|
|
29941
|
+
if (!isProbeSession) log$7.warn(`embedded run abort still streaming: runId=${params.runId} sessionId=${params.sessionId}`);
|
|
29927
29942
|
}, 1e4);
|
|
29928
29943
|
}, Math.max(1, params.timeoutMs));
|
|
29929
29944
|
armSymipulseTimer = () => {
|
|
@@ -29931,7 +29946,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
29931
29946
|
clearSymipulseTimer();
|
|
29932
29947
|
symipulseTimer = setTimeout(() => {
|
|
29933
29948
|
if (aborted) return;
|
|
29934
|
-
if (!isProbeSession) log$
|
|
29949
|
+
if (!isProbeSession) log$7.warn(`symipulse timeout: runId=${params.runId} sessionId=${params.sessionId} symipulseMs=${symipulseMs} (no activity)`);
|
|
29935
29950
|
if (shouldFlagCompactionTimeout({
|
|
29936
29951
|
isTimeout: true,
|
|
29937
29952
|
isCompactionPendingOrRetrying: subscription.isCompacting(),
|
|
@@ -29975,13 +29990,13 @@ async function runEmbeddedAttempt(params) {
|
|
|
29975
29990
|
prompt: params.prompt,
|
|
29976
29991
|
messages: activeSession.messages
|
|
29977
29992
|
}, hookCtx).catch((hookErr) => {
|
|
29978
|
-
log$
|
|
29993
|
+
log$7.warn(`before_prompt_build hook failed: ${String(hookErr)}`);
|
|
29979
29994
|
}) : void 0;
|
|
29980
29995
|
const legacyResult = hookRunner?.hasHooks("before_agent_start") ? await hookRunner.runBeforeAgentStart({
|
|
29981
29996
|
prompt: params.prompt,
|
|
29982
29997
|
messages: activeSession.messages
|
|
29983
29998
|
}, hookCtx).catch((hookErr) => {
|
|
29984
|
-
log$
|
|
29999
|
+
log$7.warn(`before_agent_start hook (legacy prompt build path) failed: ${String(hookErr)}`);
|
|
29985
30000
|
}) : void 0;
|
|
29986
30001
|
const hookResult = {
|
|
29987
30002
|
systemPrompt: promptBuildResult?.systemPrompt ?? legacyResult?.systemPrompt,
|
|
@@ -29989,7 +30004,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
29989
30004
|
};
|
|
29990
30005
|
if (hookResult?.prependContext) {
|
|
29991
30006
|
effectivePrompt = `${hookResult.prependContext}\n\n${params.prompt}`;
|
|
29992
|
-
log$
|
|
30007
|
+
log$7.debug(`hooks: prepended context to prompt (${hookResult.prependContext.length} chars)`);
|
|
29993
30008
|
}
|
|
29994
30009
|
{
|
|
29995
30010
|
const autoRecallAgentId = normalizeAgentId(params.sessionKey);
|
|
@@ -30006,11 +30021,11 @@ async function runEmbeddedAttempt(params) {
|
|
|
30006
30021
|
if (recallResults.length > 0) {
|
|
30007
30022
|
const recallBlock = `<memory_context>\nThe following memory snippets were automatically retrieved as relevant context:\n\n${recallResults.map((r) => `[${r.path}#L${r.startLine}-L${r.endLine}]\n${r.snippet}`).join("\n---\n")}\n</memory_context>`;
|
|
30008
30023
|
effectivePrompt = `${recallBlock}\n\n${effectivePrompt}`;
|
|
30009
|
-
log$
|
|
30024
|
+
log$7.debug(`auto-recall: injected ${recallResults.length} snippets (${recallBlock.length} chars)`);
|
|
30010
30025
|
}
|
|
30011
30026
|
}
|
|
30012
30027
|
} catch (recallErr) {
|
|
30013
|
-
log$
|
|
30028
|
+
log$7.debug(`auto-recall: skipped (${String(recallErr)})`);
|
|
30014
30029
|
}
|
|
30015
30030
|
}
|
|
30016
30031
|
{
|
|
@@ -30022,10 +30037,10 @@ async function runEmbeddedAttempt(params) {
|
|
|
30022
30037
|
if (planResult.enter) {
|
|
30023
30038
|
if (planResult.stripped != null) effectivePrompt = planResult.stripped;
|
|
30024
30039
|
effectivePrompt = `${PLAN_MODE_SYSTEM_PROMPT}\n\n${effectivePrompt}`;
|
|
30025
|
-
log$
|
|
30040
|
+
log$7.info(`plan-mode: activated (${planResult.reason}) for runId=${params.runId}`);
|
|
30026
30041
|
} else if (planResult.stripped != null) effectivePrompt = planResult.stripped;
|
|
30027
30042
|
}
|
|
30028
|
-
log$
|
|
30043
|
+
log$7.debug(`embedded run prompt start: runId=${params.runId} sessionId=${params.sessionId}`);
|
|
30029
30044
|
cacheTrace?.recordStage("prompt:before", {
|
|
30030
30045
|
prompt: effectivePrompt,
|
|
30031
30046
|
messages: activeSession.messages
|
|
@@ -30037,7 +30052,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
30037
30052
|
const sessionContext = sessionManager.buildSessionContext();
|
|
30038
30053
|
const sanitizedOrphan = transcriptPolicy.sanitizeThinkingSignatures ? sanitizeAntigravityThinkingBlocks(sessionContext.messages) : sessionContext.messages;
|
|
30039
30054
|
activeSession.agent.replaceMessages(sanitizedOrphan);
|
|
30040
|
-
log$
|
|
30055
|
+
log$7.warn(`Removed orphaned user message to prevent consecutive user turns. runId=${params.runId} sessionId=${params.sessionId}`);
|
|
30041
30056
|
}
|
|
30042
30057
|
try {
|
|
30043
30058
|
const imageResult = await detectAndLoadPromptImages({
|
|
@@ -30059,12 +30074,12 @@ async function runEmbeddedAttempt(params) {
|
|
|
30059
30074
|
messages: activeSession.messages,
|
|
30060
30075
|
note: `images: prompt=${imageResult.images.length} history=${imageResult.historyImagesByIndex.size}`
|
|
30061
30076
|
});
|
|
30062
|
-
if (log$
|
|
30077
|
+
if (log$7.isEnabled("debug")) {
|
|
30063
30078
|
const msgCount = activeSession.messages.length;
|
|
30064
30079
|
const systemLen = systemPromptText?.length ?? 0;
|
|
30065
30080
|
const promptLen = effectivePrompt.length;
|
|
30066
30081
|
const sessionSummary = summarizeSessionContext(activeSession.messages);
|
|
30067
|
-
log$
|
|
30082
|
+
log$7.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} historyImageMessages=${imageResult.historyImagesByIndex.size} provider=${params.provider}/${params.modelId} sessionFile=${params.sessionFile}`);
|
|
30068
30083
|
}
|
|
30069
30084
|
if (hookRunner?.hasHooks("llm_input")) hookRunner.runLlmInput({
|
|
30070
30085
|
runId: params.runId,
|
|
@@ -30082,7 +30097,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
30082
30097
|
workspaceDir: params.workspaceDir,
|
|
30083
30098
|
messageProvider: params.messageProvider ?? void 0
|
|
30084
30099
|
}).catch((err) => {
|
|
30085
|
-
log$
|
|
30100
|
+
log$7.warn(`llm_input hook failed: ${String(err)}`);
|
|
30086
30101
|
});
|
|
30087
30102
|
if (imageResult.images.length > 0) await abortable(activeSession.prompt(effectivePrompt, { images: imageResult.images }));
|
|
30088
30103
|
else await abortable(activeSession.prompt(effectivePrompt));
|
|
@@ -30090,7 +30105,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
30090
30105
|
promptError = err;
|
|
30091
30106
|
promptErrorSource = "prompt";
|
|
30092
30107
|
} finally {
|
|
30093
|
-
log$
|
|
30108
|
+
log$7.debug(`embedded run prompt end: runId=${params.runId} sessionId=${params.sessionId} durationMs=${Date.now() - promptStartedAt}`);
|
|
30094
30109
|
}
|
|
30095
30110
|
const wasCompactingBefore = activeSession.isCompacting;
|
|
30096
30111
|
const snapshot = activeSession.messages.slice();
|
|
@@ -30105,7 +30120,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
30105
30120
|
promptError = err;
|
|
30106
30121
|
promptErrorSource = "compaction";
|
|
30107
30122
|
}
|
|
30108
|
-
if (!isProbeSession) log$
|
|
30123
|
+
if (!isProbeSession) log$7.debug(`compaction wait aborted: runId=${params.runId} sessionId=${params.sessionId}`);
|
|
30109
30124
|
} else throw err;
|
|
30110
30125
|
}
|
|
30111
30126
|
if (!timedOutDuringCompaction) {
|
|
@@ -30123,7 +30138,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
30123
30138
|
currentSessionId: activeSession.sessionId
|
|
30124
30139
|
});
|
|
30125
30140
|
if (timedOutDuringCompaction) {
|
|
30126
|
-
if (!isProbeSession) log$
|
|
30141
|
+
if (!isProbeSession) log$7.warn(`using ${snapshotSelection.source} snapshot: timed out during compaction runId=${params.runId} sessionId=${params.sessionId}`);
|
|
30127
30142
|
}
|
|
30128
30143
|
messagesSnapshot = snapshotSelection.messagesSnapshot;
|
|
30129
30144
|
sessionIdUsed = snapshotSelection.sessionIdUsed;
|
|
@@ -30138,7 +30153,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
30138
30153
|
error: describeUnknownError(promptError)
|
|
30139
30154
|
});
|
|
30140
30155
|
} catch (entryErr) {
|
|
30141
|
-
log$
|
|
30156
|
+
log$7.warn(`failed to persist prompt error entry: ${String(entryErr)}`);
|
|
30142
30157
|
}
|
|
30143
30158
|
cacheTrace?.recordStage("session:after", {
|
|
30144
30159
|
messages: messagesSnapshot,
|
|
@@ -30157,17 +30172,17 @@ async function runEmbeddedAttempt(params) {
|
|
|
30157
30172
|
workspaceDir: params.workspaceDir,
|
|
30158
30173
|
messageProvider: params.messageProvider ?? void 0
|
|
30159
30174
|
}).catch((err) => {
|
|
30160
|
-
log$
|
|
30175
|
+
log$7.warn(`agent_end hook failed: ${err}`);
|
|
30161
30176
|
});
|
|
30162
30177
|
} finally {
|
|
30163
30178
|
clearTimeout(abortTimer);
|
|
30164
30179
|
clearSymipulseTimer();
|
|
30165
30180
|
if (abortWarnTimer) clearTimeout(abortWarnTimer);
|
|
30166
|
-
if (!isProbeSession && (aborted || timedOut) && !timedOutDuringCompaction) log$
|
|
30181
|
+
if (!isProbeSession && (aborted || timedOut) && !timedOutDuringCompaction) log$7.debug(`run cleanup: runId=${params.runId} sessionId=${params.sessionId} aborted=${aborted} timedOut=${timedOut}`);
|
|
30167
30182
|
try {
|
|
30168
30183
|
unsubscribe();
|
|
30169
30184
|
} catch (err) {
|
|
30170
|
-
log$
|
|
30185
|
+
log$7.error(`CRITICAL: unsubscribe failed, possible resource leak: runId=${params.runId} ${String(err)}`);
|
|
30171
30186
|
}
|
|
30172
30187
|
clearActiveEmbeddedRun(params.sessionId, queueHandle, params.sessionKey);
|
|
30173
30188
|
params.abortSignal?.removeEventListener?.("abort", onAbort);
|
|
@@ -30192,7 +30207,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
30192
30207
|
workspaceDir: params.workspaceDir,
|
|
30193
30208
|
messageProvider: params.messageProvider ?? void 0
|
|
30194
30209
|
}).catch((err) => {
|
|
30195
|
-
log$
|
|
30210
|
+
log$7.warn(`llm_output hook failed: ${String(err)}`);
|
|
30196
30211
|
});
|
|
30197
30212
|
return {
|
|
30198
30213
|
aborted,
|
|
@@ -30453,7 +30468,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
30453
30468
|
const redactedSessionId = redactRunIdentifier(params.sessionId);
|
|
30454
30469
|
const redactedSessionKey = redactRunIdentifier(params.sessionKey);
|
|
30455
30470
|
const redactedWorkspace = redactRunIdentifier(resolvedWorkspace);
|
|
30456
|
-
if (workspaceResolution.usedFallback) log$
|
|
30471
|
+
if (workspaceResolution.usedFallback) log$7.warn(`[workspace-fallback] caller=runEmbeddedPiAgent reason=${workspaceResolution.fallbackReason} run=${params.runId} session=${redactedSessionId} sessionKey=${redactedSessionKey} agent=${workspaceResolution.agentId} workspace=${redactedWorkspace}`);
|
|
30457
30472
|
const prevCwd = process.cwd();
|
|
30458
30473
|
let provider = (params.provider ?? DEFAULT_PROVIDER).trim() || DEFAULT_PROVIDER;
|
|
30459
30474
|
let modelId = (params.model ?? DEFAULT_MODEL).trim() || DEFAULT_MODEL;
|
|
@@ -30472,7 +30487,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
30472
30487
|
if (hookRunner?.hasHooks("before_model_resolve")) try {
|
|
30473
30488
|
modelResolveOverride = await hookRunner.runBeforeModelResolve({ prompt: params.prompt }, hookCtx);
|
|
30474
30489
|
} catch (hookErr) {
|
|
30475
|
-
log$
|
|
30490
|
+
log$7.warn(`before_model_resolve hook failed: ${String(hookErr)}`);
|
|
30476
30491
|
}
|
|
30477
30492
|
if (hookRunner?.hasHooks("before_agent_start")) try {
|
|
30478
30493
|
const legacyResult = await hookRunner.runBeforeAgentStart({ prompt: params.prompt }, hookCtx);
|
|
@@ -30481,15 +30496,15 @@ async function runEmbeddedPiAgent(params) {
|
|
|
30481
30496
|
modelOverride: modelResolveOverride?.modelOverride ?? legacyResult?.modelOverride
|
|
30482
30497
|
};
|
|
30483
30498
|
} catch (hookErr) {
|
|
30484
|
-
log$
|
|
30499
|
+
log$7.warn(`before_agent_start hook (legacy model resolve path) failed: ${String(hookErr)}`);
|
|
30485
30500
|
}
|
|
30486
30501
|
if (modelResolveOverride?.providerOverride) {
|
|
30487
30502
|
provider = modelResolveOverride.providerOverride;
|
|
30488
|
-
log$
|
|
30503
|
+
log$7.info(`[hooks] provider overridden to ${provider}`);
|
|
30489
30504
|
}
|
|
30490
30505
|
if (modelResolveOverride?.modelOverride) {
|
|
30491
30506
|
modelId = modelResolveOverride.modelOverride;
|
|
30492
|
-
log$
|
|
30507
|
+
log$7.info(`[hooks] model overridden to ${modelId}`);
|
|
30493
30508
|
}
|
|
30494
30509
|
const { model, error, authStorage, modelRegistry } = resolveModel(provider, modelId, agentDir, params.config);
|
|
30495
30510
|
if (!model) throw new FailoverError(error ?? `Unknown model: ${provider}/${modelId}`, {
|
|
@@ -30509,9 +30524,9 @@ async function runEmbeddedPiAgent(params) {
|
|
|
30509
30524
|
warnBelowTokens: CONTEXT_WINDOW_WARN_BELOW_TOKENS,
|
|
30510
30525
|
hardMinTokens: CONTEXT_WINDOW_HARD_MIN_TOKENS
|
|
30511
30526
|
});
|
|
30512
|
-
if (ctxGuard.shouldWarn) log$
|
|
30527
|
+
if (ctxGuard.shouldWarn) log$7.warn(`low context window: ${provider}/${modelId} ctx=${ctxGuard.tokens} (warn<${CONTEXT_WINDOW_WARN_BELOW_TOKENS}) source=${ctxGuard.source}`);
|
|
30513
30528
|
if (ctxGuard.shouldBlock) {
|
|
30514
|
-
log$
|
|
30529
|
+
log$7.error(`blocked model (context window too small): ${provider}/${modelId} ctx=${ctxGuard.tokens} (min=${CONTEXT_WINDOW_HARD_MIN_TOKENS}) source=${ctxGuard.source}`);
|
|
30515
30530
|
throw new FailoverError(`Model context window too small (${ctxGuard.tokens} tokens). Minimum is ${CONTEXT_WINDOW_HARD_MIN_TOKENS}.`, {
|
|
30516
30531
|
reason: "unknown",
|
|
30517
30532
|
provider,
|
|
@@ -30641,7 +30656,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
30641
30656
|
while (true) {
|
|
30642
30657
|
if (runLoopIterations >= MAX_RUN_LOOP_ITERATIONS) {
|
|
30643
30658
|
const message = `Exceeded retry limit after ${runLoopIterations} attempts (max=${MAX_RUN_LOOP_ITERATIONS}).`;
|
|
30644
|
-
log$
|
|
30659
|
+
log$7.error(`[run-retry-limit] sessionKey=${params.sessionKey ?? params.sessionId} provider=${provider}/${modelId} attempts=${runLoopIterations} maxAttempts=${MAX_RUN_LOOP_ITERATIONS}`);
|
|
30645
30660
|
return {
|
|
30646
30661
|
payloads: [{
|
|
30647
30662
|
text: "Request failed after repeated internal retries. Please try again, or use /new to start a fresh session.",
|
|
@@ -30762,18 +30777,18 @@ async function runEmbeddedPiAgent(params) {
|
|
|
30762
30777
|
const overflowDiagId = createCompactionDiagId$1();
|
|
30763
30778
|
const errorText = contextOverflowError.text;
|
|
30764
30779
|
const msgCount = attempt.messagesSnapshot?.length ?? 0;
|
|
30765
|
-
log$
|
|
30780
|
+
log$7.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)}`);
|
|
30766
30781
|
const isCompactionFailure = isCompactionFailureError(errorText);
|
|
30767
30782
|
const hadAttemptLevelCompaction = attemptCompactionCount > 0;
|
|
30768
30783
|
if (!isCompactionFailure && hadAttemptLevelCompaction && overflowCompactionAttempts < MAX_OVERFLOW_COMPACTION_ATTEMPTS) {
|
|
30769
30784
|
overflowCompactionAttempts++;
|
|
30770
|
-
log$
|
|
30785
|
+
log$7.warn(`context overflow persisted after in-attempt compaction (attempt ${overflowCompactionAttempts}/${MAX_OVERFLOW_COMPACTION_ATTEMPTS}); retrying prompt without additional compaction for ${provider}/${modelId}`);
|
|
30771
30786
|
continue;
|
|
30772
30787
|
}
|
|
30773
30788
|
if (!isCompactionFailure && !hadAttemptLevelCompaction && overflowCompactionAttempts < MAX_OVERFLOW_COMPACTION_ATTEMPTS) {
|
|
30774
|
-
if (log$
|
|
30789
|
+
if (log$7.isEnabled("debug")) log$7.debug(`[compaction-diag] decision diagId=${overflowDiagId} branch=compact isCompactionFailure=${isCompactionFailure} hasOversizedToolResults=unknown attempt=${overflowCompactionAttempts + 1} maxAttempts=${MAX_OVERFLOW_COMPACTION_ATTEMPTS}`);
|
|
30775
30790
|
overflowCompactionAttempts++;
|
|
30776
|
-
log$
|
|
30791
|
+
log$7.warn(`context overflow detected (attempt ${overflowCompactionAttempts}/${MAX_OVERFLOW_COMPACTION_ATTEMPTS}); attempting auto-compaction for ${provider}/${modelId}`);
|
|
30777
30792
|
const compactResult = await compactEmbeddedPiSessionDirect({
|
|
30778
30793
|
sessionId: params.sessionId,
|
|
30779
30794
|
sessionKey: params.sessionKey,
|
|
@@ -30802,10 +30817,10 @@ async function runEmbeddedPiAgent(params) {
|
|
|
30802
30817
|
});
|
|
30803
30818
|
if (compactResult.compacted) {
|
|
30804
30819
|
autoCompactionCount += 1;
|
|
30805
|
-
log$
|
|
30820
|
+
log$7.info(`auto-compaction succeeded for ${provider}/${modelId}; retrying prompt`);
|
|
30806
30821
|
continue;
|
|
30807
30822
|
}
|
|
30808
|
-
log$
|
|
30823
|
+
log$7.warn(`auto-compaction failed for ${provider}/${modelId}: ${compactResult.reason ?? "nothing to compact"}`);
|
|
30809
30824
|
}
|
|
30810
30825
|
if (!toolResultTruncationAttempted) {
|
|
30811
30826
|
const contextWindowTokens = ctxInfo.tokens;
|
|
@@ -30814,9 +30829,9 @@ async function runEmbeddedPiAgent(params) {
|
|
|
30814
30829
|
contextWindowTokens
|
|
30815
30830
|
}) : false;
|
|
30816
30831
|
if (hasOversized) {
|
|
30817
|
-
if (log$
|
|
30832
|
+
if (log$7.isEnabled("debug")) log$7.debug(`[compaction-diag] decision diagId=${overflowDiagId} branch=truncate_tool_results isCompactionFailure=${isCompactionFailure} hasOversizedToolResults=${hasOversized} attempt=${overflowCompactionAttempts} maxAttempts=${MAX_OVERFLOW_COMPACTION_ATTEMPTS}`);
|
|
30818
30833
|
toolResultTruncationAttempted = true;
|
|
30819
|
-
log$
|
|
30834
|
+
log$7.warn(`[context-overflow-recovery] Attempting tool result truncation for ${provider}/${modelId} (contextWindow=${contextWindowTokens} tokens)`);
|
|
30820
30835
|
const truncResult = await truncateOversizedToolResultsInSession({
|
|
30821
30836
|
sessionFile: params.sessionFile,
|
|
30822
30837
|
contextWindowTokens,
|
|
@@ -30824,13 +30839,13 @@ async function runEmbeddedPiAgent(params) {
|
|
|
30824
30839
|
sessionKey: params.sessionKey
|
|
30825
30840
|
});
|
|
30826
30841
|
if (truncResult.truncated) {
|
|
30827
|
-
log$
|
|
30842
|
+
log$7.info(`[context-overflow-recovery] Truncated ${truncResult.truncatedCount} tool result(s); retrying prompt`);
|
|
30828
30843
|
continue;
|
|
30829
30844
|
}
|
|
30830
|
-
log$
|
|
30831
|
-
} else if (log$
|
|
30845
|
+
log$7.warn(`[context-overflow-recovery] Tool result truncation did not help: ${truncResult.reason ?? "unknown"}`);
|
|
30846
|
+
} else if (log$7.isEnabled("debug")) log$7.debug(`[compaction-diag] decision diagId=${overflowDiagId} branch=give_up isCompactionFailure=${isCompactionFailure} hasOversizedToolResults=${hasOversized} attempt=${overflowCompactionAttempts} maxAttempts=${MAX_OVERFLOW_COMPACTION_ATTEMPTS}`);
|
|
30832
30847
|
}
|
|
30833
|
-
if ((isCompactionFailure || overflowCompactionAttempts >= MAX_OVERFLOW_COMPACTION_ATTEMPTS || toolResultTruncationAttempted) && log$
|
|
30848
|
+
if ((isCompactionFailure || overflowCompactionAttempts >= MAX_OVERFLOW_COMPACTION_ATTEMPTS || toolResultTruncationAttempted) && log$7.isEnabled("debug")) log$7.debug(`[compaction-diag] decision diagId=${overflowDiagId} branch=give_up isCompactionFailure=${isCompactionFailure} hasOversizedToolResults=unknown attempt=${overflowCompactionAttempts} maxAttempts=${MAX_OVERFLOW_COMPACTION_ATTEMPTS}`);
|
|
30834
30849
|
const kind = isCompactionFailure ? "compaction_failure" : "context_overflow";
|
|
30835
30850
|
return {
|
|
30836
30851
|
payloads: [{
|
|
@@ -30911,7 +30926,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
30911
30926
|
attempted: attemptedThinking
|
|
30912
30927
|
});
|
|
30913
30928
|
if (fallbackThinking) {
|
|
30914
|
-
log$
|
|
30929
|
+
log$7.warn(`unsupported thinking level for ${provider}/${modelId}; retrying with ${fallbackThinking}`);
|
|
30915
30930
|
thinkLevel = fallbackThinking;
|
|
30916
30931
|
continue;
|
|
30917
30932
|
}
|
|
@@ -30929,7 +30944,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
30929
30944
|
attempted: attemptedThinking
|
|
30930
30945
|
});
|
|
30931
30946
|
if (fallbackThinking && !aborted) {
|
|
30932
|
-
log$
|
|
30947
|
+
log$7.warn(`unsupported thinking level for ${provider}/${modelId}; retrying with ${fallbackThinking}`);
|
|
30933
30948
|
thinkLevel = fallbackThinking;
|
|
30934
30949
|
continue;
|
|
30935
30950
|
}
|
|
@@ -30946,7 +30961,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
30946
30961
|
imageDimensionError.contentIndex !== void 0 ? `content=${imageDimensionError.contentIndex}` : null,
|
|
30947
30962
|
imageDimensionError.maxDimensionPx !== void 0 ? `limit=${imageDimensionError.maxDimensionPx}px` : null
|
|
30948
30963
|
].filter(Boolean).join(" ");
|
|
30949
|
-
log$
|
|
30964
|
+
log$7.warn(`Profile ${lastProfileId} rejected image payload${details ? ` (${details})` : ""}.`);
|
|
30950
30965
|
}
|
|
30951
30966
|
const isLocalOllamaTimeout = timedOut && model.api === "ollama";
|
|
30952
30967
|
if (!aborted && failoverFailure || timedOut && !timedOutDuringCompaction && !isLocalOllamaTimeout) {
|
|
@@ -30958,8 +30973,8 @@ async function runEmbeddedPiAgent(params) {
|
|
|
30958
30973
|
cfg: params.config,
|
|
30959
30974
|
agentDir: params.agentDir
|
|
30960
30975
|
});
|
|
30961
|
-
if (timedOut && !isProbeSession) log$
|
|
30962
|
-
if (cloudCodeAssistFormatError) log$
|
|
30976
|
+
if (timedOut && !isProbeSession) log$7.warn(`Profile ${lastProfileId} timed out (possible rate limit). Trying next account...`);
|
|
30977
|
+
if (cloudCodeAssistFormatError) log$7.warn(`Profile ${lastProfileId} hit Cloud Code Assist format error. Tool calls will be sanitized on retry.`);
|
|
30963
30978
|
}
|
|
30964
30979
|
if (await advanceAuthProfile()) continue;
|
|
30965
30980
|
if (fallbackConfigured) {
|
|
@@ -31025,7 +31040,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
31025
31040
|
const hasCodeBlocks = attempt.assistantTexts.some((text) => /```[\s\S]*?```/.test(text));
|
|
31026
31041
|
if (hasCodeToolUsage || hasCodeBlocks) {
|
|
31027
31042
|
verificationPassCompleted = true;
|
|
31028
|
-
log$
|
|
31043
|
+
log$7.debug(`[verification] starting verification pass: runId=${params.runId} sessionId=${params.sessionId} trigger=${hasCodeToolUsage ? "tool_usage" : "code_blocks"}`);
|
|
31029
31044
|
const verificationPrompt = "Review your response against the original user request. Check: (1) Did you address every requirement? (2) Did you include tests if requested? (3) Did you run and verify the code works? If you missed anything, fix it now. If everything looks correct, briefly confirm.";
|
|
31030
31045
|
try {
|
|
31031
31046
|
const verifyAttempt = await runEmbeddedAttempt({
|
|
@@ -31111,10 +31126,10 @@ async function runEmbeddedPiAgent(params) {
|
|
|
31111
31126
|
payloads.length = 0;
|
|
31112
31127
|
payloads.push(...verifyPayloads);
|
|
31113
31128
|
}
|
|
31114
|
-
log$
|
|
31115
|
-
} else log$
|
|
31129
|
+
log$7.debug(`[verification] verification produced corrections: runId=${params.runId} tools=${verifyAttempt.toolMetas.length} texts=${verifyAttempt.assistantTexts.length}`);
|
|
31130
|
+
} else log$7.debug(`[verification] verification confirmed original response: runId=${params.runId}`);
|
|
31116
31131
|
} catch (verifyErr) {
|
|
31117
|
-
log$
|
|
31132
|
+
log$7.warn(`[verification] verification pass failed, keeping original response: runId=${params.runId} error=${String(verifyErr)}`);
|
|
31118
31133
|
}
|
|
31119
31134
|
}
|
|
31120
31135
|
}
|
|
@@ -31135,7 +31150,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
31135
31150
|
messagingToolSentTargets: attempt.messagingToolSentTargets,
|
|
31136
31151
|
successfulCronAdds: attempt.successfulCronAdds
|
|
31137
31152
|
};
|
|
31138
|
-
log$
|
|
31153
|
+
log$7.debug(`embedded run done: runId=${params.runId} sessionId=${params.sessionId} durationMs=${Date.now() - started} aborted=${aborted}`);
|
|
31139
31154
|
if (lastProfileId) {
|
|
31140
31155
|
await markAuthProfileGood({
|
|
31141
31156
|
store: authStore,
|
|
@@ -31387,7 +31402,7 @@ async function runAgentTurn(params) {
|
|
|
31387
31402
|
function createDefaultDeps() {
|
|
31388
31403
|
return {
|
|
31389
31404
|
sendMessageWhatsApp: async (...args) => {
|
|
31390
|
-
const { sendMessageWhatsApp } = await import("./web-
|
|
31405
|
+
const { sendMessageWhatsApp } = await import("./web-Dtu6w-WL.js");
|
|
31391
31406
|
return await sendMessageWhatsApp(...args);
|
|
31392
31407
|
},
|
|
31393
31408
|
sendMessageTelegram: async (...args) => {
|
|
@@ -49818,7 +49833,7 @@ function loadWebLoginQr() {
|
|
|
49818
49833
|
return webLoginQrPromise;
|
|
49819
49834
|
}
|
|
49820
49835
|
function loadWebChannel() {
|
|
49821
|
-
webChannelPromise ??= import("./web-
|
|
49836
|
+
webChannelPromise ??= import("./web-Dtu6w-WL.js");
|
|
49822
49837
|
return webChannelPromise;
|
|
49823
49838
|
}
|
|
49824
49839
|
function loadWhatsAppActions() {
|
|
@@ -64669,7 +64684,7 @@ async function compactEmbeddedPiSessionDirect(params) {
|
|
|
64669
64684
|
const provider = (params.provider ?? DEFAULT_PROVIDER).trim() || DEFAULT_PROVIDER;
|
|
64670
64685
|
const modelId = (params.model ?? DEFAULT_MODEL).trim() || DEFAULT_MODEL;
|
|
64671
64686
|
const fail = (reason) => {
|
|
64672
|
-
log$
|
|
64687
|
+
log$7.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}`);
|
|
64673
64688
|
return {
|
|
64674
64689
|
ok: false,
|
|
64675
64690
|
compacted: false,
|
|
@@ -64737,7 +64752,7 @@ async function compactEmbeddedPiSessionDirect(params) {
|
|
|
64737
64752
|
sessionId: params.sessionId,
|
|
64738
64753
|
warn: makeBootstrapWarn({
|
|
64739
64754
|
sessionLabel,
|
|
64740
|
-
warn: (message) => log$
|
|
64755
|
+
warn: (message) => log$7.warn(message)
|
|
64741
64756
|
})
|
|
64742
64757
|
});
|
|
64743
64758
|
const runAbortController = new AbortController();
|
|
@@ -64877,7 +64892,7 @@ async function compactEmbeddedPiSessionDirect(params) {
|
|
|
64877
64892
|
try {
|
|
64878
64893
|
await repairSessionFileIfNeeded({
|
|
64879
64894
|
sessionFile: params.sessionFile,
|
|
64880
|
-
warn: (message) => log$
|
|
64895
|
+
warn: (message) => log$7.warn(message)
|
|
64881
64896
|
});
|
|
64882
64897
|
await prewarmSessionFile(params.sessionFile);
|
|
64883
64898
|
const transcriptPolicy = resolveTranscriptPolicy({
|
|
@@ -64962,13 +64977,13 @@ async function compactEmbeddedPiSessionDirect(params) {
|
|
|
64962
64977
|
messages: preCompactionMessages,
|
|
64963
64978
|
sessionFile: params.sessionFile
|
|
64964
64979
|
}, hookCtx).catch((hookErr) => {
|
|
64965
|
-
log$
|
|
64980
|
+
log$7.warn(`before_compaction hook failed: ${String(hookErr)}`);
|
|
64966
64981
|
});
|
|
64967
|
-
const diagEnabled = log$
|
|
64982
|
+
const diagEnabled = log$7.isEnabled("debug");
|
|
64968
64983
|
const preMetrics = diagEnabled ? summarizeCompactionMessages(session.messages) : void 0;
|
|
64969
64984
|
if (diagEnabled && preMetrics) {
|
|
64970
|
-
log$
|
|
64971
|
-
log$
|
|
64985
|
+
log$7.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"}`);
|
|
64986
|
+
log$7.debug(`[compaction-diag] contributors diagId=${diagId} top=${JSON.stringify(preMetrics.contributors)}`);
|
|
64972
64987
|
}
|
|
64973
64988
|
const compactStartedAt = Date.now();
|
|
64974
64989
|
const result = await compactWithSafetyTimeout(() => session.compact(params.customInstructions));
|
|
@@ -64986,10 +65001,10 @@ async function compactEmbeddedPiSessionDirect(params) {
|
|
|
64986
65001
|
compactedCount: limited.length - session.messages.length,
|
|
64987
65002
|
sessionFile: params.sessionFile
|
|
64988
65003
|
}, hookCtx).catch((hookErr) => {
|
|
64989
|
-
log$
|
|
65004
|
+
log$7.warn(`after_compaction hook failed: ${hookErr}`);
|
|
64990
65005
|
});
|
|
64991
65006
|
const postMetrics = diagEnabled ? summarizeCompactionMessages(session.messages) : void 0;
|
|
64992
|
-
if (diagEnabled && preMetrics && postMetrics) log$
|
|
65007
|
+
if (diagEnabled && preMetrics && postMetrics) log$7.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"}`);
|
|
64993
65008
|
return {
|
|
64994
65009
|
ok: true,
|
|
64995
65010
|
compacted: true,
|