@symerian/symi 2.6.1 → 2.6.3
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-DQIz-_on.js → agents-Dm0V9Z2G.js} +4 -4
- package/dist/{agents.config-CIJRaVWl.js → agents.config-DP0CLvIA.js} +1 -1
- package/dist/{agents.config-D8WPDf-m.js → agents.config-WdkJjM2-.js} +1 -1
- package/dist/{audio-preflight-BVaaZWkg.js → audio-preflight-DHTaS5U1.js} +4 -4
- package/dist/{auth-choice-DTDyJL1r.js → auth-choice-B9OnYICm.js} +1 -1
- package/dist/{auth-choice-BqFbNDuP.js → auth-choice-CXHi61T5.js} +1 -1
- package/dist/{banner-DYDCxnDL.js → banner-ToxTMzfL.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-CvHSm_Kx.js → channel-options-CsGrHsjP.js} +1 -1
- package/dist/{channel-options-vBCJhJB7.js → channel-options-Jl8AKRLD.js} +1 -1
- package/dist/{channel-web-CM2LyWZW.js → channel-web-qFGaLytG.js} +1 -1
- package/dist/{channels-cli-DzOjNNFn.js → channels-cli-BFyOmW-R.js} +4 -4
- package/dist/{channels-cli-D5H3Wcho.js → channels-cli-DQTl2Pk5.js} +4 -4
- package/dist/{chrome-DkaXoP36.js → chrome-DYZwl5Gv.js} +7 -7
- package/dist/{cli-8hqssnRJ.js → cli-B4biLt2z.js} +1 -1
- package/dist/{cli-DNZwCDRe.js → cli-DQw_LEew.js} +1 -1
- package/dist/{command-registry-CHtN2HeK.js → command-registry-D1OePePk.js} +9 -9
- package/dist/{completion-cli-Cov6N3BO.js → completion-cli-CI-0hC_u.js} +2 -2
- package/dist/{completion-cli-C8y_J5KC.js → completion-cli-DW8a1WYc.js} +1 -1
- package/dist/{config-cli-BwO0xAbV.js → config-cli-CpiluXlO.js} +1 -1
- package/dist/{config-cli-B2REEd2l.js → config-cli-DHXt5cQZ.js} +1 -1
- package/dist/{configure-C6yNe33U.js → configure-CmVnpTNi.js} +3 -3
- package/dist/{configure-BWSYSi2-.js → configure-Ha9cu8Bu.js} +3 -3
- package/dist/{deliver-C46-vyqg.js → deliver-dODxSv3b.js} +1 -1
- package/dist/{doctor-completion-BKKzstt6.js → doctor-completion-CRNCOXcf.js} +1 -1
- package/dist/{doctor-completion-D7CDLFLg.js → doctor-completion-ve-JPlmN.js} +1 -1
- package/dist/entry.js +1 -1
- package/dist/extensionAPI.js +1 -1
- package/dist/{gateway-cli-Datohp3m.js → gateway-cli-BPsbjmUI.js} +9 -9
- package/dist/{gateway-cli-BhFM4Bkm.js → gateway-cli-Cc7N8N_E.js} +9 -9
- package/dist/{glass-ui-ws-BzqfD_wX.js → glass-ui-ws-1O1O2xC6.js} +7 -7
- package/dist/{glass-ui-ws-D9yvYULL.js → glass-ui-ws-CKwLnOwl.js} +7 -7
- package/dist/{health-BjwDRAdd.js → health-DTRWmRB8.js} +1 -1
- package/dist/{health-C5XJPwpt.js → health-tYyUNVp5.js} +1 -1
- package/dist/{hooks-cli-U12oVyLH.js → hooks-cli-Cp81vqRc.js} +2 -2
- package/dist/{hooks-cli-CafMq9Vr.js → hooks-cli-eC03ywfG.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-Bo4iHJy-.js → models-CuhnCX2U.js} +2 -2
- package/dist/{models-cli-B5vh-XK8.js → models-cli-BzwGQUdn.js} +3 -3
- package/dist/{models-cli-6aNi3eN9.js → models-cli-CFr_ZP5y.js} +2 -2
- package/dist/{onboard-f-GJ26Ix.js → onboard-B2g2Q6dd.js} +2 -2
- package/dist/{onboard-Bm-pmstf.js → onboard-CcB6pmEy.js} +2 -2
- package/dist/{onboard-channels-BRd1cXye.js → onboard-channels-CWd17q6h.js} +1 -1
- package/dist/{onboard-channels-CUl5U8kV.js → onboard-channels-DmRBC7VN.js} +1 -1
- package/dist/{onboarding-CvBDWlBJ.js → onboarding-DMqlt_p6.js} +3 -3
- package/dist/{onboarding-DIVKvosg.js → onboarding-DwvQIqR8.js} +3 -3
- package/dist/{onboarding.finalize-WSac-JKd.js → onboarding.finalize-BUSzTwhM.js} +5 -5
- package/dist/{onboarding.finalize-DJX6mSLa.js → onboarding.finalize-lJmZSE4C.js} +6 -6
- package/dist/{pi-embedded-BmbbC1Sb.js → pi-embedded-CT2JDfQr.js} +208 -132
- package/dist/{pi-embedded-helpers-CfqDGQ9J.js → pi-embedded-helpers-pubKo8HQ.js} +4 -4
- package/dist/{plugin-registry-5yf-hu_W.js → plugin-registry-DZdPnpP_.js} +1 -1
- package/dist/{plugin-registry-2zUJMasm.js → plugin-registry-vW2V1yCi.js} +1 -1
- package/dist/plugin-sdk/agents/pi-tools.validate-wrapper.d.ts +6 -6
- package/dist/plugin-sdk/{channel-web-DPyyTvFo.js → channel-web-38aqDKeT.js} +1 -1
- package/dist/plugin-sdk/index.js +2 -2
- package/dist/plugin-sdk/{reply-QAcAd9ev.js → reply-BjJZjZRr.js} +204 -128
- package/dist/plugin-sdk/{web-DaTTL9M0.js → web-BgKYnau3.js} +2 -2
- package/dist/{plugins-cli-D4eRESV2.js → plugins-cli-BTq9c2hZ.js} +2 -2
- package/dist/{plugins-cli-DksVl33N.js → plugins-cli-DkAx9r3h.js} +2 -2
- package/dist/{program-BjORH7Cc.js → program-DZx9PtyT.js} +7 -7
- package/dist/{program-context-DaNGrTOm.js → program-context-DyfuToE1.js} +17 -17
- package/dist/{prompt-select-styled-QaS2zul_.js → prompt-select-styled-CifWTOoY.js} +4 -4
- package/dist/{prompt-select-styled-YOj4xigd.js → prompt-select-styled-DNbD3v3G.js} +4 -4
- package/dist/{provider-auth-helpers-DCEbm2hz.js → provider-auth-helpers-BPIIDTwA.js} +1 -1
- package/dist/{provider-auth-helpers-BAGT_RXV.js → provider-auth-helpers-BzySaUp5.js} +1 -1
- package/dist/{push-apns-Bek3ANJa.js → push-apns-DbpeXPGR.js} +1 -1
- package/dist/{push-apns-BECodU1i.js → push-apns-IdD-dKZm.js} +1 -1
- package/dist/{pw-ai-m0mj2KWK.js → pw-ai-B5asscAD.js} +1 -1
- package/dist/{register.agent-DJHQo-Iq.js → register.agent-CfFcSvM1.js} +6 -6
- package/dist/{register.agent-B34lxx7F.js → register.agent-TFUcxDGN.js} +5 -5
- package/dist/{register.configure-DC_-t5kj.js → register.configure-BwRTNCws.js} +6 -6
- package/dist/{register.configure-BdhhIzb0.js → register.configure-D3BJejOC.js} +6 -6
- package/dist/{register.maintenance-cs-A4kHF.js → register.maintenance-B5350ddh.js} +7 -7
- package/dist/{register.maintenance-CITur3O_.js → register.maintenance-DkdVYwbj.js} +8 -8
- package/dist/{register.message-PIaHm2pZ.js → register.message-DTopCPGC.js} +2 -2
- package/dist/{register.message--RhtnEYn.js → register.message-FbCBAfJO.js} +2 -2
- package/dist/{register.onboard-DucZgrF7.js → register.onboard-DITZn8dx.js} +4 -4
- package/dist/{register.onboard-CTJQoDcK.js → register.onboard-GSv5xyA3.js} +4 -4
- package/dist/{register.setup-2ZiUN7ui.js → register.setup-BI6lILMU.js} +4 -4
- package/dist/{register.setup-DD4Rgkt9.js → register.setup-BuOeoBk0.js} +4 -4
- package/dist/{register.status-health-sessions-BqD7L8XL.js → register.status-health-sessions-C1RhWKxN.js} +3 -3
- package/dist/{register.status-health-sessions-sLgA92t7.js → register.status-health-sessions-EK4_odLb.js} +3 -3
- package/dist/{register.subclis-B2dGWFur.js → register.subclis-Bn_Mr_Wa.js} +9 -9
- package/dist/{reply-DYnTEYoa.js → reply-BGSd_cMI.js} +199 -123
- package/dist/{run-main-DWmu2b6D.js → run-main-Bu9IAm9E.js} +14 -14
- package/dist/{runner-CU9l0uJh.js → runner-WAG0M5s9.js} +1 -1
- package/dist/{server-methods-vDGoM3xL.js → server-methods-dxn6-zQz.js} +7 -7
- package/dist/{server-methods-C8EWZt2g.js → server-methods-tA9lkIQT.js} +7 -7
- package/dist/{server-node-events-CKi12bol.js → server-node-events-6jcJSpXA.js} +2 -2
- package/dist/{server-node-events-DFwGbkcO.js → server-node-events-CzcTGD9T.js} +2 -2
- package/dist/{status-B1_iHrOg.js → status-8176C-aV.js} +2 -2
- package/dist/{status-DiX0DAtH.js → status-CcQSl2sN.js} +1 -1
- package/dist/{status--iNVOTMO.js → status-DGKT6HnE.js} +2 -2
- package/dist/{status-BQcdARV4.js → status-DmPOSk-A.js} +1 -1
- package/dist/{subagent-registry-CXrOOgPW.js → subagent-registry-DqFKNTCX.js} +202 -126
- package/dist/{unified-runner-CulJZMxc.js → unified-runner-BbanUEmo.js} +227 -151
- package/dist/{update-cli-D1pLX3eo.js → update-cli-FMcGr7MA.js} +8 -8
- package/dist/{update-cli-560gprSp.js → update-cli-YCXB_6jz.js} +7 -7
- package/dist/{update-runner-CLKHrONW.js → update-runner-C8OkrKjW.js} +1 -1
- package/dist/{update-runner-BQxFFCGc.js → update-runner-DMP1rCS1.js} +1 -1
- package/dist/{web-hHX9a9YO.js → web-BsS1ia0M.js} +6 -6
- package/dist/{web-Bqrgp43v.js → web-CQ2F1f3a.js} +1 -1
- package/dist/{web-Dr5cOn-1.js → web-DoRGusTq.js} +2 -2
- package/dist/{web-D4qJ9XKP.js → web-LUMjboLF.js} +1 -1
- package/package.json +1 -1
|
@@ -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-BsS1ia0M.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-BsS1ia0M.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,10 +75525,27 @@ 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"]);
|
|
75530
|
+
const FILE_TOOL_NAMES = new Set([
|
|
75531
|
+
"write",
|
|
75532
|
+
"read",
|
|
75533
|
+
"edit",
|
|
75534
|
+
"patch",
|
|
75535
|
+
"file_write",
|
|
75536
|
+
"file_edit",
|
|
75537
|
+
"write_file",
|
|
75538
|
+
"edit_file",
|
|
75539
|
+
"create_file"
|
|
75540
|
+
]);
|
|
75541
|
+
const FILE_PATH_KEYS = [
|
|
75542
|
+
"file_path",
|
|
75543
|
+
"path",
|
|
75544
|
+
"filePath"
|
|
75545
|
+
];
|
|
75529
75546
|
/**
|
|
75530
|
-
* Wrap tools with argument validation.
|
|
75531
|
-
* Other tools pass through unchanged.
|
|
75547
|
+
* Wrap tools with argument validation. Exec/bash commands and file paths
|
|
75548
|
+
* are validated. Other tools pass through unchanged.
|
|
75532
75549
|
*
|
|
75533
75550
|
* Call this AFTER tools are created and the model profile is resolved.
|
|
75534
75551
|
*/
|
|
@@ -75537,24 +75554,64 @@ function wrapToolsWithArgValidation(tools, profile) {
|
|
|
75537
75554
|
return tools.map((tool) => wrapToolWithArgValidation(tool));
|
|
75538
75555
|
}
|
|
75539
75556
|
/**
|
|
75540
|
-
*
|
|
75557
|
+
* Clean a file path by stripping control token fragments.
|
|
75558
|
+
* Returns null if the path is irreparably corrupted (empty after cleanup).
|
|
75559
|
+
*/
|
|
75560
|
+
function cleanFilePath(filePath) {
|
|
75561
|
+
let cleaned = filePath.replace(/<\|[^|>]*(?:\|>)?/g, "");
|
|
75562
|
+
cleaned = cleanResidualTokenFragments(cleaned);
|
|
75563
|
+
cleaned = cleaned.trim();
|
|
75564
|
+
if (!cleaned || !/[a-zA-Z0-9/._~-]/.test(cleaned)) return {
|
|
75565
|
+
valid: false,
|
|
75566
|
+
cleaned
|
|
75567
|
+
};
|
|
75568
|
+
return {
|
|
75569
|
+
valid: true,
|
|
75570
|
+
cleaned
|
|
75571
|
+
};
|
|
75572
|
+
}
|
|
75573
|
+
/**
|
|
75574
|
+
* Wrap a single tool with argument validation.
|
|
75541
75575
|
*/
|
|
75542
75576
|
function wrapToolWithArgValidation(tool) {
|
|
75543
75577
|
const toolName = (tool.name ?? "").toLowerCase().trim();
|
|
75544
|
-
|
|
75578
|
+
const isExecTool = EXEC_TOOL_NAMES.has(toolName);
|
|
75579
|
+
const isFileTool = FILE_TOOL_NAMES.has(toolName);
|
|
75580
|
+
if (!isExecTool && !isFileTool) return tool;
|
|
75545
75581
|
const originalExecute = tool.execute;
|
|
75546
75582
|
return {
|
|
75547
75583
|
...tool,
|
|
75548
75584
|
execute(toolCallId, params, ...rest) {
|
|
75549
|
-
|
|
75550
|
-
|
|
75551
|
-
|
|
75552
|
-
|
|
75553
|
-
|
|
75585
|
+
if (isExecTool) {
|
|
75586
|
+
const command = params.command ?? params.cmd;
|
|
75587
|
+
if (typeof command !== "string") {
|
|
75588
|
+
log.debug(`[validate] exec called without string command: keys=${Object.keys(params).join(",")}`);
|
|
75589
|
+
return originalExecute.call(tool, toolCallId, params, ...rest);
|
|
75590
|
+
}
|
|
75591
|
+
const result = validateShellCommand(command);
|
|
75592
|
+
if (!result.valid) {
|
|
75593
|
+
log.warn(`[validate] exec command rejected: reason=${result.reason} raw=${command.slice(0, 100)}`);
|
|
75594
|
+
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.` });
|
|
75595
|
+
}
|
|
75596
|
+
if (result.cleaned !== command) {
|
|
75597
|
+
log.debug(`[validate] exec command cleaned: raw=${command.slice(0, 80)} → cleaned=${result.cleaned.slice(0, 80)}`);
|
|
75598
|
+
return originalExecute.call(tool, toolCallId, {
|
|
75599
|
+
...params,
|
|
75600
|
+
command: result.cleaned
|
|
75601
|
+
}, ...rest);
|
|
75602
|
+
}
|
|
75603
|
+
return originalExecute.call(tool, toolCallId, params, ...rest);
|
|
75604
|
+
}
|
|
75605
|
+
const pathKey = FILE_PATH_KEYS.find((k) => typeof params[k] === "string");
|
|
75606
|
+
if (!pathKey) return originalExecute.call(tool, toolCallId, params, ...rest);
|
|
75607
|
+
const rawPath = params[pathKey];
|
|
75608
|
+
if (!rawPath.includes("<|") && !rawPath.includes("|>") && !/^[<"|]/.test(rawPath)) return originalExecute.call(tool, toolCallId, params, ...rest);
|
|
75609
|
+
const pathResult = cleanFilePath(rawPath);
|
|
75610
|
+
if (!pathResult.valid) return Promise.resolve({ output: `Error: file path "${rawPath}" contains model control tokens and could not be cleaned. Please provide a clean file path without any <|, |>, or XML-like tags.` });
|
|
75611
|
+
return originalExecute.call(tool, toolCallId, {
|
|
75554
75612
|
...params,
|
|
75555
|
-
|
|
75613
|
+
[pathKey]: pathResult.cleaned
|
|
75556
75614
|
}, ...rest);
|
|
75557
|
-
return originalExecute.call(tool, toolCallId, params, ...rest);
|
|
75558
75615
|
}
|
|
75559
75616
|
};
|
|
75560
75617
|
}
|
|
@@ -76189,7 +76246,7 @@ function isImageExtension(filePath) {
|
|
|
76189
76246
|
}
|
|
76190
76247
|
async function sanitizeImagesWithLog(images, label, imageSanitization) {
|
|
76191
76248
|
const { images: sanitized, dropped } = await sanitizeImageBlocks(images, label, imageSanitization);
|
|
76192
|
-
if (dropped > 0) log$
|
|
76249
|
+
if (dropped > 0) log$9.warn(`Native image: dropped ${dropped} image(s) after sanitization (${label}).`);
|
|
76193
76250
|
return sanitized;
|
|
76194
76251
|
}
|
|
76195
76252
|
/**
|
|
@@ -76264,7 +76321,7 @@ async function loadImageFromRef(ref, workspaceDir, options) {
|
|
|
76264
76321
|
try {
|
|
76265
76322
|
let targetPath = ref.resolved;
|
|
76266
76323
|
if (ref.type === "url") {
|
|
76267
|
-
log$
|
|
76324
|
+
log$9.debug(`Native image: rejecting remote URL (local-only): ${ref.resolved}`);
|
|
76268
76325
|
return null;
|
|
76269
76326
|
}
|
|
76270
76327
|
if (ref.type === "path") {
|
|
@@ -76274,7 +76331,7 @@ async function loadImageFromRef(ref, workspaceDir, options) {
|
|
|
76274
76331
|
cwd: options.sandbox.root
|
|
76275
76332
|
}).hostPath;
|
|
76276
76333
|
} catch (err) {
|
|
76277
|
-
log$
|
|
76334
|
+
log$9.debug(`Native image: sandbox validation failed for ${ref.resolved}: ${err instanceof Error ? err.message : String(err)}`);
|
|
76278
76335
|
return null;
|
|
76279
76336
|
}
|
|
76280
76337
|
else if (!path.isAbsolute(targetPath)) targetPath = path.resolve(workspaceDir, targetPath);
|
|
@@ -76288,7 +76345,7 @@ async function loadImageFromRef(ref, workspaceDir, options) {
|
|
|
76288
76345
|
})
|
|
76289
76346
|
}) : await loadWebMedia(targetPath, options?.maxBytes);
|
|
76290
76347
|
if (media.kind !== "image") {
|
|
76291
|
-
log$
|
|
76348
|
+
log$9.debug(`Native image: not an image file: ${targetPath} (got ${media.kind})`);
|
|
76292
76349
|
return null;
|
|
76293
76350
|
}
|
|
76294
76351
|
const mimeType = media.contentType ?? "image/jpeg";
|
|
@@ -76298,7 +76355,7 @@ async function loadImageFromRef(ref, workspaceDir, options) {
|
|
|
76298
76355
|
mimeType
|
|
76299
76356
|
};
|
|
76300
76357
|
} catch (err) {
|
|
76301
|
-
log$
|
|
76358
|
+
log$9.debug(`Native image: failed to load ${ref.resolved}: ${err instanceof Error ? err.message : String(err)}`);
|
|
76302
76359
|
return null;
|
|
76303
76360
|
}
|
|
76304
76361
|
}
|
|
@@ -76397,7 +76454,7 @@ async function detectAndLoadPromptImages(params) {
|
|
|
76397
76454
|
loadedCount: 0,
|
|
76398
76455
|
skippedCount: 0
|
|
76399
76456
|
};
|
|
76400
|
-
log$
|
|
76457
|
+
log$9.debug(`Native image: detected ${allRefs.length} image refs (${promptRefs.length} in prompt, ${uniqueHistoryRefs.length} in history)`);
|
|
76401
76458
|
const promptImages = [...params.existingImages ?? []];
|
|
76402
76459
|
const historyImagesByIndex = /* @__PURE__ */ new Map();
|
|
76403
76460
|
let loadedCount = 0;
|
|
@@ -76414,7 +76471,7 @@ async function detectAndLoadPromptImages(params) {
|
|
|
76414
76471
|
else historyImagesByIndex.set(ref.messageIndex, [image]);
|
|
76415
76472
|
} else promptImages.push(image);
|
|
76416
76473
|
loadedCount++;
|
|
76417
|
-
log$
|
|
76474
|
+
log$9.debug(`Native image: loaded ${ref.type} ${ref.resolved}`);
|
|
76418
76475
|
} else skippedCount++;
|
|
76419
76476
|
}
|
|
76420
76477
|
const imageSanitization = { maxDimensionPx: params.maxDimensionPx };
|
|
@@ -76510,7 +76567,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
76510
76567
|
const resolvedWorkspace = resolveUserPath(params.workspaceDir);
|
|
76511
76568
|
const prevCwd = process.cwd();
|
|
76512
76569
|
const runAbortController = new AbortController();
|
|
76513
|
-
log$
|
|
76570
|
+
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"}`);
|
|
76514
76571
|
await fs$1.mkdir(resolvedWorkspace, { recursive: true });
|
|
76515
76572
|
const sandboxSessionKey = params.sessionKey?.trim() || params.sessionId;
|
|
76516
76573
|
const sandbox = await resolveSandboxContext({
|
|
@@ -76546,7 +76603,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
76546
76603
|
sessionId: params.sessionId,
|
|
76547
76604
|
warn: makeBootstrapWarn({
|
|
76548
76605
|
sessionLabel,
|
|
76549
|
-
warn: (message) => log$
|
|
76606
|
+
warn: (message) => log$9.warn(message)
|
|
76550
76607
|
})
|
|
76551
76608
|
});
|
|
76552
76609
|
const workspaceNotes = hookAdjustedBootstrapFiles.some((file) => file.name === DEFAULT_BOOTSTRAP_FILENAME && !file.missing) ? ["Reminder: commit your changes in this workspace after edits."] : void 0;
|
|
@@ -76745,7 +76802,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
76745
76802
|
try {
|
|
76746
76803
|
await repairSessionFileIfNeeded({
|
|
76747
76804
|
sessionFile: params.sessionFile,
|
|
76748
|
-
warn: (message) => log$
|
|
76805
|
+
warn: (message) => log$9.warn(message)
|
|
76749
76806
|
});
|
|
76750
76807
|
const hadSessionFile = await fs$1.stat(params.sessionFile).then(() => true).catch(() => false);
|
|
76751
76808
|
const transcriptPolicy = resolveTranscriptPolicy({
|
|
@@ -76754,7 +76811,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
76754
76811
|
modelId: params.modelId
|
|
76755
76812
|
});
|
|
76756
76813
|
const versionCheck = await handleSessionVersion(params.sessionFile);
|
|
76757
|
-
if (versionCheck.archived) log$
|
|
76814
|
+
if (versionCheck.archived) log$9.warn(`session archived: created by ${versionCheck.poisonVersion}, known corruption range → ${versionCheck.archivePath}`);
|
|
76758
76815
|
await prewarmSessionFile(params.sessionFile);
|
|
76759
76816
|
sessionManager = guardSessionManager(SessionManager.open(params.sessionFile), {
|
|
76760
76817
|
agentId: sessionAgentId,
|
|
@@ -77006,6 +77063,9 @@ async function runEmbeddedAttempt(params) {
|
|
|
77006
77063
|
});
|
|
77007
77064
|
};
|
|
77008
77065
|
const streamMonitor = createStreamMonitor(modelProfile);
|
|
77066
|
+
const TOOL_ERROR_ABORT_THRESHOLD = 5;
|
|
77067
|
+
const TOOL_ERROR_WARN_THRESHOLD = 3;
|
|
77068
|
+
let consecutiveToolErrors = 0;
|
|
77009
77069
|
const subscription = subscribeEmbeddedPiSession({
|
|
77010
77070
|
session: activeSession,
|
|
77011
77071
|
runId: params.runId,
|
|
@@ -77027,9 +77087,25 @@ async function runEmbeddedAttempt(params) {
|
|
|
77027
77087
|
onAgentEvent: (evt) => {
|
|
77028
77088
|
armSymipulseTimer();
|
|
77029
77089
|
params.onAgentEvent?.(evt);
|
|
77090
|
+
if (evt.stream === "tool" && !aborted) {
|
|
77091
|
+
const phase = typeof evt.data?.phase === "string" ? evt.data.phase : "";
|
|
77092
|
+
const isError = evt.data?.isError === true;
|
|
77093
|
+
if (phase === "result") {
|
|
77094
|
+
if (isError) consecutiveToolErrors++;
|
|
77095
|
+
else consecutiveToolErrors = 0;
|
|
77096
|
+
if (consecutiveToolErrors >= TOOL_ERROR_ABORT_THRESHOLD) {
|
|
77097
|
+
const toolName = typeof evt.data?.name === "string" ? evt.data.name : "unknown";
|
|
77098
|
+
log$9.error(`Agent-loop circuit breaker: ${consecutiveToolErrors} consecutive tool errors (last: ${toolName}). Aborting run ${params.runId}.`);
|
|
77099
|
+
abortRun(false, /* @__PURE__ */ new Error(`${consecutiveToolErrors} consecutive tool errors. The model may be generating corrupted tool arguments. Run aborted to prevent infinite loop.`));
|
|
77100
|
+
} else if (consecutiveToolErrors === TOOL_ERROR_WARN_THRESHOLD) {
|
|
77101
|
+
const toolName = typeof evt.data?.name === "string" ? evt.data.name : "unknown";
|
|
77102
|
+
log$9.warn(`Agent-loop tool error warning: ${consecutiveToolErrors} consecutive failures (last: ${toolName}). runId=${params.runId}`);
|
|
77103
|
+
}
|
|
77104
|
+
}
|
|
77105
|
+
}
|
|
77030
77106
|
if (evt.stream === "assistant" && typeof evt.data?.text === "string" && !aborted) {
|
|
77031
77107
|
streamMonitor.onChunk(evt.data.text);
|
|
77032
|
-
if (streamMonitor.shouldStop()) log$
|
|
77108
|
+
if (streamMonitor.shouldStop()) log$9.debug(`stream monitor detection (log-only, no abort): runId=${params.runId} reason=${streamMonitor.getStopReason()}`);
|
|
77033
77109
|
}
|
|
77034
77110
|
},
|
|
77035
77111
|
enforceFinalTag: params.enforceFinalTag,
|
|
@@ -77049,7 +77125,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
77049
77125
|
let abortWarnTimer;
|
|
77050
77126
|
const isProbeSession = params.sessionId?.startsWith("probe-") ?? false;
|
|
77051
77127
|
const abortTimer = setTimeout(() => {
|
|
77052
|
-
if (!isProbeSession) log$
|
|
77128
|
+
if (!isProbeSession) log$9.warn(`embedded run timeout: runId=${params.runId} sessionId=${params.sessionId} timeoutMs=${params.timeoutMs}`);
|
|
77053
77129
|
if (shouldFlagCompactionTimeout({
|
|
77054
77130
|
isTimeout: true,
|
|
77055
77131
|
isCompactionPendingOrRetrying: subscription.isCompacting(),
|
|
@@ -77058,7 +77134,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
77058
77134
|
abortRun(true);
|
|
77059
77135
|
if (!abortWarnTimer) abortWarnTimer = setTimeout(() => {
|
|
77060
77136
|
if (!activeSession.isStreaming) return;
|
|
77061
|
-
if (!isProbeSession) log$
|
|
77137
|
+
if (!isProbeSession) log$9.warn(`embedded run abort still streaming: runId=${params.runId} sessionId=${params.sessionId}`);
|
|
77062
77138
|
}, 1e4);
|
|
77063
77139
|
}, Math.max(1, params.timeoutMs));
|
|
77064
77140
|
armSymipulseTimer = () => {
|
|
@@ -77066,7 +77142,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
77066
77142
|
clearSymipulseTimer();
|
|
77067
77143
|
symipulseTimer = setTimeout(() => {
|
|
77068
77144
|
if (aborted) return;
|
|
77069
|
-
if (!isProbeSession) log$
|
|
77145
|
+
if (!isProbeSession) log$9.warn(`symipulse timeout: runId=${params.runId} sessionId=${params.sessionId} symipulseMs=${symipulseMs} (no activity)`);
|
|
77070
77146
|
if (shouldFlagCompactionTimeout({
|
|
77071
77147
|
isTimeout: true,
|
|
77072
77148
|
isCompactionPendingOrRetrying: subscription.isCompacting(),
|
|
@@ -77110,13 +77186,13 @@ async function runEmbeddedAttempt(params) {
|
|
|
77110
77186
|
prompt: params.prompt,
|
|
77111
77187
|
messages: activeSession.messages
|
|
77112
77188
|
}, hookCtx).catch((hookErr) => {
|
|
77113
|
-
log$
|
|
77189
|
+
log$9.warn(`before_prompt_build hook failed: ${String(hookErr)}`);
|
|
77114
77190
|
}) : void 0;
|
|
77115
77191
|
const legacyResult = hookRunner?.hasHooks("before_agent_start") ? await hookRunner.runBeforeAgentStart({
|
|
77116
77192
|
prompt: params.prompt,
|
|
77117
77193
|
messages: activeSession.messages
|
|
77118
77194
|
}, hookCtx).catch((hookErr) => {
|
|
77119
|
-
log$
|
|
77195
|
+
log$9.warn(`before_agent_start hook (legacy prompt build path) failed: ${String(hookErr)}`);
|
|
77120
77196
|
}) : void 0;
|
|
77121
77197
|
const hookResult = {
|
|
77122
77198
|
systemPrompt: promptBuildResult?.systemPrompt ?? legacyResult?.systemPrompt,
|
|
@@ -77124,7 +77200,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
77124
77200
|
};
|
|
77125
77201
|
if (hookResult?.prependContext) {
|
|
77126
77202
|
effectivePrompt = `${hookResult.prependContext}\n\n${params.prompt}`;
|
|
77127
|
-
log$
|
|
77203
|
+
log$9.debug(`hooks: prepended context to prompt (${hookResult.prependContext.length} chars)`);
|
|
77128
77204
|
}
|
|
77129
77205
|
{
|
|
77130
77206
|
const autoRecallAgentId = normalizeAgentId(params.sessionKey);
|
|
@@ -77141,11 +77217,11 @@ async function runEmbeddedAttempt(params) {
|
|
|
77141
77217
|
if (recallResults.length > 0) {
|
|
77142
77218
|
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>`;
|
|
77143
77219
|
effectivePrompt = `${recallBlock}\n\n${effectivePrompt}`;
|
|
77144
|
-
log$
|
|
77220
|
+
log$9.debug(`auto-recall: injected ${recallResults.length} snippets (${recallBlock.length} chars)`);
|
|
77145
77221
|
}
|
|
77146
77222
|
}
|
|
77147
77223
|
} catch (recallErr) {
|
|
77148
|
-
log$
|
|
77224
|
+
log$9.debug(`auto-recall: skipped (${String(recallErr)})`);
|
|
77149
77225
|
}
|
|
77150
77226
|
}
|
|
77151
77227
|
{
|
|
@@ -77157,10 +77233,10 @@ async function runEmbeddedAttempt(params) {
|
|
|
77157
77233
|
if (planResult.enter) {
|
|
77158
77234
|
if (planResult.stripped != null) effectivePrompt = planResult.stripped;
|
|
77159
77235
|
effectivePrompt = `${PLAN_MODE_SYSTEM_PROMPT}\n\n${effectivePrompt}`;
|
|
77160
|
-
log$
|
|
77236
|
+
log$9.info(`plan-mode: activated (${planResult.reason}) for runId=${params.runId}`);
|
|
77161
77237
|
} else if (planResult.stripped != null) effectivePrompt = planResult.stripped;
|
|
77162
77238
|
}
|
|
77163
|
-
log$
|
|
77239
|
+
log$9.debug(`embedded run prompt start: runId=${params.runId} sessionId=${params.sessionId}`);
|
|
77164
77240
|
cacheTrace?.recordStage("prompt:before", {
|
|
77165
77241
|
prompt: effectivePrompt,
|
|
77166
77242
|
messages: activeSession.messages
|
|
@@ -77172,7 +77248,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
77172
77248
|
const sessionContext = sessionManager.buildSessionContext();
|
|
77173
77249
|
const sanitizedOrphan = transcriptPolicy.sanitizeThinkingSignatures ? sanitizeAntigravityThinkingBlocks(sessionContext.messages) : sessionContext.messages;
|
|
77174
77250
|
activeSession.agent.replaceMessages(sanitizedOrphan);
|
|
77175
|
-
log$
|
|
77251
|
+
log$9.warn(`Removed orphaned user message to prevent consecutive user turns. runId=${params.runId} sessionId=${params.sessionId}`);
|
|
77176
77252
|
}
|
|
77177
77253
|
try {
|
|
77178
77254
|
const imageResult = await detectAndLoadPromptImages({
|
|
@@ -77194,12 +77270,12 @@ async function runEmbeddedAttempt(params) {
|
|
|
77194
77270
|
messages: activeSession.messages,
|
|
77195
77271
|
note: `images: prompt=${imageResult.images.length} history=${imageResult.historyImagesByIndex.size}`
|
|
77196
77272
|
});
|
|
77197
|
-
if (log$
|
|
77273
|
+
if (log$9.isEnabled("debug")) {
|
|
77198
77274
|
const msgCount = activeSession.messages.length;
|
|
77199
77275
|
const systemLen = systemPromptText?.length ?? 0;
|
|
77200
77276
|
const promptLen = effectivePrompt.length;
|
|
77201
77277
|
const sessionSummary = summarizeSessionContext(activeSession.messages);
|
|
77202
|
-
log$
|
|
77278
|
+
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}`);
|
|
77203
77279
|
}
|
|
77204
77280
|
if (hookRunner?.hasHooks("llm_input")) hookRunner.runLlmInput({
|
|
77205
77281
|
runId: params.runId,
|
|
@@ -77217,7 +77293,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
77217
77293
|
workspaceDir: params.workspaceDir,
|
|
77218
77294
|
messageProvider: params.messageProvider ?? void 0
|
|
77219
77295
|
}).catch((err) => {
|
|
77220
|
-
log$
|
|
77296
|
+
log$9.warn(`llm_input hook failed: ${String(err)}`);
|
|
77221
77297
|
});
|
|
77222
77298
|
if (imageResult.images.length > 0) await abortable(activeSession.prompt(effectivePrompt, { images: imageResult.images }));
|
|
77223
77299
|
else await abortable(activeSession.prompt(effectivePrompt));
|
|
@@ -77225,7 +77301,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
77225
77301
|
promptError = err;
|
|
77226
77302
|
promptErrorSource = "prompt";
|
|
77227
77303
|
} finally {
|
|
77228
|
-
log$
|
|
77304
|
+
log$9.debug(`embedded run prompt end: runId=${params.runId} sessionId=${params.sessionId} durationMs=${Date.now() - promptStartedAt}`);
|
|
77229
77305
|
}
|
|
77230
77306
|
const wasCompactingBefore = activeSession.isCompacting;
|
|
77231
77307
|
const snapshot = activeSession.messages.slice();
|
|
@@ -77240,7 +77316,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
77240
77316
|
promptError = err;
|
|
77241
77317
|
promptErrorSource = "compaction";
|
|
77242
77318
|
}
|
|
77243
|
-
if (!isProbeSession) log$
|
|
77319
|
+
if (!isProbeSession) log$9.debug(`compaction wait aborted: runId=${params.runId} sessionId=${params.sessionId}`);
|
|
77244
77320
|
} else throw err;
|
|
77245
77321
|
}
|
|
77246
77322
|
if (!timedOutDuringCompaction) {
|
|
@@ -77258,7 +77334,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
77258
77334
|
currentSessionId: activeSession.sessionId
|
|
77259
77335
|
});
|
|
77260
77336
|
if (timedOutDuringCompaction) {
|
|
77261
|
-
if (!isProbeSession) log$
|
|
77337
|
+
if (!isProbeSession) log$9.warn(`using ${snapshotSelection.source} snapshot: timed out during compaction runId=${params.runId} sessionId=${params.sessionId}`);
|
|
77262
77338
|
}
|
|
77263
77339
|
messagesSnapshot = snapshotSelection.messagesSnapshot;
|
|
77264
77340
|
sessionIdUsed = snapshotSelection.sessionIdUsed;
|
|
@@ -77273,7 +77349,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
77273
77349
|
error: describeUnknownError(promptError)
|
|
77274
77350
|
});
|
|
77275
77351
|
} catch (entryErr) {
|
|
77276
|
-
log$
|
|
77352
|
+
log$9.warn(`failed to persist prompt error entry: ${String(entryErr)}`);
|
|
77277
77353
|
}
|
|
77278
77354
|
cacheTrace?.recordStage("session:after", {
|
|
77279
77355
|
messages: messagesSnapshot,
|
|
@@ -77292,17 +77368,17 @@ async function runEmbeddedAttempt(params) {
|
|
|
77292
77368
|
workspaceDir: params.workspaceDir,
|
|
77293
77369
|
messageProvider: params.messageProvider ?? void 0
|
|
77294
77370
|
}).catch((err) => {
|
|
77295
|
-
log$
|
|
77371
|
+
log$9.warn(`agent_end hook failed: ${err}`);
|
|
77296
77372
|
});
|
|
77297
77373
|
} finally {
|
|
77298
77374
|
clearTimeout(abortTimer);
|
|
77299
77375
|
clearSymipulseTimer();
|
|
77300
77376
|
if (abortWarnTimer) clearTimeout(abortWarnTimer);
|
|
77301
|
-
if (!isProbeSession && (aborted || timedOut) && !timedOutDuringCompaction) log$
|
|
77377
|
+
if (!isProbeSession && (aborted || timedOut) && !timedOutDuringCompaction) log$9.debug(`run cleanup: runId=${params.runId} sessionId=${params.sessionId} aborted=${aborted} timedOut=${timedOut}`);
|
|
77302
77378
|
try {
|
|
77303
77379
|
unsubscribe();
|
|
77304
77380
|
} catch (err) {
|
|
77305
|
-
log$
|
|
77381
|
+
log$9.error(`CRITICAL: unsubscribe failed, possible resource leak: runId=${params.runId} ${String(err)}`);
|
|
77306
77382
|
}
|
|
77307
77383
|
clearActiveEmbeddedRun(params.sessionId, queueHandle, params.sessionKey);
|
|
77308
77384
|
params.abortSignal?.removeEventListener?.("abort", onAbort);
|
|
@@ -77327,7 +77403,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
77327
77403
|
workspaceDir: params.workspaceDir,
|
|
77328
77404
|
messageProvider: params.messageProvider ?? void 0
|
|
77329
77405
|
}).catch((err) => {
|
|
77330
|
-
log$
|
|
77406
|
+
log$9.warn(`llm_output hook failed: ${String(err)}`);
|
|
77331
77407
|
});
|
|
77332
77408
|
return {
|
|
77333
77409
|
aborted,
|
|
@@ -77588,7 +77664,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
77588
77664
|
const redactedSessionId = redactRunIdentifier(params.sessionId);
|
|
77589
77665
|
const redactedSessionKey = redactRunIdentifier(params.sessionKey);
|
|
77590
77666
|
const redactedWorkspace = redactRunIdentifier(resolvedWorkspace);
|
|
77591
|
-
if (workspaceResolution.usedFallback) log$
|
|
77667
|
+
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}`);
|
|
77592
77668
|
const prevCwd = process.cwd();
|
|
77593
77669
|
let provider = (params.provider ?? DEFAULT_PROVIDER).trim() || DEFAULT_PROVIDER;
|
|
77594
77670
|
let modelId = (params.model ?? DEFAULT_MODEL).trim() || DEFAULT_MODEL;
|
|
@@ -77607,7 +77683,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
77607
77683
|
if (hookRunner?.hasHooks("before_model_resolve")) try {
|
|
77608
77684
|
modelResolveOverride = await hookRunner.runBeforeModelResolve({ prompt: params.prompt }, hookCtx);
|
|
77609
77685
|
} catch (hookErr) {
|
|
77610
|
-
log$
|
|
77686
|
+
log$9.warn(`before_model_resolve hook failed: ${String(hookErr)}`);
|
|
77611
77687
|
}
|
|
77612
77688
|
if (hookRunner?.hasHooks("before_agent_start")) try {
|
|
77613
77689
|
const legacyResult = await hookRunner.runBeforeAgentStart({ prompt: params.prompt }, hookCtx);
|
|
@@ -77616,15 +77692,15 @@ async function runEmbeddedPiAgent(params) {
|
|
|
77616
77692
|
modelOverride: modelResolveOverride?.modelOverride ?? legacyResult?.modelOverride
|
|
77617
77693
|
};
|
|
77618
77694
|
} catch (hookErr) {
|
|
77619
|
-
log$
|
|
77695
|
+
log$9.warn(`before_agent_start hook (legacy model resolve path) failed: ${String(hookErr)}`);
|
|
77620
77696
|
}
|
|
77621
77697
|
if (modelResolveOverride?.providerOverride) {
|
|
77622
77698
|
provider = modelResolveOverride.providerOverride;
|
|
77623
|
-
log$
|
|
77699
|
+
log$9.info(`[hooks] provider overridden to ${provider}`);
|
|
77624
77700
|
}
|
|
77625
77701
|
if (modelResolveOverride?.modelOverride) {
|
|
77626
77702
|
modelId = modelResolveOverride.modelOverride;
|
|
77627
|
-
log$
|
|
77703
|
+
log$9.info(`[hooks] model overridden to ${modelId}`);
|
|
77628
77704
|
}
|
|
77629
77705
|
const { model, error, authStorage, modelRegistry } = resolveModel(provider, modelId, agentDir, params.config);
|
|
77630
77706
|
if (!model) throw new FailoverError(error ?? `Unknown model: ${provider}/${modelId}`, {
|
|
@@ -77644,9 +77720,9 @@ async function runEmbeddedPiAgent(params) {
|
|
|
77644
77720
|
warnBelowTokens: CONTEXT_WINDOW_WARN_BELOW_TOKENS,
|
|
77645
77721
|
hardMinTokens: CONTEXT_WINDOW_HARD_MIN_TOKENS
|
|
77646
77722
|
});
|
|
77647
|
-
if (ctxGuard.shouldWarn) log$
|
|
77723
|
+
if (ctxGuard.shouldWarn) log$9.warn(`low context window: ${provider}/${modelId} ctx=${ctxGuard.tokens} (warn<${CONTEXT_WINDOW_WARN_BELOW_TOKENS}) source=${ctxGuard.source}`);
|
|
77648
77724
|
if (ctxGuard.shouldBlock) {
|
|
77649
|
-
log$
|
|
77725
|
+
log$9.error(`blocked model (context window too small): ${provider}/${modelId} ctx=${ctxGuard.tokens} (min=${CONTEXT_WINDOW_HARD_MIN_TOKENS}) source=${ctxGuard.source}`);
|
|
77650
77726
|
throw new FailoverError(`Model context window too small (${ctxGuard.tokens} tokens). Minimum is ${CONTEXT_WINDOW_HARD_MIN_TOKENS}.`, {
|
|
77651
77727
|
reason: "unknown",
|
|
77652
77728
|
provider,
|
|
@@ -77776,7 +77852,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
77776
77852
|
while (true) {
|
|
77777
77853
|
if (runLoopIterations >= MAX_RUN_LOOP_ITERATIONS) {
|
|
77778
77854
|
const message = `Exceeded retry limit after ${runLoopIterations} attempts (max=${MAX_RUN_LOOP_ITERATIONS}).`;
|
|
77779
|
-
log$
|
|
77855
|
+
log$9.error(`[run-retry-limit] sessionKey=${params.sessionKey ?? params.sessionId} provider=${provider}/${modelId} attempts=${runLoopIterations} maxAttempts=${MAX_RUN_LOOP_ITERATIONS}`);
|
|
77780
77856
|
return {
|
|
77781
77857
|
payloads: [{
|
|
77782
77858
|
text: "Request failed after repeated internal retries. Please try again, or use /new to start a fresh session.",
|
|
@@ -77897,18 +77973,18 @@ async function runEmbeddedPiAgent(params) {
|
|
|
77897
77973
|
const overflowDiagId = createCompactionDiagId();
|
|
77898
77974
|
const errorText = contextOverflowError.text;
|
|
77899
77975
|
const msgCount = attempt.messagesSnapshot?.length ?? 0;
|
|
77900
|
-
log$
|
|
77976
|
+
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)}`);
|
|
77901
77977
|
const isCompactionFailure = isCompactionFailureError(errorText);
|
|
77902
77978
|
const hadAttemptLevelCompaction = attemptCompactionCount > 0;
|
|
77903
77979
|
if (!isCompactionFailure && hadAttemptLevelCompaction && overflowCompactionAttempts < MAX_OVERFLOW_COMPACTION_ATTEMPTS) {
|
|
77904
77980
|
overflowCompactionAttempts++;
|
|
77905
|
-
log$
|
|
77981
|
+
log$9.warn(`context overflow persisted after in-attempt compaction (attempt ${overflowCompactionAttempts}/${MAX_OVERFLOW_COMPACTION_ATTEMPTS}); retrying prompt without additional compaction for ${provider}/${modelId}`);
|
|
77906
77982
|
continue;
|
|
77907
77983
|
}
|
|
77908
77984
|
if (!isCompactionFailure && !hadAttemptLevelCompaction && overflowCompactionAttempts < MAX_OVERFLOW_COMPACTION_ATTEMPTS) {
|
|
77909
|
-
if (log$
|
|
77985
|
+
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}`);
|
|
77910
77986
|
overflowCompactionAttempts++;
|
|
77911
|
-
log$
|
|
77987
|
+
log$9.warn(`context overflow detected (attempt ${overflowCompactionAttempts}/${MAX_OVERFLOW_COMPACTION_ATTEMPTS}); attempting auto-compaction for ${provider}/${modelId}`);
|
|
77912
77988
|
const compactResult = await compactEmbeddedPiSessionDirect({
|
|
77913
77989
|
sessionId: params.sessionId,
|
|
77914
77990
|
sessionKey: params.sessionKey,
|
|
@@ -77937,10 +78013,10 @@ async function runEmbeddedPiAgent(params) {
|
|
|
77937
78013
|
});
|
|
77938
78014
|
if (compactResult.compacted) {
|
|
77939
78015
|
autoCompactionCount += 1;
|
|
77940
|
-
log$
|
|
78016
|
+
log$9.info(`auto-compaction succeeded for ${provider}/${modelId}; retrying prompt`);
|
|
77941
78017
|
continue;
|
|
77942
78018
|
}
|
|
77943
|
-
log$
|
|
78019
|
+
log$9.warn(`auto-compaction failed for ${provider}/${modelId}: ${compactResult.reason ?? "nothing to compact"}`);
|
|
77944
78020
|
}
|
|
77945
78021
|
if (!toolResultTruncationAttempted) {
|
|
77946
78022
|
const contextWindowTokens = ctxInfo.tokens;
|
|
@@ -77949,9 +78025,9 @@ async function runEmbeddedPiAgent(params) {
|
|
|
77949
78025
|
contextWindowTokens
|
|
77950
78026
|
}) : false;
|
|
77951
78027
|
if (hasOversized) {
|
|
77952
|
-
if (log$
|
|
78028
|
+
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}`);
|
|
77953
78029
|
toolResultTruncationAttempted = true;
|
|
77954
|
-
log$
|
|
78030
|
+
log$9.warn(`[context-overflow-recovery] Attempting tool result truncation for ${provider}/${modelId} (contextWindow=${contextWindowTokens} tokens)`);
|
|
77955
78031
|
const truncResult = await truncateOversizedToolResultsInSession({
|
|
77956
78032
|
sessionFile: params.sessionFile,
|
|
77957
78033
|
contextWindowTokens,
|
|
@@ -77959,13 +78035,13 @@ async function runEmbeddedPiAgent(params) {
|
|
|
77959
78035
|
sessionKey: params.sessionKey
|
|
77960
78036
|
});
|
|
77961
78037
|
if (truncResult.truncated) {
|
|
77962
|
-
log$
|
|
78038
|
+
log$9.info(`[context-overflow-recovery] Truncated ${truncResult.truncatedCount} tool result(s); retrying prompt`);
|
|
77963
78039
|
continue;
|
|
77964
78040
|
}
|
|
77965
|
-
log$
|
|
77966
|
-
} else if (log$
|
|
78041
|
+
log$9.warn(`[context-overflow-recovery] Tool result truncation did not help: ${truncResult.reason ?? "unknown"}`);
|
|
78042
|
+
} 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}`);
|
|
77967
78043
|
}
|
|
77968
|
-
if ((isCompactionFailure || overflowCompactionAttempts >= MAX_OVERFLOW_COMPACTION_ATTEMPTS || toolResultTruncationAttempted) && log$
|
|
78044
|
+
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}`);
|
|
77969
78045
|
const kind = isCompactionFailure ? "compaction_failure" : "context_overflow";
|
|
77970
78046
|
return {
|
|
77971
78047
|
payloads: [{
|
|
@@ -78046,7 +78122,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
78046
78122
|
attempted: attemptedThinking
|
|
78047
78123
|
});
|
|
78048
78124
|
if (fallbackThinking) {
|
|
78049
|
-
log$
|
|
78125
|
+
log$9.warn(`unsupported thinking level for ${provider}/${modelId}; retrying with ${fallbackThinking}`);
|
|
78050
78126
|
thinkLevel = fallbackThinking;
|
|
78051
78127
|
continue;
|
|
78052
78128
|
}
|
|
@@ -78064,7 +78140,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
78064
78140
|
attempted: attemptedThinking
|
|
78065
78141
|
});
|
|
78066
78142
|
if (fallbackThinking && !aborted) {
|
|
78067
|
-
log$
|
|
78143
|
+
log$9.warn(`unsupported thinking level for ${provider}/${modelId}; retrying with ${fallbackThinking}`);
|
|
78068
78144
|
thinkLevel = fallbackThinking;
|
|
78069
78145
|
continue;
|
|
78070
78146
|
}
|
|
@@ -78081,7 +78157,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
78081
78157
|
imageDimensionError.contentIndex !== void 0 ? `content=${imageDimensionError.contentIndex}` : null,
|
|
78082
78158
|
imageDimensionError.maxDimensionPx !== void 0 ? `limit=${imageDimensionError.maxDimensionPx}px` : null
|
|
78083
78159
|
].filter(Boolean).join(" ");
|
|
78084
|
-
log$
|
|
78160
|
+
log$9.warn(`Profile ${lastProfileId} rejected image payload${details ? ` (${details})` : ""}.`);
|
|
78085
78161
|
}
|
|
78086
78162
|
const isLocalOllamaTimeout = timedOut && model.api === "ollama";
|
|
78087
78163
|
if (!aborted && failoverFailure || timedOut && !timedOutDuringCompaction && !isLocalOllamaTimeout) {
|
|
@@ -78093,8 +78169,8 @@ async function runEmbeddedPiAgent(params) {
|
|
|
78093
78169
|
cfg: params.config,
|
|
78094
78170
|
agentDir: params.agentDir
|
|
78095
78171
|
});
|
|
78096
|
-
if (timedOut && !isProbeSession) log$
|
|
78097
|
-
if (cloudCodeAssistFormatError) log$
|
|
78172
|
+
if (timedOut && !isProbeSession) log$9.warn(`Profile ${lastProfileId} timed out (possible rate limit). Trying next account...`);
|
|
78173
|
+
if (cloudCodeAssistFormatError) log$9.warn(`Profile ${lastProfileId} hit Cloud Code Assist format error. Tool calls will be sanitized on retry.`);
|
|
78098
78174
|
}
|
|
78099
78175
|
if (await advanceAuthProfile()) continue;
|
|
78100
78176
|
if (fallbackConfigured) {
|
|
@@ -78160,7 +78236,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
78160
78236
|
const hasCodeBlocks = attempt.assistantTexts.some((text) => /```[\s\S]*?```/.test(text));
|
|
78161
78237
|
if (hasCodeToolUsage || hasCodeBlocks) {
|
|
78162
78238
|
verificationPassCompleted = true;
|
|
78163
|
-
log$
|
|
78239
|
+
log$9.debug(`[verification] starting verification pass: runId=${params.runId} sessionId=${params.sessionId} trigger=${hasCodeToolUsage ? "tool_usage" : "code_blocks"}`);
|
|
78164
78240
|
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.";
|
|
78165
78241
|
try {
|
|
78166
78242
|
const verifyAttempt = await runEmbeddedAttempt({
|
|
@@ -78246,10 +78322,10 @@ async function runEmbeddedPiAgent(params) {
|
|
|
78246
78322
|
payloads.length = 0;
|
|
78247
78323
|
payloads.push(...verifyPayloads);
|
|
78248
78324
|
}
|
|
78249
|
-
log$
|
|
78250
|
-
} else log$
|
|
78325
|
+
log$9.debug(`[verification] verification produced corrections: runId=${params.runId} tools=${verifyAttempt.toolMetas.length} texts=${verifyAttempt.assistantTexts.length}`);
|
|
78326
|
+
} else log$9.debug(`[verification] verification confirmed original response: runId=${params.runId}`);
|
|
78251
78327
|
} catch (verifyErr) {
|
|
78252
|
-
log$
|
|
78328
|
+
log$9.warn(`[verification] verification pass failed, keeping original response: runId=${params.runId} error=${String(verifyErr)}`);
|
|
78253
78329
|
}
|
|
78254
78330
|
}
|
|
78255
78331
|
}
|
|
@@ -78270,7 +78346,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
78270
78346
|
messagingToolSentTargets: attempt.messagingToolSentTargets,
|
|
78271
78347
|
successfulCronAdds: attempt.successfulCronAdds
|
|
78272
78348
|
};
|
|
78273
|
-
log$
|
|
78349
|
+
log$9.debug(`embedded run done: runId=${params.runId} sessionId=${params.sessionId} durationMs=${Date.now() - started} aborted=${aborted}`);
|
|
78274
78350
|
if (lastProfileId) {
|
|
78275
78351
|
await markAuthProfileGood({
|
|
78276
78352
|
store: authStore,
|