@bakers-build/conductor 0.10.0 → 0.10.1-next.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.
@@ -69,6 +69,10 @@ export interface BbCliDeps {
69
69
  checkConfig?: () => Promise<string | undefined>;
70
70
  /** Replaces this process (`process.execve`). A test MUST inject a fake. */
71
71
  execve?: Execve;
72
+ /** Reads the installed CLI version from disk, uncached. */
73
+ readCliVersion?: () => string;
74
+ /** Migrates the config with the installed CLI; resolves an error message, or undefined. */
75
+ migrateConfig?: () => Promise<string | undefined>;
72
76
  }
73
77
  type Execve = (file: string, args: string[], env: NodeJS.ProcessEnv) => void;
74
78
  /**
@@ -2,7 +2,7 @@ import { execFile, spawnSync } from 'node:child_process';
2
2
  import { basename, dirname, join, resolve } from 'node:path';
3
3
  import { createInterface } from 'node:readline';
4
4
  import { promisify } from 'node:util';
5
- import { CommandRunner, checkForUpdate, configHomeOf, createBbConnectionClient, createLogger, declineUpdate, defaultProcProbe, deriveCheckoutRoot, deriveConductorLiveness, homeBbDir, loadReadyBbConnection, printVersionLine, readMachineContext, resolveConfigPath, setDefaultCommandRunner, signalVerifiedProcess, stemForConfigFile, updateNotice, verifyConductorProcess, } from '@bakers-build/core';
5
+ import { CommandRunner, checkForUpdate, configHomeOf, createBbConnectionClient, createLogger, declineUpdate, defaultProcProbe, deriveCheckoutRoot, deriveConductorLiveness, homeBbDir, loadReadyBbConnection, printVersionLine, readCliVersion, readMachineContext, resolveCliVersion, resolveConfigPath, setDefaultCommandRunner, signalVerifiedProcess, stemForConfigFile, UNKNOWN_VERSION, updateNotice, verifyConductorProcess, } from '@bakers-build/core';
6
6
  import { Command } from 'commander';
7
7
  import { authStatus } from 'dropsh';
8
8
  import { resolveBbProjectContext } from '../bakers-project-context.js';
@@ -13,29 +13,49 @@ import { selectAgents, selectExecutor, selectRemote, selectWorkspace, } from '..
13
13
  import { runtimeSandboxWarning, sandboxFailures, } from '../plugins/sandbox-preflight.js';
14
14
  import { spawnDetachedConductor, } from '../process/detached-spawn.js';
15
15
  import { ovenTools } from './oven-tools.js';
16
+ /**
17
+ * `config upgrade --scope all --yes` with the installed CLI in a child: the
18
+ * new files migrate the config, never the modules this process still holds.
19
+ */
20
+ async function defaultMigrateConfig() {
21
+ return runChild([
22
+ ...process.execArgv,
23
+ process.argv[1],
24
+ 'config',
25
+ 'upgrade',
26
+ '--scope',
27
+ 'all',
28
+ '--yes',
29
+ ]);
30
+ }
16
31
  /**
17
32
  * `oven start --dry-run` in a child with this process's own runtime and argv:
18
33
  * the changed files are imported fresh there, never into this process.
19
34
  */
20
35
  async function defaultCheckConfig() {
21
- const args = [
36
+ return runChild([
22
37
  ...process.execArgv,
23
38
  ...process.argv
24
39
  .slice(1)
25
40
  .map((a) => (a === '--foreground' ? '--dry-run' : a)),
26
- ];
41
+ ]);
42
+ }
43
+ /** Runs node with `args`; resolves the error output, or undefined on success. */
44
+ async function runChild(args) {
27
45
  try {
28
46
  await promisify(execFile)(process.execPath, args, {
29
47
  cwd: process.cwd(),
30
48
  env: process.env,
31
- // A hung check would block every later restart; a timeout fails it.
49
+ // A hung child would block every later restart; a timeout fails it.
32
50
  timeout: 60_000,
33
51
  });
34
52
  return undefined;
35
53
  }
36
54
  catch (err) {
37
- const { stderr, message } = err;
38
- return stderr?.trim().split('\n').slice(-20).join('\n') || message;
55
+ const { stderr, stdout, message } = err;
56
+ // `config upgrade` reports a blocked migration on stdout, not stderr.
57
+ const output = stderr?.trim() || stdout?.trim();
58
+ return output?.split('\n').slice(-20).join('\n') || message;
39
59
  }
40
60
  }
41
61
  /**
@@ -389,12 +409,18 @@ async function cmdStartForeground(deps, log = {}, force = false, choice = {}) {
389
409
  process.once('SIGTERM', onSignal);
390
410
  const execve = deps.execve ?? process.execve?.bind(process);
391
411
  let watcher;
412
+ const check = deps.checkConfig ?? defaultCheckConfig;
413
+ const restartNow = () => {
414
+ restart = true;
415
+ watcher?.close();
416
+ clearInterval(versionTimer);
417
+ controller.abort();
418
+ };
392
419
  if (config.restart_on_change !== false && config.watch_paths) {
393
420
  if (!execve) {
394
421
  logger.warn({ node: process.version }, 'restart_on_change needs process.execve (Node >= 22.15); the conductor does not restart itself on config changes');
395
422
  }
396
423
  else {
397
- const check = deps.checkConfig ?? defaultCheckConfig;
398
424
  watcher = (deps.watchForRestart ?? watchForRestart)(config.watch_paths, async (path) => {
399
425
  if (controller.signal.aborted)
400
426
  return;
@@ -408,17 +434,70 @@ async function cmdStartForeground(deps, log = {}, force = false, choice = {}) {
408
434
  return;
409
435
  }
410
436
  logger.info({ path }, 'config check passed; restarting conductor');
411
- restart = true;
412
- watcher?.close();
413
- controller.abort();
437
+ restartNow();
414
438
  });
415
439
  }
416
440
  }
441
+ // An upgrade replaces the installed files under this running process: once
442
+ // two polls read the same new version, migrate, check and come back on it.
443
+ const startVersion = resolveCliVersion();
444
+ const readVersion = deps.readCliVersion ?? readCliVersion;
445
+ const migrate = deps.migrateConfig ?? defaultMigrateConfig;
446
+ const prefix = process.env.BAKERS_CONDUCTOR
447
+ ? `bakers --conductor ${process.env.BAKERS_CONDUCTOR}`
448
+ : 'bakers';
449
+ let lastRead;
450
+ let settled; // the new version already handled or refused
451
+ let busy = false;
452
+ const versionTimer = setInterval(async () => {
453
+ if (busy || controller.signal.aborted)
454
+ return;
455
+ const read = readVersion();
456
+ const previous = lastRead;
457
+ lastRead = read;
458
+ if (read === UNKNOWN_VERSION || read === startVersion)
459
+ return;
460
+ // A half-written install reads differently on the next poll.
461
+ if (read !== previous || read === settled)
462
+ return;
463
+ settled = read;
464
+ const changed = `CLI version changed ${startVersion} → ${read}`;
465
+ if (config.restart_on_change === false) {
466
+ logger.warn({ from: startVersion, to: read }, `${changed}; restart_on_change is off, restart with \`${prefix} oven start --force\``);
467
+ return;
468
+ }
469
+ if (!execve) {
470
+ logger.error({ from: startVersion, to: read, node: process.version }, `${changed}; restarting needs process.execve (Node >= 22.15), restart with \`${prefix} oven start --force\``);
471
+ return;
472
+ }
473
+ logger.info({ from: startVersion, to: read }, `${changed}; upgrading config`);
474
+ busy = true;
475
+ try {
476
+ for (const [step, run] of [
477
+ ['config upgrade', migrate],
478
+ ['config check', check],
479
+ ]) {
480
+ const error = await run();
481
+ if (controller.signal.aborted)
482
+ return;
483
+ if (error !== undefined) {
484
+ logger.error({ from: startVersion, to: read, step, err: error }, `${step} failed; keeping the running conductor on ${startVersion}: ${error}. Recover with \`${prefix} config upgrade --scope all --yes\`, then \`${prefix} oven start --force\``);
485
+ return;
486
+ }
487
+ }
488
+ }
489
+ finally {
490
+ busy = false;
491
+ }
492
+ logger.info({ to: read }, 'config check passed; restarting conductor');
493
+ restartNow();
494
+ }, config.poll_interval_ms);
417
495
  try {
418
496
  await conductor.serve(controller.signal);
419
497
  }
420
498
  finally {
421
499
  watcher?.close();
500
+ clearInterval(versionTimer);
422
501
  await conductor.stopTools();
423
502
  process.removeListener('SIGINT', onSignal);
424
503
  process.removeListener('SIGTERM', onSignal);
@@ -554,7 +633,7 @@ async function cmdStart(deps, log = {}, updateCheck = true, body = cmdStartBody,
554
633
  const interactive = !foreground && isInteractive(deps);
555
634
  if (notice && interactive && result.declined !== true) {
556
635
  console.log('Installing accepts the newer release and runs configuration migration.');
557
- console.log('After a successful install this start exits; rerun the start command to use the new release.');
636
+ console.log('After a successful install this start continues on the new release.');
558
637
  const question = `A new bakers version is available (${current} → ${result.latestVersion}). Install it now? [Y/n]`;
559
638
  const ask = deps.askUpdate ?? defaultAskUpdate;
560
639
  let accepted;
@@ -594,7 +673,6 @@ async function cmdStart(deps, log = {}, updateCheck = true, body = cmdStartBody,
594
673
  const prefix = env.BAKERS_CONDUCTOR
595
674
  ? `bakers --conductor ${env.BAKERS_CONDUCTOR}`
596
675
  : 'bakers';
597
- const rerun = `${prefix} conductor start${force ? ' --force' : ''}`;
598
676
  if (accepted) {
599
677
  try {
600
678
  await runBb(['update']);
@@ -611,13 +689,26 @@ async function cmdStart(deps, log = {}, updateCheck = true, body = cmdStartBody,
611
689
  catch (err) {
612
690
  console.error(`bakers config upgrade failed: ${String(err)}`);
613
691
  console.error(`Retry with: ${prefix} config upgrade --scope all --yes`);
614
- console.error(`Then rerun \`${rerun}\`.`);
692
+ console.error(`Then run \`${prefix} conductor start${force ? ' --force' : ''}\`.`);
615
693
  process.exitCode = 1;
616
694
  return;
617
695
  }
618
696
  console.log('bakers update and configuration migration completed.');
619
- console.log(`This process still has the previous modules loaded; rerun \`${rerun}\` in a new process.`);
620
- console.log('A source checkout or PATH shim may still run the source tree after a global install; use the bakers executable you expect after bakers update.');
697
+ // This process still holds the previous modules: continue as a fresh
698
+ // process of the same command on the new release, without asking again.
699
+ const again = [...process.argv.slice(1), '--no-update-check'];
700
+ const execve = deps.execve ?? process.execve?.bind(process);
701
+ if (execve) {
702
+ execve(process.execPath, [process.execPath, ...process.execArgv, ...again], env);
703
+ return;
704
+ }
705
+ try {
706
+ await runBb(again.slice(1));
707
+ }
708
+ catch (err) {
709
+ console.error(String(err));
710
+ process.exitCode = 1;
711
+ }
621
712
  return;
622
713
  }
623
714
  if (!(await declineUpdate(result, options))) {
@@ -15,16 +15,9 @@ export { findBbDir, resolveConfigPath, } from '@bakers-build/core';
15
15
  * ticket content into a single typed pane line overran the PTY canonical line
16
16
  * cap and truncated the dispatch command. Instead the prompt is a bounded,
17
17
  * constant-size pointer and the agent reads the ticket at run start. That read
18
- * returns the newest comments and facets over all of them; a state fetches the
19
- * older comments it needs through `bakers_comment_read` (bb-workflow's
20
- * read-ticket.md).
21
- *
22
- * That read goes through the bakers tool `bakers_ticket_read`, the same path
23
- * every skill step uses, so the run does not read its ticket twice in two
24
- * formats. The prompt names both transports because the agent has not loaded
25
- * a skill yet: the MCP tool, else `bakers tools`, which itself goes to the
26
- * run's conductor (run token, no site credential) inside a run and to the site
27
- * outside one; why a CLI call must run alone lives in bb-workflow's tools.md.
18
+ * goes through `bakers_ticket_read`, the same path every skill step uses. The
19
+ * prompt names no tool or arguments: the loaded skill (bb-workflow's
20
+ * read-ticket.md) owns which comment types the state's first read loads.
28
21
  *
29
22
  * herdr no longer types this into the pane: the launch command goes to a file
30
23
  * that a short `sh '<file>'` line runs (BB-635), so its length is not bound
@@ -95,7 +88,7 @@ export declare function listConductorConfigFiles(bakersDir: string): string[];
95
88
  /**
96
89
  * Remove the obsolete `states:` array property from a conductor-config JS
97
90
  * source (BB-207 made `states` optional — empty ⇒ serve all claimable
98
- * states — so `@bakers-build/bb-upgrade-project` drops the now-dead key). Pure string
91
+ * states — so `@bakers-build/bb-init-project` drops the now-dead key). Pure string
99
92
  * transform: it strips the `states: [ ... ]` property (line form or inline in
100
93
  * an object literal) with its trailing comma, and rewrites nothing else. A
101
94
  * `substates:`/other key containing "states" is not matched.
@@ -27,16 +27,9 @@ export { findBbDir, resolveConfigPath, } from '@bakers-build/core';
27
27
  * ticket content into a single typed pane line overran the PTY canonical line
28
28
  * cap and truncated the dispatch command. Instead the prompt is a bounded,
29
29
  * constant-size pointer and the agent reads the ticket at run start. That read
30
- * returns the newest comments and facets over all of them; a state fetches the
31
- * older comments it needs through `bakers_comment_read` (bb-workflow's
32
- * read-ticket.md).
33
- *
34
- * That read goes through the bakers tool `bakers_ticket_read`, the same path
35
- * every skill step uses, so the run does not read its ticket twice in two
36
- * formats. The prompt names both transports because the agent has not loaded
37
- * a skill yet: the MCP tool, else `bakers tools`, which itself goes to the
38
- * run's conductor (run token, no site credential) inside a run and to the site
39
- * outside one; why a CLI call must run alone lives in bb-workflow's tools.md.
30
+ * goes through `bakers_ticket_read`, the same path every skill step uses. The
31
+ * prompt names no tool or arguments: the loaded skill (bb-workflow's
32
+ * read-ticket.md) owns which comment types the state's first read loads.
40
33
  *
41
34
  * herdr no longer types this into the pane: the launch command goes to a file
42
35
  * that a short `sh '<file>'` line runs (BB-635), so its length is not bound
@@ -68,7 +61,7 @@ export { findBbDir, resolveConfigPath, } from '@bakers-build/core';
68
61
  export const DEFAULT_AGENT_PROMPT = `You are working ticket {identifier}, current state: {state}. Read ./WORKFLOW.md first and ` +
69
62
  `load the bakers.build entry skill named there. ` +
70
63
  `Do not call ticket or service tools before reading both files. ` +
71
- `Read the ticket with the bakers tool bakers_ticket_read, arguments {"ticket":"{ticket_uuid}"}. ` +
64
+ `Read ticket {ticket_uuid} as the loaded skill says. ` +
72
65
  `Follow the loaded skill for tool discovery, transport and fallback, ` +
73
66
  `and execute only that skill's {state} section. ` +
74
67
  `Do not start or prepare a later state. ` +
@@ -671,7 +664,7 @@ export function listConductorConfigFiles(bakersDir) {
671
664
  /**
672
665
  * Remove the obsolete `states:` array property from a conductor-config JS
673
666
  * source (BB-207 made `states` optional — empty ⇒ serve all claimable
674
- * states — so `@bakers-build/bb-upgrade-project` drops the now-dead key). Pure string
667
+ * states — so `@bakers-build/bb-init-project` drops the now-dead key). Pure string
675
668
  * transform: it strips the `states: [ ... ]` property (line form or inline in
676
669
  * an object literal) with its trailing comma, and rewrites nothing else. A
677
670
  * `substates:`/other key containing "states" is not matched.
@@ -312,6 +312,7 @@ export class Conductor {
312
312
  ...(siteTools ? { siteTools } : {}),
313
313
  ...(hosts.length > 0 ? { hosts } : {}),
314
314
  onSiteWrite: (b) => this.signalUi(b.worktreePath),
315
+ readTicket: (uuid) => this.remote.getTicket(uuid),
315
316
  });
316
317
  this.logger.info({ conductorId: this.config.conductor_id, url: this.toolServer.url }, 'tool server started');
317
318
  }
@@ -1167,6 +1168,10 @@ export class Conductor {
1167
1168
  const core = {
1168
1169
  BAKERS_URL: this.config.site.base_url,
1169
1170
  BAKERS_ID: t.uuid,
1171
+ // The agent finds its own conductor in bakers_user_read by this id.
1172
+ ...(this.config.conductor_id
1173
+ ? { BAKERS_CONDUCTOR_ID: this.config.conductor_id }
1174
+ : {}),
1170
1175
  // BB-569: lets a launch wrapper key off the ticket and the run's
1171
1176
  // start state without parsing the prompt (addon-claude `measure`).
1172
1177
  ...(t.identifier ? { BAKERS_TICKET_IDENTIFIER: t.identifier } : {}),
@@ -1494,6 +1499,10 @@ export class Conductor {
1494
1499
  : {}),
1495
1500
  ...(chosen.agent.modelApi ? { modelApi: chosen.agent.modelApi } : {}),
1496
1501
  };
1502
+ const isolates = this.config.runtime?.isolates === true;
1503
+ // Without it the run starts in an empty private home and cannot sign in.
1504
+ if (isolates && !chosen.agent.prepareRun)
1505
+ throw new Error(`agent ${chosen.alias ?? chosen.id}: the runtime isolates runs, but the agent has no prepareRun to prepare its login and configuration`);
1497
1506
  const runtimeContext = await runtime.prepareRun?.({
1498
1507
  uuid: run.runUuid,
1499
1508
  id: run.runId,
@@ -1509,7 +1518,6 @@ export class Conductor {
1509
1518
  : undefined;
1510
1519
  if (preparation)
1511
1520
  Object.assign(env, preparation.env);
1512
- const isolates = this.config.runtime?.isolates === true;
1513
1521
  // An isolated run without its own clone would share the parent's Git data.
1514
1522
  if (isolates && !ws.clone)
1515
1523
  throw new Error('the runtime isolates runs, but the workspace provides no run clone');
@@ -18,6 +18,7 @@ export const SITE_TOOLS = [
18
18
  'bakers_label_list',
19
19
  'bakers_project_read',
20
20
  'bakers_user_read',
21
+ 'bakers_conductor_list',
21
22
  ];
22
23
  /** The site tools that change a ticket; a successful call signals `bakers ui`. */
23
24
  export const SITE_WRITE_TOOLS = [
@@ -1,6 +1,6 @@
1
1
  import type { ConductorLogger } from '@bakers-build/core';
2
2
  import type { SiteToolClient } from '../plugins/remote.js';
3
- import type { ToolBinding, ToolRegistry } from '../plugins/tools.js';
3
+ import type { RunTicket, ToolBinding, ToolRegistry } from '../plugins/tools.js';
4
4
  export interface ToolServer {
5
5
  /** The MCP endpoint. */
6
6
  url: string;
@@ -31,5 +31,7 @@ export interface ToolServerOptions {
31
31
  openRuns?: string[];
32
32
  /** Further addresses to listen on, on the same port (a runtime's container network). */
33
33
  hosts?: string[];
34
+ /** Reads a ticket from the server; run calls get it as `currentTicket`. */
35
+ readTicket?: (uuid: string) => Promise<RunTicket>;
34
36
  }
35
37
  export declare function startToolServer(options: ToolServerOptions): Promise<ToolServer>;
@@ -108,7 +108,13 @@ export async function startToolServer(options) {
108
108
  }
109
109
  return result;
110
110
  }
111
- const result = await registry.call(request.params.name, request.params.arguments, binding, { signal: extra.signal, ...(logger ? { logger } : {}) });
111
+ const uuid = binding.ticket?.uuid;
112
+ const { readTicket } = options;
113
+ const result = await registry.call(request.params.name, request.params.arguments,
114
+ // Added per call, so the persisted grant never holds it.
115
+ readTicket && uuid
116
+ ? { ...binding, currentTicket: () => readTicket(uuid) }
117
+ : binding, { signal: extra.signal, ...(logger ? { logger } : {}) });
112
118
  return { content: [{ type: 'text', text: result.text }] };
113
119
  }
114
120
  catch (err) {
@@ -22,7 +22,7 @@ export function assertProtectedEntryPoints(hooks, protectedPaths) {
22
22
  ? [[`hooks.${name}`, value]]
23
23
  : Object.entries(value ?? {}).map(([key, command]) => [
24
24
  `hooks.${name}.${key}`,
25
- command,
25
+ typeof command === 'string' ? command : command.command,
26
26
  ]);
27
27
  for (const [label, command] of commands) {
28
28
  const entry = hostCommandEntry(command);
@@ -49,6 +49,8 @@ export interface RuntimePlugin {
49
49
  readonly id: string;
50
50
  /** True when runs are isolated from the host; agent permissions remain unchanged. */
51
51
  readonly isolates: boolean;
52
+ /** Run clones borrow the parent's objects (`git clone --shared`); undefined = the workspace decides. */
53
+ readonly shared?: boolean;
52
54
  readonly requiredModules: string[];
53
55
  createRuntime(config: ConductorFileConfig, deps: {
54
56
  logger: ConductorLogger;
@@ -1,6 +1,6 @@
1
1
  import type { ConductorLogger } from '@bakers-build/core';
2
2
  import { type MessageInput } from '@bakers-build/message';
3
- import type { ConductorEngineConfig } from '../types.js';
3
+ import type { ConductorEngineConfig, ProvisionExecCommand } from '../types.js';
4
4
  import type { Ticket } from './remote.js';
5
5
  export type AgentCatalog = Pick<ConductorEngineConfig, 'agents' | 'enabled_agents' | 'disabled_agents' | 'default_agent' | 'routes'>;
6
6
  export interface ToolHost {
@@ -24,13 +24,17 @@ export interface ToolDefinition {
24
24
  export interface ToolResult {
25
25
  text: string;
26
26
  }
27
+ /** A ticket as a run knows it; an operator call may know only its identifier. */
28
+ export type RunTicket = Partial<Ticket> & {
29
+ identifier: string;
30
+ };
27
31
  /** The worktree a call acts on — fixed by the session, never by the tool. */
28
32
  export interface ToolBinding {
29
33
  worktreePath: string;
30
- /** The run's ticket; an operator call may know only its identifier. */
31
- ticket?: Partial<Ticket> & {
32
- identifier: string;
33
- };
34
+ /** The run's ticket. */
35
+ ticket?: RunTicket;
36
+ /** Reads the run's ticket from the server at call time; never persisted. */
37
+ currentTicket?: () => Promise<RunTicket>;
34
38
  }
35
39
  export interface ToolRequest extends ToolBinding {
36
40
  args: Record<string, unknown>;
@@ -87,7 +91,7 @@ export interface ProvisionRuns {
87
91
  export declare function provisionRuns(timeoutMs?: number): ProvisionRuns;
88
92
  export interface ProvisionOptions {
89
93
  /** `hooks.provision_exec`: commands by key. */
90
- exec?: Record<string, string>;
94
+ exec?: Record<string, ProvisionExecCommand>;
91
95
  /** Whether the runtime isolates runs; exported to every host command. */
92
96
  isolates?: boolean;
93
97
  }
@@ -86,8 +86,9 @@ export function provisionTools(hook, runs = provisionRuns(), options = {}) {
86
86
  handlers.provision_up = async (req) => report(await runs.run(req.worktreePath, commandFor(req.args.profile), envFor(req.worktreePath)));
87
87
  }
88
88
  if (Object.keys(exec).length > 0) {
89
+ const withArgs = Object.keys(exec).filter((key) => typeof exec[key] === 'object' && exec[key].args === true);
89
90
  tools.provision_exec = {
90
- description: `Run one of the project's configured commands (${Object.keys(exec).join(', ')}) for this worktree, such as a command in its site container. \`args\` reach the command as separate arguments after \`--\`, never through a shell. Returns the exit code and the output tail.`,
91
+ description: `Run one of the project's configured commands (${Object.keys(exec).join(', ')}) for this worktree, such as a command in its site container. Each key is a fixed command; only ${withArgs.length ? withArgs.join(', ') : 'none'} also take \`args\`, passed as separate arguments after \`--\`, never through a shell. Returns the exit code and the output tail.`,
91
92
  input: {
92
93
  type: 'object',
93
94
  required: ['key'],
@@ -97,7 +98,19 @@ export function provisionTools(hook, runs = provisionRuns(), options = {}) {
97
98
  },
98
99
  },
99
100
  };
100
- handlers.provision_exec = async (req) => report(await shell(`${exec[String(req.args.key)]} -- "$@"`, req.worktreePath, req.signal, PROVISION_TIMEOUT_MS, envFor(req.worktreePath), req.args.args ?? []));
101
+ handlers.provision_exec = async (req) => {
102
+ const key = String(req.args.key);
103
+ const entry = exec[key];
104
+ const args = req.args.args ?? [];
105
+ // A plain key is the whole command: the run cannot widen it.
106
+ if (typeof entry === 'string' || entry.args !== true) {
107
+ if (args.length > 0)
108
+ throw new Error(`provision_exec: ${key} takes no arguments`);
109
+ const command = typeof entry === 'string' ? entry : entry.command;
110
+ return report(await shell(command, req.worktreePath, req.signal, PROVISION_TIMEOUT_MS, envFor(req.worktreePath), []));
111
+ }
112
+ return report(await shell(`${entry.command} -- "$@"`, req.worktreePath, req.signal, PROVISION_TIMEOUT_MS, envFor(req.worktreePath), args));
113
+ };
101
114
  }
102
115
  return [
103
116
  {
@@ -71,7 +71,7 @@ export interface ConductorSettings {
71
71
  /** Never runs on its own: offered to runs as the `provision_up(profile?)` tool. */
72
72
  provision_up?: ProvisionHook;
73
73
  /** Never runs on its own: offered to runs as the `provision_exec(key, args?)` tool. */
74
- provision_exec?: Record<string, string>;
74
+ provision_exec?: Record<string, ProvisionExecCommand>;
75
75
  };
76
76
  /** Control-plane site settings used for dropsh and agent env. */
77
77
  site: {
@@ -153,3 +153,8 @@ export type ConductorEngineConfig = Omit<ConductorFileConfig, 'site' | 'plugins'
153
153
  /** Absent when the project names no server; the connection or the default fills it. */
154
154
  remote?: RemotePlugin;
155
155
  };
156
+ /** A fixed command, or one that also receives the run's arguments as argv. */
157
+ export type ProvisionExecCommand = string | {
158
+ command: string;
159
+ args?: boolean;
160
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bakers-build/conductor",
3
- "version": "0.10.0",
3
+ "version": "0.10.1-next.10",
4
4
  "description": "bakers.build conductor engine + CLI: registers, claims tickets via JSON:API, dispatches agents.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -32,14 +32,14 @@
32
32
  "dependencies": {
33
33
  "@dropsh/plugin-jsonapi-schema": "^0.8.2",
34
34
  "@dropsh/plugin-oauth2": "^0.8.2",
35
- "@bakers-build/core": "^0.10.0",
36
- "@bakers-build/message": "^0.10.0",
35
+ "@bakers-build/core": "^0.10.1-next.10",
36
+ "@bakers-build/message": "^0.10.1-next.10",
37
37
  "@modelcontextprotocol/sdk": "1.32.1",
38
38
  "commander": "^12.1.0",
39
39
  "dropsh": "^0.8.2"
40
40
  },
41
41
  "bakersBuild": {
42
- "commit": "5857b00008bc0926fd52fdc8d9366d6d52444e35",
43
- "channel": "latest"
42
+ "commit": "d0f650fbe4c44eda2a26be62d28d30c22c56c386",
43
+ "channel": "next"
44
44
  }
45
45
  }