@bakers-build/conductor 0.7.1-next.7 → 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.
@@ -46,6 +46,10 @@ export declare class Conductor {
46
46
  * restart does not repeat `on_freeze`; loaded on the first observation.
47
47
  */
48
48
  private frozenSeen;
49
+ /** Transcript mtime each active run was last checked for denials at. */
50
+ private readonly stallChecked;
51
+ /** Active runs already reported as blocked; never reported twice. */
52
+ private readonly stallReported;
49
53
  /** The addons with contract-2 inbox messages this conductor runs. */
50
54
  private readonly inboxAddons;
51
55
  /** The per-item work each tick enqueues. */
@@ -80,7 +84,7 @@ export declare class Conductor {
80
84
  *
81
85
  * Only `cmdStartForeground` calls this. `cmdPoll` and `cmdReap` also build a
82
86
  * Conductor and call start() + tick(), then exit; if they reported a pid,
83
- * every `bakers oven once` would overwrite the running conductor's pid
87
+ * every `bakers conductor once` would overwrite the running conductor's pid
84
88
  * with its own short-lived one and the next stop would signal a dead — or
85
89
  * recycled — process. Making the report opt-in means those two commands
86
90
  * cannot do so even by accident.
@@ -102,7 +106,7 @@ export declare class Conductor {
102
106
  /** Never throws: a failed state write leaves the grant on disk, and the next start prunes it. */
103
107
  private revokeRunTools;
104
108
  start(): Promise<void>;
105
- /** One tick that also waits for its actions: `bakers oven once`, tests. */
109
+ /** One tick that also waits for its actions: `bakers conductor once`, tests. */
106
110
  tick(): Promise<void>;
107
111
  /** A failing list query must not stop the other steps or the claims. */
108
112
  private step;
@@ -120,8 +124,26 @@ export declare class Conductor {
120
124
  * conductor still finalises any unclosed run on its next tick.
121
125
  */
122
126
  private enqueueFinalize;
127
+ /**
128
+ * A run a permission rule denied cannot ask anyone on an unattended box,
129
+ * so it stops. Once its transcript has been quiet for {@link STALL_QUIET_MS}
130
+ * and holds a denial, report it once. One stat per running run per tick;
131
+ * the transcript is read once per modification.
132
+ */
133
+ private observeStalls;
134
+ /**
135
+ * The technical-problem note, then the error: the PM bot relays the newest
136
+ * comment of a frozen, labelled ticket. Cancelling lets finalisation stop
137
+ * the agent and keep its transcript.
138
+ */
139
+ private reportBlocked;
123
140
  /** Finalises one run; a failure is logged and retried next tick. */
124
141
  private finalizeOne;
142
+ /**
143
+ * The agent that actually ran: the persisted run.agent id, falling back to
144
+ * the first candidate for a run written before the field existed (empty id).
145
+ */
146
+ private agentFor;
125
147
  /** Read the run's transcript and parse its footprint for the close write. */
126
148
  private captureRun;
127
149
  /**
@@ -175,7 +197,7 @@ export declare class Conductor {
175
197
  * whose workspace still lingers (BB-89). Driven by the durable `cleaned_up`
176
198
  * flag via {@link BbRemote.fetchUncleanedTickets}: every ticket the server
177
199
  * has already closed but not yet cleaned. The SAME reconciliation runs on
178
- * every tick AND standalone as `bakers oven clean`, and the query is
200
+ * every tick AND standalone as `bakers conductor clean`, and the query is
179
201
  * scoped to THIS conductor (BB-121) — so it catches the orphans a
180
202
  * live-tick-only path structurally cannot (the conductor was down when the
181
203
  * ticket closed, or crashed mid-cleanup) for its OWN tickets. A foreign
@@ -33,14 +33,20 @@ function sleep(ms, signal) {
33
33
  }
34
34
  /**
35
35
  * A run-env key is reserved when it names a conductor-provided core variable:
36
- * any `BB_*`, `WORKSPACE_ROOT`, or `TICKET_URL`. User `env_vars` may not
37
- * clobber these — the core vars always win (BB-99).
36
+ * any `BAKERS_*`, `WORKSPACE_ROOT`, or `TICKET_URL`. User `env_vars` may not
37
+ * clobber these — the core vars always win (BB-99). `BB_*` stays reserved: a
38
+ * retired name in the run env would make the agent's `bakers` refuse to start.
38
39
  */
39
40
  function isReservedEnvKey(key) {
40
- return (key.startsWith('BB_') || key === 'WORKSPACE_ROOT' || key === 'TICKET_URL');
41
+ return (key.startsWith('BAKERS_') ||
42
+ key.startsWith('BB_') ||
43
+ key === 'WORKSPACE_ROOT' ||
44
+ key === 'TICKET_URL');
41
45
  }
42
46
  /** A portable environment variable name. */
43
47
  const ENV_KEY = /^[A-Za-z_][A-Za-z0-9_]*$/;
48
+ /** How long a run's transcript stays unchanged before its permission denials are reported. */
49
+ const STALL_QUIET_MS = 5 * 60_000;
44
50
  /**
45
51
  * What a failed listener is logged as: the error's class name, never its
46
52
  * message — listener text may carry an env value (BB-599).
@@ -157,8 +163,8 @@ function renderPrompt(template, values) {
157
163
  return template
158
164
  .replaceAll('{identifier}', values.identifier)
159
165
  .replaceAll('{state}', values.state)
160
- .replaceAll('{runUuid}', values.runUuid)
161
- .replaceAll('{ticketUuid}', values.ticketUuid);
166
+ .replaceAll('{run_uuid}', values.runUuid)
167
+ .replaceAll('{ticket_uuid}', values.ticketUuid);
162
168
  }
163
169
  /**
164
170
  * A conductor's registration payload, built from its config: what the engine
@@ -200,6 +206,10 @@ export class Conductor {
200
206
  * restart does not repeat `on_freeze`; loaded on the first observation.
201
207
  */
202
208
  frozenSeen = null;
209
+ /** Transcript mtime each active run was last checked for denials at. */
210
+ stallChecked = new Map();
211
+ /** Active runs already reported as blocked; never reported twice. */
212
+ stallReported = new Set();
203
213
  /** The addons with contract-2 inbox messages this conductor runs. */
204
214
  inboxAddons;
205
215
  /** The per-item work each tick enqueues. */
@@ -260,7 +270,7 @@ export class Conductor {
260
270
  *
261
271
  * Only `cmdStartForeground` calls this. `cmdPoll` and `cmdReap` also build a
262
272
  * Conductor and call start() + tick(), then exit; if they reported a pid,
263
- * every `bakers oven once` would overwrite the running conductor's pid
273
+ * every `bakers conductor once` would overwrite the running conductor's pid
264
274
  * with its own short-lived one and the next stop would signal a dead — or
265
275
  * recycled — process. Making the report opt-in means those two commands
266
276
  * cannot do so even by accident.
@@ -349,7 +359,7 @@ export class Conductor {
349
359
  this.logger.error({ conductorId: this.id }, line);
350
360
  }
351
361
  }
352
- /** One tick that also waits for its actions: `bakers oven once`, tests. */
362
+ /** One tick that also waits for its actions: `bakers conductor once`, tests. */
353
363
  async tick() {
354
364
  await this.produce();
355
365
  await this.queue.drain();
@@ -406,6 +416,7 @@ export class Conductor {
406
416
  await this.step('finalize', () => this.enqueueFinalize());
407
417
  await this.step('reap', () => this.enqueueReap());
408
418
  await this.step('freeze', () => this.observeFreezes());
419
+ await this.step('stalls', () => this.observeStalls());
409
420
  await runInbox(this.remote, this.inboxAddons, this.id, this.logger, this.queue);
410
421
  // A run that cannot start its sandbox would only fail and count against
411
422
  // the retry cap; claim nothing until every enabled agent can start.
@@ -474,6 +485,107 @@ export class Conductor {
474
485
  });
475
486
  }
476
487
  }
488
+ /**
489
+ * A run a permission rule denied cannot ask anyone on an unattended box,
490
+ * so it stops. Once its transcript has been quiet for {@link STALL_QUIET_MS}
491
+ * and holds a denial, report it once. One stat per running run per tick;
492
+ * the transcript is read once per modification.
493
+ */
494
+ async observeStalls() {
495
+ const runs = await this.remote.fetchActiveRuns(this.id);
496
+ const live = new Set(runs.map((r) => r.runUuid));
497
+ for (const seen of [this.stallChecked, this.stallReported])
498
+ for (const id of seen.keys())
499
+ if (!live.has(id))
500
+ seen.delete(id);
501
+ for (const r of runs) {
502
+ if (r.state !== 'running' || !r.worktreePath)
503
+ continue;
504
+ if (this.stallReported.has(r.runUuid))
505
+ continue;
506
+ const agent = this.agentFor(r)?.agent;
507
+ if (!agent?.permissionDenials || !agent.runLogModified)
508
+ continue;
509
+ const identity = {
510
+ sessionId: r.runUuid,
511
+ attemptFamily: attemptFamily(r.runUuid),
512
+ };
513
+ let denied;
514
+ try {
515
+ const modified = await agent.runLogModified(r.worktreePath, identity);
516
+ if (modified === undefined ||
517
+ Date.now() - modified < STALL_QUIET_MS ||
518
+ this.stallChecked.get(r.runUuid) === modified)
519
+ continue;
520
+ denied = agent.permissionDenials(await agent.getRunLog(r.worktreePath, identity));
521
+ // Only a successful read counts: a stuck transcript never changes again.
522
+ this.stallChecked.set(r.runUuid, modified);
523
+ }
524
+ catch (err) {
525
+ this.logger.warn({ conductorId: this.id, run: r.runUuid, err }, 'could not read the run transcript for permission denials');
526
+ continue;
527
+ }
528
+ if (denied.length === 0)
529
+ continue;
530
+ this.stallReported.add(r.runUuid);
531
+ this.queue.enqueue({
532
+ key: `stall:${r.runUuid}`,
533
+ lane: r.ticketUuid || r.runUuid,
534
+ run: () => this.reportBlocked(r, denied),
535
+ });
536
+ }
537
+ }
538
+ /**
539
+ * The technical-problem note, then the error: the PM bot relays the newest
540
+ * comment of a frozen, labelled ticket. Cancelling lets finalisation stop
541
+ * the agent and keep its transcript.
542
+ */
543
+ async reportBlocked(r, denied) {
544
+ const site = this.remote.siteTools;
545
+ // Without site tools nothing reaches the ticket; a silent cancel would hide the run.
546
+ // Unmarked, the next tick with site tools reports it.
547
+ if (!site) {
548
+ this.stallReported.delete(r.runUuid);
549
+ this.stallChecked.delete(r.runUuid);
550
+ throw new Error('no site tools to report the blocked run');
551
+ }
552
+ this.logger.warn({ conductorId: this.id, run: r.runUuid, denied }, 'run blocked on a permission denial; reporting and cancelling it');
553
+ const call = async (name, args) => {
554
+ const result = await site.call(`tool_api__${name}`, args);
555
+ if (result?.isError)
556
+ throw new Error(`${name}: ${JSON.stringify(result?.content)}`);
557
+ };
558
+ const comment = (body) => call('bakers_comment_publish', {
559
+ ticket: r.ticketUuid,
560
+ type: 'comment',
561
+ body,
562
+ });
563
+ try {
564
+ await comment('# Technical problem\n\nPlease contact the developers.\n');
565
+ await comment([
566
+ '# Error',
567
+ '',
568
+ `The sandboxed run stopped: a permission rule denied an action it needed, and its transcript has not changed for ${STALL_QUIET_MS / 60_000} minutes. An allow rule for the action is missing from the agent's \`permissions\` settings. Add it, then unfreeze the ticket.`,
569
+ '',
570
+ 'Denied actions:',
571
+ '',
572
+ ...denied.map((action) => `- \`${action}\``),
573
+ '',
574
+ ].join('\n'));
575
+ await call('bakers_ticket_update', {
576
+ ticket: r.ticketUuid,
577
+ labels_add: ['technical problem'],
578
+ frozen: true,
579
+ });
580
+ }
581
+ finally {
582
+ // A stuck run is cancelled even when the report fails; the warning names the actions.
583
+ // shortcut: the reported mark lives in memory, so if this cancel fails a restarted
584
+ // conductor reports the run again; persist the mark if duplicates show up.
585
+ await this.remote.cancelRun(r.runUuid);
586
+ }
587
+ this.signalUi();
588
+ }
477
589
  /** Finalises one run; a failure is logged and retried next tick. */
478
590
  async finalizeOne(r) {
479
591
  try {
@@ -530,12 +642,16 @@ export class Conductor {
530
642
  this.logger.warn({ run: r.runUuid, err: String(err) }, 'run finalise failed');
531
643
  }
532
644
  }
645
+ /**
646
+ * The agent that actually ran: the persisted run.agent id, falling back to
647
+ * the first candidate for a run written before the field existed (empty id).
648
+ */
649
+ agentFor(r) {
650
+ return this.agents.find((a) => a.id === r.agent) ?? this.agents[0];
651
+ }
533
652
  /** Read the run's transcript and parse its footprint for the close write. */
534
653
  async captureRun(r) {
535
- // Route to the agent that actually ran (BB-144): the persisted
536
- // run.agent id, falling back to the first candidate for a run written
537
- // before the field existed (empty id).
538
- const resolved = this.agents.find((a) => a.id === r.agent) ?? this.agents[0];
654
+ const resolved = this.agentFor(r);
539
655
  if (!resolved) {
540
656
  throw new Error('no agent candidates configured for finalize');
541
657
  }
@@ -837,7 +953,7 @@ export class Conductor {
837
953
  * whose workspace still lingers (BB-89). Driven by the durable `cleaned_up`
838
954
  * flag via {@link BbRemote.fetchUncleanedTickets}: every ticket the server
839
955
  * has already closed but not yet cleaned. The SAME reconciliation runs on
840
- * every tick AND standalone as `bakers oven clean`, and the query is
956
+ * every tick AND standalone as `bakers conductor clean`, and the query is
841
957
  * scoped to THIS conductor (BB-121) — so it catches the orphans a
842
958
  * live-tick-only path structurally cannot (the conductor was down when the
843
959
  * ticket closed, or crashed mid-cleanup) for its OWN tickets. A foreign
@@ -1071,24 +1187,24 @@ export class Conductor {
1071
1187
  workspaceIds = ids.join(',');
1072
1188
  }
1073
1189
  catch (err) {
1074
- this.logger.warn({ ticket: t.identifier, err: String(err) }, 'could not resolve reachable workspaces for BB_WORKSPACE_IDS');
1190
+ this.logger.warn({ ticket: t.identifier, err: String(err) }, 'could not resolve reachable workspaces for BAKERS_WORKSPACE_IDS');
1075
1191
  }
1076
1192
  const core = {
1077
- BB_URL: this.config.site.base_url,
1078
- BB_ID: t.uuid,
1193
+ BAKERS_URL: this.config.site.base_url,
1194
+ BAKERS_ID: t.uuid,
1079
1195
  // BB-569: lets a launch wrapper key off the ticket and the run's
1080
1196
  // start state without parsing the prompt (addon-claude `measure`).
1081
- ...(t.identifier ? { BB_TICKET_IDENTIFIER: t.identifier } : {}),
1082
- ...(state ? { BB_STATE: state } : {}),
1083
- ...(runUuid ? { BB_RUN_UUID: runUuid } : {}),
1084
- BB_TUNNEL: (await this.currentTunnel()) ? '1' : '0',
1197
+ ...(t.identifier ? { BAKERS_TICKET_IDENTIFIER: t.identifier } : {}),
1198
+ ...(state ? { BAKERS_STATE: state } : {}),
1199
+ ...(runUuid ? { BAKERS_RUN_UUID: runUuid } : {}),
1200
+ BAKERS_TUNNEL: (await this.currentTunnel()) ? '1' : '0',
1085
1201
  WORKSPACE_ROOT: this.checkoutRoot,
1086
1202
  ...(t.issueUrl ? { TICKET_URL: t.issueUrl } : {}),
1087
- ...(t.projectName ? { BB_PROJECT: t.projectName } : {}),
1088
- ...(t.projectId ? { BB_PROJECT_ID: t.projectId } : {}),
1089
- ...(t.workspaceName ? { BB_WORKSPACE: t.workspaceName } : {}),
1090
- ...(t.workspaceId ? { BB_WORKSPACE_ID: t.workspaceId } : {}),
1091
- ...(workspaceIds ? { BB_WORKSPACE_IDS: workspaceIds } : {}),
1203
+ ...(t.projectName ? { BAKERS_PROJECT: t.projectName } : {}),
1204
+ ...(t.projectId ? { BAKERS_PROJECT_ID: t.projectId } : {}),
1205
+ ...(t.workspaceName ? { BAKERS_WORKSPACE: t.workspaceName } : {}),
1206
+ ...(t.workspaceId ? { BAKERS_WORKSPACE_ID: t.workspaceId } : {}),
1207
+ ...(workspaceIds ? { BAKERS_WORKSPACE_IDS: workspaceIds } : {}),
1092
1208
  };
1093
1209
  return resolveRunEnv(t.effectiveEnvVars, core, this.logger, {
1094
1210
  ticket: t.identifier,
@@ -1216,7 +1332,7 @@ export class Conductor {
1216
1332
  if (unavailable)
1217
1333
  throw new Error(unavailable);
1218
1334
  const baseRef = t.baseBranch ? `origin/${t.baseBranch}` : undefined;
1219
- // Resolve the run env once (per-ticket env_vars + core BB_* vars) and
1335
+ // Resolve the run env once (per-ticket env_vars + core BAKERS_* vars) and
1220
1336
  // inject it into BOTH the lifecycle hooks AND the agent run
1221
1337
  // env (BB-99). Reserved core keys always win; values may be sensitive so
1222
1338
  // only key names are ever logged.
@@ -1504,7 +1620,7 @@ export class Conductor {
1504
1620
  }
1505
1621
  await this.queue.drain();
1506
1622
  // NB: the poll loop never writes status=offline itself. A graceful stop
1507
- // (`bakers oven stop`) writes offline directly server-side; a crash or
1623
+ // (`bakers conductor stop`) writes offline directly server-side; a crash or
1508
1624
  // hard-kill leaves a stale lease that the Drupal cron reaper flips to
1509
1625
  // offline (bb_core cron → ConductorReaper). Liveness is thus always
1510
1626
  // derived from status + last_seen/lease_expires_at, never from the loop.
@@ -18,7 +18,7 @@ export interface ToolServerEndpoint {
18
18
  }
19
19
  export interface ToolServerOptions {
20
20
  registry: ToolRegistry;
21
- /** `<BB_HOME>/conductors/<conductor_id>.json`; absent: no operator access. */
21
+ /** `<BAKERS_HOME>/conductors/<conductor_id>.json`; absent: no operator access. */
22
22
  endpointFile?: string;
23
23
  /** The operator may only name worktrees below this directory. */
24
24
  workspaceRoot?: string;
@@ -84,9 +84,9 @@ export interface AgentRunIdentity {
84
84
  /** The MCP server name agents see for the conductor's addon tools. */
85
85
  export declare const CONDUCTOR_TOOLS_SERVER = "bakers";
86
86
  /** The run env var holding the run's bearer token for that server. */
87
- export declare const CONDUCTOR_TOKEN_ENV = "BB_CONDUCTOR_TOKEN";
88
- /** The run env var holding that server's URL, for `bakers oven tools`. */
89
- export declare const CONDUCTOR_URL_ENV = "BB_CONDUCTOR_URL";
87
+ export declare const CONDUCTOR_TOKEN_ENV = "BAKERS_CONDUCTOR_TOKEN";
88
+ /** The run env var holding that server's URL, for `bakers conductor tools`. */
89
+ export declare const CONDUCTOR_URL_ENV = "BAKERS_CONDUCTOR_URL";
90
90
  /** What {@link BbAgent.installPlugins} hands the run's launch. */
91
91
  export interface PluginLaunch {
92
92
  /** Merged into the run env: the harness's config-dir variable, never `HOME`. */
@@ -178,6 +178,11 @@ export interface BbAgent {
178
178
  * `pi`) declares none, and the conductor always pins for it.
179
179
  */
180
180
  sessionExists?(worktreePath: string, sessionId: string): Promise<boolean>;
181
+ /**
182
+ * When the run's transcript was last written (epoch ms), from a stat alone;
183
+ * undefined when it has none yet. Optional, like {@link permissionDenials}.
184
+ */
185
+ runLogModified?(worktreePath: string, run: AgentRunIdentity): Promise<number | undefined>;
181
186
  /**
182
187
  * Parse this agent's run transcript (as returned by {@link getRunLog}) into
183
188
  * a footprint of effort metrics (BB-132). The transcript format is
@@ -193,4 +198,11 @@ export interface BbAgent {
193
198
  * agent without it is never checked.
194
199
  */
195
200
  sandboxPreflight?(host?: SandboxHost): Promise<SandboxPreflight>;
201
+ /**
202
+ * The actions a permission rule denied in this run's transcript, each as
203
+ * `Tool(argument)`, in order, but only when the run stopped on one: the agent
204
+ * ended its turn after a denial with no call outstanding; [] otherwise. Never
205
+ * throws. Optional: a run of an agent without it is never reported as blocked.
206
+ */
207
+ permissionDenials?(log: string): string[];
196
208
  }
@@ -40,6 +40,6 @@ export function matchesEnvDeny(name, patterns) {
40
40
  /** The MCP server name agents see for the conductor's addon tools. */
41
41
  export const CONDUCTOR_TOOLS_SERVER = 'bakers';
42
42
  /** The run env var holding the run's bearer token for that server. */
43
- export const CONDUCTOR_TOKEN_ENV = 'BB_CONDUCTOR_TOKEN';
44
- /** The run env var holding that server's URL, for `bakers oven tools`. */
45
- export const CONDUCTOR_URL_ENV = 'BB_CONDUCTOR_URL';
43
+ export const CONDUCTOR_TOKEN_ENV = 'BAKERS_CONDUCTOR_TOKEN';
44
+ /** The run env var holding that server's URL, for `bakers conductor tools`. */
45
+ export const CONDUCTOR_URL_ENV = 'BAKERS_CONDUCTOR_URL';
@@ -34,7 +34,7 @@ export type HookName = 'after_create' | 'before_run' | 'after_run' | 'after_done
34
34
  * What an addon hook listener receives (BB-599). One context object is
35
35
  * shared by every listener of one dispatch, so a key a `before_run` listener
36
36
  * adds to `env` reaches the next listener, that slot's shell hook and the
37
- * agent launch. Reserved keys (`BB_*`, `WORKSPACE_ROOT`, `TICKET_URL`) and
37
+ * agent launch. Reserved keys (`BAKERS_*`, `BB_*`, `WORKSPACE_ROOT`, `TICKET_URL`) and
38
38
  * invalid entries are restored after each listener. `env` values may be
39
39
  * secret: never log them.
40
40
  *
@@ -12,7 +12,7 @@ export interface ExecutorDeps {
12
12
  logger: ConductorLogger;
13
13
  }
14
14
  export interface RemotePlugin extends DropSHPlugin {
15
- readonly kind: 'remote';
15
+ readonly kind: 'server';
16
16
  readonly id: string;
17
17
  readonly requiredModules: string[];
18
18
  createRemote(config: ConductorFileConfig): Promise<BbRemote>;
@@ -24,7 +24,7 @@ export interface ExecutorPlugin extends DropSHPlugin {
24
24
  createExecutor(config: ConductorFileConfig, deps: ExecutorDeps): Promise<BbExecutor>;
25
25
  }
26
26
  export interface WorkspacePlugin extends DropSHPlugin {
27
- readonly kind: 'workspace';
27
+ readonly kind: 'worktree';
28
28
  readonly id: string;
29
29
  readonly requiredModules: string[];
30
30
  /**
@@ -11,9 +11,9 @@ import type { AddonTools, DiscoveredTools } from './tools.js';
11
11
  * the discovery call site (see {@link narrowConductorContributions}).
12
12
  */
13
13
  export interface ConductorContributions {
14
- remotes: RemotePlugin[];
14
+ servers: RemotePlugin[];
15
15
  executors: ExecutorPlugin[];
16
- workspaces: WorkspacePlugin[];
16
+ worktrees: WorkspacePlugin[];
17
17
  agents: AgentCandidate[];
18
18
  /** Lifecycle hook listeners, in accumulator order (BB-599). */
19
19
  hooks: HookListener[];
@@ -42,9 +42,9 @@ export type ConductorAddonEntry = string | (Exclude<AddonEntry, string> & {
42
42
  * silently drifting apart.
43
43
  */
44
44
  export interface Preset<O = unknown> extends BbPreset<O> {
45
- remotes?: (acc: RemotePlugin[], opts: O) => RemotePlugin[] | Promise<RemotePlugin[]>;
45
+ servers?: (acc: RemotePlugin[], opts: O) => RemotePlugin[] | Promise<RemotePlugin[]>;
46
46
  executors?: (acc: ExecutorPlugin[], opts: O) => ExecutorPlugin[] | Promise<ExecutorPlugin[]>;
47
- workspaces?: (acc: WorkspacePlugin[], opts: O) => WorkspacePlugin[] | Promise<WorkspacePlugin[]>;
47
+ worktrees?: (acc: WorkspacePlugin[], opts: O) => WorkspacePlugin[] | Promise<WorkspacePlugin[]>;
48
48
  agents?: (acc: AgentCandidate[], opts: O) => AgentCandidate[] | Promise<AgentCandidate[]>;
49
49
  hooks?: (acc: HookListener[], opts: O) => HookListener[] | Promise<HookListener[]>;
50
50
  /** Addon inbox messages: contract 2, BB-661. */
@@ -59,4 +59,4 @@ export interface Preset<O = unknown> extends BbPreset<O> {
59
59
  * {@link Preset}, and `resolveConductorSlots` still runs the runtime `.kind`
60
60
  * guard on whatever actually landed in a singleton slot.
61
61
  */
62
- export declare function narrowConductorContributions(discovered: Pick<DiscoveredContributions, 'remotes' | 'executors' | 'workspaces' | 'agents' | 'hooks' | 'addonInbox' | 'addonTools'>): ConductorContributions;
62
+ export declare function narrowConductorContributions(discovered: Pick<DiscoveredContributions, 'servers' | 'executors' | 'worktrees' | 'agents' | 'hooks' | 'addonInbox' | 'addonTools'>): ConductorContributions;
@@ -31,7 +31,7 @@ export interface ConductorRegistration {
31
31
  last_pid?: number;
32
32
  /**
33
33
  * The stem of the config file this conductor was started from (`conductor`
34
- * for the default, `shop` for `shop.conductor.config.js`) — what
34
+ * for the default, `shop` for `shop.project.config.js`) — what
35
35
  * `--conductor <name>` selects. Together with `workspace` it identifies one
36
36
  * conductor in a repo that holds several.
37
37
  */
@@ -75,7 +75,7 @@ export interface Ticket {
75
75
  /**
76
76
  * Effective environment variables (BB-99), resolved server-side along the
77
77
  * parent_id chain (child wins) as canonical `.env`-style `KEY=value` lines.
78
- * The conductor parses this, strips reserved keys, overlays the core BB_*
78
+ * The conductor parses this, strips reserved keys, overlays the core BAKERS_*
79
79
  * vars, and injects the result into the agent run env AND the workspace hooks.
80
80
  * Omitted when the ticket (and its ancestors) set none. Values may be secret.
81
81
  */
@@ -111,6 +111,8 @@ export interface ActiveRun {
111
111
  stateAtStart: string;
112
112
  /** Absolute path of the per-run git worktree, or '' when unset. */
113
113
  worktreePath: string;
114
+ /** Id of the agent the run was dispatched to, '' / undefined when unset. */
115
+ agent?: string;
114
116
  }
115
117
  export interface ConductorStatus {
116
118
  id: string;
@@ -365,7 +367,7 @@ export interface BbRemote {
365
367
  getTicket(ticketUuid: string): Promise<Ticket>;
366
368
  /**
367
369
  * BB-495: every `bb_workspace` uuid the dispatching identity can reach —
368
- * dispatch exports this as `BB_WORKSPACE_IDS` so the agent knows the full
370
+ * dispatch exports this as `BAKERS_WORKSPACE_IDS` so the agent knows the full
369
371
  * radius it may name, not only the point it starts standing on.
370
372
  */
371
373
  getReachableWorkspaces(): Promise<string[]>;
@@ -393,6 +395,11 @@ export interface BbRemote {
393
395
  * failure is visible immediately and its cause is recorded.
394
396
  */
395
397
  markFailed(runUuid: string, errorLog: string): Promise<void>;
398
+ /**
399
+ * Cancel a live run (`cancel`: claimed/running → cancelled). Finalisation
400
+ * then captures its transcript and stops its agent, as for an operator's cancel.
401
+ */
402
+ cancelRun(runUuid: string): Promise<void>;
396
403
  /**
397
404
  * Runs this conductor owns that are state in (done, cancelled) but not yet
398
405
  * closed — the conductor's one-shot finalisation work list. Cancelled runs
@@ -415,7 +422,7 @@ export interface BbRemote {
415
422
  * tickets assigned to `conductorId` are loaded, so every ticket on the list
416
423
  * is unambiguously this conductor's — a missing worktree means "already torn
417
424
  * down on this host", not "belongs to another host". The same query backs
418
- * the live tick and the standalone `bakers oven clean`. Empty once every
425
+ * the live tick and the standalone `bakers conductor clean`. Empty once every
419
426
  * closed ticket this conductor owns is cleaned.
420
427
  */
421
428
  fetchUncleanedTickets(conductorId: string): Promise<UncleanTicket[]>;
@@ -75,7 +75,7 @@ export function provisionTools(hook, runs = provisionRuns()) {
75
75
  handlers: async () => ({
76
76
  provision_up: async (req) => {
77
77
  const command = commandFor(req.args.profile);
78
- // shortcut: inherits the conductor's env, not the run's BB_* env; pass it through the binding once a hook needs it.
78
+ // shortcut: inherits the conductor's env, not the run's BAKERS_* env; pass it through the binding once a hook needs it.
79
79
  const { exitCode, output } = await runs.run(req.worktreePath, command);
80
80
  const text = `exit ${exitCode}\n${output}`;
81
81
  if (exitCode !== 0)
@@ -16,7 +16,7 @@ export interface EnsuredWorkspace {
16
16
  created: boolean;
17
17
  /**
18
18
  * Variables the run needs from its workspace backend (e.g. Git config via
19
- * `GIT_CONFIG_COUNT`). The conductor adds them to the run env; core `BB_*`
19
+ * `GIT_CONFIG_COUNT`). The conductor adds them to the run env; core `BAKERS_*`
20
20
  * keys still win.
21
21
  */
22
22
  env?: Record<string, string>;
@@ -1,8 +1,9 @@
1
1
  export const commands = (acc) => [
2
2
  ...acc,
3
3
  {
4
- name: 'oven',
4
+ name: 'conductor',
5
+ aliases: ['oven'],
5
6
  plugin: '@bakers-build/conductor/commands/conductor',
6
- describe: 'node-agent lifecycle + local registry',
7
+ describe: 'conductor lifecycle + local registry',
7
8
  },
8
9
  ];
@@ -18,7 +18,7 @@ export interface ConductorSettings {
18
18
  * Absent until `bakers init` gave the machine its UUID.
19
19
  */
20
20
  conductor_id?: string;
21
- /** The selected config file's stem: `conductor` for `conductor.config.js`. */
21
+ /** The selected config file's stem: `conductor` for `project.config.js`. */
22
22
  variant: string;
23
23
  /** This machine's display label (`machine.config.js` label). */
24
24
  machine_label?: string;
@@ -87,7 +87,7 @@ export interface ConductorSettings {
87
87
  dirs: string[];
88
88
  };
89
89
  }
90
- /** Whole conductor.config.js (dropsh-superset): site + named plugin slots. */
90
+ /** Whole project.config.js (dropsh-superset): site + named plugin slots. */
91
91
  export interface ConductorFileConfig extends ConductorSettings {
92
92
  bakers: BbProjectSelection;
93
93
  resolved_bakers?: ResolvedBbProjectContext;
@@ -124,8 +124,8 @@ export interface ConductorFileConfig extends ConductorSettings {
124
124
  }
125
125
  /**
126
126
  * BB-201 split config model: the ENGINE half of a conductor config —
127
- * everything a `conductor.config.js` carries EXCEPT the connection (`site`) and
128
- * the auth `plugins`, which now live in a separate `bakers.config.js`
127
+ * everything a `project.config.js` carries EXCEPT the connection (`site`) and
128
+ * the auth `plugins`, which now live in a separate connection file
129
129
  * (`BbConnectionConfig`). `loadConductorConfig` returns this; the conductor
130
130
  * command composes it with the connection (`composeConductorConfig`) into the
131
131
  * full `ConductorFileConfig` the engine consumes.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bakers-build/conductor",
3
- "version": "0.7.1-next.7",
3
+ "version": "0.8.1-next.1",
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.7.1-next.7",
36
- "@bakers-build/message": "^0.7.1-next.7",
35
+ "@bakers-build/core": "^0.8.1-next.1",
36
+ "@bakers-build/message": "^0.8.1-next.1",
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": "082d8c57436f78e751f5a9a26a4446cec42209ce",
42
+ "commit": "c4a887bee37bb2fed14bb9ba15ad0aacf0e26f7e",
43
43
  "channel": "next"
44
44
  }
45
45
  }