@orkestrel/probe 0.0.20 → 0.0.21
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 +6 -4
- package/dist/bin/main.js +1 -1
- package/dist/bin/main.js.map +1 -1
- package/dist/src/core/index.cjs +43 -3
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +69 -11
- package/dist/src/core/index.d.ts +69 -11
- package/dist/src/core/index.js +41 -4
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/server/index.cjs +345 -191
- package/dist/src/server/index.cjs.map +1 -1
- package/dist/src/server/index.d.cts +75 -37
- package/dist/src/server/index.d.ts +75 -37
- package/dist/src/server/index.js +346 -193
- package/dist/src/server/index.js.map +1 -1
- package/package.json +6 -6
|
@@ -5,6 +5,8 @@ import type { EmitterInterface } from '@orkestrel/emitter';
|
|
|
5
5
|
import type { EventEmitter } from 'node:events';
|
|
6
6
|
import type { Issue } from '@orkestrel/probe';
|
|
7
7
|
import type { LSPRange } from '@orkestrel/lsp';
|
|
8
|
+
import { MCPError } from '@orkestrel/mcp';
|
|
9
|
+
import type { ProbeError } from '@orkestrel/probe';
|
|
8
10
|
import type { ProbeEventMap } from '@orkestrel/probe';
|
|
9
11
|
import type { ProbeInterface } from '@orkestrel/probe';
|
|
10
12
|
import type { ProbeOptions } from '@orkestrel/probe';
|
|
@@ -89,6 +91,19 @@ export declare function collectWorkspaceFiles(workspace: string): readonly strin
|
|
|
89
91
|
*/
|
|
90
92
|
export declare function computeDigest(workspace: string, value: unknown): string;
|
|
91
93
|
|
|
94
|
+
/**
|
|
95
|
+
* Creates the protocol failure returned when the MCP handshake cannot arm the probe.
|
|
96
|
+
*
|
|
97
|
+
* @param error - The classified probe failure that ended initialization
|
|
98
|
+
* @returns An MCP server error carrying the probe failure's origin and code as protocol data
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* ```ts
|
|
102
|
+
* createHandshakeError(createDestroyedError('probe server')).code // -32000
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
export declare function createHandshakeError(error: ProbeError): MCPError;
|
|
106
|
+
|
|
92
107
|
/**
|
|
93
108
|
* Normalizes a caught or foreign error into readable text.
|
|
94
109
|
*
|
|
@@ -381,7 +396,7 @@ export declare function isRefusedName(file: string, error: unknown): boolean;
|
|
|
381
396
|
* Inspects virtual documents through one resident Oxlint language server.
|
|
382
397
|
*
|
|
383
398
|
* @remarks
|
|
384
|
-
*
|
|
399
|
+
* Starting launches the target workspace's Oxlint binary with its Language Server Protocol mode
|
|
385
400
|
* and hands the conversation to `@orkestrel/lsp`: `createStdioClientTransport` owns the child
|
|
386
401
|
* process and its bytes, and `createLSPClient` owns the framing, the request correlation, the
|
|
387
402
|
* capabilities this stage advertises, and the choice between pulled and pushed diagnostics. This
|
|
@@ -417,13 +432,15 @@ export declare function isRefusedName(file: string, error: unknown): boolean;
|
|
|
417
432
|
export declare class LintStage implements LintStageInterface {
|
|
418
433
|
#private;
|
|
419
434
|
/**
|
|
420
|
-
*
|
|
435
|
+
* Records the target workspace without starting its language server.
|
|
421
436
|
*
|
|
422
437
|
* @param workspace - The target workspace root. Default: the current working directory
|
|
423
438
|
*/
|
|
424
439
|
constructor(workspace?: string);
|
|
425
440
|
get stage(): Stage;
|
|
426
441
|
get progress(): number;
|
|
442
|
+
get exit(): Promise<never>;
|
|
443
|
+
start(): Promise<void>;
|
|
427
444
|
inspect(subject: Case, options?: InspectionOptions): Promise<Check>;
|
|
428
445
|
destroy(): Promise<void>;
|
|
429
446
|
}
|
|
@@ -448,6 +465,8 @@ export declare class LintStage implements LintStageInterface {
|
|
|
448
465
|
* ```
|
|
449
466
|
*/
|
|
450
467
|
export declare interface LintStageInterface extends StageInterface {
|
|
468
|
+
/** Rejects with the instrument fault on an exit before teardown; never fulfills. */
|
|
469
|
+
readonly exit: Promise<never>;
|
|
451
470
|
/**
|
|
452
471
|
* Inspects one case, under the bound the caller supplies.
|
|
453
472
|
*
|
|
@@ -824,9 +843,10 @@ export declare function parseRevisionOwner(revision: string): number | undefined
|
|
|
824
843
|
* Answers claims through its type, lint, and runtime stages.
|
|
825
844
|
*
|
|
826
845
|
* @remarks
|
|
827
|
-
* Construction resolves the target workspace's toolchain
|
|
846
|
+
* Construction resolves the target workspace's toolchain. Starting warms every stage and waits
|
|
847
|
+
* for lint and runtime; type warming and the boot controls continue behind that gate. The boot
|
|
828
848
|
* controls mutate imported dependencies and refuse service unless the type and runtime stages
|
|
829
|
-
* report their respective changes. One
|
|
849
|
+
* report their respective changes. One pool per stage admits inspections in arrival order, one at
|
|
830
850
|
* a time, so a stage never serves two claims at once and the deadline covers active work rather
|
|
831
851
|
* than queue wait. Each active stage inspection has a coordinator-owned deadline. An expiry at any
|
|
832
852
|
* stage abandons that stage and replaces it before the next queued inspection begins, so one slow
|
|
@@ -871,33 +891,35 @@ export declare function parseRevisionOwner(revision: string): number | undefined
|
|
|
871
891
|
* const probe = new Probe({ workspace: process.cwd() })
|
|
872
892
|
* const verdict = await probe.prove(claim)
|
|
873
893
|
* verdict.digest // 'bdf03e5dfd6bd413ead671c7a2940fcf'
|
|
874
|
-
* verdict.receipt // 'probe:bdf03e5dfd6bd413ead671c7a2940fcf:type:typescript@6.0.3:oxlint@1.
|
|
894
|
+
* verdict.receipt // 'probe:bdf03e5dfd6bd413ead671c7a2940fcf:type:typescript@6.0.3:oxlint@1.87.0:vitest@4.1.11:configs/src/tsconfig.core.json@434f59254d58cf2683d453a26bd0d837'
|
|
875
895
|
* await probe.destroy()
|
|
876
896
|
* ```
|
|
877
897
|
*/
|
|
878
898
|
export declare class Probe implements ProbeInterface {
|
|
879
899
|
#private;
|
|
880
900
|
/**
|
|
881
|
-
* Resolves the target toolchain and
|
|
901
|
+
* Resolves the target toolchain and constructs the stage pools without warming them.
|
|
882
902
|
*
|
|
883
|
-
* @param options - Workspace,
|
|
903
|
+
* @param options - Workspace, inspection and warm bounds, and initial observation hooks
|
|
884
904
|
*/
|
|
885
905
|
constructor(options?: ProbeOptions);
|
|
886
906
|
get emitter(): EmitterInterface<ProbeEventMap>;
|
|
887
907
|
get toolchain(): Toolchain;
|
|
888
908
|
prove(claim: Claim): Promise<Verdict>;
|
|
889
909
|
destroy(): Promise<void>;
|
|
910
|
+
start(): Promise<void>;
|
|
890
911
|
}
|
|
891
912
|
|
|
892
913
|
/**
|
|
893
914
|
* Implements `ProbeServerInterface` over a `PassThrough` stream this server owns, binding the
|
|
894
915
|
* published `prove` tool and the dual-era dispatcher to this process's Model Context Protocol
|
|
895
|
-
* stdio transport.
|
|
916
|
+
* stdio transport. Starting creates the probe and awaits its lint and runtime onset; type warming
|
|
917
|
+
* and the boot controls continue behind it.
|
|
896
918
|
*
|
|
897
919
|
* @remarks
|
|
898
920
|
* Construction snapshots the probe options, publishes the `prove` tool, and binds the dual-era
|
|
899
|
-
* dispatcher to the stdio transport.
|
|
900
|
-
*
|
|
921
|
+
* dispatcher to the stdio transport.
|
|
922
|
+
* Discovery remains available while the legacy handshake awaits that onset. Construction is held
|
|
901
923
|
* before it begins, so teardown entered through a construction callback waits for the resulting
|
|
902
924
|
* probe and releases it. A constructor refusal clears that held operation for a later retry.
|
|
903
925
|
*
|
|
@@ -907,7 +929,8 @@ export declare class Probe implements ProbeInterface {
|
|
|
907
929
|
* serving is still attached and still fires afterwards. The transport reads a stream this server
|
|
908
930
|
* owns rather than this process's standard input, which is what makes that possible: the
|
|
909
931
|
* transport's own listeners land on that stream, and the only listeners this server ever puts on
|
|
910
|
-
* `process.stdin` are the `data`, `close`, and `error` forwarders
|
|
932
|
+
* `process.stdin` are the `data`, `close`, and `error` forwarders and the input-end teardown.
|
|
933
|
+
* `destroy` pauses the
|
|
911
934
|
* stream only when this server is what set it flowing and nothing else is reading it, so a process
|
|
912
935
|
* that outlives this server reads its own standard input again and receives its own signals.
|
|
913
936
|
* Teardown removes the signal handlers first: it takes seconds when a boot is in flight, and a
|
|
@@ -916,7 +939,7 @@ export declare class Probe implements ProbeInterface {
|
|
|
916
939
|
* @example
|
|
917
940
|
* ```ts
|
|
918
941
|
* const server = new ProbeServer({ workspace: process.cwd() })
|
|
919
|
-
* server.start()
|
|
942
|
+
* await server.start()
|
|
920
943
|
* await server.destroy()
|
|
921
944
|
* ```
|
|
922
945
|
*/
|
|
@@ -924,12 +947,12 @@ export declare class ProbeServer implements ProbeServerInterface {
|
|
|
924
947
|
#private;
|
|
925
948
|
/**
|
|
926
949
|
* Snapshots the probe options this server will use and binds the published schema to this
|
|
927
|
-
* process's stdio transport
|
|
950
|
+
* process's stdio transport without warming the workspace.
|
|
928
951
|
*
|
|
929
|
-
* @param options - Workspace, deadline, and initial observation hooks for the
|
|
952
|
+
* @param options - Workspace, deadline, and initial observation hooks for the probe
|
|
930
953
|
*/
|
|
931
954
|
constructor(options?: ProbeOptions);
|
|
932
|
-
start(): void
|
|
955
|
+
start(): Promise<void>;
|
|
933
956
|
destroy(): Promise<void>;
|
|
934
957
|
}
|
|
935
958
|
|
|
@@ -938,43 +961,45 @@ export declare class ProbeServer implements ProbeServerInterface {
|
|
|
938
961
|
*
|
|
939
962
|
* @remarks
|
|
940
963
|
* Construction snapshots the options and resolves the workspace against the current working
|
|
941
|
-
* directory without loading its toolchain.
|
|
942
|
-
*
|
|
964
|
+
* directory without loading its toolchain. Starting creates the probe and awaits its lint and
|
|
965
|
+
* runtime onset; type warming and the boot controls continue behind it.
|
|
966
|
+
* Discovery answers during onset; legacy initialization waits for that onset's settlement.
|
|
943
967
|
*
|
|
944
968
|
* The server owns the process it runs in. `start` seizes standard input and standard output for
|
|
945
969
|
* the transport and registers the termination handlers a harness signals, so a host that starts one
|
|
946
970
|
* has already given the process to it. `destroy` reverses all of that and tears the probe down with
|
|
947
|
-
* it
|
|
948
|
-
*
|
|
949
|
-
*
|
|
971
|
+
* it. When teardown begins during construction, it waits for that construction and releases the
|
|
972
|
+
* resulting probe before it settles. Destruction before starting loads no workspace tools,
|
|
973
|
+
* which is why there is no verb that stops serving and leaves
|
|
950
974
|
* the stages standing: a probe nothing is reading from holds its tools and its mirror for nobody.
|
|
951
975
|
*
|
|
952
976
|
* @example
|
|
953
977
|
* ```ts
|
|
954
978
|
* const server = new ProbeServer({ workspace: process.cwd() })
|
|
955
|
-
* server.start()
|
|
979
|
+
* await server.start()
|
|
956
980
|
* await server.destroy()
|
|
957
981
|
* ```
|
|
958
982
|
*/
|
|
959
983
|
export declare interface ProbeServerInterface {
|
|
960
984
|
/**
|
|
961
|
-
*
|
|
985
|
+
* Begins serving and awaits the workspace probe's lint and runtime onset.
|
|
962
986
|
*
|
|
963
987
|
* @remarks
|
|
964
988
|
* Reads newline-delimited JSON requests from standard input, and answers a `SIGINT` or a
|
|
965
|
-
* `SIGTERM` by destroying the server.
|
|
966
|
-
*
|
|
989
|
+
* `SIGTERM` or input end by destroying the server. Repeated calls join the same setup promise.
|
|
990
|
+
* A refused onset keeps discovery serving and permits a later tool call to retry the probe.
|
|
991
|
+
* Teardown during setup is absorbed; calling after teardown rejects with `destroyed`.
|
|
967
992
|
*
|
|
968
|
-
* @returns
|
|
969
|
-
* @throws
|
|
993
|
+
* @returns The shared setup promise
|
|
994
|
+
* @throws A workspace onset refusal, or `destroyed` after teardown begins
|
|
970
995
|
*
|
|
971
996
|
* @example
|
|
972
997
|
* ```ts
|
|
973
998
|
* const server = new ProbeServer({ workspace: process.cwd() })
|
|
974
|
-
* server.start()
|
|
999
|
+
* await server.start()
|
|
975
1000
|
* ```
|
|
976
1001
|
*/
|
|
977
|
-
start(): void
|
|
1002
|
+
start(): Promise<void>;
|
|
978
1003
|
/**
|
|
979
1004
|
* Releases the transport, the process listeners, and the probe behind them.
|
|
980
1005
|
*
|
|
@@ -1222,7 +1247,7 @@ export declare function resolveWorkspaceModule(workspace: string, specifier: str
|
|
|
1222
1247
|
* Inspects tests through one resident Vitest service from the target workspace.
|
|
1223
1248
|
*
|
|
1224
1249
|
* @remarks
|
|
1225
|
-
*
|
|
1250
|
+
* Starting launches Vitest with the threads pool and instruments each inline or function-declared
|
|
1226
1251
|
* project with a Vite plugin that reads the active inspection's candidate overlay. A selected
|
|
1227
1252
|
* string-declared project reports a workspace issue because its configuration carries no runtime
|
|
1228
1253
|
* overlay plugin. Every inspection writes one fresh sibling specification, invalidates each
|
|
@@ -1281,16 +1306,20 @@ export declare function resolveWorkspaceModule(workspace: string, specifier: str
|
|
|
1281
1306
|
export declare class RuntimeStage implements StageInterface {
|
|
1282
1307
|
#private;
|
|
1283
1308
|
/**
|
|
1284
|
-
*
|
|
1285
|
-
*
|
|
1286
|
-
* @remarks Loading starts during this call. A loader refusal rejects the owned warm operation
|
|
1287
|
-
* rather than construction, so `inspect` reports it and `destroy` remains available.
|
|
1309
|
+
* Records the target workspace without loading its Vitest service.
|
|
1288
1310
|
*
|
|
1289
1311
|
* @param workspace - The target workspace root. Default: the current working directory
|
|
1290
1312
|
*/
|
|
1291
1313
|
constructor(workspace?: string);
|
|
1292
1314
|
get stage(): Stage;
|
|
1293
1315
|
get progress(): number;
|
|
1316
|
+
/**
|
|
1317
|
+
* Begins the warm or joins the warm already begun.
|
|
1318
|
+
*
|
|
1319
|
+
* @returns A promise that resolves after the resident Vitest service is ready
|
|
1320
|
+
* @throws When warming fails or teardown has begun
|
|
1321
|
+
*/
|
|
1322
|
+
start(): Promise<void>;
|
|
1294
1323
|
/**
|
|
1295
1324
|
* Inspects one case.
|
|
1296
1325
|
*
|
|
@@ -1347,10 +1376,10 @@ export declare function scanDiagnostics(text: string): readonly Diagnostic[];
|
|
|
1347
1376
|
* Inspects one case with the workspace's own tool.
|
|
1348
1377
|
*
|
|
1349
1378
|
* @remarks
|
|
1350
|
-
* Warming begins at
|
|
1379
|
+
* Warming begins at `start()`. The `inspect` method calls it and awaits the warm operation, which
|
|
1351
1380
|
* builds the resident tool or the mirror it reuses across calls. A stage serves one inspection at
|
|
1352
1381
|
* a time and admits none itself. Await an inspection before starting the next one, or admit
|
|
1353
|
-
* through
|
|
1382
|
+
* through the coordinator's admission: a second concurrent call reaches the same
|
|
1354
1383
|
* resident tool or mirror and the same overlay, document, and specification state the first is
|
|
1355
1384
|
* still using. A stage never holds a later inspection behind an earlier one, so a caller that
|
|
1356
1385
|
* abandons an inspection at its own deadline can still use the stage. The `destroy` method
|
|
@@ -1377,6 +1406,13 @@ export declare interface StageInterface {
|
|
|
1377
1406
|
* instrument rather than to the claimant.
|
|
1378
1407
|
*/
|
|
1379
1408
|
readonly progress: number;
|
|
1409
|
+
/**
|
|
1410
|
+
* Begins the warm or joins the warm already begun.
|
|
1411
|
+
*
|
|
1412
|
+
* @returns A promise that resolves after the resident tool or mirror is ready
|
|
1413
|
+
* @throws When warming fails or teardown has begun
|
|
1414
|
+
*/
|
|
1415
|
+
start(): Promise<void>;
|
|
1380
1416
|
/**
|
|
1381
1417
|
* Inspects one case.
|
|
1382
1418
|
*
|
|
@@ -1412,7 +1448,7 @@ export declare interface StageInterface {
|
|
|
1412
1448
|
*
|
|
1413
1449
|
* @remarks
|
|
1414
1450
|
* The compiler is a process this stage spawns rather than a module it loads, so nothing here holds
|
|
1415
|
-
* a resident program and the host's event loop is free for the whole check.
|
|
1451
|
+
* a resident program and the host's event loop is free for the whole check. Starting sweeps a
|
|
1416
1452
|
* mirror an earlier host left behind, copies the workspace into a fresh one under
|
|
1417
1453
|
* {@link TYPE_MIRROR}, and builds each declared project's incremental state there, so the first
|
|
1418
1454
|
* inspection is warm.
|
|
@@ -1445,13 +1481,14 @@ export declare interface StageInterface {
|
|
|
1445
1481
|
export declare class TypeStage implements TypeStageInterface {
|
|
1446
1482
|
#private;
|
|
1447
1483
|
/**
|
|
1448
|
-
*
|
|
1484
|
+
* Records the workspace and the mirror path without starting its compiler.
|
|
1449
1485
|
*
|
|
1450
1486
|
* @param workspace - The target workspace root. Default: the current working directory
|
|
1451
1487
|
*/
|
|
1452
1488
|
constructor(workspace?: string);
|
|
1453
1489
|
get stage(): Stage;
|
|
1454
1490
|
get progress(): number;
|
|
1491
|
+
start(): Promise<void>;
|
|
1455
1492
|
/**
|
|
1456
1493
|
* Inspects one case, against a caller-named project where the caller names one.
|
|
1457
1494
|
*
|
|
@@ -1520,6 +1557,7 @@ export declare interface TypeStageInterface extends StageInterface {
|
|
|
1520
1557
|
inspect(subject: Case, project?: string): Promise<Check>;
|
|
1521
1558
|
/**
|
|
1522
1559
|
* Resolves one project to the path and digest the stage applies for it.
|
|
1560
|
+
* Calls `start()` before reading the project.
|
|
1523
1561
|
*
|
|
1524
1562
|
* @param project - The workspace-relative TypeScript project to resolve
|
|
1525
1563
|
* @returns The resolved workspace-relative path and the digest of its compiler options
|
|
@@ -5,6 +5,8 @@ import type { EmitterInterface } from '@orkestrel/emitter';
|
|
|
5
5
|
import type { EventEmitter } from 'node:events';
|
|
6
6
|
import type { Issue } from '@orkestrel/probe';
|
|
7
7
|
import type { LSPRange } from '@orkestrel/lsp';
|
|
8
|
+
import { MCPError } from '@orkestrel/mcp';
|
|
9
|
+
import type { ProbeError } from '@orkestrel/probe';
|
|
8
10
|
import type { ProbeEventMap } from '@orkestrel/probe';
|
|
9
11
|
import type { ProbeInterface } from '@orkestrel/probe';
|
|
10
12
|
import type { ProbeOptions } from '@orkestrel/probe';
|
|
@@ -89,6 +91,19 @@ export declare function collectWorkspaceFiles(workspace: string): readonly strin
|
|
|
89
91
|
*/
|
|
90
92
|
export declare function computeDigest(workspace: string, value: unknown): string;
|
|
91
93
|
|
|
94
|
+
/**
|
|
95
|
+
* Creates the protocol failure returned when the MCP handshake cannot arm the probe.
|
|
96
|
+
*
|
|
97
|
+
* @param error - The classified probe failure that ended initialization
|
|
98
|
+
* @returns An MCP server error carrying the probe failure's origin and code as protocol data
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* ```ts
|
|
102
|
+
* createHandshakeError(createDestroyedError('probe server')).code // -32000
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
export declare function createHandshakeError(error: ProbeError): MCPError;
|
|
106
|
+
|
|
92
107
|
/**
|
|
93
108
|
* Normalizes a caught or foreign error into readable text.
|
|
94
109
|
*
|
|
@@ -381,7 +396,7 @@ export declare function isRefusedName(file: string, error: unknown): boolean;
|
|
|
381
396
|
* Inspects virtual documents through one resident Oxlint language server.
|
|
382
397
|
*
|
|
383
398
|
* @remarks
|
|
384
|
-
*
|
|
399
|
+
* Starting launches the target workspace's Oxlint binary with its Language Server Protocol mode
|
|
385
400
|
* and hands the conversation to `@orkestrel/lsp`: `createStdioClientTransport` owns the child
|
|
386
401
|
* process and its bytes, and `createLSPClient` owns the framing, the request correlation, the
|
|
387
402
|
* capabilities this stage advertises, and the choice between pulled and pushed diagnostics. This
|
|
@@ -417,13 +432,15 @@ export declare function isRefusedName(file: string, error: unknown): boolean;
|
|
|
417
432
|
export declare class LintStage implements LintStageInterface {
|
|
418
433
|
#private;
|
|
419
434
|
/**
|
|
420
|
-
*
|
|
435
|
+
* Records the target workspace without starting its language server.
|
|
421
436
|
*
|
|
422
437
|
* @param workspace - The target workspace root. Default: the current working directory
|
|
423
438
|
*/
|
|
424
439
|
constructor(workspace?: string);
|
|
425
440
|
get stage(): Stage;
|
|
426
441
|
get progress(): number;
|
|
442
|
+
get exit(): Promise<never>;
|
|
443
|
+
start(): Promise<void>;
|
|
427
444
|
inspect(subject: Case, options?: InspectionOptions): Promise<Check>;
|
|
428
445
|
destroy(): Promise<void>;
|
|
429
446
|
}
|
|
@@ -448,6 +465,8 @@ export declare class LintStage implements LintStageInterface {
|
|
|
448
465
|
* ```
|
|
449
466
|
*/
|
|
450
467
|
export declare interface LintStageInterface extends StageInterface {
|
|
468
|
+
/** Rejects with the instrument fault on an exit before teardown; never fulfills. */
|
|
469
|
+
readonly exit: Promise<never>;
|
|
451
470
|
/**
|
|
452
471
|
* Inspects one case, under the bound the caller supplies.
|
|
453
472
|
*
|
|
@@ -824,9 +843,10 @@ export declare function parseRevisionOwner(revision: string): number | undefined
|
|
|
824
843
|
* Answers claims through its type, lint, and runtime stages.
|
|
825
844
|
*
|
|
826
845
|
* @remarks
|
|
827
|
-
* Construction resolves the target workspace's toolchain
|
|
846
|
+
* Construction resolves the target workspace's toolchain. Starting warms every stage and waits
|
|
847
|
+
* for lint and runtime; type warming and the boot controls continue behind that gate. The boot
|
|
828
848
|
* controls mutate imported dependencies and refuse service unless the type and runtime stages
|
|
829
|
-
* report their respective changes. One
|
|
849
|
+
* report their respective changes. One pool per stage admits inspections in arrival order, one at
|
|
830
850
|
* a time, so a stage never serves two claims at once and the deadline covers active work rather
|
|
831
851
|
* than queue wait. Each active stage inspection has a coordinator-owned deadline. An expiry at any
|
|
832
852
|
* stage abandons that stage and replaces it before the next queued inspection begins, so one slow
|
|
@@ -871,33 +891,35 @@ export declare function parseRevisionOwner(revision: string): number | undefined
|
|
|
871
891
|
* const probe = new Probe({ workspace: process.cwd() })
|
|
872
892
|
* const verdict = await probe.prove(claim)
|
|
873
893
|
* verdict.digest // 'bdf03e5dfd6bd413ead671c7a2940fcf'
|
|
874
|
-
* verdict.receipt // 'probe:bdf03e5dfd6bd413ead671c7a2940fcf:type:typescript@6.0.3:oxlint@1.
|
|
894
|
+
* verdict.receipt // 'probe:bdf03e5dfd6bd413ead671c7a2940fcf:type:typescript@6.0.3:oxlint@1.87.0:vitest@4.1.11:configs/src/tsconfig.core.json@434f59254d58cf2683d453a26bd0d837'
|
|
875
895
|
* await probe.destroy()
|
|
876
896
|
* ```
|
|
877
897
|
*/
|
|
878
898
|
export declare class Probe implements ProbeInterface {
|
|
879
899
|
#private;
|
|
880
900
|
/**
|
|
881
|
-
* Resolves the target toolchain and
|
|
901
|
+
* Resolves the target toolchain and constructs the stage pools without warming them.
|
|
882
902
|
*
|
|
883
|
-
* @param options - Workspace,
|
|
903
|
+
* @param options - Workspace, inspection and warm bounds, and initial observation hooks
|
|
884
904
|
*/
|
|
885
905
|
constructor(options?: ProbeOptions);
|
|
886
906
|
get emitter(): EmitterInterface<ProbeEventMap>;
|
|
887
907
|
get toolchain(): Toolchain;
|
|
888
908
|
prove(claim: Claim): Promise<Verdict>;
|
|
889
909
|
destroy(): Promise<void>;
|
|
910
|
+
start(): Promise<void>;
|
|
890
911
|
}
|
|
891
912
|
|
|
892
913
|
/**
|
|
893
914
|
* Implements `ProbeServerInterface` over a `PassThrough` stream this server owns, binding the
|
|
894
915
|
* published `prove` tool and the dual-era dispatcher to this process's Model Context Protocol
|
|
895
|
-
* stdio transport.
|
|
916
|
+
* stdio transport. Starting creates the probe and awaits its lint and runtime onset; type warming
|
|
917
|
+
* and the boot controls continue behind it.
|
|
896
918
|
*
|
|
897
919
|
* @remarks
|
|
898
920
|
* Construction snapshots the probe options, publishes the `prove` tool, and binds the dual-era
|
|
899
|
-
* dispatcher to the stdio transport.
|
|
900
|
-
*
|
|
921
|
+
* dispatcher to the stdio transport.
|
|
922
|
+
* Discovery remains available while the legacy handshake awaits that onset. Construction is held
|
|
901
923
|
* before it begins, so teardown entered through a construction callback waits for the resulting
|
|
902
924
|
* probe and releases it. A constructor refusal clears that held operation for a later retry.
|
|
903
925
|
*
|
|
@@ -907,7 +929,8 @@ export declare class Probe implements ProbeInterface {
|
|
|
907
929
|
* serving is still attached and still fires afterwards. The transport reads a stream this server
|
|
908
930
|
* owns rather than this process's standard input, which is what makes that possible: the
|
|
909
931
|
* transport's own listeners land on that stream, and the only listeners this server ever puts on
|
|
910
|
-
* `process.stdin` are the `data`, `close`, and `error` forwarders
|
|
932
|
+
* `process.stdin` are the `data`, `close`, and `error` forwarders and the input-end teardown.
|
|
933
|
+
* `destroy` pauses the
|
|
911
934
|
* stream only when this server is what set it flowing and nothing else is reading it, so a process
|
|
912
935
|
* that outlives this server reads its own standard input again and receives its own signals.
|
|
913
936
|
* Teardown removes the signal handlers first: it takes seconds when a boot is in flight, and a
|
|
@@ -916,7 +939,7 @@ export declare class Probe implements ProbeInterface {
|
|
|
916
939
|
* @example
|
|
917
940
|
* ```ts
|
|
918
941
|
* const server = new ProbeServer({ workspace: process.cwd() })
|
|
919
|
-
* server.start()
|
|
942
|
+
* await server.start()
|
|
920
943
|
* await server.destroy()
|
|
921
944
|
* ```
|
|
922
945
|
*/
|
|
@@ -924,12 +947,12 @@ export declare class ProbeServer implements ProbeServerInterface {
|
|
|
924
947
|
#private;
|
|
925
948
|
/**
|
|
926
949
|
* Snapshots the probe options this server will use and binds the published schema to this
|
|
927
|
-
* process's stdio transport
|
|
950
|
+
* process's stdio transport without warming the workspace.
|
|
928
951
|
*
|
|
929
|
-
* @param options - Workspace, deadline, and initial observation hooks for the
|
|
952
|
+
* @param options - Workspace, deadline, and initial observation hooks for the probe
|
|
930
953
|
*/
|
|
931
954
|
constructor(options?: ProbeOptions);
|
|
932
|
-
start(): void
|
|
955
|
+
start(): Promise<void>;
|
|
933
956
|
destroy(): Promise<void>;
|
|
934
957
|
}
|
|
935
958
|
|
|
@@ -938,43 +961,45 @@ export declare class ProbeServer implements ProbeServerInterface {
|
|
|
938
961
|
*
|
|
939
962
|
* @remarks
|
|
940
963
|
* Construction snapshots the options and resolves the workspace against the current working
|
|
941
|
-
* directory without loading its toolchain.
|
|
942
|
-
*
|
|
964
|
+
* directory without loading its toolchain. Starting creates the probe and awaits its lint and
|
|
965
|
+
* runtime onset; type warming and the boot controls continue behind it.
|
|
966
|
+
* Discovery answers during onset; legacy initialization waits for that onset's settlement.
|
|
943
967
|
*
|
|
944
968
|
* The server owns the process it runs in. `start` seizes standard input and standard output for
|
|
945
969
|
* the transport and registers the termination handlers a harness signals, so a host that starts one
|
|
946
970
|
* has already given the process to it. `destroy` reverses all of that and tears the probe down with
|
|
947
|
-
* it
|
|
948
|
-
*
|
|
949
|
-
*
|
|
971
|
+
* it. When teardown begins during construction, it waits for that construction and releases the
|
|
972
|
+
* resulting probe before it settles. Destruction before starting loads no workspace tools,
|
|
973
|
+
* which is why there is no verb that stops serving and leaves
|
|
950
974
|
* the stages standing: a probe nothing is reading from holds its tools and its mirror for nobody.
|
|
951
975
|
*
|
|
952
976
|
* @example
|
|
953
977
|
* ```ts
|
|
954
978
|
* const server = new ProbeServer({ workspace: process.cwd() })
|
|
955
|
-
* server.start()
|
|
979
|
+
* await server.start()
|
|
956
980
|
* await server.destroy()
|
|
957
981
|
* ```
|
|
958
982
|
*/
|
|
959
983
|
export declare interface ProbeServerInterface {
|
|
960
984
|
/**
|
|
961
|
-
*
|
|
985
|
+
* Begins serving and awaits the workspace probe's lint and runtime onset.
|
|
962
986
|
*
|
|
963
987
|
* @remarks
|
|
964
988
|
* Reads newline-delimited JSON requests from standard input, and answers a `SIGINT` or a
|
|
965
|
-
* `SIGTERM` by destroying the server.
|
|
966
|
-
*
|
|
989
|
+
* `SIGTERM` or input end by destroying the server. Repeated calls join the same setup promise.
|
|
990
|
+
* A refused onset keeps discovery serving and permits a later tool call to retry the probe.
|
|
991
|
+
* Teardown during setup is absorbed; calling after teardown rejects with `destroyed`.
|
|
967
992
|
*
|
|
968
|
-
* @returns
|
|
969
|
-
* @throws
|
|
993
|
+
* @returns The shared setup promise
|
|
994
|
+
* @throws A workspace onset refusal, or `destroyed` after teardown begins
|
|
970
995
|
*
|
|
971
996
|
* @example
|
|
972
997
|
* ```ts
|
|
973
998
|
* const server = new ProbeServer({ workspace: process.cwd() })
|
|
974
|
-
* server.start()
|
|
999
|
+
* await server.start()
|
|
975
1000
|
* ```
|
|
976
1001
|
*/
|
|
977
|
-
start(): void
|
|
1002
|
+
start(): Promise<void>;
|
|
978
1003
|
/**
|
|
979
1004
|
* Releases the transport, the process listeners, and the probe behind them.
|
|
980
1005
|
*
|
|
@@ -1222,7 +1247,7 @@ export declare function resolveWorkspaceModule(workspace: string, specifier: str
|
|
|
1222
1247
|
* Inspects tests through one resident Vitest service from the target workspace.
|
|
1223
1248
|
*
|
|
1224
1249
|
* @remarks
|
|
1225
|
-
*
|
|
1250
|
+
* Starting launches Vitest with the threads pool and instruments each inline or function-declared
|
|
1226
1251
|
* project with a Vite plugin that reads the active inspection's candidate overlay. A selected
|
|
1227
1252
|
* string-declared project reports a workspace issue because its configuration carries no runtime
|
|
1228
1253
|
* overlay plugin. Every inspection writes one fresh sibling specification, invalidates each
|
|
@@ -1281,16 +1306,20 @@ export declare function resolveWorkspaceModule(workspace: string, specifier: str
|
|
|
1281
1306
|
export declare class RuntimeStage implements StageInterface {
|
|
1282
1307
|
#private;
|
|
1283
1308
|
/**
|
|
1284
|
-
*
|
|
1285
|
-
*
|
|
1286
|
-
* @remarks Loading starts during this call. A loader refusal rejects the owned warm operation
|
|
1287
|
-
* rather than construction, so `inspect` reports it and `destroy` remains available.
|
|
1309
|
+
* Records the target workspace without loading its Vitest service.
|
|
1288
1310
|
*
|
|
1289
1311
|
* @param workspace - The target workspace root. Default: the current working directory
|
|
1290
1312
|
*/
|
|
1291
1313
|
constructor(workspace?: string);
|
|
1292
1314
|
get stage(): Stage;
|
|
1293
1315
|
get progress(): number;
|
|
1316
|
+
/**
|
|
1317
|
+
* Begins the warm or joins the warm already begun.
|
|
1318
|
+
*
|
|
1319
|
+
* @returns A promise that resolves after the resident Vitest service is ready
|
|
1320
|
+
* @throws When warming fails or teardown has begun
|
|
1321
|
+
*/
|
|
1322
|
+
start(): Promise<void>;
|
|
1294
1323
|
/**
|
|
1295
1324
|
* Inspects one case.
|
|
1296
1325
|
*
|
|
@@ -1347,10 +1376,10 @@ export declare function scanDiagnostics(text: string): readonly Diagnostic[];
|
|
|
1347
1376
|
* Inspects one case with the workspace's own tool.
|
|
1348
1377
|
*
|
|
1349
1378
|
* @remarks
|
|
1350
|
-
* Warming begins at
|
|
1379
|
+
* Warming begins at `start()`. The `inspect` method calls it and awaits the warm operation, which
|
|
1351
1380
|
* builds the resident tool or the mirror it reuses across calls. A stage serves one inspection at
|
|
1352
1381
|
* a time and admits none itself. Await an inspection before starting the next one, or admit
|
|
1353
|
-
* through
|
|
1382
|
+
* through the coordinator's admission: a second concurrent call reaches the same
|
|
1354
1383
|
* resident tool or mirror and the same overlay, document, and specification state the first is
|
|
1355
1384
|
* still using. A stage never holds a later inspection behind an earlier one, so a caller that
|
|
1356
1385
|
* abandons an inspection at its own deadline can still use the stage. The `destroy` method
|
|
@@ -1377,6 +1406,13 @@ export declare interface StageInterface {
|
|
|
1377
1406
|
* instrument rather than to the claimant.
|
|
1378
1407
|
*/
|
|
1379
1408
|
readonly progress: number;
|
|
1409
|
+
/**
|
|
1410
|
+
* Begins the warm or joins the warm already begun.
|
|
1411
|
+
*
|
|
1412
|
+
* @returns A promise that resolves after the resident tool or mirror is ready
|
|
1413
|
+
* @throws When warming fails or teardown has begun
|
|
1414
|
+
*/
|
|
1415
|
+
start(): Promise<void>;
|
|
1380
1416
|
/**
|
|
1381
1417
|
* Inspects one case.
|
|
1382
1418
|
*
|
|
@@ -1412,7 +1448,7 @@ export declare interface StageInterface {
|
|
|
1412
1448
|
*
|
|
1413
1449
|
* @remarks
|
|
1414
1450
|
* The compiler is a process this stage spawns rather than a module it loads, so nothing here holds
|
|
1415
|
-
* a resident program and the host's event loop is free for the whole check.
|
|
1451
|
+
* a resident program and the host's event loop is free for the whole check. Starting sweeps a
|
|
1416
1452
|
* mirror an earlier host left behind, copies the workspace into a fresh one under
|
|
1417
1453
|
* {@link TYPE_MIRROR}, and builds each declared project's incremental state there, so the first
|
|
1418
1454
|
* inspection is warm.
|
|
@@ -1445,13 +1481,14 @@ export declare interface StageInterface {
|
|
|
1445
1481
|
export declare class TypeStage implements TypeStageInterface {
|
|
1446
1482
|
#private;
|
|
1447
1483
|
/**
|
|
1448
|
-
*
|
|
1484
|
+
* Records the workspace and the mirror path without starting its compiler.
|
|
1449
1485
|
*
|
|
1450
1486
|
* @param workspace - The target workspace root. Default: the current working directory
|
|
1451
1487
|
*/
|
|
1452
1488
|
constructor(workspace?: string);
|
|
1453
1489
|
get stage(): Stage;
|
|
1454
1490
|
get progress(): number;
|
|
1491
|
+
start(): Promise<void>;
|
|
1455
1492
|
/**
|
|
1456
1493
|
* Inspects one case, against a caller-named project where the caller names one.
|
|
1457
1494
|
*
|
|
@@ -1520,6 +1557,7 @@ export declare interface TypeStageInterface extends StageInterface {
|
|
|
1520
1557
|
inspect(subject: Case, project?: string): Promise<Check>;
|
|
1521
1558
|
/**
|
|
1522
1559
|
* Resolves one project to the path and digest the stage applies for it.
|
|
1560
|
+
* Calls `start()` before reading the project.
|
|
1523
1561
|
*
|
|
1524
1562
|
* @param project - The workspace-relative TypeScript project to resolve
|
|
1525
1563
|
* @returns The resolved workspace-relative path and the digest of its compiler options
|