@bakers-build/core 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.
@@ -226,6 +226,12 @@ export function inventoryConfig(options = {}) {
226
226
  return;
227
227
  }
228
228
  file.state = 'valid';
229
+ // An explicit executor slot: the machine's wins over the project's.
230
+ if (selected &&
231
+ source.properties.get('executor') &&
232
+ (kind === 'machine' ||
233
+ (kind === 'conductor' && report.executor_source === undefined)))
234
+ report.executor_source = path;
229
235
  const startFindings = report.findings.length;
230
236
  const field = source.properties.get('schema_version');
231
237
  file.version.header = source.headerVersions[0] ?? null;
@@ -74,6 +74,12 @@ export interface ConfigReport {
74
74
  tunnel: boolean | null;
75
75
  source: string;
76
76
  };
77
+ /**
78
+ * The file whose explicit `executor` slot the conductor uses: the machine
79
+ * file overrides the project's. Absent when neither sets one (the executor
80
+ * is then discovered from `addons[]`).
81
+ */
82
+ executor_source?: string;
77
83
  verification: {
78
84
  offline: {
79
85
  status: 'passed' | 'blocked' | 'incomplete';
@@ -34,6 +34,14 @@ export interface MachineContext {
34
34
  * Omitted or false keeps the original local URL.
35
35
  */
36
36
  tunnel?: boolean;
37
+ /** Shared run security for every agent; the conductor validates it. */
38
+ security?: unknown;
39
+ /**
40
+ * This machine's executor, an `executor` slot value as in a conductor
41
+ * config. It overrides every project's executor on this machine; the
42
+ * workspace and remote stay project-owned.
43
+ */
44
+ executor?: unknown;
37
45
  }
38
46
  /**
39
47
  * Warn once that a leftover `max_parallel` in a config file is ignored: the
@@ -0,0 +1,8 @@
1
+ /** The `bakers ui` refresh signal's basename inside a `.bakers` dir; the UI watches it. */
2
+ export declare const UI_REFRESH_FILE = "ui-refresh";
3
+ /**
4
+ * Tell any `bakers ui` watching `bakersDir` that its data may be stale: set the
5
+ * signal file's mtime, creating it if needed. A missing dir is skipped and
6
+ * nothing throws, because a failed signal must never fail its caller (a run).
7
+ */
8
+ export declare function bumpUiRefresh(bakersDir: string): void;
@@ -0,0 +1,26 @@
1
+ import { existsSync, utimesSync, writeFileSync } from 'node:fs';
2
+ import { join } from 'node:path';
3
+ /** The `bakers ui` refresh signal's basename inside a `.bakers` dir; the UI watches it. */
4
+ export const UI_REFRESH_FILE = 'ui-refresh';
5
+ /**
6
+ * Tell any `bakers ui` watching `bakersDir` that its data may be stale: set the
7
+ * signal file's mtime, creating it if needed. A missing dir is skipped and
8
+ * nothing throws, because a failed signal must never fail its caller (a run).
9
+ */
10
+ export function bumpUiRefresh(bakersDir) {
11
+ if (!existsSync(bakersDir))
12
+ return;
13
+ const file = join(bakersDir, UI_REFRESH_FILE);
14
+ try {
15
+ const now = new Date();
16
+ utimesSync(file, now, now);
17
+ }
18
+ catch {
19
+ try {
20
+ writeFileSync(file, '');
21
+ }
22
+ catch {
23
+ // Unwritable `.bakers`: the UI just stays on `R`.
24
+ }
25
+ }
26
+ }
@@ -23,6 +23,7 @@ export { defaultProcProbe, defaultRunProcessProbe, killRunProcesses, type ProcPr
23
23
  export { normalizeRepoUrl } from './core/repo-url.js';
24
24
  export { shellQuote } from './core/shell.js';
25
25
  export { DEFAULT_SLUG_MAX_LENGTH, slugify } from './core/slug.js';
26
+ export { bumpUiRefresh, UI_REFRESH_FILE } from './core/ui-refresh.js';
26
27
  export { AddonUnresolvedError, discoverAddons, loadAddonPreset, type ResolvedConductorSlots, resolveConductorSlots, } from './plugins/discover-addons.js';
27
28
  export { type AddonEntry, type AddonScope, type BbPreset, type BbSurface, type CommandDescriptor, type DiscoveredContributions, emptyContributions, type OpaqueAccumulator, PRESET_FUNCTION_KEYS, SURFACE_KEYS, } from './plugins/preset.js';
28
29
  export { type AddonScopeFinding, type AddonScopeInput, discoverScoped, type EffectiveAddon, readConfigAddons, readEffectiveAddon, scopeAddons, } from './plugins/scoped-addons.js';
package/dist/src/index.js CHANGED
@@ -25,6 +25,7 @@ export { defaultProcProbe, defaultRunProcessProbe, killRunProcesses, signalVerif
25
25
  export { normalizeRepoUrl } from './core/repo-url.js';
26
26
  export { shellQuote } from './core/shell.js';
27
27
  export { DEFAULT_SLUG_MAX_LENGTH, slugify } from './core/slug.js';
28
+ export { bumpUiRefresh, UI_REFRESH_FILE } from './core/ui-refresh.js';
28
29
  // BB-215: the Storybook-style preset contract + the shared addon discovery.
29
30
  // BB-224 (Finding 6): SURFACE-AGNOSTIC only. The conductor-surface interfaces
30
31
  // (`BbRemote`/`BbExecutor`/`BbWorkspace`/`BbAgent`, the four `*Plugin`
@@ -39,6 +40,5 @@ export { DEFAULT_SLUG_MAX_LENGTH, slugify } from './core/slug.js';
39
40
  export { AddonUnresolvedError, discoverAddons, loadAddonPreset, resolveConductorSlots, } from './plugins/discover-addons.js';
40
41
  export { emptyContributions, PRESET_FUNCTION_KEYS, SURFACE_KEYS, } from './plugins/preset.js';
41
42
  export { discoverScoped, readConfigAddons, readEffectiveAddon, scopeAddons, } from './plugins/scoped-addons.js';
42
- // BB-194 AC-2: the agent-host contract (`AgentLaunchHost` / `HostedAgent` /
43
- // `supportsAgentHost`) is likewise NOT here — it is the TUI renderer's own plugin
44
- // seam (`@bakers-build/addon-bakers-ui`), and herdr types its impl locally.
43
+ // BB-194 AC-2: there is no agent-host contract here; `bakers ui` no longer
44
+ // hosts agents.
@@ -35,6 +35,9 @@ export declare function loadAddonPreset(spec: string, bases: string[], warn?: Wa
35
35
  export declare function discoverAddons(entries: AddonEntry[] | undefined, surface: BbSurface, bases: string[], opts?: {
36
36
  logger?: ConductorLogger;
37
37
  globals?: unknown;
38
+ /** Like `globals`, but seen only by the `agents` accumulators (the
39
+ * conductor's shared run security). */
40
+ agentGlobals?: unknown;
38
41
  /** Narrow the surface's accumulators to this subset (intersection only). */
39
42
  only?: Array<keyof DiscoveredContributions>;
40
43
  /** `skip` warns and drops an addon that does not RESOLVE; import errors still throw. */
@@ -188,7 +188,7 @@ function mergeGlobals(globals, own) {
188
188
  }
189
189
  /** Run one preset's surface accumulators into `acc`, attaching `priority` to any
190
190
  * newly appended agent candidates. */
191
- async function applyPreset(preset, opts, priority, alias, surface, acc, only) {
191
+ async function applyPreset(preset, opts, priority, alias, surface, acc, only, agentOpts = opts) {
192
192
  // `only` NARROWS, never widens: a key the surface does not run stays unrun.
193
193
  const keys = only
194
194
  ? SURFACE_KEYS[surface].filter((k) => only.includes(k))
@@ -198,8 +198,9 @@ async function applyPreset(preset, opts, priority, alias, surface, acc, only) {
198
198
  if (typeof fn !== 'function')
199
199
  continue;
200
200
  const before = key === 'agents' ? acc.agents.length : 0;
201
+ const keyOpts = key === 'agents' ? agentOpts : opts;
201
202
  // biome-ignore lint/suspicious/noExplicitAny: heterogeneous per-key arrays
202
- acc[key] = await fn(acc[key], opts);
203
+ acc[key] = await fn(acc[key], keyOpts);
203
204
  if (key === 'agents' && alias !== undefined) {
204
205
  const added = acc.agents.slice(before);
205
206
  const selected = added.filter((c) => c.alias === alias);
@@ -279,7 +280,7 @@ export async function discoverAddons(entries, surface, bases, opts = {}) {
279
280
  await walk(preset.addons, listBases);
280
281
  }
281
282
  const presetOpts = mergeGlobals(opts.globals, withOpts);
282
- await applyPreset(preset, presetOpts, priority, alias, surface, acc, opts.only);
283
+ await applyPreset(preset, presetOpts, priority, alias, surface, acc, opts.only, mergeGlobals(opts.agentGlobals, presetOpts));
283
284
  if (surface === 'conductor' &&
284
285
  preset.inbox !== undefined &&
285
286
  (!opts.only || opts.only.includes('addonInbox'))) {
@@ -71,8 +71,6 @@ export interface DiscoveredContributions {
71
71
  agents: unknown[];
72
72
  /** Opaque: `HookListener[]` on the conductor surface (BB-599). */
73
73
  hooks: unknown[];
74
- /** Opaque: `HerdrHost[]` on the conductor surface. */
75
- processHosts: unknown[];
76
74
  connectionPlugins: DropSHPlugin[];
77
75
  /**
78
76
  * BB-373: UI extension entry MODULES — specifiers, never constructed
@@ -153,7 +151,6 @@ export interface BbPreset<O = unknown> {
153
151
  workspaces?: OpaqueAccumulator<O>;
154
152
  agents?: OpaqueAccumulator<O>;
155
153
  hooks?: OpaqueAccumulator<O>;
156
- processHosts?: OpaqueAccumulator<O>;
157
154
  connectionPlugins?: (acc: DropSHPlugin[], opts: O) => DropSHPlugin[] | Promise<DropSHPlugin[]>;
158
155
  uiEntries?: (acc: string[], opts: O) => string[] | Promise<string[]>;
159
156
  inbox?: unknown;
@@ -28,14 +28,7 @@
28
28
  /** The extension points each surface runs (the preset function names to call). */
29
29
  export const SURFACE_KEYS = {
30
30
  command: ['commands'],
31
- conductor: [
32
- 'remotes',
33
- 'executors',
34
- 'workspaces',
35
- 'agents',
36
- 'hooks',
37
- 'processHosts',
38
- ],
31
+ conductor: ['remotes', 'executors', 'workspaces', 'agents', 'hooks'],
39
32
  connection: ['connectionPlugins', 'uiEntries'],
40
33
  };
41
34
  /** The preset function keys, for shape-detection during discovery. */
@@ -46,7 +39,6 @@ export const PRESET_FUNCTION_KEYS = [
46
39
  'workspaces',
47
40
  'agents',
48
41
  'hooks',
49
- 'processHosts',
50
42
  'connectionPlugins',
51
43
  'uiEntries',
52
44
  ];
@@ -59,7 +51,6 @@ export function emptyContributions() {
59
51
  workspaces: [],
60
52
  agents: [],
61
53
  hooks: [],
62
- processHosts: [],
63
54
  connectionPlugins: [],
64
55
  uiEntries: [],
65
56
  addonInbox: [],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bakers-build/core",
3
- "version": "0.6.1-next.5",
3
+ "version": "0.6.1-next.7",
4
4
  "description": "bakers.build surface-agnostic kernel: host contract, split-config helpers, addon preset/discovery machinery, shared primitives.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -38,7 +38,7 @@
38
38
  "yaml": "^2.7.0"
39
39
  },
40
40
  "bakersBuild": {
41
- "commit": "314f28982940df736bea55293a81435d37864b31",
41
+ "commit": "b89398b187bf51f4f9ca5bfc1150469f73a879e6",
42
42
  "channel": "next"
43
43
  }
44
44
  }