示例工程 62-workspace-shell-sandbox

62-workspace-shell-sandbox/app/.tsc/shared/sandbox.d.ts

typescript · 1.5 KB

export type PathCode = "OK" | "EMPTY" | "ABSOLUTE" | "OUTSIDE" | "SYMLINK_ESCAPE";
export type PathResult = {
    ok: boolean;
    code: PathCode;
    resolved: string;
    detail: string;
};
export type ShellCode = "OK" | "EMPTY" | "TOO_LONG" | "SHELL_METACHAR" | "PATH_OUTSIDE" | "COMMAND_NOT_ALLOWED";
export type ShellInspection = {
    ok: boolean;
    code: ShellCode;
    tokens: string[];
    detail: string;
};
export type Scenario = {
    id: string;
    label: string;
    kind: "path" | "shell";
    input: string;
    note: string;
};
export type SandboxStatus = "ok" | "blocked" | "timeout" | "truncated";
export type SandboxResult = {
    seq: number;
    at: number;
    scenarioId: string;
    kind: "path" | "shell";
    label: string;
    input: string;
    status: SandboxStatus;
    code: string;
    detail: string;
    durationMs: number;
};
export declare const ROOT = "/Users/demo/work";
export declare const SYMLINKS: Record<string, string>;
export declare const ALLOWLIST: string[];
export declare const SHELL_TIMEOUT_MS = 200;
export declare const OUTPUT_CAP = 256;
export declare const SCENARIOS: Scenario[];
export declare function scenarioById(id: string): Scenario | undefined;
export declare function resolveInWorkspace(input: string): PathResult;
export declare function inspectCommand(command: string): ShellInspection;
export declare function runShell(command: string): {
    status: SandboxStatus;
    code: string;
    output: string;
    durationMs: number;
};
//# sourceMappingURL=sandbox.d.ts.map