@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
|
@@ -10,10 +10,10 @@ import { $ as resolveSymiAgentDir, B as resolveApiKeyForProvider, C as normalize
|
|
|
10
10
|
import { n as formatCliCommand, r as resolveCliName, t as isTruthyEnvValue } from "./env-BDXYbTKj.js";
|
|
11
11
|
import { a as saveJsonFile, i as loadJsonFile } from "./github-copilot-token-cCYzSU9h.js";
|
|
12
12
|
import { t as parseBooleanValue$1 } from "./boolean-CE7i9tBR.js";
|
|
13
|
-
import { $ as normalizeDeliveryContext, A as isTransientHttpError, At as DEFAULT_UPLOAD_DIR, Bt as expandToolGroups, C as isContextOverflowError, Ct as resolveGroupSessionKey, D as isRateLimitAssistantError, Dt as registerBrowserRoutes, E as isLikelyContextOverflowError, Et as createBrowserRouteContext, F as resolveSandboxContext, Ft as resolveSandboxConfigForAgent, G as updateLastRoute, Gt as compileGlobPatterns, H as loadSessionStore, Ht as normalizeToolName, I as resolveSandboxRuntimeStatus, It as applyOwnerOnlyToolPolicy, J as isCacheEnabled, Jt as ensureSessionHeader, K as updateSessionStore, Kt as matchesAnyGlobPattern, L as extractDeliveryInfo, Lt as buildPluginToolGroups, M as parseImageSizeError, Mt as getBridgeAuthForPort, N as sanitizeUserFacingText, Nt as ensureBrowserControlAuth, O as isRawApiErrorPayload, Ot as resolveBrowserConfig, P as ensureSandboxWorkspaceForSession, Pt as resolveBrowserControlAuth, Q as mergeDeliveryContext, R as parseSessionThreadInfo, Rt as collectExplicitAllowlist, S as isCompactionFailureError, St as deriveSessionMetaPatch, T as isFailoverErrorMessage, Tt as resolveSessionLockMaxHoldFromTimeout, U as readSessionUpdatedAt, Ut as resolveToolProfilePolicy, V as resolveAndPersistSessionFile, Vt as mergeAlsoAllowPolicy, W as recordSessionMetaFromInbound, Wt as stripPluginOnlyAllowlist, X as deliveryContextFromSession, Xt as resolveBootstrapTotalMaxChars, Y as resolveCacheTtlMs$1, Yt as resolveBootstrapMaxChars, Z as deliveryContextKey, Zt as sanitizeGoogleTurnOrdering, _ as formatRawAssistantErrorForUi, _t as resolveFreshSessionTotalTokens, a as isMessagingToolDuplicateNormalized, at as extractToolCallNames, b as isBillingAssistantError, bt as resolveExplicitAgentSessionKey, c as extractToolCallsFromAssistant, ct as hasInterSessionUserProvenance, d as isAntigravityClaude, dt as evaluateSessionFreshness, et as normalizeSessionDeliveryFields, f as isGoogleModelApi, ft as resolveChannelResetConfig, g as formatBillingErrorMessage, gt as DEFAULT_RESET_TRIGGERS, h as formatAssistantErrorText, ht as resolveThreadFlag, it as countToolResults, j as parseImageDimensionError, jt as resolveExistingPathsWithinRoot, k as isTimeoutErrorMessage, kt as resolveProfile, l as extractToolResultId, lt as normalizeInputProvenance, m as classifyFailoverReason, mt as resolveSessionResetType, n as validateGeminiTurns, nt as archiveSessionTranscripts, o as normalizeTextForComparison, ot as INPUT_PROVENANCE_KIND_VALUES, p as BILLING_ERROR_USER_MESSAGE, pt as resolveSessionResetPolicy, q as updateSessionStoreEntry, qt as buildBootstrapContextFiles, r as pickFallbackThinkingLevel, rt as capArrayByJsonBytes, s as sanitizeSessionMessagesImages, st as applyInputProvenanceToUserMessage, t as validateAnthropicTurns, tt as normalizeAccountId$3, u as downgradeOpenAIReasoningBlocks, ut as resolveSessionKey, v as getApiErrorPayloadFingerprint, vt as canonicalizeMainSessionAlias, w as isFailoverAssistantError, wt as acquireSessionWriteLock, x as isCloudCodeAssistFormatError, xt as resolveMainSessionKey, y as isAuthAssistantError, z as appendAssistantMessageToSessionTranscript, zt as expandPolicyWithPluginGroups } from "./pi-embedded-helpers-
|
|
13
|
+
import { $ as normalizeDeliveryContext, A as isTransientHttpError, At as DEFAULT_UPLOAD_DIR, Bt as expandToolGroups, C as isContextOverflowError, Ct as resolveGroupSessionKey, D as isRateLimitAssistantError, Dt as registerBrowserRoutes, E as isLikelyContextOverflowError, Et as createBrowserRouteContext, F as resolveSandboxContext, Ft as resolveSandboxConfigForAgent, G as updateLastRoute, Gt as compileGlobPatterns, H as loadSessionStore, Ht as normalizeToolName, I as resolveSandboxRuntimeStatus, It as applyOwnerOnlyToolPolicy, J as isCacheEnabled, Jt as ensureSessionHeader, K as updateSessionStore, Kt as matchesAnyGlobPattern, L as extractDeliveryInfo, Lt as buildPluginToolGroups, M as parseImageSizeError, Mt as getBridgeAuthForPort, N as sanitizeUserFacingText, Nt as ensureBrowserControlAuth, O as isRawApiErrorPayload, Ot as resolveBrowserConfig, P as ensureSandboxWorkspaceForSession, Pt as resolveBrowserControlAuth, Q as mergeDeliveryContext, R as parseSessionThreadInfo, Rt as collectExplicitAllowlist, S as isCompactionFailureError, St as deriveSessionMetaPatch, T as isFailoverErrorMessage, Tt as resolveSessionLockMaxHoldFromTimeout, U as readSessionUpdatedAt, Ut as resolveToolProfilePolicy, V as resolveAndPersistSessionFile, Vt as mergeAlsoAllowPolicy, W as recordSessionMetaFromInbound, Wt as stripPluginOnlyAllowlist, X as deliveryContextFromSession, Xt as resolveBootstrapTotalMaxChars, Y as resolveCacheTtlMs$1, Yt as resolveBootstrapMaxChars, Z as deliveryContextKey, Zt as sanitizeGoogleTurnOrdering, _ as formatRawAssistantErrorForUi, _t as resolveFreshSessionTotalTokens, a as isMessagingToolDuplicateNormalized, at as extractToolCallNames, b as isBillingAssistantError, bt as resolveExplicitAgentSessionKey, c as extractToolCallsFromAssistant, ct as hasInterSessionUserProvenance, d as isAntigravityClaude, dt as evaluateSessionFreshness, et as normalizeSessionDeliveryFields, f as isGoogleModelApi, ft as resolveChannelResetConfig, g as formatBillingErrorMessage, gt as DEFAULT_RESET_TRIGGERS, h as formatAssistantErrorText, ht as resolveThreadFlag, it as countToolResults, j as parseImageDimensionError, jt as resolveExistingPathsWithinRoot, k as isTimeoutErrorMessage, kt as resolveProfile, l as extractToolResultId, lt as normalizeInputProvenance, m as classifyFailoverReason, mt as resolveSessionResetType, n as validateGeminiTurns, nt as archiveSessionTranscripts, o as normalizeTextForComparison, ot as INPUT_PROVENANCE_KIND_VALUES, p as BILLING_ERROR_USER_MESSAGE, pt as resolveSessionResetPolicy, q as updateSessionStoreEntry, qt as buildBootstrapContextFiles, r as pickFallbackThinkingLevel, rt as capArrayByJsonBytes, s as sanitizeSessionMessagesImages, st as applyInputProvenanceToUserMessage, t as validateAnthropicTurns, tt as normalizeAccountId$3, u as downgradeOpenAIReasoningBlocks, ut as resolveSessionKey, v as getApiErrorPayloadFingerprint, vt as canonicalizeMainSessionAlias, w as isFailoverAssistantError, wt as acquireSessionWriteLock, x as isCloudCodeAssistFormatError, xt as resolveMainSessionKey, y as isAuthAssistantError, z as appendAssistantMessageToSessionTranscript, zt as expandPolicyWithPluginGroups } from "./pi-embedded-helpers-pubKo8HQ.js";
|
|
14
14
|
import { A as VERSION, C as getConfigValueAtPath, D as isSafeExecutableValue, E as unsetConfigValueAtPath, O as DEFAULT_SUBAGENT_MAX_SPAWN_DEPTH, S as unsetConfigOverride, T as setConfigValueAtPath, _ as parseDurationMs, a as writeConfigFile, b as resetConfigOverrides, c as TELEGRAM_COMMAND_NAME_PATTERN, f as isInboundPathAllowed, g as normalizeScpRemoteHost, h as resolveIMessageRemoteAttachmentRoots, i as resolveConfigSnapshotHash, k as resolveAgentMaxConcurrent, l as normalizeTelegramCommandName, m as resolveIMessageAttachmentRoots, n as loadConfig, o as validateConfigObjectWithPlugins, r as readConfigFileSnapshot, u as resolveTelegramCustomCommands, v as validateJsonSchemaValue, w as parseConfigPath, x as setConfigOverride, y as getConfigOverrides } from "./config-5SdHIcHU.js";
|
|
15
15
|
import { a as applyTestPluginDefaults, c as resolveMemorySlotDecision, d as isDangerousHostEnvVarName, i as safeStatSync, n as discoverSymiPlugins, o as normalizePluginsConfig, r as isPathInside, s as resolveEnableState, t as loadPluginManifestRegistry, u as isPathInsideWithRealpath } from "./manifest-registry-yb7sAlu4.js";
|
|
16
|
-
import { C as rawDataToString, O as DEFAULT_AI_SNAPSHOT_MAX_CHARS, T as isSecureWebSocketUrl, x as ensureChromeExtensionRelayServer } from "./chrome-
|
|
16
|
+
import { C as rawDataToString, O as DEFAULT_AI_SNAPSHOT_MAX_CHARS, T as isSecureWebSocketUrl, x as ensureChromeExtensionRelayServer } from "./chrome-DYZwl5Gv.js";
|
|
17
17
|
import { c as assertSandboxPath, d as resolveSandboxedMediaSource, f as applySkillEnvOverrides, i as resolveSkillsPromptForRun, l as resolveSandboxInputPath, n as buildWorkspaceSkillSnapshot, p as applySkillEnvOverridesFromSnapshot, r as loadWorkspaceSkillEntries, s as assertMediaNotDataUrl } from "./skills-Bs0AW1g3.js";
|
|
18
18
|
import { n as formatErrorMessage, r as formatUncaughtError } from "./errors-XIsvXeC-.js";
|
|
19
19
|
import { c as detectMime, d as imageMimeFromFormat, f as isAudioFileName, g as MAX_IMAGE_BYTES, i as getImageMetadata, l as extensionForMime, p as isGifMedia, s as resizeToJpeg, v as mediaKindFromMime } from "./image-ops-C7CauEK8.js";
|
|
@@ -31,10 +31,10 @@ import { a as resolveSlackWebClientOptions, c as buildSlackBlocksFallbackText, i
|
|
|
31
31
|
import { $ as fetchChannelPermissionsDiscord, A as unpinMessageDiscord, B as listScheduledEventsDiscord, C as editMessageDiscord, Ct as resolveTimestampMs, D as pinMessageDiscord, Dt as normalizeChannelSlug, E as listThreadsDiscord, Et as buildChannelKeyCandidates, F as fetchMemberInfoDiscord, G as uploadStickerDiscord, H as timeoutMemberDiscord, I as fetchRoleInfoDiscord, J as editChannelDiscord, K as createChannelDiscord, L as fetchVoiceStatusDiscord, M as banMemberDiscord, N as createScheduledEventDiscord, O as readMessagesDiscord, Ot as resolveChannelEntryMatchWithFallback, P as fetchChannelInfoDiscord, Q as stripUndefinedFields, R as kickMemberDiscord, S as deleteMessageDiscord, St as resolveDiscordSystemLocation, T as listPinsDiscord, Tt as applyChannelMatchMeta, U as listGuildEmojisDiscord, V as removeRoleDiscord, W as uploadEmojiDiscord, X as removeChannelPermissionDiscord, Y as moveChannelDiscord, Z as setChannelPermissionDiscord, _ as sendPollDiscord, _t as resolveDiscordShouldRequireMention, a as removeReactionDiscord, at as resolveDiscordChannelId, b as sendWebhookMessageDiscord, bt as formatDiscordReactionEmoji, c as formatDiscordComponentEventText, ct as allowListMatches$1, d as parseDiscordModalCustomId, dt as normalizeDiscordSlug, et as hasAnyGuildPermissionDiscord, f as parseDiscordModalCustomIdForCarbon, ft as resolveDiscordAllowListMatch, g as sendMessageDiscord, gt as resolveDiscordOwnerAllowFrom, h as resolveDiscordModalEntry, ht as resolveDiscordMemberAccessState, i as removeOwnReactionsDiscord, it as parseDiscordTarget, j as addRoleDiscord, k as searchMessagesDiscord, l as parseDiscordComponentCustomId, lt as isDiscordGroupAllowedByPolicy, m as resolveDiscordComponentEntry, mt as resolveDiscordGuildEntry, n as fetchReactionsDiscord, nt as createDiscordClient, o as sendDiscordComponentMessage, ot as listDiscordDirectoryGroupsLive, p as readDiscordComponentSpec, pt as resolveDiscordChannelConfigWithFallback, q as deleteChannelDiscord, r as reactMessageDiscord, rt as createDiscordRestClient, s as createDiscordFormModal, st as listDiscordDirectoryPeersLive, tt as chunkDiscordTextWithMode, u as parseDiscordComponentCustomIdForCarbon, ut as normalizeDiscordAllowList, v as sendStickerDiscord, vt as resolveGroupDmAllow, w as fetchMessageDiscord, wt as fetchDiscord, x as createThreadDiscord, xt as formatDiscordUserTag, y as sendVoiceMessageDiscord, yt as shouldEmitDiscordReactionNotification, z as listGuildChannelsDiscord } from "./send-CvhXrdgS.js";
|
|
32
32
|
import { t as emitSessionTranscriptUpdate } from "./transcript-events-BBh3Gsrx.js";
|
|
33
33
|
import { i as resolveImageSanitizationLimits, n as sanitizeImageBlocks, r as sanitizeToolResultImages } from "./tool-images-SqqWIT22.js";
|
|
34
|
-
import { C as getGlobalHookRunner, S as parseInlineDirectives$1, _ as normalizeTargetForProvider, a as normalizeOutboundPayloadsForJson, b as MEDIA_TOKEN_RE, c as applyReplyThreading, d as isRenderablePayload, f as shouldSuppressMessagingToolReplies, g as normalizeChannelTargetInput, h as buildTargetResolverSignature, i as normalizeOutboundPayloads, l as filterMessagingToolDuplicates, m as resolveReplyToMode, o as normalizeReplyPayloadsForDelivery, p as createReplyToModeFilterForChannel, r as formatOutboundPayloadLog, s as applyReplyTagsToPayload, t as deliverOutboundPayloads, u as filterMessagingToolMediaDuplicates, v as throwIfAborted, w as initializeGlobalHookRunner, x as splitMediaFromOutput, y as parseReplyDirectives } from "./deliver-
|
|
34
|
+
import { C as getGlobalHookRunner, S as parseInlineDirectives$1, _ as normalizeTargetForProvider, a as normalizeOutboundPayloadsForJson, b as MEDIA_TOKEN_RE, c as applyReplyThreading, d as isRenderablePayload, f as shouldSuppressMessagingToolReplies, g as normalizeChannelTargetInput, h as buildTargetResolverSignature, i as normalizeOutboundPayloads, l as filterMessagingToolDuplicates, m as resolveReplyToMode, o as normalizeReplyPayloadsForDelivery, p as createReplyToModeFilterForChannel, r as formatOutboundPayloadLog, s as applyReplyTagsToPayload, t as deliverOutboundPayloads, u as filterMessagingToolMediaDuplicates, v as throwIfAborted, w as initializeGlobalHookRunner, x as splitMediaFromOutput, y as parseReplyDirectives } from "./deliver-dODxSv3b.js";
|
|
35
35
|
import { a as logMessageProcessed, c as logWebhookError, d as startDiagnosticHeartbeat, f as stopDiagnosticHeartbeat, i as logLaneEnqueue, l as logWebhookProcessed, m as isDiagnosticsEnabled, o as logMessageQueued, p as emitDiagnosticEvent, r as logLaneDequeue, s as logSessionStateChange, t as diag, u as logWebhookReceived } from "./diagnostic-rPhsBoZz.js";
|
|
36
36
|
import { r as getDiagnosticSessionState } from "./diagnostic-session-state-Zw87xFym.js";
|
|
37
|
-
import { S as ensureSymiModelsJson, _ as stripMinimaxToolCallXml, a as decodeDataUrl, b as stripReasoningTagsFromText, c as extractAssistantText$1, d as extractThinkingFromTaggedText, f as formatReasoningMessage, g as stripDowngradedToolCallText, h as promoteThinkingTagsToBlocks, i as coerceImageModelConfig, l as extractAssistantThinking, m as isAssistantMessage, o as resolveProviderVisionModelFromConfig, p as inferToolMetaFromArgs, r as coerceImageAssistantText, s as minimaxUnderstandImage, u as extractThinkingFromTaggedStream, v as stripThinkingTagsFromText, x as extractTextFromChatContent, y as resolveToolDisplay } from "./image-
|
|
37
|
+
import { S as ensureSymiModelsJson, _ as stripMinimaxToolCallXml, a as decodeDataUrl, b as stripReasoningTagsFromText, c as extractAssistantText$1, d as extractThinkingFromTaggedText, f as formatReasoningMessage, g as stripDowngradedToolCallText, h as promoteThinkingTagsToBlocks, i as coerceImageModelConfig, l as extractAssistantThinking, m as isAssistantMessage, o as resolveProviderVisionModelFromConfig, p as inferToolMetaFromArgs, r as coerceImageAssistantText, s as minimaxUnderstandImage, u as extractThinkingFromTaggedStream, v as stripThinkingTagsFromText, x as extractTextFromChatContent, y as resolveToolDisplay } from "./image-CXu8W39c.js";
|
|
38
38
|
import { a as isSilentReplyText, i as isSilentReplyPrefixText, n as SILENT_REPLY_TOKEN, r as SYMIPULSE_TOKEN, t as HEARTBEAT_TOKEN } from "./tokens-Bux9Y_xD.js";
|
|
39
39
|
import { $ as isVoiceCompatibleAudio, A as extractTelegramLocation, B as normalizeAllowFromWithStore$1, C as buildTelegramGroupFrom, D as buildTypingThreadParams, E as buildTelegramThreadParams, F as resolveTelegramMediaPlaceholder, G as formatLocationText, H as firstDefined$1, I as resolveTelegramReplyId, J as readChannelAllowFromStore, K as toLocationContext, L as resolveTelegramStreamMode, M as normalizeForwardedContext, N as resolveTelegramForumThreadId, O as describeReplyTarget, P as resolveTelegramGroupAllowFromContext, Q as listPairingChannels, R as resolveTelegramThreadSpec, S as buildSenderName, T as buildTelegramParentPeer, U as isSenderIdAllowed, V as resolveSenderAllowMatch, W as mergeAllowFromSources, X as upsertChannelPairingRequest, Y as removeChannelAllowFromStoreEntry, Z as getPairingAdapter, _ as resolveTelegramFetch, a as reactMessageTelegram, b as buildGroupLabel, c as sendStickerTelegram, d as wasSentByBot, et as parseTelegramTarget, f as isRecoverableTelegramNetworkError, g as wrapFileReferencesInHtml, h as renderTelegramHtmlText, i as editMessageTelegram, j as hasBotMention, k as expandTextLinks, m as markdownToTelegramHtml, n as createForumTopicTelegram, o as sendMessageTelegram, p as markdownToTelegramChunks, q as addChannelAllowFromStoreEntry, r as deleteMessageTelegram, s as sendPollTelegram, t as buildInlineKeyboard, tt as resolveTelegramTargetChatType, u as resolveTelegramVoiceSend, v as splitTelegramCaption, w as buildTelegramGroupPeerId, x as buildSenderLabel, y as withTelegramApiErrorLogging, z as isSenderAllowed$1 } from "./send-DYj_o4_F.js";
|
|
40
40
|
import { n as discoverModels, t as discoverAuthStorage } from "./pi-model-discovery-Bv5YDJc8.js";
|
|
@@ -49,7 +49,7 @@ import { n as fetchWithTimeout, t as bindAbortRelay } from "./fetch-timeout-DL3f
|
|
|
49
49
|
import { a as readResponseWithLimit, i as fetchRemoteMedia, n as getDefaultMediaLocalRoots, o as fetchWithSsrFGuard, t as getAgentScopedMediaLocalRoots } from "./local-roots-DhZz0Ybs.js";
|
|
50
50
|
import { a as loadWebMedia, i as getDefaultLocalRoots } from "./ir-CTiz95Vb.js";
|
|
51
51
|
import { _ as resolveNativeCommandsEnabled, a as listChatCommandsForConfig, c as normalizeCommandBody, d as resolveCommandArgMenu, f as serializeCommandArgs, g as isRestartEnabled, h as isNativeCommandsExplicitlyDisabled, i as listChatCommands, l as parseCommandArgs, m as isCommandFlagEnabled, o as listNativeCommandSpecs, p as shouldHandleTextCommands, r as findCommandByNativeName, s as listNativeCommandSpecsForConfig, t as buildCommandTextFromArgs, u as resolveCommandArgChoices, v as resolveNativeSkillsEnabled } from "./commands-registry-Bfc7Uz0o.js";
|
|
52
|
-
import { _ as CLI_OUTPUT_MAX_BUFFER, a as resolveMediaAttachmentLocalRoots, c as loadModelCatalog, d as resolveAttachmentKind, f as buildRandomTempFilePath, g as resolveMediaUnderstandingScope, h as normalizeMediaUnderstandingChatType, i as resolveAutoImageModel, l as modelSupportsVision, m as resolveTimeoutMs$1, n as createMediaAttachmentCache, o as runCapability, p as resolveConcurrency, r as normalizeMediaAttachments, s as findModelInCatalog, t as buildProviderRegistry, v as applyTemplate, y as registerUnhandledRejectionHandler } from "./runner-
|
|
52
|
+
import { _ as CLI_OUTPUT_MAX_BUFFER, a as resolveMediaAttachmentLocalRoots, c as loadModelCatalog, d as resolveAttachmentKind, f as buildRandomTempFilePath, g as resolveMediaUnderstandingScope, h as normalizeMediaUnderstandingChatType, i as resolveAutoImageModel, l as modelSupportsVision, m as resolveTimeoutMs$1, n as createMediaAttachmentCache, o as runCapability, p as resolveConcurrency, r as normalizeMediaAttachments, s as findModelInCatalog, t as buildProviderRegistry, v as applyTemplate, y as registerUnhandledRejectionHandler } from "./runner-WAG0M5s9.js";
|
|
53
53
|
import { c as getSkillsSnapshotVersion, d as createAsyncLock, f as readJsonFile, i as resolveSkillCommandInvocation, l as pruneExpiredPending, n as listSkillCommandsForAgents, o as getRemoteSkillEligibility, p as writeJsonAtomic, r as listSkillCommandsForWorkspace, s as ensureSkillsWatcher, t as listReservedChatSlashCommandNames, u as resolvePairingPaths } from "./skill-commands-DcVwOafC.js";
|
|
54
54
|
import { r as normalizeInboundTextNewlines, t as finalizeInboundContext } from "./inbound-context-DSDTl6Kj.js";
|
|
55
55
|
import { n as wrapFetchWithAbortSignal, t as resolveFetch } from "./fetch-Bso4i15F.js";
|
|
@@ -80,7 +80,7 @@ import AjvPkg from "ajv";
|
|
|
80
80
|
import { CURRENT_SESSION_VERSION, DefaultResourceLoader, SessionManager, SettingsManager, codingTools, createAgentSession, createEditTool, createReadTool, createWriteTool, estimateTokens, generateSummary, readTool } from "@mariozechner/pi-coding-agent";
|
|
81
81
|
import { createServer } from "node:http";
|
|
82
82
|
import { ProxyAgent, fetch as fetch$1 } from "undici";
|
|
83
|
-
import WebSocket
|
|
83
|
+
import WebSocket, { WebSocket as WebSocket$1 } from "ws";
|
|
84
84
|
import { Buffer as Buffer$1 } from "node:buffer";
|
|
85
85
|
import { EdgeTTS } from "node-edge-tts";
|
|
86
86
|
import { createJiti } from "jiti";
|
|
@@ -4201,7 +4201,7 @@ function resolveMemoryBackendConfig(params) {
|
|
|
4201
4201
|
|
|
4202
4202
|
//#endregion
|
|
4203
4203
|
//#region src/memory/search-manager.ts
|
|
4204
|
-
const log$
|
|
4204
|
+
const log$10 = createSubsystemLogger("memory");
|
|
4205
4205
|
const QMD_MANAGER_CACHE = /* @__PURE__ */ new Map();
|
|
4206
4206
|
async function getMemorySearchManager(params) {
|
|
4207
4207
|
const resolved = resolveMemoryBackendConfig(params);
|
|
@@ -4234,7 +4234,7 @@ async function getMemorySearchManager(params) {
|
|
|
4234
4234
|
}
|
|
4235
4235
|
} catch (err) {
|
|
4236
4236
|
const message = err instanceof Error ? err.message : String(err);
|
|
4237
|
-
log$
|
|
4237
|
+
log$10.warn(`qmd memory unavailable; falling back to builtin: ${message}`);
|
|
4238
4238
|
}
|
|
4239
4239
|
}
|
|
4240
4240
|
try {
|
|
@@ -4261,7 +4261,7 @@ var FallbackMemoryManager = class {
|
|
|
4261
4261
|
} catch (err) {
|
|
4262
4262
|
this.primaryFailed = true;
|
|
4263
4263
|
this.lastError = err instanceof Error ? err.message : String(err);
|
|
4264
|
-
log$
|
|
4264
|
+
log$10.warn(`qmd memory failed; switching to builtin index: ${this.lastError}`);
|
|
4265
4265
|
await this.deps.primary.close?.().catch(() => {});
|
|
4266
4266
|
this.evictCacheEntry();
|
|
4267
4267
|
}
|
|
@@ -4341,12 +4341,12 @@ var FallbackMemoryManager = class {
|
|
|
4341
4341
|
try {
|
|
4342
4342
|
fallback = await this.deps.fallbackFactory();
|
|
4343
4343
|
if (!fallback) {
|
|
4344
|
-
log$
|
|
4344
|
+
log$10.warn("memory fallback requested but builtin index is unavailable");
|
|
4345
4345
|
return null;
|
|
4346
4346
|
}
|
|
4347
4347
|
} catch (err) {
|
|
4348
4348
|
const message = err instanceof Error ? err.message : String(err);
|
|
4349
|
-
log$
|
|
4349
|
+
log$10.warn(`memory fallback unavailable: ${message}`);
|
|
4350
4350
|
return null;
|
|
4351
4351
|
}
|
|
4352
4352
|
this.fallback = fallback;
|
|
@@ -4922,7 +4922,7 @@ async function handleSlackAction(params, cfg, context) {
|
|
|
4922
4922
|
|
|
4923
4923
|
//#endregion
|
|
4924
4924
|
//#region src/agents/pi-embedded-runner/logger.ts
|
|
4925
|
-
const log$
|
|
4925
|
+
const log$9 = createSubsystemLogger("agent/embedded");
|
|
4926
4926
|
|
|
4927
4927
|
//#endregion
|
|
4928
4928
|
//#region src/agents/pi-embedded-runner/extra-params.ts
|
|
@@ -4990,7 +4990,7 @@ function resolveAnthropicBetas(extraParams, provider, modelId) {
|
|
|
4990
4990
|
for (const beta of configured) if (typeof beta === "string" && beta.trim()) betas.add(beta.trim());
|
|
4991
4991
|
}
|
|
4992
4992
|
if (extraParams?.context1m === true) if (isAnthropic1MModel(modelId)) betas.add(ANTHROPIC_CONTEXT_1M_BETA);
|
|
4993
|
-
else log$
|
|
4993
|
+
else log$9.warn(`ignoring context1m for non-opus/sonnet model: ${provider}/${modelId}`);
|
|
4994
4994
|
return betas.size > 0 ? [...betas] : void 0;
|
|
4995
4995
|
}
|
|
4996
4996
|
function mergeAnthropicBetaHeader(headers, betas) {
|
|
@@ -5901,14 +5901,14 @@ function logToolSchemasForGoogle(params) {
|
|
|
5901
5901
|
if (params.provider !== "google-antigravity" && params.provider !== "google-gemini-cli") return;
|
|
5902
5902
|
const toolNames = params.tools.map((tool, index) => `${index}:${tool.name}`);
|
|
5903
5903
|
const tools = sanitizeToolsForGoogle(params);
|
|
5904
|
-
log$
|
|
5904
|
+
log$9.info("google tool schema snapshot", {
|
|
5905
5905
|
provider: params.provider,
|
|
5906
5906
|
toolCount: tools.length,
|
|
5907
5907
|
tools: toolNames
|
|
5908
5908
|
});
|
|
5909
5909
|
for (const [index, tool] of tools.entries()) {
|
|
5910
5910
|
const violations = findUnsupportedSchemaKeywords(tool.parameters, `${tool.name}.parameters`);
|
|
5911
|
-
if (violations.length > 0) log$
|
|
5911
|
+
if (violations.length > 0) log$9.warn("google tool schema has unsupported keywords", {
|
|
5912
5912
|
index,
|
|
5913
5913
|
tool: tool.name,
|
|
5914
5914
|
violations: violations.slice(0, 12),
|
|
@@ -5920,7 +5920,7 @@ const compactionFailureEmitter = new EventEmitter();
|
|
|
5920
5920
|
registerUnhandledRejectionHandler((reason) => {
|
|
5921
5921
|
const message = describeUnknownError(reason);
|
|
5922
5922
|
if (!isCompactionFailureError(message)) return false;
|
|
5923
|
-
log$
|
|
5923
|
+
log$9.error(`Auto-compaction failed (unhandled): ${message}`);
|
|
5924
5924
|
compactionFailureEmitter.emit("failure", message);
|
|
5925
5925
|
return true;
|
|
5926
5926
|
});
|
|
@@ -5972,7 +5972,7 @@ function applyGoogleTurnOrderingFix(params) {
|
|
|
5972
5972
|
const sanitized = sanitizeGoogleTurnOrdering(params.messages);
|
|
5973
5973
|
const didPrepend = sanitized !== params.messages;
|
|
5974
5974
|
if (didPrepend && !hasGoogleTurnOrderingMarker(params.sessionManager)) {
|
|
5975
|
-
(params.warn ?? ((message) => log$
|
|
5975
|
+
(params.warn ?? ((message) => log$9.warn(message)))(`google turn ordering fixup: prepended user bootstrap (sessionId=${params.sessionId})`);
|
|
5976
5976
|
markGoogleTurnOrderingMarker(params.sessionManager);
|
|
5977
5977
|
}
|
|
5978
5978
|
return {
|
|
@@ -6765,7 +6765,7 @@ function applySystemPromptOverrideToSession(session, override) {
|
|
|
6765
6765
|
|
|
6766
6766
|
//#endregion
|
|
6767
6767
|
//#region src/agents/pi-tools.before-tool-call.ts
|
|
6768
|
-
const log$
|
|
6768
|
+
const log$8 = createSubsystemLogger("agents/tools");
|
|
6769
6769
|
const BEFORE_TOOL_CALL_WRAPPED = Symbol("beforeToolCallWrapped");
|
|
6770
6770
|
const adjustedParamsByToolCallId = /* @__PURE__ */ new Map();
|
|
6771
6771
|
const MAX_TRACKED_ADJUSTED_PARAMS = 1024;
|
|
@@ -6799,7 +6799,7 @@ async function recordLoopOutcome(args) {
|
|
|
6799
6799
|
config: args.ctx.loopDetection
|
|
6800
6800
|
});
|
|
6801
6801
|
} catch (err) {
|
|
6802
|
-
log$
|
|
6802
|
+
log$8.warn(`tool loop outcome tracking failed: tool=${args.toolName} error=${String(err)}`);
|
|
6803
6803
|
}
|
|
6804
6804
|
}
|
|
6805
6805
|
async function runBeforeToolCallHook(args) {
|
|
@@ -6816,7 +6816,7 @@ async function runBeforeToolCallHook(args) {
|
|
|
6816
6816
|
const loopResult = detectToolCallLoop(sessionState, toolName, params, args.ctx.loopDetection);
|
|
6817
6817
|
if (loopResult.stuck) {
|
|
6818
6818
|
if (loopResult.level === "critical") {
|
|
6819
|
-
log$
|
|
6819
|
+
log$8.error(`Blocking ${toolName} due to critical loop: ${loopResult.message}`);
|
|
6820
6820
|
logToolLoopAction({
|
|
6821
6821
|
sessionKey: args.ctx.sessionKey,
|
|
6822
6822
|
sessionId: args.ctx?.agentId,
|
|
@@ -6833,7 +6833,7 @@ async function runBeforeToolCallHook(args) {
|
|
|
6833
6833
|
reason: loopResult.message
|
|
6834
6834
|
};
|
|
6835
6835
|
} else if (shouldEmitLoopWarning(sessionState, loopResult.warningKey ?? `${loopResult.detector}:${toolName}`, loopResult.count)) {
|
|
6836
|
-
log$
|
|
6836
|
+
log$8.warn(`Loop warning for ${toolName}: ${loopResult.message}`);
|
|
6837
6837
|
logToolLoopAction({
|
|
6838
6838
|
sessionKey: args.ctx.sessionKey,
|
|
6839
6839
|
sessionId: args.ctx?.agentId,
|
|
@@ -6883,7 +6883,7 @@ async function runBeforeToolCallHook(args) {
|
|
|
6883
6883
|
}
|
|
6884
6884
|
} catch (err) {
|
|
6885
6885
|
const toolCallId = args.toolCallId ? ` toolCallId=${args.toolCallId}` : "";
|
|
6886
|
-
log$
|
|
6886
|
+
log$8.warn(`before_tool_call hook failed: tool=${toolName}${toolCallId} error=${String(err)}`);
|
|
6887
6887
|
}
|
|
6888
6888
|
return {
|
|
6889
6889
|
blocked: false,
|
|
@@ -8636,7 +8636,7 @@ var GatewayClient = class {
|
|
|
8636
8636
|
if (fingerprint !== expected) return /* @__PURE__ */ new Error("gateway tls fingerprint mismatch");
|
|
8637
8637
|
});
|
|
8638
8638
|
}
|
|
8639
|
-
this.ws = new WebSocket(url, wsOptions);
|
|
8639
|
+
this.ws = new WebSocket$1(url, wsOptions);
|
|
8640
8640
|
this.ws.on("open", () => {
|
|
8641
8641
|
if (url.startsWith("wss://") && this.opts.tlsFingerprint) {
|
|
8642
8642
|
const tlsError = this.validateTlsFingerprint();
|
|
@@ -8855,7 +8855,7 @@ var GatewayClient = class {
|
|
|
8855
8855
|
return null;
|
|
8856
8856
|
}
|
|
8857
8857
|
async request(method, params, opts) {
|
|
8858
|
-
if (!this.ws || this.ws.readyState !== WebSocket.OPEN) throw new Error("gateway not connected");
|
|
8858
|
+
if (!this.ws || this.ws.readyState !== WebSocket$1.OPEN) throw new Error("gateway not connected");
|
|
8859
8859
|
const id = randomUUID();
|
|
8860
8860
|
const frame = {
|
|
8861
8861
|
type: "req",
|
|
@@ -10121,7 +10121,7 @@ async function routeReply(params) {
|
|
|
10121
10121
|
const resolvedReplyToId = replyToId ?? (channelId === "slack" && threadId != null && threadId !== "" ? String(threadId) : void 0);
|
|
10122
10122
|
const resolvedThreadId = channelId === "slack" ? null : threadId ?? null;
|
|
10123
10123
|
try {
|
|
10124
|
-
const { deliverOutboundPayloads } = await import("./deliver-
|
|
10124
|
+
const { deliverOutboundPayloads } = await import("./deliver-dODxSv3b.js").then((n) => n.n);
|
|
10125
10125
|
return {
|
|
10126
10126
|
ok: true,
|
|
10127
10127
|
messageId: (await deliverOutboundPayloads({
|
|
@@ -20175,7 +20175,7 @@ function createRunRegistry(options) {
|
|
|
20175
20175
|
|
|
20176
20176
|
//#endregion
|
|
20177
20177
|
//#region src/process/supervisor/supervisor.ts
|
|
20178
|
-
const log$
|
|
20178
|
+
const log$7 = createSubsystemLogger("process/supervisor");
|
|
20179
20179
|
function clampTimeout(value) {
|
|
20180
20180
|
if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) return;
|
|
20181
20181
|
return Math.max(1, Math.floor(value));
|
|
@@ -20361,7 +20361,7 @@ function createProcessSupervisor() {
|
|
|
20361
20361
|
exitCode: null,
|
|
20362
20362
|
exitSignal: null
|
|
20363
20363
|
});
|
|
20364
|
-
log$
|
|
20364
|
+
log$7.warn(`spawn failed: runId=${runId} reason=${String(err)}`);
|
|
20365
20365
|
throw err;
|
|
20366
20366
|
}
|
|
20367
20367
|
};
|
|
@@ -36730,7 +36730,7 @@ function createNodesTool(options) {
|
|
|
36730
36730
|
|
|
36731
36731
|
//#endregion
|
|
36732
36732
|
//#region src/gateway/session-utils.ts
|
|
36733
|
-
const log$
|
|
36733
|
+
const log$6 = createSubsystemLogger("session-utils");
|
|
36734
36734
|
const AVATAR_MAX_BYTES = 2 * 1024 * 1024;
|
|
36735
36735
|
function isStorePathTemplate(store) {
|
|
36736
36736
|
return typeof store === "string" && store.includes("{agentId}");
|
|
@@ -37593,7 +37593,7 @@ async function resolveAnnounceTarget(params) {
|
|
|
37593
37593
|
|
|
37594
37594
|
//#endregion
|
|
37595
37595
|
//#region src/agents/tools/sessions-send-tool.a2a.ts
|
|
37596
|
-
const log$
|
|
37596
|
+
const log$5 = createSubsystemLogger("agents/sessions-send");
|
|
37597
37597
|
async function runSessionsSendA2AFlow(params) {
|
|
37598
37598
|
const runContextId = params.waitRunId ?? "unknown";
|
|
37599
37599
|
try {
|
|
@@ -37684,7 +37684,7 @@ async function runSessionsSendA2AFlow(params) {
|
|
|
37684
37684
|
timeoutMs: 1e4
|
|
37685
37685
|
});
|
|
37686
37686
|
} catch (err) {
|
|
37687
|
-
log$
|
|
37687
|
+
log$5.warn("sessions_send announce delivery failed", {
|
|
37688
37688
|
runId: runContextId,
|
|
37689
37689
|
channel: announceTarget.channel,
|
|
37690
37690
|
to: announceTarget.to,
|
|
@@ -37692,7 +37692,7 @@ async function runSessionsSendA2AFlow(params) {
|
|
|
37692
37692
|
});
|
|
37693
37693
|
}
|
|
37694
37694
|
} catch (err) {
|
|
37695
|
-
log$
|
|
37695
|
+
log$5.warn("sessions_send announce flow failed", {
|
|
37696
37696
|
runId: runContextId,
|
|
37697
37697
|
error: formatErrorMessage(err)
|
|
37698
37698
|
});
|
|
@@ -40648,7 +40648,7 @@ function buildCliArgs(params) {
|
|
|
40648
40648
|
|
|
40649
40649
|
//#endregion
|
|
40650
40650
|
//#region src/agents/cli-runner.ts
|
|
40651
|
-
const log$
|
|
40651
|
+
const log$4 = createSubsystemLogger("agent/claude-cli");
|
|
40652
40652
|
async function runCliAgent(params) {
|
|
40653
40653
|
const started = Date.now();
|
|
40654
40654
|
const workspaceResolution = resolveRunWorkspaceDir({
|
|
@@ -40661,7 +40661,7 @@ async function runCliAgent(params) {
|
|
|
40661
40661
|
const redactedSessionId = redactRunIdentifier(params.sessionId);
|
|
40662
40662
|
const redactedSessionKey = redactRunIdentifier(params.sessionKey);
|
|
40663
40663
|
const redactedWorkspace = redactRunIdentifier(resolvedWorkspace);
|
|
40664
|
-
if (workspaceResolution.usedFallback) log$
|
|
40664
|
+
if (workspaceResolution.usedFallback) log$4.warn(`[workspace-fallback] caller=runCliAgent reason=${workspaceResolution.fallbackReason} run=${params.runId} session=${redactedSessionId} sessionKey=${redactedSessionKey} agent=${workspaceResolution.agentId} workspace=${redactedWorkspace}`);
|
|
40665
40665
|
const workspaceDir = resolvedWorkspace;
|
|
40666
40666
|
const backendResolved = resolveCliBackendConfig(params.provider, params.config);
|
|
40667
40667
|
if (!backendResolved) throw new Error(`Unknown CLI backend: ${params.provider}`);
|
|
@@ -40678,7 +40678,7 @@ async function runCliAgent(params) {
|
|
|
40678
40678
|
sessionId: params.sessionId,
|
|
40679
40679
|
warn: makeBootstrapWarn({
|
|
40680
40680
|
sessionLabel,
|
|
40681
|
-
warn: (message) => log$
|
|
40681
|
+
warn: (message) => log$4.warn(message)
|
|
40682
40682
|
})
|
|
40683
40683
|
});
|
|
40684
40684
|
const { defaultAgentId, sessionAgentId } = resolveSessionAgentIds({
|
|
@@ -40744,7 +40744,7 @@ async function runCliAgent(params) {
|
|
|
40744
40744
|
const queueKey = backend.serialize ?? true ? backendResolved.id : `${backendResolved.id}:${params.runId}`;
|
|
40745
40745
|
try {
|
|
40746
40746
|
const output = await enqueueCliRun(queueKey, async () => {
|
|
40747
|
-
log$
|
|
40747
|
+
log$4.info(`cli exec: provider=${params.provider} model=${normalizedModel} promptChars=${params.prompt.length}`);
|
|
40748
40748
|
const logOutputText = isTruthyEnvValue(process.env.SYMI_CLAUDE_CLI_LOG_OUTPUT);
|
|
40749
40749
|
if (logOutputText) {
|
|
40750
40750
|
const logArgs = [];
|
|
@@ -40777,7 +40777,7 @@ async function runCliAgent(params) {
|
|
|
40777
40777
|
const promptIndex = logArgs.indexOf(argsPrompt);
|
|
40778
40778
|
if (promptIndex >= 0) logArgs[promptIndex] = `<prompt:${argsPrompt.length} chars>`;
|
|
40779
40779
|
}
|
|
40780
|
-
log$
|
|
40780
|
+
log$4.info(`cli argv: ${backend.command} ${logArgs.join(" ")}`);
|
|
40781
40781
|
}
|
|
40782
40782
|
const env = (() => {
|
|
40783
40783
|
const next = {
|
|
@@ -40815,17 +40815,17 @@ async function runCliAgent(params) {
|
|
|
40815
40815
|
const stdout = result.stdout.trim();
|
|
40816
40816
|
const stderr = result.stderr.trim();
|
|
40817
40817
|
if (logOutputText) {
|
|
40818
|
-
if (stdout) log$
|
|
40819
|
-
if (stderr) log$
|
|
40818
|
+
if (stdout) log$4.info(`cli stdout:\n${stdout}`);
|
|
40819
|
+
if (stderr) log$4.info(`cli stderr:\n${stderr}`);
|
|
40820
40820
|
}
|
|
40821
40821
|
if (shouldLogVerbose()) {
|
|
40822
|
-
if (stdout) log$
|
|
40823
|
-
if (stderr) log$
|
|
40822
|
+
if (stdout) log$4.debug(`cli stdout:\n${stdout}`);
|
|
40823
|
+
if (stderr) log$4.debug(`cli stderr:\n${stderr}`);
|
|
40824
40824
|
}
|
|
40825
40825
|
if (result.exitCode !== 0 || result.reason !== "exit") {
|
|
40826
40826
|
if (result.reason === "no-output-timeout" || result.noOutputTimedOut) {
|
|
40827
40827
|
const timeoutReason = `CLI produced no output for ${Math.round(noOutputTimeoutMs / 1e3)}s and was terminated.`;
|
|
40828
|
-
log$
|
|
40828
|
+
log$4.warn(`cli watchdog timeout: provider=${params.provider} model=${modelId} session=${cliSessionIdToSend ?? params.sessionId} noOutputTimeoutMs=${noOutputTimeoutMs} pid=${managedRun.pid ?? "unknown"}`);
|
|
40829
40829
|
throw new FailoverError(timeoutReason, {
|
|
40830
40830
|
reason: "timeout",
|
|
40831
40831
|
provider: params.provider,
|
|
@@ -43560,7 +43560,7 @@ async function deliverSessionMaintenanceWarning(params) {
|
|
|
43560
43560
|
return;
|
|
43561
43561
|
}
|
|
43562
43562
|
try {
|
|
43563
|
-
const { deliverOutboundPayloads } = await import("./deliver-
|
|
43563
|
+
const { deliverOutboundPayloads } = await import("./deliver-dODxSv3b.js").then((n) => n.n);
|
|
43564
43564
|
await deliverOutboundPayloads({
|
|
43565
43565
|
cfg: params.cfg,
|
|
43566
43566
|
channel,
|
|
@@ -47006,7 +47006,7 @@ async function describeStickerImage(params) {
|
|
|
47006
47006
|
logVerbose(`telegram: describing sticker with ${provider}/${model}`);
|
|
47007
47007
|
try {
|
|
47008
47008
|
const buffer = await fs$1.readFile(imagePath);
|
|
47009
|
-
const { describeImageWithModel } = await import("./image-
|
|
47009
|
+
const { describeImageWithModel } = await import("./image-CXu8W39c.js").then((n) => n.n);
|
|
47010
47010
|
return (await describeImageWithModel({
|
|
47011
47011
|
buffer,
|
|
47012
47012
|
fileName: "sticker.webp",
|
|
@@ -49668,7 +49668,7 @@ async function preflightDiscordMessage(params) {
|
|
|
49668
49668
|
let preflightTranscript;
|
|
49669
49669
|
const hasAudioAttachment = message.attachments?.some((att) => att.contentType?.startsWith("audio/"));
|
|
49670
49670
|
if (!isDirectMessage && shouldRequireMention && hasAudioAttachment && !baseText && mentionRegexes.length > 0) try {
|
|
49671
|
-
const { transcribeFirstAudio } = await import("./audio-preflight-
|
|
49671
|
+
const { transcribeFirstAudio } = await import("./audio-preflight-DHTaS5U1.js");
|
|
49672
49672
|
const audioPaths = message.attachments?.filter((att) => att.contentType?.startsWith("audio/")).map((att) => att.url) ?? [];
|
|
49673
49673
|
if (audioPaths.length > 0) preflightTranscript = await transcribeFirstAudio({
|
|
49674
49674
|
ctx: {
|
|
@@ -53674,7 +53674,7 @@ function isVoiceChannelType(type) {
|
|
|
53674
53674
|
function createDefaultDeps() {
|
|
53675
53675
|
return {
|
|
53676
53676
|
sendMessageWhatsApp: async (...args) => {
|
|
53677
|
-
const { sendMessageWhatsApp } = await import("./web-
|
|
53677
|
+
const { sendMessageWhatsApp } = await import("./web-DnKUPuUb.js");
|
|
53678
53678
|
return await sendMessageWhatsApp(...args);
|
|
53679
53679
|
},
|
|
53680
53680
|
sendMessageTelegram: async (...args) => {
|
|
@@ -56579,7 +56579,7 @@ function createDiscordGatewayPlugin(params) {
|
|
|
56579
56579
|
super(options);
|
|
56580
56580
|
}
|
|
56581
56581
|
createWebSocket(url) {
|
|
56582
|
-
return new WebSocket
|
|
56582
|
+
return new WebSocket(url, { agent });
|
|
56583
56583
|
}
|
|
56584
56584
|
}
|
|
56585
56585
|
return new ProxyGatewayPlugin();
|
|
@@ -66797,7 +66797,7 @@ const buildTelegramMessageContext = async ({ primaryCtx, allMedia, storeAllowFro
|
|
|
66797
66797
|
const hasAudio = allMedia.some((media) => media.contentType?.startsWith("audio/"));
|
|
66798
66798
|
let preflightTranscript;
|
|
66799
66799
|
if (isGroup && requireMention && hasAudio && !hasUserText && mentionRegexes.length > 0) try {
|
|
66800
|
-
const { transcribeFirstAudio } = await import("./audio-preflight-
|
|
66800
|
+
const { transcribeFirstAudio } = await import("./audio-preflight-DHTaS5U1.js");
|
|
66801
66801
|
preflightTranscript = await transcribeFirstAudio({
|
|
66802
66802
|
ctx: {
|
|
66803
66803
|
MediaPaths: allMedia.length > 0 ? allMedia.map((m) => m.path) : void 0,
|
|
@@ -68954,7 +68954,7 @@ function loadWebLoginQr() {
|
|
|
68954
68954
|
return webLoginQrPromise;
|
|
68955
68955
|
}
|
|
68956
68956
|
function loadWebChannel() {
|
|
68957
|
-
webChannelPromise ??= import("./web-
|
|
68957
|
+
webChannelPromise ??= import("./web-DnKUPuUb.js");
|
|
68958
68958
|
return webChannelPromise;
|
|
68959
68959
|
}
|
|
68960
68960
|
function loadWhatsAppActions() {
|
|
@@ -69638,7 +69638,7 @@ function createPluginLoaderLogger(logger) {
|
|
|
69638
69638
|
|
|
69639
69639
|
//#endregion
|
|
69640
69640
|
//#region src/plugins/tools.ts
|
|
69641
|
-
const log$
|
|
69641
|
+
const log$3 = createSubsystemLogger("plugins");
|
|
69642
69642
|
const pluginToolMeta = /* @__PURE__ */ new WeakMap();
|
|
69643
69643
|
function getPluginToolMeta(tool) {
|
|
69644
69644
|
return pluginToolMeta.get(tool);
|
|
@@ -69660,7 +69660,7 @@ function resolvePluginTools(params) {
|
|
|
69660
69660
|
const registry = loadSymiPlugins({
|
|
69661
69661
|
config: effectiveConfig,
|
|
69662
69662
|
workspaceDir: params.context.workspaceDir,
|
|
69663
|
-
logger: createPluginLoaderLogger(log$
|
|
69663
|
+
logger: createPluginLoaderLogger(log$3)
|
|
69664
69664
|
});
|
|
69665
69665
|
const tools = [];
|
|
69666
69666
|
const existing = params.existingToolNames ?? /* @__PURE__ */ new Set();
|
|
@@ -69672,7 +69672,7 @@ function resolvePluginTools(params) {
|
|
|
69672
69672
|
const pluginIdKey = normalizeToolName(entry.pluginId);
|
|
69673
69673
|
if (existingNormalized.has(pluginIdKey)) {
|
|
69674
69674
|
const message = `plugin id conflicts with core tool name (${entry.pluginId})`;
|
|
69675
|
-
log$
|
|
69675
|
+
log$3.error(message);
|
|
69676
69676
|
registry.diagnostics.push({
|
|
69677
69677
|
level: "error",
|
|
69678
69678
|
pluginId: entry.pluginId,
|
|
@@ -69686,7 +69686,7 @@ function resolvePluginTools(params) {
|
|
|
69686
69686
|
try {
|
|
69687
69687
|
resolved = entry.factory(params.context);
|
|
69688
69688
|
} catch (err) {
|
|
69689
|
-
log$
|
|
69689
|
+
log$3.error(`plugin tool failed (${entry.pluginId}): ${String(err)}`);
|
|
69690
69690
|
continue;
|
|
69691
69691
|
}
|
|
69692
69692
|
if (!resolved) continue;
|
|
@@ -69701,7 +69701,7 @@ function resolvePluginTools(params) {
|
|
|
69701
69701
|
for (const tool of list) {
|
|
69702
69702
|
if (nameSet.has(tool.name) || existing.has(tool.name)) {
|
|
69703
69703
|
const message = `plugin tool name conflict (${entry.pluginId}): ${tool.name}`;
|
|
69704
|
-
log$
|
|
69704
|
+
log$3.error(message);
|
|
69705
69705
|
registry.diagnostics.push({
|
|
69706
69706
|
level: "error",
|
|
69707
69707
|
pluginId: entry.pluginId,
|
|
@@ -71408,7 +71408,7 @@ async function truncateOversizedToolResultsInSession(params) {
|
|
|
71408
71408
|
const textLength = getToolResultTextLength(msg);
|
|
71409
71409
|
if (textLength > maxChars) {
|
|
71410
71410
|
oversizedIndices.push(i);
|
|
71411
|
-
log$
|
|
71411
|
+
log$9.info(`[tool-result-truncation] Found oversized tool result: entry=${entry.id} chars=${textLength} maxChars=${maxChars} sessionKey=${params.sessionKey ?? params.sessionId ?? "unknown"}`);
|
|
71412
71412
|
}
|
|
71413
71413
|
}
|
|
71414
71414
|
if (oversizedIndices.length === 0) return {
|
|
@@ -71430,7 +71430,7 @@ async function truncateOversizedToolResultsInSession(params) {
|
|
|
71430
71430
|
message = truncateToolResultMessage(message, maxChars);
|
|
71431
71431
|
truncatedCount++;
|
|
71432
71432
|
const newLength = getToolResultTextLength(message);
|
|
71433
|
-
log$
|
|
71433
|
+
log$9.info(`[tool-result-truncation] Truncated tool result: originalEntry=${entry.id} newChars=${newLength} sessionKey=${params.sessionKey ?? params.sessionId ?? "unknown"}`);
|
|
71434
71434
|
}
|
|
71435
71435
|
sessionManager.appendMessage(message);
|
|
71436
71436
|
} else if (entry.type === "compaction") sessionManager.appendCompaction(entry.summary, entry.firstKeptEntryId, entry.tokensBefore, entry.details, entry.fromHook);
|
|
@@ -71444,14 +71444,14 @@ async function truncateOversizedToolResultsInSession(params) {
|
|
|
71444
71444
|
if (entry.name) sessionManager.appendSessionInfo(entry.name);
|
|
71445
71445
|
}
|
|
71446
71446
|
}
|
|
71447
|
-
log$
|
|
71447
|
+
log$9.info(`[tool-result-truncation] Truncated ${truncatedCount} tool result(s) in session (contextWindow=${contextWindowTokens} maxChars=${maxChars}) sessionKey=${params.sessionKey ?? params.sessionId ?? "unknown"}`);
|
|
71448
71448
|
return {
|
|
71449
71449
|
truncated: true,
|
|
71450
71450
|
truncatedCount
|
|
71451
71451
|
};
|
|
71452
71452
|
} catch (err) {
|
|
71453
71453
|
const errMsg = err instanceof Error ? err.message : String(err);
|
|
71454
|
-
log$
|
|
71454
|
+
log$9.warn(`[tool-result-truncation] Failed to truncate: ${errMsg}`);
|
|
71455
71455
|
return {
|
|
71456
71456
|
truncated: false,
|
|
71457
71457
|
truncatedCount: 0,
|
|
@@ -72626,7 +72626,7 @@ async function compactEmbeddedPiSessionDirect(params) {
|
|
|
72626
72626
|
const provider = (params.provider ?? DEFAULT_PROVIDER).trim() || DEFAULT_PROVIDER;
|
|
72627
72627
|
const modelId = (params.model ?? DEFAULT_MODEL).trim() || DEFAULT_MODEL;
|
|
72628
72628
|
const fail = (reason) => {
|
|
72629
|
-
log$
|
|
72629
|
+
log$9.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}`);
|
|
72630
72630
|
return {
|
|
72631
72631
|
ok: false,
|
|
72632
72632
|
compacted: false,
|
|
@@ -72694,7 +72694,7 @@ async function compactEmbeddedPiSessionDirect(params) {
|
|
|
72694
72694
|
sessionId: params.sessionId,
|
|
72695
72695
|
warn: makeBootstrapWarn({
|
|
72696
72696
|
sessionLabel,
|
|
72697
|
-
warn: (message) => log$
|
|
72697
|
+
warn: (message) => log$9.warn(message)
|
|
72698
72698
|
})
|
|
72699
72699
|
});
|
|
72700
72700
|
const runAbortController = new AbortController();
|
|
@@ -72834,7 +72834,7 @@ async function compactEmbeddedPiSessionDirect(params) {
|
|
|
72834
72834
|
try {
|
|
72835
72835
|
await repairSessionFileIfNeeded({
|
|
72836
72836
|
sessionFile: params.sessionFile,
|
|
72837
|
-
warn: (message) => log$
|
|
72837
|
+
warn: (message) => log$9.warn(message)
|
|
72838
72838
|
});
|
|
72839
72839
|
await prewarmSessionFile(params.sessionFile);
|
|
72840
72840
|
const transcriptPolicy = resolveTranscriptPolicy({
|
|
@@ -72919,13 +72919,13 @@ async function compactEmbeddedPiSessionDirect(params) {
|
|
|
72919
72919
|
messages: preCompactionMessages,
|
|
72920
72920
|
sessionFile: params.sessionFile
|
|
72921
72921
|
}, hookCtx).catch((hookErr) => {
|
|
72922
|
-
log$
|
|
72922
|
+
log$9.warn(`before_compaction hook failed: ${String(hookErr)}`);
|
|
72923
72923
|
});
|
|
72924
|
-
const diagEnabled = log$
|
|
72924
|
+
const diagEnabled = log$9.isEnabled("debug");
|
|
72925
72925
|
const preMetrics = diagEnabled ? summarizeCompactionMessages(session.messages) : void 0;
|
|
72926
72926
|
if (diagEnabled && preMetrics) {
|
|
72927
|
-
log$
|
|
72928
|
-
log$
|
|
72927
|
+
log$9.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"}`);
|
|
72928
|
+
log$9.debug(`[compaction-diag] contributors diagId=${diagId} top=${JSON.stringify(preMetrics.contributors)}`);
|
|
72929
72929
|
}
|
|
72930
72930
|
const compactStartedAt = Date.now();
|
|
72931
72931
|
const result = await compactWithSafetyTimeout(() => session.compact(params.customInstructions));
|
|
@@ -72943,10 +72943,10 @@ async function compactEmbeddedPiSessionDirect(params) {
|
|
|
72943
72943
|
compactedCount: limited.length - session.messages.length,
|
|
72944
72944
|
sessionFile: params.sessionFile
|
|
72945
72945
|
}, hookCtx).catch((hookErr) => {
|
|
72946
|
-
log$
|
|
72946
|
+
log$9.warn(`after_compaction hook failed: ${hookErr}`);
|
|
72947
72947
|
});
|
|
72948
72948
|
const postMetrics = diagEnabled ? summarizeCompactionMessages(session.messages) : void 0;
|
|
72949
|
-
if (diagEnabled && preMetrics && postMetrics) log$
|
|
72949
|
+
if (diagEnabled && preMetrics && postMetrics) log$9.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"}`);
|
|
72950
72950
|
return {
|
|
72951
72951
|
ok: true,
|
|
72952
72952
|
compacted: true,
|
|
@@ -73031,7 +73031,7 @@ function getQueuedFileWriter(writers, filePath) {
|
|
|
73031
73031
|
//#endregion
|
|
73032
73032
|
//#region src/agents/anthropic-payload-log.ts
|
|
73033
73033
|
const writers$1 = /* @__PURE__ */ new Map();
|
|
73034
|
-
const log$
|
|
73034
|
+
const log$2 = createSubsystemLogger("agent/anthropic-payload");
|
|
73035
73035
|
function resolvePayloadLogConfig(env) {
|
|
73036
73036
|
const enabled = parseBooleanValue$1(env.SYMI_ANTHROPIC_PAYLOAD_LOG) ?? false;
|
|
73037
73037
|
const fileOverride = env.SYMI_ANTHROPIC_PAYLOAD_LOG_FILE?.trim();
|
|
@@ -73121,13 +73121,13 @@ function createAnthropicPayloadLogger(params) {
|
|
|
73121
73121
|
usage,
|
|
73122
73122
|
error: errorMessage
|
|
73123
73123
|
});
|
|
73124
|
-
log$
|
|
73124
|
+
log$2.info("anthropic usage", {
|
|
73125
73125
|
runId: params.runId,
|
|
73126
73126
|
sessionId: params.sessionId,
|
|
73127
73127
|
usage
|
|
73128
73128
|
});
|
|
73129
73129
|
};
|
|
73130
|
-
log$
|
|
73130
|
+
log$2.info("anthropic payload logger enabled", { filePath: writer.filePath });
|
|
73131
73131
|
return {
|
|
73132
73132
|
enabled: true,
|
|
73133
73133
|
wrapStreamFn,
|
|
@@ -74996,7 +74996,7 @@ function createEmbeddedPiSessionEventHandler(ctx) {
|
|
|
74996
74996
|
//#region src/agents/pi-embedded-subscribe.ts
|
|
74997
74997
|
const THINKING_TAG_SCAN_RE = /<\s*(\/?)\s*(?:think(?:ing)?|thought|antthinking)\s*>/gi;
|
|
74998
74998
|
const FINAL_TAG_SCAN_RE = /<\s*(\/?)\s*final\s*>/gi;
|
|
74999
|
-
const log = createSubsystemLogger("agent/embedded");
|
|
74999
|
+
const log$1 = createSubsystemLogger("agent/embedded");
|
|
75000
75000
|
function subscribeEmbeddedPiSession(params) {
|
|
75001
75001
|
const reasoningMode = params.reasoningMode ?? "off";
|
|
75002
75002
|
const useMarkdown = (params.toolResultFormat ?? "markdown") === "markdown";
|
|
@@ -75153,7 +75153,7 @@ function subscribeEmbeddedPiSession(params) {
|
|
|
75153
75153
|
state.compactionRetryReject = reject;
|
|
75154
75154
|
});
|
|
75155
75155
|
state.compactionRetryPromise.catch((err) => {
|
|
75156
|
-
log.debug(`compaction promise rejected (no waiter): ${String(err)}`);
|
|
75156
|
+
log$1.debug(`compaction promise rejected (no waiter): ${String(err)}`);
|
|
75157
75157
|
});
|
|
75158
75158
|
}
|
|
75159
75159
|
};
|
|
@@ -75305,7 +75305,7 @@ function subscribeEmbeddedPiSession(params) {
|
|
|
75305
75305
|
if (!chunk) return;
|
|
75306
75306
|
if (chunk === state.lastBlockReplyText) return;
|
|
75307
75307
|
if (isMessagingToolDuplicateNormalized(normalizeTextForComparison(chunk), messagingToolSentTextsNormalized)) {
|
|
75308
|
-
log.debug(`Skipping block reply - already sent via messaging tool: ${chunk.slice(0, 50)}...`);
|
|
75308
|
+
log$1.debug(`Skipping block reply - already sent via messaging tool: ${chunk.slice(0, 50)}...`);
|
|
75309
75309
|
return;
|
|
75310
75310
|
}
|
|
75311
75311
|
if (shouldSkipAssistantText(chunk)) return;
|
|
@@ -75383,7 +75383,7 @@ function subscribeEmbeddedPiSession(params) {
|
|
|
75383
75383
|
const ctx = {
|
|
75384
75384
|
params,
|
|
75385
75385
|
state,
|
|
75386
|
-
log,
|
|
75386
|
+
log: log$1,
|
|
75387
75387
|
blockChunking,
|
|
75388
75388
|
blockChunker,
|
|
75389
75389
|
hookRunner: params.hookRunner,
|
|
@@ -75416,7 +75416,7 @@ function subscribeEmbeddedPiSession(params) {
|
|
|
75416
75416
|
if (state.unsubscribed) return;
|
|
75417
75417
|
state.unsubscribed = true;
|
|
75418
75418
|
if (state.compactionRetryPromise) {
|
|
75419
|
-
log.debug(`unsubscribe: rejecting compaction wait runId=${params.runId}`);
|
|
75419
|
+
log$1.debug(`unsubscribe: rejecting compaction wait runId=${params.runId}`);
|
|
75420
75420
|
const reject = state.compactionRetryReject;
|
|
75421
75421
|
state.compactionRetryResolve = void 0;
|
|
75422
75422
|
state.compactionRetryReject = void 0;
|
|
@@ -75426,11 +75426,11 @@ function subscribeEmbeddedPiSession(params) {
|
|
|
75426
75426
|
reject?.(abortErr);
|
|
75427
75427
|
}
|
|
75428
75428
|
if (params.session.isCompacting) {
|
|
75429
|
-
log.debug(`unsubscribe: aborting in-flight compaction runId=${params.runId}`);
|
|
75429
|
+
log$1.debug(`unsubscribe: aborting in-flight compaction runId=${params.runId}`);
|
|
75430
75430
|
try {
|
|
75431
75431
|
params.session.abortCompaction();
|
|
75432
75432
|
} catch (err) {
|
|
75433
|
-
log.warn(`unsubscribe: compaction abort failed runId=${params.runId} err=${String(err)}`);
|
|
75433
|
+
log$1.warn(`unsubscribe: compaction abort failed runId=${params.runId} err=${String(err)}`);
|
|
75434
75434
|
}
|
|
75435
75435
|
}
|
|
75436
75436
|
sessionUnsubscribe();
|
|
@@ -75525,6 +75525,7 @@ function validateShellCommand(command) {
|
|
|
75525
75525
|
|
|
75526
75526
|
//#endregion
|
|
75527
75527
|
//#region src/agents/pi-tools.validate-wrapper.ts
|
|
75528
|
+
const log = createSubsystemLogger("agents/tool-validate");
|
|
75528
75529
|
const EXEC_TOOL_NAMES = new Set(["exec", "bash"]);
|
|
75529
75530
|
const FILE_TOOL_NAMES = new Set([
|
|
75530
75531
|
"write",
|
|
@@ -75549,8 +75550,14 @@ const FILE_PATH_KEYS = [
|
|
|
75549
75550
|
* Call this AFTER tools are created and the model profile is resolved.
|
|
75550
75551
|
*/
|
|
75551
75552
|
function wrapToolsWithArgValidation(tools, profile) {
|
|
75552
|
-
if (!profile.filters?.validateToolArgs)
|
|
75553
|
-
|
|
75553
|
+
if (!profile.filters?.validateToolArgs) {
|
|
75554
|
+
log.debug(`[validate] skipped — validateToolArgs=${profile.filters?.validateToolArgs ?? "undefined"} profile=${profile.label}`);
|
|
75555
|
+
return tools;
|
|
75556
|
+
}
|
|
75557
|
+
const wrapped = tools.map((tool) => wrapToolWithArgValidation(tool));
|
|
75558
|
+
const wrappedNames = wrapped.filter((t, i) => t !== tools[i]).map((t) => t.name);
|
|
75559
|
+
log.debug(`[validate] applied to ${wrappedNames.length} tools: ${wrappedNames.join(",") || "(none matched)"}`);
|
|
75560
|
+
return wrapped;
|
|
75554
75561
|
}
|
|
75555
75562
|
/**
|
|
75556
75563
|
* Clean a file path by stripping control token fragments.
|
|
@@ -75583,13 +75590,22 @@ function wrapToolWithArgValidation(tool) {
|
|
|
75583
75590
|
execute(toolCallId, params, ...rest) {
|
|
75584
75591
|
if (isExecTool) {
|
|
75585
75592
|
const command = params.command ?? params.cmd;
|
|
75586
|
-
if (typeof command !== "string")
|
|
75593
|
+
if (typeof command !== "string") {
|
|
75594
|
+
log.debug(`[validate] exec called without string command: keys=${Object.keys(params).join(",")}`);
|
|
75595
|
+
return originalExecute.call(tool, toolCallId, params, ...rest);
|
|
75596
|
+
}
|
|
75587
75597
|
const result = validateShellCommand(command);
|
|
75588
|
-
if (!result.valid)
|
|
75589
|
-
|
|
75590
|
-
|
|
75591
|
-
|
|
75592
|
-
|
|
75598
|
+
if (!result.valid) {
|
|
75599
|
+
log.warn(`[validate] exec command rejected: reason=${result.reason} raw=${command.slice(0, 100)}`);
|
|
75600
|
+
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.` });
|
|
75601
|
+
}
|
|
75602
|
+
if (result.cleaned !== command) {
|
|
75603
|
+
log.debug(`[validate] exec command cleaned: raw=${command.slice(0, 80)} → cleaned=${result.cleaned.slice(0, 80)}`);
|
|
75604
|
+
return originalExecute.call(tool, toolCallId, {
|
|
75605
|
+
...params,
|
|
75606
|
+
command: result.cleaned
|
|
75607
|
+
}, ...rest);
|
|
75608
|
+
}
|
|
75593
75609
|
return originalExecute.call(tool, toolCallId, params, ...rest);
|
|
75594
75610
|
}
|
|
75595
75611
|
const pathKey = FILE_PATH_KEYS.find((k) => typeof params[k] === "string");
|
|
@@ -76236,7 +76252,7 @@ function isImageExtension(filePath) {
|
|
|
76236
76252
|
}
|
|
76237
76253
|
async function sanitizeImagesWithLog(images, label, imageSanitization) {
|
|
76238
76254
|
const { images: sanitized, dropped } = await sanitizeImageBlocks(images, label, imageSanitization);
|
|
76239
|
-
if (dropped > 0) log$
|
|
76255
|
+
if (dropped > 0) log$9.warn(`Native image: dropped ${dropped} image(s) after sanitization (${label}).`);
|
|
76240
76256
|
return sanitized;
|
|
76241
76257
|
}
|
|
76242
76258
|
/**
|
|
@@ -76311,7 +76327,7 @@ async function loadImageFromRef(ref, workspaceDir, options) {
|
|
|
76311
76327
|
try {
|
|
76312
76328
|
let targetPath = ref.resolved;
|
|
76313
76329
|
if (ref.type === "url") {
|
|
76314
|
-
log$
|
|
76330
|
+
log$9.debug(`Native image: rejecting remote URL (local-only): ${ref.resolved}`);
|
|
76315
76331
|
return null;
|
|
76316
76332
|
}
|
|
76317
76333
|
if (ref.type === "path") {
|
|
@@ -76321,7 +76337,7 @@ async function loadImageFromRef(ref, workspaceDir, options) {
|
|
|
76321
76337
|
cwd: options.sandbox.root
|
|
76322
76338
|
}).hostPath;
|
|
76323
76339
|
} catch (err) {
|
|
76324
|
-
log$
|
|
76340
|
+
log$9.debug(`Native image: sandbox validation failed for ${ref.resolved}: ${err instanceof Error ? err.message : String(err)}`);
|
|
76325
76341
|
return null;
|
|
76326
76342
|
}
|
|
76327
76343
|
else if (!path.isAbsolute(targetPath)) targetPath = path.resolve(workspaceDir, targetPath);
|
|
@@ -76335,7 +76351,7 @@ async function loadImageFromRef(ref, workspaceDir, options) {
|
|
|
76335
76351
|
})
|
|
76336
76352
|
}) : await loadWebMedia(targetPath, options?.maxBytes);
|
|
76337
76353
|
if (media.kind !== "image") {
|
|
76338
|
-
log$
|
|
76354
|
+
log$9.debug(`Native image: not an image file: ${targetPath} (got ${media.kind})`);
|
|
76339
76355
|
return null;
|
|
76340
76356
|
}
|
|
76341
76357
|
const mimeType = media.contentType ?? "image/jpeg";
|
|
@@ -76345,7 +76361,7 @@ async function loadImageFromRef(ref, workspaceDir, options) {
|
|
|
76345
76361
|
mimeType
|
|
76346
76362
|
};
|
|
76347
76363
|
} catch (err) {
|
|
76348
|
-
log$
|
|
76364
|
+
log$9.debug(`Native image: failed to load ${ref.resolved}: ${err instanceof Error ? err.message : String(err)}`);
|
|
76349
76365
|
return null;
|
|
76350
76366
|
}
|
|
76351
76367
|
}
|
|
@@ -76444,7 +76460,7 @@ async function detectAndLoadPromptImages(params) {
|
|
|
76444
76460
|
loadedCount: 0,
|
|
76445
76461
|
skippedCount: 0
|
|
76446
76462
|
};
|
|
76447
|
-
log$
|
|
76463
|
+
log$9.debug(`Native image: detected ${allRefs.length} image refs (${promptRefs.length} in prompt, ${uniqueHistoryRefs.length} in history)`);
|
|
76448
76464
|
const promptImages = [...params.existingImages ?? []];
|
|
76449
76465
|
const historyImagesByIndex = /* @__PURE__ */ new Map();
|
|
76450
76466
|
let loadedCount = 0;
|
|
@@ -76461,7 +76477,7 @@ async function detectAndLoadPromptImages(params) {
|
|
|
76461
76477
|
else historyImagesByIndex.set(ref.messageIndex, [image]);
|
|
76462
76478
|
} else promptImages.push(image);
|
|
76463
76479
|
loadedCount++;
|
|
76464
|
-
log$
|
|
76480
|
+
log$9.debug(`Native image: loaded ${ref.type} ${ref.resolved}`);
|
|
76465
76481
|
} else skippedCount++;
|
|
76466
76482
|
}
|
|
76467
76483
|
const imageSanitization = { maxDimensionPx: params.maxDimensionPx };
|
|
@@ -76557,7 +76573,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
76557
76573
|
const resolvedWorkspace = resolveUserPath(params.workspaceDir);
|
|
76558
76574
|
const prevCwd = process.cwd();
|
|
76559
76575
|
const runAbortController = new AbortController();
|
|
76560
|
-
log$
|
|
76576
|
+
log$9.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"}`);
|
|
76561
76577
|
await fs$1.mkdir(resolvedWorkspace, { recursive: true });
|
|
76562
76578
|
const sandboxSessionKey = params.sessionKey?.trim() || params.sessionId;
|
|
76563
76579
|
const sandbox = await resolveSandboxContext({
|
|
@@ -76593,7 +76609,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
76593
76609
|
sessionId: params.sessionId,
|
|
76594
76610
|
warn: makeBootstrapWarn({
|
|
76595
76611
|
sessionLabel,
|
|
76596
|
-
warn: (message) => log$
|
|
76612
|
+
warn: (message) => log$9.warn(message)
|
|
76597
76613
|
})
|
|
76598
76614
|
});
|
|
76599
76615
|
const workspaceNotes = hookAdjustedBootstrapFiles.some((file) => file.name === DEFAULT_BOOTSTRAP_FILENAME && !file.missing) ? ["Reminder: commit your changes in this workspace after edits."] : void 0;
|
|
@@ -76780,7 +76796,9 @@ async function runEmbeddedAttempt(params) {
|
|
|
76780
76796
|
skillsPrompt,
|
|
76781
76797
|
tools
|
|
76782
76798
|
});
|
|
76783
|
-
const
|
|
76799
|
+
const profileModelKey = params.modelId ?? "";
|
|
76800
|
+
const modelProfile = resolveModelProfile(profileModelKey, params.config?.models?.profiles);
|
|
76801
|
+
log$9.debug(`[profile] resolved: modelId=${profileModelKey} → profile=${modelProfile.label} validateToolArgs=${modelProfile.filters?.validateToolArgs ?? false}`);
|
|
76784
76802
|
const systemPromptText = createSystemPromptOverride(appendPrompt + (modelProfile.promptAdditions.length > 0 ? "\n\n" + modelProfile.promptAdditions.join("\n") : ""))();
|
|
76785
76803
|
const sessionLock = await acquireSessionWriteLock({
|
|
76786
76804
|
sessionFile: params.sessionFile,
|
|
@@ -76792,7 +76810,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
76792
76810
|
try {
|
|
76793
76811
|
await repairSessionFileIfNeeded({
|
|
76794
76812
|
sessionFile: params.sessionFile,
|
|
76795
|
-
warn: (message) => log$
|
|
76813
|
+
warn: (message) => log$9.warn(message)
|
|
76796
76814
|
});
|
|
76797
76815
|
const hadSessionFile = await fs$1.stat(params.sessionFile).then(() => true).catch(() => false);
|
|
76798
76816
|
const transcriptPolicy = resolveTranscriptPolicy({
|
|
@@ -76801,7 +76819,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
76801
76819
|
modelId: params.modelId
|
|
76802
76820
|
});
|
|
76803
76821
|
const versionCheck = await handleSessionVersion(params.sessionFile);
|
|
76804
|
-
if (versionCheck.archived) log$
|
|
76822
|
+
if (versionCheck.archived) log$9.warn(`session archived: created by ${versionCheck.poisonVersion}, known corruption range → ${versionCheck.archivePath}`);
|
|
76805
76823
|
await prewarmSessionFile(params.sessionFile);
|
|
76806
76824
|
sessionManager = guardSessionManager(SessionManager.open(params.sessionFile), {
|
|
76807
76825
|
agentId: sessionAgentId,
|
|
@@ -76845,6 +76863,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
76845
76863
|
sandboxEnabled: !!sandbox?.enabled
|
|
76846
76864
|
});
|
|
76847
76865
|
const builtInTools = wrapToolsWithArgValidation(rawBuiltInTools, modelProfile);
|
|
76866
|
+
log$9.debug(`[tool-validate] profile=${modelProfile.label} validateToolArgs=${modelProfile.filters?.validateToolArgs ?? false} builtInTools=${builtInTools.length} toolNames=${builtInTools.map((t) => t.name).join(",")}`);
|
|
76848
76867
|
let clientToolCallDetected = null;
|
|
76849
76868
|
const clientToolLoopDetection = resolveToolLoopDetectionConfig({
|
|
76850
76869
|
cfg: params.config,
|
|
@@ -77056,7 +77075,6 @@ async function runEmbeddedAttempt(params) {
|
|
|
77056
77075
|
const TOOL_ERROR_ABORT_THRESHOLD = 5;
|
|
77057
77076
|
const TOOL_ERROR_WARN_THRESHOLD = 3;
|
|
77058
77077
|
let consecutiveToolErrors = 0;
|
|
77059
|
-
let lastErrorToolName = "";
|
|
77060
77078
|
const subscription = subscribeEmbeddedPiSession({
|
|
77061
77079
|
session: activeSession,
|
|
77062
77080
|
runId: params.runId,
|
|
@@ -77080,26 +77098,23 @@ async function runEmbeddedAttempt(params) {
|
|
|
77080
77098
|
params.onAgentEvent?.(evt);
|
|
77081
77099
|
if (evt.stream === "tool" && !aborted) {
|
|
77082
77100
|
const phase = typeof evt.data?.phase === "string" ? evt.data.phase : "";
|
|
77083
|
-
const toolName = typeof evt.data?.name === "string" ? evt.data.name : "";
|
|
77084
77101
|
const isError = evt.data?.isError === true;
|
|
77085
|
-
if (phase === "result"
|
|
77086
|
-
if (isError
|
|
77087
|
-
else
|
|
77088
|
-
consecutiveToolErrors = 1;
|
|
77089
|
-
lastErrorToolName = toolName;
|
|
77090
|
-
} else {
|
|
77091
|
-
consecutiveToolErrors = 0;
|
|
77092
|
-
lastErrorToolName = "";
|
|
77093
|
-
}
|
|
77102
|
+
if (phase === "result") {
|
|
77103
|
+
if (isError) consecutiveToolErrors++;
|
|
77104
|
+
else consecutiveToolErrors = 0;
|
|
77094
77105
|
if (consecutiveToolErrors >= TOOL_ERROR_ABORT_THRESHOLD) {
|
|
77095
|
-
|
|
77096
|
-
|
|
77097
|
-
|
|
77106
|
+
const toolName = typeof evt.data?.name === "string" ? evt.data.name : "unknown";
|
|
77107
|
+
log$9.error(`Agent-loop circuit breaker: ${consecutiveToolErrors} consecutive tool errors (last: ${toolName}). Aborting run ${params.runId}.`);
|
|
77108
|
+
abortRun(false, /* @__PURE__ */ new Error(`${consecutiveToolErrors} consecutive tool errors. The model may be generating corrupted tool arguments. Run aborted to prevent infinite loop.`));
|
|
77109
|
+
} else if (consecutiveToolErrors === TOOL_ERROR_WARN_THRESHOLD) {
|
|
77110
|
+
const toolName = typeof evt.data?.name === "string" ? evt.data.name : "unknown";
|
|
77111
|
+
log$9.warn(`Agent-loop tool error warning: ${consecutiveToolErrors} consecutive failures (last: ${toolName}). runId=${params.runId}`);
|
|
77112
|
+
}
|
|
77098
77113
|
}
|
|
77099
77114
|
}
|
|
77100
77115
|
if (evt.stream === "assistant" && typeof evt.data?.text === "string" && !aborted) {
|
|
77101
77116
|
streamMonitor.onChunk(evt.data.text);
|
|
77102
|
-
if (streamMonitor.shouldStop()) log$
|
|
77117
|
+
if (streamMonitor.shouldStop()) log$9.debug(`stream monitor detection (log-only, no abort): runId=${params.runId} reason=${streamMonitor.getStopReason()}`);
|
|
77103
77118
|
}
|
|
77104
77119
|
},
|
|
77105
77120
|
enforceFinalTag: params.enforceFinalTag,
|
|
@@ -77119,7 +77134,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
77119
77134
|
let abortWarnTimer;
|
|
77120
77135
|
const isProbeSession = params.sessionId?.startsWith("probe-") ?? false;
|
|
77121
77136
|
const abortTimer = setTimeout(() => {
|
|
77122
|
-
if (!isProbeSession) log$
|
|
77137
|
+
if (!isProbeSession) log$9.warn(`embedded run timeout: runId=${params.runId} sessionId=${params.sessionId} timeoutMs=${params.timeoutMs}`);
|
|
77123
77138
|
if (shouldFlagCompactionTimeout({
|
|
77124
77139
|
isTimeout: true,
|
|
77125
77140
|
isCompactionPendingOrRetrying: subscription.isCompacting(),
|
|
@@ -77128,7 +77143,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
77128
77143
|
abortRun(true);
|
|
77129
77144
|
if (!abortWarnTimer) abortWarnTimer = setTimeout(() => {
|
|
77130
77145
|
if (!activeSession.isStreaming) return;
|
|
77131
|
-
if (!isProbeSession) log$
|
|
77146
|
+
if (!isProbeSession) log$9.warn(`embedded run abort still streaming: runId=${params.runId} sessionId=${params.sessionId}`);
|
|
77132
77147
|
}, 1e4);
|
|
77133
77148
|
}, Math.max(1, params.timeoutMs));
|
|
77134
77149
|
armSymipulseTimer = () => {
|
|
@@ -77136,7 +77151,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
77136
77151
|
clearSymipulseTimer();
|
|
77137
77152
|
symipulseTimer = setTimeout(() => {
|
|
77138
77153
|
if (aborted) return;
|
|
77139
|
-
if (!isProbeSession) log$
|
|
77154
|
+
if (!isProbeSession) log$9.warn(`symipulse timeout: runId=${params.runId} sessionId=${params.sessionId} symipulseMs=${symipulseMs} (no activity)`);
|
|
77140
77155
|
if (shouldFlagCompactionTimeout({
|
|
77141
77156
|
isTimeout: true,
|
|
77142
77157
|
isCompactionPendingOrRetrying: subscription.isCompacting(),
|
|
@@ -77180,13 +77195,13 @@ async function runEmbeddedAttempt(params) {
|
|
|
77180
77195
|
prompt: params.prompt,
|
|
77181
77196
|
messages: activeSession.messages
|
|
77182
77197
|
}, hookCtx).catch((hookErr) => {
|
|
77183
|
-
log$
|
|
77198
|
+
log$9.warn(`before_prompt_build hook failed: ${String(hookErr)}`);
|
|
77184
77199
|
}) : void 0;
|
|
77185
77200
|
const legacyResult = hookRunner?.hasHooks("before_agent_start") ? await hookRunner.runBeforeAgentStart({
|
|
77186
77201
|
prompt: params.prompt,
|
|
77187
77202
|
messages: activeSession.messages
|
|
77188
77203
|
}, hookCtx).catch((hookErr) => {
|
|
77189
|
-
log$
|
|
77204
|
+
log$9.warn(`before_agent_start hook (legacy prompt build path) failed: ${String(hookErr)}`);
|
|
77190
77205
|
}) : void 0;
|
|
77191
77206
|
const hookResult = {
|
|
77192
77207
|
systemPrompt: promptBuildResult?.systemPrompt ?? legacyResult?.systemPrompt,
|
|
@@ -77194,7 +77209,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
77194
77209
|
};
|
|
77195
77210
|
if (hookResult?.prependContext) {
|
|
77196
77211
|
effectivePrompt = `${hookResult.prependContext}\n\n${params.prompt}`;
|
|
77197
|
-
log$
|
|
77212
|
+
log$9.debug(`hooks: prepended context to prompt (${hookResult.prependContext.length} chars)`);
|
|
77198
77213
|
}
|
|
77199
77214
|
{
|
|
77200
77215
|
const autoRecallAgentId = normalizeAgentId(params.sessionKey);
|
|
@@ -77211,11 +77226,11 @@ async function runEmbeddedAttempt(params) {
|
|
|
77211
77226
|
if (recallResults.length > 0) {
|
|
77212
77227
|
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>`;
|
|
77213
77228
|
effectivePrompt = `${recallBlock}\n\n${effectivePrompt}`;
|
|
77214
|
-
log$
|
|
77229
|
+
log$9.debug(`auto-recall: injected ${recallResults.length} snippets (${recallBlock.length} chars)`);
|
|
77215
77230
|
}
|
|
77216
77231
|
}
|
|
77217
77232
|
} catch (recallErr) {
|
|
77218
|
-
log$
|
|
77233
|
+
log$9.debug(`auto-recall: skipped (${String(recallErr)})`);
|
|
77219
77234
|
}
|
|
77220
77235
|
}
|
|
77221
77236
|
{
|
|
@@ -77227,10 +77242,10 @@ async function runEmbeddedAttempt(params) {
|
|
|
77227
77242
|
if (planResult.enter) {
|
|
77228
77243
|
if (planResult.stripped != null) effectivePrompt = planResult.stripped;
|
|
77229
77244
|
effectivePrompt = `${PLAN_MODE_SYSTEM_PROMPT}\n\n${effectivePrompt}`;
|
|
77230
|
-
log$
|
|
77245
|
+
log$9.info(`plan-mode: activated (${planResult.reason}) for runId=${params.runId}`);
|
|
77231
77246
|
} else if (planResult.stripped != null) effectivePrompt = planResult.stripped;
|
|
77232
77247
|
}
|
|
77233
|
-
log$
|
|
77248
|
+
log$9.debug(`embedded run prompt start: runId=${params.runId} sessionId=${params.sessionId}`);
|
|
77234
77249
|
cacheTrace?.recordStage("prompt:before", {
|
|
77235
77250
|
prompt: effectivePrompt,
|
|
77236
77251
|
messages: activeSession.messages
|
|
@@ -77242,7 +77257,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
77242
77257
|
const sessionContext = sessionManager.buildSessionContext();
|
|
77243
77258
|
const sanitizedOrphan = transcriptPolicy.sanitizeThinkingSignatures ? sanitizeAntigravityThinkingBlocks(sessionContext.messages) : sessionContext.messages;
|
|
77244
77259
|
activeSession.agent.replaceMessages(sanitizedOrphan);
|
|
77245
|
-
log$
|
|
77260
|
+
log$9.warn(`Removed orphaned user message to prevent consecutive user turns. runId=${params.runId} sessionId=${params.sessionId}`);
|
|
77246
77261
|
}
|
|
77247
77262
|
try {
|
|
77248
77263
|
const imageResult = await detectAndLoadPromptImages({
|
|
@@ -77264,12 +77279,12 @@ async function runEmbeddedAttempt(params) {
|
|
|
77264
77279
|
messages: activeSession.messages,
|
|
77265
77280
|
note: `images: prompt=${imageResult.images.length} history=${imageResult.historyImagesByIndex.size}`
|
|
77266
77281
|
});
|
|
77267
|
-
if (log$
|
|
77282
|
+
if (log$9.isEnabled("debug")) {
|
|
77268
77283
|
const msgCount = activeSession.messages.length;
|
|
77269
77284
|
const systemLen = systemPromptText?.length ?? 0;
|
|
77270
77285
|
const promptLen = effectivePrompt.length;
|
|
77271
77286
|
const sessionSummary = summarizeSessionContext(activeSession.messages);
|
|
77272
|
-
log$
|
|
77287
|
+
log$9.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}`);
|
|
77273
77288
|
}
|
|
77274
77289
|
if (hookRunner?.hasHooks("llm_input")) hookRunner.runLlmInput({
|
|
77275
77290
|
runId: params.runId,
|
|
@@ -77287,7 +77302,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
77287
77302
|
workspaceDir: params.workspaceDir,
|
|
77288
77303
|
messageProvider: params.messageProvider ?? void 0
|
|
77289
77304
|
}).catch((err) => {
|
|
77290
|
-
log$
|
|
77305
|
+
log$9.warn(`llm_input hook failed: ${String(err)}`);
|
|
77291
77306
|
});
|
|
77292
77307
|
if (imageResult.images.length > 0) await abortable(activeSession.prompt(effectivePrompt, { images: imageResult.images }));
|
|
77293
77308
|
else await abortable(activeSession.prompt(effectivePrompt));
|
|
@@ -77295,7 +77310,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
77295
77310
|
promptError = err;
|
|
77296
77311
|
promptErrorSource = "prompt";
|
|
77297
77312
|
} finally {
|
|
77298
|
-
log$
|
|
77313
|
+
log$9.debug(`embedded run prompt end: runId=${params.runId} sessionId=${params.sessionId} durationMs=${Date.now() - promptStartedAt}`);
|
|
77299
77314
|
}
|
|
77300
77315
|
const wasCompactingBefore = activeSession.isCompacting;
|
|
77301
77316
|
const snapshot = activeSession.messages.slice();
|
|
@@ -77310,7 +77325,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
77310
77325
|
promptError = err;
|
|
77311
77326
|
promptErrorSource = "compaction";
|
|
77312
77327
|
}
|
|
77313
|
-
if (!isProbeSession) log$
|
|
77328
|
+
if (!isProbeSession) log$9.debug(`compaction wait aborted: runId=${params.runId} sessionId=${params.sessionId}`);
|
|
77314
77329
|
} else throw err;
|
|
77315
77330
|
}
|
|
77316
77331
|
if (!timedOutDuringCompaction) {
|
|
@@ -77328,7 +77343,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
77328
77343
|
currentSessionId: activeSession.sessionId
|
|
77329
77344
|
});
|
|
77330
77345
|
if (timedOutDuringCompaction) {
|
|
77331
|
-
if (!isProbeSession) log$
|
|
77346
|
+
if (!isProbeSession) log$9.warn(`using ${snapshotSelection.source} snapshot: timed out during compaction runId=${params.runId} sessionId=${params.sessionId}`);
|
|
77332
77347
|
}
|
|
77333
77348
|
messagesSnapshot = snapshotSelection.messagesSnapshot;
|
|
77334
77349
|
sessionIdUsed = snapshotSelection.sessionIdUsed;
|
|
@@ -77343,7 +77358,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
77343
77358
|
error: describeUnknownError(promptError)
|
|
77344
77359
|
});
|
|
77345
77360
|
} catch (entryErr) {
|
|
77346
|
-
log$
|
|
77361
|
+
log$9.warn(`failed to persist prompt error entry: ${String(entryErr)}`);
|
|
77347
77362
|
}
|
|
77348
77363
|
cacheTrace?.recordStage("session:after", {
|
|
77349
77364
|
messages: messagesSnapshot,
|
|
@@ -77362,17 +77377,17 @@ async function runEmbeddedAttempt(params) {
|
|
|
77362
77377
|
workspaceDir: params.workspaceDir,
|
|
77363
77378
|
messageProvider: params.messageProvider ?? void 0
|
|
77364
77379
|
}).catch((err) => {
|
|
77365
|
-
log$
|
|
77380
|
+
log$9.warn(`agent_end hook failed: ${err}`);
|
|
77366
77381
|
});
|
|
77367
77382
|
} finally {
|
|
77368
77383
|
clearTimeout(abortTimer);
|
|
77369
77384
|
clearSymipulseTimer();
|
|
77370
77385
|
if (abortWarnTimer) clearTimeout(abortWarnTimer);
|
|
77371
|
-
if (!isProbeSession && (aborted || timedOut) && !timedOutDuringCompaction) log$
|
|
77386
|
+
if (!isProbeSession && (aborted || timedOut) && !timedOutDuringCompaction) log$9.debug(`run cleanup: runId=${params.runId} sessionId=${params.sessionId} aborted=${aborted} timedOut=${timedOut}`);
|
|
77372
77387
|
try {
|
|
77373
77388
|
unsubscribe();
|
|
77374
77389
|
} catch (err) {
|
|
77375
|
-
log$
|
|
77390
|
+
log$9.error(`CRITICAL: unsubscribe failed, possible resource leak: runId=${params.runId} ${String(err)}`);
|
|
77376
77391
|
}
|
|
77377
77392
|
clearActiveEmbeddedRun(params.sessionId, queueHandle, params.sessionKey);
|
|
77378
77393
|
params.abortSignal?.removeEventListener?.("abort", onAbort);
|
|
@@ -77397,7 +77412,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
77397
77412
|
workspaceDir: params.workspaceDir,
|
|
77398
77413
|
messageProvider: params.messageProvider ?? void 0
|
|
77399
77414
|
}).catch((err) => {
|
|
77400
|
-
log$
|
|
77415
|
+
log$9.warn(`llm_output hook failed: ${String(err)}`);
|
|
77401
77416
|
});
|
|
77402
77417
|
return {
|
|
77403
77418
|
aborted,
|
|
@@ -77658,7 +77673,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
77658
77673
|
const redactedSessionId = redactRunIdentifier(params.sessionId);
|
|
77659
77674
|
const redactedSessionKey = redactRunIdentifier(params.sessionKey);
|
|
77660
77675
|
const redactedWorkspace = redactRunIdentifier(resolvedWorkspace);
|
|
77661
|
-
if (workspaceResolution.usedFallback) log$
|
|
77676
|
+
if (workspaceResolution.usedFallback) log$9.warn(`[workspace-fallback] caller=runEmbeddedPiAgent reason=${workspaceResolution.fallbackReason} run=${params.runId} session=${redactedSessionId} sessionKey=${redactedSessionKey} agent=${workspaceResolution.agentId} workspace=${redactedWorkspace}`);
|
|
77662
77677
|
const prevCwd = process.cwd();
|
|
77663
77678
|
let provider = (params.provider ?? DEFAULT_PROVIDER).trim() || DEFAULT_PROVIDER;
|
|
77664
77679
|
let modelId = (params.model ?? DEFAULT_MODEL).trim() || DEFAULT_MODEL;
|
|
@@ -77677,7 +77692,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
77677
77692
|
if (hookRunner?.hasHooks("before_model_resolve")) try {
|
|
77678
77693
|
modelResolveOverride = await hookRunner.runBeforeModelResolve({ prompt: params.prompt }, hookCtx);
|
|
77679
77694
|
} catch (hookErr) {
|
|
77680
|
-
log$
|
|
77695
|
+
log$9.warn(`before_model_resolve hook failed: ${String(hookErr)}`);
|
|
77681
77696
|
}
|
|
77682
77697
|
if (hookRunner?.hasHooks("before_agent_start")) try {
|
|
77683
77698
|
const legacyResult = await hookRunner.runBeforeAgentStart({ prompt: params.prompt }, hookCtx);
|
|
@@ -77686,15 +77701,15 @@ async function runEmbeddedPiAgent(params) {
|
|
|
77686
77701
|
modelOverride: modelResolveOverride?.modelOverride ?? legacyResult?.modelOverride
|
|
77687
77702
|
};
|
|
77688
77703
|
} catch (hookErr) {
|
|
77689
|
-
log$
|
|
77704
|
+
log$9.warn(`before_agent_start hook (legacy model resolve path) failed: ${String(hookErr)}`);
|
|
77690
77705
|
}
|
|
77691
77706
|
if (modelResolveOverride?.providerOverride) {
|
|
77692
77707
|
provider = modelResolveOverride.providerOverride;
|
|
77693
|
-
log$
|
|
77708
|
+
log$9.info(`[hooks] provider overridden to ${provider}`);
|
|
77694
77709
|
}
|
|
77695
77710
|
if (modelResolveOverride?.modelOverride) {
|
|
77696
77711
|
modelId = modelResolveOverride.modelOverride;
|
|
77697
|
-
log$
|
|
77712
|
+
log$9.info(`[hooks] model overridden to ${modelId}`);
|
|
77698
77713
|
}
|
|
77699
77714
|
const { model, error, authStorage, modelRegistry } = resolveModel(provider, modelId, agentDir, params.config);
|
|
77700
77715
|
if (!model) throw new FailoverError(error ?? `Unknown model: ${provider}/${modelId}`, {
|
|
@@ -77714,9 +77729,9 @@ async function runEmbeddedPiAgent(params) {
|
|
|
77714
77729
|
warnBelowTokens: CONTEXT_WINDOW_WARN_BELOW_TOKENS,
|
|
77715
77730
|
hardMinTokens: CONTEXT_WINDOW_HARD_MIN_TOKENS
|
|
77716
77731
|
});
|
|
77717
|
-
if (ctxGuard.shouldWarn) log$
|
|
77732
|
+
if (ctxGuard.shouldWarn) log$9.warn(`low context window: ${provider}/${modelId} ctx=${ctxGuard.tokens} (warn<${CONTEXT_WINDOW_WARN_BELOW_TOKENS}) source=${ctxGuard.source}`);
|
|
77718
77733
|
if (ctxGuard.shouldBlock) {
|
|
77719
|
-
log$
|
|
77734
|
+
log$9.error(`blocked model (context window too small): ${provider}/${modelId} ctx=${ctxGuard.tokens} (min=${CONTEXT_WINDOW_HARD_MIN_TOKENS}) source=${ctxGuard.source}`);
|
|
77720
77735
|
throw new FailoverError(`Model context window too small (${ctxGuard.tokens} tokens). Minimum is ${CONTEXT_WINDOW_HARD_MIN_TOKENS}.`, {
|
|
77721
77736
|
reason: "unknown",
|
|
77722
77737
|
provider,
|
|
@@ -77846,7 +77861,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
77846
77861
|
while (true) {
|
|
77847
77862
|
if (runLoopIterations >= MAX_RUN_LOOP_ITERATIONS) {
|
|
77848
77863
|
const message = `Exceeded retry limit after ${runLoopIterations} attempts (max=${MAX_RUN_LOOP_ITERATIONS}).`;
|
|
77849
|
-
log$
|
|
77864
|
+
log$9.error(`[run-retry-limit] sessionKey=${params.sessionKey ?? params.sessionId} provider=${provider}/${modelId} attempts=${runLoopIterations} maxAttempts=${MAX_RUN_LOOP_ITERATIONS}`);
|
|
77850
77865
|
return {
|
|
77851
77866
|
payloads: [{
|
|
77852
77867
|
text: "Request failed after repeated internal retries. Please try again, or use /new to start a fresh session.",
|
|
@@ -77967,18 +77982,18 @@ async function runEmbeddedPiAgent(params) {
|
|
|
77967
77982
|
const overflowDiagId = createCompactionDiagId();
|
|
77968
77983
|
const errorText = contextOverflowError.text;
|
|
77969
77984
|
const msgCount = attempt.messagesSnapshot?.length ?? 0;
|
|
77970
|
-
log$
|
|
77985
|
+
log$9.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)}`);
|
|
77971
77986
|
const isCompactionFailure = isCompactionFailureError(errorText);
|
|
77972
77987
|
const hadAttemptLevelCompaction = attemptCompactionCount > 0;
|
|
77973
77988
|
if (!isCompactionFailure && hadAttemptLevelCompaction && overflowCompactionAttempts < MAX_OVERFLOW_COMPACTION_ATTEMPTS) {
|
|
77974
77989
|
overflowCompactionAttempts++;
|
|
77975
|
-
log$
|
|
77990
|
+
log$9.warn(`context overflow persisted after in-attempt compaction (attempt ${overflowCompactionAttempts}/${MAX_OVERFLOW_COMPACTION_ATTEMPTS}); retrying prompt without additional compaction for ${provider}/${modelId}`);
|
|
77976
77991
|
continue;
|
|
77977
77992
|
}
|
|
77978
77993
|
if (!isCompactionFailure && !hadAttemptLevelCompaction && overflowCompactionAttempts < MAX_OVERFLOW_COMPACTION_ATTEMPTS) {
|
|
77979
|
-
if (log$
|
|
77994
|
+
if (log$9.isEnabled("debug")) log$9.debug(`[compaction-diag] decision diagId=${overflowDiagId} branch=compact isCompactionFailure=${isCompactionFailure} hasOversizedToolResults=unknown attempt=${overflowCompactionAttempts + 1} maxAttempts=${MAX_OVERFLOW_COMPACTION_ATTEMPTS}`);
|
|
77980
77995
|
overflowCompactionAttempts++;
|
|
77981
|
-
log$
|
|
77996
|
+
log$9.warn(`context overflow detected (attempt ${overflowCompactionAttempts}/${MAX_OVERFLOW_COMPACTION_ATTEMPTS}); attempting auto-compaction for ${provider}/${modelId}`);
|
|
77982
77997
|
const compactResult = await compactEmbeddedPiSessionDirect({
|
|
77983
77998
|
sessionId: params.sessionId,
|
|
77984
77999
|
sessionKey: params.sessionKey,
|
|
@@ -78007,10 +78022,10 @@ async function runEmbeddedPiAgent(params) {
|
|
|
78007
78022
|
});
|
|
78008
78023
|
if (compactResult.compacted) {
|
|
78009
78024
|
autoCompactionCount += 1;
|
|
78010
|
-
log$
|
|
78025
|
+
log$9.info(`auto-compaction succeeded for ${provider}/${modelId}; retrying prompt`);
|
|
78011
78026
|
continue;
|
|
78012
78027
|
}
|
|
78013
|
-
log$
|
|
78028
|
+
log$9.warn(`auto-compaction failed for ${provider}/${modelId}: ${compactResult.reason ?? "nothing to compact"}`);
|
|
78014
78029
|
}
|
|
78015
78030
|
if (!toolResultTruncationAttempted) {
|
|
78016
78031
|
const contextWindowTokens = ctxInfo.tokens;
|
|
@@ -78019,9 +78034,9 @@ async function runEmbeddedPiAgent(params) {
|
|
|
78019
78034
|
contextWindowTokens
|
|
78020
78035
|
}) : false;
|
|
78021
78036
|
if (hasOversized) {
|
|
78022
|
-
if (log$
|
|
78037
|
+
if (log$9.isEnabled("debug")) log$9.debug(`[compaction-diag] decision diagId=${overflowDiagId} branch=truncate_tool_results isCompactionFailure=${isCompactionFailure} hasOversizedToolResults=${hasOversized} attempt=${overflowCompactionAttempts} maxAttempts=${MAX_OVERFLOW_COMPACTION_ATTEMPTS}`);
|
|
78023
78038
|
toolResultTruncationAttempted = true;
|
|
78024
|
-
log$
|
|
78039
|
+
log$9.warn(`[context-overflow-recovery] Attempting tool result truncation for ${provider}/${modelId} (contextWindow=${contextWindowTokens} tokens)`);
|
|
78025
78040
|
const truncResult = await truncateOversizedToolResultsInSession({
|
|
78026
78041
|
sessionFile: params.sessionFile,
|
|
78027
78042
|
contextWindowTokens,
|
|
@@ -78029,13 +78044,13 @@ async function runEmbeddedPiAgent(params) {
|
|
|
78029
78044
|
sessionKey: params.sessionKey
|
|
78030
78045
|
});
|
|
78031
78046
|
if (truncResult.truncated) {
|
|
78032
|
-
log$
|
|
78047
|
+
log$9.info(`[context-overflow-recovery] Truncated ${truncResult.truncatedCount} tool result(s); retrying prompt`);
|
|
78033
78048
|
continue;
|
|
78034
78049
|
}
|
|
78035
|
-
log$
|
|
78036
|
-
} else if (log$
|
|
78050
|
+
log$9.warn(`[context-overflow-recovery] Tool result truncation did not help: ${truncResult.reason ?? "unknown"}`);
|
|
78051
|
+
} else if (log$9.isEnabled("debug")) log$9.debug(`[compaction-diag] decision diagId=${overflowDiagId} branch=give_up isCompactionFailure=${isCompactionFailure} hasOversizedToolResults=${hasOversized} attempt=${overflowCompactionAttempts} maxAttempts=${MAX_OVERFLOW_COMPACTION_ATTEMPTS}`);
|
|
78037
78052
|
}
|
|
78038
|
-
if ((isCompactionFailure || overflowCompactionAttempts >= MAX_OVERFLOW_COMPACTION_ATTEMPTS || toolResultTruncationAttempted) && log$
|
|
78053
|
+
if ((isCompactionFailure || overflowCompactionAttempts >= MAX_OVERFLOW_COMPACTION_ATTEMPTS || toolResultTruncationAttempted) && log$9.isEnabled("debug")) log$9.debug(`[compaction-diag] decision diagId=${overflowDiagId} branch=give_up isCompactionFailure=${isCompactionFailure} hasOversizedToolResults=unknown attempt=${overflowCompactionAttempts} maxAttempts=${MAX_OVERFLOW_COMPACTION_ATTEMPTS}`);
|
|
78039
78054
|
const kind = isCompactionFailure ? "compaction_failure" : "context_overflow";
|
|
78040
78055
|
return {
|
|
78041
78056
|
payloads: [{
|
|
@@ -78116,7 +78131,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
78116
78131
|
attempted: attemptedThinking
|
|
78117
78132
|
});
|
|
78118
78133
|
if (fallbackThinking) {
|
|
78119
|
-
log$
|
|
78134
|
+
log$9.warn(`unsupported thinking level for ${provider}/${modelId}; retrying with ${fallbackThinking}`);
|
|
78120
78135
|
thinkLevel = fallbackThinking;
|
|
78121
78136
|
continue;
|
|
78122
78137
|
}
|
|
@@ -78134,7 +78149,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
78134
78149
|
attempted: attemptedThinking
|
|
78135
78150
|
});
|
|
78136
78151
|
if (fallbackThinking && !aborted) {
|
|
78137
|
-
log$
|
|
78152
|
+
log$9.warn(`unsupported thinking level for ${provider}/${modelId}; retrying with ${fallbackThinking}`);
|
|
78138
78153
|
thinkLevel = fallbackThinking;
|
|
78139
78154
|
continue;
|
|
78140
78155
|
}
|
|
@@ -78151,7 +78166,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
78151
78166
|
imageDimensionError.contentIndex !== void 0 ? `content=${imageDimensionError.contentIndex}` : null,
|
|
78152
78167
|
imageDimensionError.maxDimensionPx !== void 0 ? `limit=${imageDimensionError.maxDimensionPx}px` : null
|
|
78153
78168
|
].filter(Boolean).join(" ");
|
|
78154
|
-
log$
|
|
78169
|
+
log$9.warn(`Profile ${lastProfileId} rejected image payload${details ? ` (${details})` : ""}.`);
|
|
78155
78170
|
}
|
|
78156
78171
|
const isLocalOllamaTimeout = timedOut && model.api === "ollama";
|
|
78157
78172
|
if (!aborted && failoverFailure || timedOut && !timedOutDuringCompaction && !isLocalOllamaTimeout) {
|
|
@@ -78163,8 +78178,8 @@ async function runEmbeddedPiAgent(params) {
|
|
|
78163
78178
|
cfg: params.config,
|
|
78164
78179
|
agentDir: params.agentDir
|
|
78165
78180
|
});
|
|
78166
|
-
if (timedOut && !isProbeSession) log$
|
|
78167
|
-
if (cloudCodeAssistFormatError) log$
|
|
78181
|
+
if (timedOut && !isProbeSession) log$9.warn(`Profile ${lastProfileId} timed out (possible rate limit). Trying next account...`);
|
|
78182
|
+
if (cloudCodeAssistFormatError) log$9.warn(`Profile ${lastProfileId} hit Cloud Code Assist format error. Tool calls will be sanitized on retry.`);
|
|
78168
78183
|
}
|
|
78169
78184
|
if (await advanceAuthProfile()) continue;
|
|
78170
78185
|
if (fallbackConfigured) {
|
|
@@ -78230,7 +78245,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
78230
78245
|
const hasCodeBlocks = attempt.assistantTexts.some((text) => /```[\s\S]*?```/.test(text));
|
|
78231
78246
|
if (hasCodeToolUsage || hasCodeBlocks) {
|
|
78232
78247
|
verificationPassCompleted = true;
|
|
78233
|
-
log$
|
|
78248
|
+
log$9.debug(`[verification] starting verification pass: runId=${params.runId} sessionId=${params.sessionId} trigger=${hasCodeToolUsage ? "tool_usage" : "code_blocks"}`);
|
|
78234
78249
|
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.";
|
|
78235
78250
|
try {
|
|
78236
78251
|
const verifyAttempt = await runEmbeddedAttempt({
|
|
@@ -78316,10 +78331,10 @@ async function runEmbeddedPiAgent(params) {
|
|
|
78316
78331
|
payloads.length = 0;
|
|
78317
78332
|
payloads.push(...verifyPayloads);
|
|
78318
78333
|
}
|
|
78319
|
-
log$
|
|
78320
|
-
} else log$
|
|
78334
|
+
log$9.debug(`[verification] verification produced corrections: runId=${params.runId} tools=${verifyAttempt.toolMetas.length} texts=${verifyAttempt.assistantTexts.length}`);
|
|
78335
|
+
} else log$9.debug(`[verification] verification confirmed original response: runId=${params.runId}`);
|
|
78321
78336
|
} catch (verifyErr) {
|
|
78322
|
-
log$
|
|
78337
|
+
log$9.warn(`[verification] verification pass failed, keeping original response: runId=${params.runId} error=${String(verifyErr)}`);
|
|
78323
78338
|
}
|
|
78324
78339
|
}
|
|
78325
78340
|
}
|
|
@@ -78340,7 +78355,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
78340
78355
|
messagingToolSentTargets: attempt.messagingToolSentTargets,
|
|
78341
78356
|
successfulCronAdds: attempt.successfulCronAdds
|
|
78342
78357
|
};
|
|
78343
|
-
log$
|
|
78358
|
+
log$9.debug(`embedded run done: runId=${params.runId} sessionId=${params.sessionId} durationMs=${Date.now() - started} aborted=${aborted}`);
|
|
78344
78359
|
if (lastProfileId) {
|
|
78345
78360
|
await markAuthProfileGood({
|
|
78346
78361
|
store: authStore,
|