wednesdayai 0.5.1-dev.36 → 0.5.1-dev.37
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/{agent-scope-cTY4-zRz.js → agent-scope-CoIdVzmg.js} +3 -3
- package/dist/{agent-turn-runner-JxDS9bU_.js → agent-turn-runner-CiEPY6RO.js} +2 -2
- package/dist/{agent-turn-runner-7LQU6Fut.js → agent-turn-runner-DKwd_tAc.js} +6 -6
- package/dist/{api-key-rotation-BCh_J5f6.js → api-key-rotation-CoKWzuyV.js} +2 -2
- package/dist/{audio-preflight-C9EHsVrE.js → audio-preflight-BV83ctbI.js} +23 -23
- package/dist/{audio-preflight-Cxyte-N3.js → audio-preflight-CKFGJslr.js} +3 -3
- package/dist/{audio-transcription-runner-CoyogVcx.js → audio-transcription-runner-B-MEt_yD.js} +1 -1
- package/dist/{audio-transcription-runner-DXlkPfwW.js → audio-transcription-runner-DRUTJgZh.js} +25 -25
- package/dist/build-info.json +3 -3
- package/dist/bundled/boot-md/handler.js +50 -50
- package/dist/bundled/bootstrap-extra-files/handler.js +5 -5
- package/dist/bundled/command-logger/handler.js +2 -2
- package/dist/bundled/session-journal/handler.js +50 -50
- package/dist/bundled/session-memory/handler.js +50 -50
- package/dist/canvas-host/a2ui/.bundle.hash +1 -1
- package/dist/{chat-content-Cafge7N8.js → chat-content-01nUeO9I.js} +3 -3
- package/dist/{chat-content-Csm95kDY.js → chat-content-B2kNxQ3a.js} +39 -39
- package/dist/{chrome-H5-7mQ4m.js → chrome-DgDNUC2A.js} +4 -4
- package/dist/{chrome-D-DfD0Cv.js → chrome-kwiyU0Mr.js} +31 -31
- package/dist/{chunk-zortZzCP.js → chunk-BRJHaAd6.js} +3 -3
- package/dist/{command-queue-DfL4YmGb.js → command-queue-CRm1AADE.js} +1 -1
- package/dist/{commands-registry-Vo5C1XbD.js → commands-registry-D3lOVOa7.js} +2 -2
- package/dist/{deliver-BKt_OVTK.js → deliver-BoOCdGXY.js} +28 -28
- package/dist/{deliver-x22mTRDq.js → deliver-CgFkiA4Z.js} +1 -1
- package/dist/{diagnostic-8jsvSbYs.js → diagnostic-BSnQ1U_E.js} +3 -3
- package/dist/{errors-muW4vMSB.js → errors-CgPgYfWg.js} +1 -1
- package/dist/extensionAPI.js +6 -6
- package/dist/{fetch-Ciq99DHJ.js → fetch-BBi5dEoV.js} +8 -8
- package/dist/{fetch-B9Tca1cY.js → fetch-BrwJHFZR.js} +1 -1
- package/dist/{fetch-guard-DaJwMbcY.js → fetch-guard-BcLYPGi1.js} +2 -2
- package/dist/{frontmatter-BzlMEBkz.js → frontmatter-DQTIIgFI.js} +5 -5
- package/dist/{fs-safe-CDfp5e8Q.js → fs-safe-CRbowDkj.js} +26 -26
- package/dist/{ir-BczXO28b.js → ir-D___VWlp.js} +4 -4
- package/dist/{json-files-CNVg1Wi5.js → json-files-CurKd8gy.js} +28 -28
- package/dist/{legacy-names-CRCLZarD.js → legacy-names-D7ywm6_7.js} +1 -1
- package/dist/llm-slug-generator.js +50 -50
- package/dist/{manager-ywiQQ5nv.js → manager-yAtdyPwQ.js} +18 -18
- package/dist/{markdown-tables-CmGUH7Wy.js → markdown-tables-DfqPFbkZ.js} +2 -2
- package/dist/{model-selection-BJZFC8fA.js → model-selection-B7FYf8Fo.js} +83 -83
- package/dist/{outbound-attachment-BXAhY7Q6.js → outbound-attachment-BJq1brbB.js} +2 -2
- package/dist/{outbound-message-hooks-CjfNIFcN.js → outbound-message-hooks-Dl2zci3u.js} +5 -5
- package/dist/{path-alias-guards-BV6CR8H3.js → path-alias-guards-nWrE5acE.js} +1 -1
- package/dist/{pi-embedded-BzjQS2tl.js → pi-embedded-BAKd4NmP.js} +18 -18
- package/dist/{pi-embedded-D6Ti_RiY.js → pi-embedded-_YhHvi3M.js} +258 -258
- package/dist/{pi-model-discovery-PH-bhX7g.js → pi-model-discovery-CusLASy5.js} +7 -7
- package/dist/plugin-sdk/provider-media-understanding.js +7 -7
- package/dist/{proxy-env-DXcKRnns.js → proxy-env-DrmTb0QW.js} +1 -1
- package/dist/{pw-ai-ByUzz5o2.js → pw-ai-BKN66RLi.js} +13 -13
- package/dist/{pw-ai-qlENNDHC.js → pw-ai-CPIjXEgJ.js} +1 -1
- package/dist/{qmd-manager-CPPURYfg.js → qmd-manager-BYC9bX-E.js} +12 -12
- package/dist/{qmd-scope-dd_YbPG-.js → qmd-scope-D6tMcgqR.js} +1 -1
- package/dist/{query-expansion-0S2l-J2-.js → query-expansion-CnQI0IeV.js} +13 -13
- package/dist/{recorder-CrrhLZt5.js → recorder-B7dhxQ62.js} +2 -2
- package/dist/{redact-BkE4uRXu.js → redact-CysJDryP.js} +1 -1
- package/dist/{replies-j6q2EArA.js → replies-CP8xbTSR.js} +5 -5
- package/dist/{reply-prefix-BCu_i91I.js → reply-prefix-C7r81KLS.js} +1 -1
- package/dist/{resolve-route-WUZ7lH6L.js → resolve-route-BvD1w4_v.js} +4 -4
- package/dist/{send-lY0a6iA2.js → send-4WdiWuFu.js} +8 -8
- package/dist/{send-CFG2EYja.js → send-BZv91SjC.js} +6 -6
- package/dist/{send-80rMjd6V.js → send-CjR30q4U.js} +8 -8
- package/dist/{send-D1aXT71a.js → send-bmlVFiBl.js} +7 -7
- package/dist/{session-meta-BjRAI6ON.js → session-meta-BeqTuIFU.js} +1 -1
- package/dist/{sessions-B6iaKddN.js → sessions-BjSGNjb0.js} +5 -5
- package/dist/{skill-commands-BG0ravVA.js → skill-commands-CcrQquVr.js} +8 -8
- package/dist/{store-BXWb__DD.js → store-DniD8E6a.js} +7 -7
- package/dist/{tables-CBpS5G91.js → tables-BbmkAuhA.js} +1 -1
- package/dist/{tokens-Q7TMdIpT.js → tokens-C2ll8wSq.js} +1 -1
- package/dist/{tool-loop-detection-CVIDnpv_.js → tool-loop-detection-B0Jj6y2H.js} +2 -2
- package/dist/{user-run-recording-DNsWtMOn.js → user-run-recording-COpooN64.js} +2 -2
- package/dist/{workspace-D8z8s1Xz.js → workspace-xnzx7wEV.js} +26 -26
- package/extensions/acpx/package.json +1 -1
- package/extensions/anthropic/package.json +1 -1
- package/extensions/bifrost/package.json +1 -1
- package/extensions/bluebubbles/package.json +1 -1
- package/extensions/copilot-proxy/package.json +1 -1
- package/extensions/deepgram/package.json +1 -1
- package/extensions/deepinfra/package.json +1 -1
- package/extensions/diagnostics-otel/package.json +1 -1
- package/extensions/diffs/package.json +1 -1
- package/extensions/discord/package.json +1 -1
- package/extensions/dream-cycle/package.json +1 -1
- package/extensions/elevenlabs/package.json +1 -1
- package/extensions/feishu/package.json +1 -1
- package/extensions/gemini-search/package.json +1 -1
- package/extensions/google/package.json +1 -1
- package/extensions/google-gemini-cli-auth/package.json +1 -1
- package/extensions/googlechat/package.json +1 -1
- package/extensions/grok-search/package.json +1 -1
- package/extensions/groq/package.json +1 -1
- package/extensions/imessage/package.json +1 -1
- package/extensions/irc/package.json +1 -1
- package/extensions/kimi-search/package.json +1 -1
- package/extensions/kokoro/package.json +1 -1
- package/extensions/learning-core/package.json +1 -1
- package/extensions/line/package.json +1 -1
- package/extensions/llm-task/package.json +1 -1
- package/extensions/lobster/package.json +1 -1
- package/extensions/matrix/CHANGELOG.md +1 -1
- package/extensions/matrix/package.json +1 -1
- package/extensions/mattermost/package.json +1 -1
- package/extensions/memory-core/package.json +1 -1
- package/extensions/memory-lancedb/package.json +1 -1
- package/extensions/minimax/package.json +1 -1
- package/extensions/minimax-portal-auth/package.json +1 -1
- package/extensions/mistral/package.json +1 -1
- package/extensions/moonshot/package.json +1 -1
- package/extensions/msteams/CHANGELOG.md +1 -1
- package/extensions/msteams/package.json +1 -1
- package/extensions/nextcloud-talk/package.json +1 -1
- package/extensions/nostr/CHANGELOG.md +1 -1
- package/extensions/nostr/package.json +1 -1
- package/extensions/open-prose/package.json +1 -1
- package/extensions/openai/package.json +1 -1
- package/extensions/openai-realtime/package.json +1 -1
- package/extensions/openrouter/package.json +1 -1
- package/extensions/perplexity-search/package.json +1 -1
- package/extensions/searxng-search/package.json +1 -1
- package/extensions/signal/package.json +1 -1
- package/extensions/slack/package.json +1 -1
- package/extensions/synology-chat/package.json +1 -1
- package/extensions/telegram/package.json +1 -1
- package/extensions/tlon/package.json +1 -1
- package/extensions/twitch/CHANGELOG.md +1 -1
- package/extensions/twitch/package.json +1 -1
- package/extensions/ui-surfaces/package.json +1 -1
- package/extensions/voice-call/CHANGELOG.md +1 -1
- package/extensions/voice-call/package.json +1 -1
- package/extensions/whatsapp/package.json +1 -1
- package/extensions/zai/package.json +1 -1
- package/extensions/zalo/CHANGELOG.md +1 -1
- package/extensions/zalo/package.json +1 -1
- package/extensions/zalouser/CHANGELOG.md +1 -1
- package/extensions/zalouser/package.json +1 -1
- package/package.json +1 -1
- package/dist/github-copilot-token-DrVydgnY.js +0 -106
- package/dist/paths-BIDPYPVC.js +0 -233
- package/dist/subsystem-BOg9wqSC.js +0 -2777
|
@@ -1,69 +1,69 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-Cbj13DAv.js";
|
|
2
|
-
import { _ as toAgentModelListLike, c as resolveAgentWorkspaceDir, d as resolveRunModelFallbacksOverride, f as resolveSessionAgentId, g as resolveAgentModelPrimaryValue, h as resolveAgentModelFallbackValues, i as resolveAgentDir, l as resolveDefaultAgentId, n as listAgentIds, p as resolveSessionAgentIds, r as resolveAgentConfig, s as resolveAgentSkillsFilter, t as hasConfiguredModelFallbacks, u as resolveEffectiveModelFallbacks } from "./agent-scope-
|
|
3
|
-
import { a as resolveGatewayLockDir, f as resolveRequiredHomeDir, l as resolveStateDir, o as resolveGatewayPort, r as resolveConfigPath, s as resolveOAuthDir, u as expandHomePrefix } from "./paths-
|
|
4
|
-
import { C as appendFileLog, F as openBoundaryFileSync, K as isDangerousHostEnvVarName, O as INCLUDE_KEY, P as openBoundaryFile, Q as clampInt, T as normalizeLogLevel, W as normalizeWindowsPathForComparison, Z as CONFIG_DIR, _ as colorize, a as createNonExitingRuntime, b as getChildLogger, c as registerActiveProgressLine, ct as safeParseJson, dt as sleep$3, et as ensureDir$3, f as logVerbose, ft as sliceUtf16Safe, g as warn, h as shouldLogVerbose, it as normalizeE164, j as isBlockedObjectKey, l as unregisterActiveProgressLine, lt as shortenHomeInString, m as setVerbose, mt as resolvePreferredOpenClawTmpDir, nt as formatTerminalLink, o as defaultRuntime, pt as truncateUtf16Safe, rt as isRecord$1, s as clearActiveProgressLine, st as resolveUserPath, t as createSubsystemLogger, tt as escapeRegExp, u as danger, ut as shortenHomePath, v as isRich, y as theme } from "./subsystem-
|
|
2
|
+
import { _ as toAgentModelListLike, c as resolveAgentWorkspaceDir, d as resolveRunModelFallbacksOverride, f as resolveSessionAgentId, g as resolveAgentModelPrimaryValue, h as resolveAgentModelFallbackValues, i as resolveAgentDir, l as resolveDefaultAgentId, n as listAgentIds, p as resolveSessionAgentIds, r as resolveAgentConfig, s as resolveAgentSkillsFilter, t as hasConfiguredModelFallbacks, u as resolveEffectiveModelFallbacks } from "./agent-scope-CoIdVzmg.js";
|
|
3
|
+
import { a as resolveGatewayLockDir, f as resolveRequiredHomeDir, l as resolveStateDir, o as resolveGatewayPort, r as resolveConfigPath, s as resolveOAuthDir, u as expandHomePrefix } from "./paths-B_gs59ga.js";
|
|
4
|
+
import { C as appendFileLog, F as openBoundaryFileSync, K as isDangerousHostEnvVarName, O as INCLUDE_KEY, P as openBoundaryFile, Q as clampInt, T as normalizeLogLevel, W as normalizeWindowsPathForComparison, Z as CONFIG_DIR, _ as colorize, a as createNonExitingRuntime, b as getChildLogger, c as registerActiveProgressLine, ct as safeParseJson, dt as sleep$3, et as ensureDir$3, f as logVerbose, ft as sliceUtf16Safe, g as warn, h as shouldLogVerbose, it as normalizeE164, j as isBlockedObjectKey, l as unregisterActiveProgressLine, lt as shortenHomeInString, m as setVerbose, mt as resolvePreferredOpenClawTmpDir, nt as formatTerminalLink, o as defaultRuntime, pt as truncateUtf16Safe, rt as isRecord$1, s as clearActiveProgressLine, st as resolveUserPath, t as createSubsystemLogger, tt as escapeRegExp, u as danger, ut as shortenHomePath, v as isRich, y as theme } from "./subsystem-DynBFcQj.js";
|
|
5
5
|
import { n as resolveProcessScopedMap, t as isPlainObject } from "./plain-object-Doc_YkH1.js";
|
|
6
|
-
import { B as resolveThreadSessionKeys, C as DEFAULT_AGENT_ID, D as buildAgentMainSessionKey, F as normalizeAgentId, G as normalizeAccountId$1, H as sessionKeyAgentMatches, I as normalizeMainKey, K as normalizeOptionalAccountId, L as resolveAgentIdFromSessionKey, N as isKnownAgentMainSessionKey, P as isValidAgentId, Q as isCronSessionKey, R as resolveCanonicalIdentity, S as logWarn, T as DEVICE_SENDER_PREFIX, U as toAgentStoreSessionKey, V as sanitizeAgentId, W as DEFAULT_ACCOUNT_ID, X as getSubagentDepth, Y as WAKE_GATE_SESSION_KEY_SEGMENT, Z as isAcpSessionKey, _ as runExec, a as DEFAULT_IDENTITY_FILENAME, b as logError, et as isSubagentSessionKey, f as loadWorkspaceBootstrapFiles, g as runCommandWithTimeout, i as DEFAULT_HEARTBEAT_FILENAME, k as classifySessionKeyShape, l as ensureAgentWorkspace, m as resolveOpenClawPackageRoot, n as DEFAULT_AGENT_WORKSPACE_DIR, nt as resolveThreadParentSessionKey, r as DEFAULT_BOOTSTRAP_FILENAME, rt as stripAgentSessionKeyPrefix, tt as parseAgentSessionKey, u as filterBootstrapFilesForSession, v as spawnWithFallback, x as logInfo, y as logDebug, z as resolveConfiguredCanonicalIdentity } from "./workspace-
|
|
7
|
-
import { $ as normalizeScpRemoteHost, $i as parseDotPath, $n as getChannelPlugin, $t as clearPluginCommands, A as requireApiKey, Ai as DEFAULT_SAFE_BINS, An as DEFAULT_RESET_TRIGGERS, Ar as deliveryContextKey, At as resolveMemorySlotDecision, B as resolveProfilesUnavailableReason, Bi as SAFE_BIN_PROFILES, Bn as SESSION_RUN_STORE_FILE_NAME, Br as normalizeMessageChannel, Bt as normalizeChatChannelId, C as createOllamaStreamFn, Ca as resolveSecretInputRef, Ci as listWritableExplicitTrustedSafeBinDirs, Cn as readSessionUpdatedAt, Cr as resolveDiscordAccount, Ct as validateJsonSchemaValue, D as buildUsageWithNoCost, Da as DEFAULT_PROVIDER, Di as buildEnforcedShellCommand, Dn as updateSessionStore, Dr as resolveChannelGroupToolsPolicy, Dt as isBundledChannelEnabledByChannelConfig, E as buildStreamErrorAssistantMessage, Ea as DEFAULT_MODEL, Ei as analyzeShellCommand, En as updateLastRoute, Er as resolveChannelGroupRequireMention, Et as applyTestPluginDefaults, F as resolveAuthProfileOrder, Fi as isDispatchWrapperExecutable, Fn as parseSessionIndexRecordKey, Fr as isDeliverableMessageChannel, Ft as CHAT_CHANNEL_ORDER, G as readConfigFileSnapshotForWrite, Gi as mapStreamingModeToSlackLegacyDraftStreamMode, Gr as GATEWAY_CLIENT_NAMES, Hi as resolveSafeBinProfiles, Hn as resolveSessionFilePath, Hr as resolveMessageChannel, Ht as getActiveGatewayPluginRegistry, I as getSoonestCooldownExpiry, Ii as isShellWrapperExecutable, Ir as isGatewayMessageChannel, It as getChatChannelMeta, Ji as resolveSlackStreamingMode, Jn as resolveGroupSessionKey, Jr as resolveSessionLockMaxHoldFromTimeout, Jt as addRegisteredPluginApi, K as writeConfigFile, Ki as resolveDiscordPreviewStreamMode, Kn as resolveStorePath, Kr as normalizeAccountId$2, Kt as requireActivePluginRegistry, L as isProfileInCooldown, Li as unwrapKnownDispatchWrapperInvocation, Lr as isInternalMessageChannel, Lt as listChatChannels, M as resolveEnvApiKey, Mi as resolveAllowlistCandidatePath, Mn as resolveFreshSessionTotalTokens, Mr as normalizeDeliveryContext, Mt as isPathInside, N as resolveModelAuthMode, Ni as resolveCommandResolutionFromArgv, Nn as setSessionRuntimeModel, Nr as normalizeSessionDeliveryFields, Nt as safeStatSync, O as getApiKeyForModel, Oi as isWindowsPlatform, On as updateSessionStoreEntry, Or as resolveAccountEntry, Ot as normalizePluginsConfig, Pi as extractShellWrapperInlineCommand, Pn as parseDurationMs, Pr as INTERNAL_MESSAGE_CHANNEL, Q as resolveIMessageRemoteAttachmentRoots, Qi as isRecord$2, Qn as normalizeSignalMessagingTarget, Qt as buildPluginHealthReport, R as markAuthProfileFailure, Ri as unwrapKnownShellMultiplexerInvocation, Rr as isMarkdownCapableMessageChannel, Rt as normalizeAnyChannelId, S as OLLAMA_NATIVE_BASE_URL, Sa as normalizeResolvedSecretInputString, Si as isTrustedSafeBinPath, Sn as prepareConfiguredSessionStorageRuntimeActivation, Sr as listEnabledDiscordAccounts, T as buildAssistantMessageWithZeroUsage, Ta as DEFAULT_CONTEXT_TOKENS, Ti as validateSafeBinArgv, Tn as refreshConfiguredSessionBindingEntry, Tr as resolveChannelGroupPolicy, Tt as BUNDLED_ENABLED_BY_DEFAULT, U as loadConfig, Ui as applyMergePatch, Un as resolveSessionFilePathOptions, Ur as GATEWAY_CLIENT_IDS, Ut as getActivePluginRegistry, V as resolveApiKeyForProfile, Vi as normalizeSafeBinProfileFixtures, Vr as resolveGatewayMessageChannel, Vt as resolveChannelConfigId, W as readConfigFileSnapshot, Wi as isSafeExecutableValue, Wn as resolveSessionTranscriptPath, Wr as GATEWAY_CLIENT_MODES, Wt as getActivePluginRegistryKey, Xi as describeUnknownError$1, Xn as getChannelDock, Xr as readTaskWorkStates, Xt as createPluginRegistry, Y as isInboundPathAllowed, Yi as resolveSecretRefValues, Yn as resolveParentSessionGroupId, Yr as CtxProjectionCorruptionError, Yt as clearRegisteredPluginApis, Z as resolveIMessageAttachmentRoots, Zi as isNonEmptyString, Zn as listChannelDocks, Zt as normalizePluginHttpPath, _a as resolveAuthProfileDisplayLabel, _i as getConfigValueAtPath, _n as commitPreparedConfiguredSessionStorageRuntimeActivation, _r as resolveWhatsAppAccount, _t as isAvatarDataUrl, a as isCliProvider, aa as resolveShellEnvFallbackTimeoutMs, ai as applyTargetToParams, an as getRegisteredSpeechProviders, ar as normalizeHyphenSlug, ba as coerceSecretRef, bi as unsetConfigValueAtPath, bn as loadSessionStore, br as resolveIMessageAccount, bt as isSupportedLocalAvatarExtension, c as normalizeProviderId, ca as dedupeProfileIds, cn as replaceSpeechProviders, cr as resolveSlackAccount, d as resolveDefaultModelForAgent, da as ensureAuthProfileStore, di as replaceBufferedPluginTaskPasses, dn as createConversationReadQuery, dr as resolveSlackBotToken, ea as secretRefKey, en as executePluginCommand, er as listChannelPlugins, et as parseNonNegativeByteSize, f as resolveModelRefFromString, fa as resolveAuthStorePathForDisplay, fi as RecoveryAdmissionError, fn as getConversationReadQuery, fr as listEnabledSignalAccounts, ga as readProcessElapsedSeconds, gi as unsetConfigOverride, gn as closeReplacedConfiguredSessionStorageRuntime, gr as hasAnyWhatsAppAuth, gt as AVATAR_MAX_BYTES, h as resolveThinkingDefault, ha as isPidAlive, hi as setConfigOverride, hn as closeConfiguredSessionStorageRuntime, hr as normalizeWhatsAppTarget, i as findNormalizedProviderValue, ia as getShellPathFromLoginShell, ii as stringEnum, in as BUILTIN_TTS_PROVIDER_IDS, ir as normalizeAtHashSlug, ji as matchAllowlist, jn as mergeSessionEntry, jr as mergeDeliveryContext, jt as discoverOpenClawPlugins, k as getCustomProviderApiKey, ki as splitCommandChain, kr as deliveryContextFromSession, kt as resolveEffectiveEnableState, l as parseModelRef, la as listProfilesForProvider, li as discardBufferedPluginTaskPasses, ln as normalizeProviderId$1, lr as resolveSlackReplyToMode, m as resolveSubagentSpawnModelSelection, ma as withFileLock$1, mi as resetConfigOverrides, mn as requireSessionStorageRuntime, mr as isWhatsAppGroupJid, n as buildConfiguredAllowlistKeys, na as DEFAULT_SUBAGENT_MAX_SPAWN_DEPTH, ni as channelTargetsSchema, nn as matchPluginCommand, nr as formatAllowlistMatchMeta, nt as resolveExecPolicyPreset, o as modelKey, oa as isTruthyEnvValue, oi as actionHasTarget, on as getSpeechProvider, or as normalizeStringEntries, p as resolveReasoningDefault, pa as resolveOpenClawAgentDir, pi as getConfigOverrides, pr as resolveSignalAccount, q as validateConfigObjectWithPlugins, qi as resolveSlackNativeStreaming, qn as deriveSessionMetaPatch, qr as acquireSessionWriteLock, qt as setActivePluginRegistry, r as buildModelAliasIndex, ra as VERSION, ri as optionalStringEnum, rn as registerPluginCommand, rr as resolveAllowlistMatchByCandidates, s as normalizeModelRef$2, sa as resolveOwnerDisplaySetting, si as actionRequiresTarget, sn as isBuiltinTtsProvider, sr as normalizeStringEntriesLower, t as buildAllowedModelSet, ta as runTasksWithConcurrency, ti as channelTargetSchema, tn as listPluginCommands, tr as normalizeChannelId$1, tt as ASSISTANT_IDENTITY_COLORS, u as resolveConfiguredModelRef, ua as markAuthProfileGood, ui as listBufferedPluginTaskPasses, un as StorageReadAccessError, ur as resolveSlackAppToken, vi as parseConfigPath, vn as getConfiguredSessionStorageRuntime, vr as formatCliCommand, vt as isAvatarHttpUrl, w as buildAssistantMessage, wa as splitTrailingAuthProfile, wi as normalizeTrustedSafeBinDirs, wn as recordSessionMetaFromInbound, wr as normalizeDiscordToken, wt as loadPluginManifestRegistry, x as retryAsync, xa as hasConfiguredSecretInput, xi as getTrustedSafeBinDirs, xn as loadSessionStoreFromDisk, xr as createDiscordActionGate, xt as buildChannelAccountBindings, ya as normalizeSecretInput, yi as setConfigValueAtPath, yr as resolveCliName, yt as isPathWithinRoot, z as markAuthProfileUsed, zi as splitShellArgs, zn as SAFE_SESSION_ID_RE, zr as listDeliverableMessageChannels, zt as normalizeChannelId$2 } from "./model-selection-
|
|
8
|
-
import { a as saveJsonFile, i as loadJsonFile, r as resolveCopilotApiToken } from "./github-copilot-token-
|
|
9
|
-
import { n as createInternalHookEvent, o as triggerInternalHook, s as parseBooleanValue$1, t as readManifestNamespace } from "./legacy-names-
|
|
6
|
+
import { B as resolveThreadSessionKeys, C as DEFAULT_AGENT_ID, D as buildAgentMainSessionKey, F as normalizeAgentId, G as normalizeAccountId$1, H as sessionKeyAgentMatches, I as normalizeMainKey, K as normalizeOptionalAccountId, L as resolveAgentIdFromSessionKey, N as isKnownAgentMainSessionKey, P as isValidAgentId, Q as isCronSessionKey, R as resolveCanonicalIdentity, S as logWarn, T as DEVICE_SENDER_PREFIX, U as toAgentStoreSessionKey, V as sanitizeAgentId, W as DEFAULT_ACCOUNT_ID, X as getSubagentDepth, Y as WAKE_GATE_SESSION_KEY_SEGMENT, Z as isAcpSessionKey, _ as runExec, a as DEFAULT_IDENTITY_FILENAME, b as logError, et as isSubagentSessionKey, f as loadWorkspaceBootstrapFiles, g as runCommandWithTimeout, i as DEFAULT_HEARTBEAT_FILENAME, k as classifySessionKeyShape, l as ensureAgentWorkspace, m as resolveOpenClawPackageRoot, n as DEFAULT_AGENT_WORKSPACE_DIR, nt as resolveThreadParentSessionKey, r as DEFAULT_BOOTSTRAP_FILENAME, rt as stripAgentSessionKeyPrefix, tt as parseAgentSessionKey, u as filterBootstrapFilesForSession, v as spawnWithFallback, x as logInfo, y as logDebug, z as resolveConfiguredCanonicalIdentity } from "./workspace-xnzx7wEV.js";
|
|
7
|
+
import { $ as normalizeScpRemoteHost, $i as parseDotPath, $n as getChannelPlugin, $t as clearPluginCommands, A as requireApiKey, Ai as DEFAULT_SAFE_BINS, An as DEFAULT_RESET_TRIGGERS, Ar as deliveryContextKey, At as resolveMemorySlotDecision, B as resolveProfilesUnavailableReason, Bi as SAFE_BIN_PROFILES, Bn as SESSION_RUN_STORE_FILE_NAME, Br as normalizeMessageChannel, Bt as normalizeChatChannelId, C as createOllamaStreamFn, Ca as resolveSecretInputRef, Ci as listWritableExplicitTrustedSafeBinDirs, Cn as readSessionUpdatedAt, Cr as resolveDiscordAccount, Ct as validateJsonSchemaValue, D as buildUsageWithNoCost, Da as DEFAULT_PROVIDER, Di as buildEnforcedShellCommand, Dn as updateSessionStore, Dr as resolveChannelGroupToolsPolicy, Dt as isBundledChannelEnabledByChannelConfig, E as buildStreamErrorAssistantMessage, Ea as DEFAULT_MODEL, Ei as analyzeShellCommand, En as updateLastRoute, Er as resolveChannelGroupRequireMention, Et as applyTestPluginDefaults, F as resolveAuthProfileOrder, Fi as isDispatchWrapperExecutable, Fn as parseSessionIndexRecordKey, Fr as isDeliverableMessageChannel, Ft as CHAT_CHANNEL_ORDER, G as readConfigFileSnapshotForWrite, Gi as mapStreamingModeToSlackLegacyDraftStreamMode, Gr as GATEWAY_CLIENT_NAMES, Hi as resolveSafeBinProfiles, Hn as resolveSessionFilePath, Hr as resolveMessageChannel, Ht as getActiveGatewayPluginRegistry, I as getSoonestCooldownExpiry, Ii as isShellWrapperExecutable, Ir as isGatewayMessageChannel, It as getChatChannelMeta, Ji as resolveSlackStreamingMode, Jn as resolveGroupSessionKey, Jr as resolveSessionLockMaxHoldFromTimeout, Jt as addRegisteredPluginApi, K as writeConfigFile, Ki as resolveDiscordPreviewStreamMode, Kn as resolveStorePath, Kr as normalizeAccountId$2, Kt as requireActivePluginRegistry, L as isProfileInCooldown, Li as unwrapKnownDispatchWrapperInvocation, Lr as isInternalMessageChannel, Lt as listChatChannels, M as resolveEnvApiKey, Mi as resolveAllowlistCandidatePath, Mn as resolveFreshSessionTotalTokens, Mr as normalizeDeliveryContext, Mt as isPathInside, N as resolveModelAuthMode, Ni as resolveCommandResolutionFromArgv, Nn as setSessionRuntimeModel, Nr as normalizeSessionDeliveryFields, Nt as safeStatSync, O as getApiKeyForModel, Oi as isWindowsPlatform, On as updateSessionStoreEntry, Or as resolveAccountEntry, Ot as normalizePluginsConfig, Pi as extractShellWrapperInlineCommand, Pn as parseDurationMs, Pr as INTERNAL_MESSAGE_CHANNEL, Q as resolveIMessageRemoteAttachmentRoots, Qi as isRecord$2, Qn as normalizeSignalMessagingTarget, Qt as buildPluginHealthReport, R as markAuthProfileFailure, Ri as unwrapKnownShellMultiplexerInvocation, Rr as isMarkdownCapableMessageChannel, Rt as normalizeAnyChannelId, S as OLLAMA_NATIVE_BASE_URL, Sa as normalizeResolvedSecretInputString, Si as isTrustedSafeBinPath, Sn as prepareConfiguredSessionStorageRuntimeActivation, Sr as listEnabledDiscordAccounts, T as buildAssistantMessageWithZeroUsage, Ta as DEFAULT_CONTEXT_TOKENS, Ti as validateSafeBinArgv, Tn as refreshConfiguredSessionBindingEntry, Tr as resolveChannelGroupPolicy, Tt as BUNDLED_ENABLED_BY_DEFAULT, U as loadConfig, Ui as applyMergePatch, Un as resolveSessionFilePathOptions, Ur as GATEWAY_CLIENT_IDS, Ut as getActivePluginRegistry, V as resolveApiKeyForProfile, Vi as normalizeSafeBinProfileFixtures, Vr as resolveGatewayMessageChannel, Vt as resolveChannelConfigId, W as readConfigFileSnapshot, Wi as isSafeExecutableValue, Wn as resolveSessionTranscriptPath, Wr as GATEWAY_CLIENT_MODES, Wt as getActivePluginRegistryKey, Xi as describeUnknownError$1, Xn as getChannelDock, Xr as readTaskWorkStates, Xt as createPluginRegistry, Y as isInboundPathAllowed, Yi as resolveSecretRefValues, Yn as resolveParentSessionGroupId, Yr as CtxProjectionCorruptionError, Yt as clearRegisteredPluginApis, Z as resolveIMessageAttachmentRoots, Zi as isNonEmptyString, Zn as listChannelDocks, Zt as normalizePluginHttpPath, _a as resolveAuthProfileDisplayLabel, _i as getConfigValueAtPath, _n as commitPreparedConfiguredSessionStorageRuntimeActivation, _r as resolveWhatsAppAccount, _t as isAvatarDataUrl, a as isCliProvider, aa as resolveShellEnvFallbackTimeoutMs, ai as applyTargetToParams, an as getRegisteredSpeechProviders, ar as normalizeHyphenSlug, ba as coerceSecretRef, bi as unsetConfigValueAtPath, bn as loadSessionStore, br as resolveIMessageAccount, bt as isSupportedLocalAvatarExtension, c as normalizeProviderId, ca as dedupeProfileIds, cn as replaceSpeechProviders, cr as resolveSlackAccount, d as resolveDefaultModelForAgent, da as ensureAuthProfileStore, di as replaceBufferedPluginTaskPasses, dn as createConversationReadQuery, dr as resolveSlackBotToken, ea as secretRefKey, en as executePluginCommand, er as listChannelPlugins, et as parseNonNegativeByteSize, f as resolveModelRefFromString, fa as resolveAuthStorePathForDisplay, fi as RecoveryAdmissionError, fn as getConversationReadQuery, fr as listEnabledSignalAccounts, ga as readProcessElapsedSeconds, gi as unsetConfigOverride, gn as closeReplacedConfiguredSessionStorageRuntime, gr as hasAnyWhatsAppAuth, gt as AVATAR_MAX_BYTES, h as resolveThinkingDefault, ha as isPidAlive, hi as setConfigOverride, hn as closeConfiguredSessionStorageRuntime, hr as normalizeWhatsAppTarget, i as findNormalizedProviderValue, ia as getShellPathFromLoginShell, ii as stringEnum, in as BUILTIN_TTS_PROVIDER_IDS, ir as normalizeAtHashSlug, ji as matchAllowlist, jn as mergeSessionEntry, jr as mergeDeliveryContext, jt as discoverOpenClawPlugins, k as getCustomProviderApiKey, ki as splitCommandChain, kr as deliveryContextFromSession, kt as resolveEffectiveEnableState, l as parseModelRef, la as listProfilesForProvider, li as discardBufferedPluginTaskPasses, ln as normalizeProviderId$1, lr as resolveSlackReplyToMode, m as resolveSubagentSpawnModelSelection, ma as withFileLock$1, mi as resetConfigOverrides, mn as requireSessionStorageRuntime, mr as isWhatsAppGroupJid, n as buildConfiguredAllowlistKeys, na as DEFAULT_SUBAGENT_MAX_SPAWN_DEPTH, ni as channelTargetsSchema, nn as matchPluginCommand, nr as formatAllowlistMatchMeta, nt as resolveExecPolicyPreset, o as modelKey, oa as isTruthyEnvValue, oi as actionHasTarget, on as getSpeechProvider, or as normalizeStringEntries, p as resolveReasoningDefault, pa as resolveOpenClawAgentDir, pi as getConfigOverrides, pr as resolveSignalAccount, q as validateConfigObjectWithPlugins, qi as resolveSlackNativeStreaming, qn as deriveSessionMetaPatch, qr as acquireSessionWriteLock, qt as setActivePluginRegistry, r as buildModelAliasIndex, ra as VERSION, ri as optionalStringEnum, rn as registerPluginCommand, rr as resolveAllowlistMatchByCandidates, s as normalizeModelRef$2, sa as resolveOwnerDisplaySetting, si as actionRequiresTarget, sn as isBuiltinTtsProvider, sr as normalizeStringEntriesLower, t as buildAllowedModelSet, ta as runTasksWithConcurrency, ti as channelTargetSchema, tn as listPluginCommands, tr as normalizeChannelId$1, tt as ASSISTANT_IDENTITY_COLORS, u as resolveConfiguredModelRef, ua as markAuthProfileGood, ui as listBufferedPluginTaskPasses, un as StorageReadAccessError, ur as resolveSlackAppToken, vi as parseConfigPath, vn as getConfiguredSessionStorageRuntime, vr as formatCliCommand, vt as isAvatarHttpUrl, w as buildAssistantMessage, wa as splitTrailingAuthProfile, wi as normalizeTrustedSafeBinDirs, wn as recordSessionMetaFromInbound, wr as normalizeDiscordToken, wt as loadPluginManifestRegistry, x as retryAsync, xa as hasConfiguredSecretInput, xi as getTrustedSafeBinDirs, xn as loadSessionStoreFromDisk, xr as createDiscordActionGate, xt as buildChannelAccountBindings, ya as normalizeSecretInput, yi as setConfigValueAtPath, yr as resolveCliName, yt as isPathWithinRoot, z as markAuthProfileUsed, zi as splitShellArgs, zn as SAFE_SESSION_ID_RE, zr as listDeliverableMessageChannels, zt as normalizeChannelId$2 } from "./model-selection-B7FYf8Fo.js";
|
|
8
|
+
import { a as saveJsonFile, i as loadJsonFile, r as resolveCopilotApiToken } from "./github-copilot-token-BJeEWDJb.js";
|
|
9
|
+
import { n as createInternalHookEvent, o as triggerInternalHook, s as parseBooleanValue$1, t as readManifestNamespace } from "./legacy-names-D7ywm6_7.js";
|
|
10
10
|
import { n as resolveConversationLabel, r as normalizeChatType } from "./conversation-label-Ckfze_uK.js";
|
|
11
|
-
import { a as createSlackWebClient, c as validateSlackBlocksArray, d as resolveSlackChannelId, i as normalizeSlackOutboundText, l as buildSlackBlocksFallbackText, o as resolveSlackWebClientOptions, s as parseSlackBlocksInput, t as sendMessageSlack, u as parseSlackTarget } from "./send-
|
|
12
|
-
import { $ as setChannelPermissionDiscord, A as readMessagesDiscord, At as buildChannelKeyCandidates, B as kickMemberDiscord, C as createThreadDiscord, Ct as shouldEmitDiscordReactionNotification, D as listPinsDiscord, Dt as resolveTimestampMs, E as fetchMessageDiscord, Et as resolveDiscordSystemLocation, F as createScheduledEventDiscord, G as listGuildEmojisDiscord, H as listScheduledEventsDiscord, I as fetchChannelInfoDiscord, J as createChannelDiscord, K as uploadEmojiDiscord, L as fetchMemberInfoDiscord, M as unpinMessageDiscord, Mt as resolveChannelEntryMatchWithFallback, N as addRoleDiscord, O as listThreadsDiscord, Ot as fetchDiscord, P as banMemberDiscord, Q as removeChannelPermissionDiscord, R as fetchRoleInfoDiscord, S as recordChannelActivity, St as resolveGroupDmAllow, T as editMessageDiscord, Tt as formatDiscordUserTag, U as removeRoleDiscord, V as listGuildChannelsDiscord, W as timeoutMemberDiscord, X as editChannelDiscord, Y as deleteChannelDiscord, Z as moveChannelDiscord, _ as sendPollDiscord, _t as resolveDiscordGuildEntry, a as removeReactionDiscord, at as createDiscordClient, b as sendWebhookMessageDiscord, bt as resolveDiscordOwnerAllowFrom, c as formatDiscordComponentEventText, ct as parseDiscordTarget, d as parseDiscordModalCustomId, dt as listDiscordDirectoryPeersLive, et as stripUndefinedFields, f as parseDiscordModalCustomIdForCarbon, ft as isDiscordGroupAllowedByPolicy, g as sendMessageDiscord, gt as resolveDiscordChannelConfigWithFallback, h as resolveDiscordModalEntry, ht as resolveDiscordAllowListMatch, i as removeOwnReactionsDiscord, it as normalizePollInput, j as searchMessagesDiscord, jt as normalizeChannelSlug, k as pinMessageDiscord, kt as applyChannelMatchMeta, l as parseDiscordComponentCustomId, lt as resolveDiscordChannelId, m as resolveDiscordComponentEntry, mt as normalizeDiscordSlug, n as fetchReactionsDiscord, nt as hasAnyGuildPermissionDiscord, o as sendDiscordComponentMessage, ot as createDiscordRestClient, p as readDiscordComponentSpec, pt as normalizeDiscordAllowList, q as uploadStickerDiscord, r as reactMessageDiscord, rt as chunkDiscordTextWithMode, s as createDiscordFormModal, st as createDiscordRetryRunner, tt as fetchChannelPermissionsDiscord, u as parseDiscordComponentCustomIdForCarbon, ut as listDiscordDirectoryGroupsLive, v as sendStickerDiscord, vt as resolveDiscordMemberAccessState, w as deleteMessageDiscord, wt as formatDiscordReactionEmoji, x as getChannelActivity, xt as resolveDiscordShouldRequireMention, y as sendVoiceMessageDiscord, yt as resolveDiscordOwnerAccess, z as fetchVoiceStatusDiscord } from "./send-
|
|
13
|
-
import { a as stripSilentToken, i as isSilentReplyText, n as SILENT_REPLY_TOKEN, r as isSilentReplyPrefixText, t as HEARTBEAT_TOKEN } from "./tokens-
|
|
14
|
-
import { $ as stripMessageCarriers, A as resolveChannelResetConfig, At as INPUT_PROVENANCE_KIND_VALUES, B as openDbSessionManager, Bt as resolveProviderPromptCacheKey, C as deriveSessionTotalTokens, Ct as openRawToolResultStash, D as SESSION_RUN_STATUSES, Dt as stripToolResultDetails, E as normalizeUsage, Et as sanitizeToolUseResultPairing, F as resolveAgentMainSessionKey, Ft as initializeGlobalHookRunner, G as sha256, H as drainPendingPrimaryWrites, Ht as createCurrentUserPromptEnvelope, I as resolveExplicitAgentSessionKey, It as hasHookForPlugin, J as renderInboundUserContext, K as buildInboundMetaSystemPrompt, L as resolveMainSessionKey, Lt as promptBuildResultToContribution, M as resolveSessionResetType, Mt as normalizeInputProvenance, N as resolveThreadFlag, Nt as getGlobalHookRunner, O as resolveSessionKey, Ot as canonicalToolCallIdBase, P as canonicalizeMainSessionAlias, Pt as getGlobalPluginRegistry, Q as messageTime, R as isPrimarySessionTranscriptFileName, Rt as buildPluginRuntimeIdentity, S as derivePromptTokens, St as guardSessionManager, T as makeZeroUsageSnapshot, Tt as sanitizeToolCallInputs, U as extractLegacyTranscriptEntryFields, Ut as mergePromptContributions, V as runSerializedBySession, Vt as resolveProviderRuntimeIdentity, W as sanitizeJsonb, Wt as toJsonValue$1, X as getMessageIngress, Y as attachMessageIngress, Z as isRepresentableEpochMs, _ as inferLegacyName, _t as createMessageCharEstimateCache, a as resolveMirroredTranscriptText, at as eventOrder, b as resolveDefaultCronStaggerMs, bt as getToolResultText$1, c as createSessionStorageRuntimeFromConfig, ct as capToolResultContent, d as TASK_RUN_MODES, dt as PREEMPTIVE_TOOL_RESULT_COMPACTION_PLACEHOLDER, et as formatMessageStamp, f as TASK_RUN_STATUSES, ft as TOOL_RESULT_TEXT_WEIGHT, g as CREATE_CTX_STORAGE_OWNER_SQL, gt as TOOL_RESULT_CHARS_PER_TOKEN_ESTIMATE, h as sanitizeAppendEntry, ht as CHARS_PER_TOKEN_ESTIMATE$2, i as appendAssistantMessageToSessionTranscript, it as DB_SESSION_HYDRATION_LIMIT, j as resolveSessionResetPolicy, jt as hasInterSessionUserProvenance, k as evaluateSessionFreshness, kt as sanitizeToolCallIdsForCloudCodeAssist, l as resolveSessionStorageConfig, lt as HARD_MAX_TOOL_RESULT_CHARS, m as deriveLegacyActorIdentity, mt as truncateToolResultToChars, n as parseSessionThreadInfo, nt as resolveTimezone, o as parseInlineDirectives$1, ot as pickLeaf, p as buildEqualityProjection, pt as truncateTextHeadTail, q as collectInboundUserContext, r as resolveAndPersistSessionFile, rt as resolveSenderLabel, s as attachPgPoolErrorListeners, st as HIDDEN_HEARTBEAT_CUSTOM_TYPE, t as extractDeliveryInfo, tt as formatZonedTimestamp, u as validateCtxStorage, ut as sessionLikelyHasOversizedToolResults, v as normalizeHttpWebhookUrl, vt as estimateContextChars$1, w as hasNonzeroUsage, wt as repairToolUseResultPairing, x as parseAbsoluteTimeMs, xt as isToolResultMessage, y as normalizeCronStaggerMs, yt as estimateMessageCharsCached, z as isSessionArchiveArtifactName, zt as buildPluginTurnIdentity } from "./sessions-
|
|
11
|
+
import { a as createSlackWebClient, c as validateSlackBlocksArray, d as resolveSlackChannelId, i as normalizeSlackOutboundText, l as buildSlackBlocksFallbackText, o as resolveSlackWebClientOptions, s as parseSlackBlocksInput, t as sendMessageSlack, u as parseSlackTarget } from "./send-bmlVFiBl.js";
|
|
12
|
+
import { $ as setChannelPermissionDiscord, A as readMessagesDiscord, At as buildChannelKeyCandidates, B as kickMemberDiscord, C as createThreadDiscord, Ct as shouldEmitDiscordReactionNotification, D as listPinsDiscord, Dt as resolveTimestampMs, E as fetchMessageDiscord, Et as resolveDiscordSystemLocation, F as createScheduledEventDiscord, G as listGuildEmojisDiscord, H as listScheduledEventsDiscord, I as fetchChannelInfoDiscord, J as createChannelDiscord, K as uploadEmojiDiscord, L as fetchMemberInfoDiscord, M as unpinMessageDiscord, Mt as resolveChannelEntryMatchWithFallback, N as addRoleDiscord, O as listThreadsDiscord, Ot as fetchDiscord, P as banMemberDiscord, Q as removeChannelPermissionDiscord, R as fetchRoleInfoDiscord, S as recordChannelActivity, St as resolveGroupDmAllow, T as editMessageDiscord, Tt as formatDiscordUserTag, U as removeRoleDiscord, V as listGuildChannelsDiscord, W as timeoutMemberDiscord, X as editChannelDiscord, Y as deleteChannelDiscord, Z as moveChannelDiscord, _ as sendPollDiscord, _t as resolveDiscordGuildEntry, a as removeReactionDiscord, at as createDiscordClient, b as sendWebhookMessageDiscord, bt as resolveDiscordOwnerAllowFrom, c as formatDiscordComponentEventText, ct as parseDiscordTarget, d as parseDiscordModalCustomId, dt as listDiscordDirectoryPeersLive, et as stripUndefinedFields, f as parseDiscordModalCustomIdForCarbon, ft as isDiscordGroupAllowedByPolicy, g as sendMessageDiscord, gt as resolveDiscordChannelConfigWithFallback, h as resolveDiscordModalEntry, ht as resolveDiscordAllowListMatch, i as removeOwnReactionsDiscord, it as normalizePollInput, j as searchMessagesDiscord, jt as normalizeChannelSlug, k as pinMessageDiscord, kt as applyChannelMatchMeta, l as parseDiscordComponentCustomId, lt as resolveDiscordChannelId, m as resolveDiscordComponentEntry, mt as normalizeDiscordSlug, n as fetchReactionsDiscord, nt as hasAnyGuildPermissionDiscord, o as sendDiscordComponentMessage, ot as createDiscordRestClient, p as readDiscordComponentSpec, pt as normalizeDiscordAllowList, q as uploadStickerDiscord, r as reactMessageDiscord, rt as chunkDiscordTextWithMode, s as createDiscordFormModal, st as createDiscordRetryRunner, tt as fetchChannelPermissionsDiscord, u as parseDiscordComponentCustomIdForCarbon, ut as listDiscordDirectoryGroupsLive, v as sendStickerDiscord, vt as resolveDiscordMemberAccessState, w as deleteMessageDiscord, wt as formatDiscordReactionEmoji, x as getChannelActivity, xt as resolveDiscordShouldRequireMention, y as sendVoiceMessageDiscord, yt as resolveDiscordOwnerAccess, z as fetchVoiceStatusDiscord } from "./send-4WdiWuFu.js";
|
|
13
|
+
import { a as stripSilentToken, i as isSilentReplyText, n as SILENT_REPLY_TOKEN, r as isSilentReplyPrefixText, t as HEARTBEAT_TOKEN } from "./tokens-C2ll8wSq.js";
|
|
14
|
+
import { $ as stripMessageCarriers, A as resolveChannelResetConfig, At as INPUT_PROVENANCE_KIND_VALUES, B as openDbSessionManager, Bt as resolveProviderPromptCacheKey, C as deriveSessionTotalTokens, Ct as openRawToolResultStash, D as SESSION_RUN_STATUSES, Dt as stripToolResultDetails, E as normalizeUsage, Et as sanitizeToolUseResultPairing, F as resolveAgentMainSessionKey, Ft as initializeGlobalHookRunner, G as sha256, H as drainPendingPrimaryWrites, Ht as createCurrentUserPromptEnvelope, I as resolveExplicitAgentSessionKey, It as hasHookForPlugin, J as renderInboundUserContext, K as buildInboundMetaSystemPrompt, L as resolveMainSessionKey, Lt as promptBuildResultToContribution, M as resolveSessionResetType, Mt as normalizeInputProvenance, N as resolveThreadFlag, Nt as getGlobalHookRunner, O as resolveSessionKey, Ot as canonicalToolCallIdBase, P as canonicalizeMainSessionAlias, Pt as getGlobalPluginRegistry, Q as messageTime, R as isPrimarySessionTranscriptFileName, Rt as buildPluginRuntimeIdentity, S as derivePromptTokens, St as guardSessionManager, T as makeZeroUsageSnapshot, Tt as sanitizeToolCallInputs, U as extractLegacyTranscriptEntryFields, Ut as mergePromptContributions, V as runSerializedBySession, Vt as resolveProviderRuntimeIdentity, W as sanitizeJsonb, Wt as toJsonValue$1, X as getMessageIngress, Y as attachMessageIngress, Z as isRepresentableEpochMs, _ as inferLegacyName, _t as createMessageCharEstimateCache, a as resolveMirroredTranscriptText, at as eventOrder, b as resolveDefaultCronStaggerMs, bt as getToolResultText$1, c as createSessionStorageRuntimeFromConfig, ct as capToolResultContent, d as TASK_RUN_MODES, dt as PREEMPTIVE_TOOL_RESULT_COMPACTION_PLACEHOLDER, et as formatMessageStamp, f as TASK_RUN_STATUSES, ft as TOOL_RESULT_TEXT_WEIGHT, g as CREATE_CTX_STORAGE_OWNER_SQL, gt as TOOL_RESULT_CHARS_PER_TOKEN_ESTIMATE, h as sanitizeAppendEntry, ht as CHARS_PER_TOKEN_ESTIMATE$2, i as appendAssistantMessageToSessionTranscript, it as DB_SESSION_HYDRATION_LIMIT, j as resolveSessionResetPolicy, jt as hasInterSessionUserProvenance, k as evaluateSessionFreshness, kt as sanitizeToolCallIdsForCloudCodeAssist, l as resolveSessionStorageConfig, lt as HARD_MAX_TOOL_RESULT_CHARS, m as deriveLegacyActorIdentity, mt as truncateToolResultToChars, n as parseSessionThreadInfo, nt as resolveTimezone, o as parseInlineDirectives$1, ot as pickLeaf, p as buildEqualityProjection, pt as truncateTextHeadTail, q as collectInboundUserContext, r as resolveAndPersistSessionFile, rt as resolveSenderLabel, s as attachPgPoolErrorListeners, st as HIDDEN_HEARTBEAT_CUSTOM_TYPE, t as extractDeliveryInfo, tt as formatZonedTimestamp, u as validateCtxStorage, ut as sessionLikelyHasOversizedToolResults, v as normalizeHttpWebhookUrl, vt as estimateContextChars$1, w as hasNonzeroUsage, wt as repairToolUseResultPairing, x as parseAbsoluteTimeMs, xt as isToolResultMessage, y as normalizeCronStaggerMs, yt as estimateMessageCharsCached, z as isSessionArchiveArtifactName, zt as buildPluginTurnIdentity } from "./sessions-BjSGNjb0.js";
|
|
15
15
|
import { n as isDiagnosticsEnabled, t as emitDiagnosticEvent } from "./diagnostic-events-BTSwhIfk.js";
|
|
16
16
|
import { n as onSessionTranscriptUpdate } from "./transcript-events-C2lcxc6-.js";
|
|
17
17
|
import { n as generateSecureUuid, t as generateSecureToken } from "./secure-random-BDA1WAvZ.js";
|
|
18
|
-
import { _ as recordSystemPromptHashComparison, b as recordCommandPoll, c as logModelCallCompleted, d as logRunCompleted, f as logRunStarted, g as logToolExecutionStarted, h as logToolExecutionCompleted, l as logModelCallError, m as logToolExecutionBlocked, o as logMessageProcessed, p as logSessionStateChange, s as logMessageQueued, t as diag, u as logModelCallStarted, v as refreshRunProgress, x as resetCommandPollCount, y as boundDiagnosticContent } from "./diagnostic-
|
|
18
|
+
import { _ as recordSystemPromptHashComparison, b as recordCommandPoll, c as logModelCallCompleted, d as logRunCompleted, f as logRunStarted, g as logToolExecutionStarted, h as logToolExecutionCompleted, l as logModelCallError, m as logToolExecutionBlocked, o as logMessageProcessed, p as logSessionStateChange, s as logMessageQueued, t as diag, u as logModelCallStarted, v as refreshRunProgress, x as resetCommandPollCount, y as boundDiagnosticContent } from "./diagnostic-BSnQ1U_E.js";
|
|
19
19
|
import { o as redactChannelCorrelation, r as getDiagnosticSessionState } from "./diagnostic-session-state-DJQj3Ka7.js";
|
|
20
20
|
import { t as redactIdentifier } from "./redact-identifier-C_VCQ34e.js";
|
|
21
|
-
import { i as testRegexWithBoundedInput, r as compileSafeRegex, t as redactSensitiveText } from "./redact-
|
|
21
|
+
import { i as testRegexWithBoundedInput, r as compileSafeRegex, t as redactSensitiveText } from "./redact-CysJDryP.js";
|
|
22
22
|
import { t as CommandLane } from "./lanes-DBBnME5O.js";
|
|
23
|
-
import { a as getCommandLaneSnapshots, c as isQueuedCommandCancellation, i as enqueueCommandInLane, n as clearCommandLane, o as getQueueSize, s as isGatewayDraining, t as CommandLaneAbortedError } from "./command-queue-
|
|
24
|
-
import { S as mediaKindFromMime, _ as isAudioFileName, a as getDefaultMediaLocalRoots, b as MAX_IMAGE_BYTES, f as resizeToJpeg, g as imageMimeFromFormat, h as getFileExtension, i as getAgentScopedMediaLocalRoots, l as getImageMetadata, m as extensionForMime, n as fetchRemoteMedia, p as detectMime, r as readResponseWithLimit, v as kindFromMime, y as normalizeMimeType$1 } from "./fetch-
|
|
25
|
-
import { n as discoverModels, t as discoverAuthStorage } from "./pi-model-discovery-
|
|
26
|
-
import { $ as applyOwnerOnlyToolPolicy, A as isFailoverErrorMessage, B as ensureSandboxWorkspaceForSession, C as getApiErrorPayloadFingerprint, D as isCompactionFailureError, E as isCloudCodeAssistFormatError, F as parseImageDimensionError, G as resolveBrowserConfig, H as resolveSandboxRuntimeStatus, I as parseImageSizeError, J as ensureBrowserControlAuth, K as resolveProfile, L as sanitizeUserFacingText, M as isRateLimitAssistantError, N as isRawApiErrorPayload, O as isContextOverflowError, P as isTransientHttpError, Q as resolveSandboxConfigForAgent, R as isAuthPermanentErrorMessage, S as formatRawAssistantErrorForUi, T as isBillingAssistantError, U as createBrowserRouteContext, V as resolveSandboxContext, W as registerBrowserRoutes, X as resolveGatewayCredentialsFromConfig, Y as resolveBrowserControlAuth, Z as trimToUndefined$1, _ as isGoogleModelApi, a as pickFallbackThinkingLevel, at as expandToolGroups, b as formatAssistantErrorText, c as normalizeTextForComparison, ct as listCoreToolIds, d as sanitizeToolResultImages, dt as buildBootstrapContextFiles, et as buildPluginToolGroups, f as resolveImageSanitizationLimits, ft as resolveBootstrapMaxChars, g as downgradeOpenAIReasoningBlocks, h as downgradeOpenAIFunctionCallReasoningPairs, i as validateGeminiTurns, it as stripPluginOnlyAllowlist, j as isLikelyContextOverflowError, k as isFailoverAssistantError, l as sanitizeSessionMessagesImages, lt as compileGlobPatterns, m as estimateBase64DecodedBytes, mt as sanitizeGoogleTurnOrdering, n as ensureOpenClawModelsJson, nt as expandPolicyWithPluginGroups, ot as normalizeToolName, p as canonicalizeBase64, pt as resolveBootstrapTotalMaxChars, q as getBridgeAuthForPort, r as validateAnthropicTurns, rt as mergeAlsoAllowPolicy, s as isMessagingToolDuplicateNormalized, st as resolveToolProfilePolicy, t as extractTextFromChatContent, tt as collectExplicitAllowlist, u as sanitizeImageBlocks, ut as matchesAnyGlobPattern, v as BILLING_ERROR_USER_MESSAGE, w as isAuthAssistantError, x as formatBillingErrorMessage, y as classifyFailoverReason, z as isTimeoutErrorMessage } from "./chat-content-
|
|
27
|
-
import { A as rawDataToString, B as isSecureWebSocketUrl, C as ensureChromeExtensionRelayServer, N as DEFAULT_UPLOAD_DIR, P as resolveExistingPathsWithinRoot, U as DEFAULT_AI_SNAPSHOT_MAX_CHARS, s as resolveLsofCommandSync, z as isLoopbackHost } from "./chrome-
|
|
28
|
-
import { _ as applySkillEnvOverridesFromSnapshot, a as buildWorkspaceSkillSnapshot, c as skillsSnapshotSourceDiffers, d as assertMediaNotDataUrl, f as assertSandboxPath, g as applySkillEnvOverrides, h as resolveSandboxedMediaSource, n as readJsonFile$1, o as loadWorkspaceSkillEntries, p as resolveSandboxInputPath, r as writeJsonAtomic, s as resolveSkillsPromptForRun, t as createAsyncLock } from "./json-files-
|
|
29
|
-
import { t as PATH_ALIAS_POLICIES } from "./path-alias-guards-
|
|
30
|
-
import { i as hasErrnoCode, o as readErrorName, r as formatErrorMessage } from "./errors-
|
|
31
|
-
import { a as readFileWithinRoot, c as writeFileWithinRoot, i as openFileWithinRoot, n as copyFileWithinRoot, r as createRootScopedReadFile, t as SafeOpenError } from "./fs-safe-
|
|
32
|
-
import { a as isBlockedHostnameOrIp, l as normalizeHostname, n as SsrFBlockedError } from "./proxy-env-
|
|
33
|
-
import { i as saveMediaBuffer, r as getMediaDir, t as MEDIA_MAX_BYTES } from "./store-
|
|
34
|
-
import { a as bindAbortRelay, n as withStrictGuardedFetchMode, o as fetchWithTimeout, r as withTrustedEnvProxyGuardedFetchMode, s as resolveNetworkSsrFPolicy, t as fetchWithSsrFGuard } from "./fetch-guard-
|
|
23
|
+
import { a as getCommandLaneSnapshots, c as isQueuedCommandCancellation, i as enqueueCommandInLane, n as clearCommandLane, o as getQueueSize, s as isGatewayDraining, t as CommandLaneAbortedError } from "./command-queue-CRm1AADE.js";
|
|
24
|
+
import { S as mediaKindFromMime, _ as isAudioFileName, a as getDefaultMediaLocalRoots, b as MAX_IMAGE_BYTES, f as resizeToJpeg, g as imageMimeFromFormat, h as getFileExtension, i as getAgentScopedMediaLocalRoots, l as getImageMetadata, m as extensionForMime, n as fetchRemoteMedia, p as detectMime, r as readResponseWithLimit, v as kindFromMime, y as normalizeMimeType$1 } from "./fetch-BBi5dEoV.js";
|
|
25
|
+
import { n as discoverModels, t as discoverAuthStorage } from "./pi-model-discovery-CusLASy5.js";
|
|
26
|
+
import { $ as applyOwnerOnlyToolPolicy, A as isFailoverErrorMessage, B as ensureSandboxWorkspaceForSession, C as getApiErrorPayloadFingerprint, D as isCompactionFailureError, E as isCloudCodeAssistFormatError, F as parseImageDimensionError, G as resolveBrowserConfig, H as resolveSandboxRuntimeStatus, I as parseImageSizeError, J as ensureBrowserControlAuth, K as resolveProfile, L as sanitizeUserFacingText, M as isRateLimitAssistantError, N as isRawApiErrorPayload, O as isContextOverflowError, P as isTransientHttpError, Q as resolveSandboxConfigForAgent, R as isAuthPermanentErrorMessage, S as formatRawAssistantErrorForUi, T as isBillingAssistantError, U as createBrowserRouteContext, V as resolveSandboxContext, W as registerBrowserRoutes, X as resolveGatewayCredentialsFromConfig, Y as resolveBrowserControlAuth, Z as trimToUndefined$1, _ as isGoogleModelApi, a as pickFallbackThinkingLevel, at as expandToolGroups, b as formatAssistantErrorText, c as normalizeTextForComparison, ct as listCoreToolIds, d as sanitizeToolResultImages, dt as buildBootstrapContextFiles, et as buildPluginToolGroups, f as resolveImageSanitizationLimits, ft as resolveBootstrapMaxChars, g as downgradeOpenAIReasoningBlocks, h as downgradeOpenAIFunctionCallReasoningPairs, i as validateGeminiTurns, it as stripPluginOnlyAllowlist, j as isLikelyContextOverflowError, k as isFailoverAssistantError, l as sanitizeSessionMessagesImages, lt as compileGlobPatterns, m as estimateBase64DecodedBytes, mt as sanitizeGoogleTurnOrdering, n as ensureOpenClawModelsJson, nt as expandPolicyWithPluginGroups, ot as normalizeToolName, p as canonicalizeBase64, pt as resolveBootstrapTotalMaxChars, q as getBridgeAuthForPort, r as validateAnthropicTurns, rt as mergeAlsoAllowPolicy, s as isMessagingToolDuplicateNormalized, st as resolveToolProfilePolicy, t as extractTextFromChatContent, tt as collectExplicitAllowlist, u as sanitizeImageBlocks, ut as matchesAnyGlobPattern, v as BILLING_ERROR_USER_MESSAGE, w as isAuthAssistantError, x as formatBillingErrorMessage, y as classifyFailoverReason, z as isTimeoutErrorMessage } from "./chat-content-B2kNxQ3a.js";
|
|
27
|
+
import { A as rawDataToString, B as isSecureWebSocketUrl, C as ensureChromeExtensionRelayServer, N as DEFAULT_UPLOAD_DIR, P as resolveExistingPathsWithinRoot, U as DEFAULT_AI_SNAPSHOT_MAX_CHARS, s as resolveLsofCommandSync, z as isLoopbackHost } from "./chrome-DgDNUC2A.js";
|
|
28
|
+
import { _ as applySkillEnvOverridesFromSnapshot, a as buildWorkspaceSkillSnapshot, c as skillsSnapshotSourceDiffers, d as assertMediaNotDataUrl, f as assertSandboxPath, g as applySkillEnvOverrides, h as resolveSandboxedMediaSource, n as readJsonFile$1, o as loadWorkspaceSkillEntries, p as resolveSandboxInputPath, r as writeJsonAtomic, s as resolveSkillsPromptForRun, t as createAsyncLock } from "./json-files-CurKd8gy.js";
|
|
29
|
+
import { t as PATH_ALIAS_POLICIES } from "./path-alias-guards-nWrE5acE.js";
|
|
30
|
+
import { i as hasErrnoCode, o as readErrorName, r as formatErrorMessage } from "./errors-CgPgYfWg.js";
|
|
31
|
+
import { a as readFileWithinRoot, c as writeFileWithinRoot, i as openFileWithinRoot, n as copyFileWithinRoot, r as createRootScopedReadFile, t as SafeOpenError } from "./fs-safe-CRbowDkj.js";
|
|
32
|
+
import { a as isBlockedHostnameOrIp, l as normalizeHostname, n as SsrFBlockedError } from "./proxy-env-DrmTb0QW.js";
|
|
33
|
+
import { i as saveMediaBuffer, r as getMediaDir, t as MEDIA_MAX_BYTES } from "./store-DniD8E6a.js";
|
|
34
|
+
import { a as bindAbortRelay, n as withStrictGuardedFetchMode, o as fetchWithTimeout, r as withTrustedEnvProxyGuardedFetchMode, s as resolveNetworkSsrFPolicy, t as fetchWithSsrFGuard } from "./fetch-guard-BcLYPGi1.js";
|
|
35
35
|
import { a as normalizeReasoningLevel, c as normalizeVerboseLevel, i as normalizeElevatedLevel, l as resolveResponseUsageMode, n as formatXHighModelHint, o as normalizeThinkLevel, s as normalizeUsageDisplay, t as formatThinkingLevels, u as supportsXHighThinking } from "./thinking-CwmtMy_H.js";
|
|
36
|
-
import { A as formatReasoningMessage, B as findModelInCatalog, C as coerceImageModelConfig, D as extractAssistantThinking, E as extractAssistantText$1, F as stripMinimaxToolCallXml, H as modelSupportsVision, I as stripThinkingTagsFromText, L as formatToolSummary, M as isAssistantMessage, N as promoteThinkingTagsToBlocks, O as extractThinkingFromTaggedStream, P as stripDowngradedToolCallText, R as resolveToolDisplay, S as coerceImageAssistantText, T as resolveProviderVisionModelFromConfig, V as loadModelCatalog, _ as stripCarriedTranscriptFromBody, a as resolveMediaAttachmentLocalRoots, c as applyTemplate, d as normalizeMediaUnderstandingChatType, f as resolveMediaUnderstandingScope, i as normalizeMediaAttachments, j as inferToolMetaFromArgs, k as extractThinkingFromTaggedText, l as resolveConcurrency, n as buildProviderRegistry, o as runCapability, p as CLI_OUTPUT_MAX_BUFFER, r as createMediaAttachmentCache, s as minimaxUnderstandImage, t as runAudioTranscription, u as resolveTimeoutMs$2, v as buildRandomTempFilePath, w as decodeDataUrl, x as resolveAttachmentKind, y as registerUnhandledRejectionHandler, z as stripReasoningTagsFromText } from "./audio-transcription-runner-
|
|
37
|
-
import { a as resolveAgentIdentity, i as resolveAckReaction, o as resolveEffectiveMessagesConfig, r as resolveResponsePrefixTemplate, s as resolveHumanDelayConfig, t as createReplyPrefixOptions } from "./reply-prefix-
|
|
38
|
-
import { a as chunkText, c as resolveChunkDelivery, d as resolveTextChunkLimit, f as findFenceSpanAt, i as chunkMarkdownTextWithMode, l as resolveChunkMode, m as parseFenceSpans, o as chunkTextWithMode, p as isSafeFenceBreak, r as chunkMarkdownText, t as chunkByNewline, u as resolveChunkNewlinePacking } from "./chunk-
|
|
39
|
-
import { n as resolveMarkdownTableMode } from "./markdown-tables-
|
|
40
|
-
import { a as loadWebMedia, i as getDefaultLocalRoots, o as loadWebMediaRaw } from "./ir-
|
|
41
|
-
import { _ as isRestartEnabled, a as listChatCommands, c as maybeResolveTextAlias, d as resolveCommandArgChoices, f as resolveCommandArgMenu, g as isNativeCommandsExplicitlyDisabled, h as isCommandFlagEnabled, i as isCommandEnabled, l as normalizeCommandBody, m as shouldHandleTextCommands, o as listChatCommandsForConfig, p as serializeCommandArgs, r as findCommandByNativeName, s as listNativeCommandSpecsForConfig, t as buildCommandTextFromArgs, u as parseCommandArgs, v as resolveNativeCommandsEnabled, y as resolveNativeSkillsEnabled } from "./commands-registry-
|
|
42
|
-
import { i as AGENT_LANE_SUBAGENT, r as AGENT_LANE_NESTED, t as startUserSessionRun } from "./user-run-recording-
|
|
43
|
-
import { a as getGatewayInstanceId, n as deriveSessionRunId, o as resolveSessionRunStore, r as inferSessionRunKind, t as createSessionRunRecorder } from "./recorder-
|
|
44
|
-
import { a as clearDelayedReleaseHold, c as mergeDelayedAgentTurn, d as WORKSPACE_LANE_DENIED_REASON, f as KeyedAsyncQueue, i as agentTurnIdempotencyKey, l as peekDelayedAgentTurn, n as getAgentTurnRuntime, o as enqueueAgentTurn, r as tryGetAgentTurnRuntime, s as isClaimableAgentTurnWorkId, u as setDelayedReleaseHold } from "./agent-turn-runner-
|
|
45
|
-
import { c as getSkillsSnapshotVersion, i as resolveSkillCommandInvocation, l as pruneExpiredPending, n as listSkillCommandsForAgents, o as getRemoteSkillEligibility, r as listSkillCommandsForWorkspace, s as ensureSkillsWatcher, t as listReservedChatSlashCommandNames, u as resolvePairingPaths } from "./skill-commands-
|
|
46
|
-
import { a as toInternalMessageReceivedContext, c as toPluginMessageReceivedEvent, d as resolveOutboundSessionId, i as toInternalMessagePreprocessedContext, l as fireAndForgetHook, n as createMessageSentEmitter, o as toInternalMessageTranscribedContext, r as deriveInboundMessageHookContext, s as toPluginMessageContext, t as applyMessageSendingHook, u as buildOutboundSessionContext } from "./outbound-message-hooks-
|
|
47
|
-
import { A as shouldSuppressMessagingToolReplies, C as readFullTranscriptEntriesFromBackend, D as filterMessagingToolDuplicates, E as applyReplyThreading, F as normalizeChannelTargetInput, I as normalizeTargetForProvider, M as createReplyToModeFilterForChannel, N as resolveReplyToMode, O as filterMessagingToolMediaDuplicates, P as buildTargetResolverSignature, T as applyReplyTagsToPayload, _ as stripLeadingInboundMetadata, a as normalizeOutboundPayloadsForJson, b as computeBackoff, c as loadCombinedSessionStoreForGateway, d as throwIfAborted, f as loadChannelOutboundAdapter, g as extractToolCallNames, h as countToolResults, i as normalizeOutboundPayloads, j as shouldSuppressReasoningPayload, k as isRenderablePayload, l as capArrayByJsonBytes, m as splitMediaFromOutput, o as normalizeReplyPayloadsForDelivery, p as parseReplyDirectives, r as formatOutboundPayloadLog, s as stampReplyActivity, t as deliverOutboundPayloads, u as jsonUtf8Bytes, v as lookupContextTokens, w as transcriptEntriesToMessages, x as sleepWithAbort, y as resolveContextTokensForModel } from "./deliver-
|
|
36
|
+
import { A as formatReasoningMessage, B as findModelInCatalog, C as coerceImageModelConfig, D as extractAssistantThinking, E as extractAssistantText$1, F as stripMinimaxToolCallXml, H as modelSupportsVision, I as stripThinkingTagsFromText, L as formatToolSummary, M as isAssistantMessage, N as promoteThinkingTagsToBlocks, O as extractThinkingFromTaggedStream, P as stripDowngradedToolCallText, R as resolveToolDisplay, S as coerceImageAssistantText, T as resolveProviderVisionModelFromConfig, V as loadModelCatalog, _ as stripCarriedTranscriptFromBody, a as resolveMediaAttachmentLocalRoots, c as applyTemplate, d as normalizeMediaUnderstandingChatType, f as resolveMediaUnderstandingScope, i as normalizeMediaAttachments, j as inferToolMetaFromArgs, k as extractThinkingFromTaggedText, l as resolveConcurrency, n as buildProviderRegistry, o as runCapability, p as CLI_OUTPUT_MAX_BUFFER, r as createMediaAttachmentCache, s as minimaxUnderstandImage, t as runAudioTranscription, u as resolveTimeoutMs$2, v as buildRandomTempFilePath, w as decodeDataUrl, x as resolveAttachmentKind, y as registerUnhandledRejectionHandler, z as stripReasoningTagsFromText } from "./audio-transcription-runner-DRUTJgZh.js";
|
|
37
|
+
import { a as resolveAgentIdentity, i as resolveAckReaction, o as resolveEffectiveMessagesConfig, r as resolveResponsePrefixTemplate, s as resolveHumanDelayConfig, t as createReplyPrefixOptions } from "./reply-prefix-C7r81KLS.js";
|
|
38
|
+
import { a as chunkText, c as resolveChunkDelivery, d as resolveTextChunkLimit, f as findFenceSpanAt, i as chunkMarkdownTextWithMode, l as resolveChunkMode, m as parseFenceSpans, o as chunkTextWithMode, p as isSafeFenceBreak, r as chunkMarkdownText, t as chunkByNewline, u as resolveChunkNewlinePacking } from "./chunk-BRJHaAd6.js";
|
|
39
|
+
import { n as resolveMarkdownTableMode } from "./markdown-tables-DfqPFbkZ.js";
|
|
40
|
+
import { a as loadWebMedia, i as getDefaultLocalRoots, o as loadWebMediaRaw } from "./ir-D___VWlp.js";
|
|
41
|
+
import { _ as isRestartEnabled, a as listChatCommands, c as maybeResolveTextAlias, d as resolveCommandArgChoices, f as resolveCommandArgMenu, g as isNativeCommandsExplicitlyDisabled, h as isCommandFlagEnabled, i as isCommandEnabled, l as normalizeCommandBody, m as shouldHandleTextCommands, o as listChatCommandsForConfig, p as serializeCommandArgs, r as findCommandByNativeName, s as listNativeCommandSpecsForConfig, t as buildCommandTextFromArgs, u as parseCommandArgs, v as resolveNativeCommandsEnabled, y as resolveNativeSkillsEnabled } from "./commands-registry-D3lOVOa7.js";
|
|
42
|
+
import { i as AGENT_LANE_SUBAGENT, r as AGENT_LANE_NESTED, t as startUserSessionRun } from "./user-run-recording-COpooN64.js";
|
|
43
|
+
import { a as getGatewayInstanceId, n as deriveSessionRunId, o as resolveSessionRunStore, r as inferSessionRunKind, t as createSessionRunRecorder } from "./recorder-B7dhxQ62.js";
|
|
44
|
+
import { a as clearDelayedReleaseHold, c as mergeDelayedAgentTurn, d as WORKSPACE_LANE_DENIED_REASON, f as KeyedAsyncQueue, i as agentTurnIdempotencyKey, l as peekDelayedAgentTurn, n as getAgentTurnRuntime, o as enqueueAgentTurn, r as tryGetAgentTurnRuntime, s as isClaimableAgentTurnWorkId, u as setDelayedReleaseHold } from "./agent-turn-runner-DKwd_tAc.js";
|
|
45
|
+
import { c as getSkillsSnapshotVersion, i as resolveSkillCommandInvocation, l as pruneExpiredPending, n as listSkillCommandsForAgents, o as getRemoteSkillEligibility, r as listSkillCommandsForWorkspace, s as ensureSkillsWatcher, t as listReservedChatSlashCommandNames, u as resolvePairingPaths } from "./skill-commands-CcrQquVr.js";
|
|
46
|
+
import { a as toInternalMessageReceivedContext, c as toPluginMessageReceivedEvent, d as resolveOutboundSessionId, i as toInternalMessagePreprocessedContext, l as fireAndForgetHook, n as createMessageSentEmitter, o as toInternalMessageTranscribedContext, r as deriveInboundMessageHookContext, s as toPluginMessageContext, t as applyMessageSendingHook, u as buildOutboundSessionContext } from "./outbound-message-hooks-Dl2zci3u.js";
|
|
47
|
+
import { A as shouldSuppressMessagingToolReplies, C as readFullTranscriptEntriesFromBackend, D as filterMessagingToolDuplicates, E as applyReplyThreading, F as normalizeChannelTargetInput, I as normalizeTargetForProvider, M as createReplyToModeFilterForChannel, N as resolveReplyToMode, O as filterMessagingToolMediaDuplicates, P as buildTargetResolverSignature, T as applyReplyTagsToPayload, _ as stripLeadingInboundMetadata, a as normalizeOutboundPayloadsForJson, b as computeBackoff, c as loadCombinedSessionStoreForGateway, d as throwIfAborted, f as loadChannelOutboundAdapter, g as extractToolCallNames, h as countToolResults, i as normalizeOutboundPayloads, j as shouldSuppressReasoningPayload, k as isRenderablePayload, l as capArrayByJsonBytes, m as splitMediaFromOutput, o as normalizeReplyPayloadsForDelivery, p as parseReplyDirectives, r as formatOutboundPayloadLog, s as stampReplyActivity, t as deliverOutboundPayloads, u as jsonUtf8Bytes, v as lookupContextTokens, w as transcriptEntriesToMessages, x as sleepWithAbort, y as resolveContextTokensForModel } from "./deliver-BoOCdGXY.js";
|
|
48
48
|
import { r as normalizeInboundTextNewlines, t as finalizeInboundContext } from "./inbound-context-C5qOxoGs.js";
|
|
49
|
-
import { n as wrapFetchWithAbortSignal, t as resolveFetch } from "./fetch-
|
|
50
|
-
import { t as convertMarkdownTables } from "./tables-
|
|
51
|
-
import { a as resolveSignalRpcContext, c as streamSignalEvents, n as sendReadReceiptSignal, o as signalCheck, r as sendTypingSignal, s as signalRpcRequest, t as sendMessageSignal } from "./send-
|
|
52
|
-
import { a as formatIMessageChatTarget, c as parseIMessageTarget, i as DEFAULT_IMESSAGE_PROBE_TIMEOUT_MS, o as isAllowedIMessageSender, r as createIMessageRpcClient, s as normalizeIMessageHandle, t as sendMessageIMessage } from "./send-
|
|
53
|
-
import { n as resolveAgentRoute, t as buildAgentSessionKey } from "./resolve-route-
|
|
54
|
-
import { t as recordInboundSessionMetaSafe } from "./session-meta-
|
|
55
|
-
import { a as createReplyReferencePlanner, i as resolveSlackThreadTs, n as deliverReplies$2, t as createSlackReplyDeliveryPlan } from "./replies-
|
|
56
|
-
import { n as resolveMemorySearchConfig } from "./manager-
|
|
57
|
-
import { m as normalizeExtraMemoryPaths, p as listMemoryFiles } from "./query-expansion-
|
|
58
|
-
import { t as isQmdScopeAllowed } from "./qmd-scope-
|
|
49
|
+
import { n as wrapFetchWithAbortSignal, t as resolveFetch } from "./fetch-BrwJHFZR.js";
|
|
50
|
+
import { t as convertMarkdownTables } from "./tables-BbmkAuhA.js";
|
|
51
|
+
import { a as resolveSignalRpcContext, c as streamSignalEvents, n as sendReadReceiptSignal, o as signalCheck, r as sendTypingSignal, s as signalRpcRequest, t as sendMessageSignal } from "./send-CjR30q4U.js";
|
|
52
|
+
import { a as formatIMessageChatTarget, c as parseIMessageTarget, i as DEFAULT_IMESSAGE_PROBE_TIMEOUT_MS, o as isAllowedIMessageSender, r as createIMessageRpcClient, s as normalizeIMessageHandle, t as sendMessageIMessage } from "./send-BZv91SjC.js";
|
|
53
|
+
import { n as resolveAgentRoute, t as buildAgentSessionKey } from "./resolve-route-BvD1w4_v.js";
|
|
54
|
+
import { t as recordInboundSessionMetaSafe } from "./session-meta-BeqTuIFU.js";
|
|
55
|
+
import { a as createReplyReferencePlanner, i as resolveSlackThreadTs, n as deliverReplies$2, t as createSlackReplyDeliveryPlan } from "./replies-CP8xbTSR.js";
|
|
56
|
+
import { n as resolveMemorySearchConfig } from "./manager-yAtdyPwQ.js";
|
|
57
|
+
import { m as normalizeExtraMemoryPaths, p as listMemoryFiles } from "./query-expansion-CnQI0IeV.js";
|
|
58
|
+
import { t as isQmdScopeAllowed } from "./qmd-scope-D6tMcgqR.js";
|
|
59
59
|
import { createRequire } from "node:module";
|
|
60
60
|
import * as path$1 from "node:path";
|
|
61
61
|
import path, { basename, isAbsolute, join } from "node:path";
|
|
62
|
-
import
|
|
62
|
+
import syncFs, { existsSync, mkdirSync, mkdtempSync, promises, readFileSync, realpathSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync } from "node:fs";
|
|
63
63
|
import os, { homedir } from "node:os";
|
|
64
|
-
import
|
|
65
|
-
import * as fs$
|
|
66
|
-
import fs
|
|
64
|
+
import JSON5 from "json5";
|
|
65
|
+
import * as fs$1 from "node:fs/promises";
|
|
66
|
+
import fs, { open } from "node:fs/promises";
|
|
67
67
|
import { inspect, isDeepStrictEqual, promisify } from "node:util";
|
|
68
68
|
import { execFile, execFileSync, spawn, spawnSync } from "node:child_process";
|
|
69
69
|
import { fileURLToPath } from "node:url";
|
|
@@ -3212,7 +3212,7 @@ function setPromptSourceCacheEntry(key, entry) {
|
|
|
3212
3212
|
}
|
|
3213
3213
|
function readOpenFileUtf8(fd) {
|
|
3214
3214
|
return new Promise((resolve, reject) => {
|
|
3215
|
-
|
|
3215
|
+
syncFs.readFile(fd, "utf-8", (error, data) => {
|
|
3216
3216
|
if (error) {
|
|
3217
3217
|
reject(error);
|
|
3218
3218
|
return;
|
|
@@ -3223,7 +3223,7 @@ function readOpenFileUtf8(fd) {
|
|
|
3223
3223
|
}
|
|
3224
3224
|
function closeOpenFile(fd) {
|
|
3225
3225
|
return new Promise((resolve, reject) => {
|
|
3226
|
-
|
|
3226
|
+
syncFs.close(fd, (error) => {
|
|
3227
3227
|
if (error) {
|
|
3228
3228
|
reject(error);
|
|
3229
3229
|
return;
|
|
@@ -3632,7 +3632,7 @@ function resolveWorkspaceLane(params) {
|
|
|
3632
3632
|
}
|
|
3633
3633
|
async function pathExists(targetPath) {
|
|
3634
3634
|
try {
|
|
3635
|
-
await fs
|
|
3635
|
+
await fs.access(targetPath);
|
|
3636
3636
|
return true;
|
|
3637
3637
|
} catch {
|
|
3638
3638
|
return false;
|
|
@@ -3640,7 +3640,7 @@ async function pathExists(targetPath) {
|
|
|
3640
3640
|
}
|
|
3641
3641
|
async function getExistingPathState(targetPath) {
|
|
3642
3642
|
try {
|
|
3643
|
-
const stats = await fs
|
|
3643
|
+
const stats = await fs.lstat(targetPath);
|
|
3644
3644
|
if (stats.isSymbolicLink()) return "other";
|
|
3645
3645
|
return stats.isDirectory() ? "directory" : "other";
|
|
3646
3646
|
} catch {
|
|
@@ -3649,7 +3649,7 @@ async function getExistingPathState(targetPath) {
|
|
|
3649
3649
|
}
|
|
3650
3650
|
async function pathLexicallyExists(targetPath) {
|
|
3651
3651
|
try {
|
|
3652
|
-
await fs
|
|
3652
|
+
await fs.lstat(targetPath);
|
|
3653
3653
|
return true;
|
|
3654
3654
|
} catch {
|
|
3655
3655
|
return false;
|
|
@@ -3670,9 +3670,9 @@ async function copyIfMissing(params) {
|
|
|
3670
3670
|
if (!opened.ok) return opened.reason === "path" ? "missing-source" : "invalid";
|
|
3671
3671
|
let content;
|
|
3672
3672
|
try {
|
|
3673
|
-
content =
|
|
3673
|
+
content = syncFs.readFileSync(opened.fd);
|
|
3674
3674
|
} finally {
|
|
3675
|
-
|
|
3675
|
+
syncFs.closeSync(opened.fd);
|
|
3676
3676
|
}
|
|
3677
3677
|
try {
|
|
3678
3678
|
await writeFileWithinRoot({
|
|
@@ -3716,7 +3716,7 @@ async function resolveWorkspaceLaneForTurn(params) {
|
|
|
3716
3716
|
const config = resolveWorkspaceLaneConfig(params.cfg, resolution.agentId);
|
|
3717
3717
|
if ((config?.create ?? "on-first-message") !== "on-first-message") return resolution;
|
|
3718
3718
|
const existed = pathState === "directory";
|
|
3719
|
-
if (!existed) await fs
|
|
3719
|
+
if (!existed) await fs.mkdir(resolution.effectiveWorkspaceDir, { recursive: true });
|
|
3720
3720
|
for (const file of config?.copiedOnCreate ?? DEFAULT_COPIED_ON_CREATE_FILES) {
|
|
3721
3721
|
const decision = await copyIfMissing({
|
|
3722
3722
|
sourceRoot: resolution.personaWorkspaceDir,
|
|
@@ -4040,7 +4040,7 @@ async function resolveOpenClawDocsPath(params) {
|
|
|
4040
4040
|
const workspaceDir = params.workspaceDir?.trim();
|
|
4041
4041
|
if (workspaceDir) {
|
|
4042
4042
|
const workspaceDocs = path.join(workspaceDir, "docs");
|
|
4043
|
-
if (
|
|
4043
|
+
if (syncFs.existsSync(workspaceDocs)) return workspaceDocs;
|
|
4044
4044
|
}
|
|
4045
4045
|
const packageRoot = await resolveOpenClawPackageRoot({
|
|
4046
4046
|
cwd: params.cwd,
|
|
@@ -4049,7 +4049,7 @@ async function resolveOpenClawDocsPath(params) {
|
|
|
4049
4049
|
});
|
|
4050
4050
|
if (packageRoot) {
|
|
4051
4051
|
const packageDocs = path.join(packageRoot, "docs");
|
|
4052
|
-
if (
|
|
4052
|
+
if (syncFs.existsSync(path.join(packageDocs, "docs.json"))) return packageDocs;
|
|
4053
4053
|
}
|
|
4054
4054
|
return DOCS_SITE_URL;
|
|
4055
4055
|
}
|
|
@@ -6523,7 +6523,7 @@ async function imageResult(params) {
|
|
|
6523
6523
|
}, params.label, params.imageSanitization);
|
|
6524
6524
|
}
|
|
6525
6525
|
async function imageResultFromFile(params) {
|
|
6526
|
-
const buf = await fs
|
|
6526
|
+
const buf = await fs.readFile(params.path);
|
|
6527
6527
|
const mimeType = await detectMime({ buffer: buf.slice(0, 256) }) ?? "image/png";
|
|
6528
6528
|
return await imageResult({
|
|
6529
6529
|
label: params.label,
|
|
@@ -7434,7 +7434,7 @@ async function resolveAgentSessionDirs(stateDir) {
|
|
|
7434
7434
|
const agentsDir = path.join(stateDir, "agents");
|
|
7435
7435
|
let entries = [];
|
|
7436
7436
|
try {
|
|
7437
|
-
entries = await fs
|
|
7437
|
+
entries = await fs.readdir(agentsDir, { withFileTypes: true });
|
|
7438
7438
|
} catch (err) {
|
|
7439
7439
|
if (err.code === "ENOENT") return [];
|
|
7440
7440
|
throw err;
|
|
@@ -8896,7 +8896,7 @@ function resolveDefaultIdentityPath() {
|
|
|
8896
8896
|
return path.join(resolveStateDir(), "identity", "device.json");
|
|
8897
8897
|
}
|
|
8898
8898
|
function ensureDir$2(filePath) {
|
|
8899
|
-
|
|
8899
|
+
syncFs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
8900
8900
|
}
|
|
8901
8901
|
const ED25519_SPKI_PREFIX = Buffer.from("302a300506032b6570032100", "hex");
|
|
8902
8902
|
function base64UrlEncode(buf) {
|
|
@@ -8932,8 +8932,8 @@ function generateIdentity() {
|
|
|
8932
8932
|
}
|
|
8933
8933
|
function loadOrCreateDeviceIdentity(filePath = resolveDefaultIdentityPath()) {
|
|
8934
8934
|
try {
|
|
8935
|
-
if (
|
|
8936
|
-
const raw =
|
|
8935
|
+
if (syncFs.existsSync(filePath)) {
|
|
8936
|
+
const raw = syncFs.readFileSync(filePath, "utf8");
|
|
8937
8937
|
const parsed = JSON.parse(raw);
|
|
8938
8938
|
if (parsed?.version === 1 && typeof parsed.deviceId === "string" && typeof parsed.publicKeyPem === "string" && typeof parsed.privateKeyPem === "string") {
|
|
8939
8939
|
const derivedId = fingerprintPublicKey(parsed.publicKeyPem);
|
|
@@ -8942,9 +8942,9 @@ function loadOrCreateDeviceIdentity(filePath = resolveDefaultIdentityPath()) {
|
|
|
8942
8942
|
...parsed,
|
|
8943
8943
|
deviceId: derivedId
|
|
8944
8944
|
};
|
|
8945
|
-
|
|
8945
|
+
syncFs.writeFileSync(filePath, `${JSON.stringify(updated, null, 2)}\n`, { mode: 384 });
|
|
8946
8946
|
try {
|
|
8947
|
-
|
|
8947
|
+
syncFs.chmodSync(filePath, 384);
|
|
8948
8948
|
} catch {}
|
|
8949
8949
|
return {
|
|
8950
8950
|
deviceId: derivedId,
|
|
@@ -8969,9 +8969,9 @@ function loadOrCreateDeviceIdentity(filePath = resolveDefaultIdentityPath()) {
|
|
|
8969
8969
|
privateKeyPem: identity.privateKeyPem,
|
|
8970
8970
|
createdAtMs: Date.now()
|
|
8971
8971
|
};
|
|
8972
|
-
|
|
8972
|
+
syncFs.writeFileSync(filePath, `${JSON.stringify(stored, null, 2)}\n`, { mode: 384 });
|
|
8973
8973
|
try {
|
|
8974
|
-
|
|
8974
|
+
syncFs.chmodSync(filePath, 384);
|
|
8975
8975
|
} catch {}
|
|
8976
8976
|
return identity;
|
|
8977
8977
|
}
|
|
@@ -8994,7 +8994,7 @@ function normalizeFingerprint(input) {
|
|
|
8994
8994
|
const execFileAsync = promisify(execFile);
|
|
8995
8995
|
async function fileExists(filePath) {
|
|
8996
8996
|
try {
|
|
8997
|
-
await fs
|
|
8997
|
+
await fs.access(filePath);
|
|
8998
8998
|
return true;
|
|
8999
8999
|
} catch {
|
|
9000
9000
|
return false;
|
|
@@ -9021,8 +9021,8 @@ async function generateSelfSignedCert(params) {
|
|
|
9021
9021
|
"-subj",
|
|
9022
9022
|
"/CN=openclaw-gateway"
|
|
9023
9023
|
]);
|
|
9024
|
-
await fs
|
|
9025
|
-
await fs
|
|
9024
|
+
await fs.chmod(params.keyPath, 384).catch(() => {});
|
|
9025
|
+
await fs.chmod(params.certPath, 384).catch(() => {});
|
|
9026
9026
|
params.log?.info?.(`gateway tls: generated self-signed cert at ${shortenHomeInString(params.certPath)}`);
|
|
9027
9027
|
}
|
|
9028
9028
|
async function loadGatewayTlsRuntime(cfg, log) {
|
|
@@ -9060,9 +9060,9 @@ async function loadGatewayTlsRuntime(cfg, log) {
|
|
|
9060
9060
|
error: "gateway tls: cert/key missing"
|
|
9061
9061
|
};
|
|
9062
9062
|
try {
|
|
9063
|
-
const cert = await fs
|
|
9064
|
-
const key = await fs
|
|
9065
|
-
const ca = caPath ? await fs
|
|
9063
|
+
const cert = await fs.readFile(certPath, "utf8");
|
|
9064
|
+
const key = await fs.readFile(keyPath, "utf8");
|
|
9065
|
+
const ca = caPath ? await fs.readFile(caPath, "utf8") : void 0;
|
|
9066
9066
|
const fingerprintSha256 = normalizeFingerprint(new X509Certificate(cert).fingerprint256 ?? "");
|
|
9067
9067
|
if (!fingerprintSha256) return {
|
|
9068
9068
|
enabled: false,
|
|
@@ -9163,8 +9163,8 @@ function resolveDeviceAuthPath(env = process.env) {
|
|
|
9163
9163
|
}
|
|
9164
9164
|
function readStore(filePath) {
|
|
9165
9165
|
try {
|
|
9166
|
-
if (!
|
|
9167
|
-
const raw =
|
|
9166
|
+
if (!syncFs.existsSync(filePath)) return null;
|
|
9167
|
+
const raw = syncFs.readFileSync(filePath, "utf8");
|
|
9168
9168
|
const parsed = JSON.parse(raw);
|
|
9169
9169
|
if (parsed?.version !== 1 || typeof parsed.deviceId !== "string") return null;
|
|
9170
9170
|
if (!parsed.tokens || typeof parsed.tokens !== "object") return null;
|
|
@@ -9174,10 +9174,10 @@ function readStore(filePath) {
|
|
|
9174
9174
|
}
|
|
9175
9175
|
}
|
|
9176
9176
|
function writeStore(filePath, store) {
|
|
9177
|
-
|
|
9178
|
-
|
|
9177
|
+
syncFs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
9178
|
+
syncFs.writeFileSync(filePath, `${JSON.stringify(store, null, 2)}\n`, { mode: 384 });
|
|
9179
9179
|
try {
|
|
9180
|
-
|
|
9180
|
+
syncFs.chmodSync(filePath, 384);
|
|
9181
9181
|
} catch {}
|
|
9182
9182
|
}
|
|
9183
9183
|
function loadDeviceAuthToken(params) {
|
|
@@ -13469,7 +13469,7 @@ async function routeReply(params) {
|
|
|
13469
13469
|
const resolvedReplyToId = replyToId ?? (channelId === "slack" && threadId != null && threadId !== "" ? String(threadId) : void 0);
|
|
13470
13470
|
const resolvedThreadId = channelId === "slack" ? null : threadId ?? null;
|
|
13471
13471
|
try {
|
|
13472
|
-
const { deliverOutboundPayloads } = await import("./deliver-
|
|
13472
|
+
const { deliverOutboundPayloads } = await import("./deliver-BoOCdGXY.js").then((n) => n.n);
|
|
13473
13473
|
const outboundSession = buildOutboundSessionContext({
|
|
13474
13474
|
cfg,
|
|
13475
13475
|
agentId: resolvedAgentId,
|
|
@@ -15124,7 +15124,7 @@ async function sendTranscriptEcho(params) {
|
|
|
15124
15124
|
}
|
|
15125
15125
|
const text = formatEchoTranscript(transcript, params.format ?? DEFAULT_ECHO_TRANSCRIPT_FORMAT);
|
|
15126
15126
|
try {
|
|
15127
|
-
const { deliverOutboundPayloads } = await import("./deliver-
|
|
15127
|
+
const { deliverOutboundPayloads } = await import("./deliver-BoOCdGXY.js").then((n) => n.n);
|
|
15128
15128
|
await deliverOutboundPayloads({
|
|
15129
15129
|
cfg,
|
|
15130
15130
|
channel: normalizedChannel,
|
|
@@ -18276,7 +18276,7 @@ async function resolveDiscordUserAllowlist(params) {
|
|
|
18276
18276
|
//#region src/plugin-sdk/json-store.ts
|
|
18277
18277
|
async function readJsonFileWithFallback(filePath, fallback) {
|
|
18278
18278
|
try {
|
|
18279
|
-
const parsed = safeParseJson(await
|
|
18279
|
+
const parsed = safeParseJson(await syncFs.promises.readFile(filePath, "utf-8"));
|
|
18280
18280
|
if (parsed == null) return {
|
|
18281
18281
|
value: fallback,
|
|
18282
18282
|
exists: true
|
|
@@ -18363,7 +18363,7 @@ async function readPairingRequests(filePath) {
|
|
|
18363
18363
|
}
|
|
18364
18364
|
async function ensureJsonFile(filePath, fallback) {
|
|
18365
18365
|
try {
|
|
18366
|
-
await
|
|
18366
|
+
await syncFs.promises.access(filePath);
|
|
18367
18367
|
} catch {
|
|
18368
18368
|
await writeJsonFile(filePath, fallback);
|
|
18369
18369
|
}
|
|
@@ -18519,7 +18519,7 @@ function resolveAllowFromReadCacheOrMissing(filePath, stat) {
|
|
|
18519
18519
|
async function readAllowFromStateForPathWithExists(channel, filePath) {
|
|
18520
18520
|
let stat = null;
|
|
18521
18521
|
try {
|
|
18522
|
-
stat = await
|
|
18522
|
+
stat = await syncFs.promises.stat(filePath);
|
|
18523
18523
|
} catch (err) {
|
|
18524
18524
|
if (err.code !== "ENOENT") throw err;
|
|
18525
18525
|
}
|
|
@@ -18562,7 +18562,7 @@ async function writeAllowFromState(filePath, allowFrom) {
|
|
|
18562
18562
|
});
|
|
18563
18563
|
let stat = null;
|
|
18564
18564
|
try {
|
|
18565
|
-
stat = await
|
|
18565
|
+
stat = await syncFs.promises.stat(filePath);
|
|
18566
18566
|
} catch {}
|
|
18567
18567
|
setAllowFromReadCache(filePath, {
|
|
18568
18568
|
exists: true,
|
|
@@ -19852,7 +19852,7 @@ function mergeLegacyAgent(current, legacy) {
|
|
|
19852
19852
|
}
|
|
19853
19853
|
function ensureDir$1(filePath) {
|
|
19854
19854
|
const dir = path.dirname(filePath);
|
|
19855
|
-
|
|
19855
|
+
syncFs.mkdirSync(dir, { recursive: true });
|
|
19856
19856
|
}
|
|
19857
19857
|
function coerceAllowlistEntries(allowlist) {
|
|
19858
19858
|
if (!Array.isArray(allowlist) || allowlist.length === 0) return Array.isArray(allowlist) ? allowlist : void 0;
|
|
@@ -19922,11 +19922,11 @@ function generateToken() {
|
|
|
19922
19922
|
function loadExecApprovals() {
|
|
19923
19923
|
const filePath = resolveExecApprovalsPath();
|
|
19924
19924
|
try {
|
|
19925
|
-
if (!
|
|
19925
|
+
if (!syncFs.existsSync(filePath)) return normalizeExecApprovals({
|
|
19926
19926
|
version: 1,
|
|
19927
19927
|
agents: {}
|
|
19928
19928
|
});
|
|
19929
|
-
const raw =
|
|
19929
|
+
const raw = syncFs.readFileSync(filePath, "utf8");
|
|
19930
19930
|
const parsed = JSON.parse(raw);
|
|
19931
19931
|
if (parsed?.version !== 1) return normalizeExecApprovals({
|
|
19932
19932
|
version: 1,
|
|
@@ -19943,9 +19943,9 @@ function loadExecApprovals() {
|
|
|
19943
19943
|
function saveExecApprovals(file) {
|
|
19944
19944
|
const filePath = resolveExecApprovalsPath();
|
|
19945
19945
|
ensureDir$1(filePath);
|
|
19946
|
-
|
|
19946
|
+
syncFs.writeFileSync(filePath, `${JSON.stringify(file, null, 2)}\n`, { mode: 384 });
|
|
19947
19947
|
try {
|
|
19948
|
-
|
|
19948
|
+
syncFs.chmodSync(filePath, 384);
|
|
19949
19949
|
} catch {}
|
|
19950
19950
|
}
|
|
19951
19951
|
function ensureExecApprovals() {
|
|
@@ -20511,18 +20511,18 @@ function peekSystemEventEntries(sessionKey) {
|
|
|
20511
20511
|
function resolvePowerShellPath() {
|
|
20512
20512
|
const programFiles = process.env.ProgramFiles || process.env.PROGRAMFILES || "C:\\Program Files";
|
|
20513
20513
|
const pwsh7 = path.join(programFiles, "PowerShell", "7", "pwsh.exe");
|
|
20514
|
-
if (
|
|
20514
|
+
if (syncFs.existsSync(pwsh7)) return pwsh7;
|
|
20515
20515
|
const programW6432 = process.env.ProgramW6432;
|
|
20516
20516
|
if (programW6432 && programW6432 !== programFiles) {
|
|
20517
20517
|
const pwsh7Alt = path.join(programW6432, "PowerShell", "7", "pwsh.exe");
|
|
20518
|
-
if (
|
|
20518
|
+
if (syncFs.existsSync(pwsh7Alt)) return pwsh7Alt;
|
|
20519
20519
|
}
|
|
20520
20520
|
const pwshInPath = resolveShellFromPath("pwsh");
|
|
20521
20521
|
if (pwshInPath) return pwshInPath;
|
|
20522
20522
|
const systemRoot = process.env.SystemRoot || process.env.WINDIR;
|
|
20523
20523
|
if (systemRoot) {
|
|
20524
20524
|
const candidate = path.join(systemRoot, "System32", "WindowsPowerShell", "v1.0", "powershell.exe");
|
|
20525
|
-
if (
|
|
20525
|
+
if (syncFs.existsSync(candidate)) return candidate;
|
|
20526
20526
|
}
|
|
20527
20527
|
return "powershell.exe";
|
|
20528
20528
|
}
|
|
@@ -20560,7 +20560,7 @@ function resolveShellFromPath(name) {
|
|
|
20560
20560
|
for (const entry of entries) {
|
|
20561
20561
|
const candidate = path.join(entry, name);
|
|
20562
20562
|
try {
|
|
20563
|
-
|
|
20563
|
+
syncFs.accessSync(candidate, syncFs.constants.X_OK);
|
|
20564
20564
|
return candidate;
|
|
20565
20565
|
} catch {}
|
|
20566
20566
|
}
|
|
@@ -21498,7 +21498,7 @@ async function resolveSandboxWorkdir(params) {
|
|
|
21498
21498
|
cwd: process.cwd(),
|
|
21499
21499
|
root: params.sandbox.workspaceDir
|
|
21500
21500
|
});
|
|
21501
|
-
if (!(await fs
|
|
21501
|
+
if (!(await fs.stat(resolved.resolved)).isDirectory()) throw new Error("workdir is not a directory");
|
|
21502
21502
|
const relative = resolved.relative ? resolved.relative.split(path.sep).join(path.posix.sep) : "";
|
|
21503
21503
|
const containerWorkdir = relative ? path.posix.join(params.sandbox.containerWorkdir, relative) : params.sandbox.containerWorkdir;
|
|
21504
21504
|
return {
|
|
@@ -22888,13 +22888,13 @@ async function validateScriptFileForShellBleed(params) {
|
|
|
22888
22888
|
cwd: params.workdir,
|
|
22889
22889
|
root: params.workdir
|
|
22890
22890
|
});
|
|
22891
|
-
stat = await fs
|
|
22891
|
+
stat = await fs.stat(absPath);
|
|
22892
22892
|
} catch {
|
|
22893
22893
|
return;
|
|
22894
22894
|
}
|
|
22895
22895
|
if (!stat.isFile()) return;
|
|
22896
22896
|
if (stat.size > 512 * 1024) return;
|
|
22897
|
-
const content = await fs
|
|
22897
|
+
const content = await fs.readFile(absPath, "utf-8");
|
|
22898
22898
|
const first = /\$[A-Z_][A-Z0-9_]{1,}/g.exec(content);
|
|
22899
22899
|
if (first) {
|
|
22900
22900
|
const idx = first.index;
|
|
@@ -24323,7 +24323,7 @@ function walkUpFrom(startDir, opts, resolveAtDir) {
|
|
|
24323
24323
|
function hasGitMarker(repoRoot) {
|
|
24324
24324
|
const gitPath = path.join(repoRoot, ".git");
|
|
24325
24325
|
try {
|
|
24326
|
-
const stat =
|
|
24326
|
+
const stat = syncFs.statSync(gitPath);
|
|
24327
24327
|
return stat.isDirectory() || stat.isFile();
|
|
24328
24328
|
} catch {
|
|
24329
24329
|
return false;
|
|
@@ -24335,10 +24335,10 @@ function findGitRoot(startDir, opts = {}) {
|
|
|
24335
24335
|
function resolveGitDirFromMarker(repoRoot) {
|
|
24336
24336
|
const gitPath = path.join(repoRoot, ".git");
|
|
24337
24337
|
try {
|
|
24338
|
-
const stat =
|
|
24338
|
+
const stat = syncFs.statSync(gitPath);
|
|
24339
24339
|
if (stat.isDirectory()) return gitPath;
|
|
24340
24340
|
if (!stat.isFile()) return null;
|
|
24341
|
-
const match =
|
|
24341
|
+
const match = syncFs.readFileSync(gitPath, "utf-8").match(/gitdir:\s*(.+)/i);
|
|
24342
24342
|
if (!match?.[1]) return null;
|
|
24343
24343
|
return path.resolve(repoRoot, match[1].trim());
|
|
24344
24344
|
} catch {
|
|
@@ -24405,7 +24405,7 @@ const resolveCommitHash = (options = {}) => {
|
|
|
24405
24405
|
cachedCommit = null;
|
|
24406
24406
|
return cachedCommit;
|
|
24407
24407
|
}
|
|
24408
|
-
const head =
|
|
24408
|
+
const head = syncFs.readFileSync(headPath, "utf-8").trim();
|
|
24409
24409
|
if (!head) {
|
|
24410
24410
|
cachedCommit = null;
|
|
24411
24411
|
return cachedCommit;
|
|
@@ -24413,7 +24413,7 @@ const resolveCommitHash = (options = {}) => {
|
|
|
24413
24413
|
if (head.startsWith("ref:")) {
|
|
24414
24414
|
const ref = head.replace(/^ref:\s*/i, "").trim();
|
|
24415
24415
|
const refPath = path.resolve(path.dirname(headPath), ref);
|
|
24416
|
-
cachedCommit = formatCommit(
|
|
24416
|
+
cachedCommit = formatCommit(syncFs.readFileSync(refPath, "utf-8").trim());
|
|
24417
24417
|
return cachedCommit;
|
|
24418
24418
|
}
|
|
24419
24419
|
cachedCommit = formatCommit(head);
|
|
@@ -29041,7 +29041,7 @@ function resolveRepoRoot(params) {
|
|
|
29041
29041
|
const configured = params.config?.agents?.defaults?.repoRoot?.trim();
|
|
29042
29042
|
if (configured) try {
|
|
29043
29043
|
const resolved = path.resolve(configured);
|
|
29044
|
-
if (
|
|
29044
|
+
if (syncFs.statSync(resolved).isDirectory()) return resolved;
|
|
29045
29045
|
} catch {}
|
|
29046
29046
|
const candidates = [params.workspaceDir, params.cwd].map((value) => value?.trim()).filter(Boolean);
|
|
29047
29047
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -29558,7 +29558,7 @@ async function readForwardAndSort(query, sessionId) {
|
|
|
29558
29558
|
//#region src/auto-reply/reply/commands-export-session.ts
|
|
29559
29559
|
const EXPORT_HTML_DIR = path.join(path.dirname(fileURLToPath(import.meta.url)), "export-html");
|
|
29560
29560
|
function loadTemplate(fileName) {
|
|
29561
|
-
return
|
|
29561
|
+
return syncFs.readFileSync(path.join(EXPORT_HTML_DIR, fileName), "utf-8");
|
|
29562
29562
|
}
|
|
29563
29563
|
function generateHtml(sessionData) {
|
|
29564
29564
|
const template = loadTemplate("template.html");
|
|
@@ -29661,8 +29661,8 @@ async function buildExportSessionReply(params) {
|
|
|
29661
29661
|
const defaultFileName = `openclaw-session-${entry.sessionId.slice(0, 8)}-${timestamp}.html`;
|
|
29662
29662
|
const outputPath = args.outputPath ? path.resolve(args.outputPath.startsWith("~") ? args.outputPath.replace("~", process.env.HOME ?? "") : args.outputPath) : path.join(params.workspaceDir, defaultFileName);
|
|
29663
29663
|
const outputDir = path.dirname(outputPath);
|
|
29664
|
-
if (!
|
|
29665
|
-
|
|
29664
|
+
if (!syncFs.existsSync(outputDir)) syncFs.mkdirSync(outputDir, { recursive: true });
|
|
29665
|
+
syncFs.writeFileSync(outputPath, html, "utf-8");
|
|
29666
29666
|
const relativePath = path.relative(params.workspaceDir, outputPath);
|
|
29667
29667
|
return { text: [
|
|
29668
29668
|
"✅ Session exported!",
|
|
@@ -29837,8 +29837,8 @@ function resolveZaiApiKey() {
|
|
|
29837
29837
|
}
|
|
29838
29838
|
try {
|
|
29839
29839
|
const authPath = path.join(resolveRequiredHomeDir(process.env, os.homedir), ".pi", "agent", "auth.json");
|
|
29840
|
-
if (!
|
|
29841
|
-
const data = JSON.parse(
|
|
29840
|
+
if (!syncFs.existsSync(authPath)) return;
|
|
29841
|
+
const data = JSON.parse(syncFs.readFileSync(authPath, "utf-8"));
|
|
29842
29842
|
return data["z-ai"]?.access || data.zai?.access;
|
|
29843
29843
|
} catch {
|
|
29844
29844
|
return;
|
|
@@ -31597,7 +31597,7 @@ function shouldPersistAnyBindingState() {
|
|
|
31597
31597
|
}
|
|
31598
31598
|
function shouldPersistBindingMutations() {
|
|
31599
31599
|
if (shouldPersistAnyBindingState()) return true;
|
|
31600
|
-
return
|
|
31600
|
+
return syncFs.existsSync(resolveThreadBindingsPath());
|
|
31601
31601
|
}
|
|
31602
31602
|
function saveBindingsToDisk(params = {}) {
|
|
31603
31603
|
if (!params.force && !shouldPersistAnyBindingState()) return;
|
|
@@ -34204,8 +34204,8 @@ function normalizeSessionKey(value) {
|
|
|
34204
34204
|
}
|
|
34205
34205
|
function readSessionStore(storePath) {
|
|
34206
34206
|
try {
|
|
34207
|
-
const raw =
|
|
34208
|
-
const parsed =
|
|
34207
|
+
const raw = syncFs.readFileSync(storePath, "utf-8");
|
|
34208
|
+
const parsed = JSON5.parse(raw);
|
|
34209
34209
|
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) return parsed;
|
|
34210
34210
|
} catch {}
|
|
34211
34211
|
return {};
|
|
@@ -35891,7 +35891,7 @@ async function createModelSelectionState(params) {
|
|
|
35891
35891
|
}
|
|
35892
35892
|
}
|
|
35893
35893
|
if (sessionEntry && sessionStore && sessionKey && sessionEntry.authProfileOverride) {
|
|
35894
|
-
const { ensureAuthProfileStore } = await import("./model-selection-
|
|
35894
|
+
const { ensureAuthProfileStore } = await import("./model-selection-B7FYf8Fo.js").then((n) => n.P);
|
|
35895
35895
|
const profile = ensureAuthProfileStore(void 0, { allowKeychainPrompt: false }).profiles[sessionEntry.authProfileOverride];
|
|
35896
35896
|
const providerKey = normalizeProviderId(provider);
|
|
35897
35897
|
if (!profile || normalizeProviderId(profile.provider) !== providerKey) await clearSessionAuthProfileOverride({
|
|
@@ -39414,7 +39414,7 @@ function asBoolean(value) {
|
|
|
39414
39414
|
}
|
|
39415
39415
|
function resolveTempPathParts(opts) {
|
|
39416
39416
|
const tmpDir = opts.tmpDir ?? resolvePreferredOpenClawTmpDir();
|
|
39417
|
-
if (!opts.tmpDir)
|
|
39417
|
+
if (!opts.tmpDir) syncFs.mkdirSync(tmpDir, {
|
|
39418
39418
|
recursive: true,
|
|
39419
39419
|
mode: 448
|
|
39420
39420
|
});
|
|
@@ -39500,7 +39500,7 @@ async function writeUrlToFile(filePath, url, opts) {
|
|
|
39500
39500
|
if (typeof contentLength === "number" && Number.isFinite(contentLength) && contentLength > MAX_CAMERA_URL_DOWNLOAD_BYTES) throw new Error(`writeUrlToFile: content-length ${contentLength} exceeds max ${MAX_CAMERA_URL_DOWNLOAD_BYTES}`);
|
|
39501
39501
|
const body = res.body;
|
|
39502
39502
|
if (!body) throw new Error(`failed to download ${url}: empty response body`);
|
|
39503
|
-
const fileHandle = await fs$
|
|
39503
|
+
const fileHandle = await fs$1.open(filePath, "w");
|
|
39504
39504
|
let thrown;
|
|
39505
39505
|
try {
|
|
39506
39506
|
const reader = body.getReader();
|
|
@@ -39518,7 +39518,7 @@ async function writeUrlToFile(filePath, url, opts) {
|
|
|
39518
39518
|
await fileHandle.close();
|
|
39519
39519
|
}
|
|
39520
39520
|
if (thrown) {
|
|
39521
|
-
await fs$
|
|
39521
|
+
await fs$1.unlink(filePath).catch(() => {});
|
|
39522
39522
|
throw thrown;
|
|
39523
39523
|
}
|
|
39524
39524
|
} finally {
|
|
@@ -39531,7 +39531,7 @@ async function writeUrlToFile(filePath, url, opts) {
|
|
|
39531
39531
|
}
|
|
39532
39532
|
async function writeBase64ToFile(filePath, base64) {
|
|
39533
39533
|
const buf = Buffer.from(base64, "base64");
|
|
39534
|
-
await fs$
|
|
39534
|
+
await fs$1.writeFile(filePath, buf);
|
|
39535
39535
|
return {
|
|
39536
39536
|
path: filePath,
|
|
39537
39537
|
bytes: buf.length
|
|
@@ -39616,7 +39616,7 @@ async function readJsonlFromPath(jsonlPath) {
|
|
|
39616
39616
|
if (shouldLogVerbose()) logVerbose(`Blocked canvas jsonlPath outside allowed roots: ${resolved}`);
|
|
39617
39617
|
throw new Error("jsonlPath outside allowed roots");
|
|
39618
39618
|
}
|
|
39619
|
-
const canonical = await fs
|
|
39619
|
+
const canonical = await fs.realpath(resolved).catch(() => resolved);
|
|
39620
39620
|
if (!isInboundPathAllowed({
|
|
39621
39621
|
filePath: canonical,
|
|
39622
39622
|
roots
|
|
@@ -39624,7 +39624,7 @@ async function readJsonlFromPath(jsonlPath) {
|
|
|
39624
39624
|
if (shouldLogVerbose()) logVerbose(`Blocked canvas jsonlPath outside allowed roots: ${canonical}`);
|
|
39625
39625
|
throw new Error("jsonlPath outside allowed roots");
|
|
39626
39626
|
}
|
|
39627
|
-
return await fs
|
|
39627
|
+
return await fs.readFile(canonical, "utf8");
|
|
39628
39628
|
}
|
|
39629
39629
|
const CanvasToolSchema = Type.Object({
|
|
39630
39630
|
action: stringEnum(CANVAS_ACTIONS),
|
|
@@ -40475,12 +40475,12 @@ function resolveRestartSentinelPath(env = process.env) {
|
|
|
40475
40475
|
}
|
|
40476
40476
|
async function writeRestartSentinel(payload, env = process.env) {
|
|
40477
40477
|
const filePath = resolveRestartSentinelPath(env);
|
|
40478
|
-
await fs
|
|
40478
|
+
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
|
40479
40479
|
const data = {
|
|
40480
40480
|
version: 1,
|
|
40481
40481
|
payload
|
|
40482
40482
|
};
|
|
40483
|
-
await fs
|
|
40483
|
+
await fs.writeFile(filePath, `${JSON.stringify(data, null, 2)}\n`, "utf-8");
|
|
40484
40484
|
return filePath;
|
|
40485
40485
|
}
|
|
40486
40486
|
|
|
@@ -42889,9 +42889,9 @@ function loadExternalCatalogEntries(options) {
|
|
|
42889
42889
|
const entries = [];
|
|
42890
42890
|
for (const rawPath of paths) {
|
|
42891
42891
|
const resolved = resolveUserPath(rawPath);
|
|
42892
|
-
if (!
|
|
42892
|
+
if (!syncFs.existsSync(resolved)) continue;
|
|
42893
42893
|
try {
|
|
42894
|
-
const payload = JSON.parse(
|
|
42894
|
+
const payload = JSON.parse(syncFs.readFileSync(resolved, "utf-8"));
|
|
42895
42895
|
entries.push(...parseCatalogEntries(payload));
|
|
42896
42896
|
} catch {}
|
|
42897
42897
|
}
|
|
@@ -51911,18 +51911,18 @@ function appendImagePathsToPrompt(prompt, paths) {
|
|
|
51911
51911
|
return `${trimmed}${trimmed ? "\n\n" : ""}${paths.join("\n")}`;
|
|
51912
51912
|
}
|
|
51913
51913
|
async function writeCliImages(images) {
|
|
51914
|
-
const tempDir = await fs
|
|
51914
|
+
const tempDir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-cli-images-"));
|
|
51915
51915
|
const paths = [];
|
|
51916
51916
|
for (let i = 0; i < images.length; i += 1) {
|
|
51917
51917
|
const image = images[i];
|
|
51918
51918
|
const ext = resolveImageExtension(image.mimeType);
|
|
51919
51919
|
const filePath = path.join(tempDir, `image-${i + 1}.${ext}`);
|
|
51920
51920
|
const buffer = Buffer.from(image.data, "base64");
|
|
51921
|
-
await fs
|
|
51921
|
+
await fs.writeFile(filePath, buffer, { mode: 384 });
|
|
51922
51922
|
paths.push(filePath);
|
|
51923
51923
|
}
|
|
51924
51924
|
const cleanup = async () => {
|
|
51925
|
-
await fs
|
|
51925
|
+
await fs.rm(tempDir, {
|
|
51926
51926
|
recursive: true,
|
|
51927
51927
|
force: true
|
|
51928
51928
|
});
|
|
@@ -53822,10 +53822,10 @@ function resolveCronStorePath(storePath) {
|
|
|
53822
53822
|
}
|
|
53823
53823
|
async function loadCronStore(storePath) {
|
|
53824
53824
|
try {
|
|
53825
|
-
const raw = await
|
|
53825
|
+
const raw = await syncFs.promises.readFile(storePath, "utf-8");
|
|
53826
53826
|
let parsed;
|
|
53827
53827
|
try {
|
|
53828
|
-
parsed =
|
|
53828
|
+
parsed = JSON5.parse(raw);
|
|
53829
53829
|
} catch (err) {
|
|
53830
53830
|
throw new Error(`Failed to parse cron store at ${storePath}: ${String(err)}`, { cause: err });
|
|
53831
53831
|
}
|
|
@@ -54392,9 +54392,9 @@ async function readPostCompactionContext(workspaceDir) {
|
|
|
54392
54392
|
if (!opened.ok) return null;
|
|
54393
54393
|
const sections = extractSections((() => {
|
|
54394
54394
|
try {
|
|
54395
|
-
return
|
|
54395
|
+
return syncFs.readFileSync(opened.fd, "utf-8");
|
|
54396
54396
|
} finally {
|
|
54397
|
-
|
|
54397
|
+
syncFs.closeSync(opened.fd);
|
|
54398
54398
|
}
|
|
54399
54399
|
})(), ["Session Startup", "Red Lines"]);
|
|
54400
54400
|
if (sections.length === 0) return null;
|
|
@@ -55642,7 +55642,7 @@ async function deliverSessionMaintenanceWarning(params) {
|
|
|
55642
55642
|
return;
|
|
55643
55643
|
}
|
|
55644
55644
|
try {
|
|
55645
|
-
const { deliverOutboundPayloads } = await import("./deliver-
|
|
55645
|
+
const { deliverOutboundPayloads } = await import("./deliver-BoOCdGXY.js").then((n) => n.n);
|
|
55646
55646
|
const outboundSession = buildOutboundSessionContext({
|
|
55647
55647
|
cfg: params.cfg,
|
|
55648
55648
|
sessionKey: params.sessionKey
|
|
@@ -56591,7 +56591,7 @@ async function stageSandboxMedia(params) {
|
|
|
56591
56591
|
const remoteMediaCacheDir = ctx.MediaRemoteHost ? path.join(workspaceDir, ".openclaw", "media", "remote-cache", sessionKey) : null;
|
|
56592
56592
|
const effectiveWorkspaceDir = sandbox?.workspaceDir ?? remoteMediaCacheDir;
|
|
56593
56593
|
if (!effectiveWorkspaceDir) return;
|
|
56594
|
-
await fs
|
|
56594
|
+
await fs.mkdir(effectiveWorkspaceDir, { recursive: true });
|
|
56595
56595
|
const remoteAttachmentRoots = resolveIMessageRemoteAttachmentRoots({
|
|
56596
56596
|
cfg,
|
|
56597
56597
|
accountId: ctx.AccountId
|
|
@@ -56650,8 +56650,8 @@ async function stageLocalFileIntoRoot(params) {
|
|
|
56650
56650
|
}
|
|
56651
56651
|
async function stageRemoteFileIntoRoot(params) {
|
|
56652
56652
|
const tmpRoot = resolvePreferredOpenClawTmpDir();
|
|
56653
|
-
await fs
|
|
56654
|
-
const tmpDir = await fs
|
|
56653
|
+
await fs.mkdir(tmpRoot, { recursive: true });
|
|
56654
|
+
const tmpDir = await fs.mkdtemp(path.join(tmpRoot, "stage-sandbox-media-"));
|
|
56655
56655
|
const tmpPath = path.join(tmpDir, "download");
|
|
56656
56656
|
try {
|
|
56657
56657
|
await scpFile(params.remoteHost, params.remotePath, tmpPath);
|
|
@@ -56662,7 +56662,7 @@ async function stageRemoteFileIntoRoot(params) {
|
|
|
56662
56662
|
maxBytes: params.maxBytes
|
|
56663
56663
|
});
|
|
56664
56664
|
} finally {
|
|
56665
|
-
await fs
|
|
56665
|
+
await fs.rm(tmpDir, {
|
|
56666
56666
|
recursive: true,
|
|
56667
56667
|
force: true
|
|
56668
56668
|
}).catch(() => {});
|
|
@@ -57900,7 +57900,7 @@ async function runModelGate(spec, ctx) {
|
|
|
57900
57900
|
const isolatedSessionId = randomNonce;
|
|
57901
57901
|
const isolatedRunId = randomNonce;
|
|
57902
57902
|
const tmpBaseDir = resolvePreferredOpenClawTmpDir();
|
|
57903
|
-
tmpDir = await fs
|
|
57903
|
+
tmpDir = await fs.mkdtemp(path.join(tmpBaseDir, "wake-gate-"));
|
|
57904
57904
|
const workspaceDir = tmpDir;
|
|
57905
57905
|
const prompt = spec.prompt ?? DEFAULT_MODEL_PROMPT;
|
|
57906
57906
|
const timeoutMs = spec.timeoutMs ?? DEFAULT_MODEL_TIMEOUT_MS;
|
|
@@ -57958,7 +57958,7 @@ async function runModelGate(spec, ctx) {
|
|
|
57958
57958
|
log$35.warn("model gate error", { error: err instanceof Error ? err.message : String(err) });
|
|
57959
57959
|
return { wake: false };
|
|
57960
57960
|
} finally {
|
|
57961
|
-
if (tmpDir) await fs
|
|
57961
|
+
if (tmpDir) await fs.rm(tmpDir, {
|
|
57962
57962
|
recursive: true,
|
|
57963
57963
|
force: true
|
|
57964
57964
|
}).catch(() => void 0);
|
|
@@ -58188,7 +58188,7 @@ async function resolveHeartbeatPreflight(params) {
|
|
|
58188
58188
|
const workspaceDir = resolveAgentWorkspaceDir(params.cfg, params.agentId);
|
|
58189
58189
|
const heartbeatFilePath = path.join(workspaceDir, DEFAULT_HEARTBEAT_FILENAME);
|
|
58190
58190
|
try {
|
|
58191
|
-
if (isHeartbeatContentEffectivelyEmpty(await fs
|
|
58191
|
+
if (isHeartbeatContentEffectivelyEmpty(await fs.readFile(heartbeatFilePath, "utf-8"))) return {
|
|
58192
58192
|
...basePreflight,
|
|
58193
58193
|
skipReason: "empty-heartbeat-file"
|
|
58194
58194
|
};
|
|
@@ -66765,7 +66765,7 @@ async function resolveDiscordPreflightAudioMentionContext(params) {
|
|
|
66765
66765
|
let transcript;
|
|
66766
66766
|
let carry;
|
|
66767
66767
|
if (needsPreflightTranscription) try {
|
|
66768
|
-
const { transcribeFirstAudio } = await import("./audio-preflight-
|
|
66768
|
+
const { transcribeFirstAudio } = await import("./audio-preflight-BV83ctbI.js");
|
|
66769
66769
|
const uploadable = audioAttachments.filter((att) => typeof att.url === "string" && att.url.length > 0);
|
|
66770
66770
|
if (uploadable.length > 0) {
|
|
66771
66771
|
const preflight = await transcribeFirstAudio({
|
|
@@ -68226,7 +68226,7 @@ function identityHasValues(identity) {
|
|
|
68226
68226
|
}
|
|
68227
68227
|
function loadIdentityFromFile(identityPath) {
|
|
68228
68228
|
try {
|
|
68229
|
-
const parsed = parseIdentityMarkdown(
|
|
68229
|
+
const parsed = parseIdentityMarkdown(syncFs.readFileSync(identityPath, "utf-8"));
|
|
68230
68230
|
if (!identityHasValues(parsed)) return null;
|
|
68231
68231
|
return parsed;
|
|
68232
68232
|
} catch {
|
|
@@ -68250,7 +68250,7 @@ function resolveAvatarSource(cfg, agentId) {
|
|
|
68250
68250
|
}
|
|
68251
68251
|
function resolveExistingPath(value) {
|
|
68252
68252
|
try {
|
|
68253
|
-
return
|
|
68253
|
+
return syncFs.realpathSync(value);
|
|
68254
68254
|
} catch {
|
|
68255
68255
|
return path.resolve(value);
|
|
68256
68256
|
}
|
|
@@ -68268,7 +68268,7 @@ function resolveLocalAvatarPath(params) {
|
|
|
68268
68268
|
reason: "unsupported_extension"
|
|
68269
68269
|
};
|
|
68270
68270
|
try {
|
|
68271
|
-
const stat =
|
|
68271
|
+
const stat = syncFs.statSync(realPath);
|
|
68272
68272
|
if (!stat.isFile()) return {
|
|
68273
68273
|
ok: false,
|
|
68274
68274
|
reason: "missing"
|
|
@@ -74035,19 +74035,19 @@ function createDefaultDeps() {
|
|
|
74035
74035
|
};
|
|
74036
74036
|
}),
|
|
74037
74037
|
sendMessageDiscord: async (...args) => {
|
|
74038
|
-
const { sendMessageDiscord } = await import("./send-
|
|
74038
|
+
const { sendMessageDiscord } = await import("./send-4WdiWuFu.js").then((n) => n.t);
|
|
74039
74039
|
return await sendMessageDiscord(...args);
|
|
74040
74040
|
},
|
|
74041
74041
|
sendMessageSlack: async (...args) => {
|
|
74042
|
-
const { sendMessageSlack } = await import("./send-
|
|
74042
|
+
const { sendMessageSlack } = await import("./send-bmlVFiBl.js").then((n) => n.n);
|
|
74043
74043
|
return await sendMessageSlack(...args);
|
|
74044
74044
|
},
|
|
74045
74045
|
sendMessageSignal: async (...args) => {
|
|
74046
|
-
const { sendMessageSignal } = await import("./send-
|
|
74046
|
+
const { sendMessageSignal } = await import("./send-CjR30q4U.js").then((n) => n.i);
|
|
74047
74047
|
return await sendMessageSignal(...args);
|
|
74048
74048
|
},
|
|
74049
74049
|
sendMessageIMessage: async (...args) => {
|
|
74050
|
-
const { sendMessageIMessage } = await import("./send-
|
|
74050
|
+
const { sendMessageIMessage } = await import("./send-BZv91SjC.js").then((n) => n.n);
|
|
74051
74051
|
return await sendMessageIMessage(...args);
|
|
74052
74052
|
}
|
|
74053
74053
|
};
|
|
@@ -75299,10 +75299,10 @@ function estimateDurationSeconds(pcm) {
|
|
|
75299
75299
|
return pcm.length / (bytesPerSample * SAMPLE_RATE);
|
|
75300
75300
|
}
|
|
75301
75301
|
async function writeWavFile(pcm) {
|
|
75302
|
-
const tempDir = await fs
|
|
75302
|
+
const tempDir = await fs.mkdtemp(path.join(resolvePreferredOpenClawTmpDir(), "discord-voice-"));
|
|
75303
75303
|
const filePath = path.join(tempDir, `segment-${randomUUID()}.wav`);
|
|
75304
75304
|
const wav = buildWavBuffer(pcm);
|
|
75305
|
-
await fs
|
|
75305
|
+
await fs.writeFile(filePath, wav);
|
|
75306
75306
|
scheduleTempCleanup(tempDir);
|
|
75307
75307
|
return {
|
|
75308
75308
|
path: filePath,
|
|
@@ -75311,7 +75311,7 @@ async function writeWavFile(pcm) {
|
|
|
75311
75311
|
}
|
|
75312
75312
|
function scheduleTempCleanup(tempDir, delayMs = 1800 * 1e3) {
|
|
75313
75313
|
setTimeout(() => {
|
|
75314
|
-
fs
|
|
75314
|
+
fs.rm(tempDir, {
|
|
75315
75315
|
recursive: true,
|
|
75316
75316
|
force: true
|
|
75317
75317
|
}).catch((err) => {
|
|
@@ -79096,7 +79096,7 @@ async function detectBinary(name) {
|
|
|
79096
79096
|
if (!isSafeExecutableValue(name)) return false;
|
|
79097
79097
|
const resolved = name.startsWith("~") ? resolveUserPath(name) : name;
|
|
79098
79098
|
if (path.isAbsolute(resolved) || resolved.startsWith(".") || resolved.includes("/") || resolved.includes("\\")) try {
|
|
79099
|
-
await fs
|
|
79099
|
+
await fs.access(resolved);
|
|
79100
79100
|
return true;
|
|
79101
79101
|
} catch {
|
|
79102
79102
|
return false;
|
|
@@ -79760,7 +79760,7 @@ function normalizeAllowList$1(list) {
|
|
|
79760
79760
|
async function detectRemoteHostFromCliPath(cliPath) {
|
|
79761
79761
|
try {
|
|
79762
79762
|
const expanded = cliPath.startsWith("~") ? cliPath.replace(/^~/, process.env.HOME ?? "") : cliPath;
|
|
79763
|
-
const content = await fs
|
|
79763
|
+
const content = await fs.readFile(expanded, "utf8");
|
|
79764
79764
|
const userHostMatch = content.match(/\bssh\b[^\n]*?\s+([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+)/);
|
|
79765
79765
|
if (userHostMatch) return userHostMatch[1];
|
|
79766
79766
|
return content.match(/\bssh\b[^\n]*?\s+([a-zA-Z][a-zA-Z0-9._-]*)\s+\S*\bimsg\b/)?.[1];
|
|
@@ -80096,7 +80096,7 @@ async function monitorIMessageProvider(opts = {}) {
|
|
|
80096
80096
|
function readFileIfExists(filePath) {
|
|
80097
80097
|
if (!filePath) return;
|
|
80098
80098
|
try {
|
|
80099
|
-
return
|
|
80099
|
+
return syncFs.readFileSync(filePath, "utf-8").trim();
|
|
80100
80100
|
} catch {
|
|
80101
80101
|
return;
|
|
80102
80102
|
}
|
|
@@ -80759,7 +80759,7 @@ async function downloadLineMedia(messageId, channelAccessToken, maxBytes = 10 *
|
|
|
80759
80759
|
prefix: "line-media",
|
|
80760
80760
|
extension: getExtensionForContentType(contentType)
|
|
80761
80761
|
});
|
|
80762
|
-
await
|
|
80762
|
+
await syncFs.promises.writeFile(filePath, buffer);
|
|
80763
80763
|
logVerbose(`line: downloaded media ${messageId} to ${filePath} (${buffer.length} bytes)`);
|
|
80764
80764
|
return {
|
|
80765
80765
|
path: filePath,
|
|
@@ -86532,7 +86532,7 @@ function readSlackExternalArgMenuToken(raw) {
|
|
|
86532
86532
|
}
|
|
86533
86533
|
let commandsRegistry;
|
|
86534
86534
|
async function getCommandsRegistry() {
|
|
86535
|
-
if (!commandsRegistry) commandsRegistry = await import("./commands-registry-
|
|
86535
|
+
if (!commandsRegistry) commandsRegistry = await import("./commands-registry-D3lOVOa7.js").then((n) => n.n);
|
|
86536
86536
|
return commandsRegistry;
|
|
86537
86537
|
}
|
|
86538
86538
|
function encodeSlackCommandArgValue(parts) {
|
|
@@ -86862,14 +86862,14 @@ async function registerSlackMonitorSlashCommands(params) {
|
|
|
86862
86862
|
const channelName = channelInfo?.name;
|
|
86863
86863
|
const roomLabel = channelName ? `#${channelName}` : `#${command.channel_id}`;
|
|
86864
86864
|
const [{ resolveAgentRoute }, { finalizeInboundContext }, { dispatchReplyWithDispatcher }] = await Promise.all([
|
|
86865
|
-
import("./resolve-route-
|
|
86865
|
+
import("./resolve-route-BvD1w4_v.js").then((n) => n.r),
|
|
86866
86866
|
import("./inbound-context-C5qOxoGs.js").then((n) => n.n),
|
|
86867
86867
|
Promise.resolve().then(() => provider_dispatcher_exports)
|
|
86868
86868
|
]);
|
|
86869
86869
|
const [{ resolveConversationLabel }, { createReplyPrefixOptions }, { recordInboundSessionMetaSafe }] = await Promise.all([
|
|
86870
86870
|
import("./conversation-label-Ckfze_uK.js").then((n) => n.t),
|
|
86871
|
-
import("./reply-prefix-
|
|
86872
|
-
import("./session-meta-
|
|
86871
|
+
import("./reply-prefix-C7r81KLS.js").then((n) => n.n),
|
|
86872
|
+
import("./session-meta-BeqTuIFU.js").then((n) => n.n)
|
|
86873
86873
|
]);
|
|
86874
86874
|
const route = resolveAgentRoute({
|
|
86875
86875
|
cfg,
|
|
@@ -86934,9 +86934,9 @@ async function registerSlackMonitorSlashCommands(params) {
|
|
|
86934
86934
|
});
|
|
86935
86935
|
const deliverSlashPayloads = async (replies) => {
|
|
86936
86936
|
const [{ deliverSlackSlashReplies }, { resolveChunkMode, resolveChunkNewlinePacking }, { resolveMarkdownTableMode }] = await Promise.all([
|
|
86937
|
-
import("./replies-
|
|
86938
|
-
import("./chunk-
|
|
86939
|
-
import("./markdown-tables-
|
|
86937
|
+
import("./replies-CP8xbTSR.js").then((n) => n.r),
|
|
86938
|
+
import("./chunk-BRJHaAd6.js").then((n) => n.s),
|
|
86939
|
+
import("./markdown-tables-DfqPFbkZ.js").then((n) => n.t)
|
|
86940
86940
|
]);
|
|
86941
86941
|
await deliverSlackSlashReplies({
|
|
86942
86942
|
replies,
|
|
@@ -86990,7 +86990,7 @@ async function registerSlackMonitorSlashCommands(params) {
|
|
|
86990
86990
|
let nativeCommands = [];
|
|
86991
86991
|
if (nativeEnabled) {
|
|
86992
86992
|
reg = await getCommandsRegistry();
|
|
86993
|
-
const skillCommands = nativeSkillsEnabled ? (await import("./skill-commands-
|
|
86993
|
+
const skillCommands = nativeSkillsEnabled ? (await import("./skill-commands-CcrQquVr.js").then((n) => n.a)).listSkillCommandsForAgents({ cfg }) : [];
|
|
86994
86994
|
nativeCommands = reg.listNativeCommandSpecsForConfig(cfg, {
|
|
86995
86995
|
skillCommands,
|
|
86996
86996
|
provider: "slack"
|
|
@@ -87940,7 +87940,7 @@ async function getMemorySearchManager(params) {
|
|
|
87940
87940
|
if (cached) return { manager: cached };
|
|
87941
87941
|
}
|
|
87942
87942
|
try {
|
|
87943
|
-
const { QmdMemoryManager } = await import("./qmd-manager-
|
|
87943
|
+
const { QmdMemoryManager } = await import("./qmd-manager-BYC9bX-E.js");
|
|
87944
87944
|
const primary = await QmdMemoryManager.create({
|
|
87945
87945
|
cfg: params.cfg,
|
|
87946
87946
|
agentId: params.agentId,
|
|
@@ -87952,7 +87952,7 @@ async function getMemorySearchManager(params) {
|
|
|
87952
87952
|
const wrapper = new FallbackMemoryManager({
|
|
87953
87953
|
primary,
|
|
87954
87954
|
fallbackFactory: async () => {
|
|
87955
|
-
const { MemoryIndexManager } = await import("./manager-
|
|
87955
|
+
const { MemoryIndexManager } = await import("./manager-yAtdyPwQ.js").then((n) => n.t);
|
|
87956
87956
|
return await MemoryIndexManager.get(params);
|
|
87957
87957
|
}
|
|
87958
87958
|
}, () => {
|
|
@@ -87967,7 +87967,7 @@ async function getMemorySearchManager(params) {
|
|
|
87967
87967
|
}
|
|
87968
87968
|
}
|
|
87969
87969
|
try {
|
|
87970
|
-
const { MemoryIndexManager } = await import("./manager-
|
|
87970
|
+
const { MemoryIndexManager } = await import("./manager-yAtdyPwQ.js").then((n) => n.t);
|
|
87971
87971
|
return { manager: await MemoryIndexManager.get(params) };
|
|
87972
87972
|
} catch (err) {
|
|
87973
87973
|
return {
|
|
@@ -88317,7 +88317,7 @@ const LEGACY_ARCHIVE_DEFAULT_RETENTION_MS = 720 * 60 * 60 * 1e3;
|
|
|
88317
88317
|
const log$25 = createSubsystemLogger("config/sessions/legacy-import/archive");
|
|
88318
88318
|
/** SHA-256 over the file's bytes; null when the file is gone (ENOENT). Other errors propagate. */
|
|
88319
88319
|
async function sourceIdentity(filePath) {
|
|
88320
|
-
const handle = await fs
|
|
88320
|
+
const handle = await fs.open(filePath, "r").catch((error) => {
|
|
88321
88321
|
if (error.code === "ENOENT") return null;
|
|
88322
88322
|
throw error;
|
|
88323
88323
|
});
|
|
@@ -88370,9 +88370,9 @@ function fallbackArchiveDest(source, archiveRoot) {
|
|
|
88370
88370
|
async function copyVerifiedTo(sourcePath, dest, expected) {
|
|
88371
88371
|
const tmp = `${dest}.tmp-${randomUUID()}`;
|
|
88372
88372
|
try {
|
|
88373
|
-
const handle = await fs
|
|
88373
|
+
const handle = await fs.open(tmp, "wx", 384);
|
|
88374
88374
|
try {
|
|
88375
|
-
const sourceHandle = await fs
|
|
88375
|
+
const sourceHandle = await fs.open(sourcePath, "r");
|
|
88376
88376
|
try {
|
|
88377
88377
|
const chunk = Buffer.allocUnsafe(256 * 1024);
|
|
88378
88378
|
let size = 0;
|
|
@@ -88389,18 +88389,18 @@ async function copyVerifiedTo(sourcePath, dest, expected) {
|
|
|
88389
88389
|
} finally {
|
|
88390
88390
|
await handle.close();
|
|
88391
88391
|
}
|
|
88392
|
-
await fs
|
|
88392
|
+
await fs.chmod(tmp, 384);
|
|
88393
88393
|
const copied = await identityOf(tmp);
|
|
88394
88394
|
if (!copied || copied.fingerprint !== expected.fingerprint) throw new Error(`legacy archive cross-device copy diverged from the imported bytes: ${dest}`);
|
|
88395
88395
|
try {
|
|
88396
|
-
await fs
|
|
88396
|
+
await fs.link(tmp, dest);
|
|
88397
88397
|
} catch (error) {
|
|
88398
88398
|
if (error.code !== "EEXIST") throw error;
|
|
88399
88399
|
const existing = await identityOf(dest);
|
|
88400
88400
|
if (!existing || existing.fingerprint !== expected.fingerprint) throw new Error(`legacy archive destination exists with different content: ${dest}`, { cause: error });
|
|
88401
88401
|
}
|
|
88402
88402
|
} finally {
|
|
88403
|
-
await fs
|
|
88403
|
+
await fs.rm(tmp, { force: true });
|
|
88404
88404
|
}
|
|
88405
88405
|
}
|
|
88406
88406
|
/**
|
|
@@ -88416,7 +88416,7 @@ async function planLegacyArchiveDest(source, archiveRoot, expected) {
|
|
|
88416
88416
|
const resolvedRoot = path.resolve(archiveRoot);
|
|
88417
88417
|
const { dir, dest } = archivePathsFor(source, resolvedRoot);
|
|
88418
88418
|
try {
|
|
88419
|
-
await fs
|
|
88419
|
+
await fs.mkdir(dir, {
|
|
88420
88420
|
recursive: true,
|
|
88421
88421
|
mode: 448
|
|
88422
88422
|
});
|
|
@@ -88456,7 +88456,7 @@ async function archiveLegacySource(source, archiveRoot, expected) {
|
|
|
88456
88456
|
*/
|
|
88457
88457
|
async function archiveLegacySourceTo(source, dest, archiveRoot, expected) {
|
|
88458
88458
|
const resolvedRoot = path.resolve(archiveRoot);
|
|
88459
|
-
await fs
|
|
88459
|
+
await fs.mkdir(path.dirname(dest), {
|
|
88460
88460
|
recursive: true,
|
|
88461
88461
|
mode: 448
|
|
88462
88462
|
});
|
|
@@ -88466,14 +88466,14 @@ async function archiveLegacySourceTo(source, dest, archiveRoot, expected) {
|
|
|
88466
88466
|
const expectedIdentity = expected ?? sourceIdentityValue;
|
|
88467
88467
|
if (sourceIdentityValue.fingerprint !== expectedIdentity.fingerprint) throw new Error(`legacy source changed after import; failing closed: ${source.path}`);
|
|
88468
88468
|
const destInodeVerified = async (destPath) => {
|
|
88469
|
-
const [sourceStat, destStat] = await Promise.all([fs
|
|
88469
|
+
const [sourceStat, destStat] = await Promise.all([fs.stat(source.path), fs.stat(destPath).catch(() => void 0)]);
|
|
88470
88470
|
return destStat !== void 0 && destStat.dev === sourceStat.dev && destStat.ino === sourceStat.ino;
|
|
88471
88471
|
};
|
|
88472
88472
|
const moveInto = async (destPath) => {
|
|
88473
88473
|
let moved = false;
|
|
88474
88474
|
let independentArchive = false;
|
|
88475
88475
|
try {
|
|
88476
|
-
await fs
|
|
88476
|
+
await fs.link(source.path, destPath);
|
|
88477
88477
|
moved = true;
|
|
88478
88478
|
} catch (error) {
|
|
88479
88479
|
const code = error.code;
|
|
@@ -88481,7 +88481,7 @@ async function archiveLegacySourceTo(source, dest, archiveRoot, expected) {
|
|
|
88481
88481
|
const existing = await identityOf(destPath);
|
|
88482
88482
|
if (existing && existing.fingerprint === expectedIdentity.fingerprint) {
|
|
88483
88483
|
moved = true;
|
|
88484
|
-
const [sourceStat, destStat] = await Promise.all([fs
|
|
88484
|
+
const [sourceStat, destStat] = await Promise.all([fs.stat(source.path), fs.stat(destPath)]);
|
|
88485
88485
|
independentArchive = sourceStat.dev !== destStat.dev || sourceStat.ino !== destStat.ino;
|
|
88486
88486
|
} else return {
|
|
88487
88487
|
moved: false,
|
|
@@ -88502,13 +88502,13 @@ async function archiveLegacySourceTo(source, dest, archiveRoot, expected) {
|
|
|
88502
88502
|
};
|
|
88503
88503
|
const outcome = await moveInto(dest);
|
|
88504
88504
|
if (outcome.divergent) throw new Error(`legacy archive destination exists with different content: ${dest}`);
|
|
88505
|
-
await fs
|
|
88505
|
+
await fs.chmod(dest, 384);
|
|
88506
88506
|
if (!await destInodeVerified(dest)) {
|
|
88507
88507
|
const archived = await identityOf(dest);
|
|
88508
88508
|
if (!archived || archived.fingerprint !== expectedIdentity.fingerprint) throw new Error(`legacy archive verification failed: ${dest}`);
|
|
88509
88509
|
}
|
|
88510
88510
|
if (outcome.moved) if (outcome.independentArchive) await unlinkSourceIfUnchanged(source.path, expectedIdentity);
|
|
88511
|
-
else await fs
|
|
88511
|
+
else await fs.unlink(source.path);
|
|
88512
88512
|
return dest;
|
|
88513
88513
|
}
|
|
88514
88514
|
/**
|
|
@@ -88522,12 +88522,12 @@ async function unlinkSourceIfUnchanged(sourcePath, expected) {
|
|
|
88522
88522
|
const current = await sourceIdentity(sourcePath);
|
|
88523
88523
|
if (!current) return;
|
|
88524
88524
|
if (current.fingerprint !== expected.fingerprint) throw new Error(`legacy source changed before removal; failing closed: ${sourcePath}`);
|
|
88525
|
-
await fs
|
|
88525
|
+
await fs.unlink(sourcePath);
|
|
88526
88526
|
}
|
|
88527
88527
|
async function chmodDirs(dir, stopAt) {
|
|
88528
88528
|
let current = dir;
|
|
88529
88529
|
while (current.startsWith(stopAt) && current !== stopAt) {
|
|
88530
|
-
await fs
|
|
88530
|
+
await fs.chmod(current, 448).catch(() => void 0);
|
|
88531
88531
|
const parent = path.dirname(current);
|
|
88532
88532
|
if (parent === current) return;
|
|
88533
88533
|
current = parent;
|
|
@@ -88556,11 +88556,11 @@ async function purgeExpiredLegacyArchives(runtime, opts) {
|
|
|
88556
88556
|
log$25.warn("skipping legacy archive outside the archive root", { sourcePath: receipt.sourcePath });
|
|
88557
88557
|
continue;
|
|
88558
88558
|
}
|
|
88559
|
-
if (!await fs
|
|
88559
|
+
if (!await fs.stat(archivePath).then(() => true).catch((error) => {
|
|
88560
88560
|
if (error.code === "ENOENT") return false;
|
|
88561
88561
|
throw error;
|
|
88562
88562
|
})) continue;
|
|
88563
|
-
await fs
|
|
88563
|
+
await fs.rm(archivePath, { force: true });
|
|
88564
88564
|
purged += 1;
|
|
88565
88565
|
await pruneEmptyArchiveDirs(path.dirname(archivePath), archiveRoot);
|
|
88566
88566
|
}
|
|
@@ -88571,12 +88571,12 @@ async function pruneEmptyArchiveDirs(dir, stopAt) {
|
|
|
88571
88571
|
while (current.startsWith(stopAt + path.sep)) {
|
|
88572
88572
|
let entries;
|
|
88573
88573
|
try {
|
|
88574
|
-
entries = await fs
|
|
88574
|
+
entries = await fs.readdir(current);
|
|
88575
88575
|
} catch {
|
|
88576
88576
|
return;
|
|
88577
88577
|
}
|
|
88578
88578
|
if (entries.length > 0) return;
|
|
88579
|
-
await fs
|
|
88579
|
+
await fs.rmdir(current).catch(() => void 0);
|
|
88580
88580
|
current = path.dirname(current);
|
|
88581
88581
|
}
|
|
88582
88582
|
}
|
|
@@ -88859,7 +88859,7 @@ function byPath(a, b) {
|
|
|
88859
88859
|
}
|
|
88860
88860
|
function readDirents(dirPath) {
|
|
88861
88861
|
try {
|
|
88862
|
-
return
|
|
88862
|
+
return syncFs.readdirSync(dirPath, { withFileTypes: true });
|
|
88863
88863
|
} catch {
|
|
88864
88864
|
return [];
|
|
88865
88865
|
}
|
|
@@ -88872,7 +88872,7 @@ function isUnderQuarantine(rootDir, candidatePath) {
|
|
|
88872
88872
|
}
|
|
88873
88873
|
function statSource(filePath) {
|
|
88874
88874
|
try {
|
|
88875
|
-
const stats =
|
|
88875
|
+
const stats = syncFs.statSync(filePath);
|
|
88876
88876
|
if (!stats.isFile()) return;
|
|
88877
88877
|
return {
|
|
88878
88878
|
mtimeMs: stats.mtimeMs,
|
|
@@ -89063,12 +89063,12 @@ async function censusLegacySources(cfg, env) {
|
|
|
89063
89063
|
for (const agentDir of readDirents(agentsRoot).filter((entry) => entry.isDirectory()).toSorted((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0)) {
|
|
89064
89064
|
const agentId = normalizeAgentId(agentDir.name);
|
|
89065
89065
|
const sessionsDir = path.join(agentsRoot, agentDir.name, LEGACY_SESSIONS_DIR_NAME);
|
|
89066
|
-
if (
|
|
89066
|
+
if (syncFs.existsSync(sessionsDir)) censusAgentDir(sessionsDir, agentId);
|
|
89067
89067
|
}
|
|
89068
89068
|
const legacyRoot = path.join(stateDir, LEGACY_SESSIONS_DIR_NAME);
|
|
89069
|
-
if (
|
|
89069
|
+
if (syncFs.existsSync(legacyRoot)) censusAgentDir(legacyRoot, defaultAgent);
|
|
89070
89070
|
const recoveryDir = path.join(stateDir, RECOVERY_DIR_NAME);
|
|
89071
|
-
if (
|
|
89071
|
+
if (syncFs.existsSync(recoveryDir)) censusRecoveryTree(sources, recoveryDir);
|
|
89072
89072
|
return sources.values();
|
|
89073
89073
|
}
|
|
89074
89074
|
/**
|
|
@@ -89152,7 +89152,7 @@ async function admitDurableKeyMappings(registry, listKeys, opts) {
|
|
|
89152
89152
|
await opts?.clearMappingSourcePath?.(mapping.agentId, mapping.sessionId).catch(() => void 0);
|
|
89153
89153
|
continue;
|
|
89154
89154
|
}
|
|
89155
|
-
const stats = await fs
|
|
89155
|
+
const stats = await fs.stat(mapping.sourcePath).catch(() => void 0);
|
|
89156
89156
|
if (!stats?.isFile()) continue;
|
|
89157
89157
|
registry.admit({
|
|
89158
89158
|
path: mapping.sourcePath,
|
|
@@ -89352,7 +89352,7 @@ function createLegacySourceRegistry() {
|
|
|
89352
89352
|
if (!isSettledReceipt(receipt, source.sizeBytes)) trackPendingPath(key, source);
|
|
89353
89353
|
return;
|
|
89354
89354
|
}
|
|
89355
|
-
const stats = await fs
|
|
89355
|
+
const stats = await fs.stat(key).catch(() => void 0);
|
|
89356
89356
|
if (!stats?.isFile() && receipt.status !== "imported") return;
|
|
89357
89357
|
admit({
|
|
89358
89358
|
path: key,
|
|
@@ -89569,12 +89569,12 @@ function canonicalSqliteIdentityPathSync(sqlitePath) {
|
|
|
89569
89569
|
for (let hops = 0; hops < MAX_SYMLINK_HOPS; hops += 1) {
|
|
89570
89570
|
let stats;
|
|
89571
89571
|
try {
|
|
89572
|
-
stats =
|
|
89572
|
+
stats = syncFs.lstatSync(current);
|
|
89573
89573
|
} catch {
|
|
89574
89574
|
return canonicalPathSync(current);
|
|
89575
89575
|
}
|
|
89576
89576
|
if (!stats.isSymbolicLink()) return canonicalPathSync(current);
|
|
89577
|
-
current = path.resolve(canonicalPathSync(path.dirname(current)),
|
|
89577
|
+
current = path.resolve(canonicalPathSync(path.dirname(current)), syncFs.readlinkSync(current));
|
|
89578
89578
|
}
|
|
89579
89579
|
return canonicalPathSync(sqlitePath);
|
|
89580
89580
|
}
|
|
@@ -89588,12 +89588,12 @@ function sleep$1(ms) {
|
|
|
89588
89588
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
89589
89589
|
}
|
|
89590
89590
|
function acquireKernelOwnerLock(lock) {
|
|
89591
|
-
|
|
89591
|
+
syncFs.mkdirSync(path.dirname(lock.lockPath), {
|
|
89592
89592
|
recursive: true,
|
|
89593
89593
|
mode: 448
|
|
89594
89594
|
});
|
|
89595
89595
|
try {
|
|
89596
|
-
|
|
89596
|
+
syncFs.closeSync(syncFs.openSync(lock.lockPath, "wx", 384));
|
|
89597
89597
|
} catch (err) {
|
|
89598
89598
|
if (err.code !== "EEXIST") throw err;
|
|
89599
89599
|
}
|
|
@@ -89627,7 +89627,7 @@ function closeSqliteQuietly(db) {
|
|
|
89627
89627
|
function releaseKernelOwnerLock(lock, db, info) {
|
|
89628
89628
|
try {
|
|
89629
89629
|
const current = readHolderSidecar(lock.sidecarPath);
|
|
89630
|
-
if (current !== void 0 && current.pid === info.pid && current.startedAt === info.startedAt)
|
|
89630
|
+
if (current !== void 0 && current.pid === info.pid && current.startedAt === info.startedAt) syncFs.rmSync(lock.sidecarPath, { force: true });
|
|
89631
89631
|
} finally {
|
|
89632
89632
|
closeSqliteQuietly(db);
|
|
89633
89633
|
}
|
|
@@ -89635,17 +89635,17 @@ function releaseKernelOwnerLock(lock, db, info) {
|
|
|
89635
89635
|
function writeHolderSidecar(sidecarPath, info) {
|
|
89636
89636
|
const temp = `${sidecarPath}.${process.pid}.tmp`;
|
|
89637
89637
|
try {
|
|
89638
|
-
const fd =
|
|
89638
|
+
const fd = syncFs.openSync(temp, "w", 384);
|
|
89639
89639
|
try {
|
|
89640
|
-
|
|
89641
|
-
|
|
89640
|
+
syncFs.writeFileSync(fd, `${JSON.stringify(info)}\n`);
|
|
89641
|
+
syncFs.fsyncSync(fd);
|
|
89642
89642
|
} finally {
|
|
89643
|
-
|
|
89643
|
+
syncFs.closeSync(fd);
|
|
89644
89644
|
}
|
|
89645
|
-
|
|
89645
|
+
syncFs.renameSync(temp, sidecarPath);
|
|
89646
89646
|
} catch (err) {
|
|
89647
89647
|
try {
|
|
89648
|
-
|
|
89648
|
+
syncFs.rmSync(temp, { force: true });
|
|
89649
89649
|
} catch {}
|
|
89650
89650
|
throw err;
|
|
89651
89651
|
}
|
|
@@ -89670,7 +89670,7 @@ function parseHolderSidecar(raw) {
|
|
|
89670
89670
|
function readHolderSidecar(sidecarPath) {
|
|
89671
89671
|
let raw;
|
|
89672
89672
|
try {
|
|
89673
|
-
raw =
|
|
89673
|
+
raw = syncFs.readFileSync(sidecarPath, "utf8");
|
|
89674
89674
|
} catch {
|
|
89675
89675
|
return;
|
|
89676
89676
|
}
|
|
@@ -89681,7 +89681,7 @@ async function readHolderSidecarBriefly(sidecarPath, timeoutMs = 1e3) {
|
|
|
89681
89681
|
for (;;) {
|
|
89682
89682
|
let raw;
|
|
89683
89683
|
try {
|
|
89684
|
-
raw =
|
|
89684
|
+
raw = syncFs.readFileSync(sidecarPath, "utf8");
|
|
89685
89685
|
} catch {
|
|
89686
89686
|
raw = void 0;
|
|
89687
89687
|
}
|
|
@@ -89845,7 +89845,7 @@ async function claimExclusivePartial(destPath) {
|
|
|
89845
89845
|
for (let attempt = 0; attempt < 3; attempt += 1) {
|
|
89846
89846
|
const candidate = `${destPath}.${process.pid}.${randomBytes(8).toString("hex")}.partial`;
|
|
89847
89847
|
try {
|
|
89848
|
-
await (await fs
|
|
89848
|
+
await (await fs.open(candidate, "wx", 384)).close();
|
|
89849
89849
|
return candidate;
|
|
89850
89850
|
} catch (err) {
|
|
89851
89851
|
if (err.code !== "EEXIST") throw err;
|
|
@@ -89864,7 +89864,7 @@ async function backupSqliteSessionDatabase(params) {
|
|
|
89864
89864
|
const dbPath = path.resolve(params.dbPath);
|
|
89865
89865
|
const destPath = path.resolve(params.destPath);
|
|
89866
89866
|
for (const guarded of protectedLivePaths(dbPath)) if (sameFile$1(destPath, guarded)) throw new Error("backup destination must not be the live database or its owner lock, holder sidecar, or journal files");
|
|
89867
|
-
await fs
|
|
89867
|
+
await fs.mkdir(path.dirname(destPath), {
|
|
89868
89868
|
recursive: true,
|
|
89869
89869
|
mode: 448
|
|
89870
89870
|
});
|
|
@@ -89876,14 +89876,14 @@ async function backupSqliteSessionDatabase(params) {
|
|
|
89876
89876
|
gated: sqliteBackupTestHooks.holdWorkerAtGate === true,
|
|
89877
89877
|
writableSource: false
|
|
89878
89878
|
});
|
|
89879
|
-
await fs
|
|
89879
|
+
await fs.rename(partialPath, destPath);
|
|
89880
89880
|
} catch (err) {
|
|
89881
|
-
await fs
|
|
89881
|
+
await fs.rm(partialPath, { force: true }).catch(() => {});
|
|
89882
89882
|
throw err;
|
|
89883
89883
|
}
|
|
89884
89884
|
return {
|
|
89885
89885
|
path: destPath,
|
|
89886
|
-
bytes: (await fs
|
|
89886
|
+
bytes: (await fs.stat(destPath)).size
|
|
89887
89887
|
};
|
|
89888
89888
|
}
|
|
89889
89889
|
|
|
@@ -89905,7 +89905,7 @@ const INCARNATION_SELECT_SQL = "SELECT id FROM ctx_legacy_import_incarnation LIM
|
|
|
89905
89905
|
async function readDbIncarnationId(dbPath) {
|
|
89906
89906
|
let db;
|
|
89907
89907
|
try {
|
|
89908
|
-
await fs
|
|
89908
|
+
await fs.stat(dbPath);
|
|
89909
89909
|
db = new DatabaseSync(dbPath);
|
|
89910
89910
|
const row = db.prepare(INCARNATION_SELECT_SQL).get();
|
|
89911
89911
|
return typeof row?.id === "string" ? row.id : void 0;
|
|
@@ -89957,7 +89957,7 @@ async function takePreImportLegacySnapshot(params) {
|
|
|
89957
89957
|
const marked = await readSnapshotMarker(backupsDir, canonicalDbPath);
|
|
89958
89958
|
if (marked) return marked;
|
|
89959
89959
|
if ((await params.listReceipts()).length > 0) return;
|
|
89960
|
-
await fs
|
|
89960
|
+
await fs.mkdir(backupsDir, {
|
|
89961
89961
|
recursive: true,
|
|
89962
89962
|
mode: 448
|
|
89963
89963
|
});
|
|
@@ -89968,7 +89968,7 @@ async function takePreImportLegacySnapshot(params) {
|
|
|
89968
89968
|
dbPath,
|
|
89969
89969
|
destPath
|
|
89970
89970
|
});
|
|
89971
|
-
if (dbId !== void 0) await fs
|
|
89971
|
+
if (dbId !== void 0) await fs.writeFile(path.join(backupsDir, snapshotMarkerFile(canonicalDbPath)), `${JSON.stringify({
|
|
89972
89972
|
path: backup.path,
|
|
89973
89973
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
89974
89974
|
canonicalDbPath,
|
|
@@ -89986,17 +89986,17 @@ async function takePreImportLegacySnapshot(params) {
|
|
|
89986
89986
|
*/
|
|
89987
89987
|
async function cleanupPartialLegacyBackups(stateDir) {
|
|
89988
89988
|
const backupsDir = path.join(stateDir, "backups");
|
|
89989
|
-
const names = await fs
|
|
89989
|
+
const names = await fs.readdir(backupsDir).catch(() => []);
|
|
89990
89990
|
for (const name of names) {
|
|
89991
89991
|
if (!name.endsWith(".partial")) continue;
|
|
89992
|
-
await fs
|
|
89992
|
+
await fs.rm(path.join(backupsDir, name), { force: true }).catch(() => void 0);
|
|
89993
89993
|
}
|
|
89994
89994
|
}
|
|
89995
89995
|
async function readSnapshotMarker(backupsDir, canonicalDbPath) {
|
|
89996
89996
|
const currentIncarnationId = await readDbIncarnationId(canonicalDbPath);
|
|
89997
89997
|
const keyed = await readMarkerFile(path.join(backupsDir, snapshotMarkerFile(canonicalDbPath)), canonicalDbPath, currentIncarnationId);
|
|
89998
89998
|
if (keyed !== void 0) return keyed;
|
|
89999
|
-
const names = await fs
|
|
89999
|
+
const names = await fs.readdir(backupsDir).catch(() => []);
|
|
90000
90000
|
for (const name of names) {
|
|
90001
90001
|
if (!name.startsWith(SNAPSHOT_MARKER_PREFIX) || !name.endsWith(".json")) continue;
|
|
90002
90002
|
const found = await readMarkerFile(path.join(backupsDir, name), canonicalDbPath, currentIncarnationId);
|
|
@@ -90005,7 +90005,7 @@ async function readSnapshotMarker(backupsDir, canonicalDbPath) {
|
|
|
90005
90005
|
return readMarkerFile(path.join(backupsDir, SNAPSHOT_MARKER_FILE), canonicalDbPath, currentIncarnationId);
|
|
90006
90006
|
}
|
|
90007
90007
|
async function readMarkerFile(markerFile, canonicalDbPath, currentIncarnationId) {
|
|
90008
|
-
const raw = await fs
|
|
90008
|
+
const raw = await fs.readFile(markerFile, "utf8").catch(() => void 0);
|
|
90009
90009
|
if (!raw) return;
|
|
90010
90010
|
try {
|
|
90011
90011
|
const parsed = JSON.parse(raw);
|
|
@@ -90017,7 +90017,7 @@ async function readMarkerFile(markerFile, canonicalDbPath, currentIncarnationId)
|
|
|
90017
90017
|
if (currentIncarnationId !== void 0 && currentIncarnationId === markerId) return markerPath;
|
|
90018
90018
|
return;
|
|
90019
90019
|
}
|
|
90020
|
-
const [markerStat, dbStat] = await Promise.all([fs
|
|
90020
|
+
const [markerStat, dbStat] = await Promise.all([fs.stat(markerDbPath).catch(() => void 0), fs.stat(canonicalDbPath).catch(() => void 0)]);
|
|
90021
90021
|
if (markerStat !== void 0 && dbStat !== void 0 ? markerStat.dev === dbStat.dev && markerStat.ino === dbStat.ino : markerDbPath === canonicalDbPath) return markerPath;
|
|
90022
90022
|
}
|
|
90023
90023
|
} catch {}
|
|
@@ -90283,7 +90283,7 @@ const log$17 = createSubsystemLogger("config/sessions/legacy-import/index-import
|
|
|
90283
90283
|
async function readLegacyIndexStore(storePath) {
|
|
90284
90284
|
let raw;
|
|
90285
90285
|
try {
|
|
90286
|
-
raw = await fs
|
|
90286
|
+
raw = await fs.readFile(storePath, "utf8");
|
|
90287
90287
|
} catch (error) {
|
|
90288
90288
|
throw new Error(`legacy index source unreadable: ${storePath}`, { cause: error });
|
|
90289
90289
|
}
|
|
@@ -90522,7 +90522,7 @@ async function importLegacyIndex(runtime, source, opts = {}) {
|
|
|
90522
90522
|
actorExplicit: entry.actor !== void 0
|
|
90523
90523
|
}), opts.signal);
|
|
90524
90524
|
if (transcriptPath && opts.discoveredTranscripts && path.resolve(transcriptPath) !== path.resolve(source.path)) try {
|
|
90525
|
-
const stats = await fs
|
|
90525
|
+
const stats = await fs.stat(transcriptPath);
|
|
90526
90526
|
if (stats.isFile()) opts.discoveredTranscripts.push({
|
|
90527
90527
|
path: transcriptPath,
|
|
90528
90528
|
kind: "transcript",
|
|
@@ -90638,7 +90638,7 @@ async function loadSessionKeyOverrides(stateDir) {
|
|
|
90638
90638
|
const filePath = path.join(stateDir, "recovery", SESSION_KEY_OVERRIDES_FILENAME);
|
|
90639
90639
|
let raw;
|
|
90640
90640
|
try {
|
|
90641
|
-
raw = await fs
|
|
90641
|
+
raw = await fs.readFile(filePath, "utf8");
|
|
90642
90642
|
} catch (error) {
|
|
90643
90643
|
if (error.code !== "ENOENT") log$15.warn("session key overrides unreadable; ignoring", { error });
|
|
90644
90644
|
return /* @__PURE__ */ new Map();
|
|
@@ -92114,14 +92114,14 @@ function isGatewayArgv(args) {
|
|
|
92114
92114
|
}
|
|
92115
92115
|
function readLinuxCmdline(pid) {
|
|
92116
92116
|
try {
|
|
92117
|
-
return parseProcCmdline(
|
|
92117
|
+
return parseProcCmdline(syncFs.readFileSync(`/proc/${pid}/cmdline`, "utf8"));
|
|
92118
92118
|
} catch {
|
|
92119
92119
|
return null;
|
|
92120
92120
|
}
|
|
92121
92121
|
}
|
|
92122
92122
|
function readLinuxStartTime(pid) {
|
|
92123
92123
|
try {
|
|
92124
|
-
const raw =
|
|
92124
|
+
const raw = syncFs.readFileSync(`/proc/${pid}/stat`, "utf8").trim();
|
|
92125
92125
|
const closeParen = raw.lastIndexOf(")");
|
|
92126
92126
|
if (closeParen < 0) return null;
|
|
92127
92127
|
const fields = raw.slice(closeParen + 1).trim().split(/\s+/);
|
|
@@ -92175,7 +92175,7 @@ async function resolveGatewayOwnerStatus(pid, payload, platform, port) {
|
|
|
92175
92175
|
}
|
|
92176
92176
|
async function readLockPayload(lockPath) {
|
|
92177
92177
|
try {
|
|
92178
|
-
const raw = await fs
|
|
92178
|
+
const raw = await fs.readFile(lockPath, "utf8");
|
|
92179
92179
|
const parsed = JSON.parse(raw);
|
|
92180
92180
|
if (typeof parsed.pid !== "number") return null;
|
|
92181
92181
|
if (typeof parsed.createdAt !== "string") return null;
|
|
@@ -92560,7 +92560,7 @@ async function withMemoryManagerForAgent(params) {
|
|
|
92560
92560
|
}
|
|
92561
92561
|
async function checkReadableFile(pathname) {
|
|
92562
92562
|
try {
|
|
92563
|
-
await fs
|
|
92563
|
+
await fs.access(pathname, syncFs.constants.R_OK);
|
|
92564
92564
|
return { exists: true };
|
|
92565
92565
|
} catch (err) {
|
|
92566
92566
|
const code = err.code;
|
|
@@ -92595,7 +92595,7 @@ async function scanMemoryFiles(workspaceDir, extraPaths = []) {
|
|
|
92595
92595
|
if (alt.issue) issues.push(alt.issue);
|
|
92596
92596
|
const resolvedExtraPaths = normalizeExtraMemoryPaths(workspaceDir, extraPaths);
|
|
92597
92597
|
for (const extraPath of resolvedExtraPaths) try {
|
|
92598
|
-
if ((await fs
|
|
92598
|
+
if ((await fs.lstat(extraPath)).isSymbolicLink()) continue;
|
|
92599
92599
|
const extraCheck = await checkReadableFile(extraPath);
|
|
92600
92600
|
if (extraCheck.issue) issues.push(extraCheck.issue);
|
|
92601
92601
|
} catch (err) {
|
|
@@ -92605,7 +92605,7 @@ async function scanMemoryFiles(workspaceDir, extraPaths = []) {
|
|
|
92605
92605
|
}
|
|
92606
92606
|
let dirReadable = null;
|
|
92607
92607
|
try {
|
|
92608
|
-
await fs
|
|
92608
|
+
await fs.access(memoryDir, syncFs.constants.R_OK);
|
|
92609
92609
|
dirReadable = true;
|
|
92610
92610
|
} catch (err) {
|
|
92611
92611
|
const code = err.code;
|
|
@@ -92653,7 +92653,7 @@ async function summarizeQmdIndexArtifact(manager) {
|
|
|
92653
92653
|
if (!dbPath) return null;
|
|
92654
92654
|
let stat;
|
|
92655
92655
|
try {
|
|
92656
|
-
stat = await fs
|
|
92656
|
+
stat = await fs.stat(dbPath);
|
|
92657
92657
|
} catch (err) {
|
|
92658
92658
|
const code = err.code;
|
|
92659
92659
|
if (code === "ENOENT") throw new Error(`QMD index file not found: ${shortenHomePath(dbPath)}`, { cause: err });
|
|
@@ -93132,7 +93132,7 @@ function createPluginRuntime(options = {}) {
|
|
|
93132
93132
|
workStates: readTaskWorkStates
|
|
93133
93133
|
},
|
|
93134
93134
|
resolveLearningWorkspaceDir: (agentId) => resolveLearningWorkspaceDir(loadConfig(), agentId),
|
|
93135
|
-
sessions: { startUserRun: async (params) => (await import("./user-run-recording-
|
|
93135
|
+
sessions: { startUserRun: async (params) => (await import("./user-run-recording-COpooN64.js").then((n) => n.n)).startUserSessionRun(params) }
|
|
93136
93136
|
};
|
|
93137
93137
|
Object.defineProperty(runtime, "analysis", {
|
|
93138
93138
|
enumerable: true,
|
|
@@ -93175,7 +93175,7 @@ const resolvePluginSdkAliasFile = (params) => {
|
|
|
93175
93175
|
const srcCandidate = path.join(cursor, "src", "plugin-sdk", params.srcFile);
|
|
93176
93176
|
const distCandidate = path.join(cursor, "dist", "plugin-sdk", params.distFile);
|
|
93177
93177
|
const orderedCandidates = isDistRuntime ? [distCandidate, srcCandidate] : isTest ? [distCandidate, srcCandidate] : [distCandidate];
|
|
93178
|
-
for (const candidate of orderedCandidates) if (
|
|
93178
|
+
for (const candidate of orderedCandidates) if (syncFs.existsSync(candidate)) return candidate;
|
|
93179
93179
|
const parent = path.dirname(cursor);
|
|
93180
93180
|
if (parent === cursor) break;
|
|
93181
93181
|
cursor = parent;
|
|
@@ -93728,7 +93728,7 @@ function loadOpenClawPlugins(options = {}) {
|
|
|
93728
93728
|
continue;
|
|
93729
93729
|
}
|
|
93730
93730
|
const safeSource = opened.path;
|
|
93731
|
-
|
|
93731
|
+
syncFs.closeSync(opened.fd);
|
|
93732
93732
|
let mod = null;
|
|
93733
93733
|
try {
|
|
93734
93734
|
mod = getJiti()(safeSource);
|
|
@@ -93891,7 +93891,7 @@ function loadOpenClawPlugins(options = {}) {
|
|
|
93891
93891
|
}
|
|
93892
93892
|
function safeRealpathOrResolve(value) {
|
|
93893
93893
|
try {
|
|
93894
|
-
return
|
|
93894
|
+
return syncFs.realpathSync(value);
|
|
93895
93895
|
} catch {
|
|
93896
93896
|
return path.resolve(value);
|
|
93897
93897
|
}
|
|
@@ -94049,7 +94049,7 @@ function resolvePluginWebSearchProviders(params) {
|
|
|
94049
94049
|
//#endregion
|
|
94050
94050
|
//#region src/agents/apply-patch-update.ts
|
|
94051
94051
|
async function defaultReadFile(filePath) {
|
|
94052
|
-
return fs
|
|
94052
|
+
return fs.readFile(filePath, "utf8");
|
|
94053
94053
|
}
|
|
94054
94054
|
async function applyUpdateHunk(filePath, chunks, options) {
|
|
94055
94055
|
const originalLines = (await (options?.readFile ?? defaultReadFile)(filePath).catch((err) => {
|
|
@@ -94370,7 +94370,7 @@ function resolvePatchFileOps(options) {
|
|
|
94370
94370
|
const workspaceOnly = options.workspaceOnly !== false;
|
|
94371
94371
|
return {
|
|
94372
94372
|
readFile: async (filePath) => {
|
|
94373
|
-
if (!workspaceOnly) return await fs
|
|
94373
|
+
if (!workspaceOnly) return await fs.readFile(filePath, "utf8");
|
|
94374
94374
|
const opened = await openBoundaryFile({
|
|
94375
94375
|
absolutePath: filePath,
|
|
94376
94376
|
rootPath: options.cwd,
|
|
@@ -94378,14 +94378,14 @@ function resolvePatchFileOps(options) {
|
|
|
94378
94378
|
});
|
|
94379
94379
|
assertBoundaryRead(opened, filePath);
|
|
94380
94380
|
try {
|
|
94381
|
-
return
|
|
94381
|
+
return syncFs.readFileSync(opened.fd, "utf8");
|
|
94382
94382
|
} finally {
|
|
94383
|
-
|
|
94383
|
+
syncFs.closeSync(opened.fd);
|
|
94384
94384
|
}
|
|
94385
94385
|
},
|
|
94386
94386
|
writeFile: async (filePath, content) => {
|
|
94387
94387
|
if (!workspaceOnly) {
|
|
94388
|
-
await fs
|
|
94388
|
+
await fs.writeFile(filePath, content, "utf8");
|
|
94389
94389
|
return;
|
|
94390
94390
|
}
|
|
94391
94391
|
const relative = toRelativeSandboxPath(options.cwd, filePath);
|
|
@@ -94396,8 +94396,8 @@ function resolvePatchFileOps(options) {
|
|
|
94396
94396
|
encoding: "utf8"
|
|
94397
94397
|
});
|
|
94398
94398
|
},
|
|
94399
|
-
remove: (filePath) => fs
|
|
94400
|
-
mkdirp: (dir) => fs
|
|
94399
|
+
remove: (filePath) => fs.rm(filePath),
|
|
94400
|
+
mkdirp: (dir) => fs.mkdir(dir, { recursive: true }).then(() => {})
|
|
94401
94401
|
};
|
|
94402
94402
|
}
|
|
94403
94403
|
async function ensureDir(filePath, ops) {
|
|
@@ -94676,7 +94676,7 @@ async function recordLoopOutcome(args) {
|
|
|
94676
94676
|
if (!args.ctx?.sessionKey) return;
|
|
94677
94677
|
try {
|
|
94678
94678
|
const { getDiagnosticSessionState } = await import("./diagnostic-session-state-DJQj3Ka7.js").then((n) => n.n);
|
|
94679
|
-
const { recordToolCallOutcome } = await import("./tool-loop-detection-
|
|
94679
|
+
const { recordToolCallOutcome } = await import("./tool-loop-detection-B0Jj6y2H.js");
|
|
94680
94680
|
recordToolCallOutcome(getDiagnosticSessionState({
|
|
94681
94681
|
sessionKey: args.ctx.sessionKey,
|
|
94682
94682
|
sessionId: args.ctx?.agentId
|
|
@@ -94703,8 +94703,8 @@ async function runBeforeToolCallHook(args) {
|
|
|
94703
94703
|
const params = args.params;
|
|
94704
94704
|
if (args.ctx?.sessionKey) {
|
|
94705
94705
|
const { getDiagnosticSessionState } = await import("./diagnostic-session-state-DJQj3Ka7.js").then((n) => n.n);
|
|
94706
|
-
const { logToolLoopAction } = await import("./diagnostic-
|
|
94707
|
-
const { detectToolCallLoop, recordToolCall } = await import("./tool-loop-detection-
|
|
94706
|
+
const { logToolLoopAction } = await import("./diagnostic-BSnQ1U_E.js").then((n) => n.n);
|
|
94707
|
+
const { detectToolCallLoop, recordToolCall } = await import("./tool-loop-detection-B0Jj6y2H.js");
|
|
94708
94708
|
const sessionState = getDiagnosticSessionState({
|
|
94709
94709
|
sessionKey: args.ctx.sessionKey,
|
|
94710
94710
|
sessionId: args.ctx?.agentId
|
|
@@ -94922,7 +94922,7 @@ function wrapHostEditToolWithPostWriteRecovery(base, root) {
|
|
|
94922
94922
|
if (!pathParam || !newText) throw err;
|
|
94923
94923
|
try {
|
|
94924
94924
|
const absolutePath = resolveHostEditPath(root, pathParam);
|
|
94925
|
-
const content = await fs
|
|
94925
|
+
const content = await fs.readFile(absolutePath, "utf-8");
|
|
94926
94926
|
const hasNew = content.includes(newText);
|
|
94927
94927
|
const stillHasOld = oldText !== void 0 && oldText.length > 0 && content.includes(oldText);
|
|
94928
94928
|
if (hasNew && !stillHasOld) return {
|
|
@@ -95393,14 +95393,14 @@ function createSandboxEditOperations(params) {
|
|
|
95393
95393
|
}
|
|
95394
95394
|
async function writeHostFile(absolutePath, content) {
|
|
95395
95395
|
const resolved = path.resolve(absolutePath);
|
|
95396
|
-
await fs
|
|
95397
|
-
await fs
|
|
95396
|
+
await fs.mkdir(path.dirname(resolved), { recursive: true });
|
|
95397
|
+
await fs.writeFile(resolved, content, "utf-8");
|
|
95398
95398
|
}
|
|
95399
95399
|
function createHostWriteOperations(root, options) {
|
|
95400
95400
|
if (!(options?.workspaceOnly ?? false)) return {
|
|
95401
95401
|
mkdir: async (dir) => {
|
|
95402
95402
|
const resolved = path.resolve(dir);
|
|
95403
|
-
await fs
|
|
95403
|
+
await fs.mkdir(resolved, { recursive: true });
|
|
95404
95404
|
},
|
|
95405
95405
|
writeFile: writeHostFile
|
|
95406
95406
|
};
|
|
@@ -95413,7 +95413,7 @@ function createHostWriteOperations(root, options) {
|
|
|
95413
95413
|
cwd: root,
|
|
95414
95414
|
root
|
|
95415
95415
|
});
|
|
95416
|
-
await fs
|
|
95416
|
+
await fs.mkdir(resolved, { recursive: true });
|
|
95417
95417
|
},
|
|
95418
95418
|
writeFile: async (absolutePath, content) => {
|
|
95419
95419
|
await writeFileWithinRoot({
|
|
@@ -95429,12 +95429,12 @@ function createHostEditOperations(root, options) {
|
|
|
95429
95429
|
if (!(options?.workspaceOnly ?? false)) return {
|
|
95430
95430
|
readFile: async (absolutePath) => {
|
|
95431
95431
|
const resolved = path.resolve(absolutePath);
|
|
95432
|
-
return await fs
|
|
95432
|
+
return await fs.readFile(resolved);
|
|
95433
95433
|
},
|
|
95434
95434
|
writeFile: writeHostFile,
|
|
95435
95435
|
access: async (absolutePath) => {
|
|
95436
95436
|
const resolved = path.resolve(absolutePath);
|
|
95437
|
-
await fs
|
|
95437
|
+
await fs.access(resolved);
|
|
95438
95438
|
}
|
|
95439
95439
|
};
|
|
95440
95440
|
return {
|
|
@@ -96609,9 +96609,9 @@ async function readWorkspaceContextForSummary() {
|
|
|
96609
96609
|
if (!opened.ok) return "";
|
|
96610
96610
|
const sections = extractSections((() => {
|
|
96611
96611
|
try {
|
|
96612
|
-
return
|
|
96612
|
+
return syncFs.readFileSync(opened.fd, "utf-8");
|
|
96613
96613
|
} finally {
|
|
96614
|
-
|
|
96614
|
+
syncFs.closeSync(opened.fd);
|
|
96615
96615
|
}
|
|
96616
96616
|
})(), ["Session Startup", "Red Lines"]);
|
|
96617
96617
|
if (sections.length === 0) return "";
|
|
@@ -98243,14 +98243,14 @@ async function compactEmbeddedPiSessionDirect(params) {
|
|
|
98243
98243
|
if (!apiKeyInfo.apiKey) {
|
|
98244
98244
|
if (apiKeyInfo.mode !== "aws-sdk") throw new Error(`No API key resolved for provider "${model.provider}" (auth mode: ${apiKeyInfo.mode}).`);
|
|
98245
98245
|
} else if (model.provider === "github-copilot") {
|
|
98246
|
-
const { resolveCopilotApiToken } = await import("./github-copilot-token-
|
|
98246
|
+
const { resolveCopilotApiToken } = await import("./github-copilot-token-BJeEWDJb.js").then((n) => n.n);
|
|
98247
98247
|
const copilotToken = await resolveCopilotApiToken({ githubToken: apiKeyInfo.apiKey });
|
|
98248
98248
|
authStorage.setRuntimeApiKey(model.provider, copilotToken.token);
|
|
98249
98249
|
} else authStorage.setRuntimeApiKey(model.provider, apiKeyInfo.apiKey);
|
|
98250
98250
|
} catch (err) {
|
|
98251
98251
|
return fail(describeUnknownError(err));
|
|
98252
98252
|
}
|
|
98253
|
-
await fs
|
|
98253
|
+
await fs.mkdir(resolvedWorkspace, { recursive: true });
|
|
98254
98254
|
const sandboxSessionKey = params.sessionKey?.trim() || params.sessionId;
|
|
98255
98255
|
const sandbox = await resolveSandboxContext({
|
|
98256
98256
|
config: params.config,
|
|
@@ -98259,7 +98259,7 @@ async function compactEmbeddedPiSessionDirect(params) {
|
|
|
98259
98259
|
workspaceLane: params.workspaceLane
|
|
98260
98260
|
});
|
|
98261
98261
|
const effectiveWorkspace = sandbox?.enabled ? sandbox.workspaceAccess === "rw" ? resolvedWorkspace : sandbox.workspaceDir : resolvedWorkspace;
|
|
98262
|
-
await fs
|
|
98262
|
+
await fs.mkdir(effectiveWorkspace, { recursive: true });
|
|
98263
98263
|
let restoreSkillEnv;
|
|
98264
98264
|
const releaseWorkspaceCwd = acquireWorkspaceCwd(effectiveWorkspace);
|
|
98265
98265
|
try {
|
|
@@ -105275,7 +105275,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
105275
105275
|
let embeddedAttemptBegun = false;
|
|
105276
105276
|
const runAbortController = new AbortController();
|
|
105277
105277
|
log$54.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"}`);
|
|
105278
|
-
await fs
|
|
105278
|
+
await fs.mkdir(resolvedWorkspace, { recursive: true });
|
|
105279
105279
|
const sandboxSessionKey = params.sessionKey?.trim() || params.sessionId;
|
|
105280
105280
|
const toolSessionKey = params.toolSessionKey?.trim() || sandboxSessionKey;
|
|
105281
105281
|
const sandbox = params.skipSandbox ? null : await resolveSandboxContext({
|
|
@@ -105285,7 +105285,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
105285
105285
|
workspaceLane: params.workspaceLane
|
|
105286
105286
|
});
|
|
105287
105287
|
const effectiveWorkspace = sandbox?.enabled ? sandbox.workspaceAccess === "rw" ? resolvedWorkspace : sandbox.workspaceDir : resolvedWorkspace;
|
|
105288
|
-
await fs
|
|
105288
|
+
await fs.mkdir(effectiveWorkspace, { recursive: true });
|
|
105289
105289
|
let restoreSkillEnv;
|
|
105290
105290
|
const releaseWorkspaceCwd = params.skipCwdChange ? void 0 : acquireWorkspaceCwd(effectiveWorkspace);
|
|
105291
105291
|
const rawToolResultStash = openRawToolResultStash(params.sessionId);
|
|
@@ -106962,7 +106962,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
106962
106962
|
await copilotTokenState.refreshInFlight;
|
|
106963
106963
|
return;
|
|
106964
106964
|
}
|
|
106965
|
-
const { resolveCopilotApiToken } = await import("./github-copilot-token-
|
|
106965
|
+
const { resolveCopilotApiToken } = await import("./github-copilot-token-BJeEWDJb.js").then((n) => n.n);
|
|
106966
106966
|
copilotTokenState.refreshInFlight = (async () => {
|
|
106967
106967
|
const githubToken = copilotTokenState.githubToken.trim();
|
|
106968
106968
|
if (!githubToken) throw new Error("Copilot refresh requires a GitHub token.");
|
|
@@ -107054,7 +107054,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
107054
107054
|
return;
|
|
107055
107055
|
}
|
|
107056
107056
|
if (model.provider === "github-copilot") {
|
|
107057
|
-
const { resolveCopilotApiToken } = await import("./github-copilot-token-
|
|
107057
|
+
const { resolveCopilotApiToken } = await import("./github-copilot-token-BJeEWDJb.js").then((n) => n.n);
|
|
107058
107058
|
const copilotToken = await resolveCopilotApiToken({ githubToken: apiKeyInfo.apiKey });
|
|
107059
107059
|
authStorage.setRuntimeApiKey(model.provider, copilotToken.token);
|
|
107060
107060
|
if (copilotTokenState) {
|
|
@@ -107176,7 +107176,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
107176
107176
|
const copilotAuthRetry = authRetryPending;
|
|
107177
107177
|
authRetryPending = false;
|
|
107178
107178
|
attemptedThinking.add(thinkLevel);
|
|
107179
|
-
await fs
|
|
107179
|
+
await fs.mkdir(resolvedWorkspace, { recursive: true });
|
|
107180
107180
|
const prompt = provider === "anthropic" ? scrubAnthropicRefusalMagic(params.prompt) : params.prompt;
|
|
107181
107181
|
const attempt = await runEmbeddedAttempt({
|
|
107182
107182
|
sessionId: params.sessionId,
|