@gpzhang2001/sharpkit-sandbox 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +50 -0
- package/THIRD_PARTY_NOTICES.md +48 -0
- package/lib/index.d.ts +321 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +1145 -0
- package/lib/index.js.map +1 -0
- package/package.json +48 -0
- package/src/brand.ts +24 -0
- package/src/caido.ts +257 -0
- package/src/index.ts +366 -0
- package/src/mounts.ts +197 -0
- package/src/session.ts +444 -0
- package/src/spec.ts +263 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.ts","names":["Schema"],"sources":["../src/mounts.d.ts","../src/caido.d.ts","../../../node_modules/.pnpm/@deepseek-ai+dsh-brand@0.1.2-rc.1_@deepseek-ai+cordis@4.0.2/node_modules/@deepseek-ai/dsh-brand/lib/types/index.d.ts","../src/brand.d.ts","../src/session.d.ts","../src/index.d.ts"],"sourcesContent":["/**\n * Bind-mount assembly: workspace source mapping, protected-metadata mounts\n * (`.git` / `.agents` / `.codex`, git-worktree gitdir pointers), extra-file\n * staging path rules, and collision detection. Faithful port of strix\n * session_manager.py `build_bind_mounts` (:54-66), `_metadata_mounts`\n * (:230-245), `_gitdir_from_pointer` (:248-260), `_extra_file_rel_path`\n * (:80-97), `_collides_with_source_root` (:111-124), and the staging-dir\n * sanitizer (:172-180). Filesystem facts arrive through an injectable probe\n * so every branch is unit-testable without touching a real tree.\n * @module @gpzhang2001/sharpkit-sandbox/mounts\n */\nimport type { SandboxBindMount } from './spec.ts';\n/** One source tree mounted into the sandbox workspace. */\nexport interface SandboxSourceSpec {\n /** Directory name under the workspace root (`/workspace/<subdir>`). */\n readonly workspaceSubdir: string;\n /** Host path of the tree to mount. */\n readonly sourcePath: string;\n /** Mount `.git`/`.agents`/`.codex` (and worktree gitdir) read-only on top. */\n readonly protectMetadata?: boolean;\n}\n/** Injected filesystem facts; the real service passes node:fs-backed probes. */\nexport interface FsProbe {\n /** Resolve a path to its canonical absolute form (symlinks followed). */\n resolve(path: string): string;\n exists(path: string): boolean;\n isDirectory(path: string): boolean;\n /** Whether the path exists as a regular file (a worktree `.git` pointer). */\n isFile(path: string): boolean;\n /** Read a small text file, or null when unreadable (pointer parse is best-effort). */\n readTextFile(path: string): string | null;\n}\n/** Metadata names that get their own read-only overlay mount. */\nexport declare const PROTECTED_METADATA_NAMES: readonly [\".git\", \".agents\", \".codex\"];\n/**\n * Whether `child` is `parent` itself or underneath it, POSIX-style.\n * @param parent - candidate ancestor path, already canonical.\n * @param child - candidate descendant path, already canonical.\n */\nexport declare function isSubpath(parent: string, child: string): boolean;\n/**\n * Parse a git worktree `.git` pointer file for its `gitdir:` line.\n * @param content - the raw pointer file text.\n * @param base - directory of the pointer file, for relative gitdir values.\n * @param resolve - canonicalizer for the candidate path.\n * @returns the resolved gitdir, or null when absent/malformed.\n */\nexport declare function parseGitdirPointer(content: string, base: string, resolve: (path: string) => string): string | null;\n/**\n * Build the read-only metadata overlay mounts for one source tree (strix\n * `_metadata_mounts`): each protected name that exists in the tree is mounted\n * read-only at `<target>/<name>`; a file-shaped `.git` (worktree pointer)\n * additionally gets its resolved gitdir mounted read-only when the gitdir\n * stays inside the tree.\n * @param tree - canonical host path of the source tree.\n * @param target - container mount target of the tree (e.g. `/workspace/app`).\n * @param probe - filesystem facts.\n * @returns the overlay mounts (possibly empty).\n */\nexport declare function metadataMounts(tree: string, target: string, probe: FsProbe): SandboxBindMount[];\n/**\n * Build every bind mount for the session's sources: workspace mounts plus\n * metadata overlays, sorted shallowest-target-first so nested targets land on\n * top (strix sort by `/` count).\n * @param sources - the source specs; entries missing either path part are skipped.\n * @param probe - filesystem facts.\n * @param workspaceRoot - container workspace root (default `/workspace`).\n * @returns the sorted mounts.\n */\nexport declare function buildBindMounts(sources: readonly SandboxSourceSpec[], probe: FsProbe, workspaceRoot: string): SandboxBindMount[];\n/**\n * Validate an extra file's container path (strix `_extra_file_rel_path`):\n * must live under the workspace root, have no empty/`.`/`..` segments, and\n * carry no control characters.\n * @param containerPath - the requested absolute container path.\n * @param workspaceRoot - container workspace root (default `/workspace`).\n * @returns the workspace-relative path, or null when invalid.\n */\nexport declare function extraFileRelPath(containerPath: string, workspaceRoot: string): string | null;\n/**\n * Whether a candidate workspace-relative path collides with any source root\n * or previously placed extra file (strix `_collides_with_source_root`,\n * ancestor relationships included).\n * @param rel - candidate workspace-relative path.\n * @param roots - existing roots (subdirs and placed extra files), workspace-relative.\n */\nexport declare function collidesWithRoots(rel: string, roots: readonly string[]): boolean;\n/**\n * Sanitize a scan id for a staging directory name (strix keeps `[alnum]-_.`,\n * everything else becomes `-`).\n * @param scanId - the raw scan id.\n * @returns the sanitized name fragment (empty collapses to a single `-`).\n */\nexport declare function stagingDirName(scanId: string): string;\n/**\n * The staged host path for one extra file (strix: numbered subdir + basename,\n * so same-basename files cannot clobber each other).\n * @param stagingDir - the session's staging directory.\n * @param index - the extra file's placement index.\n * @param rel - the validated workspace-relative path.\n * @returns the host file path to write the content to.\n */\nexport declare function stagedFilePath(stagingDir: string, index: number, rel: string): string;\n","/**\n * Caido proxy bootstrap, ported from strix caido_bootstrap.py + caido_handle.py:\n * guest login via `curl` executed INSIDE the container (the retry loop is the\n * readiness probe — there is no separate TCP healthcheck), then project\n * create/select over GraphQL against the host-side published endpoint using\n * global fetch. The bootstrap runs concurrently with scan start; consumers\n * resolve it lazily, and one caller's cancellation cannot cancel the shared\n * task (the underlying promise is shared, matching asyncio.shield semantics).\n * @module @gpzhang2001/sharpkit-sandbox/caido\n */\n/** A ready-to-use host-side Caido endpoint. */\nexport interface CaidoEndpoint {\n /** Base URL of the published Caido GraphQL endpoint (no trailing slash). */\n readonly baseUrl: string;\n /** Guest access token for the `Authorization: Bearer` header. */\n readonly token: string;\n /** Id of the created sandbox project. */\n readonly projectId: string;\n}\n/** Minimal exec contract the bootstrap needs (container-internal command). */\nexport interface CaidoExecFn {\n (command: string, timeoutMs: number): Promise<{\n readonly ok: boolean;\n readonly exitCode: number | null;\n readonly stdout: string;\n readonly stderr: string;\n }>;\n}\n/** Minimal fetch contract (global fetch shape) for GraphQL calls. */\nexport interface CaidoFetchFn {\n (url: string, init: {\n readonly method: 'POST';\n readonly headers: Readonly<Record<string, string>>;\n readonly body: string;\n readonly signal: AbortSignal;\n }): Promise<{\n readonly status: number;\n readonly text: () => Promise<string>;\n }>;\n}\n/** Minimal awaited-fetch shape after `.text()`. */\nexport type CaidoFetchResponse = Awaited<ReturnType<CaidoFetchFn>>;\n/** Injected clock for the retry backoff (tests pass a no-op). */\nexport type CaidoSleepFn = (ms: number) => Promise<void>;\n/**\n * Build the container-internal curl login command (strix caido_bootstrap.py:46-57).\n * @param containerBaseUrl - the in-container Caido base URL (`http://127.0.0.1:48080`).\n * @returns the shell command string for exec.\n */\nexport declare function loginCurlCommand(containerBaseUrl: string): string;\n/**\n * Extract the guest token from a login response payload.\n * @param stdout - raw curl stdout.\n * @returns the access token.\n * @throws when the payload is unparseable or carries no token (strix error wording).\n */\nexport declare function parseLoginToken(stdout: string): string;\n/**\n * Run the guest login with retries (strix `_login_as_guest`: attempts with\n * capped linear backoff 2,4,6,8,8… seconds; per-attempt exec timeout).\n * @param exec - container exec channel.\n * @param containerBaseUrl - in-container Caido base URL.\n * @param options - attempts/timeout/backoff knobs and injected sleep.\n * @returns the access token.\n * @throws when every attempt fails (strix error wording).\n */\nexport declare function loginAsGuest(exec: CaidoExecFn, containerBaseUrl: string, options: {\n readonly attempts: number;\n readonly timeoutMs: number;\n readonly sleep: CaidoSleepFn;\n}): Promise<string>;\n/**\n * Full bootstrap: guest login, then create the temporary sandbox project and\n * select it (strix `bootstrap_caido`).\n * @param exec - container exec channel (login curl runs in-container).\n * @param fetchFn - host-side fetch channel (project calls).\n * @param urls - container and host base URLs.\n * @param options - retry/timeout knobs and injected sleep.\n * @returns the ready endpoint.\n */\nexport declare function bootstrapCaido(exec: CaidoExecFn, fetchFn: CaidoFetchFn, urls: {\n readonly containerBaseUrl: string;\n readonly hostBaseUrl: string;\n}, options: {\n readonly attempts: number;\n readonly timeoutMs: number;\n readonly sleep: CaidoSleepFn;\n readonly signal: AbortSignal;\n}): Promise<CaidoEndpoint>;\n/**\n * Shared, lazily-resolved bootstrap task (strix `CaidoBootstrapHandle`): the\n * promise is created once and shared, so individual consumer cancellations\n * cannot cancel the shared bootstrap; `close()` aborts it for teardown.\n */\nexport declare class CaidoBootstrap {\n private readonly endpoint;\n private readonly controller;\n private settled;\n constructor(start: (signal: AbortSignal) => Promise<CaidoEndpoint>);\n /** Resolve the endpoint; rejects with the bootstrap failure, shared by all callers. */\n get(): Promise<CaidoEndpoint>;\n /** The resolved endpoint, or undefined while pending/failed (strix `peek`). */\n peek(): CaidoEndpoint | undefined;\n /** Abort a pending bootstrap; failures are swallowed (teardown path). */\n close(): void;\n}\n","/**\n * Duplicate-install-safe nominal primitive helpers.\n *\n * A brand makes structurally identical strings or numbers non-interchangeable\n * at the type level: a `SessionId` cannot be passed where a `ToolCallId` is\n * expected, and an event sequence cannot be passed as a log offset. Comparison,\n * logging, and serialization retain the underlying primitive behavior.\n *\n * This package owns no concrete domain value and keeps no runtime identity or mutable\n * state, so independently installed copies produce interchangeable values.\n *\n * @module @deepseek-ai/dsh-brand\n */\ndeclare const BRAND: unique symbol;\n/** A string carrying a compile-time-only brand `B`. */\nexport type Branded<B extends string> = string & {\n readonly [BRAND]: B;\n};\n/** A number carrying a compile-time-only brand `B`. */\nexport type BrandedNumber<B extends string> = number & {\n readonly [BRAND]: B;\n};\n/**\n * Apply a compile-time string brand without changing the value.\n * @param value - string admitted by the domain that owns the target brand.\n * @returns the same string with the requested compile-time brand.\n */\nexport declare function brandString<T extends Branded<string>>(value: string | T): T;\n/**\n * Apply a compile-time number brand without changing the value.\n * @param value - number admitted by the domain that owns the target brand.\n * @returns the same number with the requested compile-time brand.\n */\nexport declare function brandNumber<T extends BrandedNumber<string>>(value: number | T): T;\nexport {};\n//# sourceMappingURL=index.d.ts.map","/**\n * Opaque cross-boundary ids for the pentest sandbox seam. Kept in a leaf\n * module so consumers can import the types without dragging in runtime code\n * (`@deepseek-ai/dsh-brand` pattern, cf. jobs' JobId).\n * @module @gpzhang2001/sharpkit-sandbox/brand\n */\nimport type { Branded } from '@deepseek-ai/dsh-brand';\n/** Opaque id of one sandbox session (container + Caido bootstrap). */\nexport type SandboxSessionId = Branded<'SandboxSessionId'>;\n/** Opaque id of one PTY-backed interactive process inside a session. */\nexport type SandboxProcessId = Branded<'SandboxProcessId'>;\n/** Brand a raw string as a {@link SandboxSessionId}. */\nexport declare function SandboxSessionId(id: string): SandboxSessionId;\n/** Brand a raw string as a {@link SandboxProcessId}. */\nexport declare function SandboxProcessId(id: string): SandboxProcessId;\n","/**\n * One docker-CLI sandbox session: exec/PTY command execution, file transfer\n * via `docker cp`, lazy Caido endpoint, and strix-parity teardown. The\n * subprocess seam arrives as a structural interface so the session is\n * drivable from tests exactly like the S1 spike drove it. Teardown follows\n * strix session_manager.cleanup order (staging → caido → container), each\n * step best-effort with logging; host-side PTY trees are terminated first\n * (spike finding D1.4: host terminate cannot reach daemon-owned container\n * processes, so `docker rm -f` is the authoritative reaper).\n * @module @gpzhang2001/sharpkit-sandbox/session\n */\nimport type { SubprocessHandle, SubprocessSpawnSpec, SubprocessTerminalHandle, SubprocessTerminalSpawnSpec } from '@deepseek-ai/dsh-subprocess';\nimport { CaidoBootstrap, type CaidoEndpoint } from './caido.ts';\nimport { SandboxProcessId, type SandboxSessionId } from './brand.ts';\nimport { type SandboxBindMount } from './spec.ts';\n/** Structural view of `ctx.subprocess` the session drives (S1 spike shape). */\nexport interface SubprocessLike {\n spawn(spec: SubprocessSpawnSpec): SubprocessHandle;\n spawnTerminal(spec: SubprocessTerminalSpawnSpec): Promise<SubprocessTerminalHandle>;\n}\n/** Logger subset (cordis logger satisfies this structurally). */\nexport interface SandboxLogger {\n debug(message: string): void;\n info(message: string): void;\n warn(message: string): void;\n error(message: string): void;\n}\n/** Options for a non-interactive exec. */\nexport interface SandboxExecOptions {\n /** Working directory inside the container. */\n readonly cwd?: string | undefined;\n /** Per-call timeout; a timed-out command is terminated and reported. */\n readonly timeoutMs?: number | undefined;\n /** Cooperative cancellation: aborting terminates the tree (tool exec.signal). */\n readonly signal?: AbortSignal | undefined;\n}\n/** Result of a non-interactive exec. */\nexport interface SandboxExecResult {\n readonly exitCode: number | null;\n readonly signal: string | null;\n readonly stdout: string;\n readonly stderr: string;\n /** True only when the deadline fired (caller cancellation is `aborted`). */\n readonly timedOut: boolean;\n /** True when the caller's AbortSignal fired (cooperative cancellation). */\n readonly aborted: boolean;\n}\n/** One live PTY-backed interactive process. */\nexport interface SandboxTtyProcess {\n readonly id: SandboxProcessId;\n readonly command: string;\n /** Feed characters into the process (Ctrl-C arrives as `\\x03`, finding D1.1). */\n write(chars: string): Promise<void>;\n /** Subscribe to decoded output chunks; returns an unsubscribe function. */\n subscribe(listener: (chunk: string) => void): () => void;\n /** Resolves when the process exits. */\n readonly done: Promise<SandboxExecResult>;\n /** Terminate the host-side tree (container residue is reaped by session stop). */\n terminate(): Promise<void>;\n}\n/** The session contract consumed by the suite's tool packages. */\nexport interface PentestSandboxSession {\n readonly sessionId: SandboxSessionId;\n readonly scanId: string;\n readonly containerId: string;\n /** Await Caido readiness (the guest-login retry loop is the probe). */\n ready(): Promise<void>;\n /** Run one command in a fresh non-interactive login shell. */\n exec(command: string, options?: SandboxExecOptions): Promise<SandboxExecResult>;\n /** Start a cancellable no-timeout exec for background jobs. */\n execJob(command: string, options?: {\n readonly cwd?: string | undefined;\n }): SandboxExecProcess;\n /** Start one PTY-backed interactive process (REPL/ssh/msfconsole). */\n execTty(command: string, options?: {\n readonly cwd?: string | undefined;\n readonly rows?: number | undefined;\n readonly cols?: number | undefined;\n }): Promise<SandboxTtyProcess>;\n /** Write characters to a live PTY process. */\n writeStdin(processId: SandboxProcessId, chars: string): Promise<void>;\n /** Copy a host file into the container. */\n putFile(hostPath: string, containerPath: string): Promise<void>;\n /** Read a container file out as raw bytes (binary-safe via docker cp). */\n getFile(containerPath: string): Promise<Uint8Array>;\n /** The host-side Caido endpoint (resolves readiness first). */\n caidoEndpoint(): Promise<CaidoEndpoint>;\n /** Best-effort teardown: PTYs, staging dir, caido, container. */\n stop(): Promise<void>;\n}\n/**\n * Run one argv to completion with collected output and a hard timeout that\n * terminates (and joins) the tree — the primitive every docker CLI call in\n * the session goes through. A timeout and a caller abort terminate the host\n * tree identically but are reported separately (`timedOut` vs `aborted`);\n * per spike finding D1.4, host-side termination cannot reach daemon-owned\n * container processes — a timed-out `docker exec` may leave its command\n * running inside the container until the session stops and reaps it.\n * @param subprocess - the subprocess seam.\n * @param argv - full argv, argv[0] a program (never shell-interpreted).\n * @param options - timeout and terminate grace.\n * @returns the collected outcome.\n */\nexport declare function runCollectArgv(subprocess: SubprocessLike, argv: readonly string[], options: {\n readonly timeoutMs: number;\n readonly graceMs: number;\n readonly collectMaxBytes: number;\n readonly signal?: AbortSignal | undefined;\n}): Promise<SandboxExecResult>;\n/** A cancellable long-running non-interactive exec (jobs integration). */\nexport interface SandboxExecProcess {\n readonly processId: SandboxProcessId;\n /** Resolves with the full collected outcome after the tree settles. */\n readonly done: Promise<SandboxExecResult>;\n /** Consuming delta of stdout since the previous call ('' when nothing new). */\n readOutput(): string;\n /** Terminate the host-side tree; `done` then settles with the partial output. */\n terminate(): void;\n}\n/** Knobs the service hands each session (resolved Config values). */\nexport interface SandboxSessionDeps {\n readonly subprocess: SubprocessLike;\n readonly logger: SandboxLogger;\n readonly containerId: string;\n readonly scanId: string;\n readonly containerCaidoBaseUrl: string;\n readonly hostCaidoBaseUrl: string;\n readonly bootstrap: CaidoBootstrap;\n /** Extra-file staging directory to remove on stop (undefined when none). */\n readonly stagingDir?: string | undefined;\n readonly graceMs: number;\n readonly defaultExecTimeoutMs: number;\n readonly collectMaxBytes: number;\n}\n/**\n * The docker-CLI-backed {@link PentestSandboxSession}. Constructed by the\n * service after the container is created and started; never constructed\n * directly by consumers.\n */\nexport declare class DockerCliSandboxSession implements PentestSandboxSession {\n readonly sessionId: SandboxSessionId;\n readonly scanId: string;\n readonly containerId: string;\n private readonly deps;\n private readonly ttyProcesses;\n private stopped;\n constructor(deps: SandboxSessionDeps);\n ready(): Promise<void>;\n caidoEndpoint(): Promise<CaidoEndpoint>;\n exec(command: string, options?: SandboxExecOptions): Promise<SandboxExecResult>;\n /**\n * Start a cancellable long-running exec with no timeout (jobs own the\n * lifetime): the caller polls {@link SandboxExecProcess.readOutput} deltas\n * and terminates on cancel.\n */\n execJob(command: string, options?: {\n readonly cwd?: string | undefined;\n }): SandboxExecProcess;\n execTty(command: string, options?: {\n readonly cwd?: string | undefined;\n readonly rows?: number | undefined;\n readonly cols?: number | undefined;\n }): Promise<SandboxTtyProcess>;\n writeStdin(processId: SandboxProcessId, chars: string): Promise<void>;\n putFile(hostPath: string, containerPath: string): Promise<void>;\n getFile(containerPath: string): Promise<Uint8Array>;\n stop(): Promise<void>;\n}\n/**\n * Stage extra files for bind mounting (strix `build_extra_file_bind_mounts`):\n * one numbered subdir per file, content written, mounted read-only at its\n * workspace path.\n * @param stagingDir - the session staging directory (already created).\n * @param items - validated extra files: rel path + bytes.\n * @param workspaceRoot - container workspace root (default `/workspace`).\n * @returns the mounts, in placement order.\n */\nexport declare function stageExtraFiles(stagingDir: string, items: readonly {\n readonly rel: string;\n readonly content: Uint8Array;\n}[], workspaceRoot: string): Promise<SandboxBindMount[]>;\n","/**\n * Docker sandbox capability for the sharpkit pentest suite: the\n * `ctx.pentestSandbox` service (decision D1: `ctx.subprocess` + docker CLI,\n * argv built by the pure spec module). Port of strix runtime/session_manager\n * `create_or_reuse` + `cleanup` semantics: sessions cached by scan id,\n * container lifecycle over the CLI, extra files staged under the temp dir\n * (a remote docker daemon resolves bind sources on its own filesystem), and\n * a lazy Caido bootstrap that runs concurrently with scan start. Teardown is\n * registered once via ctx.effect and stops every live session best-effort.\n * @module @gpzhang2001/sharpkit-sandbox\n */\nimport { Context, Service } from '@deepseek-ai/cordis';\nimport type Schema from '@deepseek-ai/schemastery';\nimport { type SandboxSourceSpec } from './mounts.ts';\nimport { type PentestSandboxSession } from './session.ts';\nexport type { PentestSandboxSession, SandboxExecOptions, SandboxExecResult, SandboxTtyProcess, } from './session.ts';\nexport type { CaidoBootstrap, CaidoEndpoint } from './caido.ts';\nexport type { SandboxSourceSpec } from './mounts.ts';\nexport { SandboxProcessId, SandboxSessionId } from './brand.ts';\nexport type { SandboxProcessId as SandboxProcessIdType, SandboxSessionId as SandboxSessionIdType } from './brand.ts';\ndeclare module '@deepseek-ai/cordis' {\n interface Context {\n pentestSandbox: PentestSandboxService;\n }\n}\n/** One extra file materialized into the workspace before container start. */\nexport interface SandboxExtraFile {\n /** Absolute container path under the workspace root. */\n readonly containerPath: string;\n /** File content; strings are encoded UTF-8. */\n readonly content: string | Uint8Array;\n}\n/** Options for {@link PentestSandboxService.createSession}. */\nexport interface SandboxSessionOptions {\n /** Cache key; repeated ids reuse the live session (strix create_or_reuse). */\n readonly scanId: string;\n /** Source trees to bind-mount read-write into the workspace. */\n readonly sources?: readonly SandboxSourceSpec[];\n /** Extra files staged on the host and mounted read-only into the workspace. */\n readonly extraFiles?: readonly SandboxExtraFile[];\n}\n/** Deployment-tunable configuration (cordis resolves defaults before apply). */\nexport interface Config {\n /** Sandbox image reference. */\n readonly image?: string;\n /** Terminate grace for every docker CLI tree the session owns. */\n readonly containerGraceMs?: number;\n /** Container workspace root (protocol constant with the image). */\n readonly workspaceRoot?: string;\n /** Existing docker network to attach to (publishes no ports; strix sandbox-network mode). */\n readonly network?: string;\n /** Resource limits (strix STRIX_SANDBOX_* env knobs, now config). */\n readonly memLimit?: string;\n readonly shmSize?: string;\n readonly cpus?: number;\n readonly pidsLimit?: number;\n /** Log rotation; max-size 0/off/none/unlimited disables (strix default \"50m\"/3). */\n readonly logMaxSize?: string;\n readonly logMaxFile?: number;\n /** Run labels forwarded to the container (strix STRIX_RUN_ID/RUN_TYPE). */\n readonly runLabelId?: string;\n readonly runLabelType?: string;\n /** Caido guest-login retry budget (the readiness probe). */\n readonly caidoLoginAttempts?: number;\n /** Per-attempt login exec timeout. */\n readonly caidoLoginTimeoutMs?: number;\n /** Default timeout for exec and docker CLI helper calls. */\n readonly defaultExecTimeoutMs?: number;\n /** Collect window for exec stdout/stderr (bytes; larger streams go lossy). */\n readonly execCollectMaxBytes?: number;\n}\n/**\n * The pentest sandbox service: creates, caches, and reuses docker-CLI\n * sandbox sessions. Load as a plugin after a subprocess provider; it\n * registers as `ctx.pentestSandbox` (one per context).\n */\nexport declare class PentestSandboxService extends Service {\n static inject: string[];\n static Config: Schema<Config>;\n private readonly config;\n private readonly sessions;\n /** node:fs-backed mount facts; a handful of sync calls on a few paths. */\n private readonly probe;\n constructor(ctx: Context, config?: Config);\n /**\n * Create (or reuse) the sandbox session for a scan id — strix\n * `create_or_reuse` parity, including lazy Caido bootstrap.\n * @param options - scan identity, sources, extra files.\n * @returns the live session.\n */\n createSession(options: SandboxSessionOptions): Promise<PentestSandboxSession>;\n /** Stop and forget one session (idempotent; strix `cleanup`). */\n destroySession(scanId: string): Promise<void>;\n /** Validate + stage extra files (strix skip-and-warn semantics). */\n private stageExtraFiles;\n /** Pull the image when missing (strix image_exists → pull). */\n private ensureImage;\n /** Resolve the host-side Caido base URL for a started container. */\n private resolveCaidoHostUrl;\n}\nexport default PentestSandboxService;\n"],"x_google_ignoreList":[2],"mappings":";;;;AACA,IAAW,CAAC,qBAAqB;CAAC;OAAS,CAAC;CAAG;EAAC;EAAI;EAAI;CAAE;AAAC;;;ACD3D,IAAW,CAAC,iBAAiB;CAAC;OAAU,CAAC;CAAG;EAAC;EAAI;EAAI;CAAE;AAAC;AASxD,IAAW,CAAC,kBAAkB;CAAC;OAAU;EAAC;EAAa;EAAe;EAAS;EAAe;EAAS;CAAa;CAAG;EAAC;EAAI;EAAI;EAAI;EAAI;EAAI;EAAI;EAAI;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