import { i as OpenClawConfig, on as AgentDefaultsConfig } from "./types.openclaw-DH5a2ppk.js"; import { a as AuthProfileFailureReason, c as OAuthCredential, d as TokenCredential, i as AuthProfileCredential, n as AuthProfileBlockedReason, o as AuthProfileIdRepairResult, r as AuthProfileBlockedSource, s as AuthProfileStore, t as ApiKeyCredential, u as ProfileUsageStats } from "./types-C021KvTL.js"; import { n as RuntimeEnv } from "./runtime-Bxifh4bY.js"; import { t as PluginManifestRecord } from "./manifest-registry-BCD6e2rb.js"; import { n as PluginMetadataSnapshot } from "./plugin-metadata-snapshot.types-DSa-TOrz.js"; import { o as resolveAgentIdFromSessionKey } from "./session-key-fJM_U9Lv.js"; import { o as SessionEntry } from "./types-Dv0vM7Zp.js"; import { i as VerboseLevel, n as ThinkLevel } from "./thinking.shared-Dn7xz8fk.js"; import { $d as resolvePersistedAuthProfileOwnerAgentDir, $u as prepareSimpleCompletionModel, Ad as resolveAwsSdkEnvVarName, Bd as clearExpiredCooldowns, Cd as MissingProviderAuthError, Cf as AuthCredentialReasonCode, Dd as isMissingProviderAuthError, Df as CLAUDE_CLI_PROFILE_ID, Ed as formatMissingAuthError, Fd as markAuthProfileBlockedUntil, Gu as EmbeddedBlockChunker, Hd as isProfileInCooldown, Id as markAuthProfileCooldown, Ja as AgentCommandResultMetaOverrides, Jd as loadAuthProfileStore, Ju as AgentSimpleCompletionSelection, Ka as AgentCommandIngressOpts, Kd as ensureAuthProfileStoreWithoutExternalProfiles, Ld as markAuthProfileFailure, Md as resolveEnvApiKey, Nd as calculateAuthProfileCooldownMs, Od as isProviderAuthError, Of as CODEX_CLI_PROFILE_ID, Pd as clearAuthProfileCooldown, Qd as replaceRuntimeAuthProfileStoreSnapshots, Qu as completeWithPreparedSimpleCompletionModel, Rd as resolveProfileUnusableUntilForDisplay, Sd as shouldPreferExplicitConfigApiKeyAuth, Sf as resolveProviderIdForAuth, Td as ResolvedProviderAuth, Tf as TokenExpiryState, Ud as clearRuntimeAuthProfileStoreSnapshots, Uf as EmbeddedAgentRunMeta, Vd as getSoonestCooldownExpiry, Wd as ensureAuthProfileStore, Wf as MessagingToolSend, Wu as BlockReplyChunking, Xd as loadAuthProfileStoreForSecretsRuntime, Xu as PreparedSimpleCompletionModelForAgent, Yd as loadAuthProfileStoreForRuntime, Yu as PreparedSimpleCompletionModel, Zd as loadAuthProfileStoreWithoutExternalProfiles, Zu as SimpleCompletionModelOptions, _d as resolveApiKeyForProvider, _f as resolveAuthProfileEligibility, ad as RuntimeProviderAuthLookup, bc as appendCronStyleCurrentTimeLine, bd as resolveProviderEntryApiKeyProfileReference, bf as resetProviderAuthAliasMapCacheForTest, cd as applySecretRefHeaderSentinels, cf as upsertAuthProfileWithLock, dd as getApiKeyForModel, df as refreshOAuthCredentialForRuntime, ed as prepareSimpleCompletionModelForAgent, ef as saveAuthProfileStore, fd as getCustomProviderApiKey, ff as resolveApiKeyForProfile, gd as hasUsableCustomProviderApiKey, gf as AuthProfileEligibilityReasonCode, hd as hasSyntheticLocalProviderAuthConfig, hf as resolveAuthProfileDisplayLabel, id as ProviderEntryApiKeyBindingResolution, if as markAuthProfileSuccess, jd as EnvApiKeyResult, kd as requireApiKey, ld as canUseProfileAsProviderEntryApiKey, lf as dedupeProfileIds, md as hasRuntimeAvailableProviderAuth, mf as formatAuthDoctorHint, nd as ModelAuthMode, nf as repairOAuthProfileIdMismatch, od as applyAuthHeaderOverride, of as setAuthProfileOrder, pd as hasAvailableAuthForProvider, pf as ExternalCliAuthDiscovery, qa as AgentCommandOpts, qd as findPersistedAuthProfileCredential, rd as ProviderCredentialPrecedence, rf as suggestOAuthProfileIdForLegacyDefault, sd as applyLocalNoAuthHeaderOverride, sf as upsertAuthProfile, td as resolveSimpleCompletionSelectionForAgent, ud as createRuntimeProviderAuthLookup, uf as listProfilesForProvider, vd as resolveModelAuthMode, vf as resolveAuthProfileOrder, wd as ProviderAuthError, xc as resolveCronStyleNow, xd as resolveUsableCustomProviderApiKey, xf as resolveProviderAuthAliasMap, yc as CronStyleNow, yd as resolveProviderEntryApiKeyBinding, yf as ProviderAuthAliasLookupParams, zd as resolveProfilesUnavailableReason } from "./types-DIBfaBvi.js"; import { C as readReactionParams, D as scheduleToolProgress, E as readStringParam, O as stringifyToolPayload, S as readPositiveIntegerParam, T as readStringOrNumberParam, _ as parseAvailableTags, a as PublicToolProgress, b as readNonNegativeIntegerParam, c as ToolAuthorizationError, d as createActionGate, f as emitToolProgress, g as normalizeToolModelOverride, h as imageResultFromFile, i as AvailableTag, k as toolProgressResult, l as ToolInputError, m as imageResult, n as AgentToolWithMeta, o as ReactionParams, p as failedTextResult, r as AnyAgentTool, s as StringParamOptions, t as ActionGate, u as asToolParamsRecord, v as payloadTextResult, w as readStringArrayParam, x as readNumberParam, y as readFiniteNumberParam } from "./common-CZ-od2BP.js"; import { n as textResult, t as jsonResult } from "./tool-results-B4PkGwdU.js"; import { N as CliDeps } from "./internal-hooks-DYYCvcTJ.js"; import { a as ModelInputType, i as ModelCatalogEntry, n as DEFAULT_MODEL, r as DEFAULT_PROVIDER, t as DEFAULT_CONTEXT_TOKENS } from "./defaults-CuM4TSj3.js"; import { Ai as AuthStorage, Ci as ModelRegistry, Ii as PluginModelCatalogMetadataSnapshot } from "./index-BDr9c_3B.js"; import { A as listAgentIds, C as resolveSessionAgentIds, D as setAgentEffectiveModelPrimary, E as resolveSubagentModelFallbacksOverride, F as resolveDefaultAgentDir, I as resolveDefaultAgentId, L as hasSessionAutoModelFallbackProvenance, M as resolveAgentContextLimits, N as resolveAgentDir, O as ResolvedAgentConfig, P as resolveAgentWorkspaceDir, S as resolveSessionAgentId, T as resolveSubagentModelConfigSelectionResult, _ as resolveAgentSkillsFilter, a as clearAutoFallbackPrimaryProbeSelection, b as resolveFallbackAgentId, c as hasLegacyAutoFallbackWithoutOrigin, d as resolveAgentExecutionContract, f as resolveAgentExplicitModelPrimary, g as resolveAgentModelPrimary, h as resolveAgentModelFallbacksOverride, i as SubagentModelConfigSelectionSource, j as resolveAgentConfig, k as listAgentEntries, l as markAutoFallbackPrimaryProbe, m as resolveAgentIdsByWorkspacePath, n as AutoFallbackPrimaryProbe, o as entryMatchesAutoFallbackPrimaryProbe, p as resolveAgentIdByWorkspacePath, r as SubagentModelConfigSelectionResult, s as hasConfiguredModelFallbacks, t as AgentModelPrimaryWriteTarget, u as resolveAgentEffectiveModelPrimary, v as resolveAutoFallbackPrimaryProbe, w as resolveSubagentModelConfigSelection, x as resolveRunModelFallbacksOverride, y as resolveEffectiveModelFallbacks } from "./agent-scope-BvKO6GFB.js"; import { d as resolveAgentIdentity, f as resolveEffectiveMessagesConfig, g as resolveResponsePrefix, h as resolveMessagePrefix, m as resolveIdentityNamePrefix, p as resolveHumanDelayConfig, u as resolveAckReaction } from "./ack-reactions-BP5Ijb9Z.js"; import { a as normalizeTimestamp, c as withNormalizedTimestamp, i as formatUserTime, n as TimeFormatPreference, o as resolveUserTimeFormat, r as formatDateStamp, s as resolveUserTimezone, t as ResolvedTimeFormat } from "./date-time-C_aF3jiN.js"; import { o as OutboundSessionContext } from "./delivery-queue-CXf0kDsI.js"; import { l as projectOutboundPayloadPlanForJson } from "./deliver-Dct7lo7t.js"; import { n as AcpSessionResolution, t as AcpSessionManager } from "./manager.core-kw1WBvce.js"; import { a as legacyModelKey, c as normalizeProviderId, i as findNormalizedProviderValue, l as normalizeProviderIdForAuth, n as ModelRef, o as modelKey, r as findNormalizedProviderKey, s as normalizeModelRef, t as ModelManifestNormalizationContext, u as parseModelRef } from "./model-selection-normalize-BTRyyFzH.js"; import { t as resolveOpenClawAgentDir } from "./agent-dir-compat-ochOeoeD.js"; import { a as SerializedDurableMessagePayloadOutcome } from "./send-BgM6BzBo.js"; import { _ as resolveNonEnvSecretRefHeaderValueMarker, a as NON_ENV_SECRETREF_MARKER, c as SECRETREF_ENV_HEADER_MARKER_PREFIX, d as isNonSecretApiKeyMarker, f as isOAuthApiKeyMarker, g as resolveNonEnvSecretRefApiKeyMarker, h as resolveEnvSecretRefHeaderValueMarker, i as MINIMAX_OAUTH_MARKER, l as isAwsSdkAuthMarker, m as listKnownNonSecretApiKeyMarkers, n as CUSTOM_LOCAL_AUTH_MARKER, o as OAUTH_API_KEY_MARKER_PREFIX, p as isSecretRefHeaderValueMarker, r as GCP_VERTEX_CREDENTIALS_MARKER, s as OLLAMA_LOCAL_AUTH_MARKER, t as CODEX_APP_SERVER_AUTH_MARKER, u as isKnownEnvApiKeyMarker, v as resolveOAuthApiKeyMarker } from "./model-auth-markers-BhPapeFt.js"; import { C as normalizeModelSelection, D as resolveModelRefFromString, E as resolveHooksGmailModel, O as resolveThinkingDefault, S as inferUniqueProviderFromConfiguredModels, T as resolveConfiguredModelRef, _ as ModelRefStatus, a as resolveAllowedModelRef, b as buildModelAliasIndex, c as resolveDefaultModelForAgent, d as resolvePersistedSelectedModelRef, f as resolveReasoningDefault, g as ModelAliasIndex, h as isCliProvider, i as normalizeStoredOverrideModel, k as resolveThinkingDefaultWithRuntimeCatalog, l as resolvePersistedModelRef, m as resolveSubagentSpawnModelSelection, n as canonicalizeCaseOnlyCatalogModelRef, o as resolveAllowlistModelKey, p as resolveSubagentConfiguredModelSelection, r as getModelRefStatus, s as resolveConfiguredSubagentSpawnModelSelection, t as buildAllowedModelSet, u as resolvePersistedOverrideModelRef, v as buildConfiguredAllowlistKeys, w as resolveBareModelDefaultProvider, x as inferUniqueProviderFromCatalog, y as buildConfiguredModelCatalog } from "./model-selection-BaEcmlo0.js"; import { c as stripDowngradedToolCallText, u as stripMinimaxToolCallXml } from "./assistant-visible-text-Bo-pttz5.js"; import { a as extractAssistantVisibleText, c as formatReasoningMessage, d as promoteThinkingTagsToBlocks, f as sanitizeAssistantVisibleStreamText, h as stripModelSpecialTokens, i as extractAssistantThinking, l as inferToolMetaFromArgs, m as stripThinkingTagsFromText, n as extractAssistantCommentaryText, o as extractThinkingFromTaggedStream, p as splitThinkingTaggedText, r as extractAssistantText, s as extractThinkingFromTaggedText, t as THINKING_TAG_SCAN_RE, u as isAssistantMessage } from "./embedded-agent-utils-k93ykGZs.js"; import { a as resolveSandboxPath, i as resolveSandboxInputPath, n as assertSandboxPath, o as resolveSandboxedMediaSource, r as resolveAllowedManagedMediaPath, t as assertMediaNotDataUrl } from "./sandbox-paths-DAVxv7sM.js"; import { a as optionalPositiveIntegerSchema, i as optionalNonNegativeIntegerSchema, n as channelTargetsSchema, o as optionalStringEnum, r as optionalFiniteNumberSchema, s as stringEnum, t as channelTargetSchema } from "./typebox-WKHUFEwH.js"; import { a as normalizeCacheKey, c as resolveCacheTtlMs, d as withTimeout, f as writeCache, g as withTrustedWebToolsEndpoint, h as withStrictWebToolsEndpoint, i as ReadResponseTextResult, l as resolvePositiveTimeoutSeconds, m as withSelfHostedWebToolsEndpoint, n as DEFAULT_CACHE_TTL_MINUTES, o as readCache, p as fetchWithWebToolsNetworkGuard, r as DEFAULT_TIMEOUT_SECONDS, s as readResponseText, t as CacheEntry, u as resolveTimeoutSeconds } from "./web-shared-BA33fpFU.js"; import { a as normalizeWhitespace, i as markdownToText, n as extractBasicHtmlContent, o as truncateText, r as htmlToMarkdown, t as ExtractMode } from "./web-fetch-utils-Cx-FHkJu.js"; import { A as setTtsProvider, B as TtsDirectiveParseResult, C as resolveTtsProviderOrder, D as setTtsEnabled, E as setTtsAutoMode, F as textToSpeechStream, I as textToSpeechTelephony, L as ResolvedTtsConfig, M as synthesizeSpeech, N as testApi, O as setTtsMaxLength, P as textToSpeech, R as ResolvedTtsModelOverrides, S as resolveTtsPrefsPath, T as setSummarizationEnabled, _ as listTtsPersonas, a as TtsSynthesisStreamResult, b as resolveTtsAutoMode, c as getLastTtsAttempt, d as getTtsPersona, f as getTtsProvider, g as listSpeechVoices, h as isTtsProviderConfigured, i as TtsSynthesisResult, j as streamSpeech, k as setTtsPersona, l as getResolvedSpeechProviderConfig, m as isTtsEnabled, n as TtsResult, o as TtsTelephonyResult, p as isSummarizationEnabled, r as TtsStreamResult, s as buildTtsSystemPromptHint, u as getTtsMaxLength, v as maybeApplyTtsToPayload, w as setLastTtsAttempt, x as resolveTtsConfig, y as resolveExplicitTtsOverrides, z as TtsDirectiveOverrides } from "./tts-runtime-DwcpSQY7.js"; //#region src/agents/auth-profiles/path-resolve.d.ts /** Resolve the user-facing auth profile database path. */ declare function resolveAuthStorePathForDisplay(agentDir?: string): string; //#endregion //#region src/agents/identity-avatar.d.ts type AgentAvatarResolution = { kind: "none"; reason: string; source?: string; } | { kind: "local"; filePath: string; source: string; } | { kind: "remote"; url: string; source: string; } | { kind: "data"; url: string; source: string; }; type AgentAvatarPublicSourceInput = { kind: AgentAvatarResolution["kind"]; source?: string | null; }; /** Return a safe public description of the configured avatar source. */ declare function resolvePublicAgentAvatarSource(resolved: AgentAvatarPublicSourceInput): string | undefined; /** Resolve the effective avatar for an agent, including config and IDENTITY.md. */ declare function resolveAgentAvatar(cfg: OpenClawConfig, agentId: string, opts?: { includeUiOverride?: boolean; }): AgentAvatarResolution; //#endregion //#region src/agents/agent-auth-credentials.d.ts type AgentApiKeyCredential = { type: "api_key"; key: string; }; type AgentOAuthCredential = { type: "oauth"; access: string; refresh: string; expires: number; }; /** Credential value shape consumed by agent runtimes after auth-profile normalization. */ type AgentCredential = AgentApiKeyCredential | AgentOAuthCredential; type AgentCredentialMap = Record; //#endregion //#region src/agents/agent-auth-discovery-core.d.ts /** Options for discovering env-backed credentials during agent auth discovery. */ type AgentDiscoveryAuthLookupOptions = { config?: OpenClawConfig; workspaceDir?: string; env?: NodeJS.ProcessEnv; }; /** Adds provider credentials resolvable from env/config without mutating existing credentials. */ declare function addEnvBackedAgentCredentials(credentials: AgentCredentialMap, options?: AgentDiscoveryAuthLookupOptions): AgentCredentialMap; //#endregion //#region src/agents/agent-auth-discovery.d.ts /** Options for discovering credentials without prompting for secret material. */ type DiscoverAuthStorageOptions = { externalCli?: ExternalCliAuthDiscovery; readOnly?: boolean; skipExternalAuthProfiles?: boolean; skipCredentials?: boolean; syntheticAuthProviderRefs?: Iterable; } & AgentDiscoveryAuthLookupOptions; /** Resolves agent credentials from auth profiles, env, and synthetic auth hooks. */ declare function resolveAgentCredentialsForDiscovery(agentDir: string, options?: DiscoverAuthStorageOptions): AgentCredentialMap; declare namespace agent_model_discovery_d_exports { export { DiscoverAuthStorageOptions, addEnvBackedAgentCredentials, discoverAuthStorage, discoverModels, normalizeDiscoveredAgentModel, resolveAgentCredentialsForDiscovery }; } type DiscoverModelsOptions = { config?: OpenClawConfig; providerFilter?: string; pluginMetadataSnapshot?: PluginModelCatalogMetadataSnapshot; workspaceDir?: string; normalizeModels?: boolean; }; /** Applies plugin model normalization and transport hooks to discovered agent models. */ declare function normalizeDiscoveredAgentModel(value: T, agentDir: string): T; /** Creates auth storage for model discovery from stored and env-backed credentials. */ /** Builds auth storage for model discovery without prompting for secrets. */ declare function discoverAuthStorage(agentDir: string, options?: DiscoverAuthStorageOptions): AuthStorage; /** Creates the model registry used by agent model discovery. */ /** Creates a model registry for one agent directory, optionally filtered and plugin-normalized. */ declare function discoverModels(authStorage: AuthStorage, agentDir: string, options?: DiscoverModelsOptions): ModelRegistry; //#endregion //#region src/agents/model-catalog-lookup.d.ts /** Returns whether a catalog entry declares support for an input modality. */ declare function modelSupportsInput(entry: ModelCatalogEntry | undefined, input: ModelInputType): boolean; /** Finds a provider-qualified model entry in a catalog. */ declare function findModelInCatalog(catalog: ModelCatalogEntry[], provider: string, modelId: string): ModelCatalogEntry | undefined; /** Finds a model entry, requiring uniqueness when provider is omitted. */ declare function findModelCatalogEntry(catalog: ModelCatalogEntry[], params: { provider?: string; modelId: string; }): ModelCatalogEntry | undefined; //#endregion //#region src/agents/model-catalog.d.ts type AgentDiscoveryModule = typeof agent_model_discovery_d_exports; declare function resetModelCatalogCache(): void; declare function resetModelCatalogCacheForTest(): void; declare function setModelCatalogImportForTest(loader?: () => Promise): void; declare function loadManifestModelCatalog(params: { config: OpenClawConfig; workspaceDir?: string; env?: NodeJS.ProcessEnv; fallbackToMetadataScan?: boolean; metadataSnapshot?: PluginMetadataSnapshot; }): ModelCatalogEntry[]; declare function loadModelCatalog(params?: { config?: OpenClawConfig; useCache?: boolean; cacheOnly?: boolean; readOnly?: boolean; metadataSnapshot?: PluginMetadataSnapshot; }): Promise; /** * Check if a model supports image input based on its catalog entry. */ declare function modelSupportsVision(entry: ModelCatalogEntry | undefined): boolean; /** * Check if a model supports native document/PDF input based on its catalog entry. */ declare function modelSupportsDocument(entry: ModelCatalogEntry | undefined): boolean; //#endregion //#region src/agents/model-catalog-scope.d.ts /** Resolves provider/model refs used to scope model catalog discovery. */ declare function resolveModelCatalogScope(params: { cfg?: OpenClawConfig; provider: string; model: string; }): { providerRefs: string[]; modelRefs: string[]; }; /** Extracts provider ids from resolved catalog scope refs for discovery calls. */ declare function resolveProviderDiscoveryProviderIdsForCatalogScope(params: { providerRefs?: readonly string[]; modelRefs?: readonly string[]; }): string[] | undefined; //#endregion //#region src/tools/types.d.ts /** * Public descriptor contracts for the generic OpenClaw tool planner. * * These types keep tool ownership, execution, availability, and protocol * metadata separate so core, plugins, channels, and MCP servers share one plan. */ /** JSON primitive accepted in descriptor schemas and availability context values. */ type JsonPrimitive = string | number | boolean | null; /** Readonly JSON value accepted by public descriptor metadata. */ type JsonValue = JsonPrimitive | readonly JsonValue[] | { readonly [key: string]: JsonValue; }; /** Readonly JSON object accepted by public descriptor metadata. */ type JsonObject = { readonly [key: string]: JsonValue; }; /** Owner family responsible for defining a tool descriptor. */ type ToolOwnerRef = { readonly kind: "core"; } | { readonly kind: "plugin"; readonly pluginId: string; } | { readonly kind: "channel"; readonly channelId: string; readonly pluginId?: string; } | { readonly kind: "mcp"; readonly serverId: string; }; /** Runtime executor target used after a tool has passed availability planning. */ type ToolExecutorRef = { readonly kind: "core"; readonly executorId: string; } | { readonly kind: "plugin"; readonly pluginId: string; readonly toolName: string; } | { readonly kind: "channel"; readonly channelId: string; readonly actionId: string; } | { readonly kind: "mcp"; readonly serverId: string; readonly toolName: string; }; /** Atomic condition used to decide whether a tool is visible. */ type ToolAvailabilitySignal = { readonly kind: "always"; } | { readonly kind: "auth"; readonly providerId: string; } | { readonly kind: "config"; readonly path: readonly string[]; readonly check?: "exists" | "non-empty" | "available"; } | { readonly kind: "env"; readonly name: string; } | { readonly kind: "plugin-enabled"; readonly pluginId: string; } | { readonly kind: "context"; readonly key: string; readonly equals?: JsonPrimitive; }; /** Boolean expression over tool availability signals. */ type ToolAvailabilityExpression = ToolAvailabilitySignal | { readonly allOf: readonly ToolAvailabilityExpression[]; } | { readonly anyOf: readonly ToolAvailabilityExpression[]; }; /** Public descriptor for a tool before runtime availability planning. */ type ToolDescriptor = { readonly name: string; readonly title?: string; readonly description: string; readonly inputSchema: JsonObject; readonly outputSchema?: JsonObject; readonly owner: ToolOwnerRef; readonly executor?: ToolExecutorRef; readonly availability?: ToolAvailabilityExpression; readonly annotations?: JsonObject; readonly sortKey?: string; }; /** Runtime facts used to evaluate descriptor availability expressions. */ type ToolAvailabilityContext = { readonly authProviderIds?: ReadonlySet; readonly config?: JsonObject; readonly isConfigValueAvailable?: (params: { readonly value: JsonValue; readonly path: readonly string[]; readonly signal: Extract; }) => boolean; readonly env?: Readonly>; readonly enabledPluginIds?: ReadonlySet; readonly values?: Readonly>; }; /** Stable reason code for an unavailable descriptor. */ type ToolUnavailableReason = "auth-missing" | "config-missing" | "context-mismatch" | "env-missing" | "plugin-disabled" | "unsupported-signal"; /** Diagnostic explaining why a descriptor is hidden from the visible plan. */ type ToolAvailabilityDiagnostic = { readonly reason: ToolUnavailableReason; readonly signal?: ToolAvailabilitySignal; readonly message: string; }; /** Visible, callable tool entry selected by the planner. */ type ToolPlanEntry = { readonly descriptor: ToolDescriptor; readonly executor: ToolExecutorRef; }; /** Hidden descriptor plus diagnostics explaining why it is unavailable. */ type HiddenToolPlanEntry = { readonly descriptor: ToolDescriptor; readonly diagnostics: readonly ToolAvailabilityDiagnostic[]; }; /** Complete planner output split into visible and hidden descriptors. */ type ToolPlan = { readonly visible: readonly ToolPlanEntry[]; readonly hidden: readonly HiddenToolPlanEntry[]; }; /** Inputs required to build a tool plan. */ type BuildToolPlanOptions = { readonly descriptors: readonly ToolDescriptor[]; readonly availability?: ToolAvailabilityContext; }; //#endregion //#region src/tools/availability.d.ts /** Evaluate one descriptor against runtime context and return hidden-tool diagnostics. */ declare function evaluateToolAvailability(params: { descriptor: ToolDescriptor; context?: ToolAvailabilityContext; }): readonly ToolAvailabilityDiagnostic[]; //#endregion //#region src/tools/descriptors.d.ts /** * Identity helpers for authoring tool descriptors with stable inferred types. * * Callers use these at declaration sites so descriptor arrays keep readonly * shapes while still validating against the public ToolDescriptor contract. */ /** Define one tool descriptor without changing its runtime shape. */ declare function defineToolDescriptor(descriptor: ToolDescriptor): ToolDescriptor; /** Define a readonly descriptor list without changing runtime order or entries. */ declare function defineToolDescriptors(descriptors: readonly ToolDescriptor[]): readonly ToolDescriptor[]; //#endregion //#region src/tools/diagnostics.d.ts /** * Diagnostics used when descriptor planning violates tool contract invariants. * * These are programmer errors, not availability diagnostics, so callers can * distinguish broken tool registration from intentionally hidden tools. */ /** Stable contract error code emitted by the tool planner. */ type ToolPlanContractErrorCode = "duplicate-tool-name" | "missing-executor"; /** Error thrown when a visible tool plan cannot be built from descriptors. */ declare class ToolPlanContractError extends Error { readonly code: ToolPlanContractErrorCode; readonly toolName: string; constructor(params: { code: ToolPlanContractErrorCode; toolName: string; message: string; }); } //#endregion //#region src/tools/execution.d.ts /** * Formatting helpers for tool executor references. * * Executor refs are closed discriminated unions; the formatted string is for * diagnostics/logging and must not become a parser contract. */ /** Render an executor ref as a compact diagnostic label. */ declare function formatToolExecutorRef(ref: ToolExecutorRef): string; //#endregion //#region src/tools/planner.d.ts /** Build the visible and hidden tool plan for a runtime context. */ declare function buildToolPlan(options: BuildToolPlanOptions): ToolPlan; //#endregion //#region src/tools/protocol.d.ts type ToolProtocolDescriptor = { readonly name: string; readonly description: string; readonly inputSchema: JsonObject; }; declare function toToolProtocolDescriptor(entry: ToolPlanEntry): ToolProtocolDescriptor; declare function toToolProtocolDescriptors(entries: readonly ToolPlanEntry[]): readonly ToolProtocolDescriptor[]; //#endregion //#region src/agents/agent-runtime-config.d.ts /** Loads runtime/source config and resolves command SecretRefs when the agent path needs them. */ declare function resolveAgentRuntimeConfig(runtime: RuntimeEnv, params?: { runtimeTargetsChannelSecrets?: boolean; runtimeChannelSecretScope?: { channel: string; accountId?: string; }; }): Promise<{ loadedRaw: OpenClawConfig; sourceConfig: OpenClawConfig; cfg: OpenClawConfig; }>; //#endregion //#region src/agents/agent-command.d.ts declare function resolveAgentRunLifecycleEndLogLevel(meta: { aborted?: unknown; error?: unknown; stopReason?: unknown; livenessState?: unknown; timeoutPhase?: unknown; providerStarted?: unknown; }): "info" | "warn" | "error" | undefined; declare function resolveExplicitAgentCommandSessionKey(params: { rawExplicitSessionKey?: string; agentIdOverride?: string; shouldScopeDefaultAgentKey?: boolean; cfg: OpenClawConfig; }): string | undefined; declare function prepareAgentCommandExecution(opts: AgentCommandOpts, runtime: RuntimeEnv): Promise<{ opts: AgentCommandOpts; body: string; transcriptBody: string; cfg: OpenClawConfig; configuredThinkingCatalog: ModelCatalogEntry[]; normalizedSpawned: { spawnedBy?: string; groupId?: string; groupChannel?: string; groupSpace?: string; workspaceDir?: string; }; agentCfg: AgentDefaultsConfig | undefined; thinkOverride: ThinkLevel | undefined; thinkOnce: ThinkLevel | undefined; verboseOverride: VerboseLevel | undefined; timeoutMs: number; runTimeoutOverrideMs: number | undefined; sessionId: string; sessionKey: string | undefined; sessionEntry: SessionEntry | undefined; sessionStore: Record | undefined; storePath: string; isNewSession: boolean; persistedThinking: ThinkLevel | undefined; persistedVerbose: VerboseLevel | undefined; sessionAgentId: string; outboundSession: OutboundSessionContext | undefined; workspaceDir: string; cwd: string | undefined; agentDir: string; pluginsEnabled: boolean; manifestMetadataSnapshot: PluginMetadataSnapshot | undefined; modelManifestContext: { manifestPlugins: readonly PluginManifestRecord[]; }; runId: string; isSubagentLane: boolean; acpManager: AcpSessionManager; acpResolution: AcpSessionResolution | null; }>; declare function agentCommandInternal(initialOpts: AgentCommandOpts, runtime?: RuntimeEnv, deps?: CliDeps): Promise<{ payloads: ReturnType; meta: EmbeddedAgentRunMeta & AgentCommandResultMetaOverrides; didSendViaMessagingTool?: boolean; messagingToolSentTexts?: string[]; messagingToolSentMediaUrls?: string[]; messagingToolSentTargets?: MessagingToolSend[]; deliverySucceeded?: boolean; deliveryStatus?: { requested: true; attempted: boolean; status: "sent" | "suppressed" | "partial_failed" | "failed"; succeeded: true | false | "partial"; error?: true; errorMessage?: string; reason?: string; resultCount?: number; sentBeforeError?: true; payloadOutcomes?: SerializedDurableMessagePayloadOutcome[]; }; }>; /** Runs an agent turn from CLI/runtime options against the resolved session and model policy. */ declare function agentCommand(opts: AgentCommandOpts, runtime?: RuntimeEnv, deps?: CliDeps): Promise<{ payloads: ReturnType; meta: EmbeddedAgentRunMeta & AgentCommandResultMetaOverrides; didSendViaMessagingTool?: boolean; messagingToolSentTexts?: string[]; messagingToolSentMediaUrls?: string[]; messagingToolSentTargets?: MessagingToolSend[]; deliverySucceeded?: boolean; deliveryStatus?: { requested: true; attempted: boolean; status: "sent" | "suppressed" | "partial_failed" | "failed"; succeeded: true | false | "partial"; error?: true; errorMessage?: string; reason?: string; resultCount?: number; sentBeforeError?: true; payloadOutcomes?: SerializedDurableMessagePayloadOutcome[]; }; }>; /** Resolve the channel label for model.usage diagnostics from ingress run options. */ declare function ingressDiagnosticChannel(opts: AgentCommandIngressOpts): string; /** * Emit a model.usage diagnostic event after an ingress agent run completes. * * Unlike channel/cron paths which emit model.usage in runReplyAgent / * finalizeCronRun, the ingress path has no such existing emission — without * this every diagnostics consumer (Langfuse bridge, @openclaw/diagnostics-otel, * diagnostics-prometheus) sees usage/cost only for webchat/cli/cron turns * and is blind to HTTP API traffic (POST /v1/responses, POST /v1/chat/completions, * and node-event dispatch). */ declare function emitIngressModelUsageDiagnostic(result: NonNullable>>, opts: AgentCommandIngressOpts): void; /** Runs an agent turn from an inbound channel/gateway ingress context. */ declare function agentCommandFromIngress(opts: AgentCommandIngressOpts, runtime?: RuntimeEnv, deps?: CliDeps): Promise<{ payloads: ReturnType; meta: EmbeddedAgentRunMeta & AgentCommandResultMetaOverrides; didSendViaMessagingTool?: boolean; messagingToolSentTexts?: string[]; messagingToolSentMediaUrls?: string[]; messagingToolSentTargets?: MessagingToolSend[]; deliverySucceeded?: boolean; deliveryStatus?: { requested: true; attempted: boolean; status: "sent" | "suppressed" | "partial_failed" | "failed"; succeeded: true | false | "partial"; error?: true; errorMessage?: string; reason?: string; resultCount?: number; sentBeforeError?: true; payloadOutcomes?: SerializedDurableMessagePayloadOutcome[]; }; }>; declare const testing: { resolveAgentRuntimeConfig: typeof resolveAgentRuntimeConfig; prepareAgentCommandExecution: typeof prepareAgentCommandExecution; resolveExplicitAgentCommandSessionKey: typeof resolveExplicitAgentCommandSessionKey; resolveAgentRunLifecycleEndLogLevel: typeof resolveAgentRunLifecycleEndLogLevel; ingressDiagnosticChannel: typeof ingressDiagnosticChannel; emitIngressModelUsageDiagnostic: typeof emitIngressModelUsageDiagnostic; }; //#endregion export { ActionGate, AgentAvatarResolution, AgentModelPrimaryWriteTarget, AgentSimpleCompletionSelection, AgentToolWithMeta, AnyAgentTool, type ApiKeyCredential, type AuthCredentialReasonCode, type AuthProfileBlockedReason, type AuthProfileBlockedSource, type AuthProfileCredential, type AuthProfileEligibilityReasonCode, type AuthProfileFailureReason, type AuthProfileIdRepairResult, type AuthProfileStore, AutoFallbackPrimaryProbe, AvailableTag, BlockReplyChunking, type BuildToolPlanOptions, CLAUDE_CLI_PROFILE_ID, CODEX_APP_SERVER_AUTH_MARKER, CODEX_CLI_PROFILE_ID, CUSTOM_LOCAL_AUTH_MARKER, CacheEntry, CronStyleNow, DEFAULT_CACHE_TTL_MINUTES, DEFAULT_CONTEXT_TOKENS, DEFAULT_MODEL, DEFAULT_PROVIDER, DEFAULT_TIMEOUT_SECONDS, EmbeddedBlockChunker, type EnvApiKeyResult, ExtractMode, GCP_VERTEX_CREDENTIALS_MARKER, type HiddenToolPlanEntry, type JsonObject, type JsonPrimitive, type JsonValue, MINIMAX_OAUTH_MARKER, MissingProviderAuthError, type ModelAliasIndex, ModelAuthMode, type ModelCatalogEntry, type ModelInputType, type ModelManifestNormalizationContext, type ModelRef, type ModelRefStatus, NON_ENV_SECRETREF_MARKER, OAUTH_API_KEY_MARKER_PREFIX, type OAuthCredential, OLLAMA_LOCAL_AUTH_MARKER, PreparedSimpleCompletionModel, PreparedSimpleCompletionModelForAgent, type ProfileUsageStats, ProviderAuthAliasLookupParams, ProviderAuthError, ProviderCredentialPrecedence, ProviderEntryApiKeyBindingResolution, PublicToolProgress, ReactionParams, ReadResponseTextResult, type ResolvedAgentConfig, type ResolvedProviderAuth, ResolvedTimeFormat, type ResolvedTtsConfig, type ResolvedTtsModelOverrides, RuntimeProviderAuthLookup, SECRETREF_ENV_HEADER_MARKER_PREFIX, SimpleCompletionModelOptions, StringParamOptions, SubagentModelConfigSelectionResult, SubagentModelConfigSelectionSource, THINKING_TAG_SCAN_RE, type ThinkLevel, TimeFormatPreference, type TokenCredential, type TokenExpiryState, ToolAuthorizationError, type ToolAvailabilityContext, type ToolAvailabilityDiagnostic, type ToolAvailabilityExpression, type ToolAvailabilitySignal, type ToolDescriptor, type ToolExecutorRef, ToolInputError, type ToolOwnerRef, type ToolPlan, ToolPlanContractError, type ToolPlanEntry, type ToolUnavailableReason, type TtsDirectiveOverrides, type TtsDirectiveParseResult, type TtsResult, type TtsStreamResult, type TtsSynthesisResult, type TtsSynthesisStreamResult, type TtsTelephonyResult, setModelCatalogImportForTest as __setModelCatalogImportForTest, setModelCatalogImportForTest, testing as __testing, testing, testApi as _test, testApi, agentCommand, agentCommandFromIngress, appendCronStyleCurrentTimeLine, applyAuthHeaderOverride, applyLocalNoAuthHeaderOverride, applySecretRefHeaderSentinels, asToolParamsRecord, assertMediaNotDataUrl, assertSandboxPath, buildAllowedModelSet, buildConfiguredAllowlistKeys, buildConfiguredModelCatalog, buildModelAliasIndex, buildToolPlan, buildTtsSystemPromptHint, calculateAuthProfileCooldownMs, canUseProfileAsProviderEntryApiKey, canonicalizeCaseOnlyCatalogModelRef, channelTargetSchema, channelTargetsSchema, clearAuthProfileCooldown, clearAutoFallbackPrimaryProbeSelection, clearExpiredCooldowns, clearRuntimeAuthProfileStoreSnapshots, completeWithPreparedSimpleCompletionModel, createActionGate, createRuntimeProviderAuthLookup, dedupeProfileIds, defineToolDescriptor, defineToolDescriptors, emitToolProgress, ensureAuthProfileStore, ensureAuthProfileStoreWithoutExternalProfiles, entryMatchesAutoFallbackPrimaryProbe, evaluateToolAvailability, extractAssistantCommentaryText, extractAssistantText, extractAssistantThinking, extractAssistantVisibleText, extractBasicHtmlContent, extractThinkingFromTaggedStream, extractThinkingFromTaggedText, failedTextResult, fetchWithWebToolsNetworkGuard, findModelCatalogEntry, findModelInCatalog, findNormalizedProviderKey, findNormalizedProviderValue, findPersistedAuthProfileCredential, formatAuthDoctorHint, formatDateStamp, formatMissingAuthError, formatReasoningMessage, formatToolExecutorRef, formatUserTime, getApiKeyForModel, getCustomProviderApiKey, getLastTtsAttempt, getModelRefStatus, getResolvedSpeechProviderConfig, getSoonestCooldownExpiry, getTtsMaxLength, getTtsPersona, getTtsProvider, hasAvailableAuthForProvider, hasConfiguredModelFallbacks, hasLegacyAutoFallbackWithoutOrigin, hasRuntimeAvailableProviderAuth, hasSessionAutoModelFallbackProvenance, hasSyntheticLocalProviderAuthConfig, hasUsableCustomProviderApiKey, htmlToMarkdown, imageResult, imageResultFromFile, inferToolMetaFromArgs, inferUniqueProviderFromCatalog, inferUniqueProviderFromConfiguredModels, isAssistantMessage, isAwsSdkAuthMarker, isCliProvider, isKnownEnvApiKeyMarker, isMissingProviderAuthError, isNonSecretApiKeyMarker, isOAuthApiKeyMarker, isProfileInCooldown, isProviderAuthError, isSecretRefHeaderValueMarker, isSummarizationEnabled, isTtsEnabled, isTtsProviderConfigured, jsonResult, legacyModelKey, listAgentEntries, listAgentIds, listKnownNonSecretApiKeyMarkers, listProfilesForProvider, listSpeechVoices, listTtsPersonas, loadAuthProfileStore, loadAuthProfileStoreForRuntime, loadAuthProfileStoreForSecretsRuntime, loadAuthProfileStoreWithoutExternalProfiles, loadManifestModelCatalog, loadModelCatalog, markAuthProfileBlockedUntil, markAuthProfileCooldown, markAuthProfileFailure, markAuthProfileSuccess, markAutoFallbackPrimaryProbe, markdownToText, maybeApplyTtsToPayload, modelKey, modelSupportsDocument, modelSupportsInput, modelSupportsVision, normalizeCacheKey, normalizeModelRef, normalizeModelSelection, normalizeProviderId, normalizeProviderIdForAuth, normalizeStoredOverrideModel, normalizeTimestamp, normalizeToolModelOverride, normalizeWhitespace, optionalFiniteNumberSchema, optionalNonNegativeIntegerSchema, optionalPositiveIntegerSchema, optionalStringEnum, parseAvailableTags, parseModelRef, payloadTextResult, prepareSimpleCompletionModel, prepareSimpleCompletionModelForAgent, promoteThinkingTagsToBlocks, readCache, readFiniteNumberParam, readNonNegativeIntegerParam, readNumberParam, readPositiveIntegerParam, readReactionParams, readResponseText, readStringArrayParam, readStringOrNumberParam, readStringParam, refreshOAuthCredentialForRuntime, repairOAuthProfileIdMismatch, replaceRuntimeAuthProfileStoreSnapshots, requireApiKey, resetModelCatalogCache, resetModelCatalogCacheForTest, resetProviderAuthAliasMapCacheForTest, resolveAckReaction, resolveAgentAvatar, resolveAgentConfig, resolveAgentContextLimits, resolveAgentDir, resolveAgentEffectiveModelPrimary, resolveAgentExecutionContract, resolveAgentExplicitModelPrimary, resolveAgentIdByWorkspacePath, resolveAgentIdFromSessionKey, resolveAgentIdentity, resolveAgentIdsByWorkspacePath, resolveAgentModelFallbacksOverride, resolveAgentModelPrimary, resolveAgentSkillsFilter, resolveAgentWorkspaceDir, resolveAllowedManagedMediaPath, resolveAllowedModelRef, resolveAllowlistModelKey, resolveApiKeyForProfile, resolveApiKeyForProvider, resolveAuthProfileDisplayLabel, resolveAuthProfileEligibility, resolveAuthProfileOrder, resolveAuthStorePathForDisplay, resolveAutoFallbackPrimaryProbe, resolveAwsSdkEnvVarName, resolveBareModelDefaultProvider, resolveCacheTtlMs, resolveConfiguredModelRef, resolveConfiguredSubagentSpawnModelSelection, resolveCronStyleNow, resolveDefaultAgentDir, resolveDefaultAgentId, resolveDefaultModelForAgent, resolveEffectiveMessagesConfig, resolveEffectiveModelFallbacks, resolveEnvApiKey, resolveEnvSecretRefHeaderValueMarker, resolveExplicitTtsOverrides, resolveFallbackAgentId, resolveHooksGmailModel, resolveHumanDelayConfig, resolveIdentityNamePrefix, resolveMessagePrefix, resolveModelAuthMode, resolveModelCatalogScope, resolveModelRefFromString, resolveNonEnvSecretRefApiKeyMarker, resolveNonEnvSecretRefHeaderValueMarker, resolveOAuthApiKeyMarker, resolveOpenClawAgentDir, resolvePersistedAuthProfileOwnerAgentDir, resolvePersistedModelRef, resolvePersistedOverrideModelRef, resolvePersistedSelectedModelRef, resolvePositiveTimeoutSeconds, resolveProfileUnusableUntilForDisplay, resolveProfilesUnavailableReason, resolveProviderAuthAliasMap, resolveProviderDiscoveryProviderIdsForCatalogScope, resolveProviderEntryApiKeyBinding, resolveProviderEntryApiKeyProfileReference, resolveProviderIdForAuth, resolvePublicAgentAvatarSource, resolveReasoningDefault, resolveResponsePrefix, resolveRunModelFallbacksOverride, resolveSandboxInputPath, resolveSandboxPath, resolveSandboxedMediaSource, resolveSessionAgentId, resolveSessionAgentIds, resolveSimpleCompletionSelectionForAgent, resolveSubagentConfiguredModelSelection, resolveSubagentModelConfigSelection, resolveSubagentModelConfigSelectionResult, resolveSubagentModelFallbacksOverride, resolveSubagentSpawnModelSelection, resolveThinkingDefault, resolveThinkingDefaultWithRuntimeCatalog, resolveTimeoutSeconds, resolveTtsAutoMode, resolveTtsConfig, resolveTtsPrefsPath, resolveTtsProviderOrder, resolveUsableCustomProviderApiKey, resolveUserTimeFormat, resolveUserTimezone, sanitizeAssistantVisibleStreamText, saveAuthProfileStore, scheduleToolProgress, setAgentEffectiveModelPrimary, setAuthProfileOrder, setLastTtsAttempt, setSummarizationEnabled, setTtsAutoMode, setTtsEnabled, setTtsMaxLength, setTtsPersona, setTtsProvider, shouldPreferExplicitConfigApiKeyAuth, splitThinkingTaggedText, streamSpeech, stringEnum, stringifyToolPayload, stripDowngradedToolCallText, stripMinimaxToolCallXml, stripModelSpecialTokens, stripThinkingTagsFromText, suggestOAuthProfileIdForLegacyDefault, synthesizeSpeech, textResult, textToSpeech, textToSpeechStream, textToSpeechTelephony, toToolProtocolDescriptor, toToolProtocolDescriptors, toolProgressResult, truncateText, upsertAuthProfile, upsertAuthProfileWithLock, withNormalizedTimestamp, withSelfHostedWebToolsEndpoint, withStrictWebToolsEndpoint, withTimeout, withTrustedWebToolsEndpoint, writeCache };