UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

90 lines (89 loc) 26 kB
import { A as resolveExpiresAtMsFromEpochSeconds, C as parseStrictNonNegativeInteger, M as resolveNonNegativeIntegerOption, O as resolveExpiresAtMsFromDurationOrEpoch, S as parseStrictInteger, T as positiveSecondsToSafeMilliseconds, _ as nonNegativeSecondsToSafeMilliseconds, b as parseFiniteNumber, h as finiteSecondsToTimerSafeMilliseconds, k as resolveExpiresAtMsFromDurationSeconds, m as clampTimerTimeoutMs, n as MAX_TIMER_TIMEOUT_MS, r as MAX_TIMER_TIMEOUT_SECONDS, w as parseStrictPositiveInteger, x as parseStrictFiniteNumber } from "../number-coercion-CLj0HTDM.js"; import { c as stringifyNonErrorCause, i as extractErrorCode, l as toErrorObject, n as collectErrorGraphCandidates, s as readErrorName } from "../error-coercion-D_-xJ90S.js"; import { a as resolveOsHomeRelativePath, c as resolveUserPath, i as resolveOsHomeDir, n as resolveEffectiveHomeDir, o as resolveRequiredHomeDir, r as resolveHomeRelativePath, s as resolveRequiredOsHomeDir, t as expandHomePrefix } from "../home-dir-BPhrG-aM.js"; import { n as isVitestRuntimeEnv, t as isFastTestRuntimeEnv } from "../test-runtime-env-DQDRzsLt.js"; import { a as normalizeZaiEnv, i as normalizeEnv, n as isTruthyEnvValue, o as resolveEnvNormalizationKeys, r as logAcceptedEnvOption, t as expandEnvNormalizationKeys } from "../env-M3R40TOb.js"; import { n as isErrno, t as hasErrnoCode } from "../errno-CkbDOfLk.js"; import { A as writeExternalFileWithinRoot, C as resolveRegularFileAppendFlags, D as walkDirectory, E as statRegularFileSync, L as sanitizeUntrustedFileName, O as walkDirectorySync, S as resolveOpenedFileRealPathForHandle, T as statRegularFile, _ as readRegularFileSync, a as canonicalPathFromExistingAncestor, b as resolveAbsolutePathForWrite, c as isPathInside, d as pathExists, f as pathExistsSync, g as readRegularFile, h as readLocalFileSafely, i as assertAbsolutePathInput, j as writeFileWithinRoot, k as withTimeout, l as movePathToTrash, m as readLocalFileFromRoots, n as appendRegularFile, o as ensureAbsoluteDirectory, p as readFileWithinRoot, r as appendRegularFileSync, s as findExistingAncestor, t as FsSafeError, u as openLocalFileSafely, v as readSecureFile, w as root, x as resolveLocalPathFromRootsSync, y as resolveAbsolutePathForRead } from "../fs-safe-B6pvPGnf.js"; import { a as resolveRetryConfig, n as computeBackoff, s as sleepWithAbort } from "../src-BQ327IOM.js"; import { t as pruneMapToMaxSize } from "../map-size-CNcWiFKu.js"; import { r as formatUncaughtError, t as formatErrorMessage } from "../errors-Db3Ymjlb.js"; import { f as isDiagnosticsEnabled, m as onDiagnosticEvent, n as emitDiagnosticEvent, t as areDiagnosticsEnabledForProcess } from "../diagnostic-events-Cwe92uV3.js"; import { n as resolvePreferredOpenClawTmpDir, t as DEFAULT_POSIX_TMP_ROOT } from "../tmp-openclaw-dir-DnyL0lW9.js"; import { _ as writeJsonSync, a as readJsonFile, c as readJsonIfExists, d as readRootJsonSync, f as readRootStructuredFileSync, g as writeJsonAtomic, h as writeJson, i as readJson, l as readJsonSync, m as tryReadJsonSync, n as createAsyncLock, o as readJsonFileStrict, p as tryReadJson, r as readDurableJsonFile, s as readJsonFileSync, t as JsonFileReadError, u as readRootJsonObjectSync, v as writeTextAtomic } from "../json-files-Bq1lIlQB.js"; import { n as matchesDiagnosticFlag, r as resolveDiagnosticFlags, t as isDiagnosticFlagEnabled } from "../diagnostic-flags-qVPAqdVk.js"; import { n as resolveGlobalDedupeCache, t as createDedupeCache } from "../dedupe-gst1CUro.js"; import { t as retryAsync } from "../retry-DIUON3ys.js"; import { a as generateSecureUuid, i as generateSecureToken, n as generateSecureHex, r as generateSecureInt, t as generateSecureFraction } from "../secure-random-Ds4AFLgz.js"; import { a as isRequestBodyLimitError, c as requestBodyErrorToText, i as installRequestBodyLimitGuard, l as testApi, n as DEFAULT_WEBHOOK_MAX_BODY_BYTES, o as readJsonBodyWithLimit, r as RequestBodyLimitError, s as readRequestBodyWithLimit, t as DEFAULT_WEBHOOK_BODY_TIMEOUT_MS } from "../http-body-D3IMwTJJ.js"; import { _ as resolvePolicyTargetResolution, a as parseExecArgvToken, c as resolveApprovalAuditTrustPath, d as resolveExecutableTrustPath, f as resolveExecutionTargetCandidatePath, g as resolvePolicyTargetCandidatePath, h as resolvePolicyAllowlistCandidatePath, i as matchAllowlist, l as resolveCommandResolution, m as resolveExecutionTargetTrustPath, o as resolveAllowlistCandidatePath, p as resolveExecutionTargetResolution, s as resolveApprovalAuditCandidatePath, u as resolveCommandResolutionFromArgv, v as resolvePolicyTargetTrustPath } from "../exec-command-resolution-B6e6Gzk8.js"; import { i as drainFileLockStateForTest, n as FILE_LOCK_TIMEOUT_ERROR_CODE, o as resetFileLockStateForTest, r as acquireFileLock, s as withFileLock } from "../file-lock-B0wiaenm.js"; import "../file-lock-DPooFrLa.js"; import { t as runTasksWithConcurrency } from "../run-with-concurrency-Dtu208ef.js"; import { a as resetWSLStateForTests, i as isWSLSync, n as isWSL2Sync, r as isWSLEnv, t as isWSL } from "../wsl-DjKrZ_YH.js"; import { a as matchesNoProxy, c as shouldUseEnvHttpProxyForUrl, i as hasProxyEnvConfigured, n as hasEnvHttpProxyAgentConfigured, o as resolveEnvHttpProxyAgentOptions, r as hasEnvHttpProxyConfigured, s as resolveEnvHttpProxyUrl, t as PROXY_ENV_KEYS } from "../proxy-env-BepksPz2.js"; import { a as forceResetGlobalDispatcher, i as ensureGlobalUndiciStreamTimeouts, n as ensureGlobalUndiciDispatcherStreamTimeouts, o as globalUndiciStreamTimeoutMs, r as ensureGlobalUndiciEnvProxyDispatcher, s as resetGlobalUndiciStreamTimeoutsForTests, t as DEFAULT_UNDICI_STREAM_TIMEOUT_MS } from "../undici-global-dispatcher-D_vsOTZK.js"; import { n as buildTimeoutAbortSignal, r as fetchWithTimeout, t as bindAbortRelay } from "../fetch-timeout-DGxOi-Tg.js"; import "../backoff-BkMI1WEL.js"; import { t as normalizeHostname } from "../hostname-_16721Le.js"; import { _ as resolvePinnedHostnameWithPolicy, a as createPinnedDispatcher, b as ssrfPolicyFromHttpBaseUrlAllowedOrigin, c as isBlockedHostnameOrIp, d as isPrivateNetworkAllowedByPolicy, f as isSameSsrFPolicy, g as resolvePinnedHostname, h as normalizeHostnameAllowlist, i as closeDispatcher, l as isHostnameAllowedByPattern, m as mergeSsrFPolicies, n as assertHostnameAllowedWithPolicy, o as createPinnedLookup, p as matchesHostnameAllowlist, r as assertPublicHostname, s as isBlockedHostname, t as SsrFBlockedError, u as isPrivateIpAddress, v as resolveSsrFPolicyForUrl, x as ssrfPolicyFromHttpBaseUrlFakeIpHostnameAllowlist, y as ssrfPolicyFromHttpBaseUrlAllowedHostname } from "../ssrf-0QyXWOVG.js"; import { a as retainSafeHeadersForCrossOriginRedirectHeaders, c as withTrustedExplicitProxyGuardedFetchMode, i as fetchWithSsrFGuard, o as withStrictGuardedFetchMode, s as withTrustedEnvProxyGuardedFetchMode, t as GUARDED_FETCH_MODE } from "../fetch-guard-BMdGQhbb.js"; import { n as fetchWithRuntimeDispatcher } from "../runtime-fetch-D7UijuA3.js"; import { a as enqueueSystemEvent, c as hasSystemEvents, d as peekSystemEvents, f as resetSystemEventsForTest, i as drainSystemEvents, l as isSystemEventContextChanged, n as consumeSystemEventEntries, o as enqueueSystemEventEntry, p as resolveSystemEventDeliveryContext, r as drainSystemEventEntries, t as consumeSelectedSystemEventEntries, u as peekSystemEventEntries } from "../system-events-C03jsM0j.js"; import { i as formatDurationSeconds, n as formatDurationHuman, r as formatDurationPrecise, t as formatDurationCompact } from "../format-duration-CeDWULoS.js"; import { a as safeFileURLToPath, i as isWindowsNetworkPath, n as basenameFromMediaSource, o as trySafeFileURLToPath, r as hasEncodedFileUrlSeparator, t as assertNoWindowsNetworkPath } from "../local-file-access-B1HKoQAc.js"; import { S as resolveExecPolicyForMode, _ as normalizeExecSecurity, a as maxAsk, b as resolveExecModeFromPolicy, c as requiresExecApproval, d as resolveExecApprovalUnavailableDecisions, f as DEFAULT_EXEC_APPROVAL_TIMEOUT_MS, g as normalizeExecMode, h as normalizeExecHost, i as isExecApprovalDecisionAllowed, l as resolveExecApprovalAllowedDecisions, m as normalizeExecAsk, n as OPTIONAL_EXEC_APPROVAL_DECISIONS, o as minSecurity, p as EXEC_TARGET_VALUES, r as commandRequiresSecurityAuditSuppressionApproval, s as normalizeExecApprovalUnavailableDecisions, t as DEFAULT_EXEC_APPROVAL_DECISIONS, u as resolveExecApprovalRequestAllowedDecisions, v as normalizeExecTarget, x as resolveExecModePolicy, y as requireValidExecTarget } from "../exec-approvals-policy-CCFUzTzd.js"; import { t as stripInternalRuntimeScaffolding } from "../protocol-scaffolding-3qpaR6Vn.js"; import { a as PLUGIN_APPROVAL_DETAIL_MAX_LENGTH, c as buildPluginApprovalExpiredMessage, d as resolvePluginApprovalRequestAllowedDecisions, f as resolvePluginApprovalTimeoutMs, i as PLUGIN_APPROVAL_DESCRIPTION_MAX_LENGTH, l as buildPluginApprovalRequestMessage, n as DEFAULT_PLUGIN_APPROVAL_TIMEOUT_MS, o as PLUGIN_APPROVAL_TITLE_MAX_LENGTH, p as truncatePluginApprovalDetail, r as MAX_PLUGIN_APPROVAL_TIMEOUT_MS, s as approvalDecisionLabel, t as DEFAULT_PLUGIN_APPROVAL_DECISIONS, u as buildPluginApprovalResolvedMessage } from "../plugin-approvals-BUrr4V_c.js"; import { a as mergeExecApprovalsSocketDefaults, c as resolveExecApprovalsDisplayPath, d as resolveExecApprovalsTranscriptPath, l as resolveExecApprovalsPath, t as DEFAULT_EXEC_APPROVAL_ASK_FALLBACK, u as resolveExecApprovalsSocketPath } from "../exec-approvals-config-D1lCGl0_.js"; import { b as resolveAllowAlwaysPatternCoverage, d as addAllowlistEntry, f as addDurableCommandApproval, g as hasNodeCommandAllowAlwaysMarker, h as hasExactCommandDurableExecApproval, i as resolveExecApprovalsFromFile, l as recordAllowlistMatchesUse, m as hasDurableExecApproval, o as requestExecApprovalViaSocket, r as resolveExecApprovals, t as normalizeExecApprovals, u as recordAllowlistUse, v as persistAllowAlwaysDecision, x as resolveAllowAlwaysPersistenceDecision, y as persistAllowAlwaysPatterns } from "../exec-approvals-BSZ-fPIY.js"; import { c as restoreExecApprovalsSnapshot, o as readExecApprovalsSnapshot, r as loadExecApprovals, t as ensureExecApprovals, u as saveExecApprovals } from "../exec-approvals-store-DBR0neS0.js"; import { a as isWindowsPlatform, i as analyzeWindowsShellCommand, n as resolvePlannedSegmentArgv, o as tokenizeWindowsSegment, r as analyzeArgvCommand, s as windowsEscapeArg, t as buildEnforcedShellCommand } from "../exec-approvals-analysis-CaqIBAfQ.js"; import { a as isSafeBinUsage, c as resolveAllowAlwaysPatterns, i as evaluateShellAllowlistWithAuthorization, l as resolveSafeBins, n as evaluateExecAllowlistWithAuthorization, o as normalizeSafeBins, r as evaluateShellAllowlist, s as resolveAllowAlwaysPatternEntries, t as evaluateExecAllowlist } from "../exec-approvals-allowlist-CdzK4JhM.js"; import { i as resolveHeartbeatIntervalMs } from "../heartbeat-config-DYNUPVum.js"; import { n as resolveHeartbeatSummaryForAgent, t as isHeartbeatEnabledForAgent } from "../heartbeat-summary-DTnNVs3l.js"; import { n as hasSystemMark, r as prefixSystemMessage, t as SYSTEM_MARK } from "../system-message-Dltw0_t9.js"; import { i as normalizeScpRemotePath, n as isSafeScpRemotePath, r as normalizeScpRemoteHost, t as isSafeScpRemoteHost } from "../scp-host-3FoHUz1i.js"; import { i as resolveProxyFetchFromEnv, n as getProxyUrlFromFetch, r as makeProxyFetch, t as PROXY_FETCH_PROXY_URL } from "../proxy-fetch-BdRrrR-3.js"; import { n as wrapFetchWithAbortSignal, t as resolveFetch } from "../fetch-Dg9e8ALx.js"; import { n as createChannelApiRetryRunner, r as createRateLimitRetryRunner, t as CHANNEL_API_RETRY_DEFAULTS } from "../retry-policy-DL52fgP1.js"; import { a as loadSecretFileSync, c as tryReadSecretFileSync, l as writePrivateSecretFileAtomic, n as PRIVATE_SECRET_DIR_MODE, r as PRIVATE_SECRET_FILE_MODE, s as readSecretFileSync, t as DEFAULT_SECRET_FILE_MAX_BYTES } from "../secret-file-QljTRMYg.js"; import { n as recordChannelActivity, t as getChannelActivity } from "../channel-activity-KGHrbxIK.js"; import { n as hasLegacyFlatAllowPrivateNetworkAlias, r as migrateLegacyFlatAllowPrivateNetworkAlias, t as createLegacyPrivateNetworkDoctorContract } from "../legacy-private-network-migration-BRP8RBAq.js"; import { t as formatApprovalDisplayPath } from "../approval-display-paths-DlQSsCnq.js"; import { a as buildExecApprovalPendingReplyPayload, c as buildTypedApprovalActionDescriptors, d as buildTypedExecApprovalPresentation, f as formatExecApprovalExpiresIn, h as parseExecApprovalCommandText, i as buildExecApprovalCommandText, l as buildTypedApprovalPresentation, m as getExecApprovalReplyMetadata, n as buildApprovalPresentationFromActionDescriptors, o as buildExecApprovalPresentation, p as getExecApprovalApproverDmNoticeText, r as buildExecApprovalActionDescriptors, s as buildExecApprovalUnavailableReplyPayload, t as buildApprovalButtonPresentation, u as buildTypedExecApprovalPendingReplyPayload } from "../exec-approval-reply-ZdeEqz7J.js"; import { i as resolveExecApprovalSessionTarget, n as resolveApprovalRequestSessionConversation, r as resolveApprovalRequestSessionTarget, t as resolveApprovalRequestOriginTarget } from "../exec-approval-session-target-DNWnKqhD.js"; import { a as isExecApprovalChannelRuntimeTerminalStartError, i as createExecApprovalChannelRuntime, n as deliverApprovalRequestViaChannelNativePlan, o as resolveChannelNativeApprovalDeliveryPlan, r as ExecApprovalChannelRuntimeTerminalStartError, t as createChannelNativeApprovalRuntime } from "../approval-native-runtime-DVAlcchD.js"; import { t as resolveExecApprovalCommandDisplay } from "../exec-approval-command-display-03IqfHT_.js"; import { n as createRuntimeOutboundDelegates } from "../runtime-forwarders-9t5PoUxv.js"; import { n as resolveAgentOutboundIdentity, t as normalizeOutboundIdentity } from "../identity-DgagocEO.js"; import { n as resolveOutboundSendDep, t as resolveLegacyOutboundSendDepKeys } from "../send-deps-DjbvQHZ4.js"; import { t as sanitizeForPlainText } from "../sanitize-text-BNoGtAII.js"; import { t as drainPendingDeliveries } from "../delivery-queue-runtime-DL-6ae5z.js"; import { t as waitForTransportReady } from "../transport-ready-BdAEbBNK.js"; import { a as resolveIndicatorType, i as resetHeartbeatEventsForTest, n as getLastHeartbeatEvent, r as onHeartbeatEvent, t as emitHeartbeatEvent } from "../heartbeat-events-bg9alNGv.js"; import { t as resolveHeartbeatVisibility } from "../heartbeat-visibility-UVwDVBL7.js"; import { a as normalizeHostnameSuffixAllowlist, c as ssrfPolicyFromPrivateNetworkOptIn, i as isPrivateNetworkOptInEnabled, n as buildHostnameAllowlistPolicyFromSuffixAllowlist, o as ssrfPolicyFromAllowPrivateNetwork, r as isHttpsUrlAllowedByHostnameSuffixAllowlist, s as ssrfPolicyFromDangerouslyAllowPrivateNetwork, t as assertHttpUrlTargetsPrivateNetwork } from "../ssrf-policy-BiJHiKmw.js"; //#region src/plugin-sdk/infra-runtime.ts /** * @deprecated Compatibility shim only. Keep old plugins working, but do not * add new imports here and do not use this subpath from repo code. * Prefer injected runtime APIs or documented typed-public subpaths instead. */ /** * @deprecated Shipped compat only; preserves the old substring semantics for * external plugins. Core chat classification now maps canonical failover * reasons (see gateway resolveChatErrorKindFromError). Removal with the next * plugin-SDK major. */ function detectErrorKind(err) { if (err === void 0) return; const message = formatErrorMessage(err).toLowerCase(); const code = extractErrorCode(err)?.toLowerCase(); if (message.includes("refusal") || message.includes("content_filter") || message.includes("sensitive") || message.includes("unhandled stop reason: refusal_policy")) return "refusal"; if (message.includes("rate limit") || message.includes("too many requests") || message.includes("429") || code === "429") return "rate_limit"; if (message.includes("timeout") || code === "etimedout" || code === "timeout") return "timeout"; if (message.includes("context length") || message.includes("too many tokens") || message.includes("token limit") || message.includes("context_window")) return "context_length"; } //#endregion export { CHANNEL_API_RETRY_DEFAULTS, DEFAULT_EXEC_APPROVAL_ASK_FALLBACK, DEFAULT_EXEC_APPROVAL_DECISIONS, DEFAULT_EXEC_APPROVAL_TIMEOUT_MS, DEFAULT_PLUGIN_APPROVAL_DECISIONS, DEFAULT_PLUGIN_APPROVAL_TIMEOUT_MS, DEFAULT_POSIX_TMP_ROOT, DEFAULT_SECRET_FILE_MAX_BYTES, DEFAULT_UNDICI_STREAM_TIMEOUT_MS, DEFAULT_WEBHOOK_BODY_TIMEOUT_MS, DEFAULT_WEBHOOK_MAX_BODY_BYTES, EXEC_TARGET_VALUES, ExecApprovalChannelRuntimeTerminalStartError, FILE_LOCK_TIMEOUT_ERROR_CODE, FsSafeError, GUARDED_FETCH_MODE, JsonFileReadError, MAX_PLUGIN_APPROVAL_TIMEOUT_MS, MAX_TIMER_TIMEOUT_MS, MAX_TIMER_TIMEOUT_SECONDS, OPTIONAL_EXEC_APPROVAL_DECISIONS, PLUGIN_APPROVAL_DESCRIPTION_MAX_LENGTH, PLUGIN_APPROVAL_DETAIL_MAX_LENGTH, PLUGIN_APPROVAL_TITLE_MAX_LENGTH, PRIVATE_SECRET_DIR_MODE, PRIVATE_SECRET_FILE_MODE, PROXY_ENV_KEYS, PROXY_FETCH_PROXY_URL, RequestBodyLimitError, SYSTEM_MARK, SsrFBlockedError, testApi as __test__, testApi, acquireFileLock, addAllowlistEntry, addDurableCommandApproval, analyzeArgvCommand, analyzeWindowsShellCommand, appendRegularFile, appendRegularFileSync, approvalDecisionLabel, areDiagnosticsEnabledForProcess, assertAbsolutePathInput, assertHostnameAllowedWithPolicy, assertHttpUrlTargetsPrivateNetwork, assertNoWindowsNetworkPath, assertPublicHostname, basenameFromMediaSource, bindAbortRelay, buildApprovalButtonPresentation, buildApprovalPresentationFromActionDescriptors, buildEnforcedShellCommand, buildExecApprovalActionDescriptors, buildExecApprovalCommandText, buildExecApprovalPendingReplyPayload, buildExecApprovalPresentation, buildExecApprovalUnavailableReplyPayload, buildHostnameAllowlistPolicyFromSuffixAllowlist, buildPluginApprovalExpiredMessage, buildPluginApprovalRequestMessage, buildPluginApprovalResolvedMessage, buildTimeoutAbortSignal, buildTypedApprovalActionDescriptors, buildTypedApprovalPresentation, buildTypedExecApprovalPendingReplyPayload, buildTypedExecApprovalPresentation, canonicalPathFromExistingAncestor, clampTimerTimeoutMs, closeDispatcher, collectErrorGraphCandidates, commandRequiresSecurityAuditSuppressionApproval, computeBackoff, consumeSelectedSystemEventEntries, consumeSystemEventEntries, createAsyncLock, createChannelApiRetryRunner, createChannelNativeApprovalRuntime, createDedupeCache, createExecApprovalChannelRuntime, createLegacyPrivateNetworkDoctorContract, createPinnedDispatcher, createPinnedLookup, createRateLimitRetryRunner, createRuntimeOutboundDelegates, deliverApprovalRequestViaChannelNativePlan, detectErrorKind, drainFileLockStateForTest, drainPendingDeliveries, drainSystemEventEntries, drainSystemEvents, emitDiagnosticEvent, emitHeartbeatEvent, enqueueSystemEvent, enqueueSystemEventEntry, ensureAbsoluteDirectory, ensureExecApprovals, ensureGlobalUndiciDispatcherStreamTimeouts, ensureGlobalUndiciEnvProxyDispatcher, ensureGlobalUndiciStreamTimeouts, evaluateExecAllowlist, evaluateExecAllowlistWithAuthorization, evaluateShellAllowlist, evaluateShellAllowlistWithAuthorization, expandEnvNormalizationKeys, expandHomePrefix, extractErrorCode, fetchWithRuntimeDispatcher, fetchWithSsrFGuard, fetchWithTimeout, findExistingAncestor, finiteSecondsToTimerSafeMilliseconds, forceResetGlobalDispatcher, formatApprovalDisplayPath, formatDurationCompact, formatDurationHuman, formatDurationPrecise, formatDurationSeconds, formatErrorMessage, formatExecApprovalExpiresIn, formatUncaughtError, generateSecureFraction, generateSecureHex, generateSecureInt, generateSecureToken, generateSecureUuid, getChannelActivity, getExecApprovalApproverDmNoticeText, getExecApprovalReplyMetadata, getLastHeartbeatEvent, getProxyUrlFromFetch, globalUndiciStreamTimeoutMs, hasDurableExecApproval, hasEncodedFileUrlSeparator, hasEnvHttpProxyAgentConfigured, hasEnvHttpProxyConfigured, hasErrnoCode, hasExactCommandDurableExecApproval, hasLegacyFlatAllowPrivateNetworkAlias, hasNodeCommandAllowAlwaysMarker, hasProxyEnvConfigured, hasSystemEvents, hasSystemMark, installRequestBodyLimitGuard, isBlockedHostname, isBlockedHostnameOrIp, isDiagnosticFlagEnabled, isDiagnosticsEnabled, isErrno, isExecApprovalChannelRuntimeTerminalStartError, isExecApprovalDecisionAllowed, isFastTestRuntimeEnv, isHeartbeatEnabledForAgent, isHostnameAllowedByPattern, isHttpsUrlAllowedByHostnameSuffixAllowlist, isPathInside, isPrivateIpAddress, isPrivateNetworkAllowedByPolicy, isPrivateNetworkOptInEnabled, isRequestBodyLimitError, isSafeBinUsage, isSafeScpRemoteHost, isSafeScpRemotePath, isSameSsrFPolicy, isSystemEventContextChanged, isTruthyEnvValue, isVitestRuntimeEnv, isWSL, isWSL2Sync, isWSLEnv, isWSLSync, isWindowsNetworkPath, isWindowsPlatform, loadExecApprovals, loadSecretFileSync, logAcceptedEnvOption, makeProxyFetch, matchAllowlist, matchesDiagnosticFlag, matchesHostnameAllowlist, matchesNoProxy, maxAsk, mergeExecApprovalsSocketDefaults, mergeSsrFPolicies, migrateLegacyFlatAllowPrivateNetworkAlias, minSecurity, movePathToTrash, nonNegativeSecondsToSafeMilliseconds, normalizeEnv, normalizeExecApprovalUnavailableDecisions, normalizeExecApprovals, normalizeExecAsk, normalizeExecHost, normalizeExecMode, normalizeExecSecurity, normalizeExecTarget, normalizeHostname, normalizeHostnameAllowlist, normalizeHostnameSuffixAllowlist, normalizeOutboundIdentity, normalizeSafeBins, normalizeScpRemoteHost, normalizeScpRemotePath, normalizeZaiEnv, onDiagnosticEvent, onHeartbeatEvent, openLocalFileSafely, parseExecApprovalCommandText, parseExecArgvToken, parseFiniteNumber, parseStrictFiniteNumber, parseStrictInteger, parseStrictNonNegativeInteger, parseStrictPositiveInteger, pathExists, pathExistsSync, peekSystemEventEntries, peekSystemEvents, persistAllowAlwaysDecision, persistAllowAlwaysPatterns, positiveSecondsToSafeMilliseconds, prefixSystemMessage, pruneMapToMaxSize, readDurableJsonFile, readErrorName, readExecApprovalsSnapshot, readFileWithinRoot, readJson, readJsonBodyWithLimit, readJsonFile, readJsonFileStrict, readJsonFileSync, readJsonIfExists, readJsonSync, readLocalFileFromRoots, readLocalFileSafely, readRegularFile, readRegularFileSync, readRequestBodyWithLimit, readRootJsonObjectSync, readRootJsonSync, readRootStructuredFileSync, readSecretFileSync, readSecureFile, recordAllowlistMatchesUse, recordAllowlistUse, recordChannelActivity, requestBodyErrorToText, requestExecApprovalViaSocket, requireValidExecTarget, requiresExecApproval, resetFileLockStateForTest, resetGlobalUndiciStreamTimeoutsForTests, resetHeartbeatEventsForTest, resetSystemEventsForTest, resetWSLStateForTests, resolveAbsolutePathForRead, resolveAbsolutePathForWrite, resolveAgentOutboundIdentity, resolveAllowAlwaysPatternCoverage, resolveAllowAlwaysPatternEntries, resolveAllowAlwaysPatterns, resolveAllowAlwaysPersistenceDecision, resolveAllowlistCandidatePath, resolveApprovalAuditCandidatePath, resolveApprovalAuditTrustPath, resolveApprovalRequestOriginTarget, resolveApprovalRequestSessionConversation, resolveApprovalRequestSessionTarget, resolveChannelNativeApprovalDeliveryPlan, resolveCommandResolution, resolveCommandResolutionFromArgv, resolveNonNegativeIntegerOption as resolveDedupeNonNegativeInteger, resolveDiagnosticFlags, resolveEffectiveHomeDir, resolveEnvHttpProxyAgentOptions, resolveEnvHttpProxyUrl, resolveEnvNormalizationKeys, resolveExecApprovalAllowedDecisions, resolveExecApprovalCommandDisplay, resolveExecApprovalRequestAllowedDecisions, resolveExecApprovalSessionTarget, resolveExecApprovalUnavailableDecisions, resolveExecApprovals, resolveExecApprovalsDisplayPath, resolveExecApprovalsFromFile, resolveExecApprovalsPath, resolveExecApprovalsSocketPath, resolveExecApprovalsTranscriptPath, resolveExecModeFromPolicy, resolveExecModePolicy, resolveExecPolicyForMode, resolveExecutableTrustPath, resolveExecutionTargetCandidatePath, resolveExecutionTargetResolution, resolveExecutionTargetTrustPath, resolveExpiresAtMsFromDurationOrEpoch, resolveExpiresAtMsFromDurationSeconds, resolveExpiresAtMsFromEpochSeconds, resolveFetch, resolveGlobalDedupeCache, resolveHeartbeatIntervalMs, resolveHeartbeatSummaryForAgent, resolveHeartbeatVisibility, resolveHomeRelativePath, resolveIndicatorType, resolveLegacyOutboundSendDepKeys, resolveLocalPathFromRootsSync, resolveOpenedFileRealPathForHandle, resolveOsHomeDir, resolveOsHomeRelativePath, resolveOutboundSendDep, resolvePinnedHostname, resolvePinnedHostnameWithPolicy, resolvePlannedSegmentArgv, resolvePluginApprovalRequestAllowedDecisions, resolvePluginApprovalTimeoutMs, resolvePolicyAllowlistCandidatePath, resolvePolicyTargetCandidatePath, resolvePolicyTargetResolution, resolvePolicyTargetTrustPath, resolvePreferredOpenClawTmpDir, resolveProxyFetchFromEnv, resolveRegularFileAppendFlags, resolveRequiredHomeDir, resolveRequiredOsHomeDir, resolveRetryConfig, resolveSafeBins, resolveSsrFPolicyForUrl, resolveSystemEventDeliveryContext, resolveUserPath, restoreExecApprovalsSnapshot, retainSafeHeadersForCrossOriginRedirectHeaders, retryAsync, root, runTasksWithConcurrency, safeFileURLToPath, sanitizeForPlainText, sanitizeUntrustedFileName, saveExecApprovals, shouldUseEnvHttpProxyForUrl, sleepWithAbort, ssrfPolicyFromAllowPrivateNetwork, ssrfPolicyFromDangerouslyAllowPrivateNetwork, ssrfPolicyFromHttpBaseUrlAllowedHostname, ssrfPolicyFromHttpBaseUrlAllowedOrigin, ssrfPolicyFromHttpBaseUrlFakeIpHostnameAllowlist, ssrfPolicyFromPrivateNetworkOptIn, statRegularFile, statRegularFileSync, stringifyNonErrorCause, stripInternalRuntimeScaffolding, toErrorObject, tokenizeWindowsSegment, truncatePluginApprovalDetail, tryReadJson, tryReadJsonSync, tryReadSecretFileSync, trySafeFileURLToPath, waitForTransportReady, walkDirectory, walkDirectorySync, windowsEscapeArg, withFileLock, withStrictGuardedFetchMode, withTimeout, withTrustedEnvProxyGuardedFetchMode, withTrustedExplicitProxyGuardedFetchMode, wrapFetchWithAbortSignal, writeExternalFileWithinRoot, writeFileWithinRoot, writeJson, writeJsonAtomic, writeJsonSync, writePrivateSecretFileAtomic, writeTextAtomic };