@bakers-build/conductor 0.14.0 → 0.14.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.
@@ -1,9 +1,7 @@
1
1
  import type { ConductorSettings } from '../types.js';
2
- /** The script a host command starts: its first word, or the word after `bash`, `sh` or `node`. */
3
- export declare function hostCommandEntry(command: string): string | undefined;
2
+ export { hostCommandEntry } from '@bakers-build/core';
4
3
  /**
5
4
  * Throws naming the first hook or provision command whose entry point lies
6
- * outside `protectedPaths`. Only the entry is checked: what that script calls
7
- * is the project's responsibility.
5
+ * outside `protectedPaths`.
8
6
  */
9
7
  export declare function assertProtectedEntryPoints(hooks: ConductorSettings['hooks'], protectedPaths: readonly string[]): void;
@@ -1,35 +1,17 @@
1
- // Under an isolating runtime the host runs only code the run cannot write:
2
- // every project hook and provision command must start in a protected path.
3
- import { posix } from 'node:path';
4
- const INTERPRETERS = new Set(['bash', 'sh', 'node']);
5
- /** The script a host command starts: its first word, or the word after `bash`, `sh` or `node`. */
6
- export function hostCommandEntry(command) {
7
- const [first, second] = command
8
- .trim()
9
- .split(/[\s;&|]+/)
10
- .filter(Boolean);
11
- return first !== undefined && INTERPRETERS.has(first) ? second : first;
12
- }
1
+ import { unprotectedEntryPoints } from '@bakers-build/core';
2
+ export { hostCommandEntry } from '@bakers-build/core';
13
3
  /**
14
4
  * Throws naming the first hook or provision command whose entry point lies
15
- * outside `protectedPaths`. Only the entry is checked: what that script calls
16
- * is the project's responsibility.
5
+ * outside `protectedPaths`.
17
6
  */
18
7
  export function assertProtectedEntryPoints(hooks, protectedPaths) {
19
- const roots = ['.bakers', ...protectedPaths].map((path) => posix.normalize(path));
20
- for (const [name, value] of Object.entries(hooks ?? {})) {
21
- const commands = typeof value === 'string'
22
- ? [[`hooks.${name}`, value]]
23
- : Object.entries(value ?? {}).map(([key, command]) => [
24
- `hooks.${name}.${key}`,
25
- typeof command === 'string' ? command : command.command,
26
- ]);
27
- for (const [label, command] of commands) {
28
- const entry = hostCommandEntry(command);
29
- const path = entry === undefined ? undefined : posix.normalize(entry);
30
- if (path === undefined ||
31
- !roots.some((root) => path === root || path.startsWith(`${root}/`)))
32
- throw new Error(`${label}: under an isolating runtime a host command must start with a script in a protected path (${roots.join(', ')}); got ${JSON.stringify(command)}`);
33
- }
34
- }
8
+ const commands = Object.entries(hooks ?? {}).flatMap(([name, value]) => typeof value === 'string'
9
+ ? [[`hooks.${name}`, value]]
10
+ : Object.entries(value ?? {}).map(([key, command]) => [
11
+ `hooks.${name}.${key}`,
12
+ typeof command === 'string' ? command : command.command,
13
+ ]));
14
+ const [first] = unprotectedEntryPoints(commands, protectedPaths);
15
+ if (first)
16
+ throw new Error(`${first.key}: under an isolating runtime a host command must start with a script in a protected path (${first.roots.join(', ')}); got ${JSON.stringify(first.command)}`);
35
17
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bakers-build/conductor",
3
- "version": "0.14.0",
3
+ "version": "0.14.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.14.0",
36
- "@bakers-build/message": "^0.14.0",
35
+ "@bakers-build/core": "^0.14.1-next.1",
36
+ "@bakers-build/message": "^0.14.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": "9f7275a341fe96e9792bce6cd1bbc7b7afc1dcd0",
43
- "channel": "latest"
42
+ "commit": "e6b3d200ba14c56b2fb9d3695f273ea349a97f65",
43
+ "channel": "next"
44
44
  }
45
45
  }