@bakers-build/addon-claude 0.4.1-next.499 → 0.4.1-next.536
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/index.d.ts +4 -1
- package/dist/src/index.js +37 -1
- package/package.json +3 -3
package/dist/src/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AgentFootprint, type AgentPlugin, type AgentRunIdentity, type BbAgent, type RunEnvPolicy, type SecurityOptions } from '@bakers-build/conductor/contract';
|
|
1
|
+
import { type AgentFootprint, type AgentPlugin, type AgentRunIdentity, type BbAgent, type RunEnvPolicy, type SandboxHost, type SandboxPreflight, type SecurityOptions } from '@bakers-build/conductor/contract';
|
|
2
2
|
export { parseClaudeTranscript } from './footprint.js';
|
|
3
3
|
/**
|
|
4
4
|
* Encode an absolute cwd the way Claude Code names its per-project transcript
|
|
@@ -23,6 +23,7 @@ export declare class ClaudeAgent implements BbAgent {
|
|
|
23
23
|
private readonly model;
|
|
24
24
|
private readonly effort;
|
|
25
25
|
private readonly securityFlags;
|
|
26
|
+
private readonly securityMode;
|
|
26
27
|
readonly runEnvPolicy: RunEnvPolicy;
|
|
27
28
|
private readonly measure;
|
|
28
29
|
private readonly overrides;
|
|
@@ -38,6 +39,8 @@ export declare class ClaudeAgent implements BbAgent {
|
|
|
38
39
|
sessionExists(worktreePath: string, sessionId: string): Promise<boolean>;
|
|
39
40
|
getRunLog(worktreePath: string, run?: AgentRunIdentity): Promise<string>;
|
|
40
41
|
parseFootprint(log: string): AgentFootprint;
|
|
42
|
+
/** Linux needs bwrap, socat and a user namespace; macOS ships Seatbelt. */
|
|
43
|
+
sandboxPreflight(host?: SandboxHost): Promise<SandboxPreflight>;
|
|
41
44
|
}
|
|
42
45
|
/** Config-facing factory: `claudeAgent({ model: 'claude-opus-4-8' })`. */
|
|
43
46
|
export declare function claudeAgent(options?: ClaudeAgentOptions): AgentPlugin;
|
package/dist/src/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { readdir, readFile, stat } from 'node:fs/promises';
|
|
|
2
2
|
import { homedir } from 'node:os';
|
|
3
3
|
import { join } from 'node:path';
|
|
4
4
|
import { fileURLToPath } from 'node:url';
|
|
5
|
-
import { resolveAgentCliOptions, resolveSecurityOptions, validateOptionalBoolean, } from '@bakers-build/conductor/contract';
|
|
5
|
+
import { installCommand, lastLine, resolveAgentCliOptions, resolveSecurityOptions, systemSandboxHost, validateOptionalBoolean, } from '@bakers-build/conductor/contract';
|
|
6
6
|
import { shellQuote } from '@bakers-build/core';
|
|
7
7
|
import { parseClaudeTranscript } from './footprint.js';
|
|
8
8
|
export { parseClaudeTranscript } from './footprint.js';
|
|
@@ -102,6 +102,7 @@ export class ClaudeAgent {
|
|
|
102
102
|
model;
|
|
103
103
|
effort;
|
|
104
104
|
securityFlags;
|
|
105
|
+
securityMode;
|
|
105
106
|
runEnvPolicy;
|
|
106
107
|
measure;
|
|
107
108
|
overrides;
|
|
@@ -114,6 +115,7 @@ export class ClaudeAgent {
|
|
|
114
115
|
this.overrides = cli.overrides;
|
|
115
116
|
const security = resolveSecurityOptions(options, SANDBOX_DEFAULTS);
|
|
116
117
|
this.securityFlags = securityFlags(security);
|
|
118
|
+
this.securityMode = security.mode;
|
|
117
119
|
this.runEnvPolicy = security.runEnvPolicy;
|
|
118
120
|
this.measure = validateOptionalBoolean(options.measure, 'measure') ?? false;
|
|
119
121
|
}
|
|
@@ -266,6 +268,40 @@ export class ClaudeAgent {
|
|
|
266
268
|
parseFootprint(log) {
|
|
267
269
|
return parseClaudeTranscript(log);
|
|
268
270
|
}
|
|
271
|
+
/** Linux needs bwrap, socat and a user namespace; macOS ships Seatbelt. */
|
|
272
|
+
async sandboxPreflight(host = systemSandboxHost()) {
|
|
273
|
+
if (this.securityMode !== 'sandbox' || host.platform !== 'linux') {
|
|
274
|
+
return { ok: true };
|
|
275
|
+
}
|
|
276
|
+
const missing = [
|
|
277
|
+
['bwrap', 'bubblewrap'],
|
|
278
|
+
['socat', 'socat'],
|
|
279
|
+
].filter(([bin]) => !host.onPath(bin));
|
|
280
|
+
if (missing.length > 0) {
|
|
281
|
+
return {
|
|
282
|
+
ok: false,
|
|
283
|
+
cause: `${missing.map(([bin]) => bin).join(' and ')} not found`,
|
|
284
|
+
fix: `install it with ${installCommand(host, missing.map(([, pkg]) => pkg))}`,
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
// The namespaces Claude's sandbox needs: user (unprivileged) and net.
|
|
288
|
+
const probe = await host.run('bwrap', [
|
|
289
|
+
'--unshare-user',
|
|
290
|
+
'--unshare-net',
|
|
291
|
+
'--die-with-parent',
|
|
292
|
+
'--ro-bind',
|
|
293
|
+
'/',
|
|
294
|
+
'/',
|
|
295
|
+
'true',
|
|
296
|
+
]);
|
|
297
|
+
return probe.ok
|
|
298
|
+
? { ok: true }
|
|
299
|
+
: {
|
|
300
|
+
ok: false,
|
|
301
|
+
cause: `bwrap cannot set up its sandbox: ${lastLine(probe.stderr)}`,
|
|
302
|
+
fix: 'allow unprivileged user namespaces on this host, or run the conductor where they are allowed',
|
|
303
|
+
};
|
|
304
|
+
}
|
|
269
305
|
}
|
|
270
306
|
/** Config-facing factory: `claudeAgent({ model: 'claude-opus-4-8' })`. */
|
|
271
307
|
export function claudeAgent(options = {}) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bakers-build/addon-claude",
|
|
3
|
-
"version": "0.4.1-next.
|
|
3
|
+
"version": "0.4.1-next.536",
|
|
4
4
|
"description": "bakers.build agent plugin for the Claude CLI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"directory": "bakers-cli/addons/claude"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
|
-
"@bakers-build/conductor": "^0.4.1-next.
|
|
27
|
-
"@bakers-build/core": "^0.4.1-next.
|
|
26
|
+
"@bakers-build/conductor": "^0.4.1-next.536",
|
|
27
|
+
"@bakers-build/core": "^0.4.1-next.536"
|
|
28
28
|
}
|
|
29
29
|
}
|