@ai-hero/sandcastle 0.6.5 → 0.6.6
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/README.md +123 -54
- package/dist/{MountConfig.d.ts → MountConfig-CmXclHA5.d.ts} +3 -2
- package/dist/{SandboxProvider.d.ts → SandboxProvider-EkSMuBp8.d.ts} +25 -39
- package/dist/chunk-72UVAC7B.js +99 -0
- package/dist/chunk-72UVAC7B.js.map +1 -0
- package/dist/chunk-BIWNFKGV.js +22 -0
- package/dist/chunk-BIWNFKGV.js.map +1 -0
- package/dist/chunk-NGBM7T3E.js +76 -0
- package/dist/chunk-NGBM7T3E.js.map +1 -0
- package/dist/chunk-Q5W3WQVU.js +25569 -0
- package/dist/chunk-Q5W3WQVU.js.map +1 -0
- package/dist/chunk-UPDEQ2U7.js +362 -0
- package/dist/chunk-UPDEQ2U7.js.map +1 -0
- package/dist/chunk-Z7O2WNRU.js +26934 -0
- package/dist/chunk-Z7O2WNRU.js.map +1 -0
- package/dist/index.d.ts +920 -22
- package/dist/index.js +3212 -9
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts +0 -2
- package/dist/main.js +19256 -13
- package/dist/main.js.map +1 -1
- package/dist/mountUtils-CCA-bbpK.d.ts +25 -0
- package/dist/sandboxes/daytona.d.ts +8 -5
- package/dist/sandboxes/daytona.js +118 -124
- package/dist/sandboxes/daytona.js.map +1 -1
- package/dist/sandboxes/docker.d.ts +10 -8
- package/dist/sandboxes/docker.js +8 -255
- package/dist/sandboxes/docker.js.map +1 -1
- package/dist/sandboxes/no-sandbox.d.ts +7 -4
- package/dist/sandboxes/no-sandbox.js +6 -114
- package/dist/sandboxes/no-sandbox.js.map +1 -1
- package/dist/sandboxes/podman.d.ts +10 -8
- package/dist/sandboxes/podman.js +287 -297
- package/dist/sandboxes/podman.js.map +1 -1
- package/dist/sandboxes/vercel.d.ts +7 -4
- package/dist/sandboxes/vercel.js +144 -165
- package/dist/sandboxes/vercel.js.map +1 -1
- package/package.json +15 -14
- package/dist/AgentProvider.d.ts +0 -134
- package/dist/AgentProvider.d.ts.map +0 -1
- package/dist/AgentProvider.js +0 -647
- package/dist/AgentProvider.js.map +0 -1
- package/dist/AgentStreamEmitter.d.ts +0 -36
- package/dist/AgentStreamEmitter.d.ts.map +0 -1
- package/dist/AgentStreamEmitter.js +0 -21
- package/dist/AgentStreamEmitter.js.map +0 -1
- package/dist/CopyToWorktree.d.ts +0 -15
- package/dist/CopyToWorktree.d.ts.map +0 -1
- package/dist/CopyToWorktree.js +0 -60
- package/dist/CopyToWorktree.js.map +0 -1
- package/dist/Display.d.ts +0 -58
- package/dist/Display.d.ts.map +0 -1
- package/dist/Display.js +0 -142
- package/dist/Display.js.map +0 -1
- package/dist/DockerLifecycle.d.ts +0 -54
- package/dist/DockerLifecycle.d.ts.map +0 -1
- package/dist/DockerLifecycle.js +0 -123
- package/dist/DockerLifecycle.js.map +0 -1
- package/dist/EnvResolver.d.ts +0 -11
- package/dist/EnvResolver.d.ts.map +0 -1
- package/dist/EnvResolver.js +0 -63
- package/dist/EnvResolver.js.map +0 -1
- package/dist/ErrorHandler.d.ts +0 -15
- package/dist/ErrorHandler.d.ts.map +0 -1
- package/dist/ErrorHandler.js +0 -85
- package/dist/ErrorHandler.js.map +0 -1
- package/dist/InitService.d.ts +0 -92
- package/dist/InitService.d.ts.map +0 -1
- package/dist/InitService.js +0 -836
- package/dist/InitService.js.map +0 -1
- package/dist/MountConfig.d.ts.map +0 -1
- package/dist/MountConfig.js +0 -7
- package/dist/MountConfig.js.map +0 -1
- package/dist/Orchestrator.d.ts +0 -56
- package/dist/Orchestrator.d.ts.map +0 -1
- package/dist/Orchestrator.js +0 -293
- package/dist/Orchestrator.js.map +0 -1
- package/dist/Output.d.ts +0 -107
- package/dist/Output.d.ts.map +0 -1
- package/dist/Output.js +0 -95
- package/dist/Output.js.map +0 -1
- package/dist/PodmanLifecycle.d.ts +0 -17
- package/dist/PodmanLifecycle.d.ts.map +0 -1
- package/dist/PodmanLifecycle.js +0 -45
- package/dist/PodmanLifecycle.js.map +0 -1
- package/dist/PromptArgumentSubstitution.d.ts +0 -32
- package/dist/PromptArgumentSubstitution.d.ts.map +0 -1
- package/dist/PromptArgumentSubstitution.js +0 -104
- package/dist/PromptArgumentSubstitution.js.map +0 -1
- package/dist/PromptPreprocessor.d.ts +0 -15
- package/dist/PromptPreprocessor.d.ts.map +0 -1
- package/dist/PromptPreprocessor.js +0 -55
- package/dist/PromptPreprocessor.js.map +0 -1
- package/dist/PromptResolver.d.ts +0 -21
- package/dist/PromptResolver.d.ts.map +0 -1
- package/dist/PromptResolver.js +0 -27
- package/dist/PromptResolver.js.map +0 -1
- package/dist/RecoveryMessage.d.ts +0 -15
- package/dist/RecoveryMessage.d.ts.map +0 -1
- package/dist/RecoveryMessage.js +0 -81
- package/dist/RecoveryMessage.js.map +0 -1
- package/dist/SandboxFactory.d.ts +0 -90
- package/dist/SandboxFactory.d.ts.map +0 -1
- package/dist/SandboxFactory.js +0 -324
- package/dist/SandboxFactory.js.map +0 -1
- package/dist/SandboxLifecycle.d.ts +0 -65
- package/dist/SandboxLifecycle.d.ts.map +0 -1
- package/dist/SandboxLifecycle.js +0 -296
- package/dist/SandboxLifecycle.js.map +0 -1
- package/dist/SandboxProvider.d.ts.map +0 -1
- package/dist/SandboxProvider.js +0 -28
- package/dist/SandboxProvider.js.map +0 -1
- package/dist/SessionStore.d.ts +0 -110
- package/dist/SessionStore.d.ts.map +0 -1
- package/dist/SessionStore.js +0 -330
- package/dist/SessionStore.js.map +0 -1
- package/dist/TextDeltaBuffer.d.ts +0 -24
- package/dist/TextDeltaBuffer.d.ts.map +0 -1
- package/dist/TextDeltaBuffer.js +0 -68
- package/dist/TextDeltaBuffer.js.map +0 -1
- package/dist/WorktreeManager.d.ts +0 -79
- package/dist/WorktreeManager.d.ts.map +0 -1
- package/dist/WorktreeManager.js +0 -283
- package/dist/WorktreeManager.js.map +0 -1
- package/dist/boundedTail.d.ts +0 -48
- package/dist/boundedTail.d.ts.map +0 -1
- package/dist/boundedTail.js +0 -64
- package/dist/boundedTail.js.map +0 -1
- package/dist/cli.d.ts +0 -30
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -340
- package/dist/cli.js.map +0 -1
- package/dist/createSandbox.d.ts +0 -154
- package/dist/createSandbox.d.ts.map +0 -1
- package/dist/createSandbox.js +0 -476
- package/dist/createSandbox.js.map +0 -1
- package/dist/createWorktree.d.ts +0 -154
- package/dist/createWorktree.d.ts.map +0 -1
- package/dist/createWorktree.js +0 -391
- package/dist/createWorktree.js.map +0 -1
- package/dist/errors.d.ts +0 -227
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -81
- package/dist/errors.js.map +0 -1
- package/dist/extractStructuredOutput.d.ts +0 -23
- package/dist/extractStructuredOutput.d.ts.map +0 -1
- package/dist/extractStructuredOutput.js +0 -102
- package/dist/extractStructuredOutput.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/interactive.d.ts +0 -74
- package/dist/interactive.d.ts.map +0 -1
- package/dist/interactive.js +0 -279
- package/dist/interactive.js.map +0 -1
- package/dist/main.d.ts.map +0 -1
- package/dist/mergeProviderEnv.d.ts +0 -13
- package/dist/mergeProviderEnv.d.ts.map +0 -1
- package/dist/mergeProviderEnv.js +0 -23
- package/dist/mergeProviderEnv.js.map +0 -1
- package/dist/mountUtils.d.ts +0 -146
- package/dist/mountUtils.d.ts.map +0 -1
- package/dist/mountUtils.js +0 -301
- package/dist/mountUtils.js.map +0 -1
- package/dist/raceAbortSignal.d.ts +0 -18
- package/dist/raceAbortSignal.d.ts.map +0 -1
- package/dist/raceAbortSignal.js +0 -32
- package/dist/raceAbortSignal.js.map +0 -1
- package/dist/resolveCwd.d.ts +0 -24
- package/dist/resolveCwd.d.ts.map +0 -1
- package/dist/resolveCwd.js +0 -32
- package/dist/resolveCwd.js.map +0 -1
- package/dist/resumePrecheck.d.ts +0 -26
- package/dist/resumePrecheck.d.ts.map +0 -1
- package/dist/resumePrecheck.js +0 -40
- package/dist/resumePrecheck.js.map +0 -1
- package/dist/run.d.ts +0 -216
- package/dist/run.d.ts.map +0 -1
- package/dist/run.js +0 -313
- package/dist/run.js.map +0 -1
- package/dist/sandboxExec.d.ts +0 -12
- package/dist/sandboxExec.d.ts.map +0 -1
- package/dist/sandboxExec.js +0 -26
- package/dist/sandboxExec.js.map +0 -1
- package/dist/sandboxes/daytona.d.ts.map +0 -1
- package/dist/sandboxes/docker.d.ts.map +0 -1
- package/dist/sandboxes/no-sandbox.d.ts.map +0 -1
- package/dist/sandboxes/podman.d.ts.map +0 -1
- package/dist/sandboxes/test-bind-mount.d.ts +0 -17
- package/dist/sandboxes/test-bind-mount.d.ts.map +0 -1
- package/dist/sandboxes/test-bind-mount.js +0 -92
- package/dist/sandboxes/test-bind-mount.js.map +0 -1
- package/dist/sandboxes/test-isolated.d.ts +0 -17
- package/dist/sandboxes/test-isolated.d.ts.map +0 -1
- package/dist/sandboxes/test-isolated.js +0 -98
- package/dist/sandboxes/test-isolated.js.map +0 -1
- package/dist/sandboxes/vercel.d.ts.map +0 -1
- package/dist/shutdownRegistry.d.ts +0 -30
- package/dist/shutdownRegistry.d.ts.map +0 -1
- package/dist/shutdownRegistry.js +0 -73
- package/dist/shutdownRegistry.js.map +0 -1
- package/dist/startSandbox.d.ts +0 -50
- package/dist/startSandbox.d.ts.map +0 -1
- package/dist/startSandbox.js +0 -117
- package/dist/startSandbox.js.map +0 -1
- package/dist/syncIn.d.ts +0 -24
- package/dist/syncIn.d.ts.map +0 -1
- package/dist/syncIn.js +0 -107
- package/dist/syncIn.js.map +0 -1
- package/dist/syncOut.d.ts +0 -27
- package/dist/syncOut.d.ts.map +0 -1
- package/dist/syncOut.js +0 -271
- package/dist/syncOut.js.map +0 -1
- package/dist/templates.d.ts +0 -2
- package/dist/templates.d.ts.map +0 -1
- package/dist/templates.js +0 -26
- package/dist/templates.js.map +0 -1
- package/dist/terminalCleanup.d.ts +0 -30
- package/dist/terminalCleanup.d.ts.map +0 -1
- package/dist/terminalCleanup.js +0 -37
- package/dist/terminalCleanup.js.map +0 -1
- package/dist/testSandbox.d.ts +0 -8
- package/dist/testSandbox.d.ts.map +0 -1
- package/dist/testSandbox.js +0 -109
- package/dist/testSandbox.js.map +0 -1
- package/dist/testSetup.d.ts +0 -2
- package/dist/testSetup.d.ts.map +0 -1
- package/dist/testSetup.js +0 -29
- package/dist/testSetup.js.map +0 -1
package/dist/mergeProviderEnv.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Merge env vars from the env resolver, agent provider, and sandbox provider.
|
|
3
|
-
*
|
|
4
|
-
* Provider env (agent + sandbox) overrides env resolver output for shared keys.
|
|
5
|
-
* Agent and sandbox provider env must NOT have overlapping keys — if they do,
|
|
6
|
-
* this function throws.
|
|
7
|
-
*/
|
|
8
|
-
export const mergeProviderEnv = (options) => {
|
|
9
|
-
const { resolvedEnv, agentProviderEnv, sandboxProviderEnv } = options;
|
|
10
|
-
// Check for overlapping keys between agent and sandbox provider env
|
|
11
|
-
const agentKeys = Object.keys(agentProviderEnv);
|
|
12
|
-
const sandboxKeys = new Set(Object.keys(sandboxProviderEnv));
|
|
13
|
-
const overlapping = agentKeys.filter((k) => sandboxKeys.has(k));
|
|
14
|
-
if (overlapping.length > 0) {
|
|
15
|
-
throw new Error(`Overlapping env keys between agent provider and sandbox provider: ${overlapping.join(", ")}`);
|
|
16
|
-
}
|
|
17
|
-
return {
|
|
18
|
-
...resolvedEnv,
|
|
19
|
-
...sandboxProviderEnv,
|
|
20
|
-
...agentProviderEnv,
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
//# sourceMappingURL=mergeProviderEnv.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mergeProviderEnv.js","sourceRoot":"","sources":["../src/mergeProviderEnv.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,OAIhC,EAA0B,EAAE;IAC3B,MAAM,EAAE,WAAW,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,GAAG,OAAO,CAAC;IAEtE,oEAAoE;IACpE,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAChD,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC;IAC7D,MAAM,WAAW,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAEhE,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CACb,qEAAqE,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAC9F,CAAC;IACJ,CAAC;IAED,OAAO;QACL,GAAG,WAAW;QACd,GAAG,kBAAkB;QACrB,GAAG,gBAAgB;KACpB,CAAC;AACJ,CAAC,CAAC"}
|
package/dist/mountUtils.d.ts
DELETED
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared mount utilities for Docker and Podman sandbox providers.
|
|
3
|
-
*
|
|
4
|
-
* Handles host/sandbox path resolution, tilde expansion, user mount
|
|
5
|
-
* validation, image naming, and Windows path normalization.
|
|
6
|
-
*/
|
|
7
|
-
import type { MountConfig } from "./MountConfig.js";
|
|
8
|
-
/**
|
|
9
|
-
* SELinux volume label suffix applied to bind mounts.
|
|
10
|
-
*
|
|
11
|
-
* - `"z"` — shared label. No-op on non-SELinux systems.
|
|
12
|
-
* - `"Z"` — private label; only this container can access the mount.
|
|
13
|
-
* - `false` — disable labeling entirely.
|
|
14
|
-
*/
|
|
15
|
-
export type SelinuxLabel = "z" | "Z" | false;
|
|
16
|
-
/**
|
|
17
|
-
* Deterministic mount point inside the sandbox for the parent repo's .git
|
|
18
|
-
* directory when the workspace is a git worktree. See ADR-0006.
|
|
19
|
-
*/
|
|
20
|
-
export declare const PARENT_GIT_SANDBOX_DIR = "/.sandcastle-parent-git";
|
|
21
|
-
/**
|
|
22
|
-
* Derive the default image name from the repo directory.
|
|
23
|
-
* Returns `sandcastle:<dir-name>` where dir-name is the last path segment,
|
|
24
|
-
* lowercased and sanitized for image tag rules.
|
|
25
|
-
*
|
|
26
|
-
* Handles both POSIX (`/`) and Windows (`\`) path separators.
|
|
27
|
-
*/
|
|
28
|
-
export declare const defaultImageName: (repoDir: string) => string;
|
|
29
|
-
/**
|
|
30
|
-
* Expand tilde (`~`) to the given home directory (or `os.homedir()` if omitted).
|
|
31
|
-
* Handles both `~/path` (POSIX) and `~\path` (Windows).
|
|
32
|
-
*/
|
|
33
|
-
export declare const expandTilde: (p: string, homeDirPath?: string | undefined) => string;
|
|
34
|
-
/**
|
|
35
|
-
* Resolve a host path: expand tilde, then resolve relative paths from `process.cwd()`.
|
|
36
|
-
*/
|
|
37
|
-
export declare const resolveHostPath: (hostPath: string) => string;
|
|
38
|
-
/**
|
|
39
|
-
* Resolve a sandbox path: expands tilde using `sandboxHomedir`, then resolves
|
|
40
|
-
* relative paths from `SANDBOX_REPO_DIR`.
|
|
41
|
-
*
|
|
42
|
-
* Throws if `sandboxPath` starts with `~` but `sandboxHomedir` is `undefined`.
|
|
43
|
-
*/
|
|
44
|
-
export declare const resolveSandboxPath: (sandboxPath: string, sandboxHomedir?: string | undefined) => string;
|
|
45
|
-
/**
|
|
46
|
-
* Resolve and validate user-provided mount configurations.
|
|
47
|
-
* Throws if a hostPath does not exist on the filesystem.
|
|
48
|
-
* Throws if a sandboxPath uses tilde but `sandboxHomedir` is `undefined`.
|
|
49
|
-
*/
|
|
50
|
-
export declare const resolveUserMounts: (mounts: readonly MountConfig[], sandboxHomedir?: string | undefined) => {
|
|
51
|
-
hostPath: string;
|
|
52
|
-
sandboxPath: string;
|
|
53
|
-
readonly?: boolean | undefined;
|
|
54
|
-
}[];
|
|
55
|
-
/**
|
|
56
|
-
* Normalize mount entries for cross-platform compatibility.
|
|
57
|
-
*
|
|
58
|
-
* On Windows (`platform === "win32"`):
|
|
59
|
-
* - Replaces backslashes with forward slashes in all `hostPath` values
|
|
60
|
-
* - Remaps `sandboxPath` values that look like Windows paths to valid POSIX
|
|
61
|
-
* paths relative to `sandboxRepoDir` when the host path is under the
|
|
62
|
-
* worktree host path
|
|
63
|
-
*
|
|
64
|
-
* On non-Windows platforms, returns mounts unchanged (preserving
|
|
65
|
-
* `sandboxPath === hostPath` for git mounts so that `gitdir:` references
|
|
66
|
-
* resolve correctly inside the container).
|
|
67
|
-
*
|
|
68
|
-
* This is a pure function — no filesystem access, accepts a `platform`
|
|
69
|
-
* parameter so it can be unit-tested with fake Windows paths.
|
|
70
|
-
*/
|
|
71
|
-
export declare const normalizeMounts: <M extends {
|
|
72
|
-
hostPath: string;
|
|
73
|
-
sandboxPath: string;
|
|
74
|
-
}>(mounts: M[], worktreeHostPath: string, sandboxRepoDir: string, platform?: string) => M[];
|
|
75
|
-
/**
|
|
76
|
-
* Parse a `gitdir:` path into its parent .git directory and worktree name.
|
|
77
|
-
*
|
|
78
|
-
* The gitdir path is like `/path/to/repo/.git/worktrees/<name>` or
|
|
79
|
-
* `C:\Users\project\.git\worktrees\<name>`. We split on both `/` and `\`
|
|
80
|
-
* so this works regardless of the host platform or which platform runs tests.
|
|
81
|
-
*/
|
|
82
|
-
export declare const parseGitdirPath: (gitdirPath: string) => {
|
|
83
|
-
parentGitDir: string;
|
|
84
|
-
worktreeName: string;
|
|
85
|
-
};
|
|
86
|
-
/**
|
|
87
|
-
* On Windows, patch git mounts so that worktree `.git` files resolve inside
|
|
88
|
-
* the Linux sandbox. See ADR-0006 for the full rationale.
|
|
89
|
-
*
|
|
90
|
-
* Two fixes are applied:
|
|
91
|
-
* 1. The parent `.git` directory mount is remapped to `PARENT_GIT_SANDBOX_DIR`.
|
|
92
|
-
* 2. A corrected `.git` file (with a POSIX `gitdir:` path) is created and
|
|
93
|
-
* mounted at `sandboxRepoDir/.git`, overlaying the original.
|
|
94
|
-
*
|
|
95
|
-
* On non-Windows platforms, or when the worktree's `.git` is a directory
|
|
96
|
-
* (not a worktree pointer), returns the mounts unchanged.
|
|
97
|
-
*
|
|
98
|
-
* @param gitMounts - Raw mounts from `resolveGitMounts`.
|
|
99
|
-
* @param worktreeHostPath - Host path to the directory mounted at `sandboxRepoDir`.
|
|
100
|
-
* @param sandboxRepoDir - Where the worktree is mounted inside the sandbox.
|
|
101
|
-
* @param readFile - Read a file's content (injectable for tests).
|
|
102
|
-
* @param statFile - Stat a file to check if it's a directory (injectable for tests).
|
|
103
|
-
* @param platform - Override for `process.platform` (injectable for tests).
|
|
104
|
-
*/
|
|
105
|
-
export declare const patchGitMountsForWindows: (gitMounts: {
|
|
106
|
-
hostPath: string;
|
|
107
|
-
sandboxPath: string;
|
|
108
|
-
}[], worktreeHostPath: string, sandboxRepoDir: string, readFile?: ((path: string) => Promise<string>) | undefined, statFile?: ((path: string) => Promise<"directory" | "file">) | undefined, platform?: string) => Promise<{
|
|
109
|
-
hostPath: string;
|
|
110
|
-
sandboxPath: string;
|
|
111
|
-
}[]>;
|
|
112
|
-
/**
|
|
113
|
-
* Format a bind mount into a `-v` style string for container runtimes.
|
|
114
|
-
*
|
|
115
|
-
* Produces: `hostPath:sandboxPath[:ro][,z|Z]`
|
|
116
|
-
*
|
|
117
|
-
* Used by both Podman and Docker providers.
|
|
118
|
-
*/
|
|
119
|
-
export declare const formatVolumeMount: (mount: {
|
|
120
|
-
hostPath: string;
|
|
121
|
-
sandboxPath: string;
|
|
122
|
-
readonly?: boolean | undefined;
|
|
123
|
-
}, selinuxLabel: SelinuxLabel | undefined) => string;
|
|
124
|
-
/**
|
|
125
|
-
* Detect file-target mounts whose sandbox-side parent directory may not
|
|
126
|
-
* exist in the container image, and return the parent dirs that need to
|
|
127
|
-
* be created at container start.
|
|
128
|
-
*
|
|
129
|
-
* Validates at config time: if a file mount's sandbox parent is outside
|
|
130
|
-
* `sandboxHomedir`, throws with a clear error and remediation guidance.
|
|
131
|
-
*
|
|
132
|
-
* For file mounts whose parent is under `sandboxHomedir` (but not equal
|
|
133
|
-
* to it — `/home/agent` always exists), returns the unique set of parent
|
|
134
|
-
* directories that must be `mkdir -p` + `chown`'d before the agent runs.
|
|
135
|
-
*
|
|
136
|
-
* @param mounts - Resolved mounts (hostPath already validated to exist).
|
|
137
|
-
* @param sandboxHomedir - The agent's home directory in the sandbox (e.g. `/home/agent`).
|
|
138
|
-
* @param statFn - Injectable stat function for testing (defaults to `statSync`).
|
|
139
|
-
*/
|
|
140
|
-
export declare const processFileMountParents: (mounts: readonly {
|
|
141
|
-
hostPath: string;
|
|
142
|
-
sandboxPath: string;
|
|
143
|
-
}[], sandboxHomedir: string, statFn?: (path: string) => {
|
|
144
|
-
isFile(): boolean;
|
|
145
|
-
}) => string[];
|
|
146
|
-
//# sourceMappingURL=mountUtils.d.ts.map
|
package/dist/mountUtils.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mountUtils.d.ts","sourceRoot":"","sources":["../src/mountUtils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAGpD;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,GAAG,GAAG,GAAG,GAAG,GAAG,KAAK,CAAC;AAE7C;;;GAGG;AACH,eAAO,MAAM,sBAAsB,4BAA4B,CAAC;AAEhE;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,6BAQ5B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,WAAW,yDAKvB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,8BAG3B,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,sEAiB9B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,iBAAiB;;;;GAqB1B,CAAC;AAEL;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,eAAe,GAC1B,CAAC;;;2FAuCF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,eAAe;;;CAS3B,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,wBAAwB;;;;;;IAwFpC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB;;;;oDAU7B,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,uBAAuB;;;;;cAmCnC,CAAC"}
|
package/dist/mountUtils.js
DELETED
|
@@ -1,301 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared mount utilities for Docker and Podman sandbox providers.
|
|
3
|
-
*
|
|
4
|
-
* Handles host/sandbox path resolution, tilde expansion, user mount
|
|
5
|
-
* validation, image naming, and Windows path normalization.
|
|
6
|
-
*/
|
|
7
|
-
import { existsSync, statSync } from "node:fs";
|
|
8
|
-
import { tmpdir, homedir } from "node:os";
|
|
9
|
-
import { isAbsolute, resolve, join, dirname } from "node:path";
|
|
10
|
-
import { mkdtemp, writeFile } from "node:fs/promises";
|
|
11
|
-
import { SANDBOX_REPO_DIR } from "./SandboxFactory.js";
|
|
12
|
-
/**
|
|
13
|
-
* Deterministic mount point inside the sandbox for the parent repo's .git
|
|
14
|
-
* directory when the workspace is a git worktree. See ADR-0006.
|
|
15
|
-
*/
|
|
16
|
-
export const PARENT_GIT_SANDBOX_DIR = "/.sandcastle-parent-git";
|
|
17
|
-
/**
|
|
18
|
-
* Derive the default image name from the repo directory.
|
|
19
|
-
* Returns `sandcastle:<dir-name>` where dir-name is the last path segment,
|
|
20
|
-
* lowercased and sanitized for image tag rules.
|
|
21
|
-
*
|
|
22
|
-
* Handles both POSIX (`/`) and Windows (`\`) path separators.
|
|
23
|
-
*/
|
|
24
|
-
export const defaultImageName = (repoDir) => {
|
|
25
|
-
const dirName = repoDir
|
|
26
|
-
.replace(/[\\/]+$/, "")
|
|
27
|
-
.split(/[\\/]/)
|
|
28
|
-
.pop() ?? "local";
|
|
29
|
-
const sanitized = dirName.toLowerCase().replace(/[^a-z0-9_.-]/g, "-");
|
|
30
|
-
return `sandcastle:${sanitized || "local"}`;
|
|
31
|
-
};
|
|
32
|
-
/**
|
|
33
|
-
* Expand tilde (`~`) to the given home directory (or `os.homedir()` if omitted).
|
|
34
|
-
* Handles both `~/path` (POSIX) and `~\path` (Windows).
|
|
35
|
-
*/
|
|
36
|
-
export const expandTilde = (p, homeDirPath) => {
|
|
37
|
-
const home = homeDirPath ?? homedir();
|
|
38
|
-
if (p === "~")
|
|
39
|
-
return home;
|
|
40
|
-
if (p.startsWith("~/") || p.startsWith("~\\"))
|
|
41
|
-
return home + "/" + p.slice(2);
|
|
42
|
-
return p;
|
|
43
|
-
};
|
|
44
|
-
/**
|
|
45
|
-
* Resolve a host path: expand tilde, then resolve relative paths from `process.cwd()`.
|
|
46
|
-
*/
|
|
47
|
-
export const resolveHostPath = (hostPath) => {
|
|
48
|
-
const expanded = expandTilde(hostPath);
|
|
49
|
-
return isAbsolute(expanded) ? expanded : resolve(process.cwd(), expanded);
|
|
50
|
-
};
|
|
51
|
-
/**
|
|
52
|
-
* Resolve a sandbox path: expands tilde using `sandboxHomedir`, then resolves
|
|
53
|
-
* relative paths from `SANDBOX_REPO_DIR`.
|
|
54
|
-
*
|
|
55
|
-
* Throws if `sandboxPath` starts with `~` but `sandboxHomedir` is `undefined`.
|
|
56
|
-
*/
|
|
57
|
-
export const resolveSandboxPath = (sandboxPath, sandboxHomedir) => {
|
|
58
|
-
const hasTilde = sandboxPath === "~" ||
|
|
59
|
-
sandboxPath.startsWith("~/") ||
|
|
60
|
-
sandboxPath.startsWith("~\\");
|
|
61
|
-
if (hasTilde && sandboxHomedir === undefined) {
|
|
62
|
-
throw new Error(`sandboxPath "${sandboxPath}" contains a tilde but the provider has no sandboxHomedir set`);
|
|
63
|
-
}
|
|
64
|
-
const expanded = hasTilde
|
|
65
|
-
? expandTilde(sandboxPath, sandboxHomedir)
|
|
66
|
-
: sandboxPath;
|
|
67
|
-
return isAbsolute(expanded) ? expanded : resolve(SANDBOX_REPO_DIR, expanded);
|
|
68
|
-
};
|
|
69
|
-
/**
|
|
70
|
-
* Resolve and validate user-provided mount configurations.
|
|
71
|
-
* Throws if a hostPath does not exist on the filesystem.
|
|
72
|
-
* Throws if a sandboxPath uses tilde but `sandboxHomedir` is `undefined`.
|
|
73
|
-
*/
|
|
74
|
-
export const resolveUserMounts = (mounts, sandboxHomedir) => mounts.map((m) => {
|
|
75
|
-
const resolvedHostPath = resolveHostPath(m.hostPath);
|
|
76
|
-
if (!existsSync(resolvedHostPath)) {
|
|
77
|
-
throw new Error(`Mount hostPath does not exist: ${m.hostPath}` +
|
|
78
|
-
(m.hostPath !== resolvedHostPath
|
|
79
|
-
? ` (resolved to ${resolvedHostPath})`
|
|
80
|
-
: ""));
|
|
81
|
-
}
|
|
82
|
-
return {
|
|
83
|
-
hostPath: resolvedHostPath,
|
|
84
|
-
sandboxPath: resolveSandboxPath(m.sandboxPath, sandboxHomedir),
|
|
85
|
-
...(m.readonly ? { readonly: true } : {}),
|
|
86
|
-
};
|
|
87
|
-
});
|
|
88
|
-
/**
|
|
89
|
-
* Normalize mount entries for cross-platform compatibility.
|
|
90
|
-
*
|
|
91
|
-
* On Windows (`platform === "win32"`):
|
|
92
|
-
* - Replaces backslashes with forward slashes in all `hostPath` values
|
|
93
|
-
* - Remaps `sandboxPath` values that look like Windows paths to valid POSIX
|
|
94
|
-
* paths relative to `sandboxRepoDir` when the host path is under the
|
|
95
|
-
* worktree host path
|
|
96
|
-
*
|
|
97
|
-
* On non-Windows platforms, returns mounts unchanged (preserving
|
|
98
|
-
* `sandboxPath === hostPath` for git mounts so that `gitdir:` references
|
|
99
|
-
* resolve correctly inside the container).
|
|
100
|
-
*
|
|
101
|
-
* This is a pure function — no filesystem access, accepts a `platform`
|
|
102
|
-
* parameter so it can be unit-tested with fake Windows paths.
|
|
103
|
-
*/
|
|
104
|
-
export const normalizeMounts = (mounts, worktreeHostPath, sandboxRepoDir, platform = process.platform) => {
|
|
105
|
-
if (platform !== "win32")
|
|
106
|
-
return mounts;
|
|
107
|
-
const normalizedWorktree = worktreeHostPath.replace(/\\/g, "/");
|
|
108
|
-
return mounts.map((m) => {
|
|
109
|
-
const hostPath = m.hostPath.replace(/\\/g, "/");
|
|
110
|
-
let sandboxPath = m.sandboxPath;
|
|
111
|
-
// If sandboxPath is already a valid POSIX absolute path (e.g., user-specified
|
|
112
|
-
// sandbox paths like /mnt/data or /home/agent/workspace), leave it as-is.
|
|
113
|
-
// Otherwise, normalize it — Windows-style sandboxPaths (from resolveGitMounts
|
|
114
|
-
// setting sandboxPath === hostPath) need remapping.
|
|
115
|
-
if (/^[A-Za-z]:[/\\]/.test(sandboxPath) || sandboxPath.includes("\\")) {
|
|
116
|
-
// This is a Windows-style path — remap it
|
|
117
|
-
const normalizedSandboxPath = sandboxPath.replace(/\\/g, "/");
|
|
118
|
-
if (normalizedSandboxPath.startsWith(normalizedWorktree + "/")) {
|
|
119
|
-
// Under the worktree: derive sandbox path relative to sandboxRepoDir
|
|
120
|
-
const relativeSuffix = normalizedSandboxPath.slice(normalizedWorktree.length);
|
|
121
|
-
sandboxPath = sandboxRepoDir + relativeSuffix;
|
|
122
|
-
}
|
|
123
|
-
else if (normalizedSandboxPath === normalizedWorktree) {
|
|
124
|
-
sandboxPath = sandboxRepoDir;
|
|
125
|
-
}
|
|
126
|
-
else {
|
|
127
|
-
// Not under the worktree — just normalize slashes
|
|
128
|
-
sandboxPath = normalizedSandboxPath;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
return { ...m, hostPath, sandboxPath };
|
|
132
|
-
});
|
|
133
|
-
};
|
|
134
|
-
/**
|
|
135
|
-
* Parse a `gitdir:` path into its parent .git directory and worktree name.
|
|
136
|
-
*
|
|
137
|
-
* The gitdir path is like `/path/to/repo/.git/worktrees/<name>` or
|
|
138
|
-
* `C:\Users\project\.git\worktrees\<name>`. We split on both `/` and `\`
|
|
139
|
-
* so this works regardless of the host platform or which platform runs tests.
|
|
140
|
-
*/
|
|
141
|
-
export const parseGitdirPath = (gitdirPath) => {
|
|
142
|
-
const normalized = gitdirPath.replace(/\\/g, "/").replace(/\/+$/, "");
|
|
143
|
-
const segments = normalized.split("/");
|
|
144
|
-
const worktreeName = segments.pop(); // <name>
|
|
145
|
-
segments.pop(); // "worktrees"
|
|
146
|
-
const parentGitDir = segments.join("/");
|
|
147
|
-
return { worktreeName, parentGitDir };
|
|
148
|
-
};
|
|
149
|
-
/**
|
|
150
|
-
* On Windows, patch git mounts so that worktree `.git` files resolve inside
|
|
151
|
-
* the Linux sandbox. See ADR-0006 for the full rationale.
|
|
152
|
-
*
|
|
153
|
-
* Two fixes are applied:
|
|
154
|
-
* 1. The parent `.git` directory mount is remapped to `PARENT_GIT_SANDBOX_DIR`.
|
|
155
|
-
* 2. A corrected `.git` file (with a POSIX `gitdir:` path) is created and
|
|
156
|
-
* mounted at `sandboxRepoDir/.git`, overlaying the original.
|
|
157
|
-
*
|
|
158
|
-
* On non-Windows platforms, or when the worktree's `.git` is a directory
|
|
159
|
-
* (not a worktree pointer), returns the mounts unchanged.
|
|
160
|
-
*
|
|
161
|
-
* @param gitMounts - Raw mounts from `resolveGitMounts`.
|
|
162
|
-
* @param worktreeHostPath - Host path to the directory mounted at `sandboxRepoDir`.
|
|
163
|
-
* @param sandboxRepoDir - Where the worktree is mounted inside the sandbox.
|
|
164
|
-
* @param readFile - Read a file's content (injectable for tests).
|
|
165
|
-
* @param statFile - Stat a file to check if it's a directory (injectable for tests).
|
|
166
|
-
* @param platform - Override for `process.platform` (injectable for tests).
|
|
167
|
-
*/
|
|
168
|
-
export const patchGitMountsForWindows = async (gitMounts, worktreeHostPath, sandboxRepoDir, readFile, statFile, platform = process.platform) => {
|
|
169
|
-
if (platform !== "win32")
|
|
170
|
-
return gitMounts;
|
|
171
|
-
const _readFile = readFile ??
|
|
172
|
-
(async (p) => {
|
|
173
|
-
const { readFile: rf } = await import("node:fs/promises");
|
|
174
|
-
return rf(p, "utf-8");
|
|
175
|
-
});
|
|
176
|
-
const _statFile = statFile ??
|
|
177
|
-
(async (p) => {
|
|
178
|
-
const { stat } = await import("node:fs/promises");
|
|
179
|
-
const s = await stat(p);
|
|
180
|
-
return s.isDirectory() ? "directory" : "file";
|
|
181
|
-
});
|
|
182
|
-
// Check the worktree's .git entry
|
|
183
|
-
const gitEntryPath = join(worktreeHostPath, ".git");
|
|
184
|
-
let gitEntryType;
|
|
185
|
-
try {
|
|
186
|
-
gitEntryType = await _statFile(gitEntryPath);
|
|
187
|
-
}
|
|
188
|
-
catch {
|
|
189
|
-
return gitMounts;
|
|
190
|
-
}
|
|
191
|
-
if (gitEntryType === "directory")
|
|
192
|
-
return gitMounts;
|
|
193
|
-
// Read and parse the gitdir: line
|
|
194
|
-
let content;
|
|
195
|
-
try {
|
|
196
|
-
content = (await _readFile(gitEntryPath)).trim();
|
|
197
|
-
}
|
|
198
|
-
catch {
|
|
199
|
-
return gitMounts;
|
|
200
|
-
}
|
|
201
|
-
const match = content.match(/^gitdir:\s*(.+)$/);
|
|
202
|
-
if (!match)
|
|
203
|
-
return gitMounts;
|
|
204
|
-
const gitdirPath = match[1];
|
|
205
|
-
const { parentGitDir, worktreeName } = parseGitdirPath(gitdirPath);
|
|
206
|
-
// Create a temp file with the corrected gitdir content
|
|
207
|
-
const correctedGitdir = `${PARENT_GIT_SANDBOX_DIR}/worktrees/${worktreeName}`;
|
|
208
|
-
const tempDir = await mkdtemp(join(tmpdir(), "sandcastle-git-"));
|
|
209
|
-
const tempGitFile = join(tempDir, "git-override");
|
|
210
|
-
await writeFile(tempGitFile, `gitdir: ${correctedGitdir}\n`);
|
|
211
|
-
// Build corrected mounts
|
|
212
|
-
const normalizedParentGitDir = parentGitDir.replace(/\\/g, "/");
|
|
213
|
-
const gitFileHostPath = gitEntryPath.replace(/\\/g, "/");
|
|
214
|
-
const correctedMounts = [];
|
|
215
|
-
let replacedGitFile = false;
|
|
216
|
-
for (const m of gitMounts) {
|
|
217
|
-
const normalizedHostPath = m.hostPath.replace(/\\/g, "/");
|
|
218
|
-
if (normalizedHostPath === normalizedParentGitDir) {
|
|
219
|
-
// Remap parent .git dir to deterministic sandbox path
|
|
220
|
-
correctedMounts.push({ ...m, sandboxPath: PARENT_GIT_SANDBOX_DIR });
|
|
221
|
-
}
|
|
222
|
-
else if (normalizedHostPath === gitFileHostPath) {
|
|
223
|
-
// Replace .git file mount with corrected version (host repo is a worktree)
|
|
224
|
-
correctedMounts.push({
|
|
225
|
-
...m,
|
|
226
|
-
hostPath: tempGitFile,
|
|
227
|
-
sandboxPath: `${sandboxRepoDir}/.git`,
|
|
228
|
-
});
|
|
229
|
-
replacedGitFile = true;
|
|
230
|
-
}
|
|
231
|
-
else {
|
|
232
|
-
correctedMounts.push(m);
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
// If the .git file wasn't in gitMounts (Sandcastle-created worktree),
|
|
236
|
-
// add an overlay mount for the corrected .git file
|
|
237
|
-
if (!replacedGitFile) {
|
|
238
|
-
correctedMounts.push({
|
|
239
|
-
hostPath: tempGitFile,
|
|
240
|
-
sandboxPath: `${sandboxRepoDir}/.git`,
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
return correctedMounts;
|
|
244
|
-
};
|
|
245
|
-
/**
|
|
246
|
-
* Format a bind mount into a `-v` style string for container runtimes.
|
|
247
|
-
*
|
|
248
|
-
* Produces: `hostPath:sandboxPath[:ro][,z|Z]`
|
|
249
|
-
*
|
|
250
|
-
* Used by both Podman and Docker providers.
|
|
251
|
-
*/
|
|
252
|
-
export const formatVolumeMount = (mount, selinuxLabel) => {
|
|
253
|
-
const base = `${mount.hostPath}:${mount.sandboxPath}`;
|
|
254
|
-
const options = [mount.readonly ? "ro" : undefined, selinuxLabel || undefined]
|
|
255
|
-
.filter((option) => option !== undefined)
|
|
256
|
-
.join(",");
|
|
257
|
-
return options ? `${base}:${options}` : base;
|
|
258
|
-
};
|
|
259
|
-
/**
|
|
260
|
-
* Detect file-target mounts whose sandbox-side parent directory may not
|
|
261
|
-
* exist in the container image, and return the parent dirs that need to
|
|
262
|
-
* be created at container start.
|
|
263
|
-
*
|
|
264
|
-
* Validates at config time: if a file mount's sandbox parent is outside
|
|
265
|
-
* `sandboxHomedir`, throws with a clear error and remediation guidance.
|
|
266
|
-
*
|
|
267
|
-
* For file mounts whose parent is under `sandboxHomedir` (but not equal
|
|
268
|
-
* to it — `/home/agent` always exists), returns the unique set of parent
|
|
269
|
-
* directories that must be `mkdir -p` + `chown`'d before the agent runs.
|
|
270
|
-
*
|
|
271
|
-
* @param mounts - Resolved mounts (hostPath already validated to exist).
|
|
272
|
-
* @param sandboxHomedir - The agent's home directory in the sandbox (e.g. `/home/agent`).
|
|
273
|
-
* @param statFn - Injectable stat function for testing (defaults to `statSync`).
|
|
274
|
-
*/
|
|
275
|
-
export const processFileMountParents = (mounts, sandboxHomedir, statFn = statSync) => {
|
|
276
|
-
const parentDirs = new Set();
|
|
277
|
-
for (const mount of mounts) {
|
|
278
|
-
let isFile;
|
|
279
|
-
try {
|
|
280
|
-
isFile = statFn(mount.hostPath).isFile();
|
|
281
|
-
}
|
|
282
|
-
catch {
|
|
283
|
-
continue;
|
|
284
|
-
}
|
|
285
|
-
if (!isFile)
|
|
286
|
-
continue;
|
|
287
|
-
const parentDir = dirname(mount.sandboxPath);
|
|
288
|
-
// Parent IS sandboxHomedir — it always exists in the image
|
|
289
|
-
if (parentDir === sandboxHomedir)
|
|
290
|
-
continue;
|
|
291
|
-
// Parent is outside sandboxHomedir — fail at config time
|
|
292
|
-
if (!parentDir.startsWith(sandboxHomedir + "/")) {
|
|
293
|
-
throw new Error(`Cannot mount file to '${mount.sandboxPath}': ` +
|
|
294
|
-
`parent directory '${parentDir}' is outside the sandbox home directory ('${sandboxHomedir}'). ` +
|
|
295
|
-
`Mount the parent directory instead, or rebuild the image with '${parentDir}' pre-created.`);
|
|
296
|
-
}
|
|
297
|
-
parentDirs.add(parentDir);
|
|
298
|
-
}
|
|
299
|
-
return [...parentDirs];
|
|
300
|
-
};
|
|
301
|
-
//# sourceMappingURL=mountUtils.js.map
|
package/dist/mountUtils.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mountUtils.js","sourceRoot":"","sources":["../src/mountUtils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAEtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAWvD;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,yBAAyB,CAAC;AAEhE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,OAAe,EAAU,EAAE;IAC1D,MAAM,OAAO,GACX,OAAO;SACJ,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC;SACtB,KAAK,CAAC,OAAO,CAAC;SACd,GAAG,EAAE,IAAI,OAAO,CAAC;IACtB,MAAM,SAAS,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC;IACtE,OAAO,cAAc,SAAS,IAAI,OAAO,EAAE,CAAC;AAC9C,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAS,EAAE,WAAoB,EAAU,EAAE;IACrE,MAAM,IAAI,GAAG,WAAW,IAAI,O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,MAAM,UAAU,GAAG,IAAI,GAAG,EAAU,CAAC;IAErC,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,IAAI,MAAe,CAAC;QACpB,IAAI,CAAC;YACH,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,MAAM,EAAE,CAAC;QAC3C,CAAC;QAAC,MAAM,CAAC;YACP,SAAS;QACX,CAAC;QAED,IAAI,CAAC,MAAM;YAAE,SAAS;QAEtB,MAAM,SAAS,GAAG,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QAE7C,2DAA2D;QAC3D,IAAI,SAAS,KAAK,cAAc;YAAE,SAAS;QAE3C,yDAAyD;QACzD,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,cAAc,GAAG,GAAG,CAAC,EAAE,CAAC;YAChD,MAAM,IAAI,KAAK,CACb,yBAAyB,KAAK,CAAC,WAAW,KAAK;gBAC7C,qBAAqB,SAAS,6CAA6C,cAAc,MAAM;gBAC/F,kEAAkE,SAAS,gBAAgB,CAC9F,CAAC;QACJ,CAAC;QAED,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAC5B,CAAC;IAED,OAAO,CAAC,GAAG,UAAU,CAAC,CAAC;AACzB,CAAC,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Effect } from "effect";
|
|
2
|
-
/**
|
|
3
|
-
* Race an Effect against an optional `AbortSignal`.
|
|
4
|
-
*
|
|
5
|
-
* - If no signal is provided, the effect runs unmodified.
|
|
6
|
-
* - If the signal is already aborted at call time, dies immediately with
|
|
7
|
-
* `signal.reason`.
|
|
8
|
-
* - Otherwise, races the effect against a Deferred that fires when the
|
|
9
|
-
* signal aborts.
|
|
10
|
-
*
|
|
11
|
-
* Uses `Effect.die` so the abort reason propagates as a defect — callers
|
|
12
|
-
* should use `signal.throwIfAborted()` in their catch handler to surface
|
|
13
|
-
* the original reason without Sandcastle-specific wrapping.
|
|
14
|
-
*
|
|
15
|
-
* The abort listener is always cleaned up, even when the effect wins the race.
|
|
16
|
-
*/
|
|
17
|
-
export declare const raceAbortSignal: <A, E, R>(effect: Effect.Effect<A, E, R>, signal?: AbortSignal | undefined) => Effect.Effect<A, E, R>;
|
|
18
|
-
//# sourceMappingURL=raceAbortSignal.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"raceAbortSignal.d.ts","sourceRoot":"","sources":["../src/raceAbortSignal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE1C;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,eAAe,GAAI,CAAC,EAAE,CAAC,EAAE,CAAC,6FA4BtC,CAAC"}
|
package/dist/raceAbortSignal.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { Deferred, Effect } from "effect";
|
|
2
|
-
/**
|
|
3
|
-
* Race an Effect against an optional `AbortSignal`.
|
|
4
|
-
*
|
|
5
|
-
* - If no signal is provided, the effect runs unmodified.
|
|
6
|
-
* - If the signal is already aborted at call time, dies immediately with
|
|
7
|
-
* `signal.reason`.
|
|
8
|
-
* - Otherwise, races the effect against a Deferred that fires when the
|
|
9
|
-
* signal aborts.
|
|
10
|
-
*
|
|
11
|
-
* Uses `Effect.die` so the abort reason propagates as a defect — callers
|
|
12
|
-
* should use `signal.throwIfAborted()` in their catch handler to surface
|
|
13
|
-
* the original reason without Sandcastle-specific wrapping.
|
|
14
|
-
*
|
|
15
|
-
* The abort listener is always cleaned up, even when the effect wins the race.
|
|
16
|
-
*/
|
|
17
|
-
export const raceAbortSignal = (effect, signal) => {
|
|
18
|
-
if (!signal)
|
|
19
|
-
return effect;
|
|
20
|
-
return Effect.gen(function* () {
|
|
21
|
-
if (signal.aborted) {
|
|
22
|
-
return yield* Effect.die(signal.reason);
|
|
23
|
-
}
|
|
24
|
-
const abortDeferred = yield* Deferred.make();
|
|
25
|
-
const onAbort = () => {
|
|
26
|
-
Effect.runPromise(Deferred.die(abortDeferred, signal.reason)).catch(() => { });
|
|
27
|
-
};
|
|
28
|
-
signal.addEventListener("abort", onAbort, { once: true });
|
|
29
|
-
return yield* Effect.raceFirst(effect, Deferred.await(abortDeferred)).pipe(Effect.ensuring(Effect.sync(() => signal.removeEventListener("abort", onAbort))));
|
|
30
|
-
});
|
|
31
|
-
};
|
|
32
|
-
//# sourceMappingURL=raceAbortSignal.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"raceAbortSignal.js","sourceRoot":"","sources":["../src/raceAbortSignal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE1C;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,MAA8B,EAC9B,MAAoB,EACI,EAAE;IAC1B,IAAI,CAAC,MAAM;QAAE,OAAO,MAAM,CAAC;IAE3B,OAAO,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;QACzB,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YACnB,OAAO,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC1C,CAAC;QAED,MAAM,aAAa,GAAG,KAAK,CAAC,CAAC,QAAQ,CAAC,IAAI,EAAgB,CAAC;QAC3D,MAAM,OAAO,GAAG,GAAG,EAAE;YACnB,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,aAAa,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CACjE,GAAG,EAAE,GAAE,CAAC,CACT,CAAC;QACJ,CAAC,CAAC;QACF,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QAE1D,OAAO,KAAK,CAAC,CAAC,MAAM,CAAC,SAAS,CAC5B,MAAM,EACN,QAAQ,CAAC,KAAK,CAAC,aAAa,CAAuC,CACpE,CAAC,IAAI,CACJ,MAAM,CAAC,QAAQ,CACb,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAChE,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC"}
|
package/dist/resolveCwd.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { FileSystem } from "@effect/platform";
|
|
2
|
-
import { Effect } from "effect";
|
|
3
|
-
declare const CwdError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
4
|
-
readonly _tag: "CwdError";
|
|
5
|
-
} & Readonly<A>;
|
|
6
|
-
/** The provided `cwd` path does not exist or is not a directory. */
|
|
7
|
-
export declare class CwdError extends CwdError_base<{
|
|
8
|
-
readonly message: string;
|
|
9
|
-
readonly cwd: string;
|
|
10
|
-
}> {
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Resolve an optional `cwd` string to an absolute, validated host repo directory.
|
|
14
|
-
*
|
|
15
|
-
* - `undefined` → `process.cwd()` (resolved to absolute).
|
|
16
|
-
* - Relative path → resolved against `process.cwd()`.
|
|
17
|
-
* - Absolute path → passed through.
|
|
18
|
-
*
|
|
19
|
-
* Stats the result via Effect's `FileSystem`; fails with {@link CwdError}
|
|
20
|
-
* when the path is missing or is not a directory.
|
|
21
|
-
*/
|
|
22
|
-
export declare const resolveCwd: (cwd: string | undefined) => Effect.Effect<string, CwdError, FileSystem.FileSystem>;
|
|
23
|
-
export {};
|
|
24
|
-
//# sourceMappingURL=resolveCwd.d.ts.map
|
package/dist/resolveCwd.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolveCwd.d.ts","sourceRoot":"","sources":["../src/resolveCwd.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAQ,MAAM,EAAE,MAAM,QAAQ,CAAC;;;;AAEtC,oEAAoE;AACpE,qBAAa,QAAS,SAAQ,cAA6B;IACzD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB,CAAC;CAAG;AAEL;;;;;;;;;GASG;AACH,eAAO,MAAM,UAAU,qFA0BnB,CAAC"}
|
package/dist/resolveCwd.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { FileSystem } from "@effect/platform";
|
|
2
|
-
import { resolve } from "node:path";
|
|
3
|
-
import { Data, Effect } from "effect";
|
|
4
|
-
/** The provided `cwd` path does not exist or is not a directory. */
|
|
5
|
-
export class CwdError extends Data.TaggedError("CwdError") {
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Resolve an optional `cwd` string to an absolute, validated host repo directory.
|
|
9
|
-
*
|
|
10
|
-
* - `undefined` → `process.cwd()` (resolved to absolute).
|
|
11
|
-
* - Relative path → resolved against `process.cwd()`.
|
|
12
|
-
* - Absolute path → passed through.
|
|
13
|
-
*
|
|
14
|
-
* Stats the result via Effect's `FileSystem`; fails with {@link CwdError}
|
|
15
|
-
* when the path is missing or is not a directory.
|
|
16
|
-
*/
|
|
17
|
-
export const resolveCwd = (cwd) => Effect.gen(function* () {
|
|
18
|
-
const resolved = cwd !== undefined ? resolve(process.cwd(), cwd) : resolve(process.cwd());
|
|
19
|
-
const fs = yield* FileSystem.FileSystem;
|
|
20
|
-
const stat = yield* fs.stat(resolved).pipe(Effect.mapError(() => new CwdError({
|
|
21
|
-
message: `cwd does not exist: ${resolved}`,
|
|
22
|
-
cwd: resolved,
|
|
23
|
-
})));
|
|
24
|
-
if (stat.type !== "Directory") {
|
|
25
|
-
return yield* new CwdError({
|
|
26
|
-
message: `cwd is not a directory: ${resolved}`,
|
|
27
|
-
cwd: resolved,
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
return resolved;
|
|
31
|
-
});
|
|
32
|
-
//# sourceMappingURL=resolveCwd.js.map
|
package/dist/resolveCwd.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolveCwd.js","sourceRoot":"","sources":["../src/resolveCwd.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEtC,oEAAoE;AACpE,MAAM,OAAO,QAAS,SAAQ,IAAI,CAAC,WAAW,CAAC,UAAU,CAGvD;CAAG;AAEL;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CACxB,GAAuB,EACiC,EAAE,CAC1D,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,MAAM,QAAQ,GACZ,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAE3E,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC;IAExC,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,CACxC,MAAM,CAAC,QAAQ,CACb,GAAG,EAAE,CACH,IAAI,QAAQ,CAAC;QACX,OAAO,EAAE,uBAAuB,QAAQ,EAAE;QAC1C,GAAG,EAAE,QAAQ;KACd,CAAC,CACL,CACF,CAAC;IACF,IAAI,IAAI,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAC,CAAC,IAAI,QAAQ,CAAC;YACzB,OAAO,EAAE,2BAA2B,QAAQ,EAAE;YAC9C,GAAG,EAAE,QAAQ;SACd,CAAC,CAAC;IACL,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/dist/resumePrecheck.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { AgentProvider } from "./AgentProvider.js";
|
|
2
|
-
/**
|
|
3
|
-
* Fail-fast validation that a resumable agent session exists on the host before
|
|
4
|
-
* launching the agent. Throws a descriptive error when the session is missing.
|
|
5
|
-
*
|
|
6
|
-
* The lookup strategy depends on the sandbox:
|
|
7
|
-
*
|
|
8
|
-
* - **No-sandbox**: the agent runs directly on the host and writes its session
|
|
9
|
-
* in place under a cwd-derived directory; Sandcastle never moves it. The
|
|
10
|
-
* agent's own path encoding (realpath canonicalisation plus
|
|
11
|
-
* non-alphanumeric → hyphen) is fragile and platform-specific to reconstruct,
|
|
12
|
-
* so we locate the file by its globally-unique session id instead.
|
|
13
|
-
* - **Sandboxed (bind-mount)**: Sandcastle's capture transfers the session into
|
|
14
|
-
* the host store keyed on the host repo dir, so for a resumable run the file
|
|
15
|
-
* lives at that exact encoded location — check it directly rather than
|
|
16
|
-
* scanning. (Isolated sandboxes fall here too, but neither capture nor resume
|
|
17
|
-
* transfer is wired for them today, so this is the host-repo-dir check by
|
|
18
|
-
* default.)
|
|
19
|
-
*/
|
|
20
|
-
export declare const assertResumeSessionExists: (params: {
|
|
21
|
-
readonly provider: AgentProvider;
|
|
22
|
-
readonly sandboxTag: "bind-mount" | "isolated" | "none";
|
|
23
|
-
readonly hostRepoDir: string;
|
|
24
|
-
readonly resumeSession: string;
|
|
25
|
-
}) => Promise<void>;
|
|
26
|
-
//# sourceMappingURL=resumePrecheck.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resumePrecheck.d.ts","sourceRoot":"","sources":["../src/resumePrecheck.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGxD;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,yBAAyB;;;;;mBAgCrC,CAAC"}
|