import { n as OpenResult } from "./root-impl-DRXbHPA1.js"; import { n as FileStoreSync, t as FileStore } from "./file-store-Gb3fO3aL.js"; import fs from "node:fs"; import fs$1 from "node:fs/promises"; //#region node_modules/@openclaw/fs-safe/dist/root-paths.d.ts type InvalidPathResult = { ok: false; error: string; }; type ResolvePathsWithinRootParams = { rootDir: string; requestedPaths: string[]; scopeLabel: string; }; type ResolvePathsWithinRootResult = { ok: true; paths: string[]; } | InvalidPathResult; type PathScopeResolveOptions = { defaultName?: string; }; type PathScopeOptions = { label: string; }; type PathScope = { rootDir: string; label: string; resolve(requestedPath: string, options?: PathScopeResolveOptions): { ok: true; path: string; } | { ok: false; error: string; }; resolveAll(requestedPaths: string[]): ResolvePathsWithinRootResult; existing(requestedPaths: string[]): Promise; files(requestedPaths: string[]): Promise; writable(requestedPath: string, options?: PathScopeResolveOptions): Promise<{ ok: true; path: string; } | { ok: false; error: string; }>; ensureDir(requestedPath: string, options?: PathScopeResolveOptions & { mode?: number; }): Promise<{ ok: true; path: string; } | { ok: false; error: string; }>; }; declare function resolvePathWithinRoot(params: { rootDir: string; requestedPath: string; scopeLabel: string; defaultFileName?: string; }): { ok: true; path: string; } | { ok: false; error: string; }; declare function resolveWritablePathWithinRoot(params: { rootDir: string; requestedPath: string; scopeLabel: string; defaultFileName?: string; }): Promise<{ ok: true; path: string; } | { ok: false; error: string; }>; declare function resolvePathsWithinRoot(params: ResolvePathsWithinRootParams): ResolvePathsWithinRootResult; declare function resolveExistingPathsWithinRoot(params: ResolvePathsWithinRootParams): Promise; declare function resolveStrictExistingPathsWithinRoot(params: ResolvePathsWithinRootParams): Promise; declare function pathScope(rootDir: string, options: PathScopeOptions): PathScope; //#endregion //#region node_modules/@openclaw/fs-safe/dist/symlink-parents.d.ts type AssertNoSymlinkParentsOptions = { rootDir: string; targetPath: string; allowMissing?: boolean; allowOutsideRoot?: boolean; allowRootChildSymlink?: boolean; requireDirectories?: boolean; messagePrefix?: string; }; declare function assertNoSymlinkParents(params: AssertNoSymlinkParentsOptions): Promise; declare function assertNoSymlinkParentsSync(params: AssertNoSymlinkParentsOptions): void; //#endregion //#region node_modules/@openclaw/fs-safe/dist/sibling-temp.d.ts type WriteSiblingTempFileOptions = { dir: string; writeTemp: (tempPath: string) => Promise; resolveFinalPath: (result: T) => string; tempPrefix?: string; dirMode?: number; chmodDir?: boolean; mode?: number; syncTempFile?: boolean; syncParentDir?: boolean; }; type WriteSiblingTempFileResult = { filePath: string; result: T; }; declare function writeSiblingTempFile(options: WriteSiblingTempFileOptions): Promise>; declare function writeViaSiblingTempPath(params: { rootDir: string; targetPath: string; writeTemp: (tempPath: string) => Promise; fallbackFileName?: string; tempPrefix?: string; }): Promise; //#endregion //#region src/security/channel-metadata.d.ts /** * Build bounded, externally wrapped channel metadata for prompt context. * Channel-provided labels can be user-controlled, so callers must treat this as untrusted content. */ declare function buildUntrustedChannelMetadata(params: { source: string; label: string; entries: Array; maxChars?: number; }): string | undefined; //#endregion //#region src/security/safe-regex.d.ts type SafeRegexRejectReason = "empty" | "unsafe-nested-repetition" | "invalid-regex"; type SafeRegexCompileResult = { regex: RegExp; source: string; flags: string; reason: null; } | { regex: null; source: string; flags: string; reason: SafeRegexRejectReason; }; declare function testRegexWithBoundedInput(regex: RegExp, input: string, maxWindow?: number): boolean; declare function hasNestedRepetition(source: string): boolean; declare function compileSafeRegexDetailed(source: string, flags?: string): SafeRegexCompileResult; declare function compileSafeRegex(source: string, flags?: string): RegExp | null; //#endregion //#region src/infra/private-file-store.d.ts type PrivateFileStore = FileStore; /** Create an async private file store rooted at `rootDir`. */ declare function privateFileStore(rootDir: string): FileStore; type PrivateFileStoreSync = FileStoreSync; /** Create a sync private file store rooted at `rootDir`. */ declare function privateFileStoreSync(rootDir: string): PrivateFileStoreSync; //#endregion //#region node_modules/@openclaw/fs-safe/dist/replace-file.d.ts type ReplaceFileAtomicFileSystem = { promises: Pick; }; type ReplaceFileAtomicSyncFileSystem = Pick; type ReplaceFileAtomicBaseOptions = { filePath: string; content: string | Uint8Array; dirMode?: number; mode?: number; preserveExistingMode?: boolean; tempPrefix?: string; renameMaxRetries?: number; renameRetryBaseDelayMs?: number; copyFallbackOnPermissionError?: boolean; syncTempFile?: boolean; syncParentDir?: boolean; throwOnCleanupError?: boolean; }; type ReplaceFileAtomicOptions = ReplaceFileAtomicBaseOptions & { fileSystem?: ReplaceFileAtomicFileSystem; beforeRename?: (params: { filePath: string; tempPath: string; }) => Promise; }; type ReplaceFileAtomicSyncOptions = ReplaceFileAtomicBaseOptions & { fileSystem?: ReplaceFileAtomicSyncFileSystem; beforeRename?: (params: { filePath: string; tempPath: string; }) => void; }; type ReplaceFileAtomicResult = { method: "rename" | "copy-fallback"; }; declare function replaceFileAtomic$1(options: ReplaceFileAtomicOptions): Promise; declare function replaceFileAtomicSync(options: ReplaceFileAtomicSyncOptions): ReplaceFileAtomicResult; //#endregion //#region node_modules/@openclaw/fs-safe/dist/move-path.d.ts type MovePathWithCopyFallbackOptions$1 = { from: string; sourceHardlinks?: "allow" | "reject"; to: string; }; //#endregion //#region src/infra/replace-file.d.ts /** Atomic file replacement primitive re-exported through the fs-safe defaults shim. */ declare const replaceFileAtomic: typeof replaceFileAtomic$1; /** Options for moving paths while optionally rejecting hardlinked source files. */ type MovePathWithCopyFallbackOptions = MovePathWithCopyFallbackOptions$1 & { sourceHardlinks?: "allow" | "reject"; }; /** * Moves a path using fs-safe's copy fallback, with an OpenClaw hardlink guard * for install/update flows that must not preserve package-manager links. */ declare function movePathWithCopyFallback(options: MovePathWithCopyFallbackOptions): Promise; //#endregion //#region src/security/secret-equal.d.ts /** Compare two optional UTF-8 secrets without leaking length through timingSafeEqual errors. */ declare function safeEqualSecret(provided: string | undefined | null, expected: string | undefined | null): boolean; //#endregion //#region src/plugin-sdk/security-runtime.d.ts /** Safely open a path beneath a trusted root while rejecting hardlinks and unsafe symlinks by default. */ declare function openFileWithinRoot(params: { rootDir: string; relativePath: string; rejectHardlinks?: boolean; nonBlockingRead?: boolean; allowSymlinkTargetWithinRoot?: boolean; }): Promise; /** Copy a source file into a path beneath a trusted root using fs-safe root policy. */ declare function writeFileFromPathWithinRoot(params: { rootDir: string; relativePath: string; sourcePath: string; mkdir?: boolean; }): Promise; //#endregion export { pathScope as A, WriteSiblingTempFileOptions as C, AssertNoSymlinkParentsOptions as D, writeViaSiblingTempPath as E, resolveWritablePathWithinRoot as F, resolvePathWithinRoot as M, resolvePathsWithinRoot as N, assertNoSymlinkParents as O, resolveStrictExistingPathsWithinRoot as P, buildUntrustedChannelMetadata as S, writeSiblingTempFile as T, SafeRegexRejectReason as _, movePathWithCopyFallback as a, hasNestedRepetition as b, ReplaceFileAtomicOptions as c, ReplaceFileAtomicSyncOptions as d, replaceFileAtomicSync as f, SafeRegexCompileResult as g, privateFileStoreSync as h, MovePathWithCopyFallbackOptions as i, resolveExistingPathsWithinRoot as j, assertNoSymlinkParentsSync as k, ReplaceFileAtomicResult as l, privateFileStore as m, writeFileFromPathWithinRoot as n, replaceFileAtomic as o, PrivateFileStore as p, safeEqualSecret as r, ReplaceFileAtomicFileSystem as s, openFileWithinRoot as t, ReplaceFileAtomicSyncFileSystem as u, compileSafeRegex as v, WriteSiblingTempFileResult as w, testRegexWithBoundedInput as x, compileSafeRegexDetailed as y };