@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
|
@@ -3448,7 +3448,7 @@ function resolveMemoryBackendConfig(params) {
|
|
|
3448
3448
|
|
|
3449
3449
|
//#endregion
|
|
3450
3450
|
//#region src/memory/search-manager.ts
|
|
3451
|
-
const log$
|
|
3451
|
+
const log$10 = createSubsystemLogger("memory");
|
|
3452
3452
|
const QMD_MANAGER_CACHE = /* @__PURE__ */ new Map();
|
|
3453
3453
|
async function getMemorySearchManager(params) {
|
|
3454
3454
|
const resolved = resolveMemoryBackendConfig(params);
|
|
@@ -3481,7 +3481,7 @@ async function getMemorySearchManager(params) {
|
|
|
3481
3481
|
}
|
|
3482
3482
|
} catch (err) {
|
|
3483
3483
|
const message = err instanceof Error ? err.message : String(err);
|
|
3484
|
-
log$
|
|
3484
|
+
log$10.warn(`qmd memory unavailable; falling back to builtin: ${message}`);
|
|
3485
3485
|
}
|
|
3486
3486
|
}
|
|
3487
3487
|
try {
|
|
@@ -3508,7 +3508,7 @@ var FallbackMemoryManager = class {
|
|
|
3508
3508
|
} catch (err) {
|
|
3509
3509
|
this.primaryFailed = true;
|
|
3510
3510
|
this.lastError = err instanceof Error ? err.message : String(err);
|
|
3511
|
-
log$
|
|
3511
|
+
log$10.warn(`qmd memory failed; switching to builtin index: ${this.lastError}`);
|
|
3512
3512
|
await this.deps.primary.close?.().catch(() => {});
|
|
3513
3513
|
this.evictCacheEntry();
|
|
3514
3514
|
}
|
|
@@ -3588,12 +3588,12 @@ var FallbackMemoryManager = class {
|
|
|
3588
3588
|
try {
|
|
3589
3589
|
fallback = await this.deps.fallbackFactory();
|
|
3590
3590
|
if (!fallback) {
|
|
3591
|
-
log$
|
|
3591
|
+
log$10.warn("memory fallback requested but builtin index is unavailable");
|
|
3592
3592
|
return null;
|
|
3593
3593
|
}
|
|
3594
3594
|
} catch (err) {
|
|
3595
3595
|
const message = err instanceof Error ? err.message : String(err);
|
|
3596
|
-
log$
|
|
3596
|
+
log$10.warn(`memory fallback unavailable: ${message}`);
|
|
3597
3597
|
return null;
|
|
3598
3598
|
}
|
|
3599
3599
|
this.fallback = fallback;
|
|
@@ -17253,7 +17253,7 @@ function createRunRegistry(options) {
|
|
|
17253
17253
|
|
|
17254
17254
|
//#endregion
|
|
17255
17255
|
//#region src/process/supervisor/supervisor.ts
|
|
17256
|
-
const log$
|
|
17256
|
+
const log$9 = createSubsystemLogger("process/supervisor");
|
|
17257
17257
|
function clampTimeout(value) {
|
|
17258
17258
|
if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) return;
|
|
17259
17259
|
return Math.max(1, Math.floor(value));
|
|
@@ -17439,7 +17439,7 @@ function createProcessSupervisor() {
|
|
|
17439
17439
|
exitCode: null,
|
|
17440
17440
|
exitSignal: null
|
|
17441
17441
|
});
|
|
17442
|
-
log$
|
|
17442
|
+
log$9.warn(`spawn failed: runId=${runId} reason=${String(err)}`);
|
|
17443
17443
|
throw err;
|
|
17444
17444
|
}
|
|
17445
17445
|
};
|
|
@@ -34770,7 +34770,7 @@ function createNodesTool(options) {
|
|
|
34770
34770
|
|
|
34771
34771
|
//#endregion
|
|
34772
34772
|
//#region src/gateway/session-utils.ts
|
|
34773
|
-
const log$
|
|
34773
|
+
const log$8 = createSubsystemLogger("session-utils");
|
|
34774
34774
|
const AVATAR_MAX_BYTES = 2 * 1024 * 1024;
|
|
34775
34775
|
function isStorePathTemplate(store) {
|
|
34776
34776
|
return typeof store === "string" && store.includes("{agentId}");
|
|
@@ -35633,7 +35633,7 @@ async function resolveAnnounceTarget(params) {
|
|
|
35633
35633
|
|
|
35634
35634
|
//#endregion
|
|
35635
35635
|
//#region src/agents/tools/sessions-send-tool.a2a.ts
|
|
35636
|
-
const log$
|
|
35636
|
+
const log$7 = createSubsystemLogger("agents/sessions-send");
|
|
35637
35637
|
async function runSessionsSendA2AFlow(params) {
|
|
35638
35638
|
const runContextId = params.waitRunId ?? "unknown";
|
|
35639
35639
|
try {
|
|
@@ -35724,7 +35724,7 @@ async function runSessionsSendA2AFlow(params) {
|
|
|
35724
35724
|
timeoutMs: 1e4
|
|
35725
35725
|
});
|
|
35726
35726
|
} catch (err) {
|
|
35727
|
-
log$
|
|
35727
|
+
log$7.warn("sessions_send announce delivery failed", {
|
|
35728
35728
|
runId: runContextId,
|
|
35729
35729
|
channel: announceTarget.channel,
|
|
35730
35730
|
to: announceTarget.to,
|
|
@@ -35732,7 +35732,7 @@ async function runSessionsSendA2AFlow(params) {
|
|
|
35732
35732
|
});
|
|
35733
35733
|
}
|
|
35734
35734
|
} catch (err) {
|
|
35735
|
-
log$
|
|
35735
|
+
log$7.warn("sessions_send announce flow failed", {
|
|
35736
35736
|
runId: runContextId,
|
|
35737
35737
|
error: formatErrorMessage(err)
|
|
35738
35738
|
});
|
|
@@ -38762,7 +38762,7 @@ function resolveRunWorkspaceDir(params) {
|
|
|
38762
38762
|
|
|
38763
38763
|
//#endregion
|
|
38764
38764
|
//#region src/agents/cli-runner.ts
|
|
38765
|
-
const log$
|
|
38765
|
+
const log$6 = createSubsystemLogger("agent/claude-cli");
|
|
38766
38766
|
async function runCliAgent(params) {
|
|
38767
38767
|
const started = Date.now();
|
|
38768
38768
|
const workspaceResolution = resolveRunWorkspaceDir({
|
|
@@ -38775,7 +38775,7 @@ async function runCliAgent(params) {
|
|
|
38775
38775
|
const redactedSessionId = redactRunIdentifier(params.sessionId);
|
|
38776
38776
|
const redactedSessionKey = redactRunIdentifier(params.sessionKey);
|
|
38777
38777
|
const redactedWorkspace = redactRunIdentifier(resolvedWorkspace);
|
|
38778
|
-
if (workspaceResolution.usedFallback) log$
|
|
38778
|
+
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}`);
|
|
38779
38779
|
const workspaceDir = resolvedWorkspace;
|
|
38780
38780
|
const backendResolved = resolveCliBackendConfig(params.provider, params.config);
|
|
38781
38781
|
if (!backendResolved) throw new Error(`Unknown CLI backend: ${params.provider}`);
|
|
@@ -38792,7 +38792,7 @@ async function runCliAgent(params) {
|
|
|
38792
38792
|
sessionId: params.sessionId,
|
|
38793
38793
|
warn: makeBootstrapWarn({
|
|
38794
38794
|
sessionLabel,
|
|
38795
|
-
warn: (message) => log$
|
|
38795
|
+
warn: (message) => log$6.warn(message)
|
|
38796
38796
|
})
|
|
38797
38797
|
});
|
|
38798
38798
|
const { defaultAgentId, sessionAgentId } = resolveSessionAgentIds({
|
|
@@ -38858,7 +38858,7 @@ async function runCliAgent(params) {
|
|
|
38858
38858
|
const queueKey = backend.serialize ?? true ? backendResolved.id : `${backendResolved.id}:${params.runId}`;
|
|
38859
38859
|
try {
|
|
38860
38860
|
const output = await enqueueCliRun(queueKey, async () => {
|
|
38861
|
-
log$
|
|
38861
|
+
log$6.info(`cli exec: provider=${params.provider} model=${normalizedModel} promptChars=${params.prompt.length}`);
|
|
38862
38862
|
const logOutputText = isTruthyEnvValue(process.env.SYMI_CLAUDE_CLI_LOG_OUTPUT);
|
|
38863
38863
|
if (logOutputText) {
|
|
38864
38864
|
const logArgs = [];
|
|
@@ -38891,7 +38891,7 @@ async function runCliAgent(params) {
|
|
|
38891
38891
|
const promptIndex = logArgs.indexOf(argsPrompt);
|
|
38892
38892
|
if (promptIndex >= 0) logArgs[promptIndex] = `<prompt:${argsPrompt.length} chars>`;
|
|
38893
38893
|
}
|
|
38894
|
-
log$
|
|
38894
|
+
log$6.info(`cli argv: ${backend.command} ${logArgs.join(" ")}`);
|
|
38895
38895
|
}
|
|
38896
38896
|
const env = (() => {
|
|
38897
38897
|
const next = {
|
|
@@ -38929,17 +38929,17 @@ async function runCliAgent(params) {
|
|
|
38929
38929
|
const stdout = result.stdout.trim();
|
|
38930
38930
|
const stderr = result.stderr.trim();
|
|
38931
38931
|
if (logOutputText) {
|
|
38932
|
-
if (stdout) log$
|
|
38933
|
-
if (stderr) log$
|
|
38932
|
+
if (stdout) log$6.info(`cli stdout:\n${stdout}`);
|
|
38933
|
+
if (stderr) log$6.info(`cli stderr:\n${stderr}`);
|
|
38934
38934
|
}
|
|
38935
38935
|
if (shouldLogVerbose()) {
|
|
38936
|
-
if (stdout) log$
|
|
38937
|
-
if (stderr) log$
|
|
38936
|
+
if (stdout) log$6.debug(`cli stdout:\n${stdout}`);
|
|
38937
|
+
if (stderr) log$6.debug(`cli stderr:\n${stderr}`);
|
|
38938
38938
|
}
|
|
38939
38939
|
if (result.exitCode !== 0 || result.reason !== "exit") {
|
|
38940
38940
|
if (result.reason === "no-output-timeout" || result.noOutputTimedOut) {
|
|
38941
38941
|
const timeoutReason = `CLI produced no output for ${Math.round(noOutputTimeoutMs / 1e3)}s and was terminated.`;
|
|
38942
|
-
log$
|
|
38942
|
+
log$6.warn(`cli watchdog timeout: provider=${params.provider} model=${modelId} session=${cliSessionIdToSend ?? params.sessionId} noOutputTimeoutMs=${noOutputTimeoutMs} pid=${managedRun.pid ?? "unknown"}`);
|
|
38943
38943
|
throw new FailoverError(timeoutReason, {
|
|
38944
38944
|
reason: "timeout",
|
|
38945
38945
|
provider: params.provider,
|
|
@@ -39258,7 +39258,7 @@ function resolveEmbeddedSessionLane(key) {
|
|
|
39258
39258
|
|
|
39259
39259
|
//#endregion
|
|
39260
39260
|
//#region src/agents/pi-embedded-runner/logger.ts
|
|
39261
|
-
const log$
|
|
39261
|
+
const log$5 = createSubsystemLogger("agent/embedded");
|
|
39262
39262
|
|
|
39263
39263
|
//#endregion
|
|
39264
39264
|
//#region src/utils/safe-json.ts
|
|
@@ -39304,7 +39304,7 @@ function getQueuedFileWriter(writers, filePath) {
|
|
|
39304
39304
|
//#endregion
|
|
39305
39305
|
//#region src/agents/anthropic-payload-log.ts
|
|
39306
39306
|
const writers$1 = /* @__PURE__ */ new Map();
|
|
39307
|
-
const log$
|
|
39307
|
+
const log$4 = createSubsystemLogger("agent/anthropic-payload");
|
|
39308
39308
|
function resolvePayloadLogConfig(env) {
|
|
39309
39309
|
const enabled = parseBooleanValue$1(env.SYMI_ANTHROPIC_PAYLOAD_LOG) ?? false;
|
|
39310
39310
|
const fileOverride = env.SYMI_ANTHROPIC_PAYLOAD_LOG_FILE?.trim();
|
|
@@ -39394,13 +39394,13 @@ function createAnthropicPayloadLogger(params) {
|
|
|
39394
39394
|
usage,
|
|
39395
39395
|
error: errorMessage
|
|
39396
39396
|
});
|
|
39397
|
-
log$
|
|
39397
|
+
log$4.info("anthropic usage", {
|
|
39398
39398
|
runId: params.runId,
|
|
39399
39399
|
sessionId: params.sessionId,
|
|
39400
39400
|
usage
|
|
39401
39401
|
});
|
|
39402
39402
|
};
|
|
39403
|
-
log$
|
|
39403
|
+
log$4.info("anthropic payload logger enabled", { filePath: writer.filePath });
|
|
39404
39404
|
return {
|
|
39405
39405
|
enabled: true,
|
|
39406
39406
|
wrapStreamFn,
|
|
@@ -41492,7 +41492,7 @@ function createEmbeddedPiSessionEventHandler(ctx) {
|
|
|
41492
41492
|
//#region src/agents/pi-embedded-subscribe.ts
|
|
41493
41493
|
const THINKING_TAG_SCAN_RE = /<\s*(\/?)\s*(?:think(?:ing)?|thought|antthinking)\s*>/gi;
|
|
41494
41494
|
const FINAL_TAG_SCAN_RE = /<\s*(\/?)\s*final\s*>/gi;
|
|
41495
|
-
const log$
|
|
41495
|
+
const log$3 = createSubsystemLogger("agent/embedded");
|
|
41496
41496
|
function subscribeEmbeddedPiSession(params) {
|
|
41497
41497
|
const reasoningMode = params.reasoningMode ?? "off";
|
|
41498
41498
|
const useMarkdown = (params.toolResultFormat ?? "markdown") === "markdown";
|
|
@@ -41649,7 +41649,7 @@ function subscribeEmbeddedPiSession(params) {
|
|
|
41649
41649
|
state.compactionRetryReject = reject;
|
|
41650
41650
|
});
|
|
41651
41651
|
state.compactionRetryPromise.catch((err) => {
|
|
41652
|
-
log$
|
|
41652
|
+
log$3.debug(`compaction promise rejected (no waiter): ${String(err)}`);
|
|
41653
41653
|
});
|
|
41654
41654
|
}
|
|
41655
41655
|
};
|
|
@@ -41801,7 +41801,7 @@ function subscribeEmbeddedPiSession(params) {
|
|
|
41801
41801
|
if (!chunk) return;
|
|
41802
41802
|
if (chunk === state.lastBlockReplyText) return;
|
|
41803
41803
|
if (isMessagingToolDuplicateNormalized(normalizeTextForComparison(chunk), messagingToolSentTextsNormalized)) {
|
|
41804
|
-
log$
|
|
41804
|
+
log$3.debug(`Skipping block reply - already sent via messaging tool: ${chunk.slice(0, 50)}...`);
|
|
41805
41805
|
return;
|
|
41806
41806
|
}
|
|
41807
41807
|
if (shouldSkipAssistantText(chunk)) return;
|
|
@@ -41879,7 +41879,7 @@ function subscribeEmbeddedPiSession(params) {
|
|
|
41879
41879
|
const ctx = {
|
|
41880
41880
|
params,
|
|
41881
41881
|
state,
|
|
41882
|
-
log: log$
|
|
41882
|
+
log: log$3,
|
|
41883
41883
|
blockChunking,
|
|
41884
41884
|
blockChunker,
|
|
41885
41885
|
hookRunner: params.hookRunner,
|
|
@@ -41912,7 +41912,7 @@ function subscribeEmbeddedPiSession(params) {
|
|
|
41912
41912
|
if (state.unsubscribed) return;
|
|
41913
41913
|
state.unsubscribed = true;
|
|
41914
41914
|
if (state.compactionRetryPromise) {
|
|
41915
|
-
log$
|
|
41915
|
+
log$3.debug(`unsubscribe: rejecting compaction wait runId=${params.runId}`);
|
|
41916
41916
|
const reject = state.compactionRetryReject;
|
|
41917
41917
|
state.compactionRetryResolve = void 0;
|
|
41918
41918
|
state.compactionRetryReject = void 0;
|
|
@@ -41922,11 +41922,11 @@ function subscribeEmbeddedPiSession(params) {
|
|
|
41922
41922
|
reject?.(abortErr);
|
|
41923
41923
|
}
|
|
41924
41924
|
if (params.session.isCompacting) {
|
|
41925
|
-
log$
|
|
41925
|
+
log$3.debug(`unsubscribe: aborting in-flight compaction runId=${params.runId}`);
|
|
41926
41926
|
try {
|
|
41927
41927
|
params.session.abortCompaction();
|
|
41928
41928
|
} catch (err) {
|
|
41929
|
-
log$
|
|
41929
|
+
log$3.warn(`unsubscribe: compaction abort failed runId=${params.runId} err=${String(err)}`);
|
|
41930
41930
|
}
|
|
41931
41931
|
}
|
|
41932
41932
|
sessionUnsubscribe();
|
|
@@ -41975,7 +41975,7 @@ function subscribeEmbeddedPiSession(params) {
|
|
|
41975
41975
|
|
|
41976
41976
|
//#endregion
|
|
41977
41977
|
//#region src/agents/pi-tools.before-tool-call.ts
|
|
41978
|
-
const log$
|
|
41978
|
+
const log$2 = createSubsystemLogger("agents/tools");
|
|
41979
41979
|
const BEFORE_TOOL_CALL_WRAPPED = Symbol("beforeToolCallWrapped");
|
|
41980
41980
|
const adjustedParamsByToolCallId = /* @__PURE__ */ new Map();
|
|
41981
41981
|
const MAX_TRACKED_ADJUSTED_PARAMS = 1024;
|
|
@@ -42009,7 +42009,7 @@ async function recordLoopOutcome(args) {
|
|
|
42009
42009
|
config: args.ctx.loopDetection
|
|
42010
42010
|
});
|
|
42011
42011
|
} catch (err) {
|
|
42012
|
-
log$
|
|
42012
|
+
log$2.warn(`tool loop outcome tracking failed: tool=${args.toolName} error=${String(err)}`);
|
|
42013
42013
|
}
|
|
42014
42014
|
}
|
|
42015
42015
|
async function runBeforeToolCallHook(args) {
|
|
@@ -42026,7 +42026,7 @@ async function runBeforeToolCallHook(args) {
|
|
|
42026
42026
|
const loopResult = detectToolCallLoop(sessionState, toolName, params, args.ctx.loopDetection);
|
|
42027
42027
|
if (loopResult.stuck) {
|
|
42028
42028
|
if (loopResult.level === "critical") {
|
|
42029
|
-
log$
|
|
42029
|
+
log$2.error(`Blocking ${toolName} due to critical loop: ${loopResult.message}`);
|
|
42030
42030
|
logToolLoopAction({
|
|
42031
42031
|
sessionKey: args.ctx.sessionKey,
|
|
42032
42032
|
sessionId: args.ctx?.agentId,
|
|
@@ -42043,7 +42043,7 @@ async function runBeforeToolCallHook(args) {
|
|
|
42043
42043
|
reason: loopResult.message
|
|
42044
42044
|
};
|
|
42045
42045
|
} else if (shouldEmitLoopWarning(sessionState, loopResult.warningKey ?? `${loopResult.detector}:${toolName}`, loopResult.count)) {
|
|
42046
|
-
log$
|
|
42046
|
+
log$2.warn(`Loop warning for ${toolName}: ${loopResult.message}`);
|
|
42047
42047
|
logToolLoopAction({
|
|
42048
42048
|
sessionKey: args.ctx.sessionKey,
|
|
42049
42049
|
sessionId: args.ctx?.agentId,
|
|
@@ -42093,7 +42093,7 @@ async function runBeforeToolCallHook(args) {
|
|
|
42093
42093
|
}
|
|
42094
42094
|
} catch (err) {
|
|
42095
42095
|
const toolCallId = args.toolCallId ? ` toolCallId=${args.toolCallId}` : "";
|
|
42096
|
-
log$
|
|
42096
|
+
log$2.warn(`before_tool_call hook failed: tool=${toolName}${toolCallId} error=${String(err)}`);
|
|
42097
42097
|
}
|
|
42098
42098
|
return {
|
|
42099
42099
|
blocked: false,
|
|
@@ -42337,6 +42337,7 @@ function validateShellCommand(command) {
|
|
|
42337
42337
|
|
|
42338
42338
|
//#endregion
|
|
42339
42339
|
//#region src/agents/pi-tools.validate-wrapper.ts
|
|
42340
|
+
const log$1 = createSubsystemLogger("agents/tool-validate");
|
|
42340
42341
|
const EXEC_TOOL_NAMES = new Set(["exec", "bash"]);
|
|
42341
42342
|
const FILE_TOOL_NAMES = new Set([
|
|
42342
42343
|
"write",
|
|
@@ -42361,8 +42362,14 @@ const FILE_PATH_KEYS = [
|
|
|
42361
42362
|
* Call this AFTER tools are created and the model profile is resolved.
|
|
42362
42363
|
*/
|
|
42363
42364
|
function wrapToolsWithArgValidation(tools, profile) {
|
|
42364
|
-
if (!profile.filters?.validateToolArgs)
|
|
42365
|
-
|
|
42365
|
+
if (!profile.filters?.validateToolArgs) {
|
|
42366
|
+
log$1.debug(`[validate] skipped — validateToolArgs=${profile.filters?.validateToolArgs ?? "undefined"} profile=${profile.label}`);
|
|
42367
|
+
return tools;
|
|
42368
|
+
}
|
|
42369
|
+
const wrapped = tools.map((tool) => wrapToolWithArgValidation(tool));
|
|
42370
|
+
const wrappedNames = wrapped.filter((t, i) => t !== tools[i]).map((t) => t.name);
|
|
42371
|
+
log$1.debug(`[validate] applied to ${wrappedNames.length} tools: ${wrappedNames.join(",") || "(none matched)"}`);
|
|
42372
|
+
return wrapped;
|
|
42366
42373
|
}
|
|
42367
42374
|
/**
|
|
42368
42375
|
* Clean a file path by stripping control token fragments.
|
|
@@ -42395,13 +42402,22 @@ function wrapToolWithArgValidation(tool) {
|
|
|
42395
42402
|
execute(toolCallId, params, ...rest) {
|
|
42396
42403
|
if (isExecTool) {
|
|
42397
42404
|
const command = params.command ?? params.cmd;
|
|
42398
|
-
if (typeof command !== "string")
|
|
42405
|
+
if (typeof command !== "string") {
|
|
42406
|
+
log$1.debug(`[validate] exec called without string command: keys=${Object.keys(params).join(",")}`);
|
|
42407
|
+
return originalExecute.call(tool, toolCallId, params, ...rest);
|
|
42408
|
+
}
|
|
42399
42409
|
const result = validateShellCommand(command);
|
|
42400
|
-
if (!result.valid)
|
|
42401
|
-
|
|
42402
|
-
|
|
42403
|
-
|
|
42404
|
-
|
|
42410
|
+
if (!result.valid) {
|
|
42411
|
+
log$1.warn(`[validate] exec command rejected: reason=${result.reason} raw=${command.slice(0, 100)}`);
|
|
42412
|
+
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.` });
|
|
42413
|
+
}
|
|
42414
|
+
if (result.cleaned !== command) {
|
|
42415
|
+
log$1.debug(`[validate] exec command cleaned: raw=${command.slice(0, 80)} → cleaned=${result.cleaned.slice(0, 80)}`);
|
|
42416
|
+
return originalExecute.call(tool, toolCallId, {
|
|
42417
|
+
...params,
|
|
42418
|
+
command: result.cleaned
|
|
42419
|
+
}, ...rest);
|
|
42420
|
+
}
|
|
42405
42421
|
return originalExecute.call(tool, toolCallId, params, ...rest);
|
|
42406
42422
|
}
|
|
42407
42423
|
const pathKey = FILE_PATH_KEYS.find((k) => typeof params[k] === "string");
|
|
@@ -42772,7 +42788,7 @@ async function truncateOversizedToolResultsInSession(params) {
|
|
|
42772
42788
|
const textLength = getToolResultTextLength(msg);
|
|
42773
42789
|
if (textLength > maxChars) {
|
|
42774
42790
|
oversizedIndices.push(i);
|
|
42775
|
-
log$
|
|
42791
|
+
log$5.info(`[tool-result-truncation] Found oversized tool result: entry=${entry.id} chars=${textLength} maxChars=${maxChars} sessionKey=${params.sessionKey ?? params.sessionId ?? "unknown"}`);
|
|
42776
42792
|
}
|
|
42777
42793
|
}
|
|
42778
42794
|
if (oversizedIndices.length === 0) return {
|
|
@@ -42794,7 +42810,7 @@ async function truncateOversizedToolResultsInSession(params) {
|
|
|
42794
42810
|
message = truncateToolResultMessage(message, maxChars);
|
|
42795
42811
|
truncatedCount++;
|
|
42796
42812
|
const newLength = getToolResultTextLength(message);
|
|
42797
|
-
log$
|
|
42813
|
+
log$5.info(`[tool-result-truncation] Truncated tool result: originalEntry=${entry.id} newChars=${newLength} sessionKey=${params.sessionKey ?? params.sessionId ?? "unknown"}`);
|
|
42798
42814
|
}
|
|
42799
42815
|
sessionManager.appendMessage(message);
|
|
42800
42816
|
} else if (entry.type === "compaction") sessionManager.appendCompaction(entry.summary, entry.firstKeptEntryId, entry.tokensBefore, entry.details, entry.fromHook);
|
|
@@ -42808,14 +42824,14 @@ async function truncateOversizedToolResultsInSession(params) {
|
|
|
42808
42824
|
if (entry.name) sessionManager.appendSessionInfo(entry.name);
|
|
42809
42825
|
}
|
|
42810
42826
|
}
|
|
42811
|
-
log$
|
|
42827
|
+
log$5.info(`[tool-result-truncation] Truncated ${truncatedCount} tool result(s) in session (contextWindow=${contextWindowTokens} maxChars=${maxChars}) sessionKey=${params.sessionKey ?? params.sessionId ?? "unknown"}`);
|
|
42812
42828
|
return {
|
|
42813
42829
|
truncated: true,
|
|
42814
42830
|
truncatedCount
|
|
42815
42831
|
};
|
|
42816
42832
|
} catch (err) {
|
|
42817
42833
|
const errMsg = err instanceof Error ? err.message : String(err);
|
|
42818
|
-
log$
|
|
42834
|
+
log$5.warn(`[tool-result-truncation] Failed to truncate: ${errMsg}`);
|
|
42819
42835
|
return {
|
|
42820
42836
|
truncated: false,
|
|
42821
42837
|
truncatedCount: 0,
|
|
@@ -44473,7 +44489,7 @@ function resolveAnthropicBetas(extraParams, provider, modelId) {
|
|
|
44473
44489
|
for (const beta of configured) if (typeof beta === "string" && beta.trim()) betas.add(beta.trim());
|
|
44474
44490
|
}
|
|
44475
44491
|
if (extraParams?.context1m === true) if (isAnthropic1MModel(modelId)) betas.add(ANTHROPIC_CONTEXT_1M_BETA);
|
|
44476
|
-
else log$
|
|
44492
|
+
else log$5.warn(`ignoring context1m for non-opus/sonnet model: ${provider}/${modelId}`);
|
|
44477
44493
|
return betas.size > 0 ? [...betas] : void 0;
|
|
44478
44494
|
}
|
|
44479
44495
|
function mergeAnthropicBetaHeader(headers, betas) {
|
|
@@ -45084,14 +45100,14 @@ function logToolSchemasForGoogle(params) {
|
|
|
45084
45100
|
if (params.provider !== "google-antigravity" && params.provider !== "google-gemini-cli") return;
|
|
45085
45101
|
const toolNames = params.tools.map((tool, index) => `${index}:${tool.name}`);
|
|
45086
45102
|
const tools = sanitizeToolsForGoogle(params);
|
|
45087
|
-
log$
|
|
45103
|
+
log$5.info("google tool schema snapshot", {
|
|
45088
45104
|
provider: params.provider,
|
|
45089
45105
|
toolCount: tools.length,
|
|
45090
45106
|
tools: toolNames
|
|
45091
45107
|
});
|
|
45092
45108
|
for (const [index, tool] of tools.entries()) {
|
|
45093
45109
|
const violations = findUnsupportedSchemaKeywords(tool.parameters, `${tool.name}.parameters`);
|
|
45094
|
-
if (violations.length > 0) log$
|
|
45110
|
+
if (violations.length > 0) log$5.warn("google tool schema has unsupported keywords", {
|
|
45095
45111
|
index,
|
|
45096
45112
|
tool: tool.name,
|
|
45097
45113
|
violations: violations.slice(0, 12),
|
|
@@ -45103,7 +45119,7 @@ const compactionFailureEmitter = new EventEmitter();
|
|
|
45103
45119
|
registerUnhandledRejectionHandler((reason) => {
|
|
45104
45120
|
const message = describeUnknownError(reason);
|
|
45105
45121
|
if (!isCompactionFailureError(message)) return false;
|
|
45106
|
-
log$
|
|
45122
|
+
log$5.error(`Auto-compaction failed (unhandled): ${message}`);
|
|
45107
45123
|
compactionFailureEmitter.emit("failure", message);
|
|
45108
45124
|
return true;
|
|
45109
45125
|
});
|
|
@@ -45155,7 +45171,7 @@ function applyGoogleTurnOrderingFix(params) {
|
|
|
45155
45171
|
const sanitized = sanitizeGoogleTurnOrdering(params.messages);
|
|
45156
45172
|
const didPrepend = sanitized !== params.messages;
|
|
45157
45173
|
if (didPrepend && !hasGoogleTurnOrderingMarker(params.sessionManager)) {
|
|
45158
|
-
(params.warn ?? ((message) => log$
|
|
45174
|
+
(params.warn ?? ((message) => log$5.warn(message)))(`google turn ordering fixup: prepended user bootstrap (sessionId=${params.sessionId})`);
|
|
45159
45175
|
markGoogleTurnOrderingMarker(params.sessionManager);
|
|
45160
45176
|
}
|
|
45161
45177
|
return {
|
|
@@ -45763,7 +45779,7 @@ function isImageExtension(filePath) {
|
|
|
45763
45779
|
}
|
|
45764
45780
|
async function sanitizeImagesWithLog(images, label, imageSanitization) {
|
|
45765
45781
|
const { images: sanitized, dropped } = await sanitizeImageBlocks(images, label, imageSanitization);
|
|
45766
|
-
if (dropped > 0) log$
|
|
45782
|
+
if (dropped > 0) log$5.warn(`Native image: dropped ${dropped} image(s) after sanitization (${label}).`);
|
|
45767
45783
|
return sanitized;
|
|
45768
45784
|
}
|
|
45769
45785
|
/**
|
|
@@ -45838,7 +45854,7 @@ async function loadImageFromRef(ref, workspaceDir, options) {
|
|
|
45838
45854
|
try {
|
|
45839
45855
|
let targetPath = ref.resolved;
|
|
45840
45856
|
if (ref.type === "url") {
|
|
45841
|
-
log$
|
|
45857
|
+
log$5.debug(`Native image: rejecting remote URL (local-only): ${ref.resolved}`);
|
|
45842
45858
|
return null;
|
|
45843
45859
|
}
|
|
45844
45860
|
if (ref.type === "path") {
|
|
@@ -45848,7 +45864,7 @@ async function loadImageFromRef(ref, workspaceDir, options) {
|
|
|
45848
45864
|
cwd: options.sandbox.root
|
|
45849
45865
|
}).hostPath;
|
|
45850
45866
|
} catch (err) {
|
|
45851
|
-
log$
|
|
45867
|
+
log$5.debug(`Native image: sandbox validation failed for ${ref.resolved}: ${err instanceof Error ? err.message : String(err)}`);
|
|
45852
45868
|
return null;
|
|
45853
45869
|
}
|
|
45854
45870
|
else if (!path.isAbsolute(targetPath)) targetPath = path.resolve(workspaceDir, targetPath);
|
|
@@ -45862,7 +45878,7 @@ async function loadImageFromRef(ref, workspaceDir, options) {
|
|
|
45862
45878
|
})
|
|
45863
45879
|
}) : await loadWebMedia(targetPath, options?.maxBytes);
|
|
45864
45880
|
if (media.kind !== "image") {
|
|
45865
|
-
log$
|
|
45881
|
+
log$5.debug(`Native image: not an image file: ${targetPath} (got ${media.kind})`);
|
|
45866
45882
|
return null;
|
|
45867
45883
|
}
|
|
45868
45884
|
const mimeType = media.contentType ?? "image/jpeg";
|
|
@@ -45872,7 +45888,7 @@ async function loadImageFromRef(ref, workspaceDir, options) {
|
|
|
45872
45888
|
mimeType
|
|
45873
45889
|
};
|
|
45874
45890
|
} catch (err) {
|
|
45875
|
-
log$
|
|
45891
|
+
log$5.debug(`Native image: failed to load ${ref.resolved}: ${err instanceof Error ? err.message : String(err)}`);
|
|
45876
45892
|
return null;
|
|
45877
45893
|
}
|
|
45878
45894
|
}
|
|
@@ -45971,7 +45987,7 @@ async function detectAndLoadPromptImages(params) {
|
|
|
45971
45987
|
loadedCount: 0,
|
|
45972
45988
|
skippedCount: 0
|
|
45973
45989
|
};
|
|
45974
|
-
log$
|
|
45990
|
+
log$5.debug(`Native image: detected ${allRefs.length} image refs (${promptRefs.length} in prompt, ${uniqueHistoryRefs.length} in history)`);
|
|
45975
45991
|
const promptImages = [...params.existingImages ?? []];
|
|
45976
45992
|
const historyImagesByIndex = /* @__PURE__ */ new Map();
|
|
45977
45993
|
let loadedCount = 0;
|
|
@@ -45988,7 +46004,7 @@ async function detectAndLoadPromptImages(params) {
|
|
|
45988
46004
|
else historyImagesByIndex.set(ref.messageIndex, [image]);
|
|
45989
46005
|
} else promptImages.push(image);
|
|
45990
46006
|
loadedCount++;
|
|
45991
|
-
log$
|
|
46007
|
+
log$5.debug(`Native image: loaded ${ref.type} ${ref.resolved}`);
|
|
45992
46008
|
} else skippedCount++;
|
|
45993
46009
|
}
|
|
45994
46010
|
const imageSanitization = { maxDimensionPx: params.maxDimensionPx };
|
|
@@ -46084,7 +46100,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
46084
46100
|
const resolvedWorkspace = resolveUserPath(params.workspaceDir);
|
|
46085
46101
|
const prevCwd = process.cwd();
|
|
46086
46102
|
const runAbortController = new AbortController();
|
|
46087
|
-
log$
|
|
46103
|
+
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"}`);
|
|
46088
46104
|
await fs$1.mkdir(resolvedWorkspace, { recursive: true });
|
|
46089
46105
|
const sandboxSessionKey = params.sessionKey?.trim() || params.sessionId;
|
|
46090
46106
|
const sandbox = await resolveSandboxContext({
|
|
@@ -46120,7 +46136,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
46120
46136
|
sessionId: params.sessionId,
|
|
46121
46137
|
warn: makeBootstrapWarn({
|
|
46122
46138
|
sessionLabel,
|
|
46123
|
-
warn: (message) => log$
|
|
46139
|
+
warn: (message) => log$5.warn(message)
|
|
46124
46140
|
})
|
|
46125
46141
|
});
|
|
46126
46142
|
const workspaceNotes = hookAdjustedBootstrapFiles.some((file) => file.name === DEFAULT_BOOTSTRAP_FILENAME && !file.missing) ? ["Reminder: commit your changes in this workspace after edits."] : void 0;
|
|
@@ -46307,7 +46323,9 @@ async function runEmbeddedAttempt(params) {
|
|
|
46307
46323
|
skillsPrompt,
|
|
46308
46324
|
tools
|
|
46309
46325
|
});
|
|
46310
|
-
const
|
|
46326
|
+
const profileModelKey = params.modelId ?? "";
|
|
46327
|
+
const modelProfile = resolveModelProfile(profileModelKey, params.config?.models?.profiles);
|
|
46328
|
+
log$5.debug(`[profile] resolved: modelId=${profileModelKey} → profile=${modelProfile.label} validateToolArgs=${modelProfile.filters?.validateToolArgs ?? false}`);
|
|
46311
46329
|
const systemPromptText = createSystemPromptOverride(appendPrompt + (modelProfile.promptAdditions.length > 0 ? "\n\n" + modelProfile.promptAdditions.join("\n") : ""))();
|
|
46312
46330
|
const sessionLock = await acquireSessionWriteLock({
|
|
46313
46331
|
sessionFile: params.sessionFile,
|
|
@@ -46319,7 +46337,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
46319
46337
|
try {
|
|
46320
46338
|
await repairSessionFileIfNeeded({
|
|
46321
46339
|
sessionFile: params.sessionFile,
|
|
46322
|
-
warn: (message) => log$
|
|
46340
|
+
warn: (message) => log$5.warn(message)
|
|
46323
46341
|
});
|
|
46324
46342
|
const hadSessionFile = await fs$1.stat(params.sessionFile).then(() => true).catch(() => false);
|
|
46325
46343
|
const transcriptPolicy = resolveTranscriptPolicy({
|
|
@@ -46328,7 +46346,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
46328
46346
|
modelId: params.modelId
|
|
46329
46347
|
});
|
|
46330
46348
|
const versionCheck = await handleSessionVersion(params.sessionFile);
|
|
46331
|
-
if (versionCheck.archived) log$
|
|
46349
|
+
if (versionCheck.archived) log$5.warn(`session archived: created by ${versionCheck.poisonVersion}, known corruption range → ${versionCheck.archivePath}`);
|
|
46332
46350
|
await prewarmSessionFile(params.sessionFile);
|
|
46333
46351
|
sessionManager = guardSessionManager(SessionManager.open(params.sessionFile), {
|
|
46334
46352
|
agentId: sessionAgentId,
|
|
@@ -46372,6 +46390,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
46372
46390
|
sandboxEnabled: !!sandbox?.enabled
|
|
46373
46391
|
});
|
|
46374
46392
|
const builtInTools = wrapToolsWithArgValidation(rawBuiltInTools, modelProfile);
|
|
46393
|
+
log$5.debug(`[tool-validate] profile=${modelProfile.label} validateToolArgs=${modelProfile.filters?.validateToolArgs ?? false} builtInTools=${builtInTools.length} toolNames=${builtInTools.map((t) => t.name).join(",")}`);
|
|
46375
46394
|
let clientToolCallDetected = null;
|
|
46376
46395
|
const clientToolLoopDetection = resolveToolLoopDetectionConfig({
|
|
46377
46396
|
cfg: params.config,
|
|
@@ -46583,7 +46602,6 @@ async function runEmbeddedAttempt(params) {
|
|
|
46583
46602
|
const TOOL_ERROR_ABORT_THRESHOLD = 5;
|
|
46584
46603
|
const TOOL_ERROR_WARN_THRESHOLD = 3;
|
|
46585
46604
|
let consecutiveToolErrors = 0;
|
|
46586
|
-
let lastErrorToolName = "";
|
|
46587
46605
|
const subscription = subscribeEmbeddedPiSession({
|
|
46588
46606
|
session: activeSession,
|
|
46589
46607
|
runId: params.runId,
|
|
@@ -46607,26 +46625,23 @@ async function runEmbeddedAttempt(params) {
|
|
|
46607
46625
|
params.onAgentEvent?.(evt);
|
|
46608
46626
|
if (evt.stream === "tool" && !aborted) {
|
|
46609
46627
|
const phase = typeof evt.data?.phase === "string" ? evt.data.phase : "";
|
|
46610
|
-
const toolName = typeof evt.data?.name === "string" ? evt.data.name : "";
|
|
46611
46628
|
const isError = evt.data?.isError === true;
|
|
46612
|
-
if (phase === "result"
|
|
46613
|
-
if (isError
|
|
46614
|
-
else
|
|
46615
|
-
consecutiveToolErrors = 1;
|
|
46616
|
-
lastErrorToolName = toolName;
|
|
46617
|
-
} else {
|
|
46618
|
-
consecutiveToolErrors = 0;
|
|
46619
|
-
lastErrorToolName = "";
|
|
46620
|
-
}
|
|
46629
|
+
if (phase === "result") {
|
|
46630
|
+
if (isError) consecutiveToolErrors++;
|
|
46631
|
+
else consecutiveToolErrors = 0;
|
|
46621
46632
|
if (consecutiveToolErrors >= TOOL_ERROR_ABORT_THRESHOLD) {
|
|
46622
|
-
|
|
46623
|
-
|
|
46624
|
-
|
|
46633
|
+
const toolName = typeof evt.data?.name === "string" ? evt.data.name : "unknown";
|
|
46634
|
+
log$5.error(`Agent-loop circuit breaker: ${consecutiveToolErrors} consecutive tool errors (last: ${toolName}). Aborting run ${params.runId}.`);
|
|
46635
|
+
abortRun(false, /* @__PURE__ */ new Error(`${consecutiveToolErrors} consecutive tool errors. The model may be generating corrupted tool arguments. Run aborted to prevent infinite loop.`));
|
|
46636
|
+
} else if (consecutiveToolErrors === TOOL_ERROR_WARN_THRESHOLD) {
|
|
46637
|
+
const toolName = typeof evt.data?.name === "string" ? evt.data.name : "unknown";
|
|
46638
|
+
log$5.warn(`Agent-loop tool error warning: ${consecutiveToolErrors} consecutive failures (last: ${toolName}). runId=${params.runId}`);
|
|
46639
|
+
}
|
|
46625
46640
|
}
|
|
46626
46641
|
}
|
|
46627
46642
|
if (evt.stream === "assistant" && typeof evt.data?.text === "string" && !aborted) {
|
|
46628
46643
|
streamMonitor.onChunk(evt.data.text);
|
|
46629
|
-
if (streamMonitor.shouldStop()) log$
|
|
46644
|
+
if (streamMonitor.shouldStop()) log$5.debug(`stream monitor detection (log-only, no abort): runId=${params.runId} reason=${streamMonitor.getStopReason()}`);
|
|
46630
46645
|
}
|
|
46631
46646
|
},
|
|
46632
46647
|
enforceFinalTag: params.enforceFinalTag,
|
|
@@ -46646,7 +46661,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
46646
46661
|
let abortWarnTimer;
|
|
46647
46662
|
const isProbeSession = params.sessionId?.startsWith("probe-") ?? false;
|
|
46648
46663
|
const abortTimer = setTimeout(() => {
|
|
46649
|
-
if (!isProbeSession) log$
|
|
46664
|
+
if (!isProbeSession) log$5.warn(`embedded run timeout: runId=${params.runId} sessionId=${params.sessionId} timeoutMs=${params.timeoutMs}`);
|
|
46650
46665
|
if (shouldFlagCompactionTimeout({
|
|
46651
46666
|
isTimeout: true,
|
|
46652
46667
|
isCompactionPendingOrRetrying: subscription.isCompacting(),
|
|
@@ -46655,7 +46670,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
46655
46670
|
abortRun(true);
|
|
46656
46671
|
if (!abortWarnTimer) abortWarnTimer = setTimeout(() => {
|
|
46657
46672
|
if (!activeSession.isStreaming) return;
|
|
46658
|
-
if (!isProbeSession) log$
|
|
46673
|
+
if (!isProbeSession) log$5.warn(`embedded run abort still streaming: runId=${params.runId} sessionId=${params.sessionId}`);
|
|
46659
46674
|
}, 1e4);
|
|
46660
46675
|
}, Math.max(1, params.timeoutMs));
|
|
46661
46676
|
armSymipulseTimer = () => {
|
|
@@ -46663,7 +46678,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
46663
46678
|
clearSymipulseTimer();
|
|
46664
46679
|
symipulseTimer = setTimeout(() => {
|
|
46665
46680
|
if (aborted) return;
|
|
46666
|
-
if (!isProbeSession) log$
|
|
46681
|
+
if (!isProbeSession) log$5.warn(`symipulse timeout: runId=${params.runId} sessionId=${params.sessionId} symipulseMs=${symipulseMs} (no activity)`);
|
|
46667
46682
|
if (shouldFlagCompactionTimeout({
|
|
46668
46683
|
isTimeout: true,
|
|
46669
46684
|
isCompactionPendingOrRetrying: subscription.isCompacting(),
|
|
@@ -46707,13 +46722,13 @@ async function runEmbeddedAttempt(params) {
|
|
|
46707
46722
|
prompt: params.prompt,
|
|
46708
46723
|
messages: activeSession.messages
|
|
46709
46724
|
}, hookCtx).catch((hookErr) => {
|
|
46710
|
-
log$
|
|
46725
|
+
log$5.warn(`before_prompt_build hook failed: ${String(hookErr)}`);
|
|
46711
46726
|
}) : void 0;
|
|
46712
46727
|
const legacyResult = hookRunner?.hasHooks("before_agent_start") ? await hookRunner.runBeforeAgentStart({
|
|
46713
46728
|
prompt: params.prompt,
|
|
46714
46729
|
messages: activeSession.messages
|
|
46715
46730
|
}, hookCtx).catch((hookErr) => {
|
|
46716
|
-
log$
|
|
46731
|
+
log$5.warn(`before_agent_start hook (legacy prompt build path) failed: ${String(hookErr)}`);
|
|
46717
46732
|
}) : void 0;
|
|
46718
46733
|
const hookResult = {
|
|
46719
46734
|
systemPrompt: promptBuildResult?.systemPrompt ?? legacyResult?.systemPrompt,
|
|
@@ -46721,7 +46736,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
46721
46736
|
};
|
|
46722
46737
|
if (hookResult?.prependContext) {
|
|
46723
46738
|
effectivePrompt = `${hookResult.prependContext}\n\n${params.prompt}`;
|
|
46724
|
-
log$
|
|
46739
|
+
log$5.debug(`hooks: prepended context to prompt (${hookResult.prependContext.length} chars)`);
|
|
46725
46740
|
}
|
|
46726
46741
|
{
|
|
46727
46742
|
const autoRecallAgentId = normalizeAgentId(params.sessionKey);
|
|
@@ -46738,11 +46753,11 @@ async function runEmbeddedAttempt(params) {
|
|
|
46738
46753
|
if (recallResults.length > 0) {
|
|
46739
46754
|
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>`;
|
|
46740
46755
|
effectivePrompt = `${recallBlock}\n\n${effectivePrompt}`;
|
|
46741
|
-
log$
|
|
46756
|
+
log$5.debug(`auto-recall: injected ${recallResults.length} snippets (${recallBlock.length} chars)`);
|
|
46742
46757
|
}
|
|
46743
46758
|
}
|
|
46744
46759
|
} catch (recallErr) {
|
|
46745
|
-
log$
|
|
46760
|
+
log$5.debug(`auto-recall: skipped (${String(recallErr)})`);
|
|
46746
46761
|
}
|
|
46747
46762
|
}
|
|
46748
46763
|
{
|
|
@@ -46754,10 +46769,10 @@ async function runEmbeddedAttempt(params) {
|
|
|
46754
46769
|
if (planResult.enter) {
|
|
46755
46770
|
if (planResult.stripped != null) effectivePrompt = planResult.stripped;
|
|
46756
46771
|
effectivePrompt = `${PLAN_MODE_SYSTEM_PROMPT}\n\n${effectivePrompt}`;
|
|
46757
|
-
log$
|
|
46772
|
+
log$5.info(`plan-mode: activated (${planResult.reason}) for runId=${params.runId}`);
|
|
46758
46773
|
} else if (planResult.stripped != null) effectivePrompt = planResult.stripped;
|
|
46759
46774
|
}
|
|
46760
|
-
log$
|
|
46775
|
+
log$5.debug(`embedded run prompt start: runId=${params.runId} sessionId=${params.sessionId}`);
|
|
46761
46776
|
cacheTrace?.recordStage("prompt:before", {
|
|
46762
46777
|
prompt: effectivePrompt,
|
|
46763
46778
|
messages: activeSession.messages
|
|
@@ -46769,7 +46784,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
46769
46784
|
const sessionContext = sessionManager.buildSessionContext();
|
|
46770
46785
|
const sanitizedOrphan = transcriptPolicy.sanitizeThinkingSignatures ? sanitizeAntigravityThinkingBlocks(sessionContext.messages) : sessionContext.messages;
|
|
46771
46786
|
activeSession.agent.replaceMessages(sanitizedOrphan);
|
|
46772
|
-
log$
|
|
46787
|
+
log$5.warn(`Removed orphaned user message to prevent consecutive user turns. runId=${params.runId} sessionId=${params.sessionId}`);
|
|
46773
46788
|
}
|
|
46774
46789
|
try {
|
|
46775
46790
|
const imageResult = await detectAndLoadPromptImages({
|
|
@@ -46791,12 +46806,12 @@ async function runEmbeddedAttempt(params) {
|
|
|
46791
46806
|
messages: activeSession.messages,
|
|
46792
46807
|
note: `images: prompt=${imageResult.images.length} history=${imageResult.historyImagesByIndex.size}`
|
|
46793
46808
|
});
|
|
46794
|
-
if (log$
|
|
46809
|
+
if (log$5.isEnabled("debug")) {
|
|
46795
46810
|
const msgCount = activeSession.messages.length;
|
|
46796
46811
|
const systemLen = systemPromptText?.length ?? 0;
|
|
46797
46812
|
const promptLen = effectivePrompt.length;
|
|
46798
46813
|
const sessionSummary = summarizeSessionContext(activeSession.messages);
|
|
46799
|
-
log$
|
|
46814
|
+
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}`);
|
|
46800
46815
|
}
|
|
46801
46816
|
if (hookRunner?.hasHooks("llm_input")) hookRunner.runLlmInput({
|
|
46802
46817
|
runId: params.runId,
|
|
@@ -46814,7 +46829,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
46814
46829
|
workspaceDir: params.workspaceDir,
|
|
46815
46830
|
messageProvider: params.messageProvider ?? void 0
|
|
46816
46831
|
}).catch((err) => {
|
|
46817
|
-
log$
|
|
46832
|
+
log$5.warn(`llm_input hook failed: ${String(err)}`);
|
|
46818
46833
|
});
|
|
46819
46834
|
if (imageResult.images.length > 0) await abortable(activeSession.prompt(effectivePrompt, { images: imageResult.images }));
|
|
46820
46835
|
else await abortable(activeSession.prompt(effectivePrompt));
|
|
@@ -46822,7 +46837,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
46822
46837
|
promptError = err;
|
|
46823
46838
|
promptErrorSource = "prompt";
|
|
46824
46839
|
} finally {
|
|
46825
|
-
log$
|
|
46840
|
+
log$5.debug(`embedded run prompt end: runId=${params.runId} sessionId=${params.sessionId} durationMs=${Date.now() - promptStartedAt}`);
|
|
46826
46841
|
}
|
|
46827
46842
|
const wasCompactingBefore = activeSession.isCompacting;
|
|
46828
46843
|
const snapshot = activeSession.messages.slice();
|
|
@@ -46837,7 +46852,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
46837
46852
|
promptError = err;
|
|
46838
46853
|
promptErrorSource = "compaction";
|
|
46839
46854
|
}
|
|
46840
|
-
if (!isProbeSession) log$
|
|
46855
|
+
if (!isProbeSession) log$5.debug(`compaction wait aborted: runId=${params.runId} sessionId=${params.sessionId}`);
|
|
46841
46856
|
} else throw err;
|
|
46842
46857
|
}
|
|
46843
46858
|
if (!timedOutDuringCompaction) {
|
|
@@ -46855,7 +46870,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
46855
46870
|
currentSessionId: activeSession.sessionId
|
|
46856
46871
|
});
|
|
46857
46872
|
if (timedOutDuringCompaction) {
|
|
46858
|
-
if (!isProbeSession) log$
|
|
46873
|
+
if (!isProbeSession) log$5.warn(`using ${snapshotSelection.source} snapshot: timed out during compaction runId=${params.runId} sessionId=${params.sessionId}`);
|
|
46859
46874
|
}
|
|
46860
46875
|
messagesSnapshot = snapshotSelection.messagesSnapshot;
|
|
46861
46876
|
sessionIdUsed = snapshotSelection.sessionIdUsed;
|
|
@@ -46870,7 +46885,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
46870
46885
|
error: describeUnknownError(promptError)
|
|
46871
46886
|
});
|
|
46872
46887
|
} catch (entryErr) {
|
|
46873
|
-
log$
|
|
46888
|
+
log$5.warn(`failed to persist prompt error entry: ${String(entryErr)}`);
|
|
46874
46889
|
}
|
|
46875
46890
|
cacheTrace?.recordStage("session:after", {
|
|
46876
46891
|
messages: messagesSnapshot,
|
|
@@ -46889,17 +46904,17 @@ async function runEmbeddedAttempt(params) {
|
|
|
46889
46904
|
workspaceDir: params.workspaceDir,
|
|
46890
46905
|
messageProvider: params.messageProvider ?? void 0
|
|
46891
46906
|
}).catch((err) => {
|
|
46892
|
-
log$
|
|
46907
|
+
log$5.warn(`agent_end hook failed: ${err}`);
|
|
46893
46908
|
});
|
|
46894
46909
|
} finally {
|
|
46895
46910
|
clearTimeout(abortTimer);
|
|
46896
46911
|
clearSymipulseTimer();
|
|
46897
46912
|
if (abortWarnTimer) clearTimeout(abortWarnTimer);
|
|
46898
|
-
if (!isProbeSession && (aborted || timedOut) && !timedOutDuringCompaction) log$
|
|
46913
|
+
if (!isProbeSession && (aborted || timedOut) && !timedOutDuringCompaction) log$5.debug(`run cleanup: runId=${params.runId} sessionId=${params.sessionId} aborted=${aborted} timedOut=${timedOut}`);
|
|
46899
46914
|
try {
|
|
46900
46915
|
unsubscribe();
|
|
46901
46916
|
} catch (err) {
|
|
46902
|
-
log$
|
|
46917
|
+
log$5.error(`CRITICAL: unsubscribe failed, possible resource leak: runId=${params.runId} ${String(err)}`);
|
|
46903
46918
|
}
|
|
46904
46919
|
clearActiveEmbeddedRun(params.sessionId, queueHandle, params.sessionKey);
|
|
46905
46920
|
params.abortSignal?.removeEventListener?.("abort", onAbort);
|
|
@@ -46924,7 +46939,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
46924
46939
|
workspaceDir: params.workspaceDir,
|
|
46925
46940
|
messageProvider: params.messageProvider ?? void 0
|
|
46926
46941
|
}).catch((err) => {
|
|
46927
|
-
log$
|
|
46942
|
+
log$5.warn(`llm_output hook failed: ${String(err)}`);
|
|
46928
46943
|
});
|
|
46929
46944
|
return {
|
|
46930
46945
|
aborted,
|
|
@@ -47185,7 +47200,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
47185
47200
|
const redactedSessionId = redactRunIdentifier(params.sessionId);
|
|
47186
47201
|
const redactedSessionKey = redactRunIdentifier(params.sessionKey);
|
|
47187
47202
|
const redactedWorkspace = redactRunIdentifier(resolvedWorkspace);
|
|
47188
|
-
if (workspaceResolution.usedFallback) log$
|
|
47203
|
+
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}`);
|
|
47189
47204
|
const prevCwd = process.cwd();
|
|
47190
47205
|
let provider = (params.provider ?? DEFAULT_PROVIDER).trim() || DEFAULT_PROVIDER;
|
|
47191
47206
|
let modelId = (params.model ?? DEFAULT_MODEL).trim() || DEFAULT_MODEL;
|
|
@@ -47204,7 +47219,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
47204
47219
|
if (hookRunner?.hasHooks("before_model_resolve")) try {
|
|
47205
47220
|
modelResolveOverride = await hookRunner.runBeforeModelResolve({ prompt: params.prompt }, hookCtx);
|
|
47206
47221
|
} catch (hookErr) {
|
|
47207
|
-
log$
|
|
47222
|
+
log$5.warn(`before_model_resolve hook failed: ${String(hookErr)}`);
|
|
47208
47223
|
}
|
|
47209
47224
|
if (hookRunner?.hasHooks("before_agent_start")) try {
|
|
47210
47225
|
const legacyResult = await hookRunner.runBeforeAgentStart({ prompt: params.prompt }, hookCtx);
|
|
@@ -47213,15 +47228,15 @@ async function runEmbeddedPiAgent(params) {
|
|
|
47213
47228
|
modelOverride: modelResolveOverride?.modelOverride ?? legacyResult?.modelOverride
|
|
47214
47229
|
};
|
|
47215
47230
|
} catch (hookErr) {
|
|
47216
|
-
log$
|
|
47231
|
+
log$5.warn(`before_agent_start hook (legacy model resolve path) failed: ${String(hookErr)}`);
|
|
47217
47232
|
}
|
|
47218
47233
|
if (modelResolveOverride?.providerOverride) {
|
|
47219
47234
|
provider = modelResolveOverride.providerOverride;
|
|
47220
|
-
log$
|
|
47235
|
+
log$5.info(`[hooks] provider overridden to ${provider}`);
|
|
47221
47236
|
}
|
|
47222
47237
|
if (modelResolveOverride?.modelOverride) {
|
|
47223
47238
|
modelId = modelResolveOverride.modelOverride;
|
|
47224
|
-
log$
|
|
47239
|
+
log$5.info(`[hooks] model overridden to ${modelId}`);
|
|
47225
47240
|
}
|
|
47226
47241
|
const { model, error, authStorage, modelRegistry } = resolveModel(provider, modelId, agentDir, params.config);
|
|
47227
47242
|
if (!model) throw new FailoverError(error ?? `Unknown model: ${provider}/${modelId}`, {
|
|
@@ -47241,9 +47256,9 @@ async function runEmbeddedPiAgent(params) {
|
|
|
47241
47256
|
warnBelowTokens: CONTEXT_WINDOW_WARN_BELOW_TOKENS,
|
|
47242
47257
|
hardMinTokens: CONTEXT_WINDOW_HARD_MIN_TOKENS
|
|
47243
47258
|
});
|
|
47244
|
-
if (ctxGuard.shouldWarn) log$
|
|
47259
|
+
if (ctxGuard.shouldWarn) log$5.warn(`low context window: ${provider}/${modelId} ctx=${ctxGuard.tokens} (warn<${CONTEXT_WINDOW_WARN_BELOW_TOKENS}) source=${ctxGuard.source}`);
|
|
47245
47260
|
if (ctxGuard.shouldBlock) {
|
|
47246
|
-
log$
|
|
47261
|
+
log$5.error(`blocked model (context window too small): ${provider}/${modelId} ctx=${ctxGuard.tokens} (min=${CONTEXT_WINDOW_HARD_MIN_TOKENS}) source=${ctxGuard.source}`);
|
|
47247
47262
|
throw new FailoverError(`Model context window too small (${ctxGuard.tokens} tokens). Minimum is ${CONTEXT_WINDOW_HARD_MIN_TOKENS}.`, {
|
|
47248
47263
|
reason: "unknown",
|
|
47249
47264
|
provider,
|
|
@@ -47373,7 +47388,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
47373
47388
|
while (true) {
|
|
47374
47389
|
if (runLoopIterations >= MAX_RUN_LOOP_ITERATIONS) {
|
|
47375
47390
|
const message = `Exceeded retry limit after ${runLoopIterations} attempts (max=${MAX_RUN_LOOP_ITERATIONS}).`;
|
|
47376
|
-
log$
|
|
47391
|
+
log$5.error(`[run-retry-limit] sessionKey=${params.sessionKey ?? params.sessionId} provider=${provider}/${modelId} attempts=${runLoopIterations} maxAttempts=${MAX_RUN_LOOP_ITERATIONS}`);
|
|
47377
47392
|
return {
|
|
47378
47393
|
payloads: [{
|
|
47379
47394
|
text: "Request failed after repeated internal retries. Please try again, or use /new to start a fresh session.",
|
|
@@ -47494,18 +47509,18 @@ async function runEmbeddedPiAgent(params) {
|
|
|
47494
47509
|
const overflowDiagId = createCompactionDiagId$1();
|
|
47495
47510
|
const errorText = contextOverflowError.text;
|
|
47496
47511
|
const msgCount = attempt.messagesSnapshot?.length ?? 0;
|
|
47497
|
-
log$
|
|
47512
|
+
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)}`);
|
|
47498
47513
|
const isCompactionFailure = isCompactionFailureError(errorText);
|
|
47499
47514
|
const hadAttemptLevelCompaction = attemptCompactionCount > 0;
|
|
47500
47515
|
if (!isCompactionFailure && hadAttemptLevelCompaction && overflowCompactionAttempts < MAX_OVERFLOW_COMPACTION_ATTEMPTS) {
|
|
47501
47516
|
overflowCompactionAttempts++;
|
|
47502
|
-
log$
|
|
47517
|
+
log$5.warn(`context overflow persisted after in-attempt compaction (attempt ${overflowCompactionAttempts}/${MAX_OVERFLOW_COMPACTION_ATTEMPTS}); retrying prompt without additional compaction for ${provider}/${modelId}`);
|
|
47503
47518
|
continue;
|
|
47504
47519
|
}
|
|
47505
47520
|
if (!isCompactionFailure && !hadAttemptLevelCompaction && overflowCompactionAttempts < MAX_OVERFLOW_COMPACTION_ATTEMPTS) {
|
|
47506
|
-
if (log$
|
|
47521
|
+
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}`);
|
|
47507
47522
|
overflowCompactionAttempts++;
|
|
47508
|
-
log$
|
|
47523
|
+
log$5.warn(`context overflow detected (attempt ${overflowCompactionAttempts}/${MAX_OVERFLOW_COMPACTION_ATTEMPTS}); attempting auto-compaction for ${provider}/${modelId}`);
|
|
47509
47524
|
const compactResult = await compactEmbeddedPiSessionDirect({
|
|
47510
47525
|
sessionId: params.sessionId,
|
|
47511
47526
|
sessionKey: params.sessionKey,
|
|
@@ -47534,10 +47549,10 @@ async function runEmbeddedPiAgent(params) {
|
|
|
47534
47549
|
});
|
|
47535
47550
|
if (compactResult.compacted) {
|
|
47536
47551
|
autoCompactionCount += 1;
|
|
47537
|
-
log$
|
|
47552
|
+
log$5.info(`auto-compaction succeeded for ${provider}/${modelId}; retrying prompt`);
|
|
47538
47553
|
continue;
|
|
47539
47554
|
}
|
|
47540
|
-
log$
|
|
47555
|
+
log$5.warn(`auto-compaction failed for ${provider}/${modelId}: ${compactResult.reason ?? "nothing to compact"}`);
|
|
47541
47556
|
}
|
|
47542
47557
|
if (!toolResultTruncationAttempted) {
|
|
47543
47558
|
const contextWindowTokens = ctxInfo.tokens;
|
|
@@ -47546,9 +47561,9 @@ async function runEmbeddedPiAgent(params) {
|
|
|
47546
47561
|
contextWindowTokens
|
|
47547
47562
|
}) : false;
|
|
47548
47563
|
if (hasOversized) {
|
|
47549
|
-
if (log$
|
|
47564
|
+
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}`);
|
|
47550
47565
|
toolResultTruncationAttempted = true;
|
|
47551
|
-
log$
|
|
47566
|
+
log$5.warn(`[context-overflow-recovery] Attempting tool result truncation for ${provider}/${modelId} (contextWindow=${contextWindowTokens} tokens)`);
|
|
47552
47567
|
const truncResult = await truncateOversizedToolResultsInSession({
|
|
47553
47568
|
sessionFile: params.sessionFile,
|
|
47554
47569
|
contextWindowTokens,
|
|
@@ -47556,13 +47571,13 @@ async function runEmbeddedPiAgent(params) {
|
|
|
47556
47571
|
sessionKey: params.sessionKey
|
|
47557
47572
|
});
|
|
47558
47573
|
if (truncResult.truncated) {
|
|
47559
|
-
log$
|
|
47574
|
+
log$5.info(`[context-overflow-recovery] Truncated ${truncResult.truncatedCount} tool result(s); retrying prompt`);
|
|
47560
47575
|
continue;
|
|
47561
47576
|
}
|
|
47562
|
-
log$
|
|
47563
|
-
} else if (log$
|
|
47577
|
+
log$5.warn(`[context-overflow-recovery] Tool result truncation did not help: ${truncResult.reason ?? "unknown"}`);
|
|
47578
|
+
} 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}`);
|
|
47564
47579
|
}
|
|
47565
|
-
if ((isCompactionFailure || overflowCompactionAttempts >= MAX_OVERFLOW_COMPACTION_ATTEMPTS || toolResultTruncationAttempted) && log$
|
|
47580
|
+
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}`);
|
|
47566
47581
|
const kind = isCompactionFailure ? "compaction_failure" : "context_overflow";
|
|
47567
47582
|
return {
|
|
47568
47583
|
payloads: [{
|
|
@@ -47643,7 +47658,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
47643
47658
|
attempted: attemptedThinking
|
|
47644
47659
|
});
|
|
47645
47660
|
if (fallbackThinking) {
|
|
47646
|
-
log$
|
|
47661
|
+
log$5.warn(`unsupported thinking level for ${provider}/${modelId}; retrying with ${fallbackThinking}`);
|
|
47647
47662
|
thinkLevel = fallbackThinking;
|
|
47648
47663
|
continue;
|
|
47649
47664
|
}
|
|
@@ -47661,7 +47676,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
47661
47676
|
attempted: attemptedThinking
|
|
47662
47677
|
});
|
|
47663
47678
|
if (fallbackThinking && !aborted) {
|
|
47664
|
-
log$
|
|
47679
|
+
log$5.warn(`unsupported thinking level for ${provider}/${modelId}; retrying with ${fallbackThinking}`);
|
|
47665
47680
|
thinkLevel = fallbackThinking;
|
|
47666
47681
|
continue;
|
|
47667
47682
|
}
|
|
@@ -47678,7 +47693,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
47678
47693
|
imageDimensionError.contentIndex !== void 0 ? `content=${imageDimensionError.contentIndex}` : null,
|
|
47679
47694
|
imageDimensionError.maxDimensionPx !== void 0 ? `limit=${imageDimensionError.maxDimensionPx}px` : null
|
|
47680
47695
|
].filter(Boolean).join(" ");
|
|
47681
|
-
log$
|
|
47696
|
+
log$5.warn(`Profile ${lastProfileId} rejected image payload${details ? ` (${details})` : ""}.`);
|
|
47682
47697
|
}
|
|
47683
47698
|
const isLocalOllamaTimeout = timedOut && model.api === "ollama";
|
|
47684
47699
|
if (!aborted && failoverFailure || timedOut && !timedOutDuringCompaction && !isLocalOllamaTimeout) {
|
|
@@ -47690,8 +47705,8 @@ async function runEmbeddedPiAgent(params) {
|
|
|
47690
47705
|
cfg: params.config,
|
|
47691
47706
|
agentDir: params.agentDir
|
|
47692
47707
|
});
|
|
47693
|
-
if (timedOut && !isProbeSession) log$
|
|
47694
|
-
if (cloudCodeAssistFormatError) log$
|
|
47708
|
+
if (timedOut && !isProbeSession) log$5.warn(`Profile ${lastProfileId} timed out (possible rate limit). Trying next account...`);
|
|
47709
|
+
if (cloudCodeAssistFormatError) log$5.warn(`Profile ${lastProfileId} hit Cloud Code Assist format error. Tool calls will be sanitized on retry.`);
|
|
47695
47710
|
}
|
|
47696
47711
|
if (await advanceAuthProfile()) continue;
|
|
47697
47712
|
if (fallbackConfigured) {
|
|
@@ -47757,7 +47772,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
47757
47772
|
const hasCodeBlocks = attempt.assistantTexts.some((text) => /```[\s\S]*?```/.test(text));
|
|
47758
47773
|
if (hasCodeToolUsage || hasCodeBlocks) {
|
|
47759
47774
|
verificationPassCompleted = true;
|
|
47760
|
-
log$
|
|
47775
|
+
log$5.debug(`[verification] starting verification pass: runId=${params.runId} sessionId=${params.sessionId} trigger=${hasCodeToolUsage ? "tool_usage" : "code_blocks"}`);
|
|
47761
47776
|
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.";
|
|
47762
47777
|
try {
|
|
47763
47778
|
const verifyAttempt = await runEmbeddedAttempt({
|
|
@@ -47843,10 +47858,10 @@ async function runEmbeddedPiAgent(params) {
|
|
|
47843
47858
|
payloads.length = 0;
|
|
47844
47859
|
payloads.push(...verifyPayloads);
|
|
47845
47860
|
}
|
|
47846
|
-
log$
|
|
47847
|
-
} else log$
|
|
47861
|
+
log$5.debug(`[verification] verification produced corrections: runId=${params.runId} tools=${verifyAttempt.toolMetas.length} texts=${verifyAttempt.assistantTexts.length}`);
|
|
47862
|
+
} else log$5.debug(`[verification] verification confirmed original response: runId=${params.runId}`);
|
|
47848
47863
|
} catch (verifyErr) {
|
|
47849
|
-
log$
|
|
47864
|
+
log$5.warn(`[verification] verification pass failed, keeping original response: runId=${params.runId} error=${String(verifyErr)}`);
|
|
47850
47865
|
}
|
|
47851
47866
|
}
|
|
47852
47867
|
}
|
|
@@ -47867,7 +47882,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
47867
47882
|
messagingToolSentTargets: attempt.messagingToolSentTargets,
|
|
47868
47883
|
successfulCronAdds: attempt.successfulCronAdds
|
|
47869
47884
|
};
|
|
47870
|
-
log$
|
|
47885
|
+
log$5.debug(`embedded run done: runId=${params.runId} sessionId=${params.sessionId} durationMs=${Date.now() - started} aborted=${aborted}`);
|
|
47871
47886
|
if (lastProfileId) {
|
|
47872
47887
|
await markAuthProfileGood({
|
|
47873
47888
|
store: authStore,
|
|
@@ -60588,7 +60603,7 @@ function isVoiceChannelType(type) {
|
|
|
60588
60603
|
function createDefaultDeps() {
|
|
60589
60604
|
return {
|
|
60590
60605
|
sendMessageWhatsApp: async (...args) => {
|
|
60591
|
-
const { sendMessageWhatsApp } = await import("./web-
|
|
60606
|
+
const { sendMessageWhatsApp } = await import("./web-D6iv7lpW.js");
|
|
60592
60607
|
return await sendMessageWhatsApp(...args);
|
|
60593
60608
|
},
|
|
60594
60609
|
sendMessageTelegram: async (...args) => {
|
|
@@ -75868,7 +75883,7 @@ function loadWebLoginQr() {
|
|
|
75868
75883
|
return webLoginQrPromise;
|
|
75869
75884
|
}
|
|
75870
75885
|
function loadWebChannel() {
|
|
75871
|
-
webChannelPromise ??= import("./web-
|
|
75886
|
+
webChannelPromise ??= import("./web-D6iv7lpW.js");
|
|
75872
75887
|
return webChannelPromise;
|
|
75873
75888
|
}
|
|
75874
75889
|
function loadWhatsAppActions() {
|
|
@@ -78224,7 +78239,7 @@ async function compactEmbeddedPiSessionDirect(params) {
|
|
|
78224
78239
|
const provider = (params.provider ?? DEFAULT_PROVIDER).trim() || DEFAULT_PROVIDER;
|
|
78225
78240
|
const modelId = (params.model ?? DEFAULT_MODEL).trim() || DEFAULT_MODEL;
|
|
78226
78241
|
const fail = (reason) => {
|
|
78227
|
-
log$
|
|
78242
|
+
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}`);
|
|
78228
78243
|
return {
|
|
78229
78244
|
ok: false,
|
|
78230
78245
|
compacted: false,
|
|
@@ -78292,7 +78307,7 @@ async function compactEmbeddedPiSessionDirect(params) {
|
|
|
78292
78307
|
sessionId: params.sessionId,
|
|
78293
78308
|
warn: makeBootstrapWarn({
|
|
78294
78309
|
sessionLabel,
|
|
78295
|
-
warn: (message) => log$
|
|
78310
|
+
warn: (message) => log$5.warn(message)
|
|
78296
78311
|
})
|
|
78297
78312
|
});
|
|
78298
78313
|
const runAbortController = new AbortController();
|
|
@@ -78432,7 +78447,7 @@ async function compactEmbeddedPiSessionDirect(params) {
|
|
|
78432
78447
|
try {
|
|
78433
78448
|
await repairSessionFileIfNeeded({
|
|
78434
78449
|
sessionFile: params.sessionFile,
|
|
78435
|
-
warn: (message) => log$
|
|
78450
|
+
warn: (message) => log$5.warn(message)
|
|
78436
78451
|
});
|
|
78437
78452
|
await prewarmSessionFile(params.sessionFile);
|
|
78438
78453
|
const transcriptPolicy = resolveTranscriptPolicy({
|
|
@@ -78517,13 +78532,13 @@ async function compactEmbeddedPiSessionDirect(params) {
|
|
|
78517
78532
|
messages: preCompactionMessages,
|
|
78518
78533
|
sessionFile: params.sessionFile
|
|
78519
78534
|
}, hookCtx).catch((hookErr) => {
|
|
78520
|
-
log$
|
|
78535
|
+
log$5.warn(`before_compaction hook failed: ${String(hookErr)}`);
|
|
78521
78536
|
});
|
|
78522
|
-
const diagEnabled = log$
|
|
78537
|
+
const diagEnabled = log$5.isEnabled("debug");
|
|
78523
78538
|
const preMetrics = diagEnabled ? summarizeCompactionMessages(session.messages) : void 0;
|
|
78524
78539
|
if (diagEnabled && preMetrics) {
|
|
78525
|
-
log$
|
|
78526
|
-
log$
|
|
78540
|
+
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"}`);
|
|
78541
|
+
log$5.debug(`[compaction-diag] contributors diagId=${diagId} top=${JSON.stringify(preMetrics.contributors)}`);
|
|
78527
78542
|
}
|
|
78528
78543
|
const compactStartedAt = Date.now();
|
|
78529
78544
|
const result = await compactWithSafetyTimeout(() => session.compact(params.customInstructions));
|
|
@@ -78541,10 +78556,10 @@ async function compactEmbeddedPiSessionDirect(params) {
|
|
|
78541
78556
|
compactedCount: limited.length - session.messages.length,
|
|
78542
78557
|
sessionFile: params.sessionFile
|
|
78543
78558
|
}, hookCtx).catch((hookErr) => {
|
|
78544
|
-
log$
|
|
78559
|
+
log$5.warn(`after_compaction hook failed: ${hookErr}`);
|
|
78545
78560
|
});
|
|
78546
78561
|
const postMetrics = diagEnabled ? summarizeCompactionMessages(session.messages) : void 0;
|
|
78547
|
-
if (diagEnabled && preMetrics && postMetrics) log$
|
|
78562
|
+
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"}`);
|
|
78548
78563
|
return {
|
|
78549
78564
|
ok: true,
|
|
78550
78565
|
compacted: true,
|