@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
|
@@ -10695,7 +10695,7 @@ function createRunRegistry(options) {
|
|
|
10695
10695
|
|
|
10696
10696
|
//#endregion
|
|
10697
10697
|
//#region src/process/supervisor/supervisor.ts
|
|
10698
|
-
const log$
|
|
10698
|
+
const log$8 = createSubsystemLogger("process/supervisor");
|
|
10699
10699
|
function clampTimeout(value) {
|
|
10700
10700
|
if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) return;
|
|
10701
10701
|
return Math.max(1, Math.floor(value));
|
|
@@ -10881,7 +10881,7 @@ function createProcessSupervisor() {
|
|
|
10881
10881
|
exitCode: null,
|
|
10882
10882
|
exitSignal: null
|
|
10883
10883
|
});
|
|
10884
|
-
log$
|
|
10884
|
+
log$8.warn(`spawn failed: runId=${runId} reason=${String(err)}`);
|
|
10885
10885
|
throw err;
|
|
10886
10886
|
}
|
|
10887
10887
|
};
|
|
@@ -28903,7 +28903,7 @@ async function resolveAnnounceTarget(params) {
|
|
|
28903
28903
|
|
|
28904
28904
|
//#endregion
|
|
28905
28905
|
//#region src/agents/tools/sessions-send-tool.a2a.ts
|
|
28906
|
-
const log$
|
|
28906
|
+
const log$7 = createSubsystemLogger("agents/sessions-send");
|
|
28907
28907
|
async function runSessionsSendA2AFlow(params) {
|
|
28908
28908
|
const runContextId = params.waitRunId ?? "unknown";
|
|
28909
28909
|
try {
|
|
@@ -28994,7 +28994,7 @@ async function runSessionsSendA2AFlow(params) {
|
|
|
28994
28994
|
timeoutMs: 1e4
|
|
28995
28995
|
});
|
|
28996
28996
|
} catch (err) {
|
|
28997
|
-
log$
|
|
28997
|
+
log$7.warn("sessions_send announce delivery failed", {
|
|
28998
28998
|
runId: runContextId,
|
|
28999
28999
|
channel: announceTarget.channel,
|
|
29000
29000
|
to: announceTarget.to,
|
|
@@ -29002,7 +29002,7 @@ async function runSessionsSendA2AFlow(params) {
|
|
|
29002
29002
|
});
|
|
29003
29003
|
}
|
|
29004
29004
|
} catch (err) {
|
|
29005
|
-
log$
|
|
29005
|
+
log$7.warn("sessions_send announce flow failed", {
|
|
29006
29006
|
runId: runContextId,
|
|
29007
29007
|
error: formatErrorMessage(err)
|
|
29008
29008
|
});
|
|
@@ -32032,7 +32032,7 @@ function resolveRunWorkspaceDir(params) {
|
|
|
32032
32032
|
|
|
32033
32033
|
//#endregion
|
|
32034
32034
|
//#region src/agents/cli-runner.ts
|
|
32035
|
-
const log$
|
|
32035
|
+
const log$6 = createSubsystemLogger("agent/claude-cli");
|
|
32036
32036
|
async function runCliAgent(params) {
|
|
32037
32037
|
const started = Date.now();
|
|
32038
32038
|
const workspaceResolution = resolveRunWorkspaceDir({
|
|
@@ -32045,7 +32045,7 @@ async function runCliAgent(params) {
|
|
|
32045
32045
|
const redactedSessionId = redactRunIdentifier(params.sessionId);
|
|
32046
32046
|
const redactedSessionKey = redactRunIdentifier(params.sessionKey);
|
|
32047
32047
|
const redactedWorkspace = redactRunIdentifier(resolvedWorkspace);
|
|
32048
|
-
if (workspaceResolution.usedFallback) log$
|
|
32048
|
+
if (workspaceResolution.usedFallback) log$6.warn(`[workspace-fallback] caller=runCliAgent reason=${workspaceResolution.fallbackReason} run=${params.runId} session=${redactedSessionId} sessionKey=${redactedSessionKey} agent=${workspaceResolution.agentId} workspace=${redactedWorkspace}`);
|
|
32049
32049
|
const workspaceDir = resolvedWorkspace;
|
|
32050
32050
|
const backendResolved = resolveCliBackendConfig(params.provider, params.config);
|
|
32051
32051
|
if (!backendResolved) throw new Error(`Unknown CLI backend: ${params.provider}`);
|
|
@@ -32062,7 +32062,7 @@ async function runCliAgent(params) {
|
|
|
32062
32062
|
sessionId: params.sessionId,
|
|
32063
32063
|
warn: makeBootstrapWarn({
|
|
32064
32064
|
sessionLabel,
|
|
32065
|
-
warn: (message) => log$
|
|
32065
|
+
warn: (message) => log$6.warn(message)
|
|
32066
32066
|
})
|
|
32067
32067
|
});
|
|
32068
32068
|
const { defaultAgentId, sessionAgentId } = resolveSessionAgentIds({
|
|
@@ -32128,7 +32128,7 @@ async function runCliAgent(params) {
|
|
|
32128
32128
|
const queueKey = backend.serialize ?? true ? backendResolved.id : `${backendResolved.id}:${params.runId}`;
|
|
32129
32129
|
try {
|
|
32130
32130
|
const output = await enqueueCliRun(queueKey, async () => {
|
|
32131
|
-
log$
|
|
32131
|
+
log$6.info(`cli exec: provider=${params.provider} model=${normalizedModel} promptChars=${params.prompt.length}`);
|
|
32132
32132
|
const logOutputText = isTruthyEnvValue(process.env.SYMI_CLAUDE_CLI_LOG_OUTPUT);
|
|
32133
32133
|
if (logOutputText) {
|
|
32134
32134
|
const logArgs = [];
|
|
@@ -32161,7 +32161,7 @@ async function runCliAgent(params) {
|
|
|
32161
32161
|
const promptIndex = logArgs.indexOf(argsPrompt);
|
|
32162
32162
|
if (promptIndex >= 0) logArgs[promptIndex] = `<prompt:${argsPrompt.length} chars>`;
|
|
32163
32163
|
}
|
|
32164
|
-
log$
|
|
32164
|
+
log$6.info(`cli argv: ${backend.command} ${logArgs.join(" ")}`);
|
|
32165
32165
|
}
|
|
32166
32166
|
const env = (() => {
|
|
32167
32167
|
const next = {
|
|
@@ -32199,17 +32199,17 @@ async function runCliAgent(params) {
|
|
|
32199
32199
|
const stdout = result.stdout.trim();
|
|
32200
32200
|
const stderr = result.stderr.trim();
|
|
32201
32201
|
if (logOutputText) {
|
|
32202
|
-
if (stdout) log$
|
|
32203
|
-
if (stderr) log$
|
|
32202
|
+
if (stdout) log$6.info(`cli stdout:\n${stdout}`);
|
|
32203
|
+
if (stderr) log$6.info(`cli stderr:\n${stderr}`);
|
|
32204
32204
|
}
|
|
32205
32205
|
if (shouldLogVerbose()) {
|
|
32206
|
-
if (stdout) log$
|
|
32207
|
-
if (stderr) log$
|
|
32206
|
+
if (stdout) log$6.debug(`cli stdout:\n${stdout}`);
|
|
32207
|
+
if (stderr) log$6.debug(`cli stderr:\n${stderr}`);
|
|
32208
32208
|
}
|
|
32209
32209
|
if (result.exitCode !== 0 || result.reason !== "exit") {
|
|
32210
32210
|
if (result.reason === "no-output-timeout" || result.noOutputTimedOut) {
|
|
32211
32211
|
const timeoutReason = `CLI produced no output for ${Math.round(noOutputTimeoutMs / 1e3)}s and was terminated.`;
|
|
32212
|
-
log$
|
|
32212
|
+
log$6.warn(`cli watchdog timeout: provider=${params.provider} model=${modelId} session=${cliSessionIdToSend ?? params.sessionId} noOutputTimeoutMs=${noOutputTimeoutMs} pid=${managedRun.pid ?? "unknown"}`);
|
|
32213
32213
|
throw new FailoverError(timeoutReason, {
|
|
32214
32214
|
reason: "timeout",
|
|
32215
32215
|
provider: params.provider,
|
|
@@ -32528,7 +32528,7 @@ function resolveEmbeddedSessionLane(key) {
|
|
|
32528
32528
|
|
|
32529
32529
|
//#endregion
|
|
32530
32530
|
//#region src/agents/pi-embedded-runner/logger.ts
|
|
32531
|
-
const log$
|
|
32531
|
+
const log$5 = createSubsystemLogger("agent/embedded");
|
|
32532
32532
|
|
|
32533
32533
|
//#endregion
|
|
32534
32534
|
//#region src/utils/safe-json.ts
|
|
@@ -32574,7 +32574,7 @@ function getQueuedFileWriter(writers, filePath) {
|
|
|
32574
32574
|
//#endregion
|
|
32575
32575
|
//#region src/agents/anthropic-payload-log.ts
|
|
32576
32576
|
const writers$1 = /* @__PURE__ */ new Map();
|
|
32577
|
-
const log$
|
|
32577
|
+
const log$4 = createSubsystemLogger("agent/anthropic-payload");
|
|
32578
32578
|
function resolvePayloadLogConfig(env) {
|
|
32579
32579
|
const enabled = parseBooleanValue$1(env.SYMI_ANTHROPIC_PAYLOAD_LOG) ?? false;
|
|
32580
32580
|
const fileOverride = env.SYMI_ANTHROPIC_PAYLOAD_LOG_FILE?.trim();
|
|
@@ -32664,13 +32664,13 @@ function createAnthropicPayloadLogger(params) {
|
|
|
32664
32664
|
usage,
|
|
32665
32665
|
error: errorMessage
|
|
32666
32666
|
});
|
|
32667
|
-
log$
|
|
32667
|
+
log$4.info("anthropic usage", {
|
|
32668
32668
|
runId: params.runId,
|
|
32669
32669
|
sessionId: params.sessionId,
|
|
32670
32670
|
usage
|
|
32671
32671
|
});
|
|
32672
32672
|
};
|
|
32673
|
-
log$
|
|
32673
|
+
log$4.info("anthropic payload logger enabled", { filePath: writer.filePath });
|
|
32674
32674
|
return {
|
|
32675
32675
|
enabled: true,
|
|
32676
32676
|
wrapStreamFn,
|
|
@@ -34762,7 +34762,7 @@ function createEmbeddedPiSessionEventHandler(ctx) {
|
|
|
34762
34762
|
//#region src/agents/pi-embedded-subscribe.ts
|
|
34763
34763
|
const THINKING_TAG_SCAN_RE = /<\s*(\/?)\s*(?:think(?:ing)?|thought|antthinking)\s*>/gi;
|
|
34764
34764
|
const FINAL_TAG_SCAN_RE = /<\s*(\/?)\s*final\s*>/gi;
|
|
34765
|
-
const log$
|
|
34765
|
+
const log$3 = createSubsystemLogger("agent/embedded");
|
|
34766
34766
|
function subscribeEmbeddedPiSession(params) {
|
|
34767
34767
|
const reasoningMode = params.reasoningMode ?? "off";
|
|
34768
34768
|
const useMarkdown = (params.toolResultFormat ?? "markdown") === "markdown";
|
|
@@ -34919,7 +34919,7 @@ function subscribeEmbeddedPiSession(params) {
|
|
|
34919
34919
|
state.compactionRetryReject = reject;
|
|
34920
34920
|
});
|
|
34921
34921
|
state.compactionRetryPromise.catch((err) => {
|
|
34922
|
-
log$
|
|
34922
|
+
log$3.debug(`compaction promise rejected (no waiter): ${String(err)}`);
|
|
34923
34923
|
});
|
|
34924
34924
|
}
|
|
34925
34925
|
};
|
|
@@ -35071,7 +35071,7 @@ function subscribeEmbeddedPiSession(params) {
|
|
|
35071
35071
|
if (!chunk) return;
|
|
35072
35072
|
if (chunk === state.lastBlockReplyText) return;
|
|
35073
35073
|
if (isMessagingToolDuplicateNormalized(normalizeTextForComparison(chunk), messagingToolSentTextsNormalized)) {
|
|
35074
|
-
log$
|
|
35074
|
+
log$3.debug(`Skipping block reply - already sent via messaging tool: ${chunk.slice(0, 50)}...`);
|
|
35075
35075
|
return;
|
|
35076
35076
|
}
|
|
35077
35077
|
if (shouldSkipAssistantText(chunk)) return;
|
|
@@ -35149,7 +35149,7 @@ function subscribeEmbeddedPiSession(params) {
|
|
|
35149
35149
|
const ctx = {
|
|
35150
35150
|
params,
|
|
35151
35151
|
state,
|
|
35152
|
-
log: log$
|
|
35152
|
+
log: log$3,
|
|
35153
35153
|
blockChunking,
|
|
35154
35154
|
blockChunker,
|
|
35155
35155
|
hookRunner: params.hookRunner,
|
|
@@ -35182,7 +35182,7 @@ function subscribeEmbeddedPiSession(params) {
|
|
|
35182
35182
|
if (state.unsubscribed) return;
|
|
35183
35183
|
state.unsubscribed = true;
|
|
35184
35184
|
if (state.compactionRetryPromise) {
|
|
35185
|
-
log$
|
|
35185
|
+
log$3.debug(`unsubscribe: rejecting compaction wait runId=${params.runId}`);
|
|
35186
35186
|
const reject = state.compactionRetryReject;
|
|
35187
35187
|
state.compactionRetryResolve = void 0;
|
|
35188
35188
|
state.compactionRetryReject = void 0;
|
|
@@ -35192,11 +35192,11 @@ function subscribeEmbeddedPiSession(params) {
|
|
|
35192
35192
|
reject?.(abortErr);
|
|
35193
35193
|
}
|
|
35194
35194
|
if (params.session.isCompacting) {
|
|
35195
|
-
log$
|
|
35195
|
+
log$3.debug(`unsubscribe: aborting in-flight compaction runId=${params.runId}`);
|
|
35196
35196
|
try {
|
|
35197
35197
|
params.session.abortCompaction();
|
|
35198
35198
|
} catch (err) {
|
|
35199
|
-
log$
|
|
35199
|
+
log$3.warn(`unsubscribe: compaction abort failed runId=${params.runId} err=${String(err)}`);
|
|
35200
35200
|
}
|
|
35201
35201
|
}
|
|
35202
35202
|
sessionUnsubscribe();
|
|
@@ -35245,7 +35245,7 @@ function subscribeEmbeddedPiSession(params) {
|
|
|
35245
35245
|
|
|
35246
35246
|
//#endregion
|
|
35247
35247
|
//#region src/agents/pi-tools.before-tool-call.ts
|
|
35248
|
-
const log$
|
|
35248
|
+
const log$2 = createSubsystemLogger("agents/tools");
|
|
35249
35249
|
const BEFORE_TOOL_CALL_WRAPPED = Symbol("beforeToolCallWrapped");
|
|
35250
35250
|
const adjustedParamsByToolCallId = /* @__PURE__ */ new Map();
|
|
35251
35251
|
const MAX_TRACKED_ADJUSTED_PARAMS = 1024;
|
|
@@ -35279,7 +35279,7 @@ async function recordLoopOutcome(args) {
|
|
|
35279
35279
|
config: args.ctx.loopDetection
|
|
35280
35280
|
});
|
|
35281
35281
|
} catch (err) {
|
|
35282
|
-
log$
|
|
35282
|
+
log$2.warn(`tool loop outcome tracking failed: tool=${args.toolName} error=${String(err)}`);
|
|
35283
35283
|
}
|
|
35284
35284
|
}
|
|
35285
35285
|
async function runBeforeToolCallHook(args) {
|
|
@@ -35296,7 +35296,7 @@ async function runBeforeToolCallHook(args) {
|
|
|
35296
35296
|
const loopResult = detectToolCallLoop(sessionState, toolName, params, args.ctx.loopDetection);
|
|
35297
35297
|
if (loopResult.stuck) {
|
|
35298
35298
|
if (loopResult.level === "critical") {
|
|
35299
|
-
log$
|
|
35299
|
+
log$2.error(`Blocking ${toolName} due to critical loop: ${loopResult.message}`);
|
|
35300
35300
|
logToolLoopAction({
|
|
35301
35301
|
sessionKey: args.ctx.sessionKey,
|
|
35302
35302
|
sessionId: args.ctx?.agentId,
|
|
@@ -35313,7 +35313,7 @@ async function runBeforeToolCallHook(args) {
|
|
|
35313
35313
|
reason: loopResult.message
|
|
35314
35314
|
};
|
|
35315
35315
|
} else if (shouldEmitLoopWarning(sessionState, loopResult.warningKey ?? `${loopResult.detector}:${toolName}`, loopResult.count)) {
|
|
35316
|
-
log$
|
|
35316
|
+
log$2.warn(`Loop warning for ${toolName}: ${loopResult.message}`);
|
|
35317
35317
|
logToolLoopAction({
|
|
35318
35318
|
sessionKey: args.ctx.sessionKey,
|
|
35319
35319
|
sessionId: args.ctx?.agentId,
|
|
@@ -35363,7 +35363,7 @@ async function runBeforeToolCallHook(args) {
|
|
|
35363
35363
|
}
|
|
35364
35364
|
} catch (err) {
|
|
35365
35365
|
const toolCallId = args.toolCallId ? ` toolCallId=${args.toolCallId}` : "";
|
|
35366
|
-
log$
|
|
35366
|
+
log$2.warn(`before_tool_call hook failed: tool=${toolName}${toolCallId} error=${String(err)}`);
|
|
35367
35367
|
}
|
|
35368
35368
|
return {
|
|
35369
35369
|
blocked: false,
|
|
@@ -35607,6 +35607,7 @@ function validateShellCommand(command) {
|
|
|
35607
35607
|
|
|
35608
35608
|
//#endregion
|
|
35609
35609
|
//#region src/agents/pi-tools.validate-wrapper.ts
|
|
35610
|
+
const log$1 = createSubsystemLogger("agents/tool-validate");
|
|
35610
35611
|
const EXEC_TOOL_NAMES = new Set(["exec", "bash"]);
|
|
35611
35612
|
const FILE_TOOL_NAMES = new Set([
|
|
35612
35613
|
"write",
|
|
@@ -35631,8 +35632,14 @@ const FILE_PATH_KEYS = [
|
|
|
35631
35632
|
* Call this AFTER tools are created and the model profile is resolved.
|
|
35632
35633
|
*/
|
|
35633
35634
|
function wrapToolsWithArgValidation(tools, profile) {
|
|
35634
|
-
if (!profile.filters?.validateToolArgs)
|
|
35635
|
-
|
|
35635
|
+
if (!profile.filters?.validateToolArgs) {
|
|
35636
|
+
log$1.debug(`[validate] skipped — validateToolArgs=${profile.filters?.validateToolArgs ?? "undefined"} profile=${profile.label}`);
|
|
35637
|
+
return tools;
|
|
35638
|
+
}
|
|
35639
|
+
const wrapped = tools.map((tool) => wrapToolWithArgValidation(tool));
|
|
35640
|
+
const wrappedNames = wrapped.filter((t, i) => t !== tools[i]).map((t) => t.name);
|
|
35641
|
+
log$1.debug(`[validate] applied to ${wrappedNames.length} tools: ${wrappedNames.join(",") || "(none matched)"}`);
|
|
35642
|
+
return wrapped;
|
|
35636
35643
|
}
|
|
35637
35644
|
/**
|
|
35638
35645
|
* Clean a file path by stripping control token fragments.
|
|
@@ -35665,13 +35672,22 @@ function wrapToolWithArgValidation(tool) {
|
|
|
35665
35672
|
execute(toolCallId, params, ...rest) {
|
|
35666
35673
|
if (isExecTool) {
|
|
35667
35674
|
const command = params.command ?? params.cmd;
|
|
35668
|
-
if (typeof command !== "string")
|
|
35675
|
+
if (typeof command !== "string") {
|
|
35676
|
+
log$1.debug(`[validate] exec called without string command: keys=${Object.keys(params).join(",")}`);
|
|
35677
|
+
return originalExecute.call(tool, toolCallId, params, ...rest);
|
|
35678
|
+
}
|
|
35669
35679
|
const result = validateShellCommand(command);
|
|
35670
|
-
if (!result.valid)
|
|
35671
|
-
|
|
35672
|
-
|
|
35673
|
-
|
|
35674
|
-
|
|
35680
|
+
if (!result.valid) {
|
|
35681
|
+
log$1.warn(`[validate] exec command rejected: reason=${result.reason} raw=${command.slice(0, 100)}`);
|
|
35682
|
+
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.` });
|
|
35683
|
+
}
|
|
35684
|
+
if (result.cleaned !== command) {
|
|
35685
|
+
log$1.debug(`[validate] exec command cleaned: raw=${command.slice(0, 80)} → cleaned=${result.cleaned.slice(0, 80)}`);
|
|
35686
|
+
return originalExecute.call(tool, toolCallId, {
|
|
35687
|
+
...params,
|
|
35688
|
+
command: result.cleaned
|
|
35689
|
+
}, ...rest);
|
|
35690
|
+
}
|
|
35675
35691
|
return originalExecute.call(tool, toolCallId, params, ...rest);
|
|
35676
35692
|
}
|
|
35677
35693
|
const pathKey = FILE_PATH_KEYS.find((k) => typeof params[k] === "string");
|
|
@@ -36042,7 +36058,7 @@ async function truncateOversizedToolResultsInSession(params) {
|
|
|
36042
36058
|
const textLength = getToolResultTextLength(msg);
|
|
36043
36059
|
if (textLength > maxChars) {
|
|
36044
36060
|
oversizedIndices.push(i);
|
|
36045
|
-
log$
|
|
36061
|
+
log$5.info(`[tool-result-truncation] Found oversized tool result: entry=${entry.id} chars=${textLength} maxChars=${maxChars} sessionKey=${params.sessionKey ?? params.sessionId ?? "unknown"}`);
|
|
36046
36062
|
}
|
|
36047
36063
|
}
|
|
36048
36064
|
if (oversizedIndices.length === 0) return {
|
|
@@ -36064,7 +36080,7 @@ async function truncateOversizedToolResultsInSession(params) {
|
|
|
36064
36080
|
message = truncateToolResultMessage(message, maxChars);
|
|
36065
36081
|
truncatedCount++;
|
|
36066
36082
|
const newLength = getToolResultTextLength(message);
|
|
36067
|
-
log$
|
|
36083
|
+
log$5.info(`[tool-result-truncation] Truncated tool result: originalEntry=${entry.id} newChars=${newLength} sessionKey=${params.sessionKey ?? params.sessionId ?? "unknown"}`);
|
|
36068
36084
|
}
|
|
36069
36085
|
sessionManager.appendMessage(message);
|
|
36070
36086
|
} else if (entry.type === "compaction") sessionManager.appendCompaction(entry.summary, entry.firstKeptEntryId, entry.tokensBefore, entry.details, entry.fromHook);
|
|
@@ -36078,14 +36094,14 @@ async function truncateOversizedToolResultsInSession(params) {
|
|
|
36078
36094
|
if (entry.name) sessionManager.appendSessionInfo(entry.name);
|
|
36079
36095
|
}
|
|
36080
36096
|
}
|
|
36081
|
-
log$
|
|
36097
|
+
log$5.info(`[tool-result-truncation] Truncated ${truncatedCount} tool result(s) in session (contextWindow=${contextWindowTokens} maxChars=${maxChars}) sessionKey=${params.sessionKey ?? params.sessionId ?? "unknown"}`);
|
|
36082
36098
|
return {
|
|
36083
36099
|
truncated: true,
|
|
36084
36100
|
truncatedCount
|
|
36085
36101
|
};
|
|
36086
36102
|
} catch (err) {
|
|
36087
36103
|
const errMsg = err instanceof Error ? err.message : String(err);
|
|
36088
|
-
log$
|
|
36104
|
+
log$5.warn(`[tool-result-truncation] Failed to truncate: ${errMsg}`);
|
|
36089
36105
|
return {
|
|
36090
36106
|
truncated: false,
|
|
36091
36107
|
truncatedCount: 0,
|
|
@@ -37743,7 +37759,7 @@ function resolveAnthropicBetas(extraParams, provider, modelId) {
|
|
|
37743
37759
|
for (const beta of configured) if (typeof beta === "string" && beta.trim()) betas.add(beta.trim());
|
|
37744
37760
|
}
|
|
37745
37761
|
if (extraParams?.context1m === true) if (isAnthropic1MModel(modelId)) betas.add(ANTHROPIC_CONTEXT_1M_BETA);
|
|
37746
|
-
else log$
|
|
37762
|
+
else log$5.warn(`ignoring context1m for non-opus/sonnet model: ${provider}/${modelId}`);
|
|
37747
37763
|
return betas.size > 0 ? [...betas] : void 0;
|
|
37748
37764
|
}
|
|
37749
37765
|
function mergeAnthropicBetaHeader(headers, betas) {
|
|
@@ -38354,14 +38370,14 @@ function logToolSchemasForGoogle(params) {
|
|
|
38354
38370
|
if (params.provider !== "google-antigravity" && params.provider !== "google-gemini-cli") return;
|
|
38355
38371
|
const toolNames = params.tools.map((tool, index) => `${index}:${tool.name}`);
|
|
38356
38372
|
const tools = sanitizeToolsForGoogle(params);
|
|
38357
|
-
log$
|
|
38373
|
+
log$5.info("google tool schema snapshot", {
|
|
38358
38374
|
provider: params.provider,
|
|
38359
38375
|
toolCount: tools.length,
|
|
38360
38376
|
tools: toolNames
|
|
38361
38377
|
});
|
|
38362
38378
|
for (const [index, tool] of tools.entries()) {
|
|
38363
38379
|
const violations = findUnsupportedSchemaKeywords(tool.parameters, `${tool.name}.parameters`);
|
|
38364
|
-
if (violations.length > 0) log$
|
|
38380
|
+
if (violations.length > 0) log$5.warn("google tool schema has unsupported keywords", {
|
|
38365
38381
|
index,
|
|
38366
38382
|
tool: tool.name,
|
|
38367
38383
|
violations: violations.slice(0, 12),
|
|
@@ -38373,7 +38389,7 @@ const compactionFailureEmitter = new EventEmitter();
|
|
|
38373
38389
|
registerUnhandledRejectionHandler((reason) => {
|
|
38374
38390
|
const message = describeUnknownError(reason);
|
|
38375
38391
|
if (!isCompactionFailureError(message)) return false;
|
|
38376
|
-
log$
|
|
38392
|
+
log$5.error(`Auto-compaction failed (unhandled): ${message}`);
|
|
38377
38393
|
compactionFailureEmitter.emit("failure", message);
|
|
38378
38394
|
return true;
|
|
38379
38395
|
});
|
|
@@ -38425,7 +38441,7 @@ function applyGoogleTurnOrderingFix(params) {
|
|
|
38425
38441
|
const sanitized = sanitizeGoogleTurnOrdering(params.messages);
|
|
38426
38442
|
const didPrepend = sanitized !== params.messages;
|
|
38427
38443
|
if (didPrepend && !hasGoogleTurnOrderingMarker(params.sessionManager)) {
|
|
38428
|
-
(params.warn ?? ((message) => log$
|
|
38444
|
+
(params.warn ?? ((message) => log$5.warn(message)))(`google turn ordering fixup: prepended user bootstrap (sessionId=${params.sessionId})`);
|
|
38429
38445
|
markGoogleTurnOrderingMarker(params.sessionManager);
|
|
38430
38446
|
}
|
|
38431
38447
|
return {
|
|
@@ -39036,7 +39052,7 @@ function isImageExtension(filePath) {
|
|
|
39036
39052
|
}
|
|
39037
39053
|
async function sanitizeImagesWithLog(images, label, imageSanitization) {
|
|
39038
39054
|
const { images: sanitized, dropped } = await sanitizeImageBlocks(images, label, imageSanitization);
|
|
39039
|
-
if (dropped > 0) log$
|
|
39055
|
+
if (dropped > 0) log$5.warn(`Native image: dropped ${dropped} image(s) after sanitization (${label}).`);
|
|
39040
39056
|
return sanitized;
|
|
39041
39057
|
}
|
|
39042
39058
|
/**
|
|
@@ -39111,7 +39127,7 @@ async function loadImageFromRef(ref, workspaceDir, options) {
|
|
|
39111
39127
|
try {
|
|
39112
39128
|
let targetPath = ref.resolved;
|
|
39113
39129
|
if (ref.type === "url") {
|
|
39114
|
-
log$
|
|
39130
|
+
log$5.debug(`Native image: rejecting remote URL (local-only): ${ref.resolved}`);
|
|
39115
39131
|
return null;
|
|
39116
39132
|
}
|
|
39117
39133
|
if (ref.type === "path") {
|
|
@@ -39121,7 +39137,7 @@ async function loadImageFromRef(ref, workspaceDir, options) {
|
|
|
39121
39137
|
cwd: options.sandbox.root
|
|
39122
39138
|
}).hostPath;
|
|
39123
39139
|
} catch (err) {
|
|
39124
|
-
log$
|
|
39140
|
+
log$5.debug(`Native image: sandbox validation failed for ${ref.resolved}: ${err instanceof Error ? err.message : String(err)}`);
|
|
39125
39141
|
return null;
|
|
39126
39142
|
}
|
|
39127
39143
|
else if (!path.isAbsolute(targetPath)) targetPath = path.resolve(workspaceDir, targetPath);
|
|
@@ -39135,7 +39151,7 @@ async function loadImageFromRef(ref, workspaceDir, options) {
|
|
|
39135
39151
|
})
|
|
39136
39152
|
}) : await loadWebMedia(targetPath, options?.maxBytes);
|
|
39137
39153
|
if (media.kind !== "image") {
|
|
39138
|
-
log$
|
|
39154
|
+
log$5.debug(`Native image: not an image file: ${targetPath} (got ${media.kind})`);
|
|
39139
39155
|
return null;
|
|
39140
39156
|
}
|
|
39141
39157
|
const mimeType = media.contentType ?? "image/jpeg";
|
|
@@ -39145,7 +39161,7 @@ async function loadImageFromRef(ref, workspaceDir, options) {
|
|
|
39145
39161
|
mimeType
|
|
39146
39162
|
};
|
|
39147
39163
|
} catch (err) {
|
|
39148
|
-
log$
|
|
39164
|
+
log$5.debug(`Native image: failed to load ${ref.resolved}: ${err instanceof Error ? err.message : String(err)}`);
|
|
39149
39165
|
return null;
|
|
39150
39166
|
}
|
|
39151
39167
|
}
|
|
@@ -39244,7 +39260,7 @@ async function detectAndLoadPromptImages(params) {
|
|
|
39244
39260
|
loadedCount: 0,
|
|
39245
39261
|
skippedCount: 0
|
|
39246
39262
|
};
|
|
39247
|
-
log$
|
|
39263
|
+
log$5.debug(`Native image: detected ${allRefs.length} image refs (${promptRefs.length} in prompt, ${uniqueHistoryRefs.length} in history)`);
|
|
39248
39264
|
const promptImages = [...params.existingImages ?? []];
|
|
39249
39265
|
const historyImagesByIndex = /* @__PURE__ */ new Map();
|
|
39250
39266
|
let loadedCount = 0;
|
|
@@ -39261,7 +39277,7 @@ async function detectAndLoadPromptImages(params) {
|
|
|
39261
39277
|
else historyImagesByIndex.set(ref.messageIndex, [image]);
|
|
39262
39278
|
} else promptImages.push(image);
|
|
39263
39279
|
loadedCount++;
|
|
39264
|
-
log$
|
|
39280
|
+
log$5.debug(`Native image: loaded ${ref.type} ${ref.resolved}`);
|
|
39265
39281
|
} else skippedCount++;
|
|
39266
39282
|
}
|
|
39267
39283
|
const imageSanitization = { maxDimensionPx: params.maxDimensionPx };
|
|
@@ -39357,7 +39373,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
39357
39373
|
const resolvedWorkspace = resolveUserPath(params.workspaceDir);
|
|
39358
39374
|
const prevCwd = process.cwd();
|
|
39359
39375
|
const runAbortController = new AbortController();
|
|
39360
|
-
log$
|
|
39376
|
+
log$5.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"}`);
|
|
39361
39377
|
await fs$1.mkdir(resolvedWorkspace, { recursive: true });
|
|
39362
39378
|
const sandboxSessionKey = params.sessionKey?.trim() || params.sessionId;
|
|
39363
39379
|
const sandbox = await resolveSandboxContext({
|
|
@@ -39393,7 +39409,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
39393
39409
|
sessionId: params.sessionId,
|
|
39394
39410
|
warn: makeBootstrapWarn({
|
|
39395
39411
|
sessionLabel,
|
|
39396
|
-
warn: (message) => log$
|
|
39412
|
+
warn: (message) => log$5.warn(message)
|
|
39397
39413
|
})
|
|
39398
39414
|
});
|
|
39399
39415
|
const workspaceNotes = hookAdjustedBootstrapFiles.some((file) => file.name === DEFAULT_BOOTSTRAP_FILENAME && !file.missing) ? ["Reminder: commit your changes in this workspace after edits."] : void 0;
|
|
@@ -39580,7 +39596,9 @@ async function runEmbeddedAttempt(params) {
|
|
|
39580
39596
|
skillsPrompt,
|
|
39581
39597
|
tools
|
|
39582
39598
|
});
|
|
39583
|
-
const
|
|
39599
|
+
const profileModelKey = params.modelId ?? "";
|
|
39600
|
+
const modelProfile = resolveModelProfile(profileModelKey, params.config?.models?.profiles);
|
|
39601
|
+
log$5.debug(`[profile] resolved: modelId=${profileModelKey} → profile=${modelProfile.label} validateToolArgs=${modelProfile.filters?.validateToolArgs ?? false}`);
|
|
39584
39602
|
const systemPromptText = createSystemPromptOverride(appendPrompt + (modelProfile.promptAdditions.length > 0 ? "\n\n" + modelProfile.promptAdditions.join("\n") : ""))();
|
|
39585
39603
|
const sessionLock = await acquireSessionWriteLock({
|
|
39586
39604
|
sessionFile: params.sessionFile,
|
|
@@ -39592,7 +39610,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
39592
39610
|
try {
|
|
39593
39611
|
await repairSessionFileIfNeeded({
|
|
39594
39612
|
sessionFile: params.sessionFile,
|
|
39595
|
-
warn: (message) => log$
|
|
39613
|
+
warn: (message) => log$5.warn(message)
|
|
39596
39614
|
});
|
|
39597
39615
|
const hadSessionFile = await fs$1.stat(params.sessionFile).then(() => true).catch(() => false);
|
|
39598
39616
|
const transcriptPolicy = resolveTranscriptPolicy({
|
|
@@ -39601,7 +39619,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
39601
39619
|
modelId: params.modelId
|
|
39602
39620
|
});
|
|
39603
39621
|
const versionCheck = await handleSessionVersion(params.sessionFile);
|
|
39604
|
-
if (versionCheck.archived) log$
|
|
39622
|
+
if (versionCheck.archived) log$5.warn(`session archived: created by ${versionCheck.poisonVersion}, known corruption range → ${versionCheck.archivePath}`);
|
|
39605
39623
|
await prewarmSessionFile(params.sessionFile);
|
|
39606
39624
|
sessionManager = guardSessionManager(SessionManager.open(params.sessionFile), {
|
|
39607
39625
|
agentId: sessionAgentId,
|
|
@@ -39645,6 +39663,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
39645
39663
|
sandboxEnabled: !!sandbox?.enabled
|
|
39646
39664
|
});
|
|
39647
39665
|
const builtInTools = wrapToolsWithArgValidation(rawBuiltInTools, modelProfile);
|
|
39666
|
+
log$5.debug(`[tool-validate] profile=${modelProfile.label} validateToolArgs=${modelProfile.filters?.validateToolArgs ?? false} builtInTools=${builtInTools.length} toolNames=${builtInTools.map((t) => t.name).join(",")}`);
|
|
39648
39667
|
let clientToolCallDetected = null;
|
|
39649
39668
|
const clientToolLoopDetection = resolveToolLoopDetectionConfig({
|
|
39650
39669
|
cfg: params.config,
|
|
@@ -39856,7 +39875,6 @@ async function runEmbeddedAttempt(params) {
|
|
|
39856
39875
|
const TOOL_ERROR_ABORT_THRESHOLD = 5;
|
|
39857
39876
|
const TOOL_ERROR_WARN_THRESHOLD = 3;
|
|
39858
39877
|
let consecutiveToolErrors = 0;
|
|
39859
|
-
let lastErrorToolName = "";
|
|
39860
39878
|
const subscription = subscribeEmbeddedPiSession({
|
|
39861
39879
|
session: activeSession,
|
|
39862
39880
|
runId: params.runId,
|
|
@@ -39880,26 +39898,23 @@ async function runEmbeddedAttempt(params) {
|
|
|
39880
39898
|
params.onAgentEvent?.(evt);
|
|
39881
39899
|
if (evt.stream === "tool" && !aborted) {
|
|
39882
39900
|
const phase = typeof evt.data?.phase === "string" ? evt.data.phase : "";
|
|
39883
|
-
const toolName = typeof evt.data?.name === "string" ? evt.data.name : "";
|
|
39884
39901
|
const isError = evt.data?.isError === true;
|
|
39885
|
-
if (phase === "result"
|
|
39886
|
-
if (isError
|
|
39887
|
-
else
|
|
39888
|
-
consecutiveToolErrors = 1;
|
|
39889
|
-
lastErrorToolName = toolName;
|
|
39890
|
-
} else {
|
|
39891
|
-
consecutiveToolErrors = 0;
|
|
39892
|
-
lastErrorToolName = "";
|
|
39893
|
-
}
|
|
39902
|
+
if (phase === "result") {
|
|
39903
|
+
if (isError) consecutiveToolErrors++;
|
|
39904
|
+
else consecutiveToolErrors = 0;
|
|
39894
39905
|
if (consecutiveToolErrors >= TOOL_ERROR_ABORT_THRESHOLD) {
|
|
39895
|
-
|
|
39896
|
-
|
|
39897
|
-
|
|
39906
|
+
const toolName = typeof evt.data?.name === "string" ? evt.data.name : "unknown";
|
|
39907
|
+
log$5.error(`Agent-loop circuit breaker: ${consecutiveToolErrors} consecutive tool errors (last: ${toolName}). Aborting run ${params.runId}.`);
|
|
39908
|
+
abortRun(false, /* @__PURE__ */ new Error(`${consecutiveToolErrors} consecutive tool errors. The model may be generating corrupted tool arguments. Run aborted to prevent infinite loop.`));
|
|
39909
|
+
} else if (consecutiveToolErrors === TOOL_ERROR_WARN_THRESHOLD) {
|
|
39910
|
+
const toolName = typeof evt.data?.name === "string" ? evt.data.name : "unknown";
|
|
39911
|
+
log$5.warn(`Agent-loop tool error warning: ${consecutiveToolErrors} consecutive failures (last: ${toolName}). runId=${params.runId}`);
|
|
39912
|
+
}
|
|
39898
39913
|
}
|
|
39899
39914
|
}
|
|
39900
39915
|
if (evt.stream === "assistant" && typeof evt.data?.text === "string" && !aborted) {
|
|
39901
39916
|
streamMonitor.onChunk(evt.data.text);
|
|
39902
|
-
if (streamMonitor.shouldStop()) log$
|
|
39917
|
+
if (streamMonitor.shouldStop()) log$5.debug(`stream monitor detection (log-only, no abort): runId=${params.runId} reason=${streamMonitor.getStopReason()}`);
|
|
39903
39918
|
}
|
|
39904
39919
|
},
|
|
39905
39920
|
enforceFinalTag: params.enforceFinalTag,
|
|
@@ -39919,7 +39934,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
39919
39934
|
let abortWarnTimer;
|
|
39920
39935
|
const isProbeSession = params.sessionId?.startsWith("probe-") ?? false;
|
|
39921
39936
|
const abortTimer = setTimeout(() => {
|
|
39922
|
-
if (!isProbeSession) log$
|
|
39937
|
+
if (!isProbeSession) log$5.warn(`embedded run timeout: runId=${params.runId} sessionId=${params.sessionId} timeoutMs=${params.timeoutMs}`);
|
|
39923
39938
|
if (shouldFlagCompactionTimeout({
|
|
39924
39939
|
isTimeout: true,
|
|
39925
39940
|
isCompactionPendingOrRetrying: subscription.isCompacting(),
|
|
@@ -39928,7 +39943,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
39928
39943
|
abortRun(true);
|
|
39929
39944
|
if (!abortWarnTimer) abortWarnTimer = setTimeout(() => {
|
|
39930
39945
|
if (!activeSession.isStreaming) return;
|
|
39931
|
-
if (!isProbeSession) log$
|
|
39946
|
+
if (!isProbeSession) log$5.warn(`embedded run abort still streaming: runId=${params.runId} sessionId=${params.sessionId}`);
|
|
39932
39947
|
}, 1e4);
|
|
39933
39948
|
}, Math.max(1, params.timeoutMs));
|
|
39934
39949
|
armSymipulseTimer = () => {
|
|
@@ -39936,7 +39951,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
39936
39951
|
clearSymipulseTimer();
|
|
39937
39952
|
symipulseTimer = setTimeout(() => {
|
|
39938
39953
|
if (aborted) return;
|
|
39939
|
-
if (!isProbeSession) log$
|
|
39954
|
+
if (!isProbeSession) log$5.warn(`symipulse timeout: runId=${params.runId} sessionId=${params.sessionId} symipulseMs=${symipulseMs} (no activity)`);
|
|
39940
39955
|
if (shouldFlagCompactionTimeout({
|
|
39941
39956
|
isTimeout: true,
|
|
39942
39957
|
isCompactionPendingOrRetrying: subscription.isCompacting(),
|
|
@@ -39980,13 +39995,13 @@ async function runEmbeddedAttempt(params) {
|
|
|
39980
39995
|
prompt: params.prompt,
|
|
39981
39996
|
messages: activeSession.messages
|
|
39982
39997
|
}, hookCtx).catch((hookErr) => {
|
|
39983
|
-
log$
|
|
39998
|
+
log$5.warn(`before_prompt_build hook failed: ${String(hookErr)}`);
|
|
39984
39999
|
}) : void 0;
|
|
39985
40000
|
const legacyResult = hookRunner?.hasHooks("before_agent_start") ? await hookRunner.runBeforeAgentStart({
|
|
39986
40001
|
prompt: params.prompt,
|
|
39987
40002
|
messages: activeSession.messages
|
|
39988
40003
|
}, hookCtx).catch((hookErr) => {
|
|
39989
|
-
log$
|
|
40004
|
+
log$5.warn(`before_agent_start hook (legacy prompt build path) failed: ${String(hookErr)}`);
|
|
39990
40005
|
}) : void 0;
|
|
39991
40006
|
const hookResult = {
|
|
39992
40007
|
systemPrompt: promptBuildResult?.systemPrompt ?? legacyResult?.systemPrompt,
|
|
@@ -39994,7 +40009,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
39994
40009
|
};
|
|
39995
40010
|
if (hookResult?.prependContext) {
|
|
39996
40011
|
effectivePrompt = `${hookResult.prependContext}\n\n${params.prompt}`;
|
|
39997
|
-
log$
|
|
40012
|
+
log$5.debug(`hooks: prepended context to prompt (${hookResult.prependContext.length} chars)`);
|
|
39998
40013
|
}
|
|
39999
40014
|
{
|
|
40000
40015
|
const autoRecallAgentId = normalizeAgentId(params.sessionKey);
|
|
@@ -40011,11 +40026,11 @@ async function runEmbeddedAttempt(params) {
|
|
|
40011
40026
|
if (recallResults.length > 0) {
|
|
40012
40027
|
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>`;
|
|
40013
40028
|
effectivePrompt = `${recallBlock}\n\n${effectivePrompt}`;
|
|
40014
|
-
log$
|
|
40029
|
+
log$5.debug(`auto-recall: injected ${recallResults.length} snippets (${recallBlock.length} chars)`);
|
|
40015
40030
|
}
|
|
40016
40031
|
}
|
|
40017
40032
|
} catch (recallErr) {
|
|
40018
|
-
log$
|
|
40033
|
+
log$5.debug(`auto-recall: skipped (${String(recallErr)})`);
|
|
40019
40034
|
}
|
|
40020
40035
|
}
|
|
40021
40036
|
{
|
|
@@ -40027,10 +40042,10 @@ async function runEmbeddedAttempt(params) {
|
|
|
40027
40042
|
if (planResult.enter) {
|
|
40028
40043
|
if (planResult.stripped != null) effectivePrompt = planResult.stripped;
|
|
40029
40044
|
effectivePrompt = `${PLAN_MODE_SYSTEM_PROMPT}\n\n${effectivePrompt}`;
|
|
40030
|
-
log$
|
|
40045
|
+
log$5.info(`plan-mode: activated (${planResult.reason}) for runId=${params.runId}`);
|
|
40031
40046
|
} else if (planResult.stripped != null) effectivePrompt = planResult.stripped;
|
|
40032
40047
|
}
|
|
40033
|
-
log$
|
|
40048
|
+
log$5.debug(`embedded run prompt start: runId=${params.runId} sessionId=${params.sessionId}`);
|
|
40034
40049
|
cacheTrace?.recordStage("prompt:before", {
|
|
40035
40050
|
prompt: effectivePrompt,
|
|
40036
40051
|
messages: activeSession.messages
|
|
@@ -40042,7 +40057,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
40042
40057
|
const sessionContext = sessionManager.buildSessionContext();
|
|
40043
40058
|
const sanitizedOrphan = transcriptPolicy.sanitizeThinkingSignatures ? sanitizeAntigravityThinkingBlocks(sessionContext.messages) : sessionContext.messages;
|
|
40044
40059
|
activeSession.agent.replaceMessages(sanitizedOrphan);
|
|
40045
|
-
log$
|
|
40060
|
+
log$5.warn(`Removed orphaned user message to prevent consecutive user turns. runId=${params.runId} sessionId=${params.sessionId}`);
|
|
40046
40061
|
}
|
|
40047
40062
|
try {
|
|
40048
40063
|
const imageResult = await detectAndLoadPromptImages({
|
|
@@ -40064,12 +40079,12 @@ async function runEmbeddedAttempt(params) {
|
|
|
40064
40079
|
messages: activeSession.messages,
|
|
40065
40080
|
note: `images: prompt=${imageResult.images.length} history=${imageResult.historyImagesByIndex.size}`
|
|
40066
40081
|
});
|
|
40067
|
-
if (log$
|
|
40082
|
+
if (log$5.isEnabled("debug")) {
|
|
40068
40083
|
const msgCount = activeSession.messages.length;
|
|
40069
40084
|
const systemLen = systemPromptText?.length ?? 0;
|
|
40070
40085
|
const promptLen = effectivePrompt.length;
|
|
40071
40086
|
const sessionSummary = summarizeSessionContext(activeSession.messages);
|
|
40072
|
-
log$
|
|
40087
|
+
log$5.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}`);
|
|
40073
40088
|
}
|
|
40074
40089
|
if (hookRunner?.hasHooks("llm_input")) hookRunner.runLlmInput({
|
|
40075
40090
|
runId: params.runId,
|
|
@@ -40087,7 +40102,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
40087
40102
|
workspaceDir: params.workspaceDir,
|
|
40088
40103
|
messageProvider: params.messageProvider ?? void 0
|
|
40089
40104
|
}).catch((err) => {
|
|
40090
|
-
log$
|
|
40105
|
+
log$5.warn(`llm_input hook failed: ${String(err)}`);
|
|
40091
40106
|
});
|
|
40092
40107
|
if (imageResult.images.length > 0) await abortable(activeSession.prompt(effectivePrompt, { images: imageResult.images }));
|
|
40093
40108
|
else await abortable(activeSession.prompt(effectivePrompt));
|
|
@@ -40095,7 +40110,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
40095
40110
|
promptError = err;
|
|
40096
40111
|
promptErrorSource = "prompt";
|
|
40097
40112
|
} finally {
|
|
40098
|
-
log$
|
|
40113
|
+
log$5.debug(`embedded run prompt end: runId=${params.runId} sessionId=${params.sessionId} durationMs=${Date.now() - promptStartedAt}`);
|
|
40099
40114
|
}
|
|
40100
40115
|
const wasCompactingBefore = activeSession.isCompacting;
|
|
40101
40116
|
const snapshot = activeSession.messages.slice();
|
|
@@ -40110,7 +40125,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
40110
40125
|
promptError = err;
|
|
40111
40126
|
promptErrorSource = "compaction";
|
|
40112
40127
|
}
|
|
40113
|
-
if (!isProbeSession) log$
|
|
40128
|
+
if (!isProbeSession) log$5.debug(`compaction wait aborted: runId=${params.runId} sessionId=${params.sessionId}`);
|
|
40114
40129
|
} else throw err;
|
|
40115
40130
|
}
|
|
40116
40131
|
if (!timedOutDuringCompaction) {
|
|
@@ -40128,7 +40143,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
40128
40143
|
currentSessionId: activeSession.sessionId
|
|
40129
40144
|
});
|
|
40130
40145
|
if (timedOutDuringCompaction) {
|
|
40131
|
-
if (!isProbeSession) log$
|
|
40146
|
+
if (!isProbeSession) log$5.warn(`using ${snapshotSelection.source} snapshot: timed out during compaction runId=${params.runId} sessionId=${params.sessionId}`);
|
|
40132
40147
|
}
|
|
40133
40148
|
messagesSnapshot = snapshotSelection.messagesSnapshot;
|
|
40134
40149
|
sessionIdUsed = snapshotSelection.sessionIdUsed;
|
|
@@ -40143,7 +40158,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
40143
40158
|
error: describeUnknownError(promptError)
|
|
40144
40159
|
});
|
|
40145
40160
|
} catch (entryErr) {
|
|
40146
|
-
log$
|
|
40161
|
+
log$5.warn(`failed to persist prompt error entry: ${String(entryErr)}`);
|
|
40147
40162
|
}
|
|
40148
40163
|
cacheTrace?.recordStage("session:after", {
|
|
40149
40164
|
messages: messagesSnapshot,
|
|
@@ -40162,17 +40177,17 @@ async function runEmbeddedAttempt(params) {
|
|
|
40162
40177
|
workspaceDir: params.workspaceDir,
|
|
40163
40178
|
messageProvider: params.messageProvider ?? void 0
|
|
40164
40179
|
}).catch((err) => {
|
|
40165
|
-
log$
|
|
40180
|
+
log$5.warn(`agent_end hook failed: ${err}`);
|
|
40166
40181
|
});
|
|
40167
40182
|
} finally {
|
|
40168
40183
|
clearTimeout(abortTimer);
|
|
40169
40184
|
clearSymipulseTimer();
|
|
40170
40185
|
if (abortWarnTimer) clearTimeout(abortWarnTimer);
|
|
40171
|
-
if (!isProbeSession && (aborted || timedOut) && !timedOutDuringCompaction) log$
|
|
40186
|
+
if (!isProbeSession && (aborted || timedOut) && !timedOutDuringCompaction) log$5.debug(`run cleanup: runId=${params.runId} sessionId=${params.sessionId} aborted=${aborted} timedOut=${timedOut}`);
|
|
40172
40187
|
try {
|
|
40173
40188
|
unsubscribe();
|
|
40174
40189
|
} catch (err) {
|
|
40175
|
-
log$
|
|
40190
|
+
log$5.error(`CRITICAL: unsubscribe failed, possible resource leak: runId=${params.runId} ${String(err)}`);
|
|
40176
40191
|
}
|
|
40177
40192
|
clearActiveEmbeddedRun(params.sessionId, queueHandle, params.sessionKey);
|
|
40178
40193
|
params.abortSignal?.removeEventListener?.("abort", onAbort);
|
|
@@ -40197,7 +40212,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
40197
40212
|
workspaceDir: params.workspaceDir,
|
|
40198
40213
|
messageProvider: params.messageProvider ?? void 0
|
|
40199
40214
|
}).catch((err) => {
|
|
40200
|
-
log$
|
|
40215
|
+
log$5.warn(`llm_output hook failed: ${String(err)}`);
|
|
40201
40216
|
});
|
|
40202
40217
|
return {
|
|
40203
40218
|
aborted,
|
|
@@ -40458,7 +40473,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
40458
40473
|
const redactedSessionId = redactRunIdentifier(params.sessionId);
|
|
40459
40474
|
const redactedSessionKey = redactRunIdentifier(params.sessionKey);
|
|
40460
40475
|
const redactedWorkspace = redactRunIdentifier(resolvedWorkspace);
|
|
40461
|
-
if (workspaceResolution.usedFallback) log$
|
|
40476
|
+
if (workspaceResolution.usedFallback) log$5.warn(`[workspace-fallback] caller=runEmbeddedPiAgent reason=${workspaceResolution.fallbackReason} run=${params.runId} session=${redactedSessionId} sessionKey=${redactedSessionKey} agent=${workspaceResolution.agentId} workspace=${redactedWorkspace}`);
|
|
40462
40477
|
const prevCwd = process.cwd();
|
|
40463
40478
|
let provider = (params.provider ?? DEFAULT_PROVIDER).trim() || DEFAULT_PROVIDER;
|
|
40464
40479
|
let modelId = (params.model ?? DEFAULT_MODEL).trim() || DEFAULT_MODEL;
|
|
@@ -40477,7 +40492,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
40477
40492
|
if (hookRunner?.hasHooks("before_model_resolve")) try {
|
|
40478
40493
|
modelResolveOverride = await hookRunner.runBeforeModelResolve({ prompt: params.prompt }, hookCtx);
|
|
40479
40494
|
} catch (hookErr) {
|
|
40480
|
-
log$
|
|
40495
|
+
log$5.warn(`before_model_resolve hook failed: ${String(hookErr)}`);
|
|
40481
40496
|
}
|
|
40482
40497
|
if (hookRunner?.hasHooks("before_agent_start")) try {
|
|
40483
40498
|
const legacyResult = await hookRunner.runBeforeAgentStart({ prompt: params.prompt }, hookCtx);
|
|
@@ -40486,15 +40501,15 @@ async function runEmbeddedPiAgent(params) {
|
|
|
40486
40501
|
modelOverride: modelResolveOverride?.modelOverride ?? legacyResult?.modelOverride
|
|
40487
40502
|
};
|
|
40488
40503
|
} catch (hookErr) {
|
|
40489
|
-
log$
|
|
40504
|
+
log$5.warn(`before_agent_start hook (legacy model resolve path) failed: ${String(hookErr)}`);
|
|
40490
40505
|
}
|
|
40491
40506
|
if (modelResolveOverride?.providerOverride) {
|
|
40492
40507
|
provider = modelResolveOverride.providerOverride;
|
|
40493
|
-
log$
|
|
40508
|
+
log$5.info(`[hooks] provider overridden to ${provider}`);
|
|
40494
40509
|
}
|
|
40495
40510
|
if (modelResolveOverride?.modelOverride) {
|
|
40496
40511
|
modelId = modelResolveOverride.modelOverride;
|
|
40497
|
-
log$
|
|
40512
|
+
log$5.info(`[hooks] model overridden to ${modelId}`);
|
|
40498
40513
|
}
|
|
40499
40514
|
const { model, error, authStorage, modelRegistry } = resolveModel(provider, modelId, agentDir, params.config);
|
|
40500
40515
|
if (!model) throw new FailoverError(error ?? `Unknown model: ${provider}/${modelId}`, {
|
|
@@ -40514,9 +40529,9 @@ async function runEmbeddedPiAgent(params) {
|
|
|
40514
40529
|
warnBelowTokens: CONTEXT_WINDOW_WARN_BELOW_TOKENS,
|
|
40515
40530
|
hardMinTokens: CONTEXT_WINDOW_HARD_MIN_TOKENS
|
|
40516
40531
|
});
|
|
40517
|
-
if (ctxGuard.shouldWarn) log$
|
|
40532
|
+
if (ctxGuard.shouldWarn) log$5.warn(`low context window: ${provider}/${modelId} ctx=${ctxGuard.tokens} (warn<${CONTEXT_WINDOW_WARN_BELOW_TOKENS}) source=${ctxGuard.source}`);
|
|
40518
40533
|
if (ctxGuard.shouldBlock) {
|
|
40519
|
-
log$
|
|
40534
|
+
log$5.error(`blocked model (context window too small): ${provider}/${modelId} ctx=${ctxGuard.tokens} (min=${CONTEXT_WINDOW_HARD_MIN_TOKENS}) source=${ctxGuard.source}`);
|
|
40520
40535
|
throw new FailoverError(`Model context window too small (${ctxGuard.tokens} tokens). Minimum is ${CONTEXT_WINDOW_HARD_MIN_TOKENS}.`, {
|
|
40521
40536
|
reason: "unknown",
|
|
40522
40537
|
provider,
|
|
@@ -40646,7 +40661,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
40646
40661
|
while (true) {
|
|
40647
40662
|
if (runLoopIterations >= MAX_RUN_LOOP_ITERATIONS) {
|
|
40648
40663
|
const message = `Exceeded retry limit after ${runLoopIterations} attempts (max=${MAX_RUN_LOOP_ITERATIONS}).`;
|
|
40649
|
-
log$
|
|
40664
|
+
log$5.error(`[run-retry-limit] sessionKey=${params.sessionKey ?? params.sessionId} provider=${provider}/${modelId} attempts=${runLoopIterations} maxAttempts=${MAX_RUN_LOOP_ITERATIONS}`);
|
|
40650
40665
|
return {
|
|
40651
40666
|
payloads: [{
|
|
40652
40667
|
text: "Request failed after repeated internal retries. Please try again, or use /new to start a fresh session.",
|
|
@@ -40767,18 +40782,18 @@ async function runEmbeddedPiAgent(params) {
|
|
|
40767
40782
|
const overflowDiagId = createCompactionDiagId$1();
|
|
40768
40783
|
const errorText = contextOverflowError.text;
|
|
40769
40784
|
const msgCount = attempt.messagesSnapshot?.length ?? 0;
|
|
40770
|
-
log$
|
|
40785
|
+
log$5.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)}`);
|
|
40771
40786
|
const isCompactionFailure = isCompactionFailureError(errorText);
|
|
40772
40787
|
const hadAttemptLevelCompaction = attemptCompactionCount > 0;
|
|
40773
40788
|
if (!isCompactionFailure && hadAttemptLevelCompaction && overflowCompactionAttempts < MAX_OVERFLOW_COMPACTION_ATTEMPTS) {
|
|
40774
40789
|
overflowCompactionAttempts++;
|
|
40775
|
-
log$
|
|
40790
|
+
log$5.warn(`context overflow persisted after in-attempt compaction (attempt ${overflowCompactionAttempts}/${MAX_OVERFLOW_COMPACTION_ATTEMPTS}); retrying prompt without additional compaction for ${provider}/${modelId}`);
|
|
40776
40791
|
continue;
|
|
40777
40792
|
}
|
|
40778
40793
|
if (!isCompactionFailure && !hadAttemptLevelCompaction && overflowCompactionAttempts < MAX_OVERFLOW_COMPACTION_ATTEMPTS) {
|
|
40779
|
-
if (log$
|
|
40794
|
+
if (log$5.isEnabled("debug")) log$5.debug(`[compaction-diag] decision diagId=${overflowDiagId} branch=compact isCompactionFailure=${isCompactionFailure} hasOversizedToolResults=unknown attempt=${overflowCompactionAttempts + 1} maxAttempts=${MAX_OVERFLOW_COMPACTION_ATTEMPTS}`);
|
|
40780
40795
|
overflowCompactionAttempts++;
|
|
40781
|
-
log$
|
|
40796
|
+
log$5.warn(`context overflow detected (attempt ${overflowCompactionAttempts}/${MAX_OVERFLOW_COMPACTION_ATTEMPTS}); attempting auto-compaction for ${provider}/${modelId}`);
|
|
40782
40797
|
const compactResult = await compactEmbeddedPiSessionDirect({
|
|
40783
40798
|
sessionId: params.sessionId,
|
|
40784
40799
|
sessionKey: params.sessionKey,
|
|
@@ -40807,10 +40822,10 @@ async function runEmbeddedPiAgent(params) {
|
|
|
40807
40822
|
});
|
|
40808
40823
|
if (compactResult.compacted) {
|
|
40809
40824
|
autoCompactionCount += 1;
|
|
40810
|
-
log$
|
|
40825
|
+
log$5.info(`auto-compaction succeeded for ${provider}/${modelId}; retrying prompt`);
|
|
40811
40826
|
continue;
|
|
40812
40827
|
}
|
|
40813
|
-
log$
|
|
40828
|
+
log$5.warn(`auto-compaction failed for ${provider}/${modelId}: ${compactResult.reason ?? "nothing to compact"}`);
|
|
40814
40829
|
}
|
|
40815
40830
|
if (!toolResultTruncationAttempted) {
|
|
40816
40831
|
const contextWindowTokens = ctxInfo.tokens;
|
|
@@ -40819,9 +40834,9 @@ async function runEmbeddedPiAgent(params) {
|
|
|
40819
40834
|
contextWindowTokens
|
|
40820
40835
|
}) : false;
|
|
40821
40836
|
if (hasOversized) {
|
|
40822
|
-
if (log$
|
|
40837
|
+
if (log$5.isEnabled("debug")) log$5.debug(`[compaction-diag] decision diagId=${overflowDiagId} branch=truncate_tool_results isCompactionFailure=${isCompactionFailure} hasOversizedToolResults=${hasOversized} attempt=${overflowCompactionAttempts} maxAttempts=${MAX_OVERFLOW_COMPACTION_ATTEMPTS}`);
|
|
40823
40838
|
toolResultTruncationAttempted = true;
|
|
40824
|
-
log$
|
|
40839
|
+
log$5.warn(`[context-overflow-recovery] Attempting tool result truncation for ${provider}/${modelId} (contextWindow=${contextWindowTokens} tokens)`);
|
|
40825
40840
|
const truncResult = await truncateOversizedToolResultsInSession({
|
|
40826
40841
|
sessionFile: params.sessionFile,
|
|
40827
40842
|
contextWindowTokens,
|
|
@@ -40829,13 +40844,13 @@ async function runEmbeddedPiAgent(params) {
|
|
|
40829
40844
|
sessionKey: params.sessionKey
|
|
40830
40845
|
});
|
|
40831
40846
|
if (truncResult.truncated) {
|
|
40832
|
-
log$
|
|
40847
|
+
log$5.info(`[context-overflow-recovery] Truncated ${truncResult.truncatedCount} tool result(s); retrying prompt`);
|
|
40833
40848
|
continue;
|
|
40834
40849
|
}
|
|
40835
|
-
log$
|
|
40836
|
-
} else if (log$
|
|
40850
|
+
log$5.warn(`[context-overflow-recovery] Tool result truncation did not help: ${truncResult.reason ?? "unknown"}`);
|
|
40851
|
+
} else if (log$5.isEnabled("debug")) log$5.debug(`[compaction-diag] decision diagId=${overflowDiagId} branch=give_up isCompactionFailure=${isCompactionFailure} hasOversizedToolResults=${hasOversized} attempt=${overflowCompactionAttempts} maxAttempts=${MAX_OVERFLOW_COMPACTION_ATTEMPTS}`);
|
|
40837
40852
|
}
|
|
40838
|
-
if ((isCompactionFailure || overflowCompactionAttempts >= MAX_OVERFLOW_COMPACTION_ATTEMPTS || toolResultTruncationAttempted) && log$
|
|
40853
|
+
if ((isCompactionFailure || overflowCompactionAttempts >= MAX_OVERFLOW_COMPACTION_ATTEMPTS || toolResultTruncationAttempted) && log$5.isEnabled("debug")) log$5.debug(`[compaction-diag] decision diagId=${overflowDiagId} branch=give_up isCompactionFailure=${isCompactionFailure} hasOversizedToolResults=unknown attempt=${overflowCompactionAttempts} maxAttempts=${MAX_OVERFLOW_COMPACTION_ATTEMPTS}`);
|
|
40839
40854
|
const kind = isCompactionFailure ? "compaction_failure" : "context_overflow";
|
|
40840
40855
|
return {
|
|
40841
40856
|
payloads: [{
|
|
@@ -40916,7 +40931,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
40916
40931
|
attempted: attemptedThinking
|
|
40917
40932
|
});
|
|
40918
40933
|
if (fallbackThinking) {
|
|
40919
|
-
log$
|
|
40934
|
+
log$5.warn(`unsupported thinking level for ${provider}/${modelId}; retrying with ${fallbackThinking}`);
|
|
40920
40935
|
thinkLevel = fallbackThinking;
|
|
40921
40936
|
continue;
|
|
40922
40937
|
}
|
|
@@ -40934,7 +40949,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
40934
40949
|
attempted: attemptedThinking
|
|
40935
40950
|
});
|
|
40936
40951
|
if (fallbackThinking && !aborted) {
|
|
40937
|
-
log$
|
|
40952
|
+
log$5.warn(`unsupported thinking level for ${provider}/${modelId}; retrying with ${fallbackThinking}`);
|
|
40938
40953
|
thinkLevel = fallbackThinking;
|
|
40939
40954
|
continue;
|
|
40940
40955
|
}
|
|
@@ -40951,7 +40966,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
40951
40966
|
imageDimensionError.contentIndex !== void 0 ? `content=${imageDimensionError.contentIndex}` : null,
|
|
40952
40967
|
imageDimensionError.maxDimensionPx !== void 0 ? `limit=${imageDimensionError.maxDimensionPx}px` : null
|
|
40953
40968
|
].filter(Boolean).join(" ");
|
|
40954
|
-
log$
|
|
40969
|
+
log$5.warn(`Profile ${lastProfileId} rejected image payload${details ? ` (${details})` : ""}.`);
|
|
40955
40970
|
}
|
|
40956
40971
|
const isLocalOllamaTimeout = timedOut && model.api === "ollama";
|
|
40957
40972
|
if (!aborted && failoverFailure || timedOut && !timedOutDuringCompaction && !isLocalOllamaTimeout) {
|
|
@@ -40963,8 +40978,8 @@ async function runEmbeddedPiAgent(params) {
|
|
|
40963
40978
|
cfg: params.config,
|
|
40964
40979
|
agentDir: params.agentDir
|
|
40965
40980
|
});
|
|
40966
|
-
if (timedOut && !isProbeSession) log$
|
|
40967
|
-
if (cloudCodeAssistFormatError) log$
|
|
40981
|
+
if (timedOut && !isProbeSession) log$5.warn(`Profile ${lastProfileId} timed out (possible rate limit). Trying next account...`);
|
|
40982
|
+
if (cloudCodeAssistFormatError) log$5.warn(`Profile ${lastProfileId} hit Cloud Code Assist format error. Tool calls will be sanitized on retry.`);
|
|
40968
40983
|
}
|
|
40969
40984
|
if (await advanceAuthProfile()) continue;
|
|
40970
40985
|
if (fallbackConfigured) {
|
|
@@ -41030,7 +41045,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
41030
41045
|
const hasCodeBlocks = attempt.assistantTexts.some((text) => /```[\s\S]*?```/.test(text));
|
|
41031
41046
|
if (hasCodeToolUsage || hasCodeBlocks) {
|
|
41032
41047
|
verificationPassCompleted = true;
|
|
41033
|
-
log$
|
|
41048
|
+
log$5.debug(`[verification] starting verification pass: runId=${params.runId} sessionId=${params.sessionId} trigger=${hasCodeToolUsage ? "tool_usage" : "code_blocks"}`);
|
|
41034
41049
|
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.";
|
|
41035
41050
|
try {
|
|
41036
41051
|
const verifyAttempt = await runEmbeddedAttempt({
|
|
@@ -41116,10 +41131,10 @@ async function runEmbeddedPiAgent(params) {
|
|
|
41116
41131
|
payloads.length = 0;
|
|
41117
41132
|
payloads.push(...verifyPayloads);
|
|
41118
41133
|
}
|
|
41119
|
-
log$
|
|
41120
|
-
} else log$
|
|
41134
|
+
log$5.debug(`[verification] verification produced corrections: runId=${params.runId} tools=${verifyAttempt.toolMetas.length} texts=${verifyAttempt.assistantTexts.length}`);
|
|
41135
|
+
} else log$5.debug(`[verification] verification confirmed original response: runId=${params.runId}`);
|
|
41121
41136
|
} catch (verifyErr) {
|
|
41122
|
-
log$
|
|
41137
|
+
log$5.warn(`[verification] verification pass failed, keeping original response: runId=${params.runId} error=${String(verifyErr)}`);
|
|
41123
41138
|
}
|
|
41124
41139
|
}
|
|
41125
41140
|
}
|
|
@@ -41140,7 +41155,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
41140
41155
|
messagingToolSentTargets: attempt.messagingToolSentTargets,
|
|
41141
41156
|
successfulCronAdds: attempt.successfulCronAdds
|
|
41142
41157
|
};
|
|
41143
|
-
log$
|
|
41158
|
+
log$5.debug(`embedded run done: runId=${params.runId} sessionId=${params.sessionId} durationMs=${Date.now() - started} aborted=${aborted}`);
|
|
41144
41159
|
if (lastProfileId) {
|
|
41145
41160
|
await markAuthProfileGood({
|
|
41146
41161
|
store: authStore,
|
|
@@ -53012,7 +53027,7 @@ function isVoiceChannelType(type) {
|
|
|
53012
53027
|
function createDefaultDeps() {
|
|
53013
53028
|
return {
|
|
53014
53029
|
sendMessageWhatsApp: async (...args) => {
|
|
53015
|
-
const { sendMessageWhatsApp } = await import("./web-
|
|
53030
|
+
const { sendMessageWhatsApp } = await import("./web-CNlgAOtg.js");
|
|
53016
53031
|
return await sendMessageWhatsApp(...args);
|
|
53017
53032
|
},
|
|
53018
53033
|
sendMessageTelegram: async (...args) => {
|
|
@@ -68326,7 +68341,7 @@ function loadWebLoginQr() {
|
|
|
68326
68341
|
return webLoginQrPromise;
|
|
68327
68342
|
}
|
|
68328
68343
|
function loadWebChannel() {
|
|
68329
|
-
webChannelPromise ??= import("./web-
|
|
68344
|
+
webChannelPromise ??= import("./web-CNlgAOtg.js");
|
|
68330
68345
|
return webChannelPromise;
|
|
68331
68346
|
}
|
|
68332
68347
|
function loadWhatsAppActions() {
|
|
@@ -70464,7 +70479,7 @@ async function compactEmbeddedPiSessionDirect(params) {
|
|
|
70464
70479
|
const provider = (params.provider ?? DEFAULT_PROVIDER).trim() || DEFAULT_PROVIDER;
|
|
70465
70480
|
const modelId = (params.model ?? DEFAULT_MODEL).trim() || DEFAULT_MODEL;
|
|
70466
70481
|
const fail = (reason) => {
|
|
70467
|
-
log$
|
|
70482
|
+
log$5.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}`);
|
|
70468
70483
|
return {
|
|
70469
70484
|
ok: false,
|
|
70470
70485
|
compacted: false,
|
|
@@ -70532,7 +70547,7 @@ async function compactEmbeddedPiSessionDirect(params) {
|
|
|
70532
70547
|
sessionId: params.sessionId,
|
|
70533
70548
|
warn: makeBootstrapWarn({
|
|
70534
70549
|
sessionLabel,
|
|
70535
|
-
warn: (message) => log$
|
|
70550
|
+
warn: (message) => log$5.warn(message)
|
|
70536
70551
|
})
|
|
70537
70552
|
});
|
|
70538
70553
|
const runAbortController = new AbortController();
|
|
@@ -70672,7 +70687,7 @@ async function compactEmbeddedPiSessionDirect(params) {
|
|
|
70672
70687
|
try {
|
|
70673
70688
|
await repairSessionFileIfNeeded({
|
|
70674
70689
|
sessionFile: params.sessionFile,
|
|
70675
|
-
warn: (message) => log$
|
|
70690
|
+
warn: (message) => log$5.warn(message)
|
|
70676
70691
|
});
|
|
70677
70692
|
await prewarmSessionFile(params.sessionFile);
|
|
70678
70693
|
const transcriptPolicy = resolveTranscriptPolicy({
|
|
@@ -70757,13 +70772,13 @@ async function compactEmbeddedPiSessionDirect(params) {
|
|
|
70757
70772
|
messages: preCompactionMessages,
|
|
70758
70773
|
sessionFile: params.sessionFile
|
|
70759
70774
|
}, hookCtx).catch((hookErr) => {
|
|
70760
|
-
log$
|
|
70775
|
+
log$5.warn(`before_compaction hook failed: ${String(hookErr)}`);
|
|
70761
70776
|
});
|
|
70762
|
-
const diagEnabled = log$
|
|
70777
|
+
const diagEnabled = log$5.isEnabled("debug");
|
|
70763
70778
|
const preMetrics = diagEnabled ? summarizeCompactionMessages(session.messages) : void 0;
|
|
70764
70779
|
if (diagEnabled && preMetrics) {
|
|
70765
|
-
log$
|
|
70766
|
-
log$
|
|
70780
|
+
log$5.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"}`);
|
|
70781
|
+
log$5.debug(`[compaction-diag] contributors diagId=${diagId} top=${JSON.stringify(preMetrics.contributors)}`);
|
|
70767
70782
|
}
|
|
70768
70783
|
const compactStartedAt = Date.now();
|
|
70769
70784
|
const result = await compactWithSafetyTimeout(() => session.compact(params.customInstructions));
|
|
@@ -70781,10 +70796,10 @@ async function compactEmbeddedPiSessionDirect(params) {
|
|
|
70781
70796
|
compactedCount: limited.length - session.messages.length,
|
|
70782
70797
|
sessionFile: params.sessionFile
|
|
70783
70798
|
}, hookCtx).catch((hookErr) => {
|
|
70784
|
-
log$
|
|
70799
|
+
log$5.warn(`after_compaction hook failed: ${hookErr}`);
|
|
70785
70800
|
});
|
|
70786
70801
|
const postMetrics = diagEnabled ? summarizeCompactionMessages(session.messages) : void 0;
|
|
70787
|
-
if (diagEnabled && preMetrics && postMetrics) log$
|
|
70802
|
+
if (diagEnabled && preMetrics && postMetrics) log$5.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"}`);
|
|
70788
70803
|
return {
|
|
70789
70804
|
ok: true,
|
|
70790
70805
|
compacted: true,
|