@linzumi/cli 1.0.272 → 1.0.274
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 +1 -1
- package/dist/impl-res/cloud-supervisor.mjs +69 -69
- package/dist/impl-res/index.js +355 -314
- package/dist/impl-res/mcp-server.mjs +34 -34
- package/dist/impl-ts/cloud-supervisor.mjs +69 -69
- package/dist/impl-ts/index.js +495 -495
- package/dist/impl-ts/mcp-server.mjs +1 -1
- package/dist/mcp-server.mjs +1 -1
- package/package.json +3 -2
- package/scripts/check-package-size-budget.mjs +9 -0
- package/scripts/build-auth-parity-oracle.mjs +0 -709
- package/scripts/build-canonical-codex-transpiler-oracle.mjs +0 -93
- package/scripts/build-config-identity-parity-oracle.mjs +0 -526
- package/scripts/build-core-commander-seams-parity-oracle.mjs +0 -799
- package/scripts/build-core-daemon-parity-oracle.mjs +0 -573
- package/scripts/build-core-dispatch-input-queue-parity-oracle.mjs +0 -225
- package/scripts/build-core-fate-ladder-parity-oracle.mjs +0 -350
- package/scripts/build-core-generation-overlap-parity-oracle.mjs +0 -292
- package/scripts/build-core-integration-parity-oracle.mjs +0 -453
- package/scripts/build-core-lifecycle-guards-parity-oracle.mjs +0 -443
- package/scripts/build-core-lock-parity-oracle.mjs +0 -462
- package/scripts/build-core-reconnect-resume-parity-oracle.mjs +0 -365
- package/scripts/build-core-startup-resume-scan-parity-oracle.mjs +0 -296
- package/scripts/build-core-supervisor-parity-oracle.mjs +0 -781
- package/scripts/build-cross-harness-failover-oracle.mjs +0 -349
- package/scripts/build-editor-parity-oracle.mjs +0 -1525
- package/scripts/build-forwarding-parity-oracle.mjs +0 -1390
- package/scripts/build-harness-claude-parity-oracle.mjs +0 -407
- package/scripts/build-harness-codex-parity-oracle.mjs +0 -479
- package/scripts/build-mcp-parity-oracle.mjs +0 -412
- package/scripts/build-mcp-selector-parity-oracle.mjs +0 -65
- package/scripts/build-onboarding-discovery-parity-oracle.mjs +0 -388
- package/scripts/build-onboarding-flow-parity-oracle.mjs +0 -562
- package/scripts/build-onboarding-gateway-parity-oracle.mjs +0 -313
- package/scripts/build-onboarding-support-parity-oracle.mjs +0 -519
- package/scripts/build-pipeline-parity-oracle.mjs +0 -614
- package/scripts/build-protocol-parity-oracle.mjs +0 -398
- package/scripts/build-queue-parity-oracle.mjs +0 -1012
- package/scripts/build-session-registry-parity-oracle.mjs +0 -582
- package/scripts/build-transport-parity-oracle.mjs +0 -694
- package/scripts/build-tui-parity-oracle.mjs +0 -577
- package/scripts/build-vm-sandbox-parity-oracle.mjs +0 -1281
- package/scripts/build-worker-entry-parity-oracle.mjs +0 -424
- package/scripts/build-worker-spawn-parity-oracle.mjs +0 -823
|
@@ -1,292 +0,0 @@
|
|
|
1
|
-
// Spec: kandan/plans/2026-07-10-compute-nodes-rescript-commander-zero-ts-program.md
|
|
2
|
-
// (M3 cluster 10, commander core) +
|
|
3
|
-
// plans/2026-07-11-runner-generation-overlap-zero-downtime-updates.md
|
|
4
|
-
// (the ported surface's own spec, CLI half #2981).
|
|
5
|
-
// Relationship: Builds the TS-side PARITY ORACLE for the generation-overlap
|
|
6
|
-
// slice of the ReScript commander port, the sibling of
|
|
7
|
-
// build-pipeline-parity-oracle.mjs (cluster 9) and
|
|
8
|
-
// build-session-registry-parity-oracle.mjs (cluster 6). The oracle bundles
|
|
9
|
-
// the REAL TS generation-overlap module (src/generationOverlap.ts) - env
|
|
10
|
-
// flag/readers, join-hello envelope, the supervisor<->child IPC codec, the
|
|
11
|
-
// per-process overlap runtime, the dispatch gate's held-control queues,
|
|
12
|
-
// and the cursor-persistence freeze - behind the cluster 1/2 one-shot
|
|
13
|
-
// BATCH driver (a JSON array of cases on stdin, a JSON array of results on
|
|
14
|
-
// stdout).
|
|
15
|
-
//
|
|
16
|
-
// Byte parity: envelopes, parsed/built IPC frames, and every scripted
|
|
17
|
-
// trace entry are returned VERBATIM (the TS objects' own key order rides
|
|
18
|
-
// JSON.stringify), so the ReScript side must reproduce field presence AND
|
|
19
|
-
// insertion order exactly - the hello and IPC payloads are frozen wire
|
|
20
|
-
// bytes. Determinism: nothing here reads env, clocks, or process.send -
|
|
21
|
-
// env dicts are scripted per case, the runtime's send seam is injected,
|
|
22
|
-
// and runtime/gate/freeze flows are driven by scripted op arrays.
|
|
23
|
-
//
|
|
24
|
-
// SECRETS: the oracle only ever sees the conformance suite's synthetic
|
|
25
|
-
// payloads. The output is a local test artifact (.differential/ is
|
|
26
|
-
// gitignored, never published) and stays unminified for debuggability.
|
|
27
|
-
import { mkdir } from 'node:fs/promises';
|
|
28
|
-
import { dirname, join } from 'node:path';
|
|
29
|
-
import { fileURLToPath } from 'node:url';
|
|
30
|
-
import { build } from 'esbuild';
|
|
31
|
-
|
|
32
|
-
const packageRoot = dirname(dirname(fileURLToPath(import.meta.url)));
|
|
33
|
-
|
|
34
|
-
const driverSource = `
|
|
35
|
-
import {
|
|
36
|
-
buildGenerationIpcMessage,
|
|
37
|
-
createGenerationDispatchGate,
|
|
38
|
-
createGenerationOverlapRuntime,
|
|
39
|
-
defaultGenerationStillbornWindowMs,
|
|
40
|
-
generationEpochEnvKey,
|
|
41
|
-
generationHandoffPidEnvKey,
|
|
42
|
-
generationHelloEnvelope,
|
|
43
|
-
generationOverlapFlagEnvKey,
|
|
44
|
-
generationStillbornWindowEnvKey,
|
|
45
|
-
generationTtyOwnerEnvKey,
|
|
46
|
-
isGenerationOverlapEnabled,
|
|
47
|
-
isGenerationTtyOwner,
|
|
48
|
-
parseGenerationIpcMessage,
|
|
49
|
-
readGenerationEpoch,
|
|
50
|
-
readGenerationHandoffPid,
|
|
51
|
-
resolveGenerationStillbornWindowMs,
|
|
52
|
-
withGenerationCursorFreeze,
|
|
53
|
-
} from './src/generationOverlap';
|
|
54
|
-
|
|
55
|
-
// Scripted runtime flow: hooks/log/send all trace-recording, ops drive the
|
|
56
|
-
// REAL createGenerationOverlapRuntime.
|
|
57
|
-
function runRuntimeCase(caseInput) {
|
|
58
|
-
const trace = [];
|
|
59
|
-
let sendOk = true;
|
|
60
|
-
const runtime = createGenerationOverlapRuntime({
|
|
61
|
-
env: caseInput.env,
|
|
62
|
-
log: (event, fields) => trace.push({ t: 'log', event, fields }),
|
|
63
|
-
send: (message) => {
|
|
64
|
-
trace.push({ t: 'send', message, ok: sendOk });
|
|
65
|
-
return sendOk;
|
|
66
|
-
},
|
|
67
|
-
});
|
|
68
|
-
if (runtime === undefined) {
|
|
69
|
-
return { created: false, trace };
|
|
70
|
-
}
|
|
71
|
-
if (caseInput.installHooks !== false) {
|
|
72
|
-
runtime.hooks.onOverlapDrain = (incomingEpoch) =>
|
|
73
|
-
trace.push({ t: 'hook.overlapDrain', incomingEpoch });
|
|
74
|
-
runtime.hooks.onOverlapAbort = () => trace.push({ t: 'hook.overlapAbort' });
|
|
75
|
-
runtime.hooks.onPinsReleased = (released) =>
|
|
76
|
-
trace.push({ t: 'hook.pinsReleased', released });
|
|
77
|
-
runtime.hooks.onPromote = () => trace.push({ t: 'hook.promote' });
|
|
78
|
-
}
|
|
79
|
-
for (const op of caseInput.ops ?? []) {
|
|
80
|
-
if (op.op === 'ipc') runtime.handleIpcMessage(op.value);
|
|
81
|
-
else if (op.op === 'beginDrain') runtime.beginOutgoingDrain(op.threadIds);
|
|
82
|
-
else if (op.op === 'send') {
|
|
83
|
-
const message = parseGenerationIpcMessage(op.message);
|
|
84
|
-
if (message === undefined) trace.push({ t: 'sendSkipped' });
|
|
85
|
-
else runtime.sendToSupervisor(message);
|
|
86
|
-
} else if (op.op === 'sendResult') sendOk = op.ok === true;
|
|
87
|
-
else if (op.op === 'pinOutgoing') runtime.outgoingPins.pin(op.threadId);
|
|
88
|
-
else if (op.op === 'releaseOutgoing')
|
|
89
|
-
trace.push({
|
|
90
|
-
t: 'released',
|
|
91
|
-
threadId: op.threadId,
|
|
92
|
-
released: runtime.outgoingPins.release(op.threadId),
|
|
93
|
-
});
|
|
94
|
-
else if (op.op === 'seams') {
|
|
95
|
-
runtime.requestUpdateDrain('parity-trigger');
|
|
96
|
-
trace.push({
|
|
97
|
-
t: 'seams',
|
|
98
|
-
cancel: runtime.cancelUpdateDrain('parity-reason'),
|
|
99
|
-
promote: runtime.promoteRunnerLock(),
|
|
100
|
-
});
|
|
101
|
-
} else if (op.op === 'query')
|
|
102
|
-
trace.push({
|
|
103
|
-
t: 'query',
|
|
104
|
-
epoch: runtime.epoch,
|
|
105
|
-
handoffFromPid: runtime.handoffFromPid ?? null,
|
|
106
|
-
outgoingDrainActive: runtime.outgoingDrainActive(),
|
|
107
|
-
pinsKnown: runtime.pinsKnown(),
|
|
108
|
-
role: runtime.currentRole() ?? null,
|
|
109
|
-
outgoingPins: runtime.outgoingPins.snapshot(),
|
|
110
|
-
incomingPins: runtime.incomingPins.snapshot(),
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
return { created: true, trace };
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
// Scripted gate flow: controls are plain JSON envelopes; the extractors
|
|
117
|
-
// mirror the runner wiring (threadIdOf / controlTypeOf injected).
|
|
118
|
-
function runGateCase(caseInput) {
|
|
119
|
-
const trace = [];
|
|
120
|
-
const runtime = createGenerationOverlapRuntime({
|
|
121
|
-
env: caseInput.env,
|
|
122
|
-
log: (event, fields) => trace.push({ t: 'log', event, fields }),
|
|
123
|
-
send: () => true,
|
|
124
|
-
});
|
|
125
|
-
if (runtime === undefined) {
|
|
126
|
-
return { created: false, trace };
|
|
127
|
-
}
|
|
128
|
-
const gate = createGenerationDispatchGate({
|
|
129
|
-
runtime,
|
|
130
|
-
threadIdOf: (control) =>
|
|
131
|
-
typeof control.threadId === 'string' ? control.threadId : undefined,
|
|
132
|
-
controlTypeOf: (control) =>
|
|
133
|
-
typeof control.type === 'string' ? control.type : '',
|
|
134
|
-
dispatch: (control, ack) => {
|
|
135
|
-
trace.push({
|
|
136
|
-
t: 'dispatched',
|
|
137
|
-
id: control.id ?? null,
|
|
138
|
-
threadId: typeof control.threadId === 'string' ? control.threadId : null,
|
|
139
|
-
});
|
|
140
|
-
ack();
|
|
141
|
-
},
|
|
142
|
-
log: (event, fields) => trace.push({ t: 'log', event, fields }),
|
|
143
|
-
});
|
|
144
|
-
for (const op of caseInput.ops ?? []) {
|
|
145
|
-
if (op.op === 'control') {
|
|
146
|
-
const control = op.control;
|
|
147
|
-
gate.dispatch(control, () =>
|
|
148
|
-
trace.push({ t: 'ack', id: control.id ?? null })
|
|
149
|
-
);
|
|
150
|
-
} else if (op.op === 'ipc') runtime.handleIpcMessage(op.value);
|
|
151
|
-
else if (op.op === 'beginDrain') runtime.beginOutgoingDrain(op.threadIds);
|
|
152
|
-
else if (op.op === 'dispatchUnpinned')
|
|
153
|
-
trace.push({ t: 'dispatchUnpinned', count: gate.dispatchUnpinned() });
|
|
154
|
-
else if (op.op === 'redispatch')
|
|
155
|
-
trace.push({ t: 'redispatch', count: gate.redispatchDeferredToIncoming() });
|
|
156
|
-
else if (op.op === 'held') {
|
|
157
|
-
const counts = gate.heldCounts();
|
|
158
|
-
trace.push({
|
|
159
|
-
t: 'held',
|
|
160
|
-
deferredToIncoming: counts.deferredToIncoming,
|
|
161
|
-
deferredPinned: counts.deferredPinned,
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
return { created: true, trace };
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
// Scripted cursor-freeze flow: the underlying store is trace-recording;
|
|
169
|
-
// ops toggle the frozen predicate and drive the wrapped store.
|
|
170
|
-
function runFreezeCase(caseInput) {
|
|
171
|
-
const trace = [];
|
|
172
|
-
let frozen = false;
|
|
173
|
-
const store = {
|
|
174
|
-
initial: (topic) => (caseInput.initialValues ?? {})[topic],
|
|
175
|
-
onAdvance: (topic, seq) => trace.push({ t: 'store.onAdvance', topic, seq }),
|
|
176
|
-
reset:
|
|
177
|
-
caseInput.hasReset === false
|
|
178
|
-
? undefined
|
|
179
|
-
: (topic, seq) => trace.push({ t: 'store.reset', topic, seq }),
|
|
180
|
-
flush: () => trace.push({ t: 'store.flush' }),
|
|
181
|
-
epoch: () =>
|
|
182
|
-
typeof caseInput.storeEpoch === 'string' ? caseInput.storeEpoch : undefined,
|
|
183
|
-
adoptEpoch: (epoch) => {
|
|
184
|
-
trace.push({ t: 'store.adoptEpoch', epoch });
|
|
185
|
-
return caseInput.adoptResult === true;
|
|
186
|
-
},
|
|
187
|
-
};
|
|
188
|
-
const wrapped = withGenerationCursorFreeze(store, () => frozen);
|
|
189
|
-
for (const op of caseInput.ops ?? []) {
|
|
190
|
-
if (op.op === 'setFrozen') frozen = op.value === true;
|
|
191
|
-
else if (op.op === 'initial')
|
|
192
|
-
trace.push({ t: 'initial', topic: op.topic, value: wrapped.initial(op.topic) ?? null });
|
|
193
|
-
else if (op.op === 'advance') wrapped.onAdvance(op.topic, op.seq);
|
|
194
|
-
else if (op.op === 'reset') {
|
|
195
|
-
if (wrapped.reset === undefined) trace.push({ t: 'resetUnavailable' });
|
|
196
|
-
else wrapped.reset(op.topic, op.seq);
|
|
197
|
-
} else if (op.op === 'flush') wrapped.flush();
|
|
198
|
-
else if (op.op === 'epoch')
|
|
199
|
-
trace.push({ t: 'epoch', value: wrapped.epoch() ?? null });
|
|
200
|
-
else if (op.op === 'adoptEpoch')
|
|
201
|
-
trace.push({ t: 'adoptEpoch', result: wrapped.adoptEpoch(op.epoch) });
|
|
202
|
-
}
|
|
203
|
-
return { trace };
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
function runCase(input) {
|
|
207
|
-
switch (input.kind) {
|
|
208
|
-
case 'constants':
|
|
209
|
-
return {
|
|
210
|
-
flagKey: generationOverlapFlagEnvKey,
|
|
211
|
-
epochKey: generationEpochEnvKey,
|
|
212
|
-
handoffPidKey: generationHandoffPidEnvKey,
|
|
213
|
-
stillbornWindowKey: generationStillbornWindowEnvKey,
|
|
214
|
-
ttyOwnerKey: generationTtyOwnerEnvKey,
|
|
215
|
-
defaultStillbornWindowMs: defaultGenerationStillbornWindowMs,
|
|
216
|
-
};
|
|
217
|
-
case 'envRead': {
|
|
218
|
-
if (input.which === 'enabled') return isGenerationOverlapEnabled(input.env);
|
|
219
|
-
if (input.which === 'ttyOwner') return isGenerationTtyOwner(input.env);
|
|
220
|
-
if (input.which === 'epoch') return readGenerationEpoch(input.env) ?? null;
|
|
221
|
-
if (input.which === 'handoffPid')
|
|
222
|
-
return readGenerationHandoffPid(input.env) ?? null;
|
|
223
|
-
return resolveGenerationStillbornWindowMs(input.env);
|
|
224
|
-
}
|
|
225
|
-
case 'helloEnvelope':
|
|
226
|
-
return generationHelloEnvelope(input.env);
|
|
227
|
-
case 'parseIpc': {
|
|
228
|
-
const parsed = parseGenerationIpcMessage(input.value);
|
|
229
|
-
return parsed === undefined ? null : parsed;
|
|
230
|
-
}
|
|
231
|
-
case 'buildIpc': {
|
|
232
|
-
const parsed = parseGenerationIpcMessage(input.message);
|
|
233
|
-
return parsed === undefined ? { unparsable: true } : buildGenerationIpcMessage(parsed);
|
|
234
|
-
}
|
|
235
|
-
case 'runtimeRun':
|
|
236
|
-
return runRuntimeCase(input);
|
|
237
|
-
case 'gateRun':
|
|
238
|
-
return runGateCase(input);
|
|
239
|
-
case 'freezeRun':
|
|
240
|
-
return runFreezeCase(input);
|
|
241
|
-
default:
|
|
242
|
-
return { error: 'unknown case kind ' + String(input.kind) };
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
async function runBatch() {
|
|
247
|
-
const chunks = [];
|
|
248
|
-
for await (const chunk of process.stdin) chunks.push(chunk);
|
|
249
|
-
const cases = JSON.parse(Buffer.concat(chunks).toString('utf8'));
|
|
250
|
-
const results = [];
|
|
251
|
-
for (const testCase of cases) {
|
|
252
|
-
results.push(runCase(testCase));
|
|
253
|
-
}
|
|
254
|
-
process.stdout.write(JSON.stringify(results), () => {
|
|
255
|
-
process.exit(0);
|
|
256
|
-
});
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
runBatch().then(
|
|
260
|
-
() => {},
|
|
261
|
-
(error) => {
|
|
262
|
-
process.stderr.write(String(error && error.stack ? error.stack : error) + '\\n');
|
|
263
|
-
process.exit(1);
|
|
264
|
-
}
|
|
265
|
-
);
|
|
266
|
-
`;
|
|
267
|
-
|
|
268
|
-
const outDir = join(packageRoot, '.differential');
|
|
269
|
-
const outPath = join(outDir, 'core-generation-overlap-parity-oracle.mjs');
|
|
270
|
-
|
|
271
|
-
await mkdir(outDir, { recursive: true });
|
|
272
|
-
|
|
273
|
-
await build({
|
|
274
|
-
stdin: {
|
|
275
|
-
contents: driverSource,
|
|
276
|
-
resolveDir: packageRoot,
|
|
277
|
-
sourcefile: 'core-generation-overlap-parity-driver.ts',
|
|
278
|
-
loader: 'ts',
|
|
279
|
-
},
|
|
280
|
-
bundle: true,
|
|
281
|
-
platform: 'node',
|
|
282
|
-
target: 'node20',
|
|
283
|
-
format: 'esm',
|
|
284
|
-
outfile: outPath,
|
|
285
|
-
minify: false,
|
|
286
|
-
sourcemap: false,
|
|
287
|
-
legalComments: 'none',
|
|
288
|
-
logLevel: 'silent',
|
|
289
|
-
external: ['ws', 'undici', 'blessed', '@anthropic-ai/claude-agent-sdk'],
|
|
290
|
-
});
|
|
291
|
-
|
|
292
|
-
process.stdout.write(outPath + '\n');
|