@orkestrel/probe 0.0.11 → 0.0.13
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 +22 -11
- package/dist/bin/main.js +1 -1
- package/dist/bin/main.js.map +1 -1
- package/dist/src/core/index.cjs +77 -16
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +245 -147
- package/dist/src/core/index.d.ts +245 -147
- package/dist/src/core/index.js +75 -17
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/server/index.cjs +829 -375
- package/dist/src/server/index.cjs.map +1 -1
- package/dist/src/server/index.d.cts +531 -163
- package/dist/src/server/index.d.ts +531 -163
- package/dist/src/server/index.js +821 -375
- package/dist/src/server/index.js.map +1 -1
- package/package.json +20 -21
package/dist/src/core/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ArrayShape } from '@orkestrel/contract';
|
|
2
|
-
import { EmitterErrorHandler } from '@orkestrel/emitter';
|
|
3
|
-
import { EmitterHooks } from '@orkestrel/emitter';
|
|
4
|
-
import { EmitterInterface } from '@orkestrel/emitter';
|
|
5
|
-
import { Guard } from '@orkestrel/contract';
|
|
2
|
+
import type { EmitterErrorHandler } from '@orkestrel/emitter';
|
|
3
|
+
import type { EmitterHooks } from '@orkestrel/emitter';
|
|
4
|
+
import type { EmitterInterface } from '@orkestrel/emitter';
|
|
5
|
+
import type { Guard } from '@orkestrel/contract';
|
|
6
6
|
import { LiteralShape } from '@orkestrel/contract';
|
|
7
|
-
import { LSPRange } from '@orkestrel/lsp';
|
|
7
|
+
import type { LSPRange } from '@orkestrel/lsp';
|
|
8
8
|
import { ObjectShape } from '@orkestrel/contract';
|
|
9
9
|
import { StringShape } from '@orkestrel/contract';
|
|
10
10
|
|
|
@@ -20,18 +20,23 @@ import { StringShape } from '@orkestrel/contract';
|
|
|
20
20
|
* @example
|
|
21
21
|
* ```ts
|
|
22
22
|
* const subject: Case = {
|
|
23
|
-
* files: [
|
|
23
|
+
* files: [
|
|
24
|
+
* {
|
|
25
|
+
* path: 'src/core/factories.ts',
|
|
26
|
+
* text: "export function createGreeting(): string {\n\treturn 'hi'\n}\n",
|
|
27
|
+
* },
|
|
28
|
+
* ],
|
|
24
29
|
* test: {
|
|
25
30
|
* path: 'tmp/probe/greeting.test.ts',
|
|
26
|
-
* text: "import { expect, test } from 'vitest'\nimport {
|
|
31
|
+
* text: "import { expect, test } from 'vitest'\nimport { createGreeting } from '../../src/core/factories.js'\ntest('greets', () => expect(createGreeting()).toBe('hi'))\n",
|
|
27
32
|
* },
|
|
28
33
|
* }
|
|
29
34
|
* ```
|
|
30
35
|
*/
|
|
31
36
|
export declare interface Case {
|
|
32
|
-
/**
|
|
37
|
+
/** Holds the candidate drafts the test imports, in the order the claim supplies them. */
|
|
33
38
|
readonly files: readonly Draft[];
|
|
34
|
-
/**
|
|
39
|
+
/** Holds the test that exercises those drafts. */
|
|
35
40
|
readonly test: Draft;
|
|
36
41
|
}
|
|
37
42
|
|
|
@@ -44,15 +49,15 @@ export declare interface Case {
|
|
|
44
49
|
* compileGuard(CASE_SHAPE)({ files: [], test }) // true
|
|
45
50
|
* ```
|
|
46
51
|
*/
|
|
47
|
-
export declare const CASE_SHAPE: ObjectShape<{
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
export declare const CASE_SHAPE: ObjectShape< {
|
|
53
|
+
files: ArrayShape<ObjectShape< {
|
|
54
|
+
path: StringShape;
|
|
55
|
+
text: StringShape;
|
|
56
|
+
}, false>>;
|
|
57
|
+
test: ObjectShape< {
|
|
58
|
+
path: StringShape;
|
|
59
|
+
text: StringShape;
|
|
60
|
+
}, false>;
|
|
56
61
|
}, false>;
|
|
57
62
|
|
|
58
63
|
/**
|
|
@@ -68,11 +73,11 @@ export declare const CASE_SHAPE: ObjectShape<{
|
|
|
68
73
|
* ```
|
|
69
74
|
*/
|
|
70
75
|
export declare interface Check {
|
|
71
|
-
/**
|
|
76
|
+
/** Names the stage that produced this outcome. */
|
|
72
77
|
readonly stage: Stage;
|
|
73
|
-
/**
|
|
78
|
+
/** Holds the milliseconds the stage took. */
|
|
74
79
|
readonly elapsed: number;
|
|
75
|
-
/**
|
|
80
|
+
/** Holds every message the stage's tool reported, in the tool's own order. */
|
|
76
81
|
readonly issues: readonly Issue[];
|
|
77
82
|
}
|
|
78
83
|
|
|
@@ -95,30 +100,43 @@ export declare interface Check {
|
|
|
95
100
|
* const claim: Claim = {
|
|
96
101
|
* project: 'configs/src/tsconfig.core.json',
|
|
97
102
|
* case: {
|
|
98
|
-
* files: [
|
|
103
|
+
* files: [
|
|
104
|
+
* {
|
|
105
|
+
* path: 'src/core/factories.ts',
|
|
106
|
+
* text: "export function createGreeting(): string {\n\treturn 'hi'\n}\n",
|
|
107
|
+
* },
|
|
108
|
+
* ],
|
|
99
109
|
* test: {
|
|
100
110
|
* path: 'tmp/probe/greeting.test.ts',
|
|
101
|
-
* text: "import { expect, test } from 'vitest'\nimport {
|
|
111
|
+
* text: "import { expect, test } from 'vitest'\nimport { createGreeting } from '../../src/core/factories.js'\ntest('greets', () => expect(createGreeting()).toBe('hi'))\n",
|
|
102
112
|
* },
|
|
103
113
|
* },
|
|
104
114
|
* control: {
|
|
105
|
-
* files: [
|
|
115
|
+
* files: [
|
|
116
|
+
* {
|
|
117
|
+
* path: 'src/core/factories.ts',
|
|
118
|
+
* text: "export function createGreeting(): number {\n\treturn 'hi'\n}\n",
|
|
119
|
+
* },
|
|
120
|
+
* ],
|
|
106
121
|
* test: {
|
|
107
122
|
* path: 'tmp/probe/greeting.test.ts',
|
|
108
|
-
* text: "import { expect, test } from 'vitest'\nimport {
|
|
123
|
+
* text: "import { expect, test } from 'vitest'\nimport { createGreeting } from '../../src/core/factories.js'\ntest('greets', () => expect(createGreeting()).toBe('hi'))\n",
|
|
109
124
|
* },
|
|
110
125
|
* stage: 'type',
|
|
111
|
-
* reason: 'a string
|
|
126
|
+
* reason: 'a string returned as a number must not compile',
|
|
112
127
|
* },
|
|
113
128
|
* }
|
|
114
129
|
* ```
|
|
115
130
|
*/
|
|
116
131
|
export declare interface Claim {
|
|
117
|
-
/**
|
|
132
|
+
/**
|
|
133
|
+
* Names the workspace-relative path of the TypeScript project the candidate drafts are checked
|
|
134
|
+
* against.
|
|
135
|
+
*/
|
|
118
136
|
readonly project: string;
|
|
119
|
-
/**
|
|
137
|
+
/** Holds the drafts and test the claim asserts about. */
|
|
120
138
|
readonly case: Case;
|
|
121
|
-
/**
|
|
139
|
+
/** Holds the negative control that must break, and where. */
|
|
122
140
|
readonly control: Control;
|
|
123
141
|
}
|
|
124
142
|
|
|
@@ -141,30 +159,30 @@ export declare interface Claim {
|
|
|
141
159
|
* admits({ project: 'tsconfig.json' }) // false
|
|
142
160
|
* ```
|
|
143
161
|
*/
|
|
144
|
-
export declare const CLAIM_SHAPE: ObjectShape<{
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
162
|
+
export declare const CLAIM_SHAPE: ObjectShape< {
|
|
163
|
+
project: StringShape;
|
|
164
|
+
case: ObjectShape< {
|
|
165
|
+
files: ArrayShape<ObjectShape< {
|
|
166
|
+
path: StringShape;
|
|
167
|
+
text: StringShape;
|
|
168
|
+
}, false>>;
|
|
169
|
+
test: ObjectShape< {
|
|
170
|
+
path: StringShape;
|
|
171
|
+
text: StringShape;
|
|
172
|
+
}, false>;
|
|
173
|
+
}, false>;
|
|
174
|
+
control: ObjectShape< {
|
|
175
|
+
stage: LiteralShape<readonly ["type", "lint", "runtime"]>;
|
|
176
|
+
reason: StringShape;
|
|
177
|
+
files: ArrayShape<ObjectShape< {
|
|
178
|
+
path: StringShape;
|
|
179
|
+
text: StringShape;
|
|
180
|
+
}, false>>;
|
|
181
|
+
test: ObjectShape< {
|
|
182
|
+
path: StringShape;
|
|
183
|
+
text: StringShape;
|
|
184
|
+
}, false>;
|
|
185
|
+
}, false>;
|
|
168
186
|
}, false>;
|
|
169
187
|
|
|
170
188
|
/**
|
|
@@ -205,7 +223,7 @@ export declare const CLAIM_SHAPE: ObjectShape<{
|
|
|
205
223
|
* @example
|
|
206
224
|
* ```ts
|
|
207
225
|
* computeReceipt(proven, 'type')
|
|
208
|
-
* // 'probe:6ca20c3bff623031d3955b9d1a76d71d:type:typescript@6.0.3:oxlint@1.79.0:vitest@4.1.11:configs/src/tsconfig.core.json@
|
|
226
|
+
* // 'probe:6ca20c3bff623031d3955b9d1a76d71d:type:typescript@6.0.3:oxlint@1.79.0:vitest@4.1.11:configs/src/tsconfig.core.json@d61f11b52460b1c6707cfac2c6078d59'
|
|
209
227
|
* computeReceipt(proven, 'lint') // undefined
|
|
210
228
|
* ```
|
|
211
229
|
*/
|
|
@@ -222,20 +240,25 @@ export declare function computeReceipt(verdict: Verdict, stage: Stage): string |
|
|
|
222
240
|
* @example
|
|
223
241
|
* ```ts
|
|
224
242
|
* const control: Control = {
|
|
225
|
-
* files: [
|
|
243
|
+
* files: [
|
|
244
|
+
* {
|
|
245
|
+
* path: 'src/core/factories.ts',
|
|
246
|
+
* text: "export function createGreeting(): number {\n\treturn 'hi'\n}\n",
|
|
247
|
+
* },
|
|
248
|
+
* ],
|
|
226
249
|
* test: {
|
|
227
250
|
* path: 'tmp/probe/greeting.test.ts',
|
|
228
|
-
* text: "import { expect, test } from 'vitest'\nimport {
|
|
251
|
+
* text: "import { expect, test } from 'vitest'\nimport { createGreeting } from '../../src/core/factories.js'\ntest('greets', () => expect(createGreeting()).toBe('hi'))\n",
|
|
229
252
|
* },
|
|
230
253
|
* stage: 'type',
|
|
231
|
-
* reason: 'a string
|
|
254
|
+
* reason: 'a string returned as a number must not compile',
|
|
232
255
|
* }
|
|
233
256
|
* ```
|
|
234
257
|
*/
|
|
235
258
|
export declare interface Control extends Case {
|
|
236
|
-
/**
|
|
259
|
+
/** Names the stage this control must report issues at. */
|
|
237
260
|
readonly stage: Stage;
|
|
238
|
-
/**
|
|
261
|
+
/** Explains why the control fails there, in the claimant's own words. */
|
|
239
262
|
readonly reason: string;
|
|
240
263
|
}
|
|
241
264
|
|
|
@@ -252,17 +275,17 @@ export declare interface Control extends Case {
|
|
|
252
275
|
* compileGuard(CONTROL_SHAPE)({ files: [], test, stage: 'type', reason: 'must not compile' }) // true
|
|
253
276
|
* ```
|
|
254
277
|
*/
|
|
255
|
-
export declare const CONTROL_SHAPE: ObjectShape<{
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
278
|
+
export declare const CONTROL_SHAPE: ObjectShape< {
|
|
279
|
+
stage: LiteralShape<readonly ["type", "lint", "runtime"]>;
|
|
280
|
+
reason: StringShape;
|
|
281
|
+
files: ArrayShape<ObjectShape< {
|
|
282
|
+
path: StringShape;
|
|
283
|
+
text: StringShape;
|
|
284
|
+
}, false>>;
|
|
285
|
+
test: ObjectShape< {
|
|
286
|
+
path: StringShape;
|
|
287
|
+
text: StringShape;
|
|
288
|
+
}, false>;
|
|
266
289
|
}, false>;
|
|
267
290
|
|
|
268
291
|
/**
|
|
@@ -294,13 +317,16 @@ export declare function createDestroyedError(subject: string): ProbeError;
|
|
|
294
317
|
*
|
|
295
318
|
* @example
|
|
296
319
|
* ```ts
|
|
297
|
-
* const draft: Draft = {
|
|
320
|
+
* const draft: Draft = {
|
|
321
|
+
* path: 'src/core/factories.ts',
|
|
322
|
+
* text: "export function createGreeting(): string {\n\treturn 'hi'\n}\n",
|
|
323
|
+
* }
|
|
298
324
|
* ```
|
|
299
325
|
*/
|
|
300
326
|
export declare interface Draft {
|
|
301
|
-
/**
|
|
327
|
+
/** Names the workspace-relative path the stages resolve the text against. */
|
|
302
328
|
readonly path: string;
|
|
303
|
-
/**
|
|
329
|
+
/** Holds the file's full contents. */
|
|
304
330
|
readonly text: string;
|
|
305
331
|
}
|
|
306
332
|
|
|
@@ -320,9 +346,9 @@ export declare interface Draft {
|
|
|
320
346
|
* compileGuard(DRAFT_SHAPE)({ path: 'src/core/greeting.ts', text: '' }) // true
|
|
321
347
|
* ```
|
|
322
348
|
*/
|
|
323
|
-
export declare const DRAFT_SHAPE: ObjectShape<{
|
|
324
|
-
|
|
325
|
-
|
|
349
|
+
export declare const DRAFT_SHAPE: ObjectShape< {
|
|
350
|
+
path: StringShape;
|
|
351
|
+
text: StringShape;
|
|
326
352
|
}, false>;
|
|
327
353
|
|
|
328
354
|
/**
|
|
@@ -387,7 +413,7 @@ export declare function formatIssue(issue: Issue): string;
|
|
|
387
413
|
* @example
|
|
388
414
|
* ```ts
|
|
389
415
|
* formatProof(proven)
|
|
390
|
-
* // 'receipt probe:6ca20c3bff623031d3955b9d1a76d71d:type:typescript@6.0.3:oxlint@1.79.0:vitest@4.1.11:configs/src/tsconfig.core.json@
|
|
416
|
+
* // 'receipt probe:6ca20c3bff623031d3955b9d1a76d71d:type:typescript@6.0.3:oxlint@1.79.0:vitest@4.1.11:configs/src/tsconfig.core.json@d61f11b52460b1c6707cfac2c6078d59'
|
|
391
417
|
* formatProof(disproven) // 'no receipt'
|
|
392
418
|
* ```
|
|
393
419
|
*/
|
|
@@ -544,9 +570,10 @@ export declare const isControl: Guard<Control>;
|
|
|
544
570
|
*
|
|
545
571
|
* @example
|
|
546
572
|
* ```ts
|
|
547
|
-
*
|
|
573
|
+
* const text = "export function createGreeting(): string {\n\treturn 'hi'\n}\n"
|
|
574
|
+
* isDraft({ path: 'src/core/factories.ts', text }) // true
|
|
548
575
|
* isDraft({ path: '../../etc/hosts', text: '' }) // false
|
|
549
|
-
* isDraft({ path: 'src/core/
|
|
576
|
+
* isDraft({ path: 'src/core/factories.ts' }) // false
|
|
550
577
|
* ```
|
|
551
578
|
*/
|
|
552
579
|
export declare const isDraft: Guard<Draft>;
|
|
@@ -598,7 +625,7 @@ export declare const isParty: Guard<Party>;
|
|
|
598
625
|
* condition all stay outside the type.
|
|
599
626
|
*
|
|
600
627
|
* @param value - The value to inspect
|
|
601
|
-
* @returns True
|
|
628
|
+
* @returns True if the value is a `ProbeError` instance; false otherwise
|
|
602
629
|
*
|
|
603
630
|
* @example
|
|
604
631
|
* ```ts
|
|
@@ -662,10 +689,11 @@ export declare const isStage: Guard<Stage>;
|
|
|
662
689
|
* reported no location, which happens for a whole-file diagnostic. A runtime failure is not one of
|
|
663
690
|
* those: a failure Vitest reported at a stack frame carries that frame's position.
|
|
664
691
|
*
|
|
665
|
-
* Each stage supplies the extent its own tool gives it. The
|
|
666
|
-
*
|
|
667
|
-
*
|
|
668
|
-
*
|
|
692
|
+
* Each stage supplies the extent its own tool gives it. The lint stage carries the span the language
|
|
693
|
+
* server published. A tool that reports a point rather than a span produces a zero-width range at
|
|
694
|
+
* that point, which is the same value a span of no width would carry, and the type stage and the
|
|
695
|
+
* runtime stage both report one: the compiler's plain-text output names a start position and no
|
|
696
|
+
* extent, and a stack frame names a position.
|
|
669
697
|
*
|
|
670
698
|
* `formatIssue` renders `start.line` one-based, because that is the numbering an editor shows.
|
|
671
699
|
*
|
|
@@ -673,20 +701,22 @@ export declare const isStage: Guard<Stage>;
|
|
|
673
701
|
* ```ts
|
|
674
702
|
* const issue: Issue = {
|
|
675
703
|
* origin: 'claimant',
|
|
676
|
-
* path: 'src/core/
|
|
704
|
+
* path: 'src/core/factories.ts',
|
|
677
705
|
* message: "Type 'string' is not assignable to type 'number'.",
|
|
678
|
-
* range: { start: { line: 0, character: 6 }, end: { line: 0, character:
|
|
706
|
+
* range: { start: { line: 0, character: 6 }, end: { line: 0, character: 6 } },
|
|
679
707
|
* }
|
|
680
708
|
* ```
|
|
681
709
|
*/
|
|
682
710
|
export declare interface Issue {
|
|
683
|
-
/**
|
|
711
|
+
/** Names the party that must act on this message. */
|
|
684
712
|
readonly origin: Party;
|
|
685
|
-
/**
|
|
713
|
+
/** Names the workspace-relative path this message is reported against. */
|
|
686
714
|
readonly path: string;
|
|
687
|
-
/**
|
|
715
|
+
/** Holds the diagnostic or failure message. */
|
|
688
716
|
readonly message: string;
|
|
689
|
-
/**
|
|
717
|
+
/**
|
|
718
|
+
* Holds the zero-based UTF-16 span the tool reported, or is absent when it reported no location.
|
|
719
|
+
*/
|
|
690
720
|
readonly range?: LSPRange;
|
|
691
721
|
}
|
|
692
722
|
|
|
@@ -725,8 +755,8 @@ export declare const isToolchain: Guard<Toolchain>;
|
|
|
725
755
|
export declare const isVerdict: Guard<Verdict>;
|
|
726
756
|
|
|
727
757
|
/**
|
|
728
|
-
* Names the bound the lint stage holds over the lifecycle exchanges the protocol leaves
|
|
729
|
-
* server: the `initialize` reply warming waits for and the `shutdown` reply ending waits for.
|
|
758
|
+
* Names the 2,000 ms bound the lint stage holds over the lifecycle exchanges the protocol leaves
|
|
759
|
+
* to the server: the `initialize` reply warming waits for and the `shutdown` reply ending waits for.
|
|
730
760
|
*
|
|
731
761
|
* @remarks
|
|
732
762
|
* It does not reach the diagnostics an inspection waits for, which the caller's own signal bounds.
|
|
@@ -777,7 +807,8 @@ export declare function matchesSpecification(text: string, revision: string): bo
|
|
|
777
807
|
export declare type Party = (typeof PROBE_PARTIES)[number];
|
|
778
808
|
|
|
779
809
|
/**
|
|
780
|
-
* Names the default inspection deadline a `Probe` applies when its construction omits one
|
|
810
|
+
* Names the default inspection deadline a `Probe` applies when its construction omits one,
|
|
811
|
+
* 30,000 ms.
|
|
781
812
|
*
|
|
782
813
|
* @remarks
|
|
783
814
|
* `ProbeOptions.deadline` overrides this value per instance.
|
|
@@ -790,7 +821,8 @@ export declare type Party = (typeof PROBE_PARTIES)[number];
|
|
|
790
821
|
export declare const PROBE_DEADLINE = 30000;
|
|
791
822
|
|
|
792
823
|
/**
|
|
793
|
-
* Lists the conditions that can end a probe operation
|
|
824
|
+
* Lists the conditions that can end a probe operation:
|
|
825
|
+
* `['refused', 'missing', 'malformed', 'destroyed', 'deadline']`.
|
|
794
826
|
*
|
|
795
827
|
* @remarks
|
|
796
828
|
* One list feeds the code union and the error guard, so a condition cannot be constructed by one
|
|
@@ -806,7 +838,7 @@ export declare const PROBE_ERROR_CODES: readonly ["refused", "missing", "malform
|
|
|
806
838
|
|
|
807
839
|
/**
|
|
808
840
|
* Names the total enumerable key bound `ProbeServer` applies to inbound metadata and to produced
|
|
809
|
-
* tool content alike.
|
|
841
|
+
* tool content alike, 4096.
|
|
810
842
|
*
|
|
811
843
|
* @remarks
|
|
812
844
|
* `@orkestrel/mcp`'s default leaf is sized for metadata: a verdict costs 38 keys empty and 11 more
|
|
@@ -824,7 +856,8 @@ export declare const PROBE_ERROR_CODES: readonly ["refused", "missing", "malform
|
|
|
824
856
|
export declare const PROBE_KEYS = 4096;
|
|
825
857
|
|
|
826
858
|
/**
|
|
827
|
-
* Lists the parties that can own action on an issue or probe failure
|
|
859
|
+
* Lists the parties that can own action on an issue or probe failure:
|
|
860
|
+
* `['claimant', 'workspace', 'instrument']`.
|
|
828
861
|
*
|
|
829
862
|
* @remarks
|
|
830
863
|
* One list feeds the `Party` type and its guard, so a party cannot be admitted by one and refused
|
|
@@ -838,7 +871,29 @@ export declare const PROBE_KEYS = 4096;
|
|
|
838
871
|
export declare const PROBE_PARTIES: readonly ["claimant", "workspace", "instrument"];
|
|
839
872
|
|
|
840
873
|
/**
|
|
841
|
-
*
|
|
874
|
+
* Names the specification lifetime the runtime stage replaces its resident Vitest service at,
|
|
875
|
+
* 64 specifications.
|
|
876
|
+
*
|
|
877
|
+
* @remarks
|
|
878
|
+
* Vite retains one unresolved URL for every fresh specification path, so an inspection that writes
|
|
879
|
+
* a specification grows a map the resident service never releases. The stage replaces that service
|
|
880
|
+
* rather than deleting from each map it owns, and this is the count of specifications one service
|
|
881
|
+
* carries before the replacement. Any bound holds the retention flat, because the replacement
|
|
882
|
+
* releases everything the instance held; this value trades the cost of the replacement against how
|
|
883
|
+
* far the map grows between them. On 2026-08-20, over this package's own workspace on the host
|
|
884
|
+
* `guides/probe.md` § Cost names, two runs of 66 inspections put the crossing inspection at 480 ms
|
|
885
|
+
* and 269 ms against median inspections of 156 ms and 155 ms.
|
|
886
|
+
*
|
|
887
|
+
* @example
|
|
888
|
+
* ```ts
|
|
889
|
+
* PROBE_SPECIFICATIONS // 64
|
|
890
|
+
* ```
|
|
891
|
+
*/
|
|
892
|
+
export declare const PROBE_SPECIFICATIONS = 64;
|
|
893
|
+
|
|
894
|
+
/**
|
|
895
|
+
* Lists the stages a claim passes through, in the order a verdict reports them:
|
|
896
|
+
* `['type', 'lint', 'runtime']`.
|
|
842
897
|
*
|
|
843
898
|
* @remarks
|
|
844
899
|
* One list feeds the `Stage` type, the wire shape, the stage guard, and the receipt computation, so
|
|
@@ -919,20 +974,20 @@ export declare type ProbeErrorCode = (typeof PROBE_ERROR_CODES)[number];
|
|
|
919
974
|
* ```
|
|
920
975
|
*/
|
|
921
976
|
export declare interface ProbeErrorContext {
|
|
922
|
-
/**
|
|
977
|
+
/** Names the stage the failure belongs to, when one stage owns it. */
|
|
923
978
|
readonly stage?: Stage;
|
|
924
979
|
/**
|
|
925
|
-
*
|
|
980
|
+
* Names the path involved, spelled as the refusing operation named it: workspace-relative for an
|
|
926
981
|
* input a caller supplied, absolute for a file this package resolved.
|
|
927
982
|
*/
|
|
928
983
|
readonly path?: string;
|
|
929
|
-
/**
|
|
984
|
+
/** Names the workspace-relative TypeScript project involved, for a project failure. */
|
|
930
985
|
readonly project?: string;
|
|
931
|
-
/**
|
|
986
|
+
/** Identifies the installed package involved, for a workspace toolchain failure. */
|
|
932
987
|
readonly name?: string;
|
|
933
|
-
/**
|
|
988
|
+
/** Holds the milliseconds the expired budget allowed, for a deadline failure. */
|
|
934
989
|
readonly deadline?: number;
|
|
935
|
-
/**
|
|
990
|
+
/** Holds the rejected value, for an input the guards refused. */
|
|
936
991
|
readonly value?: unknown;
|
|
937
992
|
}
|
|
938
993
|
|
|
@@ -954,13 +1009,13 @@ export declare interface ProbeErrorContext {
|
|
|
954
1009
|
* ```
|
|
955
1010
|
*/
|
|
956
1011
|
export declare interface ProbeErrorOptions {
|
|
957
|
-
/**
|
|
1012
|
+
/** Names the party that must act on this failure. */
|
|
958
1013
|
readonly origin: Party;
|
|
959
|
-
/**
|
|
1014
|
+
/** Names the condition that ended the operation. */
|
|
960
1015
|
readonly code: ProbeErrorCode;
|
|
961
|
-
/**
|
|
1016
|
+
/** Holds structured detail about the failure. */
|
|
962
1017
|
readonly context?: ProbeErrorContext;
|
|
963
|
-
/**
|
|
1018
|
+
/** Holds the underlying fault, when one ended the operation. */
|
|
964
1019
|
readonly cause?: unknown;
|
|
965
1020
|
}
|
|
966
1021
|
|
|
@@ -982,13 +1037,16 @@ export declare interface ProbeErrorOptions {
|
|
|
982
1037
|
* ```
|
|
983
1038
|
*/
|
|
984
1039
|
export declare type ProbeEventMap = {
|
|
985
|
-
/**
|
|
1040
|
+
/** Fires when the boot control has reported red and the instrument has begun answering calls. */
|
|
986
1041
|
readonly arm: readonly [toolchain: Toolchain];
|
|
987
|
-
/**
|
|
1042
|
+
/** Fires when a claim is answered. */
|
|
988
1043
|
readonly prove: readonly [verdict: Verdict];
|
|
989
|
-
/**
|
|
1044
|
+
/** Fires after the coordinator's deadline fired at one stage and that stage was replaced. */
|
|
990
1045
|
readonly expire: readonly [claim: Claim];
|
|
991
|
-
/**
|
|
1046
|
+
/**
|
|
1047
|
+
* Fires when a fault surfaces for observation, once per fault, including a rejected arming
|
|
1048
|
+
* attempt.
|
|
1049
|
+
*/
|
|
992
1050
|
readonly error: readonly [error: unknown];
|
|
993
1051
|
};
|
|
994
1052
|
|
|
@@ -1000,9 +1058,9 @@ export declare type ProbeEventMap = {
|
|
|
1000
1058
|
* the process and a restart is a new process rather than a second lifecycle.
|
|
1001
1059
|
*
|
|
1002
1060
|
* `prove` re-reads the target workspace before it answers, so a file edited since the last call is
|
|
1003
|
-
* judged as it stands on disk rather than as a warm service remembers it.
|
|
1004
|
-
*
|
|
1005
|
-
*
|
|
1061
|
+
* judged as it stands on disk rather than as a warm service remembers it. Each stage keys that
|
|
1062
|
+
* sweep by content: the runtime stage compares each workspace module's contents, and the type stage
|
|
1063
|
+
* refreshes its mirror of the workspace by content digest.
|
|
1006
1064
|
*
|
|
1007
1065
|
* @example
|
|
1008
1066
|
* ```ts
|
|
@@ -1012,9 +1070,9 @@ export declare type ProbeEventMap = {
|
|
|
1012
1070
|
* ```
|
|
1013
1071
|
*/
|
|
1014
1072
|
export declare interface ProbeInterface {
|
|
1015
|
-
/**
|
|
1073
|
+
/** Publishes arming, answers, deadline expiry, and faults for observation. */
|
|
1016
1074
|
readonly emitter: EmitterInterface<ProbeEventMap>;
|
|
1017
|
-
/**
|
|
1075
|
+
/** Names the tool versions resolved from the workspace at construction. */
|
|
1018
1076
|
readonly toolchain: Toolchain;
|
|
1019
1077
|
/**
|
|
1020
1078
|
* Answers one claim with every stage's evidence.
|
|
@@ -1022,7 +1080,7 @@ export declare interface ProbeInterface {
|
|
|
1022
1080
|
* @remarks
|
|
1023
1081
|
* A control carrying the case's files and the case's test byte for byte is refused at admission,
|
|
1024
1082
|
* with `origin: 'claimant'` and `code: 'refused'`. No stage inspects such a claim: the refusal
|
|
1025
|
-
* answers before
|
|
1083
|
+
* answers before any stage is awaited, so it reads the same in every workspace state.
|
|
1026
1084
|
* Such a control can only break by nondeterminism, so the receipt it would earn attests a
|
|
1027
1085
|
* falsification that never happened, and a flake-earned receipt is the worst answer this package
|
|
1028
1086
|
* can return. The refusal compares the bytes of each side's files and test rather than the digest
|
|
@@ -1038,9 +1096,9 @@ export declare interface ProbeInterface {
|
|
|
1038
1096
|
*/
|
|
1039
1097
|
prove(claim: Claim): Promise<Verdict>;
|
|
1040
1098
|
/**
|
|
1041
|
-
* Tears down
|
|
1099
|
+
* Tears down every stage and releases the processes and the mirror they hold.
|
|
1042
1100
|
*
|
|
1043
|
-
* @returns A promise that settles
|
|
1101
|
+
* @returns A promise that settles after every stage has released its resources
|
|
1044
1102
|
*/
|
|
1045
1103
|
destroy(): Promise<void>;
|
|
1046
1104
|
}
|
|
@@ -1064,15 +1122,15 @@ export declare interface ProbeInterface {
|
|
|
1064
1122
|
* ```
|
|
1065
1123
|
*/
|
|
1066
1124
|
export declare interface ProbeOptions {
|
|
1067
|
-
/**
|
|
1125
|
+
/** Declares the initial listeners, wired at construction. */
|
|
1068
1126
|
readonly on?: EmitterHooks<ProbeEventMap>;
|
|
1069
|
-
/**
|
|
1127
|
+
/** Holds the handler for a listener throw. */
|
|
1070
1128
|
readonly error?: EmitterErrorHandler;
|
|
1071
|
-
/**
|
|
1129
|
+
/** Names the target workspace root. Default: the current working directory. */
|
|
1072
1130
|
readonly workspace?: string;
|
|
1073
1131
|
/**
|
|
1074
|
-
*
|
|
1075
|
-
* 30,000 ms.
|
|
1132
|
+
* Holds the milliseconds one active stage inspection may take; an expired stage is replaced.
|
|
1133
|
+
* Default: 30,000 ms.
|
|
1076
1134
|
*/
|
|
1077
1135
|
readonly deadline?: number;
|
|
1078
1136
|
}
|
|
@@ -1085,25 +1143,30 @@ export declare interface ProbeOptions {
|
|
|
1085
1143
|
* under one project and fails under another, so a verdict that omits the project states less than
|
|
1086
1144
|
* it appears to. `path` names which project file, in the resolved workspace-relative spelling
|
|
1087
1145
|
* rather than the caller's. `digest` names what that project contained, because a receipt travels
|
|
1088
|
-
* away from the workspace that minted it and a path alone is a claim about a name.
|
|
1146
|
+
* away from the workspace that minted it and a path alone is a claim about a name. The digest reads
|
|
1147
|
+
* the compiler's own printed configuration for the workspace's copy of that project, so a claim's
|
|
1148
|
+
* drafts cannot move it.
|
|
1089
1149
|
*
|
|
1090
1150
|
* @example
|
|
1091
1151
|
* ```ts
|
|
1092
1152
|
* const project: Project = {
|
|
1093
1153
|
* path: 'configs/src/tsconfig.core.json',
|
|
1094
|
-
* digest: '
|
|
1154
|
+
* digest: 'd61f11b52460b1c6707cfac2c6078d59',
|
|
1095
1155
|
* }
|
|
1096
1156
|
* ```
|
|
1097
1157
|
*/
|
|
1098
1158
|
export declare interface Project {
|
|
1099
|
-
/**
|
|
1159
|
+
/** Names the resolved workspace-relative path of the project file the type stage applied. */
|
|
1100
1160
|
readonly path: string;
|
|
1101
|
-
/**
|
|
1161
|
+
/**
|
|
1162
|
+
* Holds the digest of that project's resolved compiler options, workspace-relative and
|
|
1163
|
+
* key-sorted.
|
|
1164
|
+
*/
|
|
1102
1165
|
readonly digest: string;
|
|
1103
1166
|
}
|
|
1104
1167
|
|
|
1105
1168
|
/**
|
|
1106
|
-
* Names the leading token every receipt carries
|
|
1169
|
+
* Names the leading token every receipt carries, `'probe'`.
|
|
1107
1170
|
*
|
|
1108
1171
|
* @remarks
|
|
1109
1172
|
* A receipt travels away from the verdict that minted it — an agent pastes it into the promotion
|
|
@@ -1112,14 +1175,14 @@ export declare interface Project {
|
|
|
1112
1175
|
* @example
|
|
1113
1176
|
* ```ts
|
|
1114
1177
|
* const receipt =
|
|
1115
|
-
* 'probe:6ca20c3bff623031d3955b9d1a76d71d:type:typescript@6.0.3:oxlint@1.79.0:vitest@4.1.11:configs/src/tsconfig.core.json@
|
|
1178
|
+
* 'probe:6ca20c3bff623031d3955b9d1a76d71d:type:typescript@6.0.3:oxlint@1.79.0:vitest@4.1.11:configs/src/tsconfig.core.json@d61f11b52460b1c6707cfac2c6078d59'
|
|
1116
1179
|
* receipt.startsWith(RECEIPT_PREFIX) // true
|
|
1117
1180
|
* ```
|
|
1118
1181
|
*/
|
|
1119
1182
|
export declare const RECEIPT_PREFIX = "probe";
|
|
1120
1183
|
|
|
1121
1184
|
/**
|
|
1122
|
-
* Names the character joining a receipt's tokens
|
|
1185
|
+
* Names the character joining a receipt's tokens, `':'`.
|
|
1123
1186
|
*
|
|
1124
1187
|
* @remarks
|
|
1125
1188
|
* A project path can contain this character, so the project field goes last and a reader rejoins
|
|
@@ -1128,12 +1191,28 @@ export declare const RECEIPT_PREFIX = "probe";
|
|
|
1128
1191
|
* @example
|
|
1129
1192
|
* ```ts
|
|
1130
1193
|
* const receipt =
|
|
1131
|
-
* 'probe:6ca20c3bff623031d3955b9d1a76d71d:type:typescript@6.0.3:oxlint@1.79.0:vitest@4.1.11:configs/src/tsconfig.core.json@
|
|
1194
|
+
* 'probe:6ca20c3bff623031d3955b9d1a76d71d:type:typescript@6.0.3:oxlint@1.79.0:vitest@4.1.11:configs/src/tsconfig.core.json@d61f11b52460b1c6707cfac2c6078d59'
|
|
1132
1195
|
* receipt.split(RECEIPT_SEPARATOR).length // 7
|
|
1133
1196
|
* ```
|
|
1134
1197
|
*/
|
|
1135
1198
|
export declare const RECEIPT_SEPARATOR = ":";
|
|
1136
1199
|
|
|
1200
|
+
/**
|
|
1201
|
+
* Names the Vite plugin the runtime stage installs into a target workspace's Vitest
|
|
1202
|
+
* configuration, `'orkestrel-runtime-overlay'`.
|
|
1203
|
+
*
|
|
1204
|
+
* @remarks
|
|
1205
|
+
* The stage declares the plugin under this name and reads a configured project's plugin list for
|
|
1206
|
+
* the same name to decide whether that project carries the overlay. One name feeds both, so a
|
|
1207
|
+
* project the stage instrumented is never reported as a workspace project it could not reach.
|
|
1208
|
+
*
|
|
1209
|
+
* @example
|
|
1210
|
+
* ```ts
|
|
1211
|
+
* RUNTIME_PLUGIN // 'orkestrel-runtime-overlay'
|
|
1212
|
+
* ```
|
|
1213
|
+
*/
|
|
1214
|
+
export declare const RUNTIME_PLUGIN = "orkestrel-runtime-overlay";
|
|
1215
|
+
|
|
1137
1216
|
/**
|
|
1138
1217
|
* Names an inspection a claim passes through, derived from {@link PROBE_STAGES}.
|
|
1139
1218
|
*
|
|
@@ -1162,14 +1241,33 @@ export declare type Stage = (typeof PROBE_STAGES)[number];
|
|
|
1162
1241
|
* ```
|
|
1163
1242
|
*/
|
|
1164
1243
|
export declare interface Toolchain {
|
|
1165
|
-
/**
|
|
1244
|
+
/** Names the resolved `typescript` version the type stage ran. */
|
|
1166
1245
|
readonly typescript: string;
|
|
1167
|
-
/**
|
|
1246
|
+
/** Names the resolved `oxlint` version the lint stage ran. */
|
|
1168
1247
|
readonly oxlint: string;
|
|
1169
|
-
/**
|
|
1248
|
+
/** Names the resolved `vitest` version the runtime stage ran. */
|
|
1170
1249
|
readonly vitest: string;
|
|
1171
1250
|
}
|
|
1172
1251
|
|
|
1252
|
+
/**
|
|
1253
|
+
* Names the workspace-relative directory the type stage keeps its workspace mirror under,
|
|
1254
|
+
* `'tmp/type'`.
|
|
1255
|
+
*
|
|
1256
|
+
* @remarks
|
|
1257
|
+
* Each stage owns one directory beneath this one, named for the writing host's process id and a
|
|
1258
|
+
* fresh UUID, and deletes it at teardown. The directory sits under `tmp/` so nothing the stage
|
|
1259
|
+
* writes reaches a version-controlled path, and beside `tmp/probe/` rather than inside it because
|
|
1260
|
+
* the workbench Vitest project collects `tmp/probe/**` and would otherwise collect a mirrored test.
|
|
1261
|
+
* A target that runs its own `check`, `lint:check`, or `format:check` while a probe is resident
|
|
1262
|
+
* reads whatever it does not exclude, so exclude this directory there.
|
|
1263
|
+
*
|
|
1264
|
+
* @example
|
|
1265
|
+
* ```ts
|
|
1266
|
+
* TYPE_MIRROR // 'tmp/type'
|
|
1267
|
+
* ```
|
|
1268
|
+
*/
|
|
1269
|
+
export declare const TYPE_MIRROR = "tmp/type";
|
|
1270
|
+
|
|
1173
1271
|
/**
|
|
1174
1272
|
* Carries the full result of one claim: every stage, for both the case and its control.
|
|
1175
1273
|
*
|
|
@@ -1211,7 +1309,7 @@ export declare interface Toolchain {
|
|
|
1211
1309
|
* toolchain: { typescript: '6.0.3', oxlint: '1.79.0', vitest: '4.1.11' },
|
|
1212
1310
|
* project: {
|
|
1213
1311
|
* path: 'configs/src/tsconfig.core.json',
|
|
1214
|
-
* digest: '
|
|
1312
|
+
* digest: 'd61f11b52460b1c6707cfac2c6078d59',
|
|
1215
1313
|
* },
|
|
1216
1314
|
* reason: 'a number annotation must reject the string literal beside it',
|
|
1217
1315
|
* case: [
|
|
@@ -1226,31 +1324,31 @@ export declare interface Toolchain {
|
|
|
1226
1324
|
* ],
|
|
1227
1325
|
* elapsed: 549,
|
|
1228
1326
|
* receipt:
|
|
1229
|
-
* 'probe:6ca20c3bff623031d3955b9d1a76d71d:type:typescript@6.0.3:oxlint@1.79.0:vitest@4.1.11:configs/src/tsconfig.core.json@
|
|
1327
|
+
* 'probe:6ca20c3bff623031d3955b9d1a76d71d:type:typescript@6.0.3:oxlint@1.79.0:vitest@4.1.11:configs/src/tsconfig.core.json@d61f11b52460b1c6707cfac2c6078d59',
|
|
1230
1328
|
* }
|
|
1231
1329
|
* ```
|
|
1232
1330
|
*/
|
|
1233
1331
|
export declare interface Verdict {
|
|
1234
|
-
/**
|
|
1332
|
+
/** Names the revision identity this verdict was produced for, fresh per call. */
|
|
1235
1333
|
readonly id: string;
|
|
1236
|
-
/**
|
|
1334
|
+
/** Holds the digest of the case and control this verdict answers. */
|
|
1237
1335
|
readonly digest: string;
|
|
1238
|
-
/**
|
|
1336
|
+
/** Names the tool versions that produced it. */
|
|
1239
1337
|
readonly toolchain: Toolchain;
|
|
1240
|
-
/**
|
|
1338
|
+
/** Names the TypeScript project the candidate drafts were judged against. */
|
|
1241
1339
|
readonly project: Project;
|
|
1242
1340
|
/**
|
|
1243
|
-
*
|
|
1244
|
-
* of the control, so it enters `digest` and through it the receipt token.
|
|
1341
|
+
* Holds the claimant's explanation for the selected control, when the verdict came from a claim.
|
|
1342
|
+
* Part of the control, so it enters `digest` and through it the receipt token.
|
|
1245
1343
|
*/
|
|
1246
1344
|
readonly reason?: string;
|
|
1247
|
-
/**
|
|
1345
|
+
/** Holds one outcome per stage for the claim's case. */
|
|
1248
1346
|
readonly case: readonly Check[];
|
|
1249
|
-
/**
|
|
1347
|
+
/** Holds one outcome per stage for the claim's control. */
|
|
1250
1348
|
readonly control: readonly Check[];
|
|
1251
|
-
/**
|
|
1349
|
+
/** Holds the milliseconds the whole call took, including both the case and the control. */
|
|
1252
1350
|
readonly elapsed: number;
|
|
1253
|
-
/**
|
|
1351
|
+
/** Holds the proof token, absent when either phase reports an instrument failure. */
|
|
1254
1352
|
readonly receipt?: string;
|
|
1255
1353
|
}
|
|
1256
1354
|
|