@bakers-build/addon-claude 0.5.1-next.855 → 0.5.1-next.856

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.
@@ -23,12 +23,22 @@ export declare class ClaudeAgent implements BbAgent {
23
23
  private readonly model;
24
24
  private readonly effort;
25
25
  private readonly securityFlags;
26
+ /** The sandbox's own MCP servers, strict; undefined outside the sandbox. */
27
+ private readonly sandboxMcpServers;
26
28
  private readonly securityMode;
27
29
  readonly runEnvPolicy: RunEnvPolicy;
28
30
  private readonly measure;
29
31
  private readonly overrides;
30
32
  constructor(options?: ClaudeAgentOptions, home?: string);
31
- launchCommand(prompt: string, run?: AgentRunIdentity): string;
33
+ launchCommand(prompt: string, run?: AgentRunIdentity, _workspacePath?: string, tools?: {
34
+ url: string;
35
+ }): string;
36
+ /**
37
+ * The sandbox's strict MCP config, plus the conductor's tool server when
38
+ * the run has one. A measured run stays without MCP servers. The token is
39
+ * referenced from the run env, which Claude expands, so it is never in argv.
40
+ */
41
+ private mcpFlags;
32
42
  /**
33
43
  * `claude --session-id <uuid>` refuses to start when that session already
34
44
  * exists (BB-473 review round 2), so the conductor checks this before
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 { installCommand, lastLine, resolveAgentCliOptions, resolveSecurityOptions, systemSandboxHost, validateOptionalBoolean, } from '@bakers-build/conductor/contract';
5
+ import { CONDUCTOR_TOKEN_ENV, CONDUCTOR_TOOLS_SERVER, 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';
@@ -69,9 +69,6 @@ function securityFlags({ mode, sandbox, config }) {
69
69
  'project,local',
70
70
  '--settings',
71
71
  JSON.stringify(settings),
72
- '--strict-mcp-config',
73
- '--mcp-config',
74
- JSON.stringify({ mcpServers: sandbox.mcp_servers }),
75
72
  ];
76
73
  }
77
74
  /**
@@ -102,6 +99,8 @@ export class ClaudeAgent {
102
99
  model;
103
100
  effort;
104
101
  securityFlags;
102
+ /** The sandbox's own MCP servers, strict; undefined outside the sandbox. */
103
+ sandboxMcpServers;
105
104
  securityMode;
106
105
  runEnvPolicy;
107
106
  measure;
@@ -115,11 +114,13 @@ export class ClaudeAgent {
115
114
  this.overrides = cli.overrides;
116
115
  const security = resolveSecurityOptions(options, SANDBOX_DEFAULTS);
117
116
  this.securityFlags = securityFlags(security);
117
+ this.sandboxMcpServers =
118
+ security.mode === 'sandbox' ? security.sandbox.mcp_servers : undefined;
118
119
  this.securityMode = security.mode;
119
120
  this.runEnvPolicy = security.runEnvPolicy;
120
121
  this.measure = validateOptionalBoolean(options.measure, 'measure') ?? false;
121
122
  }
122
- launchCommand(prompt, run) {
123
+ launchCommand(prompt, run, _workspacePath, tools) {
123
124
  if (prompt === '') {
124
125
  return 'claude';
125
126
  }
@@ -139,6 +140,7 @@ export class ClaudeAgent {
139
140
  }
140
141
  // The flags are constants; only their generated values need quoting.
141
142
  parts.push(...this.securityFlags.map((t) => t.startsWith('--') ? t : shellQuote(t)));
143
+ parts.push(...this.mcpFlags(tools).map((t) => t.startsWith('--') ? t : shellQuote(t)));
142
144
  // Pin the transcript's own session id to the run's UUID (BB-473), so
143
145
  // `getRunLog` can read that ONE file directly instead of scanning the
144
146
  // worktree-keyed directory by mtime — the scan is what let a
@@ -150,13 +152,39 @@ export class ClaudeAgent {
150
152
  if (this.measure) {
151
153
  // The wrapper folds an inline --settings JSON into its profile file.
152
154
  for (const pair of MEASURE_FLAGS) {
153
- if (!this.securityFlags.includes(pair[0])) {
155
+ if (!parts.includes(pair[0])) {
154
156
  parts.push(...pair.map(shellQuote));
155
157
  }
156
158
  }
157
159
  }
158
160
  return parts.join(' ');
159
161
  }
162
+ /**
163
+ * The sandbox's strict MCP config, plus the conductor's tool server when
164
+ * the run has one. A measured run stays without MCP servers. The token is
165
+ * referenced from the run env, which Claude expands, so it is never in argv.
166
+ */
167
+ mcpFlags(tools) {
168
+ const conductor = tools && !this.measure
169
+ ? {
170
+ [CONDUCTOR_TOOLS_SERVER]: {
171
+ type: 'http',
172
+ url: tools.url,
173
+ headers: { Authorization: `Bearer \${${CONDUCTOR_TOKEN_ENV}}` },
174
+ },
175
+ }
176
+ : {};
177
+ const config = (servers) => JSON.stringify({ mcpServers: servers });
178
+ if (this.sandboxMcpServers !== undefined)
179
+ return [
180
+ '--strict-mcp-config',
181
+ '--mcp-config',
182
+ config({ ...this.sandboxMcpServers, ...conductor }),
183
+ ];
184
+ return Object.keys(conductor).length > 0
185
+ ? ['--mcp-config', config(conductor)]
186
+ : [];
187
+ }
160
188
  /**
161
189
  * `claude --session-id <uuid>` refuses to start when that session already
162
190
  * exists (BB-473 review round 2), so the conductor checks this before
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bakers-build/addon-claude",
3
- "version": "0.5.1-next.855",
3
+ "version": "0.5.1-next.856",
4
4
  "description": "bakers.build agent plugin for the Claude CLI.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -23,11 +23,11 @@
23
23
  "directory": "bakers-cli/addons/claude"
24
24
  },
25
25
  "peerDependencies": {
26
- "@bakers-build/conductor": "^0.5.1-next.855",
27
- "@bakers-build/core": "^0.5.1-next.855"
26
+ "@bakers-build/conductor": "^0.5.1-next.856",
27
+ "@bakers-build/core": "^0.5.1-next.856"
28
28
  },
29
29
  "bakersBuild": {
30
- "commit": "bea27960d8d0cfb827f72aae305ed5820ecd28f3",
30
+ "commit": "756501eea816e36604ee443b4b3dc8a9e6c89692",
31
31
  "channel": "next"
32
32
  }
33
33
  }