@bakers-build/conductor 0.8.0 → 0.8.1-next.1

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.
@@ -91,14 +91,14 @@ export declare function strayConductorsOf(rows: ConductorStatus[], own: Conducto
91
91
  /** Prompt for the developer Kürzel / user id on an interactive terminal. */
92
92
  /** Build the `oven` subcommand tree (lifecycle + registry). */
93
93
  export declare function createConductorCommand(deps: BbCliDeps): Command;
94
- /** The `oven` command plugin the host mounts (BB-201). BB-224
94
+ /** The `conductor` command plugin the host mounts (BB-201). BB-224
95
95
  * (Finding 7): the `bakers deployment` batch helper is no longer registered here —
96
96
  * it is its own command addon, `@bakers-build/addon-deployment`. */
97
97
  declare const conductorCommandPlugin: BbCommandPlugin;
98
98
  export default conductorCommandPlugin;
99
99
  /**
100
100
  * Build a standalone program with the conductor command mounted — the test entry
101
- * (mirrors what the host does for `bakers oven …`). `deps` inject fakes.
101
+ * (mirrors what the host does for `bakers conductor …`). `deps` inject fakes.
102
102
  */
103
103
  export declare function buildConductorProgram(deps?: BbCliDeps): Command;
104
104
  /** Parse argv against the conductor program (test entry). */
@@ -66,9 +66,9 @@ function defaultHost() {
66
66
  }
67
67
  /**
68
68
  * Resolve + compose the full conductor config: the engine half
69
- * (`conductor.config.js` via `loadConductorConfig`) plus the connection half
70
- * (`bakers.config.js` via `loadBbConfig`, walk-up → home → shipped fallback).
71
- * `--config` / `$BB_CONDUCTOR_CONFIG` selects the engine file; the connection
69
+ * (`project.config.js` via `loadConductorConfig`) plus the connection half
70
+ * (connection file via `loadBbConfig`, walk-up → home → shipped fallback).
71
+ * `--config` / `$BAKERS_CONDUCTOR_CONFIG` selects the engine file; the connection
72
72
  * is resolved from cwd.
73
73
  */
74
74
  async function resolveConfig(deps, configPathOverride, resolveProject = false) {
@@ -149,7 +149,7 @@ function loggerFor(checkoutRoot, log = {}) {
149
149
  /**
150
150
  * The liveness words this CLI prints.
151
151
  *
152
- * Delegated to core so `bakers oven ls`, the cockpit and the server-side
152
+ * Delegated to core so `bakers conductor ls`, the cockpit and the server-side
153
153
  * deriver describe one conductor identically. The previous CLI-only vocabulary
154
154
  * (`wedged`, `stopped`, `host-missing`, `registry-only`) went with the registry
155
155
  * that made those distinctions expressible.
@@ -246,7 +246,7 @@ async function cmdPoll(deps, log = {}) {
246
246
  await conductor.start();
247
247
  await conductor.tick();
248
248
  }
249
- /** `bakers oven check`: whether each enabled agent can start its sandbox. */
249
+ /** `bakers conductor check`: whether each enabled agent can start its sandbox. */
250
250
  async function cmdCheck(deps) {
251
251
  const config = await resolveConfig(deps);
252
252
  for (const agent of deps.agents ?? (await selectAgents(config))) {
@@ -578,10 +578,10 @@ async function cmdStart(deps, log = {}, updateCheck = true, body = cmdStartBody,
578
578
  if (status)
579
579
  throw new Error(`bakers ${args[0]} exited ${status}`);
580
580
  });
581
- const prefix = env.BB_CONDUCTOR
582
- ? `bakers --conductor ${env.BB_CONDUCTOR}`
581
+ const prefix = env.BAKERS_CONDUCTOR
582
+ ? `bakers --conductor ${env.BAKERS_CONDUCTOR}`
583
583
  : 'bakers';
584
- const rerun = `${prefix} oven start${force ? ' --force' : ''}`;
584
+ const rerun = `${prefix} conductor start${force ? ' --force' : ''}`;
585
585
  if (accepted) {
586
586
  try {
587
587
  await runBb(['update']);
@@ -715,7 +715,7 @@ async function waitForNotRunning(probe, pid, deps) {
715
715
  return false;
716
716
  }
717
717
  /**
718
- * `bakers oven start` reports exactly one of three outcomes (BB-450
718
+ * `bakers conductor start` reports exactly one of three outcomes (BB-450
719
719
  * AC-12): **started**, naming the pid and `host_key`; **already running**,
720
720
  * naming the live pid and its heartbeat age; **failed**, naming the reason.
721
721
  * `failed` sets a non-zero exit status so a script can tell the three apart.
@@ -810,9 +810,9 @@ async function cmdStartBody(deps, log, force = false, choice = {}) {
810
810
  process.execPath,
811
811
  process.argv[1], // the running bakers entry script
812
812
  ...(stem && stem !== 'conductor' ? ['--conductor', stem] : []),
813
- 'oven',
813
+ 'conductor',
814
814
  ...(log.level ? ['--log-level', log.level] : []),
815
- // No --log-sink: the child's stdout is the log file, pinned by BB_CONDUCTOR_LOG=file.
815
+ // No --log-sink: the child's stdout is the log file, pinned by BAKERS_CONDUCTOR_LOG=file.
816
816
  'start',
817
817
  '--foreground',
818
818
  '--no-update-check',
@@ -823,7 +823,7 @@ async function cmdStartBody(deps, log, force = false, choice = {}) {
823
823
  child = await (deps.spawnConductor ?? spawnDetachedConductor)({
824
824
  argv,
825
825
  cwd: checkoutRoot,
826
- env: { ...process.env, BB_CONDUCTOR_LOG: 'file' },
826
+ env: { ...process.env, BAKERS_CONDUCTOR_LOG: 'file' },
827
827
  logPath,
828
828
  });
829
829
  logger.info({ id, pid: child.pid }, 'started conductor detached');
@@ -944,10 +944,10 @@ async function tryConfig(deps) {
944
944
  // --- the conductor command tree --------------------------------------------
945
945
  /** Build the `oven` subcommand tree (lifecycle + registry). */
946
946
  export function createConductorCommand(deps) {
947
- const conductor = new Command('oven')
947
+ const conductor = new Command('conductor')
948
948
  .description('node-agent lifecycle + local registry')
949
- .option('--log-level <level>', 'log verbosity: debug | info | warn | error (overrides BB_LOG_LEVEL)')
950
- .option('--log-sink <sink>', 'log sink: stdout | file | both (overrides BB_CONDUCTOR_LOG)')
949
+ .option('--log-level <level>', 'log verbosity: debug | info | warn | error (overrides BAKERS_LOG_LEVEL)')
950
+ .option('--log-sink <sink>', 'log sink: stdout | file | both (overrides BAKERS_CONDUCTOR_LOG)')
951
951
  .addHelpText('after', `
952
952
  Logging (precedence: CLI flag > env var > default):
953
953
  --log-level <level> debug | info (default) | warn | error.
@@ -955,13 +955,13 @@ Logging (precedence: CLI flag > env var > default):
955
955
  --log-sink <sink> stdout | file | both (file/both write <checkoutRoot>/.bakers/log.txt).
956
956
  Default: both on a TTY, file otherwise (BB-237 — a run in a
957
957
  herdr pane is on a TTY, and its diagnostics must outlive the pane).
958
- BB_LOG_LEVEL env fallback for --log-level.
959
- BB_CONDUCTOR_LOG env fallback for --log-sink.
958
+ BAKERS_LOG_LEVEL env fallback for --log-level.
959
+ BAKERS_CONDUCTOR_LOG env fallback for --log-sink.
960
960
 
961
961
  Examples:
962
- bakers oven --log-level debug start --foreground
963
- bakers oven --log-level debug once
964
- BB_LOG_LEVEL=debug bakers oven once`);
962
+ bakers conductor --log-level debug start --foreground
963
+ bakers conductor --log-level debug once
964
+ BAKERS_LOG_LEVEL=debug bakers conductor once`);
965
965
  conductor
966
966
  .command('start')
967
967
  .description('start the conductor loop (a detached background process by default)')
@@ -1042,13 +1042,13 @@ Examples:
1042
1042
  // stops is offline, not absent.
1043
1043
  return conductor;
1044
1044
  }
1045
- /** The `oven` command plugin the host mounts (BB-201). BB-224
1045
+ /** The `conductor` command plugin the host mounts (BB-201). BB-224
1046
1046
  * (Finding 7): the `bakers deployment` batch helper is no longer registered here —
1047
1047
  * it is its own command addon, `@bakers-build/addon-deployment`. */
1048
1048
  const conductorCommandPlugin = {
1049
1049
  kind: 'command',
1050
- name: 'oven',
1051
- describe: 'node-agent lifecycle + local registry',
1050
+ name: 'conductor',
1051
+ describe: 'conductor lifecycle + local registry',
1052
1052
  register(program, host) {
1053
1053
  program.addCommand(createConductorCommand({ host }));
1054
1054
  },
@@ -1056,7 +1056,7 @@ const conductorCommandPlugin = {
1056
1056
  export default conductorCommandPlugin;
1057
1057
  /**
1058
1058
  * Build a standalone program with the conductor command mounted — the test entry
1059
- * (mirrors what the host does for `bakers oven …`). `deps` inject fakes.
1059
+ * (mirrors what the host does for `bakers conductor …`). `deps` inject fakes.
1060
1060
  */
1061
1061
  export function buildConductorProgram(deps = {}) {
1062
1062
  const program = new Command();
@@ -1,4 +1,4 @@
1
- // `bakers oven tools`: an MCP client for the run's own conductor tool server,
1
+ // `bakers conductor tools`: an MCP client for the run's own conductor tool server,
2
2
  // for agents that cannot load the `bakers` MCP server themselves. URL and bearer
3
3
  // token come from the run env; the token never reaches argv or output.
4
4
  import { readFileSync } from 'node:fs';
@@ -28,7 +28,7 @@ export { findBbDir, resolveConfigPath, } from '@bakers-build/core';
28
28
  * that a short `sh '<file>'` line runs (BB-635), so its length is not bound
29
29
  * by the tty canonical cap (macOS 1024 B, Linux 4096 B). The prompt is still
30
30
  * kept single-line (BB-128 test).
31
- * Placeholders: `{identifier}`, `{state}`, `{runUuid}`, `{ticketUuid}` ({state} falls back to
31
+ * Placeholders: `{identifier}`, `{state}`, `{run_uuid}`, `{ticket_uuid}` ({state} falls back to
32
32
  * `qualification` for unclassified tickets).
33
33
  *
34
34
  * WHERE THE PROMPT SENDS THE AGENT, and why it no longer names a WORKFLOW.md
@@ -61,8 +61,8 @@ export declare function resolveAgents(raw: unknown, configPath: string): Promise
61
61
  * Load the ENGINE half of a conductor config (BB-201 split model). Reads
62
62
  * remote/executor/agent/workspace + project/states/prompt/
63
63
  * scheduler/hooks — and deliberately NOT `site` or the auth `plugins`, which now
64
- * live in a `bakers.config.js` connection config. The conductor command composes
65
- * the two via `composeConductorConfig`. A legacy `conductor.config.js` still
64
+ * live in a connection file connection config. The conductor command composes
65
+ * the two via `composeConductorConfig`. A legacy `project.config.js` still
66
66
  * carrying `site`/`plugins` loads fine — those two keys are simply ignored here
67
67
  * (the connection loader reads them, back-compat).
68
68
  */
@@ -72,26 +72,17 @@ export declare function loadConductorConfig(configFile: string): Promise<Conduct
72
72
  * half (`loadConductorConfig`) and the connection half (`loadBbConfig`). The
73
73
  * connection supplies `site` + the auth `plugins`; `ensureAuthenticated` /
74
74
  * `selectRemote` read them exactly as before — the fields just arrive from
75
- * `bakers.config.js` now.
75
+ * connection file now.
76
76
  */
77
77
  export declare function composeConductorConfig(engine: ConductorEngineConfig, connection: Pick<BbConnectionConfig, 'site' | 'plugins'>): ConductorFileConfig;
78
78
  /**
79
- * The conductor **stems** in a `.bakers/` dir — the file naming predicate of
80
- * BB-137: exactly `conductor.config.js` (stem `conductor`) or
81
- * `<variant>.conductor.config.js` (stem `<variant>`). The resolution itself
82
- * lives in `@bakers-build/core` (re-exported above); this is the enumeration.
79
+ * The conductor variants in a `.bakers/` dir (`conductor` for
80
+ * `project.config.js`), by the loader's own naming rule.
83
81
  */
84
82
  export declare function configStems(bakersDir: string): string[];
85
- /** Map a conductor stem back to its file name. */
83
+ /** Map a conductor variant back to its file name. */
86
84
  export declare function fileForStem(stem: string): string;
87
- /**
88
- * List the conductor-config **file names** in a `.bakers/` dir, using the same
89
- * naming predicate the loader uses (`configStems`). This is the only supported
90
- * enumeration for the `@bakers-build/bb-upgrade-project` states-strip: it visits the
91
- * default `conductor.config.js` + every `<variant>.conductor.config.js`, and
92
- * never an unrelated JS config (`vite.config.js`, the near-miss
93
- * `myconductor.config.js`).
94
- */
85
+ /** The project config file names in a `.bakers/` dir, default and variants. */
95
86
  export declare function listConductorConfigFiles(bakersDir: string): string[];
96
87
  /**
97
88
  * Remove the obsolete `states:` array property from a conductor-config JS
@@ -1,7 +1,7 @@
1
1
  import { readdirSync } from 'node:fs';
2
- import { basename, dirname, isAbsolute, join, resolve } from 'node:path';
2
+ import { basename, dirname, isAbsolute, resolve } from 'node:path';
3
3
  import { pathToFileURL } from 'node:url';
4
- import { assertSchemaVersion1, discoverAddons, discoverScoped, findDefaultExportObject, machineContextPath, matchDelimiter, readMachineContext, resolveConductorSlots, resolveModuleEslintStyle, scanTopLevelProperties, scopeAddons, stemForConfigFile, warnIgnoredMaxParallel, } from '@bakers-build/core';
4
+ import { assertSchemaVersion, assertValidConfig, discoverAddons, discoverScoped, findDefaultExportObject, machineContextPath, matchDelimiter, readMachineContext, resolveConductorSlots, resolveModuleEslintStyle, scanTopLevelProperties, scopeAddons, stemForConfigFile, } from '@bakers-build/core';
5
5
  import { readBbProjectSelection } from './cli/project-context.js';
6
6
  import { SHARED_SECURITY_KEY, validateSharedSecurity, } from './plugins/agent-args.js';
7
7
  import { validateMarketplaces } from './plugins/agent-home.js';
@@ -39,7 +39,7 @@ export { findBbDir, resolveConfigPath, } from '@bakers-build/core';
39
39
  * that a short `sh '<file>'` line runs (BB-635), so its length is not bound
40
40
  * by the tty canonical cap (macOS 1024 B, Linux 4096 B). The prompt is still
41
41
  * kept single-line (BB-128 test).
42
- * Placeholders: `{identifier}`, `{state}`, `{runUuid}`, `{ticketUuid}` ({state} falls back to
42
+ * Placeholders: `{identifier}`, `{state}`, `{run_uuid}`, `{ticket_uuid}` ({state} falls back to
43
43
  * `qualification` for unclassified tickets).
44
44
  *
45
45
  * WHERE THE PROMPT SENDS THE AGENT, and why it no longer names a WORKFLOW.md
@@ -59,9 +59,9 @@ export { findBbDir, resolveConfigPath, } from '@bakers-build/core';
59
59
  * only against the most literal readers.
60
60
  */
61
61
  export const DEFAULT_AGENT_PROMPT = `You are working ticket {identifier}, current state: {state}. Read the ticket and all comments ` +
62
- `with the bakers tool bakers_ticket_read, arguments {"ticket":"{ticketUuid}"}: ` +
62
+ `with the bakers tool bakers_ticket_read, arguments {"ticket":"{ticket_uuid}"}: ` +
63
63
  `the MCP tool bakers_ticket_read when it is listed, ` +
64
- `else bakers tools bakers_ticket_read --data '{"ticket":"{ticketUuid}"}' as a Bash call of its own, ` +
64
+ `else bakers tools bakers_ticket_read --data '{"ticket":"{ticket_uuid}"}' as a Bash call of its own, ` +
65
65
  `then read ./WORKFLOW.md, load the bakers.build skill its loader names for this ticket's work type ` +
66
66
  `and state, and execute only that skill's {state} section. ` +
67
67
  `Do not start or prepare a later state. ` +
@@ -71,10 +71,7 @@ export const DEFAULT_AGENT_PROMPT = `You are working ticket {identifier}, curren
71
71
  /** A config file's top-level `permissions`, validated; the error names the file. */
72
72
  function sharedSecurityOf(config, layer, path) {
73
73
  try {
74
- if (config.security !== undefined)
75
- throw new Error('security was renamed: use permissions');
76
- const value = config.permissions;
77
- return validateSharedSecurity(value, layer);
74
+ return validateSharedSecurity(config.permissions, layer);
78
75
  }
79
76
  catch (error) {
80
77
  throw new Error(`${path}: ${error.message}`);
@@ -163,22 +160,20 @@ function requirePlugin(value, kind) {
163
160
  return value;
164
161
  }
165
162
  /**
166
- * A named-plugin descriptor `{ plugin, export?, with?/options? }` — the
167
- * import-free form. `config.ts` resolves it into a constructed plugin, so a
168
- * committed conductor.config.js need not `import` its plugin packages (which
163
+ * A slot descriptor `{ use, export?, with? }` — the import-free form. `config.ts` resolves it into a constructed plugin, so a
164
+ * committed project.config.js need not `import` its plugin packages (which
169
165
  * would resolve relative to the config file, not the CLI — the source of the
170
166
  * "unknown command dropsh" breakage after the @bakers → @bakers-ai scope rename).
171
167
  * Mirror of dropsh 0.4.1 `loadNamedPlugin` / `resolveSlot`.
172
168
  */
173
169
  function isPluginDescriptor(entry) {
174
- return isRecord(entry) && typeof entry.plugin === 'string';
170
+ return isRecord(entry) && typeof entry.use === 'string';
175
171
  }
176
172
  /**
177
173
  * Resolve + construct a descriptor. Resolution base order, ESLint-style:
178
174
  * config dir → cwd → conductor install (`import.meta.url`) — the first
179
175
  * `createRequire(base).resolve(name)` that succeeds wins. Then `import` the
180
- * module, pick `export` (default 'default'), and call the factory with
181
- * `with` (falling back to `options`).
176
+ * module, pick `export` (default 'default'), and call the factory with `with`.
182
177
  */
183
178
  async function loadNamedPlugin(entry, configPath) {
184
179
  const bases = [
@@ -186,16 +181,16 @@ async function loadNamedPlugin(entry, configPath) {
186
181
  pathToFileURL(`${process.cwd()}/`).href,
187
182
  import.meta.url,
188
183
  ];
189
- const resolved = resolveModuleEslintStyle(entry.plugin, bases);
184
+ const resolved = resolveModuleEslintStyle(entry.use, bases);
190
185
  if (resolved === undefined) {
191
- throw new Error(`conductor config cannot resolve plugin '${entry.plugin}'`);
186
+ throw new Error(`project config cannot resolve '${entry.use}'`);
192
187
  }
193
188
  const mod = (await import(pathToFileURL(resolved).href));
194
189
  let factory;
195
190
  if (typeof entry.export === 'string') {
196
191
  factory = mod[entry.export];
197
192
  if (typeof factory !== 'function') {
198
- throw new Error(`plugin '${entry.plugin}' has no callable export '${entry.export}'`);
193
+ throw new Error(`'${entry.use}' has no callable export '${entry.export}'`);
199
194
  }
200
195
  }
201
196
  else if (typeof mod.default === 'function') {
@@ -207,10 +202,10 @@ async function loadNamedPlugin(entry, configPath) {
207
202
  factory = mod[fns[0]];
208
203
  }
209
204
  else {
210
- throw new Error(`plugin '${entry.plugin}' has no default export and ${fns.length} function exports (${fns.join(', ')}); specify "export"`);
205
+ throw new Error(`'${entry.use}' has no default export and ${fns.length} function exports (${fns.join(', ')}); specify "export"`);
211
206
  }
212
207
  }
213
- return factory(entry.with ?? entry.options);
208
+ return factory(entry.with);
214
209
  }
215
210
  /**
216
211
  * Resolve a slot value: a descriptor is constructed via `loadNamedPlugin`, an
@@ -236,7 +231,7 @@ export async function resolveAgents(raw, configPath) {
236
231
  const hasWrapper = isRecord(entry) &&
237
232
  'agent' in entry &&
238
233
  !('kind' in entry) &&
239
- !('plugin' in entry);
234
+ !('use' in entry);
240
235
  const agentValue = hasWrapper ? entry.agent : entry;
241
236
  const priority = hasWrapper
242
237
  ? entry.priority
@@ -266,21 +261,6 @@ export async function resolveAgents(raw, configPath) {
266
261
  function isRecord(value) {
267
262
  return typeof value === 'object' && value !== null && !Array.isArray(value);
268
263
  }
269
- function requireNonEmptyString(value, key) {
270
- if (typeof value !== 'string' || value.trim() === '') {
271
- throw new Error(`conductor config requires non-empty ${key}`);
272
- }
273
- return value;
274
- }
275
- function optionalPositiveInteger(value, fallback, key) {
276
- if (value === undefined) {
277
- return fallback;
278
- }
279
- if (typeof value !== 'number' || !Number.isInteger(value) || value <= 0) {
280
- throw new Error(`conductor config requires positive integer ${key}`);
281
- }
282
- return value;
283
- }
284
264
  /**
285
265
  * A conductor is machine + project + variant: its registration key and label
286
266
  * are derived here and never written to a config.
@@ -303,8 +283,8 @@ function identityOf(machine, project, variant) {
303
283
  * Load the ENGINE half of a conductor config (BB-201 split model). Reads
304
284
  * remote/executor/agent/workspace + project/states/prompt/
305
285
  * scheduler/hooks — and deliberately NOT `site` or the auth `plugins`, which now
306
- * live in a `bakers.config.js` connection config. The conductor command composes
307
- * the two via `composeConductorConfig`. A legacy `conductor.config.js` still
286
+ * live in a connection file connection config. The conductor command composes
287
+ * the two via `composeConductorConfig`. A legacy `project.config.js` still
308
288
  * carrying `site`/`plugins` loads fine — those two keys are simply ignored here
309
289
  * (the connection loader reads them, back-compat).
310
290
  */
@@ -314,43 +294,17 @@ export async function loadConductorConfig(configFile) {
314
294
  const module = (await import(pathToFileURL(configPath).href));
315
295
  const raw = module.default;
316
296
  if (!isRecord(raw)) {
317
- throw new Error('conductor config default export must be an object');
297
+ throw new Error(`${configPath}: default export must be an object`);
318
298
  }
319
- // BB-218 (AC-6): the engine config must not carry connection/auth material.
320
- // A legacy config still declaring `site`/`plugins` gets exactly ONE actionable
321
- // warning naming the file + the offending key(s); the values are never merged
322
- // (`ConductorEngineConfig` omits both structurally).
323
- const leftover = ['site', 'plugins'].filter((k) => k in raw);
324
- if (leftover.length > 0) {
325
- console.warn(`warning: ${configPath} declares ${leftover.join('/')} — ignored; ` +
326
- 'auth/connection belong in the sibling bakers.config.js (BB-218)');
327
- }
328
- assertSchemaVersion1(configPath, raw);
329
- // A conductor is machine + project + variant: the project config names no id.
330
- const identity = ['conductor_id', 'machine_id', 'label'].filter((key) => key in raw);
331
- if (identity.length > 0)
332
- throw new Error(`${configPath}: ${identity.join(', ')} no longer belong in a project config (a conductor is machine + project + variant); remove them and run bakers init`);
299
+ assertSchemaVersion(configPath, raw);
300
+ // The same schema config check applies.
301
+ assertValidConfig('project', raw, configPath);
333
302
  const config = raw;
334
- const retiredAgentKeys = [
335
- 'agent',
336
- 'agents',
337
- 'default_agent',
338
- 'agent_routes',
339
- ].filter((key) => key in raw);
340
- if (retiredAgentKeys.length > 0) {
341
- throw new Error(`${configPath}: retired conductor agent policy ${retiredAgentKeys.join(', ')}; run bakers config upgrade --scope all`);
342
- }
343
303
  const project = bakers.project;
344
- // `states` is optional. An empty (or absent) list means the conductor serves
345
- // every claimable state in its project; a non-empty list narrows it to those
346
- // states (BB-207). When present it must be an array of non-empty strings.
347
- const states = Array.isArray(config.states)
348
- ? config.states.map((state) => requireNonEmptyString(state, 'states'))
349
- : [];
350
- warnIgnoredMaxParallel(configPath, config);
304
+ // An empty (or absent) states list serves every claimable state (BB-207).
305
+ const states = config.states ?? [];
351
306
  const restartOnChange = config.restart_on_change ?? true;
352
- if (typeof restartOnChange !== 'boolean')
353
- throw new Error(`${configPath}: restart_on_change must be a boolean`);
307
+ // The schema checks the shape; the Git URL rule is the marketplace loader's.
354
308
  const marketplaces = (() => {
355
309
  try {
356
310
  return validateMarketplaces(config.marketplaces);
@@ -360,9 +314,6 @@ export async function loadConductorConfig(configFile) {
360
314
  }
361
315
  })();
362
316
  const machineCtx = await readMachineContext();
363
- if ('marketplaces' in machineCtx)
364
- throw new Error(`${machineContextPath()}: marketplaces is declared per project, in its conductor.config.js; remove it from the machine config`);
365
- warnIgnoredMaxParallel(machineContextPath(), machineCtx);
366
317
  const tunnel = machineCtx.tunnel === true;
367
318
  const variant = stemForConfigFile(basename(configPath)) ?? 'conductor';
368
319
  // BB-215: discover the conductor `addons: []` surface (last-wins singletons,
@@ -376,14 +327,9 @@ export async function loadConductorConfig(configFile) {
376
327
  // The machine and this project config each carry one `addons[]`, read the
377
328
  // same way: each addon declares the scopes it may be listed in, and the
378
329
  // machine entry wins (`scopeAddons`). Agents come from this list too.
330
+ // readMachineContext checked the machine file against machine.schema.json.
379
331
  const policy = machineCtx.agents;
380
- if (policy !== undefined && !isRecord(policy))
381
- throw new Error('machine agents must be an object');
382
- if (policy?.addons !== undefined)
383
- throw new Error('machine agents.addons is retired: move its entries into machine.config.js addons[]');
384
332
  const machineAddons = machineCtx.addons ?? [];
385
- if (!Array.isArray(machineAddons))
386
- throw new Error('machine addons must be an array');
387
333
  const addonEntries = Array.isArray(config.addons)
388
334
  ? config.addons
389
335
  : [];
@@ -429,11 +375,11 @@ export async function loadConductorConfig(configFile) {
429
375
  ];
430
376
  const tools = toolSets.length > 0 ? await loadTools(toolSets) : undefined;
431
377
  const inboxAddons = await loadInboxAddons(discovered.addonInbox, new Set(tools?.list().map((t) => t.name)));
432
- const remote = config.remote !== undefined
433
- ? await resolveSlot(config.remote, 'remote', configPath)
378
+ const remote = config.server !== undefined
379
+ ? await resolveSlot(config.server, 'server', configPath)
434
380
  : wired.remote;
435
381
  if (!remote) {
436
- throw new Error('conductor config resolves no remote — name a remote addon in addons[] or set the remote slot');
382
+ throw new Error('project config resolves no server — name a server addon in addons[] or set the server slot');
437
383
  }
438
384
  // The machine may run its own installed tool: its explicit executor wins
439
385
  // over the project's, which wins over the one discovered from addons[].
@@ -443,20 +389,20 @@ export async function loadConductorConfig(configFile) {
443
389
  ? await resolveSlot(config.executor, 'executor', configPath)
444
390
  : wired.executor;
445
391
  if (!executor) {
446
- throw new Error('conductor config resolves no executor — name an executor addon in addons[] or set the executor slot');
392
+ throw new Error('project config resolves no executor — name an executor addon in addons[] or set the executor slot');
447
393
  }
448
- const workspace = config.workspace !== undefined
449
- ? await resolveSlot(config.workspace, 'workspace', configPath)
394
+ const workspace = config.worktree !== undefined
395
+ ? await resolveSlot(config.worktree, 'worktree', configPath)
450
396
  : wired.workspace;
451
397
  if (!workspace) {
452
- throw new Error('conductor config resolves no workspace — name a workspace addon in addons[] or set the workspace slot');
398
+ throw new Error('project config resolves no worktree — name a worktree addon in addons[] or set the worktree slot');
453
399
  }
454
400
  const installedHarnesses = new Set(machineAddons.flatMap((entry) => {
455
401
  if (typeof entry === 'string')
456
402
  return [entry];
457
403
  if (!isRecord(entry))
458
404
  return [];
459
- const packageName = entry.use ?? entry.name;
405
+ const packageName = entry.use;
460
406
  return typeof packageName === 'string' ? [packageName] : [];
461
407
  }));
462
408
  const dedupeCandidates = (candidates) => {
@@ -534,15 +480,6 @@ export async function loadConductorConfig(configFile) {
534
480
  const enabledAgents = [
535
481
  ...new Set(candidates.map((candidate) => candidate.alias)),
536
482
  ];
537
- const configuredDefault = policy?.default_agent;
538
- if (configuredDefault !== undefined &&
539
- (typeof configuredDefault !== 'string' || !configuredDefault.trim()))
540
- throw new Error('agents.default_agent must be a non-empty alias');
541
- const defaultAgent = typeof configuredDefault === 'string'
542
- ? configuredDefault.trim()
543
- : enabledAgents[0];
544
- if (!enabledAgents.includes(defaultAgent))
545
- throw new Error(`agents.default_agent names unavailable alias '${defaultAgent}'`);
546
483
  const rawRoutes = policy?.routes;
547
484
  if (rawRoutes !== undefined && !isRecord(rawRoutes))
548
485
  throw new Error('agents.routes must be an object of named routes');
@@ -556,12 +493,12 @@ export async function loadConductorConfig(configFile) {
556
493
  throw new Error(`agents.routes.${name || '<empty>'} must map states (or *) to non-empty aliases`);
557
494
  routes[name] = { ...route };
558
495
  }
496
+ // The default agent is set in one place: agents.routes.default.
497
+ const defaultAgent = routes.default?.['*']?.trim() ?? enabledAgents[0];
498
+ if (!enabledAgents.includes(defaultAgent))
499
+ throw new Error(`agents.routes.default names unavailable alias '${defaultAgent}'`);
559
500
  if (!routes.default)
560
501
  routes.default = { '*': defaultAgent };
561
- if (config.selectAgent !== undefined &&
562
- typeof config.selectAgent !== 'function') {
563
- throw new Error('selectAgent must be a function');
564
- }
565
502
  return {
566
503
  remote,
567
504
  executor,
@@ -570,9 +507,9 @@ export async function loadConductorConfig(configFile) {
570
507
  disabled_agents: disabled,
571
508
  default_agent: defaultAgent,
572
509
  routes,
573
- ...(typeof config.selectAgent === 'function'
510
+ ...(typeof config.select_agent === 'function'
574
511
  ? {
575
- selectAgent: config.selectAgent,
512
+ selectAgent: config.select_agent,
576
513
  }
577
514
  : {}),
578
515
  workspace,
@@ -590,18 +527,16 @@ export async function loadConductorConfig(configFile) {
590
527
  ? config.prompt
591
528
  : DEFAULT_AGENT_PROMPT,
592
529
  tunnel,
593
- poll_interval_ms: optionalPositiveInteger(config.poll_interval_ms, 5000, 'poll_interval_ms'),
594
- lease_seconds: optionalPositiveInteger(config.lease_seconds, 300, 'lease_seconds'),
530
+ poll_interval_ms: config.poll_interval_ms ?? 5000,
531
+ lease_seconds: config.lease_seconds ?? 300,
532
+ ...(config.capture_logs !== undefined
533
+ ? { capture_logs: config.capture_logs }
534
+ : {}),
595
535
  ...(config.hooks !== undefined ? { hooks: config.hooks } : {}),
596
536
  config_path: configPath,
597
537
  restart_on_change: restartOnChange,
598
538
  watch_paths: {
599
- files: [
600
- configPath,
601
- configPath.replace(/\.js$/, '.local.js'),
602
- join(dirname(configPath), 'connection.config.local.js'),
603
- machineContextPath(),
604
- ],
539
+ files: [configPath, machineContextPath()],
605
540
  // A retired entry keeps its spec as key; only resolved modules have a dir.
606
541
  dirs: [
607
542
  ...new Set(effectiveAddons
@@ -616,7 +551,7 @@ export async function loadConductorConfig(configFile) {
616
551
  * half (`loadConductorConfig`) and the connection half (`loadBbConfig`). The
617
552
  * connection supplies `site` + the auth `plugins`; `ensureAuthenticated` /
618
553
  * `selectRemote` read them exactly as before — the fields just arrive from
619
- * `bakers.config.js` now.
554
+ * connection file now.
620
555
  */
621
556
  export function composeConductorConfig(engine, connection) {
622
557
  return {
@@ -625,36 +560,23 @@ export function composeConductorConfig(engine, connection) {
625
560
  ...(connection.plugins.length > 0 ? { plugins: connection.plugins } : {}),
626
561
  };
627
562
  }
628
- const DEFAULT_CONFIG = 'conductor.config.js';
629
- const VARIANT_SUFFIX = '.conductor.config.js';
630
563
  /**
631
- * The conductor **stems** in a `.bakers/` dir — the file naming predicate of
632
- * BB-137: exactly `conductor.config.js` (stem `conductor`) or
633
- * `<variant>.conductor.config.js` (stem `<variant>`). The resolution itself
634
- * lives in `@bakers-build/core` (re-exported above); this is the enumeration.
564
+ * The conductor variants in a `.bakers/` dir (`conductor` for
565
+ * `project.config.js`), by the loader's own naming rule.
635
566
  */
636
567
  export function configStems(bakersDir) {
637
568
  return readdirSync(bakersDir)
638
- .map((f) => f === DEFAULT_CONFIG
639
- ? 'conductor'
640
- : f.endsWith(VARIANT_SUFFIX)
641
- ? f.slice(0, -VARIANT_SUFFIX.length)
642
- : undefined)
569
+ .map(stemForConfigFile)
643
570
  .filter((s) => s !== undefined)
644
571
  .sort();
645
572
  }
646
- /** Map a conductor stem back to its file name. */
573
+ /** Map a conductor variant back to its file name. */
647
574
  export function fileForStem(stem) {
648
- return stem === 'conductor' ? DEFAULT_CONFIG : `${stem}${VARIANT_SUFFIX}`;
575
+ return stem === 'conductor'
576
+ ? 'project.config.js'
577
+ : `project.${stem}.config.js`;
649
578
  }
650
- /**
651
- * List the conductor-config **file names** in a `.bakers/` dir, using the same
652
- * naming predicate the loader uses (`configStems`). This is the only supported
653
- * enumeration for the `@bakers-build/bb-upgrade-project` states-strip: it visits the
654
- * default `conductor.config.js` + every `<variant>.conductor.config.js`, and
655
- * never an unrelated JS config (`vite.config.js`, the near-miss
656
- * `myconductor.config.js`).
657
- */
579
+ /** The project config file names in a `.bakers/` dir, default and variants. */
658
580
  export function listConductorConfigFiles(bakersDir) {
659
581
  return configStems(bakersDir).map(fileForStem);
660
582
  }