@linzumi/cli 1.0.275 → 1.0.276

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 (41) hide show
  1. package/README.md +10 -9
  2. package/dist/{impl-ts/cloud-supervisor.mjs → cloud-supervisor.mjs} +78 -78
  3. package/dist/hosted-coding-account-worker.js +25 -0
  4. package/dist/index.js +1609 -3
  5. package/dist/mcp-server.mjs +174 -168
  6. package/dist/{impl-res/native → native}/darwin/manifest.json +5 -2
  7. package/dist/remote-codex-harness-worker.js +757 -0
  8. package/dist/tcp-tunnel-cli.mjs +25 -69
  9. package/dist/topics-cli.mjs +137 -13
  10. package/package.json +9 -16
  11. package/scripts/build.mjs +33 -356
  12. package/scripts/bump-cli-version.mjs +35 -9
  13. package/scripts/check-package-size-budget.mjs +13 -61
  14. package/dist/impl-res/cloud-supervisor.mjs +0 -281
  15. package/dist/impl-res/index.js +0 -1546
  16. package/dist/impl-res/mcp-server.mjs +0 -461
  17. package/dist/impl-ts/assets/linzumi-logo.svg +0 -1
  18. package/dist/impl-ts/crossHarnessFailover.mjs +0 -14
  19. package/dist/impl-ts/index.js +0 -2617
  20. package/dist/impl-ts/mcp-server.mjs +0 -455
  21. package/dist/impl-ts/native/darwin/manifest.json +0 -21
  22. package/dist/impl-ts/native/darwin/preview-process-identity +0 -0
  23. package/dist/impl-ts/tcp-tunnel-cli.mjs +0 -93
  24. package/scripts/build-differential-entry-impl-res.mjs +0 -64
  25. package/scripts/build-differential-entry.mjs +0 -180
  26. package/scripts/build-onboarding-demo-evidence.mjs +0 -186
  27. package/scripts/build-tui-demo-evidence.mjs +0 -107
  28. package/scripts/diagnose-claude-probe.ts +0 -198
  29. package/scripts/differentialMutations.mjs +0 -114
  30. package/scripts/f5_live_cross_harness_failover_e2e.mjs +0 -239
  31. package/scripts/golden-chaos-harness.mjs +0 -1420
  32. package/scripts/normalize-agent-replay-fixture.ts +0 -281
  33. package/scripts/promote-gstack-claude-smoke-fixture.ts +0 -891
  34. package/scripts/record-agent-replay-fixtures.ts +0 -610
  35. package/scripts/replay-agent-backend-browser.ts +0 -198
  36. package/scripts/replay-agent-backend.ts +0 -1961
  37. package/scripts/replay-agent-fixture.ts +0 -326
  38. package/scripts/typecheck.mjs +0 -42
  39. /package/dist/{impl-res/assets → assets}/linzumi-logo.svg +0 -0
  40. /package/dist/{impl-res/crossHarnessFailover.mjs → crossHarnessFailover.mjs} +0 -0
  41. /package/dist/{impl-res/native → native}/darwin/preview-process-identity +0 -0
@@ -1,326 +0,0 @@
1
- /*
2
- - Date: 2026-06-29
3
- Spec: plans/2026-06-29-claude-code-raw-replay-harness-plan.md
4
- Relationship: Local replay entrypoint for raw agent fixtures. It loads one or
5
- more NDJSON fixtures, validates coverage, and writes static playground and
6
- JSON summary artifacts without starting live providers.
7
- */
8
- import { mkdir, writeFile } from 'node:fs/promises';
9
- import { basename, join, resolve } from 'node:path';
10
- import {
11
- commanderReplayCoverageRequirements,
12
- commanderReplayRealCoverageRequirements,
13
- extractAgentReplayCoverage,
14
- missingAgentReplayCoverage,
15
- } from '../src/agentReplayCoverage';
16
- import {
17
- loadAgentReplayFixture,
18
- type AgentReplayFixture,
19
- } from '../src/agentReplayFixture';
20
- import { renderAgentReplayPlaygroundHtml } from '../src/agentReplayPlayground';
21
- import { collectAgentReplayDiagnostics } from '../src/agentReplayDiagnostics';
22
- import {
23
- evaluateAgentReplayFeatureReadiness,
24
- loadAgentReplayManifestForFixture,
25
- summarizeAgentReplayManifest,
26
- type AgentReplayFeatureReadiness,
27
- type AgentReplayManifestSummary,
28
- } from '../src/agentReplayManifest';
29
-
30
- type ReplayCliOptions = {
31
- readonly fixtures: readonly string[];
32
- readonly outDir: string;
33
- readonly coverageMode: 'none' | 'real' | 'full';
34
- readonly html: boolean;
35
- readonly summary: boolean;
36
- readonly requiredFeatureId: string | undefined;
37
- };
38
-
39
- async function main(): Promise<void> {
40
- const args = process.argv.slice(2);
41
-
42
- if (args.includes('--help')) {
43
- printHelp();
44
- return;
45
- }
46
-
47
- const options = parseArgs(args);
48
- const fixtures = await Promise.all(options.fixtures.map(loadFixture));
49
- const manifestSummaries = await loadManifestSummaries(options.fixtures);
50
- const featureReadiness = await loadManifestReadiness(options.fixtures);
51
- await mkdir(options.outDir, { recursive: true });
52
-
53
- if (options.html) {
54
- for (const fixture of fixtures) {
55
- const name = fixtureOutputName(fixture.path);
56
- await writeFile(
57
- join(options.outDir, `${name}.html`),
58
- renderAgentReplayPlaygroundHtml(fixture),
59
- 'utf8'
60
- );
61
- }
62
- }
63
-
64
- const coverage = extractAgentReplayCoverage(fixtures);
65
- const diagnostics = combineDiagnostics(
66
- fixtures.map(collectAgentReplayDiagnostics)
67
- );
68
- const requirements =
69
- options.coverageMode === 'real'
70
- ? commanderReplayRealCoverageRequirements
71
- : commanderReplayCoverageRequirements;
72
- const gaps =
73
- options.coverageMode === 'none'
74
- ? []
75
- : missingAgentReplayCoverage(coverage, requirements);
76
- const requiredFeatureGate = evaluateRequiredFeatureGate(
77
- options.requiredFeatureId,
78
- featureReadiness
79
- );
80
- const summary = {
81
- fixtures: fixtures.map((fixture) => ({
82
- path: fixture.path,
83
- records: fixture.records.length,
84
- })),
85
- coverageMode: options.coverageMode,
86
- coverage: coverageSummary(coverage),
87
- featureCoverage: manifestSummaries,
88
- featureReadiness,
89
- diagnostics,
90
- gaps,
91
- requiredFeature: requiredFeatureGate,
92
- };
93
-
94
- if (options.summary) {
95
- await writeFile(
96
- join(options.outDir, 'summary.json'),
97
- `${JSON.stringify(summary, null, 2)}\n`,
98
- 'utf8'
99
- );
100
- }
101
-
102
- process.stdout.write(`${JSON.stringify(summary, null, 2)}\n`);
103
-
104
- if (
105
- gaps.length > 0 ||
106
- diagnostics.droppedEvents.length > 0 ||
107
- requiredFeatureGate.status === 'failed'
108
- ) {
109
- process.exitCode = 1;
110
- }
111
- }
112
-
113
- function combineDiagnostics(
114
- diagnostics: readonly ReturnType<typeof collectAgentReplayDiagnostics>[]
115
- ): ReturnType<typeof collectAgentReplayDiagnostics> {
116
- return {
117
- droppedEvents: diagnostics.flatMap((entry) => entry.droppedEvents),
118
- debugOnlyEvents: diagnostics.flatMap((entry) => entry.debugOnlyEvents),
119
- };
120
- }
121
-
122
- function parseArgs(args: readonly string[]): ReplayCliOptions {
123
- const fixtures = valuesFor(args, '--fixture').map((path) => resolve(path));
124
-
125
- if (fixtures.length === 0) {
126
- throw new Error('provide at least one --fixture <path>');
127
- }
128
-
129
- return {
130
- fixtures,
131
- outDir: resolve(argValue(args, '--out-dir') ?? 'agent-replay-output'),
132
- coverageMode: coverageModeValue(argValue(args, '--coverage') ?? 'full'),
133
- html: !args.includes('--no-html'),
134
- summary: !args.includes('--no-summary'),
135
- requiredFeatureId: argValue(args, '--require-feature'),
136
- };
137
- }
138
-
139
- function coverageModeValue(value: string): ReplayCliOptions['coverageMode'] {
140
- switch (value) {
141
- case 'none':
142
- case 'real':
143
- case 'full':
144
- return value;
145
- default:
146
- throw new Error(`unsupported --coverage value: ${value}`);
147
- }
148
- }
149
-
150
- async function loadManifestSummaries(
151
- fixturePaths: readonly string[]
152
- ): Promise<readonly AgentReplayManifestSummary[]> {
153
- const manifests: AgentReplayManifestSummary[] = [];
154
-
155
- for (const fixturePath of fixturePaths) {
156
- const loaded = await loadAgentReplayManifestForFixture(fixturePath);
157
-
158
- if (loaded === undefined) {
159
- continue;
160
- }
161
-
162
- if (loaded.type === 'error') {
163
- throw new Error(JSON.stringify(loaded.error));
164
- }
165
-
166
- manifests.push(summarizeAgentReplayManifest(loaded.manifest));
167
- }
168
-
169
- return manifests;
170
- }
171
-
172
- async function loadManifestReadiness(
173
- fixturePaths: readonly string[]
174
- ): Promise<readonly AgentReplayFeatureReadiness[]> {
175
- const readiness: AgentReplayFeatureReadiness[] = [];
176
-
177
- for (const fixturePath of fixturePaths) {
178
- const loaded = await loadAgentReplayManifestForFixture(fixturePath);
179
-
180
- if (loaded === undefined) {
181
- continue;
182
- }
183
-
184
- if (loaded.type === 'error') {
185
- throw new Error(JSON.stringify(loaded.error));
186
- }
187
-
188
- readiness.push(...evaluateAgentReplayFeatureReadiness(loaded.manifest));
189
- }
190
-
191
- return readiness;
192
- }
193
-
194
- type RequiredFeatureGate =
195
- | { readonly status: 'not-required' }
196
- | {
197
- readonly status: 'passed';
198
- readonly featureId: string;
199
- readonly readiness: AgentReplayFeatureReadiness;
200
- }
201
- | {
202
- readonly status: 'failed';
203
- readonly featureId: string;
204
- readonly reason: string;
205
- readonly readiness?: AgentReplayFeatureReadiness | undefined;
206
- };
207
-
208
- function evaluateRequiredFeatureGate(
209
- featureId: string | undefined,
210
- readiness: readonly AgentReplayFeatureReadiness[]
211
- ): RequiredFeatureGate {
212
- if (featureId === undefined) {
213
- return { status: 'not-required' };
214
- }
215
-
216
- if (readiness.length === 0) {
217
- return {
218
- status: 'failed',
219
- featureId,
220
- reason: '--require-feature needs a neighboring fixture manifest',
221
- };
222
- }
223
-
224
- const feature = readiness.find((row) => row.featureId === featureId);
225
-
226
- if (feature === undefined) {
227
- return {
228
- status: 'failed',
229
- featureId,
230
- reason: `feature ${featureId} is not present in the fixture manifests`,
231
- };
232
- }
233
-
234
- switch (feature.status) {
235
- case 'implemented':
236
- case 'ready-to-implement':
237
- return { status: 'passed', featureId, readiness: feature };
238
- case 'blocked':
239
- case 'missing-proof':
240
- case 'not-started':
241
- return {
242
- status: 'failed',
243
- featureId,
244
- readiness: feature,
245
- reason: feature.reason,
246
- };
247
- }
248
- }
249
-
250
- async function loadFixture(path: string): Promise<AgentReplayFixture> {
251
- const loaded = await loadAgentReplayFixture(path);
252
-
253
- if (loaded.type === 'error') {
254
- throw new Error(JSON.stringify(loaded.error));
255
- }
256
-
257
- return loaded.fixture;
258
- }
259
-
260
- function valuesFor(args: readonly string[], name: string): readonly string[] {
261
- const values: string[] = [];
262
-
263
- for (let index = 0; index < args.length; index += 1) {
264
- if (args[index] === name) {
265
- const value = args[index + 1];
266
-
267
- if (value === undefined) {
268
- throw new Error(`${name} requires a value`);
269
- }
270
-
271
- values.push(value);
272
- }
273
- }
274
-
275
- return values;
276
- }
277
-
278
- function argValue(args: readonly string[], name: string): string | undefined {
279
- const index = args.indexOf(name);
280
-
281
- if (index === -1) {
282
- return undefined;
283
- }
284
-
285
- const value = args[index + 1];
286
-
287
- if (value === undefined) {
288
- throw new Error(`${name} requires a value`);
289
- }
290
-
291
- return value;
292
- }
293
-
294
- function fixtureOutputName(path: string): string {
295
- return basename(path).replace(/\.ndjson$/u, '');
296
- }
297
-
298
- function coverageSummary(
299
- coverage: ReturnType<typeof extractAgentReplayCoverage>
300
- ): Record<string, readonly string[]> {
301
- return {
302
- codexNotificationMethods: sorted(coverage.codexNotificationMethods),
303
- codexRequestMethods: sorted(coverage.codexRequestMethods),
304
- codexThreadItemTypes: sorted(coverage.codexThreadItemTypes),
305
- claudeSdkMessageTags: sorted(coverage.claudeSdkMessageTags),
306
- claudeContentBlockTypes: sorted(coverage.claudeContentBlockTypes),
307
- claudeToolNames: sorted(coverage.claudeToolNames),
308
- };
309
- }
310
-
311
- function sorted(values: ReadonlySet<string>): readonly string[] {
312
- return Array.from(values).sort();
313
- }
314
-
315
- function printHelp(): void {
316
- process.stdout.write(
317
- `Usage: pnpm run replay:agent-fixture -- --fixture <path> [--fixture <path>...] [options]\n\nOptions:\n --out-dir <path> Artifact directory. Default: agent-replay-output\n --coverage none|real|full Coverage gate. Default: full\n --no-html Do not write per-fixture playground HTML\n --no-summary Do not write summary.json\n\nExamples:\n pnpm --filter @linzumi/cli run replay:agent-fixture -- \\\n --fixture test/fixtures/agent-raw-replay/real-probe/codex.ndjson \\\n --fixture test/fixtures/agent-raw-replay/real-probe/claude.ndjson \\\n --coverage real \\\n --out-dir /tmp/agent-replay-real\n`
318
- );
319
- }
320
-
321
- main().catch((error) => {
322
- process.stderr.write(
323
- `${error instanceof Error ? (error.stack ?? error.message) : String(error)}\n`
324
- );
325
- process.exitCode = 1;
326
- });
@@ -1,42 +0,0 @@
1
- // Strict typecheck gate for @linzumi/cli: ZERO errors AND ZERO warnings.
2
- //
3
- // `tsc --noEmit` exits non-zero on errors, but some diagnostics (e.g.
4
- // deprecated-option notices, future warning-class output, node runtime
5
- // warnings from the toolchain) can reach stdout/stderr while tsc still exits
6
- // 0. This wrapper treats ANY diagnostic output as a failure so the ratchet
7
- // can never silently loosen: a green check means tsc printed NOTHING.
8
- import { spawnSync } from 'node:child_process';
9
- import { createRequire } from 'node:module';
10
- import { dirname, join } from 'node:path';
11
- import { fileURLToPath } from 'node:url';
12
-
13
- const packageDir = dirname(dirname(fileURLToPath(import.meta.url)));
14
- const require = createRequire(import.meta.url);
15
- // Resolve the workspace's own TypeScript (no PATH/npx ambiguity).
16
- const tscBin = join(dirname(require.resolve('typescript/package.json')), 'bin', 'tsc');
17
-
18
- const result = spawnSync(
19
- process.execPath,
20
- [tscBin, '--noEmit', '--pretty', 'false'],
21
- { cwd: packageDir, encoding: 'utf8' }
22
- );
23
-
24
- const output = `${result.stdout ?? ''}${result.stderr ?? ''}`.trim();
25
-
26
- if (output !== '') {
27
- console.error(output);
28
- console.error(
29
- '\n[typecheck] FAILED: tsc produced diagnostic output above ' +
30
- '(zero errors AND zero warnings required).'
31
- );
32
- process.exit(1);
33
- }
34
-
35
- if (result.status !== 0) {
36
- console.error(
37
- `[typecheck] FAILED: tsc exited ${result.status} with no output.`
38
- );
39
- process.exit(result.status ?? 1);
40
- }
41
-
42
- console.log('[typecheck] OK: zero errors, zero warnings.');