@bluewombat/conductor 0.9.0 → 0.10.0

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,6 +1,8 @@
1
1
  import type { CommandResult, WorkLedger } from "@bluewombat/work-ledger";
2
2
  import type { AuthorityPort, TransformerPort } from "../transformers/port.js";
3
- export type ConductorRefusalCode = "stable-missing" | "root-invalid" | "persist-failed" | "interrupted" | "isolate-failed" | "warm-failed" | "align-conflict" | "transformer-invalid" | "unavailable" | "not-found" | "point-of-no-return" | "project-busy" | "illegal-transition";
3
+ import type { ProjectRunResult } from "./results.js";
4
+ export type { ConductorRefusalCode, ProjectRunResult } from "./results.js";
5
+ export { foldMessageOf, subjectOf } from "./subject.js";
4
6
  /** Prepare a Ticket workspace after Isolation — install deps, and so on. */
5
7
  export type WarmOutcome = "warmed" | "failed" | "interrupted" | "invalid-invocation";
6
8
  export type WarmPort = {
@@ -11,20 +13,18 @@ export type WarmPort = {
11
13
  outcome: WarmOutcome;
12
14
  }>;
13
15
  };
14
- export type ProjectRunResult = {
15
- outcome: "idle";
16
- } | {
17
- outcome: "done";
18
- key: string;
19
- } | {
20
- outcome: "escalated";
21
- key: string;
22
- } | {
23
- outcome: "paused";
24
- key?: string;
25
- } | {
26
- outcome: "refused";
27
- code: ConductorRefusalCode;
16
+ /**
17
+ * Bring the shared copy of the work line up to what the Authority holds, for
18
+ * the line `target` names. Conductor asks right before it reads the copy, so a
19
+ * ticket always starts from, and aligns with, the line as it is now.
20
+ */
21
+ export type LinePort = {
22
+ refresh(target: string): Promise<{
23
+ ok: true;
24
+ } | {
25
+ ok: false;
26
+ detail?: string;
27
+ }>;
28
28
  };
29
29
  export type OpenConductorOptions = {
30
30
  ledger: WorkLedger;
@@ -32,6 +32,18 @@ export type OpenConductorOptions = {
32
32
  workLineStable: string;
33
33
  workspaceRoot: string;
34
34
  transformerDurationMs?: number;
35
+ /**
36
+ * How many Tickets of a Project may be active at once. Default 1.
37
+ *
38
+ * Above 1 the Project needs an Authority: a Ticket folded straight into the
39
+ * work line would move it under the others with nobody to send them back.
40
+ */
41
+ maxParallel?: number;
42
+ /**
43
+ * Keeps the shared copy of the work line current. Absent: it is whatever its
44
+ * owner left, as before.
45
+ */
46
+ line?: LinePort;
35
47
  /**
36
48
  * The outside judge of a Submission. Absent: an assembled ticket is folded
37
49
  * into the work line directly, with nobody else asked.
@@ -44,17 +56,24 @@ export type OpenConductorOptions = {
44
56
  /**
45
57
  * Whether a local judge decides if the assembled ticket meets the
46
58
  * intention, before any Submission exists — or, without an Authority,
47
- * before the final fold. Absent or `false`: `assembly.validate` is not
59
+ * before the final fold. Absent or `false`: `validate` is not
48
60
  * declared, and `integrating` goes straight to offer (or the local judge on
49
61
  * `produce: false`).
50
62
  */
51
- assemblyValidate?: boolean;
63
+ validate?: boolean;
52
64
  /**
53
- * Whether `assembly.fix` is declared. A validate refusal with nothing to
65
+ * Whether the tests of a Task are written before its code. Then a pass of its
66
+ * own runs in the Ticket's workspace first, and what it wrote is committed as a
67
+ * checkpoint, so the producer's work is what comes after it. Absent or `false`:
68
+ * the producer makes the code and the tests together, as before.
69
+ */
70
+ tests?: boolean;
71
+ /**
72
+ * Whether a fix is declared. A validate refusal with nothing to
54
73
  * repair it escalates on the spot rather than spending the budget on a round
55
74
  * that can only repeat the same refusal.
56
75
  */
57
- assemblyFixDeclared?: boolean;
76
+ fixDeclared?: boolean;
58
77
  /**
59
78
  * Told at the moments a pass changes what an outsider would want to know:
60
79
  * the work is submitted. Awaited,
@@ -83,6 +102,19 @@ export type Conductor = {
83
102
  pause(): void;
84
103
  resume(): void;
85
104
  runProject(project: string): Promise<ProjectRunResult>;
105
+ /**
106
+ * Take the next Ticket of the Project that may start, within its parallel
107
+ * limit. Nothing is run. Absent when none may: the Project is full, or
108
+ * nothing is ready or unblocked.
109
+ */
110
+ claimNext(project: string): Promise<{
111
+ key: string;
112
+ } | undefined>;
113
+ /**
114
+ * Drive one Ticket the Project already holds, as far as it goes. Unlike
115
+ * `runProject` it neither claims nor reconciles, so several can run at once.
116
+ */
117
+ runTicket(key: string): Promise<ProjectRunResult>;
86
118
  cancel(key: string): Promise<CommandResult>;
87
119
  /**
88
120
  * Drop a held unit without waiting for the bail clock.
@@ -90,16 +122,5 @@ export type Conductor = {
90
122
  */
91
123
  release(key: string): Promise<CommandResult>;
92
124
  };
93
- /**
94
- * A fold's subject out of prose. Text written the way a commit is — a headline,
95
- * a blank line, the rest — gives its headline. Otherwise the first sentence,
96
- * cut at a word when even that runs past what one line of history shows. A
97
- * subject is not markdown, so the backticks prose uses for names come off; and
98
- * it ends on a word, not on an ellipsis — the whole text follows in the body
99
- * for whoever wants it.
100
- */
101
- export declare function subjectOf(text: string): string;
102
- /** Subject line, then the whole text when the subject did not carry it all. */
103
- export declare function foldMessageOf(text: string): string;
104
125
  export declare function openConductor(options: OpenConductorOptions): Conductor;
105
126
  //# sourceMappingURL=open-conductor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"open-conductor.d.ts","sourceRoot":"","sources":["../../src/run/open-conductor.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,aAAa,EAGb,UAAU,EACX,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EACV,aAAa,EAGb,eAAe,EAChB,MAAM,yBAAyB,CAAC;AAMjC,MAAM,MAAM,oBAAoB,GAC5B,gBAAgB,GAChB,cAAc,GACd,gBAAgB,GAChB,aAAa,GACb,gBAAgB,GAChB,aAAa,GACb,gBAAgB,GAChB,qBAAqB,GACrB,aAAa,GACb,WAAW,GACX,oBAAoB,GACpB,cAAc,GACd,oBAAoB,CAAC;AAEzB,4EAA4E;AAC5E,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,QAAQ,GAAG,aAAa,GAAG,oBAAoB,CAAC;AAErF,MAAM,MAAM,QAAQ,GAAG;IACrB,OAAO,CAAC,KAAK,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,M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