@bakers-build/conductor 0.9.1-next.8 → 0.9.1-next.9

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.
@@ -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);
@@ -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 {
@@ -87,7 +87,7 @@ export interface ProvisionRuns {
87
87
  export declare function provisionRuns(timeoutMs?: number): ProvisionRuns;
88
88
  export interface ProvisionOptions {
89
89
  /** `hooks.provision_exec`: commands by key. */
90
- exec?: Record<string, string>;
90
+ exec?: Record<string, ProvisionExecCommand>;
91
91
  /** Whether the runtime isolates runs; exported to every host command. */
92
92
  isolates?: boolean;
93
93
  }
@@ -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.9.1-next.8",
3
+ "version": "0.9.1-next.9",
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.9.1-next.8",
36
- "@bakers-build/message": "^0.9.1-next.8",
35
+ "@bakers-build/core": "^0.9.1-next.9",
36
+ "@bakers-build/message": "^0.9.1-next.9",
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": "41eb5631e4ddf107b0b7a5ce2ffe2ed2a6052b5e",
42
+ "commit": "fa0565441ae1aee6535c9205b3a37f87e9b52054",
43
43
  "channel": "next"
44
44
  }
45
45
  }