@monoes/monomindcli 2.16.9 → 2.16.10
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/dist/src/commands/cleanup.d.ts +8 -1
- package/dist/src/commands/cleanup.d.ts.map +1 -1
- package/dist/src/commands/cleanup.js +113 -15
- package/dist/src/commands/cleanup.js.map +1 -1
- package/dist/src/orgrt/daemon.d.ts.map +1 -1
- package/dist/src/orgrt/daemon.js +3 -0
- package/dist/src/orgrt/daemon.js.map +1 -1
- package/dist/src/orgrt/git-guard.d.ts.map +1 -1
- package/dist/src/orgrt/git-guard.js +9 -23
- package/dist/src/orgrt/git-guard.js.map +1 -1
- package/dist/src/orgrt/sandbox-stubs.d.ts +144 -0
- package/dist/src/orgrt/sandbox-stubs.d.ts.map +1 -0
- package/dist/src/orgrt/sandbox-stubs.js +424 -0
- package/dist/src/orgrt/sandbox-stubs.js.map +1 -0
- package/dist/src/orgrt/session.d.ts.map +1 -1
- package/dist/src/orgrt/session.js +11 -0
- package/dist/src/orgrt/session.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -6
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mount-point stubs for the SDK sandbox's write-denies, held for the whole run.
|
|
3
|
+
*
|
|
4
|
+
* The Claude Code sandbox (bubblewrap) denies writes to a fixed set of
|
|
5
|
+
* "dangerous" paths: in the role's cwd, in every directory above it that is
|
|
6
|
+
* writable in the sandbox, in the Claude config dir and in $HOME. For one that
|
|
7
|
+
* does not exist it binds /dev/null onto it, so bwrap creates a 0-byte,
|
|
8
|
+
* mode-0444 file there as the mount point (an empty directory for a missing
|
|
9
|
+
* `.claude/`), and the SDK deletes it again when the command ends
|
|
10
|
+
* (sandbox-runtime cleanupBwrapMountPoints). The SDK only coordinates that
|
|
11
|
+
* within one process. Every role is its own CLI process sharing one cwd and
|
|
12
|
+
* one ~/.claude, so role B, wrapping a command while role A's stub exists,
|
|
13
|
+
* takes the stub for a real file and binds it onto itself (`--ro-bind P P`);
|
|
14
|
+
* A's command ends, A deletes it, and B's bwrap dies with "Can't find source
|
|
15
|
+
* path ~/.claude/local" (release runs since 2.16.x: 0–5 per run, each a
|
|
16
|
+
* sandbox-fault).
|
|
17
|
+
*
|
|
18
|
+
* So before a sandboxed role starts, the runtime creates every such path that
|
|
19
|
+
* is missing, the way bwrap would (an empty 0444 file; a plain `.claude/`
|
|
20
|
+
* directory to hold them), and keeps it until the run ends. The SDK then only
|
|
21
|
+
* ever finds an existing path, which it binds read-only and never tracks or
|
|
22
|
+
* deletes, so no process removes a mount source another one is about to use.
|
|
23
|
+
* At the end the runtime removes only what it created itself — still the same
|
|
24
|
+
* inode, still empty; a path that already existed is never touched. Every
|
|
25
|
+
* stub is also written to a per-machine ledger (defaultStubLedger()), so the
|
|
26
|
+
* ones a SIGKILL'd daemon or a reboot leaves behind (an empty read-only file
|
|
27
|
+
* at ~/.claude/commands would break the user's own Claude config for good)
|
|
28
|
+
* are reclaimed by the next runtime under the same rule (reclaim()).
|
|
29
|
+
*
|
|
30
|
+
* The lists are what claude-agent-sdk 0.3.226 binds (read off /proc/self/
|
|
31
|
+
* mountinfo inside its sandbox; sandbox-stubs-sdk.test.ts fails when an SDK
|
|
32
|
+
* upgrade adds one). Left out on purpose: `.git/config.lock` (held, it makes
|
|
33
|
+
* every `git config` write fail), the dirs the CLI writes into itself
|
|
34
|
+
* (projects, shell-snapshots, session-env, plugins, backups), which a file
|
|
35
|
+
* would break, and the state files it writes itself (.claude.json,
|
|
36
|
+
* .config.json, .credentials.json): a CLI starting on an empty .config.json
|
|
37
|
+
* exits with "configuration file … is corrupted". A path whose parent does not
|
|
38
|
+
* exist is skipped.
|
|
39
|
+
*/
|
|
40
|
+
/** Relative to the role's cwd. Also what git-guard.ts hides from `git add`. */
|
|
41
|
+
export declare const CWD_STUBS: string[];
|
|
42
|
+
/** Relative to the Claude config dir ($CLAUDE_CONFIG_DIR, else ~/.claude). */
|
|
43
|
+
export declare const CONFIG_DIR_STUBS: string[];
|
|
44
|
+
/** Relative to where the global config file lives ($CLAUDE_CONFIG_DIR, else $HOME). */
|
|
45
|
+
export declare const GLOBAL_CONFIG_STUBS: string[];
|
|
46
|
+
/** Every stub path the sandbox binds for a role with this cwd and HOME, where
|
|
47
|
+
* `writableRoots` is the sandbox's `filesystem.allowWrite`. A `.claude`
|
|
48
|
+
* directory comes before the files in it. */
|
|
49
|
+
export declare function sandboxStubPaths(ctx: {
|
|
50
|
+
cwd: string;
|
|
51
|
+
home: string;
|
|
52
|
+
writableRoots: string[];
|
|
53
|
+
env?: NodeJS.ProcessEnv;
|
|
54
|
+
}): string[];
|
|
55
|
+
/** The per-machine crash ledger: `MONOMIND_ORGRT_STUBS_DIR`, else
|
|
56
|
+
* ~/.monomind/orgrt-sandbox-stubs (next to orgrt-broker and orgrt-operator). */
|
|
57
|
+
export declare function defaultStubLedger(env?: NodeJS.ProcessEnv): string;
|
|
58
|
+
export interface LedgerEntry {
|
|
59
|
+
path: string;
|
|
60
|
+
ino: number;
|
|
61
|
+
dev: number;
|
|
62
|
+
kind: 'file' | 'dir';
|
|
63
|
+
pid: number;
|
|
64
|
+
/** This pid's namespace and boot, so a later reclaim() can tell a dead pid
|
|
65
|
+
* in our own namespace apart from a live one we simply cannot see from a
|
|
66
|
+
* different namespace. Absent on an entry written before this field
|
|
67
|
+
* existed (see isLegacy). */
|
|
68
|
+
pidNamespace?: string;
|
|
69
|
+
bootId?: string;
|
|
70
|
+
runId: string;
|
|
71
|
+
createdAt: string;
|
|
72
|
+
}
|
|
73
|
+
/** Reads what identifies THIS process's pid namespace and boot, so a ledger
|
|
74
|
+
* entry can later tell a dead pid in our own namespace (safe to reclaim)
|
|
75
|
+
* apart from a live daemon's pid that we simply cannot see (the Claude SDK
|
|
76
|
+
* sandbox runs every role with `bwrap --unshare-pid`: `process.kill(pid, 0)`
|
|
77
|
+
* on a pid outside our namespace always throws ESRCH, alive or not). */
|
|
78
|
+
export interface IdentitySource {
|
|
79
|
+
/** `/proc/self/ns/pid`'s target, e.g. `pid:[4026531836]`; undefined if it
|
|
80
|
+
* cannot be read (older kernel, no /proc). */
|
|
81
|
+
pidNamespace(): string | undefined;
|
|
82
|
+
/** `/proc/sys/kernel/random/boot_id`, stable for one boot and never reused
|
|
83
|
+
* across a reboot — unlike a pid, which is. */
|
|
84
|
+
bootId(): string | undefined;
|
|
85
|
+
}
|
|
86
|
+
/** The stubs this process created, and which runs still need each one. */
|
|
87
|
+
export declare class SandboxStubs {
|
|
88
|
+
private readonly ledger?;
|
|
89
|
+
private readonly identity;
|
|
90
|
+
private readonly stubs;
|
|
91
|
+
private exitHook;
|
|
92
|
+
private reclaimed;
|
|
93
|
+
/** `ledger`: the crash-ledger file (default defaultStubLedger(), read when
|
|
94
|
+
* first needed); null keeps no ledger. `identity`: overridable in tests;
|
|
95
|
+
* defaults to reading this process's real pid namespace and boot id. */
|
|
96
|
+
constructor(ledger?: string | null | undefined, identity?: IdentitySource);
|
|
97
|
+
private get ledgerFile();
|
|
98
|
+
/** Creates each missing path — a `.claude` path as a directory, anything
|
|
99
|
+
* else as an empty 0444 file — and records `owner` on every path this
|
|
100
|
+
* process created. The first call reclaims a dead runtime's stubs first.
|
|
101
|
+
* Returns the paths created now. */
|
|
102
|
+
hold(owner: string, paths: string[]): string[];
|
|
103
|
+
/** Drops `owner`; removes the stubs no other run holds. Returns them. */
|
|
104
|
+
release(owner: string): string[];
|
|
105
|
+
releaseAll(): void;
|
|
106
|
+
/**
|
|
107
|
+
* Stubs a runtime that died without cleaning up (SIGKILL, reboot) left in
|
|
108
|
+
* the ledger. Each is removed under the same rule as our own — same inode,
|
|
109
|
+
* still empty — and forgotten either way: a changed path is no longer a
|
|
110
|
+
* stub. While another live runtime has stubs in the ledger, its roles may
|
|
111
|
+
* be binding the dead one's as existing files, so they are adopted instead:
|
|
112
|
+
* held by this process and removed when its first run ends. Entries of live
|
|
113
|
+
* runtimes are kept. Returns the paths removed.
|
|
114
|
+
*/
|
|
115
|
+
reclaim(): string[];
|
|
116
|
+
private entry;
|
|
117
|
+
/** Is `e` an entry this process itself wrote? For a modern entry that also
|
|
118
|
+
* requires our current namespace and boot to match — a matching pid alone
|
|
119
|
+
* can be a different process after a pid wrap, or the same-numbered pid in
|
|
120
|
+
* an unrelated namespace. A legacy entry (no pidNamespace/bootId) falls
|
|
121
|
+
* back to the bare pid check it was written under — and so does every
|
|
122
|
+
* entry when OUR OWN identity could not be read (older kernel, no /proc):
|
|
123
|
+
* with no `ourNs`/`ourBootId` to compare against, a modern entry's real
|
|
124
|
+
* values would always look "different", which is not a safe basis for
|
|
125
|
+
* ownership either. */
|
|
126
|
+
private isOwn;
|
|
127
|
+
/** Is `e` safe to reclaim? A different boot always is (pids and namespace
|
|
128
|
+
* ids are meaningless across a reboot). Same boot but a different pid
|
|
129
|
+
* namespace never is — we cannot tell alive from dead across namespaces
|
|
130
|
+
* (`process.kill` always throws ESRCH there), so it is left alone rather
|
|
131
|
+
* than guessed at. Same boot and same namespace (or a legacy entry) falls
|
|
132
|
+
* back to the bare pid-alive check — and so does every entry when OUR OWN
|
|
133
|
+
* identity could not be read (older kernel, no /proc): without `ourNs`/
|
|
134
|
+
* `ourBootId` to compare against, a modern entry's real boot/namespace
|
|
135
|
+
* ids would always compare unequal, which would misjudge every live
|
|
136
|
+
* entry as a different boot and reclaim it. */
|
|
137
|
+
private isDead;
|
|
138
|
+
private updateLedger;
|
|
139
|
+
/** Files before the directories holding them; each only while unchanged. */
|
|
140
|
+
private remove;
|
|
141
|
+
}
|
|
142
|
+
/** One per process: every org run in it shares the cwd and ~/.claude stubs. */
|
|
143
|
+
export declare const sandboxStubs: SandboxStubs;
|
|
144
|
+
//# sourceMappingURL=sandbox-stubs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sandbox-stubs.d.ts","sourceRoot":"","sources":["../../../src/orgrt/sandbox-stubs.ts"],"names":[],"mappings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AC,QAAQ,CAAS;IACzB,OAAO,CAAC,SAAS,CAAS;IAE1B;;6EAEyE;IACzE,YACmB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,YAAA,EACtB,QAAQ,GAAE,cAAgC,EACzD;IAEJ,OAAO,KAAK,UAAU,GAErB;IAED;;;yCAGqC;IACrC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CA+B7C;IAED,yEAAyE;IACzE,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAO/B;IAED,UAAU,IAAI,IAAI,CAEjB;IAED;;;;;;;;OAQG;IACH,OAAO,IAAI,MAAM,EAAE,CA4BlB;IAED,OAAO,CAAC,KAAK;IAeb;;;;;;;;4BAQwB;IACxB,OAAO,CAAC,KAAK;IAKb;;;;;;;;;oDASgD;IAChD,OAAO,CAAC,MAAM;IAad,OAAO,CAAC,YAAY;IAWpB,4EAA4E;IAC5E,OAAO,CAAC,MAAM;CAiBf;AA6BD,+EAA+E;AAC/E,eAAO,MAAM,YAAY,cAAqB,CAAC"}
|
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
// packages/@monomind/cli/src/orgrt/sandbox-stubs.ts
|
|
2
|
+
/**
|
|
3
|
+
* Mount-point stubs for the SDK sandbox's write-denies, held for the whole run.
|
|
4
|
+
*
|
|
5
|
+
* The Claude Code sandbox (bubblewrap) denies writes to a fixed set of
|
|
6
|
+
* "dangerous" paths: in the role's cwd, in every directory above it that is
|
|
7
|
+
* writable in the sandbox, in the Claude config dir and in $HOME. For one that
|
|
8
|
+
* does not exist it binds /dev/null onto it, so bwrap creates a 0-byte,
|
|
9
|
+
* mode-0444 file there as the mount point (an empty directory for a missing
|
|
10
|
+
* `.claude/`), and the SDK deletes it again when the command ends
|
|
11
|
+
* (sandbox-runtime cleanupBwrapMountPoints). The SDK only coordinates that
|
|
12
|
+
* within one process. Every role is its own CLI process sharing one cwd and
|
|
13
|
+
* one ~/.claude, so role B, wrapping a command while role A's stub exists,
|
|
14
|
+
* takes the stub for a real file and binds it onto itself (`--ro-bind P P`);
|
|
15
|
+
* A's command ends, A deletes it, and B's bwrap dies with "Can't find source
|
|
16
|
+
* path ~/.claude/local" (release runs since 2.16.x: 0–5 per run, each a
|
|
17
|
+
* sandbox-fault).
|
|
18
|
+
*
|
|
19
|
+
* So before a sandboxed role starts, the runtime creates every such path that
|
|
20
|
+
* is missing, the way bwrap would (an empty 0444 file; a plain `.claude/`
|
|
21
|
+
* directory to hold them), and keeps it until the run ends. The SDK then only
|
|
22
|
+
* ever finds an existing path, which it binds read-only and never tracks or
|
|
23
|
+
* deletes, so no process removes a mount source another one is about to use.
|
|
24
|
+
* At the end the runtime removes only what it created itself — still the same
|
|
25
|
+
* inode, still empty; a path that already existed is never touched. Every
|
|
26
|
+
* stub is also written to a per-machine ledger (defaultStubLedger()), so the
|
|
27
|
+
* ones a SIGKILL'd daemon or a reboot leaves behind (an empty read-only file
|
|
28
|
+
* at ~/.claude/commands would break the user's own Claude config for good)
|
|
29
|
+
* are reclaimed by the next runtime under the same rule (reclaim()).
|
|
30
|
+
*
|
|
31
|
+
* The lists are what claude-agent-sdk 0.3.226 binds (read off /proc/self/
|
|
32
|
+
* mountinfo inside its sandbox; sandbox-stubs-sdk.test.ts fails when an SDK
|
|
33
|
+
* upgrade adds one). Left out on purpose: `.git/config.lock` (held, it makes
|
|
34
|
+
* every `git config` write fail), the dirs the CLI writes into itself
|
|
35
|
+
* (projects, shell-snapshots, session-env, plugins, backups), which a file
|
|
36
|
+
* would break, and the state files it writes itself (.claude.json,
|
|
37
|
+
* .config.json, .credentials.json): a CLI starting on an empty .config.json
|
|
38
|
+
* exits with "configuration file … is corrupted". A path whose parent does not
|
|
39
|
+
* exist is skipped.
|
|
40
|
+
*/
|
|
41
|
+
import { closeSync, constants, lstatSync, mkdirSync, openSync, readdirSync, readFileSync, readlinkSync, renameSync, rmdirSync, unlinkSync, writeFileSync, } from 'node:fs';
|
|
42
|
+
import { homedir } from 'node:os';
|
|
43
|
+
import { basename, dirname, isAbsolute, join, sep } from 'node:path';
|
|
44
|
+
/** Relative to the role's cwd and to each sandbox-writable directory above it. */
|
|
45
|
+
const PROJECT_STUBS = [
|
|
46
|
+
'.mcp.json',
|
|
47
|
+
'.claude/settings.json',
|
|
48
|
+
'.claude/settings.local.json',
|
|
49
|
+
'.claude/agents',
|
|
50
|
+
'.claude/commands',
|
|
51
|
+
'.claude/hooks',
|
|
52
|
+
'.claude/skills',
|
|
53
|
+
'.claude/workflows',
|
|
54
|
+
'.claude/routines',
|
|
55
|
+
'.claude/output-styles',
|
|
56
|
+
'.claude/launch.json',
|
|
57
|
+
'.claude/loop.md',
|
|
58
|
+
'.claude/scheduled_tasks.json',
|
|
59
|
+
];
|
|
60
|
+
/** Relative to the role's cwd. Also what git-guard.ts hides from `git add`. */
|
|
61
|
+
export const CWD_STUBS = [
|
|
62
|
+
'.bashrc',
|
|
63
|
+
'.bash_profile',
|
|
64
|
+
'.profile',
|
|
65
|
+
'.zshrc',
|
|
66
|
+
'.zprofile',
|
|
67
|
+
'.gitconfig',
|
|
68
|
+
'.gitmodules',
|
|
69
|
+
'.ripgreprc',
|
|
70
|
+
'.idea',
|
|
71
|
+
'.vscode',
|
|
72
|
+
...PROJECT_STUBS,
|
|
73
|
+
];
|
|
74
|
+
/** Relative to the Claude config dir ($CLAUDE_CONFIG_DIR, else ~/.claude). */
|
|
75
|
+
export const CONFIG_DIR_STUBS = [
|
|
76
|
+
'settings.json',
|
|
77
|
+
'settings.local.json',
|
|
78
|
+
'CLAUDE.md',
|
|
79
|
+
'agents',
|
|
80
|
+
'commands',
|
|
81
|
+
'hooks',
|
|
82
|
+
'skills',
|
|
83
|
+
'rules',
|
|
84
|
+
'workflows',
|
|
85
|
+
'routines',
|
|
86
|
+
'output-styles',
|
|
87
|
+
'ide',
|
|
88
|
+
'local',
|
|
89
|
+
'jobs',
|
|
90
|
+
'daemon',
|
|
91
|
+
'daemon.json',
|
|
92
|
+
'launch.json',
|
|
93
|
+
'loop.md',
|
|
94
|
+
'policy-limits.json',
|
|
95
|
+
'scheduled_tasks.json',
|
|
96
|
+
];
|
|
97
|
+
/** Relative to where the global config file lives ($CLAUDE_CONFIG_DIR, else $HOME). */
|
|
98
|
+
export const GLOBAL_CONFIG_STUBS = [
|
|
99
|
+
'.claude-custom-oauth.json',
|
|
100
|
+
'.claude-local-oauth.json',
|
|
101
|
+
'.claude-staging-oauth.json',
|
|
102
|
+
];
|
|
103
|
+
const within = (root, p) => p === root || p.startsWith(root.endsWith(sep) ? root : root + sep);
|
|
104
|
+
/** Every stub path the sandbox binds for a role with this cwd and HOME, where
|
|
105
|
+
* `writableRoots` is the sandbox's `filesystem.allowWrite`. A `.claude`
|
|
106
|
+
* directory comes before the files in it. */
|
|
107
|
+
export function sandboxStubPaths(ctx) {
|
|
108
|
+
const configDir = ctx.env?.CLAUDE_CONFIG_DIR;
|
|
109
|
+
const above = [];
|
|
110
|
+
for (let d = dirname(ctx.cwd);; d = dirname(d)) {
|
|
111
|
+
if (ctx.writableRoots.some((r) => within(r, d)))
|
|
112
|
+
above.push(d);
|
|
113
|
+
if (d === dirname(d))
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
const project = (dir) => [
|
|
117
|
+
join(dir, '.claude'),
|
|
118
|
+
...PROJECT_STUBS.map((p) => join(dir, p)),
|
|
119
|
+
];
|
|
120
|
+
return [
|
|
121
|
+
...project(ctx.cwd),
|
|
122
|
+
...CWD_STUBS.filter((p) => !PROJECT_STUBS.includes(p)).map((p) => join(ctx.cwd, p)),
|
|
123
|
+
join(ctx.cwd, '.git', 'config.worktree'),
|
|
124
|
+
...above.flatMap(project),
|
|
125
|
+
...CONFIG_DIR_STUBS.map((p) => join(configDir ?? join(ctx.home, '.claude'), p)),
|
|
126
|
+
...GLOBAL_CONFIG_STUBS.map((p) => join(configDir ?? ctx.home, p)),
|
|
127
|
+
join(ctx.home, '.mcp.json'),
|
|
128
|
+
];
|
|
129
|
+
}
|
|
130
|
+
/** Every name a stub can have: a ledger entry naming anything else is not
|
|
131
|
+
* reclaimed, whatever it says (the ledger lives in a directory the roles'
|
|
132
|
+
* sandboxed shells can write). */
|
|
133
|
+
const STUB_NAMES = new Set(['.claude', 'config.worktree', ...CWD_STUBS, ...CONFIG_DIR_STUBS, ...GLOBAL_CONFIG_STUBS].map((p) => basename(p)));
|
|
134
|
+
/** The per-machine crash ledger: `MONOMIND_ORGRT_STUBS_DIR`, else
|
|
135
|
+
* ~/.monomind/orgrt-sandbox-stubs (next to orgrt-broker and orgrt-operator). */
|
|
136
|
+
export function defaultStubLedger(env = process.env) {
|
|
137
|
+
return join(env.MONOMIND_ORGRT_STUBS_DIR || join(homedir(), '.monomind', 'orgrt-sandbox-stubs'), 'ledger.json');
|
|
138
|
+
}
|
|
139
|
+
function readLedger(file) {
|
|
140
|
+
try {
|
|
141
|
+
const entries = JSON.parse(readFileSync(file, 'utf8')).entries;
|
|
142
|
+
if (!Array.isArray(entries))
|
|
143
|
+
return [];
|
|
144
|
+
return entries.filter((e) => !!e &&
|
|
145
|
+
typeof e.path === 'string' &&
|
|
146
|
+
isAbsolute(e.path) &&
|
|
147
|
+
typeof e.ino === 'number' &&
|
|
148
|
+
typeof e.dev === 'number' &&
|
|
149
|
+
(e.kind === 'file' || e.kind === 'dir') &&
|
|
150
|
+
Number.isInteger(e.pid) &&
|
|
151
|
+
(e.pidNamespace === undefined || typeof e.pidNamespace === 'string') &&
|
|
152
|
+
(e.bootId === undefined || typeof e.bootId === 'string'));
|
|
153
|
+
}
|
|
154
|
+
catch {
|
|
155
|
+
return []; // missing or corrupt: nothing to reclaim
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
/** Atomic (tmp + rename). Only a write that adds entries makes the dir: a
|
|
159
|
+
* removal has nothing to record where there is no ledger. */
|
|
160
|
+
function writeLedger(file, entries, create) {
|
|
161
|
+
try {
|
|
162
|
+
if (create)
|
|
163
|
+
mkdirSync(dirname(file), { recursive: true });
|
|
164
|
+
const tmp = `${file}.${process.pid}.tmp`;
|
|
165
|
+
writeFileSync(tmp, `${JSON.stringify({ entries }, null, 2)}\n`);
|
|
166
|
+
renameSync(tmp, file);
|
|
167
|
+
}
|
|
168
|
+
catch {
|
|
169
|
+
/* best-effort: the stubs still work, only crash recovery is lost */
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
const alive = (pid) => {
|
|
173
|
+
try {
|
|
174
|
+
process.kill(pid, 0);
|
|
175
|
+
return true;
|
|
176
|
+
}
|
|
177
|
+
catch (err) {
|
|
178
|
+
return err.code === 'EPERM';
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
const defaultIdentity = {
|
|
182
|
+
pidNamespace() {
|
|
183
|
+
try {
|
|
184
|
+
return readlinkSync('/proc/self/ns/pid');
|
|
185
|
+
}
|
|
186
|
+
catch {
|
|
187
|
+
return undefined;
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
bootId() {
|
|
191
|
+
try {
|
|
192
|
+
return readFileSync('/proc/sys/kernel/random/boot_id', 'utf8').trim();
|
|
193
|
+
}
|
|
194
|
+
catch {
|
|
195
|
+
return undefined;
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
};
|
|
199
|
+
/** An entry recorded before pid-namespace awareness (no `pidNamespace`/
|
|
200
|
+
* `bootId`), or one whose reader could not read them: falls back to the
|
|
201
|
+
* bare pid check (today's behavior, and correct outside any sandbox). */
|
|
202
|
+
function isLegacy(e) {
|
|
203
|
+
return e.pidNamespace === undefined || e.bootId === undefined;
|
|
204
|
+
}
|
|
205
|
+
/** The stubs this process created, and which runs still need each one. */
|
|
206
|
+
export class SandboxStubs {
|
|
207
|
+
ledger;
|
|
208
|
+
identity;
|
|
209
|
+
stubs = new Map();
|
|
210
|
+
exitHook = false;
|
|
211
|
+
reclaimed = false;
|
|
212
|
+
/** `ledger`: the crash-ledger file (default defaultStubLedger(), read when
|
|
213
|
+
* first needed); null keeps no ledger. `identity`: overridable in tests;
|
|
214
|
+
* defaults to reading this process's real pid namespace and boot id. */
|
|
215
|
+
constructor(ledger, identity = defaultIdentity) {
|
|
216
|
+
this.ledger = ledger;
|
|
217
|
+
this.identity = identity;
|
|
218
|
+
}
|
|
219
|
+
get ledgerFile() {
|
|
220
|
+
return this.ledger === undefined ? defaultStubLedger() : this.ledger;
|
|
221
|
+
}
|
|
222
|
+
/** Creates each missing path — a `.claude` path as a directory, anything
|
|
223
|
+
* else as an empty 0444 file — and records `owner` on every path this
|
|
224
|
+
* process created. The first call reclaims a dead runtime's stubs first.
|
|
225
|
+
* Returns the paths created now. */
|
|
226
|
+
hold(owner, paths) {
|
|
227
|
+
if (!this.reclaimed)
|
|
228
|
+
this.reclaim();
|
|
229
|
+
const created = [];
|
|
230
|
+
for (const p of paths) {
|
|
231
|
+
const mine = this.stubs.get(p);
|
|
232
|
+
if (mine) {
|
|
233
|
+
mine.owners.add(owner);
|
|
234
|
+
continue;
|
|
235
|
+
}
|
|
236
|
+
const dir = p.endsWith(`${sep}.claude`);
|
|
237
|
+
try {
|
|
238
|
+
if (!lstatSync(dirname(p)).isDirectory())
|
|
239
|
+
continue;
|
|
240
|
+
// Exclusive: a path that exists in any form is not ours.
|
|
241
|
+
if (dir)
|
|
242
|
+
mkdirSync(p);
|
|
243
|
+
else
|
|
244
|
+
closeSync(openSync(p, constants.O_CREAT | constants.O_EXCL | constants.O_WRONLY, 0o444));
|
|
245
|
+
const st = lstatSync(p);
|
|
246
|
+
this.stubs.set(p, { dev: st.dev, ino: st.ino, dir, owners: new Set([owner]) });
|
|
247
|
+
created.push(p);
|
|
248
|
+
}
|
|
249
|
+
catch {
|
|
250
|
+
/* exists, no parent, or not writable: the SDK handles it as before */
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
if (created.length) {
|
|
254
|
+
this.updateLedger((entries) => [...entries, ...created.map((p) => this.entry(p, owner))]);
|
|
255
|
+
if (!this.exitHook) {
|
|
256
|
+
this.exitHook = true;
|
|
257
|
+
process.on('exit', () => this.releaseAll());
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
return created;
|
|
261
|
+
}
|
|
262
|
+
/** Drops `owner`; removes the stubs no other run holds. Returns them. */
|
|
263
|
+
release(owner) {
|
|
264
|
+
const free = [];
|
|
265
|
+
for (const [p, stub] of this.stubs) {
|
|
266
|
+
stub.owners.delete(owner);
|
|
267
|
+
if (!stub.owners.size)
|
|
268
|
+
free.push([p, stub]);
|
|
269
|
+
}
|
|
270
|
+
return this.remove(free);
|
|
271
|
+
}
|
|
272
|
+
releaseAll() {
|
|
273
|
+
this.remove([...this.stubs]);
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Stubs a runtime that died without cleaning up (SIGKILL, reboot) left in
|
|
277
|
+
* the ledger. Each is removed under the same rule as our own — same inode,
|
|
278
|
+
* still empty — and forgotten either way: a changed path is no longer a
|
|
279
|
+
* stub. While another live runtime has stubs in the ledger, its roles may
|
|
280
|
+
* be binding the dead one's as existing files, so they are adopted instead:
|
|
281
|
+
* held by this process and removed when its first run ends. Entries of live
|
|
282
|
+
* runtimes are kept. Returns the paths removed.
|
|
283
|
+
*/
|
|
284
|
+
reclaim() {
|
|
285
|
+
this.reclaimed = true;
|
|
286
|
+
const file = this.ledgerFile;
|
|
287
|
+
if (!file)
|
|
288
|
+
return [];
|
|
289
|
+
const entries = readLedger(file);
|
|
290
|
+
const ourNs = this.identity.pidNamespace();
|
|
291
|
+
const ourBootId = this.identity.bootId();
|
|
292
|
+
const dead = entries.filter((e) => this.isDead(e, ourNs, ourBootId));
|
|
293
|
+
if (!dead.length)
|
|
294
|
+
return [];
|
|
295
|
+
const othersLive = entries.some((e) => !this.isOwn(e, ourNs, ourBootId) && !dead.includes(e));
|
|
296
|
+
const stale = dead
|
|
297
|
+
.filter((e) => STUB_NAMES.has(basename(e.path)) && !this.stubs.has(e.path))
|
|
298
|
+
.map((e) => [
|
|
299
|
+
e.path,
|
|
300
|
+
{ dev: e.dev, ino: e.ino, dir: e.kind === 'dir', owners: new Set() },
|
|
301
|
+
]);
|
|
302
|
+
const removed = [];
|
|
303
|
+
const adopted = [];
|
|
304
|
+
for (const [p, stub] of stale.sort(([a], [b]) => b.length - a.length)) {
|
|
305
|
+
if (othersLive) {
|
|
306
|
+
if (unchanged(p, stub, true)) {
|
|
307
|
+
this.stubs.set(p, stub);
|
|
308
|
+
adopted.push(this.entry(p, 'adopted'));
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
else if (removeIfUnchanged(p, stub))
|
|
312
|
+
removed.push(p);
|
|
313
|
+
}
|
|
314
|
+
this.updateLedger((all) => [...all.filter((e) => !dead.includes(e)), ...adopted], entries);
|
|
315
|
+
return removed;
|
|
316
|
+
}
|
|
317
|
+
entry(p, runId) {
|
|
318
|
+
const s = this.stubs.get(p);
|
|
319
|
+
return {
|
|
320
|
+
path: p,
|
|
321
|
+
ino: s.ino,
|
|
322
|
+
dev: s.dev,
|
|
323
|
+
kind: s.dir ? 'dir' : 'file',
|
|
324
|
+
pid: process.pid,
|
|
325
|
+
pidNamespace: this.identity.pidNamespace(),
|
|
326
|
+
bootId: this.identity.bootId(),
|
|
327
|
+
runId,
|
|
328
|
+
createdAt: new Date().toISOString(),
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
/** Is `e` an entry this process itself wrote? For a modern entry that also
|
|
332
|
+
* requires our current namespace and boot to match — a matching pid alone
|
|
333
|
+
* can be a different process after a pid wrap, or the same-numbered pid in
|
|
334
|
+
* an unrelated namespace. A legacy entry (no pidNamespace/bootId) falls
|
|
335
|
+
* back to the bare pid check it was written under — and so does every
|
|
336
|
+
* entry when OUR OWN identity could not be read (older kernel, no /proc):
|
|
337
|
+
* with no `ourNs`/`ourBootId` to compare against, a modern entry's real
|
|
338
|
+
* values would always look "different", which is not a safe basis for
|
|
339
|
+
* ownership either. */
|
|
340
|
+
isOwn(e, ourNs, ourBootId) {
|
|
341
|
+
if (isLegacy(e) || ourNs === undefined || ourBootId === undefined)
|
|
342
|
+
return e.pid === process.pid;
|
|
343
|
+
return e.pid === process.pid && e.pidNamespace === ourNs && e.bootId === ourBootId;
|
|
344
|
+
}
|
|
345
|
+
/** Is `e` safe to reclaim? A different boot always is (pids and namespace
|
|
346
|
+
* ids are meaningless across a reboot). Same boot but a different pid
|
|
347
|
+
* namespace never is — we cannot tell alive from dead across namespaces
|
|
348
|
+
* (`process.kill` always throws ESRCH there), so it is left alone rather
|
|
349
|
+
* than guessed at. Same boot and same namespace (or a legacy entry) falls
|
|
350
|
+
* back to the bare pid-alive check — and so does every entry when OUR OWN
|
|
351
|
+
* identity could not be read (older kernel, no /proc): without `ourNs`/
|
|
352
|
+
* `ourBootId` to compare against, a modern entry's real boot/namespace
|
|
353
|
+
* ids would always compare unequal, which would misjudge every live
|
|
354
|
+
* entry as a different boot and reclaim it. */
|
|
355
|
+
isDead(e, ourNs, ourBootId) {
|
|
356
|
+
if (isLegacy(e) || ourNs === undefined || ourBootId === undefined) {
|
|
357
|
+
return e.pid === process.pid || !alive(e.pid);
|
|
358
|
+
}
|
|
359
|
+
if (e.bootId !== ourBootId)
|
|
360
|
+
return true;
|
|
361
|
+
if (e.pidNamespace !== ourNs)
|
|
362
|
+
return false;
|
|
363
|
+
return e.pid === process.pid || !alive(e.pid);
|
|
364
|
+
}
|
|
365
|
+
updateLedger(change, current) {
|
|
366
|
+
const file = this.ledgerFile;
|
|
367
|
+
if (!file)
|
|
368
|
+
return;
|
|
369
|
+
const before = current ?? readLedger(file);
|
|
370
|
+
const after = change(before);
|
|
371
|
+
writeLedger(file, after, after.length > before.length);
|
|
372
|
+
}
|
|
373
|
+
/** Files before the directories holding them; each only while unchanged. */
|
|
374
|
+
remove(entries) {
|
|
375
|
+
const removed = [];
|
|
376
|
+
entries.sort(([a], [b]) => b.length - a.length);
|
|
377
|
+
for (const [p, stub] of entries) {
|
|
378
|
+
this.stubs.delete(p);
|
|
379
|
+
if (removeIfUnchanged(p, stub))
|
|
380
|
+
removed.push(p);
|
|
381
|
+
}
|
|
382
|
+
if (entries.length) {
|
|
383
|
+
const gone = new Set(entries.map(([p]) => p));
|
|
384
|
+
const ourNs = this.identity.pidNamespace();
|
|
385
|
+
const ourBootId = this.identity.bootId();
|
|
386
|
+
this.updateLedger((all) => all.filter((e) => !this.isOwn(e, ourNs, ourBootId) || !gone.has(e.path)));
|
|
387
|
+
}
|
|
388
|
+
return removed;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
/** Is `p` still the empty file or directory recorded in `stub`? A directory
|
|
392
|
+
* that still holds stubs counts with `filledDir` (adoption: its stubs are
|
|
393
|
+
* adopted with it). */
|
|
394
|
+
function unchanged(p, stub, filledDir = false) {
|
|
395
|
+
try {
|
|
396
|
+
const st = lstatSync(p);
|
|
397
|
+
if (st.dev !== stub.dev || st.ino !== stub.ino)
|
|
398
|
+
return false;
|
|
399
|
+
if (stub.dir)
|
|
400
|
+
return st.isDirectory() && (filledDir || readdirSync(p).length === 0);
|
|
401
|
+
return st.isFile() && st.size === 0;
|
|
402
|
+
}
|
|
403
|
+
catch {
|
|
404
|
+
return false;
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
/** Removes `p` only while it is still the empty file or directory recorded. */
|
|
408
|
+
function removeIfUnchanged(p, stub) {
|
|
409
|
+
if (!unchanged(p, stub))
|
|
410
|
+
return false;
|
|
411
|
+
try {
|
|
412
|
+
if (stub.dir)
|
|
413
|
+
rmdirSync(p); // fails unless (still) empty
|
|
414
|
+
else
|
|
415
|
+
unlinkSync(p);
|
|
416
|
+
return true;
|
|
417
|
+
}
|
|
418
|
+
catch {
|
|
419
|
+
return false;
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
/** One per process: every org run in it shares the cwd and ~/.claude stubs. */
|
|
423
|
+
export const sandboxStubs = new SandboxStubs();
|
|
424
|
+
//# sourceMappingURL=sandbox-stubs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sandbox-stubs.js","sourceRoot":"","sources":["../../../src/orgrt/sandbox-stubs.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH,OAAO,EACL,SAAS,EACT,SAAS,EACT,SAAS,EACT,SAAS,EACT,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,SAAS,EACT,UAAU,EACV,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAErE,kFAAkF;AAClF,MAAM,aAAa,GAAG;IACpB,WAAW;IACX,uBAAuB;IACvB,6BAA6B;IAC7B,gBAAgB;IAChB,kBAAkB;IAClB,eAAe;IACf,gBAAgB;IAChB,mBAAmB;IACnB,kBAAkB;IAClB,uBAAuB;IACvB,qBAAqB;IACrB,iBAAiB;IACjB,8BAA8B;CAC/B,CAAC;AAEF,+EAA+E;AAC/E,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,SAAS;IACT,eAAe;IACf,UAAU;IACV,QAAQ;IACR,WAAW;IACX,YAAY;IACZ,aAAa;IACb,YAAY;IACZ,OAAO;IACP,SAAS;IACT,GAAG,aAAa;CACjB,CAAC;AAEF,8EAA8E;AAC9E,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,eAAe;IACf,qBAAqB;IACrB,WAAW;IACX,QAAQ;IACR,UAAU;IACV,OAAO;IACP,QAAQ;IACR,OAAO;IACP,WAAW;IACX,UAAU;IACV,eAAe;IACf,KAAK;IACL,OAAO;IACP,MAAM;IACN,QAAQ;IACR,aAAa;IACb,aAAa;IACb,SAAS;IACT,oBAAoB;IACpB,sBAAsB;CACvB,CAAC;AAEF,uFAAuF;AACvF,MAAM,CAAC,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ACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAWtE;AAo/BD;;;;;;kFAMkF;AAClF,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,wBAAgB,aAAa,CAAC,IAAI,EAAE,WAAW,GAAG,UAAU,EAAE,CA0X7D"}
|
|
@@ -7,6 +7,7 @@ import { scanInput } from './fence.js';
|
|
|
7
7
|
import { Mailbox } from './mailbox.js';
|
|
8
8
|
import { summarizeToolOutput } from './policy.js';
|
|
9
9
|
import { FaultRestarts, ProcessFaultError } from './sandbox-fault.js';
|
|
10
|
+
import { sandboxStubPaths, sandboxStubs } from './sandbox-stubs.js';
|
|
10
11
|
import { StateDetector } from './state-detector.js';
|
|
11
12
|
import { linkAbort, queueCancelNotice, TaskCancelledError, trackTaskProcess, } from './task-cancel.js';
|
|
12
13
|
import { MAX_TASK_BRIEF } from './task-dag.js';
|
|
@@ -752,6 +753,16 @@ async function runOneSession(opts, resume, costTotals, progress, tokenTotals, st
|
|
|
752
753
|
claudeRuntime: runner instanceof ClaudeAgentRunner,
|
|
753
754
|
runtime: role.runtime ?? opts.def?.runtime,
|
|
754
755
|
});
|
|
756
|
+
// The sandbox's mount-point stubs, created once and kept until the run
|
|
757
|
+
// ends, so no other role's process deletes one mid-bind (sandbox-stubs.ts).
|
|
758
|
+
const osSandbox = gitEnforcement.claudeRestrictions?.sandbox;
|
|
759
|
+
if (osSandbox && process.platform === 'linux')
|
|
760
|
+
sandboxStubs.hold(`${org}:${opts.run ?? ''}`, sandboxStubPaths({
|
|
761
|
+
cwd,
|
|
762
|
+
home: homedir(),
|
|
763
|
+
writableRoots: osSandbox.filesystem?.allowWrite ?? [],
|
|
764
|
+
env: process.env,
|
|
765
|
+
}));
|
|
755
766
|
// What this session really got, not what the config asked for (policy-git.ts).
|
|
756
767
|
policy.setOsSandboxed(!!gitEnforcement.claudeRestrictions?.sandbox);
|
|
757
768
|
const authorityMask = roleAuthorityMask({
|