@enderfga/claw-orchestrator 5.1.0 → 6.0.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.
- package/README.md +26 -26
- package/dist/bin/cli.js +107 -1
- package/dist/bin/cli.js.map +1 -1
- package/dist/src/acp-server.d.ts +5 -5
- package/dist/src/acp-server.js +3 -3
- package/dist/src/acp-server.js.map +1 -1
- package/dist/src/autoloop/dispatcher.d.ts +22 -0
- package/dist/src/autoloop/dispatcher.js +71 -13
- package/dist/src/autoloop/dispatcher.js.map +1 -1
- package/dist/src/autoloop/messages.d.ts +10 -0
- package/dist/src/autoloop/messages.js.map +1 -1
- package/dist/src/autoloop/runner.js +6 -0
- package/dist/src/autoloop/runner.js.map +1 -1
- package/dist/src/constants.d.ts +0 -6
- package/dist/src/constants.js +0 -6
- package/dist/src/constants.js.map +1 -1
- package/dist/src/council.d.ts +15 -0
- package/dist/src/council.js +48 -35
- package/dist/src/council.js.map +1 -1
- package/dist/src/dashboard/index.html +191 -6
- package/dist/src/embedded-server.js +132 -9
- package/dist/src/embedded-server.js.map +1 -1
- package/dist/src/fanout.d.ts +30 -1
- package/dist/src/fanout.js +32 -3
- package/dist/src/fanout.js.map +1 -1
- package/dist/src/index.js +359 -4
- package/dist/src/index.js.map +1 -1
- package/dist/src/kernel/agent-step.d.ts +59 -0
- package/dist/src/kernel/agent-step.js +100 -0
- package/dist/src/kernel/agent-step.js.map +1 -0
- package/dist/src/kernel/conditions.d.ts +11 -0
- package/dist/src/kernel/conditions.js +24 -0
- package/dist/src/kernel/conditions.js.map +1 -0
- package/dist/src/kernel/engine.d.ts +319 -0
- package/dist/src/kernel/engine.js +1047 -0
- package/dist/src/kernel/engine.js.map +1 -0
- package/dist/src/kernel/exec.d.ts +43 -0
- package/dist/src/kernel/exec.js +112 -0
- package/dist/src/kernel/exec.js.map +1 -0
- package/dist/src/kernel/file-lock.d.ts +50 -0
- package/dist/src/kernel/file-lock.js +135 -0
- package/dist/src/kernel/file-lock.js.map +1 -0
- package/dist/src/kernel/nodes/agent.d.ts +4 -0
- package/dist/src/kernel/nodes/agent.js +35 -0
- package/dist/src/kernel/nodes/agent.js.map +1 -0
- package/dist/src/kernel/nodes/autoloop.d.ts +78 -0
- package/dist/src/kernel/nodes/autoloop.js +75 -0
- package/dist/src/kernel/nodes/autoloop.js.map +1 -0
- package/dist/src/kernel/nodes/council.d.ts +12 -0
- package/dist/src/kernel/nodes/council.js +88 -0
- package/dist/src/kernel/nodes/council.js.map +1 -0
- package/dist/src/kernel/nodes/fanout.d.ts +11 -0
- package/dist/src/kernel/nodes/fanout.js +63 -0
- package/dist/src/kernel/nodes/fanout.js.map +1 -0
- package/dist/src/kernel/nodes/human-gate.d.ts +4 -0
- package/dist/src/kernel/nodes/human-gate.js +7 -0
- package/dist/src/kernel/nodes/human-gate.js.map +1 -0
- package/dist/src/kernel/nodes/index.d.ts +12 -0
- package/dist/src/kernel/nodes/index.js +21 -0
- package/dist/src/kernel/nodes/index.js.map +1 -0
- package/dist/src/kernel/nodes/router.d.ts +4 -0
- package/dist/src/kernel/nodes/router.js +12 -0
- package/dist/src/kernel/nodes/router.js.map +1 -0
- package/dist/src/kernel/nodes/subflow.d.ts +13 -0
- package/dist/src/kernel/nodes/subflow.js +38 -0
- package/dist/src/kernel/nodes/subflow.js.map +1 -0
- package/dist/src/kernel/nodes/ultraapp.d.ts +60 -0
- package/dist/src/kernel/nodes/ultraapp.js +62 -0
- package/dist/src/kernel/nodes/ultraapp.js.map +1 -0
- package/dist/src/kernel/nodes/verifier.d.ts +14 -0
- package/dist/src/kernel/nodes/verifier.js +84 -0
- package/dist/src/kernel/nodes/verifier.js.map +1 -0
- package/dist/src/kernel/projections.d.ts +42 -0
- package/dist/src/kernel/projections.js +133 -0
- package/dist/src/kernel/projections.js.map +1 -0
- package/dist/src/kernel/repo.d.ts +13 -0
- package/dist/src/kernel/repo.js +64 -0
- package/dist/src/kernel/repo.js.map +1 -0
- package/dist/src/kernel/secrets.d.ts +25 -0
- package/dist/src/kernel/secrets.js +48 -0
- package/dist/src/kernel/secrets.js.map +1 -0
- package/dist/src/kernel/store.d.ts +225 -0
- package/dist/src/kernel/store.js +838 -0
- package/dist/src/kernel/store.js.map +1 -0
- package/dist/src/kernel/templates/index.d.ts +140 -0
- package/dist/src/kernel/templates/index.js +266 -0
- package/dist/src/kernel/templates/index.js.map +1 -0
- package/dist/src/kernel/types.d.ts +326 -0
- package/dist/src/kernel/types.js +19 -0
- package/dist/src/kernel/types.js.map +1 -0
- package/dist/src/run-ledger.d.ts +57 -3
- package/dist/src/run-ledger.js +45 -2
- package/dist/src/run-ledger.js.map +1 -1
- package/dist/src/session-manager.d.ts +176 -129
- package/dist/src/session-manager.js +652 -603
- package/dist/src/session-manager.js.map +1 -1
- package/dist/src/types.d.ts +33 -3
- package/dist/src/ultraapp/build.d.ts +117 -3
- package/dist/src/ultraapp/build.js +319 -3
- package/dist/src/ultraapp/build.js.map +1 -1
- package/dist/src/ultraapp/contract.d.ts +52 -0
- package/dist/src/ultraapp/contract.js +83 -0
- package/dist/src/ultraapp/contract.js.map +1 -0
- package/dist/src/ultraapp/conventions.js +9 -2
- package/dist/src/ultraapp/conventions.js.map +1 -1
- package/dist/src/ultraapp/fix-on-failure.d.ts +21 -2
- package/dist/src/ultraapp/fix-on-failure.js +46 -62
- package/dist/src/ultraapp/fix-on-failure.js.map +1 -1
- package/dist/src/ultraapp/manager.d.ts +107 -2
- package/dist/src/ultraapp/manager.js +305 -86
- package/dist/src/ultraapp/manager.js.map +1 -1
- package/dist/src/verify/baseline.d.ts +73 -0
- package/dist/src/verify/baseline.js +186 -0
- package/dist/src/verify/baseline.js.map +1 -0
- package/dist/src/verify/contract.d.ts +116 -0
- package/dist/src/verify/contract.js +142 -0
- package/dist/src/verify/contract.js.map +1 -0
- package/dist/src/verify/evidence.d.ts +61 -0
- package/dist/src/verify/evidence.js +133 -0
- package/dist/src/verify/evidence.js.map +1 -0
- package/dist/src/verify/runner.d.ts +63 -0
- package/dist/src/verify/runner.js +317 -0
- package/dist/src/verify/runner.js.map +1 -0
- package/openclaw.plugin.json +8 -0
- package/package.json +2 -2
- package/skills/SKILL.md +120 -79
- package/skills/references/acp.md +17 -17
- package/skills/references/autoloop.md +139 -65
- package/skills/references/claude-cli-tracking.md +4 -4
- package/skills/references/cli.md +101 -59
- package/skills/references/council.md +109 -37
- package/skills/references/dashboard.md +34 -6
- package/skills/references/getting-started.md +13 -13
- package/skills/references/inbox.md +4 -4
- package/skills/references/mcp.md +39 -34
- package/skills/references/multi-engine.md +51 -47
- package/skills/references/observability.md +88 -28
- package/skills/references/openai-compat.md +39 -39
- package/skills/references/sessions.md +43 -25
- package/skills/references/tools.md +402 -309
- package/skills/references/ultra.md +45 -45
- package/skills/references/ultraapp.md +126 -50
- package/skills/references/verification.md +187 -0
- package/skills/references/workflow.md +362 -0
- package/dist/src/ultraapp/fix-on-failure-session.d.ts +0 -23
- package/dist/src/ultraapp/fix-on-failure-session.js +0 -51
- package/dist/src/ultraapp/fix-on-failure-session.js.map +0 -1
|
@@ -1,76 +1,60 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* Run the verification pipeline in a worktree, spawn a session to fix mechanical
|
|
3
|
+
* errors on red, retry up to N rounds.
|
|
4
|
+
*
|
|
5
|
+
* As of 6.0.0 this is an adapter over `src/verify/`, not its own runner. The
|
|
6
|
+
* logic it used to own — ordered steps, exit-code gating, byte-capped tails, the
|
|
7
|
+
* fix loop — moved out to become mode-agnostic, and came back with the two
|
|
8
|
+
* things it was missing: a per-step timeout (a wedged `npm test` used to hang
|
|
9
|
+
* the pipeline forever) and an honoured `required` flag (the field was declared
|
|
10
|
+
* here and never read, so every step was fatal).
|
|
4
11
|
*
|
|
5
12
|
* Not to be confused with src/autoloop/, which is a planner/coder/reviewer
|
|
6
13
|
* message-bus orchestrator for a different problem shape.
|
|
7
14
|
*/
|
|
8
|
-
import
|
|
9
|
-
|
|
15
|
+
import path from 'node:path';
|
|
16
|
+
import os from 'node:os';
|
|
17
|
+
import { runContract } from '../verify/runner.js';
|
|
18
|
+
const TEN_MIN = 10 * 60_000;
|
|
19
|
+
export const DEFAULT_STEPS = [
|
|
10
20
|
{ cmd: 'npm', args: ['install'] },
|
|
11
21
|
{ cmd: 'npm', args: ['run', 'build'] },
|
|
12
22
|
{ cmd: 'npm', args: ['test'] },
|
|
13
23
|
{ cmd: 'docker', args: ['build', '-t', 'ultraapp-fix:test', '.'] },
|
|
14
24
|
];
|
|
15
|
-
|
|
16
|
-
export
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
if (failure === null)
|
|
24
|
-
return { ok: true, rounds };
|
|
25
|
-
if (rounds >= args.maxRounds) {
|
|
26
|
-
return {
|
|
27
|
-
ok: false,
|
|
28
|
-
rounds,
|
|
29
|
-
lastError: failure.lastError,
|
|
30
|
-
failingCommand: failure.failingCommand,
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
rounds++;
|
|
34
|
-
await spawnFixer({
|
|
35
|
-
worktreePath: args.worktreePath,
|
|
36
|
-
failingCommand: failure.failingCommand,
|
|
37
|
-
tail: failure.tail,
|
|
38
|
-
});
|
|
39
|
-
}
|
|
25
|
+
/** Translate the legacy step list into contract checks, `required` included this time. */
|
|
26
|
+
export function stepsToContract(steps, fixOnFailureRounds) {
|
|
27
|
+
const checks = steps.map((s, i) => ({
|
|
28
|
+
id: `${s.cmd}-${i + 1}`,
|
|
29
|
+
spec: { type: 'command', cmd: s.cmd, args: s.args, timeoutMs: s.timeoutMs ?? TEN_MIN },
|
|
30
|
+
required: s.required !== false,
|
|
31
|
+
}));
|
|
32
|
+
return { id: 'fix-on-failure', checks, fixOnFailureRounds };
|
|
40
33
|
}
|
|
41
|
-
async function
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
34
|
+
export async function runFixOnFailure(args) {
|
|
35
|
+
const contract = args.contract ?? stepsToContract(args.steps ?? DEFAULT_STEPS, args.maxRounds);
|
|
36
|
+
const spawnFixer = args.spawnFixer
|
|
37
|
+
? ({ cwd, failingCheck, tail }) => args.spawnFixer({ worktreePath: cwd, failingCommand: failingCheck, tail })
|
|
38
|
+
: undefined;
|
|
39
|
+
const { results, passed, rounds } = await runContract({ ...contract, fixOnFailureRounds: args.maxRounds }, {
|
|
40
|
+
cwd: args.worktreePath,
|
|
41
|
+
artifactDir: args.artifactDir ?? path.join(os.tmpdir(), 'clawo-fix-artifacts'),
|
|
42
|
+
exec: args.shell ? shellToExec(args.shell) : undefined,
|
|
43
|
+
}, spawnFixer);
|
|
44
|
+
const failing = results.find((r) => r.required && !r.passed);
|
|
45
|
+
return {
|
|
46
|
+
ok: passed,
|
|
47
|
+
rounds,
|
|
48
|
+
lastError: failing ? (failing.tail ?? failing.detail).slice(0, 500) : undefined,
|
|
49
|
+
failingCommand: failing?.detail,
|
|
50
|
+
results,
|
|
51
|
+
};
|
|
55
52
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
53
|
+
/** Keep the injectable `ShellRunner` seam callers already depend on. */
|
|
54
|
+
function shellToExec(shell) {
|
|
55
|
+
return async (cmd, cmdArgs, opts) => {
|
|
56
|
+
const r = await shell(cmd, cmdArgs, { cwd: opts.cwd ?? process.cwd() });
|
|
57
|
+
return { code: r.ok ? 0 : 1, out: r.stdout, err: r.stderr, timedOut: false, durationMs: 0 };
|
|
58
|
+
};
|
|
62
59
|
}
|
|
63
|
-
const realShell = (cmd, args, opts) => new Promise((resolve) => {
|
|
64
|
-
const child = spawn(cmd, args, { cwd: opts.cwd, stdio: ['ignore', 'pipe', 'pipe'] });
|
|
65
|
-
let stdout = '';
|
|
66
|
-
let stderr = '';
|
|
67
|
-
child.stdout.on('data', (d) => (stdout = appendCapped(stdout, d.toString())));
|
|
68
|
-
child.stderr.on('data', (d) => (stderr = appendCapped(stderr, d.toString())));
|
|
69
|
-
child.on('close', (code) => resolve({ ok: code === 0, stdout, stderr }));
|
|
70
|
-
child.on('error', (e) => resolve({ ok: false, stdout, stderr: stderr + e.message }));
|
|
71
|
-
});
|
|
72
|
-
const defaultSpawnFixer = async (args) => {
|
|
73
|
-
const { spawnFixerSession } = await import('./fix-on-failure-session.js');
|
|
74
|
-
await spawnFixerSession(args);
|
|
75
|
-
};
|
|
76
60
|
//# sourceMappingURL=fix-on-failure.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fix-on-failure.js","sourceRoot":"","sources":["../../../src/ultraapp/fix-on-failure.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"fix-on-failure.js","sourceRoot":"","sources":["../../../src/ultraapp/fix-on-failure.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,WAAW,EAA2C,MAAM,qBAAqB,CAAC;AAyC3F,MAAM,OAAO,GAAG,EAAE,GAAG,MAAM,CAAC;AAE5B,MAAM,CAAC,MAAM,aAAa,GAA2C;IACnE,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,SAAS,CAAC,EAAE;IACjC,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE;IACtC,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,MAAM,CAAC,EAAE;IAC9B,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,mBAAmB,EAAE,GAAG,CAAC,EAAE;CACn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|
2
|
-
import { type UltraappStore, type ChatEntry } from './store.js';
|
|
2
|
+
import { type UltraappStore, type ChatEntry, type RunMode } from './store.js';
|
|
3
3
|
import { type QuestionEnvelope } from './interview-parser.js';
|
|
4
4
|
import { type PatchOp } from './json-patch.js';
|
|
5
5
|
import type { BuildEvent } from './build-events.js';
|
|
6
|
+
import { RunKernel } from '../kernel/engine.js';
|
|
7
|
+
import type { RunRecord } from '../kernel/types.js';
|
|
8
|
+
import { type AcceptanceContract, type CheckResult } from '../verify/contract.js';
|
|
6
9
|
import { type DeployArgs, type DeployResult } from './deploy.js';
|
|
7
10
|
import type { UltraappRouter } from './router.js';
|
|
8
11
|
export type RunEvent = {
|
|
@@ -56,23 +59,69 @@ export interface UltraappManagerOptions {
|
|
|
56
59
|
`build-complete` (v0.2 behaviour); when present, deploy runs after build
|
|
57
60
|
and the run reaches `done` with a public-but-local URL. */
|
|
58
61
|
router?: UltraappRouter;
|
|
62
|
+
/**
|
|
63
|
+
* The run kernel that drives the build pipeline.
|
|
64
|
+
*
|
|
65
|
+
* Supplied by SessionManager in production so UltraApp's runs share the one
|
|
66
|
+
* run store, listing and ownership model as everything else. Left out, a
|
|
67
|
+
* private kernel is wired up — which keeps the class usable on its own, and
|
|
68
|
+
* still means there is only one execution model, not two.
|
|
69
|
+
*/
|
|
70
|
+
kernel?: RunKernel;
|
|
59
71
|
/** Test seam: stub the deploy state machine. */
|
|
60
72
|
deployFn?: (a: DeployArgs) => Promise<DeployResult>;
|
|
73
|
+
/**
|
|
74
|
+
* Override the build-stage acceptance contract.
|
|
75
|
+
*
|
|
76
|
+
* A caller-supplied contract, never an agent-supplied one — the same rule as
|
|
77
|
+
* everywhere else in the verification plane. It exists because the default
|
|
78
|
+
* really does run `npm install && npm run build && npm test` in the generated
|
|
79
|
+
* codebase, which a unit test has no business doing; tests declare a trivial
|
|
80
|
+
* contract the way they inject `deployFn`.
|
|
81
|
+
*/
|
|
82
|
+
buildContract?: AcceptanceContract;
|
|
83
|
+
/**
|
|
84
|
+
* Test seam: stub the deploy-stage acceptance checks. The real one drives a
|
|
85
|
+
* headless browser against the deployed URL, which a stubbed deploy has not
|
|
86
|
+
* got, so tests inject their own the same way they inject `deployFn`.
|
|
87
|
+
*/
|
|
88
|
+
runDeployChecksFn?: (contract: AcceptanceContract, cwd: string, artifactDir: string) => Promise<CheckResult[]>;
|
|
61
89
|
/** Runtime mode for build + deploy. 'host' (default) runs the generated
|
|
62
90
|
app as a regular Node process — works anywhere Node works, no extra
|
|
63
91
|
deps. 'docker' uses `docker build` + `docker run` for isolation; only
|
|
64
92
|
use this when you want shared-host hardening. */
|
|
65
93
|
runtimeMode?: 'host' | 'docker';
|
|
66
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* The kernel run id for an app's current build.
|
|
97
|
+
*
|
|
98
|
+
* Stable rather than per-attempt, so `clawo workflow show ultraapp-<id>` always
|
|
99
|
+
* names the build that matters; a rebuild deletes the previous run and starts a
|
|
100
|
+
* new one under the same id, which the incarnation check makes safe.
|
|
101
|
+
*/
|
|
102
|
+
export declare function ultraappKernelRunId(appRunId: string): string;
|
|
103
|
+
/**
|
|
104
|
+
* UltraApp's `RunMode`, derived from the kernel record.
|
|
105
|
+
*
|
|
106
|
+
* The build pipeline no longer has a state machine of its own: this reads the
|
|
107
|
+
* one the kernel keeps. `interview` and `queued` are not here because they are
|
|
108
|
+
* not pipeline states — nothing is running yet, and the interview genuinely is
|
|
109
|
+
* not a workflow.
|
|
110
|
+
*/
|
|
111
|
+
export declare function ultraappModeOf(record: RunRecord): RunMode;
|
|
67
112
|
export declare class UltraappManager {
|
|
68
113
|
private readonly opts;
|
|
69
114
|
private readonly runs;
|
|
70
115
|
private readonly skillContent;
|
|
71
116
|
private readonly buildQueue;
|
|
72
117
|
private readonly narrators;
|
|
118
|
+
private readonly kernel;
|
|
119
|
+
/** Per-run serialisation for the mode projection. See {@link projectMode}. */
|
|
120
|
+
private readonly projectChain;
|
|
73
121
|
private readonly classifierSessions;
|
|
74
122
|
private readonly inflightWork;
|
|
75
123
|
constructor(opts: UltraappManagerOptions);
|
|
124
|
+
private ultraappNodeDeps;
|
|
76
125
|
get store(): UltraappStore;
|
|
77
126
|
createRun(): Promise<string>;
|
|
78
127
|
submitAnswer(runId: string, answer: {
|
|
@@ -94,8 +143,64 @@ export declare class UltraappManager {
|
|
|
94
143
|
startBuild(runId: string): Promise<void>;
|
|
95
144
|
cancelBuild(runId: string): void;
|
|
96
145
|
buildPosition(runId: string): number;
|
|
146
|
+
/**
|
|
147
|
+
* Run the build pipeline as a kernel workflow.
|
|
148
|
+
*
|
|
149
|
+
* This used to be a hand-rolled sequence: council, then fix-on-failure, then
|
|
150
|
+
* deploy, with a mode enum written at each step and nothing checkpointed
|
|
151
|
+
* between them. It worked, but it meant UltraApp was a second runtime standing
|
|
152
|
+
* beside the one this release exists to be — its runs were invisible to
|
|
153
|
+
* `workflow_list` and the Runs tab, and a crash halfway through threw away a
|
|
154
|
+
* finished council and started it again from nothing.
|
|
155
|
+
*
|
|
156
|
+
* Now the sequence is a `WorkflowSpec` and the kernel drives it. What is left
|
|
157
|
+
* here is the part that is genuinely UltraApp's: turning kernel events into
|
|
158
|
+
* `BuildEvent`s for the dashboard, and keeping `RunMode` — which the whole
|
|
159
|
+
* UI and every stored run reads — as a projection of the kernel's state
|
|
160
|
+
* rather than as a second source of truth.
|
|
161
|
+
*
|
|
162
|
+
* The interview and the done-mode conversation are deliberately NOT here.
|
|
163
|
+
* They are user-driven and open-ended; expressing them as a workflow would
|
|
164
|
+
* mean a router self-loop fighting the visit bound, or one fake node with a
|
|
165
|
+
* state machine hidden inside it. That would be unification as theatre.
|
|
166
|
+
*/
|
|
97
167
|
private runBuild;
|
|
98
|
-
|
|
168
|
+
/** Best-effort narrator startup; its failure must not sink a build. */
|
|
169
|
+
private startNarrator;
|
|
170
|
+
/**
|
|
171
|
+
* Translate the run's kernel events into build events and mode transitions.
|
|
172
|
+
*
|
|
173
|
+
* The mode is recomputed from the record every time rather than stepped
|
|
174
|
+
* forward, so a handler that arrives late cannot write a stale value over a
|
|
175
|
+
* newer one — which it otherwise can, because these handlers are async and the
|
|
176
|
+
* kernel does not wait for them.
|
|
177
|
+
*/
|
|
178
|
+
private subscribeKernel;
|
|
179
|
+
private onKernelEvent;
|
|
180
|
+
/**
|
|
181
|
+
* Write UltraApp's mode as it is implied by the kernel record, right now.
|
|
182
|
+
*
|
|
183
|
+
* Serialised per run, and that is the whole mechanism. These are fired from
|
|
184
|
+
* async event handlers, so two of them can read the record at different
|
|
185
|
+
* moments and still write in the opposite order — which showed up as a run
|
|
186
|
+
* that had already failed reverting to `building`. Chaining read-compute-write
|
|
187
|
+
* makes the last write the one computed last, and the kernel record only ever
|
|
188
|
+
* moves forward, so the last computed value is the current one.
|
|
189
|
+
*/
|
|
190
|
+
private projectMode;
|
|
191
|
+
private projectModeNow;
|
|
192
|
+
/** Emit the terminal build event and settle the mode from the final record. */
|
|
193
|
+
private settleBuild;
|
|
194
|
+
/**
|
|
195
|
+
* Deploy the built codebase and check the deployed thing.
|
|
196
|
+
*
|
|
197
|
+
* Returns an outcome rather than writing modes: the mode is projected from the
|
|
198
|
+
* kernel now, and a stage that also wrote it would put the two back out of
|
|
199
|
+
* step. The acceptance verdict comes back with the outcome because it is the
|
|
200
|
+
* run's terminal verdict — §7g screenshots are taken against a URL that does
|
|
201
|
+
* not exist until this has run, so the contract cannot sit in the spec.
|
|
202
|
+
*/
|
|
203
|
+
private deployStage;
|
|
99
204
|
startContainer(runId: string): Promise<{
|
|
100
205
|
ok: boolean;
|
|
101
206
|
error?: string;
|