import { A as IFileSystem, C as SecureFetch, D as DirentEntry, E as CpOptions, F as WriteFileOptions, I as ExecutionLimitProfile, L as ExecutionLimits, M as MkdirOptions, N as ReadFileOptions, O as FileContent, P as RmOptions, R as ByteString, S as TraceCallback, T as BufferEncoding, _ as CustomCommand, a as CommandPolicyFileSystem, b as Command, c as DEFAULT_MAX_PIPELINE_DEPTH, d as ApplyPatchBatchMode, f as ApplyPatchOperation, g as DEFAULT_MAX_PATCH_SIZE, h as ApplyPatchStatus, i as CommandInspector, j as InitialFiles, k as FsStat, l as DEFAULT_MAX_SEGMENTS, m as ApplyPatchResult, n as createWorkspaceFileSystemView, o as CommandPolicyOptions, p as ApplyPatchOptions, r as CommandInspectDecision, s as DEFAULT_MAX_COMMAND_LENGTH, t as WorkspaceFileSystemViewOptions, u as PolicyReasonCode, v as defineCommand, w as NetworkConfig, x as FeatureCoverageWriter, y as BashExecResult } from "./filesystem-view-BTebCKdE.js"; //#region ../../.bun/install/cache/links/just-bash@3.4.2-8196b62c07b67856/node_modules/just-bash/dist/commands/registry.d.ts /** All available built-in command names (excludes network commands) */ type CommandName = "echo" | "cat" | "printf" | "ls" | "mkdir" | "rmdir" | "touch" | "rm" | "cp" | "mv" | "ln" | "chmod" | "pwd" | "readlink" | "head" | "tail" | "wc" | "stat" | "grep" | "fgrep" | "egrep" | "rg" | "sed" | "awk" | "sort" | "uniq" | "comm" | "cut" | "paste" | "tr" | "rev" | "nl" | "fold" | "expand" | "unexpand" | "strings" | "split" | "column" | "join" | "tee" | "find" | "basename" | "dirname" | "tree" | "du" | "env" | "printenv" | "alias" | "unalias" | "history" | "xargs" | "true" | "false" | "clear" | "bash" | "sh" | "jq" | "base64" | "diff" | "date" | "sleep" | "timeout" | "seq" | "expr" | "md5sum" | "sha1sum" | "sha256sum" | "file" | "html-to-markdown" | "help" | "which" | "tac" | "hostname" | "od" | "gzip" | "gunzip" | "zcat" | "tar" | "yq" | "xan" | "sqlite3" | "time" | "whoami"; //#endregion //#region ../../.bun/install/cache/links/just-bash@3.4.2-8196b62c07b67856/node_modules/just-bash/dist/security/types.d.ts /** * Security Types for Defense-in-Depth Box * * These types define the configuration and behavior of the defense-in-depth * security layer that protects against code execution escape vectors. * * IMPORTANT: This is a SECONDARY defense layer. It should never be relied upon * as the primary security mechanism. The primary security comes from proper * sandboxing, input validation, and architectural constraints. */ /** * Configuration for the defense-in-depth box. */ interface DefenseInDepthConfig { /** * Enable, disable, or capability-detect the defense layer. * * `true` (the default used by `Bash`) and `"auto"` both enable the strongest * protection supported by the current runtime. Inspect `getStatus()` when a * host requires the full contextual dynamic-import boundary. */ enabled?: boolean | "auto"; /** * Permanently freeze selected host intrinsics and lock well-known Symbol * descriptors. This cannot be undone by `deactivate()` and is therefore * disabled by default. Only use in a dedicated, process-lifetime realm. */ processLifetimeIntrinsicHardening?: boolean; /** * Audit mode: log violations but don't block them. * Useful for debugging and testing without breaking execution. * Default: false */ auditMode?: boolean; /** * Callback invoked when a security violation is detected. * Called regardless of auditMode setting. */ onViolation?: (violation: SecurityViolation) => void; /** * Violation types to exclude from blocking. * Use this when certain globals are required for legitimate purposes * (e.g., WebAssembly for sql.js in sqlite3 worker). * Constructor-execution protections are non-excludable. */ excludeViolationTypes?: SecurityViolationType[]; } /** * Types of security violations that can be detected. */ /** * Types of security violations that can be detected. * * Note: We focus on code execution vectors. We don't block: * - process: Needed for Node.js operation (process.nextTick, etc.) * - require: May not exist in ESM, and import() can't be blocked this way */ type SecurityViolationType = "function_constructor" | "eval" | "setTimeout" | "setInterval" | "setImmediate" | "async_function_constructor" | "generator_function_constructor" | "async_generator_function_constructor" | "weak_ref" | "finalization_registry" | "reflect" | "proxy" | "process_env" | "process_binding" | "process_dlopen" | "process_main_module" | "process_exit" | "process_kill" | "process_setuid" | "process_umask" | "process_argv" | "process_exec_path" | "process_chdir" | "process_connected" | "process_send" | "process_channel" | "process_timing" | "module_load" | "webassembly" | "shared_array_buffer" | "atomics" | "process_get_builtin_module" | "error_prepare_stack_trace" | "performance_timing" | "process_stdout" | "process_stderr" | "module_resolve_filename" | "dynamic_import_builtin" | "missing_defense_context" | "promise_then_after_deactivate" | "bound_callback_after_deactivate" | "prototype_mutation" | "json_mutation" | "math_mutation" | "process_report" | "process_exception_handler"; /** * Information about a detected security violation. */ interface SecurityViolation { /** * Timestamp when the violation occurred (milliseconds since epoch). */ timestamp: number; /** * Type of violation detected. */ type: SecurityViolationType; /** * Human-readable message describing the violation. */ message: string; /** * Path to the blocked global (e.g., "globalThis.Function"). */ path: string; /** * Stack trace at the point of violation, if available. */ stack?: string; /** * Execution ID from AsyncLocalStorage context, for correlation. */ executionId?: string; } //#endregion //#region ../../.bun/install/cache/links/just-bash@3.4.2-8196b62c07b67856/node_modules/just-bash/dist/ast/types.d.ts /** * Abstract Syntax Tree (AST) Types for Bash * * This module defines the complete AST structure for bash scripts. * The design follows the actual bash grammar while being TypeScript-idiomatic. * * Architecture: * Input → Lexer → Parser → AST → Expander → Interpreter → Output * * Each node type corresponds to a bash construct and can be visited * by the tree-walking interpreter. */ /** Base interface for all AST nodes */ interface ASTNode { type: string; /** Source line number (1-based) for $LINENO tracking. May be 0 or undefined for synthesized nodes. */ line?: number; } /** Root node: a complete script */ interface ScriptNode extends ASTNode { type: "Script"; statements: StatementNode[]; } /** A statement is a list of pipelines connected by && or || */ interface StatementNode extends ASTNode { type: "Statement"; pipelines: PipelineNode[]; /** Operators between pipelines: "&&" | "||" | ";" */ operators: ("&&" | "||" | ";")[]; /** Run in background? */ background: boolean; /** * Deferred syntax error. If set, executing this statement will throw a syntax error. * This is used to support bash's incremental parsing behavior where syntax errors * on later lines only trigger if/when execution reaches that line. * Example: `{ls;\n}` - the } is invalid but with errexit, the script exits before reaching it. */ deferredError?: { message: string; token: string; }; /** * Original source text for verbose mode (set -v). * When verbose mode is enabled, this text is printed to stderr before execution. */ sourceText?: string; } /** A pipeline: cmd1 | cmd2 | cmd3 */ interface PipelineNode extends ASTNode { type: "Pipeline"; commands: CommandNode[]; /** Negate exit status with ! */ negated: boolean; /** Time the pipeline with 'time' keyword */ timed?: boolean; /** Use POSIX format for time output (-p flag) */ timePosix?: boolean; /** * For each pipe in the pipeline, whether it's |& (pipe stderr too). * pipeStderr[i] indicates if command[i]'s stderr should be piped to command[i+1]'s stdin. * Length is commands.length - 1. */ pipeStderr?: boolean[]; } /** Union of all command types */ type CommandNode = SimpleCommandNode | CompoundCommandNode | FunctionDefNode; /** Simple command: name args... with optional redirections */ interface SimpleCommandNode extends ASTNode { type: "SimpleCommand"; /** Variable assignments before command: VAR=value cmd */ assignments: AssignmentNode[]; /** Command name (may be empty for assignment-only) */ name: WordNode | null; /** Command arguments */ args: WordNode[]; /** I/O redirections */ redirections: RedirectionNode[]; } /** Compound commands: control structures */ type CompoundCommandNode = IfNode | ForNode | CStyleForNode | WhileNode | UntilNode | CaseNode | SubshellNode | GroupNode | ArithmeticCommandNode | ConditionalCommandNode; /** if statement */ interface IfNode extends ASTNode { type: "If"; clauses: IfClause[]; elseBody: StatementNode[] | null; redirections: RedirectionNode[]; } interface IfClause { condition: StatementNode[]; body: StatementNode[]; } /** for loop: for VAR in WORDS; do ...; done */ interface ForNode extends ASTNode { type: "For"; variable: string; /** Words to iterate over (null = "$@") */ words: WordNode[] | null; body: StatementNode[]; redirections: RedirectionNode[]; } /** C-style for loop: for ((init; cond; step)); do ...; done */ interface CStyleForNode extends ASTNode { type: "CStyleFor"; init: ArithmeticExpressionNode | null; condition: ArithmeticExpressionNode | null; update: ArithmeticExpressionNode | null; body: StatementNode[]; redirections: RedirectionNode[]; } /** while loop */ interface WhileNode extends ASTNode { type: "While"; condition: StatementNode[]; body: StatementNode[]; redirections: RedirectionNode[]; } /** until loop */ interface UntilNode extends ASTNode { type: "Until"; condition: StatementNode[]; body: StatementNode[]; redirections: RedirectionNode[]; } /** case statement */ interface CaseNode extends ASTNode { type: "Case"; word: WordNode; items: CaseItemNode[]; redirections: RedirectionNode[]; } interface CaseItemNode extends ASTNode { type: "CaseItem"; patterns: WordNode[]; body: StatementNode[]; /** Terminator: ";;" | ";&" | ";;&" */ terminator: ";;" | ";&" | ";;&"; } /** Subshell: ( ... ) */ interface SubshellNode extends ASTNode { type: "Subshell"; body: StatementNode[]; redirections: RedirectionNode[]; } /** Command group: { ...; } */ interface GroupNode extends ASTNode { type: "Group"; body: StatementNode[]; redirections: RedirectionNode[]; } /** Arithmetic command: (( expr )) */ interface ArithmeticCommandNode extends ASTNode { type: "ArithmeticCommand"; expression: ArithmeticExpressionNode; redirections: RedirectionNode[]; } /** Conditional command: [[ expr ]] */ interface ConditionalCommandNode extends ASTNode { type: "ConditionalCommand"; expression: ConditionalExpressionNode; redirections: RedirectionNode[]; line?: number; } /** Function definition */ interface FunctionDefNode extends ASTNode { type: "FunctionDef"; name: string; body: CompoundCommandNode; redirections: RedirectionNode[]; /** Source file where the function was defined (for BASH_SOURCE tracking) */ sourceFile?: string; } /** Variable assignment: VAR=value or VAR+=value */ interface AssignmentNode extends ASTNode { type: "Assignment"; name: string; value: WordNode | null; /** Append mode: VAR+=value */ append: boolean; /** Array assignment: VAR=(a b c) */ array: WordNode[] | null; } /** I/O redirection */ interface RedirectionNode extends ASTNode { type: "Redirection"; /** File descriptor (default depends on operator) */ fd: number | null; /** * Variable name for automatic FD allocation ({varname}>file syntax). * When set, bash allocates an FD >= 10 and stores the number in this variable. */ fdVariable?: string; operator: RedirectionOperator; target: WordNode | HereDocNode; } type RedirectionOperator = "<" | ">" | ">>" | ">&" | "<&" | "<>" | ">|" | "&>" | "&>>" | "<<<" | "<<" | "<<-"; /** Here document */ interface HereDocNode extends ASTNode { type: "HereDoc"; delimiter: string; content: WordNode; /** Strip leading tabs (<<- vs <<) */ stripTabs: boolean; /** Quoted delimiter means no expansion */ quoted: boolean; /** Whether parsing consumed the closing delimiter. Undefined for legacy ASTs. */ terminated?: boolean; } /** * A Word is a sequence of parts that form a single shell word. * After expansion, it may produce zero, one, or multiple strings. */ interface WordNode extends ASTNode { type: "Word"; parts: WordPart[]; } /** Parts that can make up a word */ type WordPart = LiteralPart | SingleQuotedPart | DoubleQuotedPart | EscapedPart | ParameterExpansionPart | CommandSubstitutionPart | ArithmeticExpansionPart | ProcessSubstitutionPart | BraceExpansionPart | TildeExpansionPart | GlobPart; /** Literal text (no special meaning) */ interface LiteralPart extends ASTNode { type: "Literal"; value: string; } /** Single-quoted string: 'literal' */ interface SingleQuotedPart extends ASTNode { type: "SingleQuoted"; value: string; } /** Double-quoted string: "with $expansion" */ interface DoubleQuotedPart extends ASTNode { type: "DoubleQuoted"; parts: WordPart[]; } /** Escaped character: \x */ interface EscapedPart extends ASTNode { type: "Escaped"; value: string; } /** Parameter/variable expansion: $VAR or ${VAR...} */ interface ParameterExpansionPart extends ASTNode { type: "ParameterExpansion"; parameter: string; /** Expansion operation */ operation: ParameterOperation | null; } /** Operations that can be used as inner operations for indirection (${!ref-default}) */ type InnerParameterOperation = DefaultValueOp | AssignDefaultOp | ErrorIfUnsetOp | UseAlternativeOp | LengthOp | LengthSliceErrorOp | BadSubstitutionOp | SubstringOp | PatternRemovalOp | PatternReplacementOp | CaseModificationOp | TransformOp; type ParameterOperation = InnerParameterOperation | IndirectionOp | ArrayKeysOp | VarNamePrefixOp; /** ${#VAR:...} - invalid syntax, length cannot have substring */ interface LengthSliceErrorOp { type: "LengthSliceError"; } /** Bad substitution - parsed but errors at runtime (e.g., ${(x)foo} zsh syntax) */ interface BadSubstitutionOp { type: "BadSubstitution"; /** The raw text that caused the error (for error message) */ text: string; } /** ${VAR:-default} or ${VAR-default} */ interface DefaultValueOp { type: "DefaultValue"; word: WordNode; checkEmpty: boolean; } /** ${VAR:=default} or ${VAR=default} */ interface AssignDefaultOp { type: "AssignDefault"; word: WordNode; checkEmpty: boolean; } /** ${VAR:?error} or ${VAR?error} */ interface ErrorIfUnsetOp { type: "ErrorIfUnset"; word: WordNode | null; checkEmpty: boolean; } /** ${VAR:+alternative} or ${VAR+alternative} */ interface UseAlternativeOp { type: "UseAlternative"; word: WordNode; checkEmpty: boolean; } /** ${#VAR} */ interface LengthOp { type: "Length"; } /** ${VAR:offset} or ${VAR:offset:length} */ interface SubstringOp { type: "Substring"; offset: ArithmeticExpressionNode; length: ArithmeticExpressionNode | null; } /** ${VAR#pattern}, ${VAR##pattern}, ${VAR%pattern}, ${VAR%%pattern} */ interface PatternRemovalOp { type: "PatternRemoval"; pattern: WordNode; /** "prefix" = # or ##, "suffix" = % or %% */ side: "prefix" | "suffix"; /** Greedy (## or %%) vs non-greedy (# or %) */ greedy: boolean; } /** ${VAR/pattern/replacement} or ${VAR//pattern/replacement} */ interface PatternReplacementOp { type: "PatternReplacement"; pattern: WordNode; replacement: WordNode | null; /** Replace all occurrences */ all: boolean; /** Match at start (#) or end (%) only */ anchor: "start" | "end" | null; } /** ${VAR^}, ${VAR^^}, ${VAR,}, ${VAR,,} */ interface CaseModificationOp { type: "CaseModification"; /** "upper" = ^ or ^^, "lower" = , or ,, */ direction: "upper" | "lower"; /** Apply to all characters */ all: boolean; pattern: WordNode | null; } /** ${var@Q}, ${var@P}, etc. - parameter transformation */ interface TransformOp { type: "Transform"; /** Q=quote, P=prompt, a=attributes, A=assignment, E=escape, K=keys, k=keys(alt), u=ucfirst, U=uppercase, L=lowercase */ operator: "Q" | "P" | "a" | "A" | "E" | "K" | "k" | "u" | "U" | "L"; } /** ${!VAR} - indirect expansion, optionally combined with another operation like ${!ref-default} */ interface IndirectionOp { type: "Indirection"; /** Additional operation to apply after indirection (e.g., ${!ref-default}) */ innerOp?: InnerParameterOperation; } /** ${!arr[@]} or ${!arr[*]} - array keys/indices */ interface ArrayKeysOp { type: "ArrayKeys"; /** The array name (without subscript) */ array: string; /** true if [*] was used instead of [@] */ star: boolean; } /** ${!prefix*} or ${!prefix@} - list variable names with prefix */ interface VarNamePrefixOp { type: "VarNamePrefix"; /** The prefix to match */ prefix: string; /** true if * was used instead of @ */ star: boolean; } /** Command substitution: $(cmd) or `cmd` */ interface CommandSubstitutionPart extends ASTNode { type: "CommandSubstitution"; body: ScriptNode; /** Legacy backtick syntax */ legacy: boolean; } /** Arithmetic expansion: $((expr)) */ interface ArithmeticExpansionPart extends ASTNode { type: "ArithmeticExpansion"; expression: ArithmeticExpressionNode; } /** Arithmetic expression (for $((...)) and ((...))) */ interface ArithmeticExpressionNode extends ASTNode { type: "ArithmeticExpression"; expression: ArithExpr; /** Original expression text before parsing, used for re-parsing after variable expansion */ originalText?: string; } type ArithExpr = ArithNumberNode | ArithVariableNode | ArithSpecialVarNode | ArithBinaryNode | ArithUnaryNode | ArithTernaryNode | ArithAssignmentNode | ArithDynamicAssignmentNode | ArithDynamicElementNode | ArithGroupNode | ArithNestedNode | ArithCommandSubstNode | ArithBracedExpansionNode | ArithArrayElementNode | ArithDynamicBaseNode | ArithDynamicNumberNode | ArithConcatNode | ArithDoubleSubscriptNode | ArithNumberSubscriptNode | ArithSyntaxErrorNode | ArithSingleQuoteNode; interface ArithBracedExpansionNode extends ASTNode { type: "ArithBracedExpansion"; content: string; } /** Dynamic base constant: ${base}#value where base is expanded at runtime */ interface ArithDynamicBaseNode extends ASTNode { type: "ArithDynamicBase"; baseExpr: string; value: string; } /** Dynamic number prefix: ${zero}11 or ${zero}xAB for dynamic octal/hex */ interface ArithDynamicNumberNode extends ASTNode { type: "ArithDynamicNumber"; prefix: string; suffix: string; } /** Concatenation of multiple parts forming a single numeric value */ interface ArithConcatNode extends ASTNode { type: "ArithConcat"; parts: ArithExpr[]; } interface ArithArrayElementNode extends ASTNode { type: "ArithArrayElement"; array: string; /** The index expression (for numeric indices) */ index?: ArithExpr; /** For associative arrays: literal string key (e.g., 'key' or "key") */ stringKey?: string; } /** Invalid double subscript node (e.g., a[1][1]) - evaluated to error at runtime */ interface ArithDoubleSubscriptNode extends ASTNode { type: "ArithDoubleSubscript"; array: string; index: ArithExpr; } /** Invalid number subscript node (e.g., 1[2]) - evaluated to error at runtime */ interface ArithNumberSubscriptNode extends ASTNode { type: "ArithNumberSubscript"; number: string; errorToken: string; } /** Syntax error in arithmetic expression - evaluated to error at runtime */ interface ArithSyntaxErrorNode extends ASTNode { type: "ArithSyntaxError"; errorToken: string; message: string; } /** * Single-quoted string in arithmetic expression. * In $(()) expansion context, this causes an error. * In (()) command context, this is evaluated as a number. */ interface ArithSingleQuoteNode extends ASTNode { type: "ArithSingleQuote"; content: string; value: number; } interface ArithNumberNode extends ASTNode { type: "ArithNumber"; value: number; } interface ArithVariableNode extends ASTNode { type: "ArithVariable"; name: string; /** True if the variable was written with $ prefix (e.g., $x vs x) */ hasDollarPrefix?: boolean; } /** Special variable node: $*, $@, $#, $?, $-, $!, $$ */ interface ArithSpecialVarNode extends ASTNode { type: "ArithSpecialVar"; name: string; } interface ArithBinaryNode extends ASTNode { type: "ArithBinary"; operator: "+" | "-" | "*" | "/" | "%" | "**" | "<<" | ">>" | "<" | "<=" | ">" | ">=" | "==" | "!=" | "&" | "|" | "^" | "&&" | "||" | ","; left: ArithExpr; right: ArithExpr; } interface ArithUnaryNode extends ASTNode { type: "ArithUnary"; operator: "-" | "+" | "!" | "~" | "++" | "--"; operand: ArithExpr; /** Prefix vs postfix for ++ and -- */ prefix: boolean; } interface ArithTernaryNode extends ASTNode { type: "ArithTernary"; condition: ArithExpr; consequent: ArithExpr; alternate: ArithExpr; } type ArithAssignmentOperator = "=" | "+=" | "-=" | "*=" | "/=" | "%=" | "<<=" | ">>=" | "&=" | "|=" | "^="; interface ArithAssignmentNode extends ASTNode { type: "ArithAssignment"; operator: ArithAssignmentOperator; variable: string; /** For array element assignment: the subscript expression */ subscript?: ArithExpr; /** For associative arrays: literal string key (e.g., 'key' or "key") */ stringKey?: string; value: ArithExpr; } /** Dynamic assignment where variable name is built from concatenation: x$foo = 42 or x$foo[5] = 42 */ interface ArithDynamicAssignmentNode extends ASTNode { type: "ArithDynamicAssignment"; operator: ArithAssignmentOperator; /** The target expression (ArithConcat) that evaluates to the variable name */ target: ArithExpr; /** For array element assignment: the subscript expression */ subscript?: ArithExpr; value: ArithExpr; } /** Dynamic array element where array name is built from concatenation: x$foo[5] */ interface ArithDynamicElementNode extends ASTNode { type: "ArithDynamicElement"; /** The expression (ArithConcat) that evaluates to the array name */ nameExpr: ArithExpr; /** The subscript expression */ subscript: ArithExpr; } interface ArithGroupNode extends ASTNode { type: "ArithGroup"; expression: ArithExpr; } /** Nested arithmetic expansion within arithmetic context: $((expr)) */ interface ArithNestedNode extends ASTNode { type: "ArithNested"; expression: ArithExpr; } /** Command substitution within arithmetic context: $(cmd) or `cmd` */ interface ArithCommandSubstNode extends ASTNode { type: "ArithCommandSubst"; command: string; } /** Process substitution: <(cmd) or >(cmd) */ interface ProcessSubstitutionPart extends ASTNode { type: "ProcessSubstitution"; body: ScriptNode; direction: "input" | "output"; } /** Brace expansion: {a,b,c} or {1..10} */ interface BraceExpansionPart extends ASTNode { type: "BraceExpansion"; items: BraceItem[]; } type BraceItem = { type: "Word"; word: WordNode; } | { type: "Range"; start: string | number; end: string | number; step?: number; startStr?: string; endStr?: string; }; /** Tilde expansion: ~ or ~user */ interface TildeExpansionPart extends ASTNode { type: "TildeExpansion"; user: string | null; } /** Glob pattern part (expanded during pathname expansion) */ interface GlobPart extends ASTNode { type: "Glob"; pattern: string; } type ConditionalExpressionNode = CondBinaryNode | CondUnaryNode | CondNotNode | CondAndNode | CondOrNode | CondGroupNode | CondWordNode; type CondBinaryOperator = "=" | "==" | "!=" | "=~" | "<" | ">" | "-eq" | "-ne" | "-lt" | "-le" | "-gt" | "-ge" | "-nt" | "-ot" | "-ef"; interface CondBinaryNode extends ASTNode { type: "CondBinary"; operator: CondBinaryOperator; left: WordNode; right: WordNode; } type CondUnaryOperator = "-a" | "-b" | "-c" | "-d" | "-e" | "-f" | "-g" | "-h" | "-k" | "-p" | "-r" | "-s" | "-t" | "-u" | "-w" | "-x" | "-G" | "-L" | "-N" | "-O" | "-S" | "-z" | "-n" | "-o" | "-v" | "-R"; interface CondUnaryNode extends ASTNode { type: "CondUnary"; operator: CondUnaryOperator; operand: WordNode; } interface CondNotNode extends ASTNode { type: "CondNot"; operand: ConditionalExpressionNode; } interface CondAndNode extends ASTNode { type: "CondAnd"; left: ConditionalExpressionNode; right: ConditionalExpressionNode; } interface CondOrNode extends ASTNode { type: "CondOr"; left: ConditionalExpressionNode; right: ConditionalExpressionNode; } interface CondGroupNode extends ASTNode { type: "CondGroup"; expression: ConditionalExpressionNode; } interface CondWordNode extends ASTNode { type: "CondWord"; word: WordNode; } //#endregion //#region ../../.bun/install/cache/links/just-bash@3.4.2-8196b62c07b67856/node_modules/just-bash/dist/transform/types.d.ts interface TransformPlugin> { name: string; transform(context: TransformContext): TransformResult; } interface TransformContext { ast: ScriptNode; metadata: Record; } interface TransformResult> { ast: ScriptNode; metadata?: TMetadata; } interface BashTransformResult> { script: string; ast: ScriptNode; metadata: TMetadata; } //#endregion //#region ../../.bun/install/cache/links/just-bash@3.4.2-8196b62c07b67856/node_modules/just-bash/dist/Bash.d.ts /** * Logger interface for Bash execution logging. * Implement this interface to receive execution logs. */ interface BashLogger { /** Log informational messages (exec commands, stderr, exit codes) */ info(message: string, data?: Record): void; /** Log debug messages (stdout output) */ debug(message: string, data?: Record): void; } interface JavaScriptConfig { /** Bootstrap JavaScript code to run before user scripts */ bootstrap?: string; /** * Tool invocation hook. When provided, code running in `js-exec` gets a * global `tools` proxy that routes calls through this callback synchronously * (the worker blocks via `Atomics.wait` while the host resolves the call). * * - `path`: dot-separated tool path (e.g. `"math.add"`). The proxy builds * it from JS property access — `tools.math.add(...)` becomes `"math.add"`. * - `argsJson`: JSON-stringified args object, or empty string for no args. * - return: JSON-stringified result, or empty string for `undefined`. * - throw: propagates as a catchable exception inside the sandbox. * * Setting `invokeTool` implicitly enables `js-exec` (no separate * `javascript: true` needed). Pair with `customCommands` if you want the * same tools available as bash commands. The companion package * `@just-bash/executor` produces a matching `invokeTool` + `commands` pair * from inline tools and/or `@executor-js/sdk` discovery. */ invokeTool?: (path: string, argsJson: string) => Promise; } interface BashOptions { files?: InitialFiles; env?: Record; cwd?: string; fs?: IFileSystem; /** * Execution limits to prevent runaway compute. * See ExecutionLimits interface for available options. */ executionLimits?: ExecutionLimits; /** Named execution-limit preset. Defaults to compatibility-oriented `normal`. */ executionLimitProfile?: ExecutionLimitProfile; /** * @deprecated Use executionLimits.maxCallDepth instead */ maxCallDepth?: number; /** * @deprecated Use executionLimits.maxCommandCount instead */ maxCommandCount?: number; /** * @deprecated Use executionLimits.maxLoopIterations instead */ maxLoopIterations?: number; /** * Custom secure fetch function. When provided, used instead of creating one * from NetworkConfig. Enables wrapping the fetch layer with custom logic * (e.g., policy evaluation) while keeping built-in curl unmodified. * Network commands (curl, wget) are registered when either `fetch` or `network` is provided. */ fetch?: SecureFetch; /** * Network configuration for commands like curl. * Network access is disabled by default - you must explicitly configure allowed URLs. */ network?: NetworkConfig; /** * Enable python3/python commands. * Python is disabled by default as it introduces additional security surface * (arbitrary code execution via CPython Emscripten). */ python?: boolean; /** * Enable js-exec command for sandboxed JavaScript execution via QuickJS. * Disabled by default. Can be a boolean or a config object with bootstrap code. */ javascript?: boolean | JavaScriptConfig; /** * Optional list of command names to register. * If not provided, all built-in commands are available. * Use this to restrict which commands can be executed. */ commands?: CommandName[]; /** * Optional sleep function for the sleep command. * If provided, used instead of real setTimeout. * Useful for testing with mock clocks. */ sleep?: (ms: number) => Promise; /** * Custom commands to register alongside built-in commands. * These take precedence over built-ins with the same name. * * @example * ```ts * import { defineCommand } from "just-bash"; * * const hello = defineCommand("hello", async (args) => ({ * stdout: `Hello, ${args[0] || "world"}!\n`, * stderr: "", * exitCode: 0, * })); * * const bash = new Bash({ customCommands: [hello] }); * ``` */ customCommands?: CustomCommand[]; /** * Optional logger for execution tracing. * When provided, logs exec commands (info), stdout (debug), stderr (info), and exit codes (info). * Disabled by default. */ logger?: BashLogger; /** * Optional trace callback for performance profiling. * When provided, commands emit timing events for analysis. * Useful for identifying performance bottlenecks. */ trace?: TraceCallback; /** * Defense-in-depth configuration. * * When enabled, monkey-patches dangerous JavaScript globals (Function, eval, * setTimeout, process, etc.) during script execution to block potential * escape vectors. * * IMPORTANT: This is a SECONDARY defense layer. It should never be relied * upon as the primary security mechanism. The primary security comes from * proper sandboxing, input validation, and architectural constraints. * * @example * ```ts * // Capability-detect the strongest available protection. * const bash = new Bash({ defenseInDepth: { enabled: "auto" } }); * * // With custom configuration * const bash = new Bash({ * defenseInDepth: { * enabled: true, * auditMode: false, // Set to true to log but not block * onViolation: (v) => console.warn('Violation:', v), * }, * }); * ``` * Node versions without context-aware ESM loader hooks retain the scoped * best-effort controls and report the unavailable loader capability in * DefenseInDepthStatus. */ defenseInDepth?: DefenseInDepthConfig | boolean; /** * Feature coverage writer for fuzzing instrumentation. * When provided, interpreter emits coverage hits for analysis. */ coverage?: FeatureCoverageWriter; /** * Virtual process info for sandboxed environment. * Overrides the default virtual PID/UID values exposed via $$, $PPID, $UID, $EUID, $BASHPID, * and /proc/self/status. Real host process info is never exposed. */ processInfo?: { pid?: number; ppid?: number; uid?: number; gid?: number; }; } interface ExecOptions { /** * Environment variables to set for this execution only. * These are merged with the current environment and restored after execution. */ env?: Record; /** * If true, start execution with an empty environment and then apply `env`. * If false/omitted, `env` is merged into the current environment. */ replaceEnv?: boolean; /** * Working directory for this execution only. * Restored to original after execution. */ cwd?: string; /** * If true, skip normalizing the script (trimming leading whitespace from lines). * Useful when running scripts where leading whitespace is significant (e.g., here-docs). * Default: false */ rawScript?: boolean; /** * Standard input to pass to the script. * This will be available to commands via stdin (e.g., for `bash -c 'cat'`). */ stdin?: string; /** * Shape of {@link stdin} — see `CommandExecOptions.stdinKind`. * Defaults to `"text"` (UTF-8 encoded into bytes for byte consumers * inside the script). Pass `"bytes"` when you've prepared a latin1 * byte buffer (e.g. `Buffer.from(buf).toString("latin1")`) and want * it forwarded verbatim. */ stdinKind?: "text" | "bytes"; /** * Abort signal for cooperative cancellation. * When aborted, the interpreter stops executing at the next statement boundary. */ signal?: AbortSignal; /** * Additional argv entries appended to the first executed command at the interpreter level. * Values bypass shell parsing entirely — no escaping, splitting, or globbing. * Like child_process.spawnSync(cmd, args). These do not set or modify the shell's * positional parameters ($1, $2, "$@", etc.). */ args?: string[]; } export declare class Bash { readonly fs: IFileSystem; private commands; private useDefaultLayout; private limits; private secureFetch?; private sleepFn?; private traceFn?; private logger?; private defenseInDepthConfig?; private coverageWriter?; private jsBootstrapCode?; private invokeToolFn?; private transformPlugins; private state; constructor(options?: BashOptions); registerCommand(command: Command): void; private registerBundledCommand; private registerCommandInternal; private logResult; exec(commandLine: string, options?: ExecOptions): Promise; private execInScope; readFile(path: string): Promise; writeFile(path: string, content: string): Promise; getCwd(): string; getEnv(): Record; registerTransformPlugin(plugin: TransformPlugin): void; transform(commandLine: string): BashTransformResult; } //#endregion //#region ../../.bun/install/cache/links/just-bash@3.4.2-8196b62c07b67856/node_modules/just-bash/dist/fs/in-memory-fs/in-memory-fs.d.ts interface InMemoryFsOptions { /** Aggregate materialized file bytes retained by this filesystem. */ maxTotalBytes?: number; } export declare class InMemoryFs implements IFileSystem { private data; private entryIdentities; private nextEntryIdentity; private readonly maxTotalBytes; private retainedBytes; /** Number of directory entries retaining each hard-link-compatible buffer. */ private contentReferences; private materializedContent; private storedByteLength; private wouldReleaseBytes; /** * Check a newly allocated, unique file body before creating its buffer. * Replacing the final reference to an old body credits those bytes. */ private assertCanAllocate; /** Replace one path while updating retained storage in constant time. */ private setEntry; private deleteEntry; private contentByteLength; private identityFor; constructor(initialFiles?: InitialFiles, options?: InMemoryFsOptions); private ensureParentDirs; writeFileSync(path: string, content: FileContent, options?: WriteFileOptions | BufferEncoding, metadata?: { mode?: number; mtime?: Date; }): void; /** * Store a lazy file entry whose content is provided by a function on first read. * Writing to the path replaces the lazy entry, so the function is never called. */ writeFileLazy(path: string, lazy: () => string | Uint8Array | Promise, metadata?: { mode?: number; mtime?: Date; }): void; /** * Materialize a lazy file entry, replacing it with a concrete FileEntry. * Returns the materialized FileEntry. */ private materializeLazy; readFile(path: string, options?: ReadFileOptions | BufferEncoding): Promise; readFileBytes(path: string): Promise; readFileBuffer(path: string): Promise; writeFile(path: string, content: FileContent, options?: WriteFileOptions | BufferEncoding): Promise; appendFile(path: string, content: FileContent, options?: WriteFileOptions | BufferEncoding): Promise; exists(path: string): Promise; stat(path: string): Promise; lstat(path: string): Promise; /** * Resolve symlinks in intermediate path components only (not the final component). * Used by lstat which should not follow the final symlink. */ private resolveIntermediateSymlinks; /** * Resolve all symlinks in a path, including intermediate components. * For example: /home/user/linkdir/file.txt where linkdir is a symlink to "subdir" * would resolve to /home/user/subdir/file.txt */ private resolvePathWithSymlinks; mkdir(path: string, options?: MkdirOptions): Promise; /** * Synchronous version of mkdir */ mkdirSync(path: string, options?: MkdirOptions): void; readdir(path: string): Promise; readdirWithFileTypes(path: string): Promise; rm(path: string, options?: RmOptions): Promise; cp(src: string, dest: string, options?: CpOptions): Promise; mv(src: string, dest: string): Promise; getAllPaths(): string[]; resolvePath(base: string, path: string): string; chmod(path: string, mode: number): Promise; symlink(target: string, linkPath: string): Promise; link(existingPath: string, newPath: string): Promise; readlink(path: string): Promise; /** * Resolve all symlinks in a path to get the canonical physical path. * This is equivalent to POSIX realpath(). */ realpath(path: string): Promise; /** * Set access and modification times of a file * @param path - The file path * @param _atime - Access time (ignored, kept for API compatibility) * @param mtime - Modification time */ utimes(path: string, _atime: Date, mtime: Date): Promise; } //#endregion //#region src/api/json.d.ts type JsonValue = string | number | boolean | null | readonly JsonValue[] | { readonly [key: string]: JsonValue; }; //#endregion //#region src/api/commit.d.ts interface CommitLeaseInput { readonly scope: string; readonly transactionId: string; } interface CommitLease { readonly lost: () => Promise; readonly release: () => Promise; } interface CommitCoordinator { readonly acquire: (input: CommitLeaseInput) => Promise; } interface CommitContext { readonly actor: string; readonly cause?: string; readonly correlationId: string; readonly idempotencyKey?: string; readonly metadata?: Readonly>; } interface CommitOptions { readonly context?: CommitContext; } type CommitStatus = 'complete' | 'partial'; export declare const HISTORY_SCHEMA_VERSION = 1; //#endregion //#region src/api/history.d.ts interface CheckpointOptions { readonly idempotencyKey?: string; readonly label?: string; readonly retentionClass?: string; } interface CheckpointReceipt { readonly checkpointId: string; readonly createdAt: Date; readonly revision: string; } interface CheckpointRecord extends CheckpointReceipt { readonly idempotencyKey?: string; readonly label?: string; readonly retentionClass?: string; } interface HistoryQuery { readonly cursor?: string; readonly cursorMissing?: 'error' | 'oldest'; readonly limit?: number; } interface HistoryRecord { readonly actor: string; readonly cause?: string; readonly changes: readonly WorkspaceChange[]; readonly committedAt: Date; readonly correlationId: string; readonly cursor: string; readonly idempotencyKey?: string; readonly metadata?: Readonly>; readonly parentRevision: string | null; readonly revision: string; readonly schemaVersion: number; readonly scope: string; readonly status: 'complete' | 'partial'; readonly transactionId: string; } interface HistoryPage { readonly nextCursor?: string; readonly records: readonly HistoryRecord[]; } type RevisionDiffRef = { readonly revision: string; } | { readonly checkpoint: string; } | { readonly staged: true; }; interface RevisionDiffInput { readonly from: RevisionDiffRef; readonly paths?: readonly string[]; readonly previewBytes?: number; readonly to: RevisionDiffRef; } type RevisionDiffKind = 'added' | 'deleted' | 'metadata' | 'modified' | 'moved' | 'type-change' | 'unavailable'; interface RevisionDiffEntry { readonly afterHash?: string; readonly beforeHash?: string; readonly kind: RevisionDiffKind; readonly moveFrom?: string; readonly moveTo?: string; readonly path: string; readonly preview?: string; } interface RevisionDiff { readonly entries: readonly RevisionDiffEntry[]; readonly fromRevision: string; readonly toRevision: string; } interface RestorePlan { readonly diff: RevisionDiff; readonly sourceRevision: string; } interface PurgeOptions { /** Protect this revision and all newer revisions. */ readonly keepAfterRevision?: string; readonly dryRun?: boolean; readonly maxAgeMs?: number; readonly maxRevisions?: number; } interface PurgeReceipt { readonly bytes: number; readonly dryRun: boolean; readonly objects: readonly string[]; } interface RevisionEntry { readonly contentHash?: string; readonly entryKind: WorkspaceEntryKind; readonly etag?: string; readonly mode: number; readonly path: string; readonly size: number; readonly target?: string; } interface ReadonlyWorkspaceView { readonly entries: readonly RevisionEntry[]; readonly readFile: (path: string) => Promise; /** Detached original bytes, including binary files in Storage revisions. */ readonly readFileBuffer: (path: string) => Promise; readonly revision: string; } /** Postgres historical redaction; selectors are exact paths or stored body hashes (union). */ interface RedactOptions { readonly paths?: readonly string[]; readonly bodyHashes?: readonly string[]; /** Exclusive boundary; defaults to the current head. */ readonly before?: string; readonly dryRun?: boolean; readonly reason?: string; readonly metadataKeys?: readonly string[]; /** Cause is free text, so it is cleared as a whole. */ readonly clearCause?: boolean; } interface RedactReceipt { readonly redactionId: string; readonly revisions: readonly string[]; readonly bodies: readonly string[]; readonly bytes: number; readonly dryRun: boolean; } //#endregion //#region src/api/contracts.d.ts type WorkspaceChangeKind = 'delete' | 'move' | 'upsert'; type WorkspaceEntryKind = 'directory' | 'file' | 'symlink'; type WorkspaceBackendKind = 'postgres' | 'storage'; interface WorkspaceCapabilities { readonly backend: WorkspaceBackendKind; readonly content: 'byte-tree' | 'utf8-text-tree'; readonly durableEmptyDirectories: boolean; readonly modes: boolean; readonly symbolicLinks: boolean; } interface WorkspaceChange { readonly afterEtag?: string; readonly afterHash?: string; readonly afterSize?: number; readonly beforeEtag?: string; readonly beforeHash?: string; readonly beforeSize?: number; readonly contentHash?: string; readonly entryKind: WorkspaceEntryKind; readonly etag?: string; readonly kind: WorkspaceChangeKind; readonly moveFrom?: string; readonly moveTo?: string; readonly path: string; } interface CommitReceipt { readonly actor: string; readonly cause?: string; readonly changes: readonly WorkspaceChange[]; readonly committedAt: Date; readonly correlationId: string; readonly cursor: string; readonly idempotencyKey?: string; readonly metadata?: Readonly>; readonly parentRevision: string | null; readonly revision: string; readonly schemaVersion: number; readonly scope: string; readonly status: CommitStatus; readonly transactionId: string; } interface Workspace { readonly fs: IFileSystem; readonly changes: () => readonly WorkspaceChange[]; readonly checkpoint: (options?: CheckpointOptions) => Promise; readonly checkpoints: () => Promise; readonly commit: (options?: CommitOptions) => Promise; readonly deleteCheckpoint: (checkpointId: string) => Promise; readonly discard: () => Promise; readonly diff: (input: RevisionDiffInput) => Promise; readonly history: (query?: HistoryQuery) => Promise; readonly purge: (options: PurgeOptions) => Promise; readonly readRevision: (revision: string) => Promise; readonly restore: (revision: string) => Promise; } //#endregion //#region src/history/limits.d.ts export declare const DEFAULT_MAX_VISIBLE_FILES = 10000; export declare const DEFAULT_MAX_PATH_LENGTH = 1024; export declare const DEFAULT_MAX_FILE_SIZE = 10485760; export declare const DEFAULT_MAX_STAGED_BYTES = 52428800; export declare const DEFAULT_MAX_HISTORY_PAGE_SIZE = 100; export declare const DEFAULT_MAX_DIFF_PREVIEW_BYTES = 8192; export declare const DEFAULT_MAX_TRANSACTION_METADATA_BYTES = 16384; export declare const DEFAULT_MAX_REVISIONS_RETAINED = 50; interface WorkspaceLimits { readonly maxDiffPreviewBytes?: number; readonly maxFileSize?: number; readonly maxHistoryPageSize?: number; readonly maxPathLength?: number; readonly maxStagedBytes?: number; readonly maxTransactionMetadataBytes?: number; readonly maxVisibleFiles?: number; } //#endregion //#region src/api/capability.d.ts export declare const CAPABILITY_SCHEMA_VERSION = 1; export declare const POSTGRES_CAPABILITY_SCHEMA_VERSION = 3; export declare const DEFAULT_MAX_CAPABILITY_LIFETIME_SECONDS = 900; type DelegatedOperation = 'checkpoint' | 'commit' | 'history' | 'purge' | 'redact' | 'read' | 'restore' | 'write'; interface DelegatedCapabilityClaims { readonly aud: string; readonly bucket: string; readonly corr: string; readonly exp: number; readonly iat: number; readonly iss: string; readonly nonce: string; readonly ops: readonly DelegatedOperation[]; readonly origin: string; readonly prefix: string; readonly sub: string; readonly sv: number; } interface PostgresDelegatedCapabilityClaims { readonly aud: string; readonly backend: 'postgres'; readonly corr: string; readonly exp: number; readonly iat: number; readonly iss: string; readonly nonce: string; readonly ops: readonly DelegatedOperation[]; readonly origin: string; readonly sub: string; readonly sv: typeof POSTGRES_CAPABILITY_SCHEMA_VERSION; readonly workspace: string; } type AnyDelegatedCapabilityClaims = DelegatedCapabilityClaims | PostgresDelegatedCapabilityClaims; /** Storage capabilities are signed with Ed25519 and verified by the delegate itself. */ interface CreateDelegatedCapabilityInput { readonly claims: DelegatedCapabilityClaims; readonly keyId: string; readonly privateKey: CryptoKey; } /** * Postgres capabilities are signed with HMAC-SHA256. The database is the only * verifier, so the secret is shared between the minting host and the database * and is never handed to the delegate that presents the capability. */ interface CreatePostgresDelegatedCapabilityInput { readonly claims: PostgresDelegatedCapabilityClaims; readonly keyId: string; readonly secretKey: CryptoKey; } interface CapabilityNonceStore { readonly consume: (nonce: string, expiresAt: Date) => Promise; } interface DelegatedVerifier { readonly audience: string; readonly clockSkewSeconds?: number; readonly issuer: string; readonly maxLifetimeSeconds?: number; readonly nonceStore?: CapabilityNonceStore; readonly origin: string; readonly publicKeys: Readonly>; } interface VerifyDelegatedCapabilityInput { readonly capability: string; readonly verifier: DelegatedVerifier; } interface OpenDelegatedOptions { readonly bucket: string; readonly capability: string; readonly coordinator?: CommitCoordinator; readonly fetch?: typeof globalThis.fetch; readonly limits?: WorkspaceLimits; readonly maxFileSystemBytes?: number; readonly serviceRoleKey: string; readonly supabaseUrl: string; readonly uploadConcurrency?: number; readonly verifier: DelegatedVerifier; } //#endregion //#region src/api/document-codec.d.ts type DocumentMetadataValue = boolean | number | string | null; type DocumentMetadata = Readonly>; interface StoredTextDocument { readonly body: string; readonly metadata: DocumentMetadata; readonly path: string; } interface TextDocumentCodec { readonly parse: (path: string, content: string) => StoredTextDocument; } interface YamlFrontmatterCodecOptions { readonly validate?: (metadata: DocumentMetadata, path: string) => void; } export declare const plainTextDocumentCodec: TextDocumentCodec; export declare const createYamlFrontmatterCodec: (options?: YamlFrontmatterCodecOptions) => TextDocumentCodec; export declare const renderStoredDocument: ({ body, metadata }: Pick) => string; //#endregion //#region src/api/errors.d.ts type SupabashErrorCode = 'AUTHENTICATION' | 'AUTHORIZATION' | 'COMMIT_CONFLICT' | 'COMMIT_COORDINATION' | 'COMMIT_IN_PROGRESS' | 'EXPIRED_CAPABILITY' | 'HISTORY_CORRUPTION' | 'IDEMPOTENCY_CONFLICT' | 'INVALID_CAPABILITY' | 'INVALID_PATCH' | 'INVALID_PATH' | 'PARTIAL_COMMIT' | 'POLICY_DENIED' | 'QUOTA_EXCEEDED' | 'REVISION_NOT_FOUND' | 'REDACTED' | 'REDACTION_CURRENT_BODY' | 'REDACTION_INVALIDATED' | 'RESTORE_CROSSES_REDACTION' | 'STORAGE' | 'UNSUPPORTED_CONTENT'; interface SupabashErrorOptions { readonly cause?: unknown; readonly outcomeUnknown?: boolean; readonly path?: string; readonly retryable?: boolean; } declare const SUPABASH_ERROR: unique symbol; export declare class SupabashError extends Error { readonly [SUPABASH_ERROR] = true; readonly code: SupabashErrorCode; readonly outcomeUnknown: boolean; readonly path?: string; readonly retryable: boolean; constructor(code: SupabashErrorCode, message: string, options?: SupabashErrorOptions); } /** Recognize errors across independently bundled package entry points. */ export declare const isSupabashError: (error: unknown) => error is SupabashError; export declare const isRetryableSupabashError: (error: unknown) => error is SupabashError; export declare const isUnknownOutcomeSupabashError: (error: unknown) => error is SupabashError; //#endregion //#region src/api/observability.d.ts type WorkspaceOperation = 'checkpoint' | 'checkpoint-delete' | 'checkpoint-list' | 'commit' | 'diff' | 'filesystem-projection' | 'history' | 'purge' | 'redact' | 'restore-floor' | 'revision-load' | 'snapshot-load'; interface WorkspaceOperationEvent { readonly backend: WorkspaceBackendKind; readonly changeCount?: number; readonly documentCount?: number; readonly durationMs: number; readonly errorCode?: SupabashErrorCode; readonly operation: WorkspaceOperation; readonly outcome: 'conflict' | 'failure' | 'success'; readonly replayed?: boolean; readonly serializedPayloadBytes?: number; readonly totalUtf8Bytes?: number; } interface WorkspaceObservability { /** * Receives privacy-safe operation summaries. Observer failures are ignored and cannot change * workspace behavior. */ readonly onOperation: (event: WorkspaceOperationEvent) => void; } //#endregion //#region src/api/postgres.d.ts export declare const POSTGRES_WORKSPACE_CAPABILITIES: Readonly<{ readonly backend: 'postgres'; readonly content: 'utf8-text-tree'; readonly durableEmptyDirectories: false; readonly modes: false; readonly symbolicLinks: false; }>; type PostgresWorkspaceCapabilities = typeof POSTGRES_WORKSPACE_CAPABILITIES; interface PostgresWorkspace extends Workspace { readonly redact: (options: RedactOptions) => Promise; readonly restoreFloor: () => Promise; readonly capabilities: PostgresWorkspaceCapabilities; /** A detached copy of the committed base. Staged filesystem changes are excluded. */ readonly committedSnapshot: () => Promise; /** The pinned revision, without loading document bodies. */ readonly committedRevision: () => string | null; } interface PostgresWorkspaceDocumentSnapshot { readonly body: string; readonly bodyByteSize: number; readonly bodyHash: string; readonly byteSize: number; readonly content: string; readonly contentHash: string; readonly metadata: DocumentMetadata; readonly path: string; } interface PostgresWorkspaceSnapshot { readonly committedAt: Date | null; readonly documents: readonly PostgresWorkspaceDocumentSnapshot[]; readonly revision: string | null; readonly transactionId: string | null; } interface DelegatedPostgresWorkspaceInfo { readonly actor: string; readonly correlationId: string; readonly operations: readonly DelegatedOperation[]; readonly subject: string; readonly workspace: string; } interface DelegatedPostgresWorkspace extends PostgresWorkspace { readonly delegation: DelegatedPostgresWorkspaceInfo; } interface PostgresWorkspaceOptions { /** The one canonical workspace identifier understood by the installed SQL functions. */ readonly workspace: string; readonly documentCodec?: TextDocumentCodec; readonly fetch?: typeof globalThis.fetch; readonly limits?: WorkspaceLimits; readonly maxFileSystemBytes?: number; readonly observability?: WorkspaceObservability; readonly publishableKey: string; readonly request: Request; readonly supabaseUrl: string; } interface CreatePostgresWorkspaceOptions { readonly fetch?: typeof globalThis.fetch; readonly publishableKey: string; readonly request: Request; readonly supabaseUrl: string; } /** * The database verifies the capability and returns the grant, so a delegate * needs no verification key of its own. */ interface OpenPostgresDelegatedOptions { readonly capability: string; readonly documentCodec?: TextDocumentCodec; /** Require the granted capability to contain exactly this operation set. */ readonly expectedOperations?: readonly DelegatedOperation[]; readonly fetch?: typeof globalThis.fetch; readonly limits?: WorkspaceLimits; readonly maxFileSystemBytes?: number; readonly observability?: WorkspaceObservability; readonly serviceRoleKey: string; readonly supabaseUrl: string; } //#endregion //#region src/capability/open.d.ts declare const openDelegated: (options: OpenDelegatedOptions) => Promise; //#endregion //#region src/postgres/open.d.ts declare const openPostgres: (options: PostgresWorkspaceOptions) => Promise; declare const createPostgresWorkspace: (options: CreatePostgresWorkspaceOptions) => Promise; declare const openPostgresDelegated: (options: OpenPostgresDelegatedOptions) => Promise; //#endregion //#region src/api/options.d.ts interface SupabashOptions { readonly bucket: string; readonly coordinator?: CommitCoordinator; readonly fetch?: typeof globalThis.fetch; readonly limits?: WorkspaceLimits; readonly maxFileSystemBytes?: number; readonly publishableKey: string; readonly request: Request; readonly supabaseUrl: string; readonly uploadConcurrency?: number; } //#endregion //#region src/api/supabash.d.ts declare const open: (options: SupabashOptions) => Promise; export declare const Supabash: Readonly<{ createPostgresWorkspace: typeof createPostgresWorkspace; open: typeof open; openDelegated: typeof openDelegated; openPostgres: typeof openPostgres; openPostgresDelegated: typeof openPostgresDelegated; }>; //#endregion //#region src/capability/create.d.ts export declare const createDelegatedCapability: (input: CreateDelegatedCapabilityInput) => Promise; export declare const createPostgresDelegatedCapability: (input: CreatePostgresDelegatedCapabilityInput) => Promise; //#endregion //#region src/capability/secret.d.ts /** * Imports the shared Postgres capability secret. The secret is the base64url * value that `public.supabash_register_capability_verifier` returned once and * that the database reads back from `supabase_vault`. Only the minting host * holds it. A delegate that presents a capability never needs it. */ export declare const importCapabilitySecret: (secret: string) => Promise; //#endregion //#region src/capability/verify.d.ts export declare const verifyDelegatedCapability: (input: VerifyDelegatedCapabilityInput) => Promise; //#endregion //#region src/mounts/snapshot.d.ts interface SnapshotFile { readonly path: string; readonly content: string | Uint8Array; } interface SnapshotLimits { readonly maxFiles?: number; readonly maxBytes?: number; } /** Detached source bytes. Its revision is supplied by the trusted publisher. */ interface FileSystemSnapshot { readonly fs: IFileSystem; readonly sourceId: string; readonly revision: string; readonly digest: string; readonly fileCount: number; readonly byteCount: number; } interface CreateFileSystemSnapshotOptions { readonly sourceId: string; readonly revision: string; readonly files: readonly SnapshotFile[]; readonly limits?: SnapshotLimits; } /** Adapt rows from one consistent table read, a release bundle, or another trusted source. */ export declare const createFileSystemSnapshot: (options: CreateFileSystemSnapshotOptions) => Promise; /** Read an explicit immutable revision; staged edits never enter this snapshot. */ export declare const readWorkspaceSnapshot: (options: { readonly workspace: Pick; readonly sourceId: string; readonly revision: string; readonly limits?: SnapshotLimits; }) => Promise; //#endregion //#region src/mounts/contracts.d.ts interface MountLocation { readonly mountPoint: string; readonly view?: WorkspaceFileSystemViewOptions; } interface WritableWorkspaceMount extends MountLocation { readonly access: 'read-write'; readonly sourceId: string; readonly workspace: Pick; } interface ReadonlySnapshotMount extends MountLocation { readonly access: 'read-only'; readonly snapshot: FileSystemSnapshot; } type FileSystemMount = WritableWorkspaceMount | ReadonlySnapshotMount; type MountDescriptor = Readonly<{ mountPoint: string; sourceId: string; root: string; hiddenRoots: readonly string[]; }> & (Readonly<{ access: 'read-write'; }> | Readonly<{ access: 'read-only'; revision: string; digest: string; }>); interface MountedFileSystem { readonly fs: IFileSystem; /** Safe to record with a turn; contains identities and revisions, not file bodies. */ readonly mounts: readonly MountDescriptor[]; /** Translate a visible path to its backing-source identity and stored path. */ readonly toSourcePath: (path: string) => Readonly<{ mountPoint: string; sourceId: string; path: string; }>; /** Translate a stored path (for example a retrieval result) into the tool namespace. */ readonly toVirtualPath: (mountPoint: string, sourcePath: string) => string; } //#endregion //#region src/mounts/compose.d.ts /** Compose already-authorized sources. This view has no commit, restore, or purge API. */ export declare const createMountedFileSystem: (mounts: readonly FileSystemMount[]) => MountedFileSystem; //#endregion //#region src/patch/apply-diff.d.ts type ApplyDiffMode = 'create' | 'default'; export declare const applyDiff: (input: string, diff: string, mode?: ApplyDiffMode) => string; //#endregion //#region src/patch/executor.d.ts type PatchWorkspace = Pick; export declare const applyPatch: (workspace: PatchWorkspace, operation: ApplyPatchOperation, options?: ApplyPatchOptions) => Promise; export declare const applyPatchOperations: (workspace: PatchWorkspace, operations: readonly ApplyPatchOperation[], options?: ApplyPatchOptions) => Promise; //#endregion //#region src/policy/inspect.d.ts export declare const createCommandPolicy: (options?: CommandPolicyOptions) => CommandInspector; //#endregion //#region src/index.d.ts export declare const POSTGRES_INSTALL_SQL_URL: URL; export declare const POSTGRES_REMOVE_SQL_URL: URL; //#endregion export { type AnyDelegatedCapabilityClaims, type ApplyDiffMode, type ApplyPatchBatchMode, type ApplyPatchOperation, type ApplyPatchOptions, type ApplyPatchResult, type ApplyPatchStatus, type CapabilityNonceStore, type CheckpointOptions, type CheckpointReceipt, type CheckpointRecord, type CommandInspectDecision, type CommandInspector, type CommandPolicyFileSystem, type CommandPolicyOptions, type CommitContext, type CommitCoordinator, type CommitLease, type CommitLeaseInput, type CommitOptions, type CommitReceipt, type CommitStatus, type CreateDelegatedCapabilityInput, type CreateFileSystemSnapshotOptions, type CreatePostgresDelegatedCapabilityInput, type CreatePostgresWorkspaceOptions, type CustomCommand, DEFAULT_MAX_COMMAND_LENGTH, DEFAULT_MAX_PATCH_SIZE, DEFAULT_MAX_PIPELINE_DEPTH, DEFAULT_MAX_SEGMENTS, type DelegatedCapabilityClaims, type DelegatedOperation, type DelegatedPostgresWorkspace, type DelegatedPostgresWorkspaceInfo, type DelegatedVerifier, type DocumentMetadata, type DocumentMetadataValue, type FileSystemMount, type FileSystemSnapshot, type FsStat, type HistoryPage, type HistoryQuery, type HistoryRecord, type IFileSystem, type JsonValue, type MountDescriptor, type MountedFileSystem, type OpenDelegatedOptions, type OpenPostgresDelegatedOptions, type PolicyReasonCode, type PostgresDelegatedCapabilityClaims, type PostgresWorkspace, type PostgresWorkspaceCapabilities, type PostgresWorkspaceDocumentSnapshot, type PostgresWorkspaceOptions, type PostgresWorkspaceSnapshot, type PurgeOptions, type PurgeReceipt, type ReadonlySnapshotMount, type ReadonlyWorkspaceView, type RedactOptions, type RedactReceipt, type RestorePlan, type RevisionDiff, type RevisionDiffEntry, type RevisionDiffInput, type RevisionDiffKind, type RevisionDiffRef, type RevisionEntry, type SnapshotFile, type SnapshotLimits, type StoredTextDocument, type SupabashErrorCode, type SupabashErrorOptions, type SupabashOptions, type TextDocumentCodec, type VerifyDelegatedCapabilityInput, type Workspace, type WorkspaceBackendKind, type WorkspaceCapabilities, type WorkspaceChange, type WorkspaceChangeKind, type WorkspaceEntryKind, type WorkspaceFileSystemViewOptions, type WorkspaceLimits, type WorkspaceObservability, type WorkspaceOperation, type WorkspaceOperationEvent, type WritableWorkspaceMount, type YamlFrontmatterCodecOptions, createWorkspaceFileSystemView, defineCommand };