@bakers-build/conductor 0.10.0 → 0.10.1-next.2

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.
@@ -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
  }
@@ -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.2",
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.2",
36
+ "@bakers-build/message": "^0.10.1-next.2",
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": "1bc392c2e9aaebacbb1904ad2b55563da8784233",
43
+ "channel": "next"
44
44
  }
45
45
  }