import { i as OpenClawConfig } from "./types.openclaw-CpnoYlBx.js"; import { createLoggerBackedRuntime } from "./runtime-logger.js"; import { n as buildTimeoutAbortSignal } from "./fetch-timeout-D2yvPshT.js"; import { ZodType, z } from "zod"; //#region src/utils/zod-parse.d.ts /** * Null-returning Zod parse helpers for plugin and runtime boundaries. * * Callers use these where invalid external payloads should be ignored or * recovered from without constructing and catching validation errors. */ /** Safely validates an unknown value with a Zod schema, returning null on validation failure. */ declare function safeParseWithSchema(schema: ZodType, value: unknown): T | null; /** Parses JSON, then safely validates it with a Zod schema, returning null for parse or schema failures. */ declare function safeParseJsonWithSchema(schema: ZodType, raw: string): T | null; //#endregion //#region src/plugin-sdk/extension-shared.d.ts type PassiveChannelStatusSnapshot = { configured?: boolean; running?: boolean; lastStartAt?: number | null; lastStopAt?: number | null; lastError?: string | null; probe?: unknown; lastProbeAt?: number | null; }; type TrafficStatusSnapshot = { lastInboundAt?: number | null; lastOutboundAt?: number | null; }; type StoppableMonitor = { stop: () => void; }; type RequireOpenAllowFromFn = (params: { policy?: string; allowFrom?: Array; ctx: z.RefinementCtx; path: Array; message: string; }) => void; /** * Builds the standard passive-channel status object used by plugin status surfaces. * Missing lifecycle fields are normalized to stable defaults so callers can merge * plugin-specific extras without leaking `undefined` into status responses. */ declare function buildPassiveChannelStatusSummary(snapshot: PassiveChannelStatusSnapshot, extra?: TExtra): { configured: boolean; } & TExtra & { running: boolean; lastStartAt: number | null; lastStopAt: number | null; lastError: string | null; }; /** Adds probe state to the standard passive-channel status summary. */ declare function buildPassiveProbedChannelStatusSummary(snapshot: PassiveChannelStatusSnapshot, extra?: TExtra): { configured: boolean; } & TExtra & { probe: unknown; lastProbeAt: number | null; running: boolean; lastStartAt: number | null; lastStopAt: number | null; lastError: string | null; }; /** Normalizes optional traffic timestamps for channel status payloads. */ declare function buildTrafficStatusSummary(snapshot?: TrafficStatusSnapshot | null): { lastInboundAt: number | null; lastOutboundAt: number | null; }; /** * Runs a passive monitor until the supplied abort signal fires, then calls `stop()`. * This adapts simple plugin monitors to the shared passive account lifecycle. */ declare function runStoppablePassiveMonitor(params: { abortSignal: AbortSignal; start: () => Promise; }): Promise; /** * Returns the provided runtime or creates a logger-backed fallback for monitor-only paths. * The fallback cannot exit the process, so command/runtime callers should inject a real runtime. */ declare function resolveLoggerBackedRuntime(runtime: TRuntime | undefined, logger: Parameters[0]["logger"]): TRuntime; /** Applies the shared validation rule for open DM policies that require wildcard allowlists. */ declare function requireChannelOpenAllowFrom(params: { channel: string; policy?: string; allowFrom?: Array; ctx: z.RefinementCtx; requireOpenAllowFrom: RequireOpenAllowFromFn; }): void; /** Extracts a fixed set of fields from unknown status issue payloads without trusting shape. */ declare function readStatusIssueFields(value: unknown, fields: readonly TField[]): Record | null; /** Converts string or numeric account identifiers from status issue payloads to strings. */ declare function coerceStatusIssueAccountId(value: unknown): string | undefined; /** Creates a promise with externally controlled resolve/reject hooks for async handoff code. */ declare function createDeferred(): { promise: Promise; resolve: (value: T | PromiseLike) => void; reject: (reason?: unknown) => void; }; type PackageJsonRequire = (id: string) => unknown; type PluginConfigIssuePathSegment = string | number; type PluginConfigIssue = { path: PluginConfigIssuePathSegment[]; message: string; }; type PluginConfigIssueMessageOptions = { invalidConfigMessage?: string; unknownKeyMessage?: (key: string) => string; rootInvalidTypeMessage?: string; }; /** Formats Zod plugin-config issues into stable user-facing status messages. */ declare function formatPluginConfigIssue(issue: z.ZodIssue | undefined, options?: PluginConfigIssueMessageOptions): string; /** Keeps only string/number path segments so config issue paths stay JSON-safe. */ declare function normalizePluginConfigIssuePath(path: readonly unknown[]): PluginConfigIssuePathSegment[]; /** Converts raw Zod issues into the plugin status issue shape used by bundled channels. */ declare function mapPluginConfigIssues(issues: readonly z.ZodIssue[], options?: PluginConfigIssueMessageOptions): PluginConfigIssue[]; /** Checks whether a read-only plugin path may resolve a secret through an env provider. */ declare function canResolveEnvSecretRefInReadOnlyPath(params: { cfg?: OpenClawConfig; provider: string; id: string; }): boolean; /** Reads plugin package versions across source, bundled, and test layouts with a fallback. */ declare function readPluginPackageVersion(params: { require: PackageJsonRequire; candidates?: readonly string[]; fallback?: string; }): string; /** * Builds an ambient Node proxy agent when proxy env/config is active. * Managed proxy CA trust is attached when available; creation errors are reported * through `onError` and otherwise degrade to no agent. */ declare function resolveAmbientNodeProxyAgent(params?: { onError?: (error: unknown) => void; onUsingProxy?: () => void; protocol?: "http" | "https"; }): Promise; //#endregion export { buildPassiveChannelStatusSummary, buildPassiveProbedChannelStatusSummary, buildTimeoutAbortSignal, buildTrafficStatusSummary, canResolveEnvSecretRefInReadOnlyPath, coerceStatusIssueAccountId, createDeferred, formatPluginConfigIssue, mapPluginConfigIssues, normalizePluginConfigIssuePath, readPluginPackageVersion, readStatusIssueFields, requireChannelOpenAllowFrom, resolveAmbientNodeProxyAgent, resolveLoggerBackedRuntime, runStoppablePassiveMonitor, safeParseJsonWithSchema, safeParseWithSchema };