@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,109 @@
1
+ import { type BbConnectionConfig } from '@bakers-build/core';
2
+ import type { AgentCandidate } from './plugins/plugins.js';
3
+ import type { ConductorEngineConfig, ConductorFileConfig } from './types.js';
4
+ export { findBbDir, resolveConfigPath, } from '@bakers-build/core';
5
+ /**
6
+ * Default agent prompt - the project instruction contract. One run works EXACTLY one state;
7
+ * the agent must stop instead of running the whole flow in one session. The run
8
+ * is closed automatically when the ticket state changes on the next claim - the
9
+ * agent does not release it. Run mechanics live here (not in the repo's
10
+ * WORKFLOW.md). The prompt points directly at the matching project-owned state
11
+ * section and does not prescribe an agent skill. A conductor config may override
12
+ * it via the `prompt` field.
13
+ *
14
+ * The ticket + its comments are NOT embedded (BB-112): embedding unbounded
15
+ * ticket content into a single typed pane line overran the PTY canonical line
16
+ * cap and truncated the dispatch command. Instead the prompt is a bounded,
17
+ * constant-size pointer and the agent reads the ticket + all comments at run
18
+ * start via `bakers dropsh read … --include comments`.
19
+ *
20
+ * herdr no longer types this into the pane: the launch command goes to a file
21
+ * that a short `sh '<file>'` line runs (BB-635), so its length is not bound
22
+ * by the tty canonical cap (macOS 1024 B, Linux 4096 B). The prompt is still
23
+ * kept single-line (BB-128 test).
24
+ * Placeholders: `{identifier}`, `{state}`, `{runUuid}` ({state} falls back to
25
+ * `qualification` for unclassified tickets).
26
+ *
27
+ * WHERE THE PROMPT SENDS THE AGENT, and why it no longer names a WORKFLOW.md
28
+ * section. This used to say `execute only its ordered "State: {state}" section`,
29
+ * which described the pre-BB-204 loader: WORKFLOW.md then carried one ordered
30
+ * `## State: <state>` section per state. BB-204 replaced that with a pure
31
+ * loader — WORKFLOW.md lists skills, each skill self-declares the
32
+ * `(work_type, workflow, step)` triple it owns, and the step's flow lives in the
33
+ * skill. No project's WORKFLOW.md has carried a `State:` section since.
34
+ *
35
+ * The prompt kept pointing at one anyway, and that is not cosmetic: a dispatched
36
+ * agent that reads the instruction literally finds no such section and STOPS.
37
+ * Observed on a fixture run — "WORKFLOW.md has no ordered State: spec section;
38
+ * it instead declares skill-based routing. Stopped at this configuration
39
+ * mismatch." Agents that completed runs were working around the prompt rather
40
+ * than following it, which is why this survived so long: it failed silently and
41
+ * only against the most literal readers.
42
+ */
43
+ export declare const DEFAULT_AGENT_PROMPT: string;
44
+ /**
45
+ * Resolve the `agent` slot into candidate(s), **preserving the authored shape**:
46
+ * a single descriptor/plugin/wrapper → a single `AgentCandidate`, an array →
47
+ * `AgentCandidate[]`. Each entry is either a bare descriptor/plugin or a
48
+ * `{ agent, priority? }` wrapper; the inner agent value is resolved through the
49
+ * same `agent` kind-guard as any slot, and a `priority` function is preserved
50
+ * verbatim (AC-1, AC-2). Normalization to a list happens at selection time.
51
+ */
52
+ export declare function resolveAgents(raw: unknown, configPath: string): Promise<AgentCandidate | AgentCandidate[]>;
53
+ /**
54
+ * Load the ENGINE half of a conductor config (BB-201 split model). Reads
55
+ * remote/executor/agent/workspace + project/states/machine_id/label/prompt/
56
+ * scheduler/hooks — and deliberately NOT `site` or the auth `plugins`, which now
57
+ * live in a `bakers.config.js` connection config. The conductor command composes
58
+ * the two via `composeConductorConfig`. A legacy `conductor.config.js` still
59
+ * carrying `site`/`plugins` loads fine — those two keys are simply ignored here
60
+ * (the connection loader reads them, back-compat).
61
+ */
62
+ export declare function loadConductorConfig(configFile: string): Promise<ConductorEngineConfig>;
63
+ /**
64
+ * Compose the full `ConductorFileConfig` the engine consumes from the engine
65
+ * half (`loadConductorConfig`) and the connection half (`loadBbConfig`). The
66
+ * connection supplies `site` + the auth `plugins`; `ensureAuthenticated` /
67
+ * `selectRemote` read them exactly as before — the fields just arrive from
68
+ * `bakers.config.js` now.
69
+ */
70
+ export declare function composeConductorConfig(engine: ConductorEngineConfig, connection: Pick<BbConnectionConfig, 'site' | 'plugins'>): ConductorFileConfig;
71
+ /**
72
+ * The conductor **stems** in a `.bakers/` dir — the file naming predicate of
73
+ * BB-137: exactly `conductor.config.js` (stem `conductor`) or
74
+ * `<variant>.conductor.config.js` (stem `<variant>`). The resolution itself
75
+ * lives in `@bakers-build/core` (re-exported above); this is the enumeration.
76
+ */
77
+ export declare function configStems(bakersDir: string): string[];
78
+ /** Map a conductor stem back to its file name. */
79
+ export declare function fileForStem(stem: string): string;
80
+ /**
81
+ * List the conductor-config **file names** in a `.bakers/` dir, using the same
82
+ * naming predicate the loader uses (`configStems`). This is the only supported
83
+ * enumeration for the `@bakers-build/upgrade-project` states-strip: it visits the
84
+ * default `conductor.config.js` + every `<variant>.conductor.config.js`, and
85
+ * never an unrelated JS config (`vite.config.js`, the near-miss
86
+ * `myconductor.config.js`).
87
+ */
88
+ export declare function listConductorConfigFiles(bakersDir: string): string[];
89
+ /**
90
+ * Remove the obsolete `states:` array property from a conductor-config JS
91
+ * source (BB-207 made `states` optional — empty ⇒ serve all claimable
92
+ * states — so `@bakers-build/upgrade-project` drops the now-dead key). Pure string
93
+ * transform: it strips the `states: [ ... ]` property (line form or inline in
94
+ * an object literal) with its trailing comma, and rewrites nothing else. A
95
+ * `substates:`/other key containing "states" is not matched.
96
+ */
97
+ export declare function stripStatesFromConfigSource(source: string): string;
98
+ /**
99
+ * Strip the `site:` and `plugins:` properties from an engine config's
100
+ * `export default { … }` (with their leading comment/whitespace), plus the
101
+ * now-orphaned connection preamble consts. Returns the rewritten source and the
102
+ * list of object keys removed (`[]` — source returned unchanged — when there is
103
+ * nothing connection-related to remove). remote/executor/agent/workspace/hooks/
104
+ * project/machine_id/loadLocal are left intact.
105
+ */
106
+ export declare function stripLegacyConnectionFromConfigSource(source: string): {
107
+ text: string;
108
+ removed: string[];
109
+ };