@bakers-build/addon-codex 0.6.1-next.5 → 0.6.1-next.7

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.
@@ -1,4 +1,4 @@
1
- import { type AgentFootprint, type AgentPlugin, type AgentRunIdentity, type BbAgent, type RunEnvPolicy, type SandboxHost, type SandboxPreflight, type SecurityOptions } from '@bakers-build/conductor/contract';
1
+ import { type AgentFootprint, type AgentPlugin, type AgentRunIdentity, type BbAgent, type ResolvedSecurity, type RunEnvPolicy, type SandboxHost, type SandboxPreflight, type SecurityOptions } from '@bakers-build/conductor/contract';
2
2
  export { parseCodexTranscript } from './footprint.js';
3
3
  export interface CodexAgentOptions extends SecurityOptions {
4
4
  model?: string;
@@ -21,10 +21,12 @@ export declare class CodexAgent implements BbAgent {
21
21
  private readonly model;
22
22
  private readonly effort;
23
23
  private readonly overrides;
24
- private readonly security;
24
+ readonly security: ResolvedSecurity;
25
25
  private readonly allowWrite;
26
26
  readonly runEnvPolicy: RunEnvPolicy;
27
27
  constructor(options?: CodexAgentOptions, home?: string);
28
+ /** A `config.toml` server the conductor's own replaces, named once per dispatch. */
29
+ get launchWarnings(): readonly string[];
28
30
  /** The launch flags a security mode owns (`docs/addons/codex.md`). */
29
31
  private securityFlags;
30
32
  private userMcpServers;
package/dist/src/index.js CHANGED
@@ -110,7 +110,10 @@ export class CodexAgent {
110
110
  this.model = cli.model;
111
111
  this.effort = cli.effort;
112
112
  this.overrides = cli.overrides;
113
- this.security = resolveSecurityOptions(options, SANDBOX_DEFAULTS);
113
+ // Shared deny_read and trusted_commands have nothing to map onto here.
114
+ this.security = resolveSecurityOptions(options, SANDBOX_DEFAULTS, {
115
+ unsupported: ['deny_read', 'trusted_commands'],
116
+ });
114
117
  this.runEnvPolicy = this.security.runEnvPolicy;
115
118
  this.allowWrite = withoutGitDirs(this.security.sandbox.allow_write);
116
119
  // Codex has no read deny or unsandboxed-command list to map these onto.
@@ -128,8 +131,16 @@ export class CodexAgent {
128
131
  }
129
132
  }
130
133
  }
134
+ /** A `config.toml` server the conductor's own replaces, named once per dispatch. */
135
+ get launchWarnings() {
136
+ return this.userMcpServers().includes(CONDUCTOR_TOOLS_SERVER)
137
+ ? [
138
+ `~/.codex/config.toml mcp_servers.${CONDUCTOR_TOOLS_SERVER} is replaced by the conductor's ${CONDUCTOR_TOOLS_SERVER} server`,
139
+ ]
140
+ : [];
141
+ }
131
142
  /** The launch flags a security mode owns (`docs/addons/codex.md`). */
132
- securityFlags(workspacePath) {
143
+ securityFlags(workspacePath, withTools) {
133
144
  const { mode, sandbox, config } = this.security;
134
145
  if (mode === 'system')
135
146
  return [];
@@ -167,9 +178,9 @@ export class CodexAgent {
167
178
  `permissions.bakers=${profile}`,
168
179
  ];
169
180
  for (const id of this.userMcpServers()) {
170
- // The conductor's server is set per launch, never switched off.
181
+ // A launch with the conductor's server replaces that id whole below.
171
182
  if (!Object.hasOwn(sandbox.mcp_servers, id) &&
172
- id !== CONDUCTOR_TOOLS_SERVER) {
183
+ !(withTools && id === CONDUCTOR_TOOLS_SERVER)) {
173
184
  flags.push(...pairs([[`mcp_servers.${id}.enabled`, false]]));
174
185
  }
175
186
  }
@@ -189,7 +200,10 @@ export class CodexAgent {
189
200
  launchCommand(prompt, _run, workspacePath = process.cwd(), tools, env = {}) {
190
201
  // Quote at assembly; a plain word has nothing for the shell to expand.
191
202
  const word = (t) => (/^[\w./=-]+$/.test(t) ? t : shellQuote(t));
192
- const parts = ['codex', ...this.securityFlags(workspacePath).map(word)];
203
+ const parts = [
204
+ 'codex',
205
+ ...this.securityFlags(workspacePath, tools !== undefined).map(word),
206
+ ];
193
207
  // Codex's default shell env filter drops `*KEY*` names; without its key a
194
208
  // `GIT_CONFIG_COUNT` entry makes every git call fail.
195
209
  for (const [name, value] of Object.entries(env)) {
@@ -198,9 +212,9 @@ export class CodexAgent {
198
212
  }
199
213
  }
200
214
  if (tools) {
201
- // Codex reads the token from the run env, so it never enters argv.
202
- const server = `mcp_servers.${CONDUCTOR_TOOLS_SERVER}`;
203
- parts.push('-c', word(`${server}.url=${JSON.stringify(tools.url)}`), '-c', word(`${server}.bearer_token_env_var=${JSON.stringify(CONDUCTOR_TOKEN_ENV)}`));
215
+ // A whole inline table replaces any config.toml entry of that id. Codex
216
+ // reads the token from the run env, so it never enters argv.
217
+ parts.push('-c', word(`mcp_servers.${CONDUCTOR_TOOLS_SERVER}={url=${JSON.stringify(tools.url)},bearer_token_env_var=${JSON.stringify(CONDUCTOR_TOKEN_ENV)},default_tools_approval_mode="approve"}`));
204
218
  }
205
219
  if (this.model !== undefined && !this.overrides.model) {
206
220
  parts.push('--model', shellQuote(this.model));
@@ -307,6 +321,7 @@ export function codexAgent(options = {}) {
307
321
  kind: 'agent',
308
322
  id: 'codex',
309
323
  requiredModules: [],
324
+ security: agent.security.report,
310
325
  async createAgent() {
311
326
  return agent;
312
327
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bakers-build/addon-codex",
3
- "version": "0.6.1-next.5",
3
+ "version": "0.6.1-next.7",
4
4
  "description": "bakers.build agent plugin for the Codex CLI.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -20,11 +20,11 @@
20
20
  "directory": "bakers-cli/addons/codex"
21
21
  },
22
22
  "peerDependencies": {
23
- "@bakers-build/conductor": "^0.6.1-next.5",
24
- "@bakers-build/core": "^0.6.1-next.5"
23
+ "@bakers-build/conductor": "^0.6.1-next.7",
24
+ "@bakers-build/core": "^0.6.1-next.7"
25
25
  },
26
26
  "bakersBuild": {
27
- "commit": "314f28982940df736bea55293a81435d37864b31",
27
+ "commit": "b89398b187bf51f4f9ca5bfc1150469f73a879e6",
28
28
  "channel": "next"
29
29
  }
30
30
  }