@bakers-build/conductor 0.0.0-stage → 0.1.0-next.42

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.
Files changed (61) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +4 -2
  3. package/dist/src/bakers-project-context.d.ts +12 -0
  4. package/dist/src/bakers-project-context.js +59 -0
  5. package/dist/src/cli/config-plan.d.ts +35 -0
  6. package/dist/src/cli/config-plan.js +1264 -0
  7. package/dist/src/cli/config-schema.d.ts +137 -0
  8. package/dist/src/cli/config-schema.js +239 -0
  9. package/dist/src/cli/config-source-edit.d.ts +17 -0
  10. package/dist/src/cli/config-source-edit.js +95 -0
  11. package/dist/src/cli/config-templates.d.ts +43 -0
  12. package/dist/src/cli/config-templates.js +130 -0
  13. package/dist/src/cli/config-validation.d.ts +12 -0
  14. package/dist/src/cli/config-validation.js +353 -0
  15. package/dist/src/cli/migrate-addon-names.d.ts +82 -0
  16. package/dist/src/cli/migrate-addon-names.js +334 -0
  17. package/dist/src/cli/project-context.d.ts +21 -0
  18. package/dist/src/cli/project-context.js +105 -0
  19. package/dist/src/commands/conductor.d.ts +91 -0
  20. package/dist/src/commands/conductor.js +843 -0
  21. package/dist/src/config.d.ts +109 -0
  22. package/dist/src/config.js +712 -0
  23. package/dist/src/contract.d.ts +13 -0
  24. package/dist/src/contract.js +19 -0
  25. package/dist/src/core/action-queue.d.ts +31 -0
  26. package/dist/src/core/action-queue.js +69 -0
  27. package/dist/src/core/attempt.d.ts +25 -0
  28. package/dist/src/core/attempt.js +41 -0
  29. package/dist/src/core/conductor.d.ts +236 -0
  30. package/dist/src/core/conductor.js +1293 -0
  31. package/dist/src/core/host-key.d.ts +19 -0
  32. package/dist/src/core/host-key.js +27 -0
  33. package/dist/src/core/inbox-runtime.d.ts +48 -0
  34. package/dist/src/core/inbox-runtime.js +180 -0
  35. package/dist/src/core/mr-changes.d.ts +18 -0
  36. package/dist/src/core/mr-changes.js +47 -0
  37. package/dist/src/index.d.ts +8 -0
  38. package/dist/src/index.js +27 -0
  39. package/dist/src/plugins/agent-args.d.ts +43 -0
  40. package/dist/src/plugins/agent-args.js +221 -0
  41. package/dist/src/plugins/agent.d.ts +121 -0
  42. package/dist/src/plugins/agent.js +12 -0
  43. package/dist/src/plugins/executor.d.ts +182 -0
  44. package/dist/src/plugins/executor.js +1 -0
  45. package/dist/src/plugins/message.d.ts +61 -0
  46. package/dist/src/plugins/message.js +47 -0
  47. package/dist/src/plugins/plugins.d.ts +96 -0
  48. package/dist/src/plugins/plugins.js +120 -0
  49. package/dist/src/plugins/preset.d.ts +61 -0
  50. package/dist/src/plugins/preset.js +23 -0
  51. package/dist/src/plugins/process-host.d.ts +7 -0
  52. package/dist/src/plugins/process-host.js +1 -0
  53. package/dist/src/plugins/remote.d.ts +420 -0
  54. package/dist/src/plugins/remote.js +1 -0
  55. package/dist/src/plugins/workspace.d.ts +69 -0
  56. package/dist/src/plugins/workspace.js +1 -0
  57. package/dist/src/preset.d.ts +2 -0
  58. package/dist/src/preset.js +8 -0
  59. package/dist/src/types.d.ts +132 -0
  60. package/dist/src/types.js +6 -0
  61. package/package.json +38 -4
@@ -0,0 +1,132 @@
1
+ import type { AgentRoutes } from '@bakers-build/core';
2
+ import type { DropSHPlugin } from 'dropsh/plugin';
3
+ import type { ResolvedBbProjectContext } from './bakers-project-context.js';
4
+ import type { BbProjectSelection } from './cli/project-context.js';
5
+ import type { HookListener } from './plugins/executor.js';
6
+ import type { LoadedInbox } from './plugins/message.js';
7
+ import type { AgentCandidate, ExecutorPlugin, RemotePlugin, ResolvedAgent, WorkspacePlugin } from './plugins/plugins.js';
8
+ import type { HerdrHost } from './plugins/process-host.js';
9
+ import type { Ticket } from './plugins/remote.js';
10
+ /** Normalized single conductor. */
11
+ export interface ConductorSettings {
12
+ /** Default: `${project} @ ${checkoutRoot}`. */
13
+ label: string;
14
+ /**
15
+ * Stable conductor registration key (bb_conductor.conductor_id). Composed
16
+ * as `${user_id}-${host}-${project}` from the machine context. Set it to pin
17
+ * a conductor to a known identity — e.g. so a ticket can be pre-assigned to
18
+ * it (conductor assignment is the run-start trigger).
19
+ */
20
+ conductor_id?: string;
21
+ /**
22
+ * @deprecated BB-353 — alias for `conductor_id` during cutover.
23
+ */
24
+ machine_id?: string;
25
+ /** Project name (bb_project.name); resolved at registration. */
26
+ project: string;
27
+ /**
28
+ * Workflow states this conductor serves. An empty list means it serves every
29
+ * claimable state in its project; a non-empty list narrows it to those
30
+ * states (BB-207).
31
+ */
32
+ states: string[];
33
+ /**
34
+ * Agent prompt template - the bakers.build run contract, NOT project workflow. Bounds
35
+ * the agent to exactly one state and tells it to release + stop, keeping run
36
+ * mechanics out of the repo's WORKFLOW.md. Placeholders: `{identifier}`,
37
+ * `{state}`, `{runUuid}`. Defaults to `DEFAULT_AGENT_PROMPT`.
38
+ */
39
+ prompt: string;
40
+ /**
41
+ * Host concurrent-run budget. Sourced from machine context max_parallel
42
+ * (BB-353); engine-config leftovers are ignored with a warning.
43
+ */
44
+ max_parallel: number;
45
+ /**
46
+ * Machine preview-link policy. True when `machine.config.js` sets `tunnel: true`.
47
+ * Runtime-derived; ticket and project env cannot override it.
48
+ */
49
+ tunnel?: boolean;
50
+ /**
51
+ * Host identity stem (bb_machine.host_key). Sourced from
52
+ * MachineContext.machine_id — not derived by hyphen-splitting conductor_id
53
+ * (that mis-parses when project or host segments contain hyphens).
54
+ */
55
+ host_key?: string;
56
+ poll_interval_ms: number;
57
+ lease_seconds: number;
58
+ /**
59
+ * Whether to upload the agent transcript at finalize. Default true.
60
+ *
61
+ * Turning it off keeps this conductor's runs out of the log store entirely —
62
+ * for a machine whose transcripts are large, uninteresting, or subject to a
63
+ * local policy. Metrics are unaffected: the footprint is derived from the
64
+ * agent's own session files in this process, never from the uploaded log.
65
+ *
66
+ * Client-side by design. It lets an operator opt out; it is not a policy the
67
+ * server enforces, so a conductor running an older build still uploads.
68
+ */
69
+ capture_logs?: boolean;
70
+ /** Project shell commands, one per slot; run after the addon listeners. */
71
+ hooks?: {
72
+ after_create?: string;
73
+ before_run?: string;
74
+ after_run?: string;
75
+ after_done?: string;
76
+ /** Runs once in a ticket's worktree when a poll sees it frozen. */
77
+ on_freeze?: string;
78
+ /** Runs once in a ticket's worktree when a poll sees it unfrozen. */
79
+ on_resume?: string;
80
+ };
81
+ /** Control-plane site settings used for dropsh and agent env. */
82
+ site: {
83
+ base_url: string;
84
+ jsonapi_prefix: string;
85
+ };
86
+ /** Absolute path of the loaded config. */
87
+ config_path: string;
88
+ }
89
+ /** Whole conductor.config.js (dropsh-superset): site + named plugin slots. */
90
+ export interface ConductorFileConfig extends ConductorSettings {
91
+ bakers: BbProjectSelection;
92
+ resolved_bakers?: ResolvedBbProjectContext;
93
+ remote: RemotePlugin;
94
+ executor: ExecutorPlugin;
95
+ /** Effective addon-derived catalog after machine overlays and filters. */
96
+ agents: AgentCandidate[];
97
+ enabled_agents: string[];
98
+ disabled_agents: string[];
99
+ default_agent: string;
100
+ routes: AgentRoutes;
101
+ /** Replaces the shipped label/default resolution for this project. */
102
+ selectAgent?: (candidates: ResolvedAgent[], ticket: Ticket) => ResolvedAgent;
103
+ workspace: WorkspacePlugin;
104
+ /**
105
+ * Addon lifecycle listeners from the conductor `addons[]` `hooks`
106
+ * accumulator (BB-599), validated at load. Kept apart from the shell
107
+ * `hooks` strings. Absent means none.
108
+ */
109
+ hookListeners?: HookListener[];
110
+ /**
111
+ * Addons with contract-2 inbox messages from the conductor `addons[]`,
112
+ * validated at load (BB-661). Absent means none.
113
+ */
114
+ inboxAddons?: LoadedInbox[];
115
+ /**
116
+ * Conductor process host from the `processHosts` accumulator (last wins).
117
+ * Absent when no addon contributed one — `bakers oven start` then fails
118
+ * with the existing no-herdr hint.
119
+ */
120
+ processHost?: HerdrHost;
121
+ /** dropsh-layer plugins (auth etc.); separate from the bakers.build slots. */
122
+ plugins?: DropSHPlugin[];
123
+ }
124
+ /**
125
+ * BB-201 split config model: the ENGINE half of a conductor config —
126
+ * everything a `conductor.config.js` carries EXCEPT the connection (`site`) and
127
+ * the auth `plugins`, which now live in a separate `bakers.config.js`
128
+ * (`BbConnectionConfig`). `loadConductorConfig` returns this; the conductor
129
+ * command composes it with the connection (`composeConductorConfig`) into the
130
+ * full `ConductorFileConfig` the engine consumes.
131
+ */
132
+ export type ConductorEngineConfig = Omit<ConductorFileConfig, 'site' | 'plugins'>;
@@ -0,0 +1,6 @@
1
+ // BB-224 (Finding 6, decision 6): the conductor CONFIG CONTRACT lives here, in
2
+ // `@bakers-build/conductor`, not in `@bakers-build/core`. It is typed BY the
3
+ // conductor-surface plugin interfaces (`remote: RemotePlugin`, …), so it had to
4
+ // move with them — otherwise the surface-agnostic kernel would have to edge the
5
+ // engine, violating the acyclic rule "core has zero @bakers-build/* edges".
6
+ export {};
package/package.json CHANGED
@@ -1,6 +1,40 @@
1
1
  {
2
2
  "name": "@bakers-build/conductor",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0-next.42",
4
+ "description": "bakers.build conductor engine + CLI: registers, claims tickets via JSON:API, dispatches agents.",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "engines": {
8
+ "node": ">=20.19"
9
+ },
10
+ "exports": {
11
+ ".": "./dist/src/index.js",
12
+ "./contract": "./dist/src/contract.js",
13
+ "./preset": "./dist/src/preset.js",
14
+ "./commands/conductor": "./dist/src/commands/conductor.js",
15
+ "./project-context": "./dist/src/cli/project-context.js",
16
+ "./package.json": "./package.json",
17
+ "./config": "./dist/src/cli/config-plan.js"
18
+ },
19
+ "files": [
20
+ "dist/src",
21
+ "README.md",
22
+ "LICENSE"
23
+ ],
24
+ "publishConfig": {
25
+ "access": "public"
26
+ },
27
+ "repository": {
28
+ "type": "git",
29
+ "url": "git+https://git.key-tec.de/bakers-build/bakers-build.git",
30
+ "directory": "bakers-cli/conductor"
31
+ },
32
+ "dependencies": {
33
+ "@dropsh/plugin-jsonapi-schema": "^0.7.1",
34
+ "@dropsh/plugin-oauth2": "^0.7.5",
35
+ "@bakers-build/core": "^0.1.0-next.42",
36
+ "@bakers-build/message": "^0.1.0-next.42",
37
+ "commander": "^12.1.0",
38
+ "dropsh": "^0.7.5"
39
+ }
40
+ }