mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-28 05:16:23 -06:00
fix(agents): split sandbox fs bridge types
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import type { OpenClawConfig } from "../../config/config.js";
|
||||
import { normalizeOptionalLowercaseString } from "../../shared/string-coerce.js";
|
||||
import type { SandboxFsBridge } from "./fs-bridge.js";
|
||||
import type { SandboxFsBridge } from "./fs-bridge.types.js";
|
||||
import type { SandboxRegistryEntry } from "./registry.js";
|
||||
import type { SandboxConfig, SandboxContext } from "./types.js";
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
} from "./fs-bridge-mutation-helper.js";
|
||||
import { SandboxFsPathGuard } from "./fs-bridge-path-safety.js";
|
||||
import { buildStatPlan, type SandboxFsCommandPlan } from "./fs-bridge-shell-command-plans.js";
|
||||
import type { SandboxFsBridge, SandboxFsStat, SandboxResolvedPath } from "./fs-bridge.types.js";
|
||||
import {
|
||||
buildSandboxFsMounts,
|
||||
resolveSandboxFsPathWithMounts,
|
||||
@@ -24,44 +25,7 @@ type RunCommandOptions = {
|
||||
signal?: AbortSignal;
|
||||
};
|
||||
|
||||
export type SandboxResolvedPath = {
|
||||
hostPath?: string;
|
||||
relativePath: string;
|
||||
containerPath: string;
|
||||
};
|
||||
|
||||
export type SandboxFsStat = {
|
||||
type: "file" | "directory" | "other";
|
||||
size: number;
|
||||
mtimeMs: number;
|
||||
};
|
||||
|
||||
export type SandboxFsBridge = {
|
||||
resolvePath(params: { filePath: string; cwd?: string }): SandboxResolvedPath;
|
||||
readFile(params: { filePath: string; cwd?: string; signal?: AbortSignal }): Promise<Buffer>;
|
||||
writeFile(params: {
|
||||
filePath: string;
|
||||
cwd?: string;
|
||||
data: Buffer | string;
|
||||
encoding?: BufferEncoding;
|
||||
mkdir?: boolean;
|
||||
signal?: AbortSignal;
|
||||
}): Promise<void>;
|
||||
mkdirp(params: { filePath: string; cwd?: string; signal?: AbortSignal }): Promise<void>;
|
||||
remove(params: {
|
||||
filePath: string;
|
||||
cwd?: string;
|
||||
recursive?: boolean;
|
||||
force?: boolean;
|
||||
signal?: AbortSignal;
|
||||
}): Promise<void>;
|
||||
rename(params: { from: string; to: string; cwd?: string; signal?: AbortSignal }): Promise<void>;
|
||||
stat(params: {
|
||||
filePath: string;
|
||||
cwd?: string;
|
||||
signal?: AbortSignal;
|
||||
}): Promise<SandboxFsStat | null>;
|
||||
};
|
||||
export type { SandboxFsBridge, SandboxFsStat, SandboxResolvedPath } from "./fs-bridge.types.js";
|
||||
|
||||
export function createSandboxFsBridge(params: { sandbox: SandboxContext }): SandboxFsBridge {
|
||||
return new SandboxFsBridgeImpl(params.sandbox);
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
export type SandboxResolvedPath = {
|
||||
hostPath?: string;
|
||||
relativePath: string;
|
||||
containerPath: string;
|
||||
};
|
||||
|
||||
export type SandboxFsStat = {
|
||||
type: "file" | "directory" | "other";
|
||||
size: number;
|
||||
mtimeMs: number;
|
||||
};
|
||||
|
||||
export type SandboxFsBridge = {
|
||||
resolvePath(params: { filePath: string; cwd?: string }): SandboxResolvedPath;
|
||||
readFile(params: { filePath: string; cwd?: string; signal?: AbortSignal }): Promise<Buffer>;
|
||||
writeFile(params: {
|
||||
filePath: string;
|
||||
cwd?: string;
|
||||
data: Buffer | string;
|
||||
encoding?: BufferEncoding;
|
||||
mkdir?: boolean;
|
||||
signal?: AbortSignal;
|
||||
}): Promise<void>;
|
||||
mkdirp(params: { filePath: string; cwd?: string; signal?: AbortSignal }): Promise<void>;
|
||||
remove(params: {
|
||||
filePath: string;
|
||||
cwd?: string;
|
||||
recursive?: boolean;
|
||||
force?: boolean;
|
||||
signal?: AbortSignal;
|
||||
}): Promise<void>;
|
||||
rename(params: { from: string; to: string; cwd?: string; signal?: AbortSignal }): Promise<void>;
|
||||
stat(params: {
|
||||
filePath: string;
|
||||
cwd?: string;
|
||||
signal?: AbortSignal;
|
||||
}): Promise<SandboxFsStat | null>;
|
||||
};
|
||||
@@ -3,7 +3,7 @@ import { isPathInside } from "../../infra/path-guards.js";
|
||||
import type { SandboxBackendCommandParams, SandboxBackendCommandResult } from "./backend.js";
|
||||
import { SANDBOX_PINNED_MUTATION_PYTHON } from "./fs-bridge-mutation-helper.js";
|
||||
import { createWritableRenameTargetResolver } from "./fs-bridge-rename-targets.js";
|
||||
import type { SandboxFsBridge, SandboxFsStat, SandboxResolvedPath } from "./fs-bridge.js";
|
||||
import type { SandboxFsBridge, SandboxFsStat, SandboxResolvedPath } from "./fs-bridge.types.js";
|
||||
import {
|
||||
isPathInsideContainerRoot,
|
||||
normalizeContainerPath as normalizeSandboxContainerPath,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { SandboxBackendHandle, SandboxBackendId } from "./backend.js";
|
||||
import type { SandboxFsBridge } from "./fs-bridge.js";
|
||||
import type { SandboxFsBridge } from "./fs-bridge.types.js";
|
||||
import type { SandboxDockerConfig } from "./types.docker.js";
|
||||
|
||||
export type { SandboxDockerConfig } from "./types.docker.js";
|
||||
|
||||
Reference in New Issue
Block a user