geospec 0.1.0-beta.9 → 0.4.1-next.331

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 (105) hide show
  1. package/README.md +34 -9
  2. package/agent/doctrine.md +2 -1
  3. package/agent/geospec-authoring/SKILL.md +3 -3
  4. package/agent/geospec-authoring/api-index.md +20 -92
  5. package/agent/geospec-authoring/api-types.md +85 -480
  6. package/agent/geospec-authoring/public-api-functions.md +21 -1
  7. package/agent/geospec-authoring/public-api-index.md +215 -319
  8. package/agent/geospec-authoring/public-api-types-2.md +480 -352
  9. package/agent/geospec-authoring/public-api-types-3.md +79 -215
  10. package/agent/geospec-authoring/public-api-types.md +334 -849
  11. package/agent/resources.js +12 -13
  12. package/agent/skills.json +2 -3
  13. package/dist/assertion-client/client.d.mts +14 -15
  14. package/dist/assertion-client/client.mjs +1 -1
  15. package/dist/cli/check.mjs +2 -0
  16. package/dist/cli/cli.d.mts +5 -5
  17. package/dist/cli/cli.mjs +20 -3
  18. package/dist/cli/node-host.d.mts +5 -4
  19. package/dist/cli/node-host.mjs +1 -1
  20. package/dist/cli/wire-value.mjs +1 -1
  21. package/dist/config/define-config.d.mts +2 -3
  22. package/dist/config/node/index.mjs +1 -1
  23. package/dist/config/node/load.d.mts +2 -3
  24. package/dist/config/node/load.mjs +1 -1
  25. package/dist/config/read-geospec-config.d.mts +10 -6
  26. package/dist/config/read-geospec-config.mjs +1 -1
  27. package/dist/config/types.d.mts +6 -7
  28. package/dist/create-geospec.d.mts +7 -6
  29. package/dist/engine/client.d.mts +15 -15
  30. package/dist/engine/client.mjs +1 -1
  31. package/dist/engine/matchers.d.mts +10 -11
  32. package/dist/engine/pmi.types.d.mts +11 -12
  33. package/dist/engine/protocol.d.mts +7 -8
  34. package/dist/engine/protocol.mjs +1 -1
  35. package/dist/geometry-unit.d.mts +2 -3
  36. package/dist/index.d.mts +2 -2
  37. package/dist/index.mjs +1 -1
  38. package/dist/mesh/index.d.mts +2 -2
  39. package/dist/mesh/types.d.mts +8 -505
  40. package/dist/model/errors.d.mts +2 -3
  41. package/dist/model/load-model.d.mts +3 -4
  42. package/dist/model/mesh-evidence-matchers.d.mts +2 -3
  43. package/dist/model/native-model-loader.d.mts +14 -17
  44. package/dist/model/native-model-loader.mjs +1 -1
  45. package/dist/model/node/command-exporter.d.mts +3 -4
  46. package/dist/model/node/command-exporter.mjs +1 -1
  47. package/dist/model/node/index.mjs +1 -1
  48. package/dist/model/region-scope.d.mts +3 -6
  49. package/dist/model/region-scope.mjs +1 -1
  50. package/dist/model/subject.d.mts +2 -5
  51. package/dist/model/subject.mjs +1 -1
  52. package/dist/model/types.d.mts +19 -20
  53. package/dist/runner/collector.d.mts +7 -8
  54. package/dist/runner/collector.mjs +3 -1
  55. package/dist/runner/discovery.d.mts +10 -11
  56. package/dist/runner/discovery.mjs +5 -1
  57. package/dist/runner/filter.d.mts +6 -7
  58. package/dist/runner/filter.mjs +3 -1
  59. package/dist/runner/index.d.mts +3 -1
  60. package/dist/runner/index.mjs +1 -1
  61. package/dist/runner/native/native-pool-grants.d.mts +2 -3
  62. package/dist/runner/native/native-serial-runner.d.mts +4 -7
  63. package/dist/runner/native/native-serial-runner.mjs +1 -1
  64. package/dist/runner/node/engine.d.mts +5 -6
  65. package/dist/runner/node/index.mjs +1 -1
  66. package/dist/runner/node/node-vm-filesystem.d.mts +4 -5
  67. package/dist/runner/node/node-vm-filesystem.mjs +1 -1
  68. package/dist/runner/node/pool-runner.d.mts +15 -6
  69. package/dist/runner/node/pool-runner.mjs +1 -1
  70. package/dist/runner/node/pool-worker-entry.d.mts +9 -6
  71. package/dist/runner/node/pool-worker-entry.mjs +1 -1
  72. package/dist/runner/pool/events.mjs +1 -1
  73. package/dist/runner/pool/pool-messages.d.mts +8 -9
  74. package/dist/runner/pool/pool.d.mts +4 -6
  75. package/dist/runner/pool/pool.mjs +1 -1
  76. package/dist/runner/pool/shard-timings.d.mts +3 -4
  77. package/dist/runner/pool/worker-host.d.mts +6 -5
  78. package/dist/runner/pool/worker-host.mjs +1 -1
  79. package/dist/runner/run-geospec-module.d.mts +2 -3
  80. package/dist/runner/run-geospec-module.mjs +2 -2
  81. package/dist/runner/timeout-codes.d.mts +6 -8
  82. package/dist/runner/types.d.mts +56 -53
  83. package/dist/runner/worker/no-matching-tests-issue.d.mts +3 -4
  84. package/dist/runner/worker/runner-types.d.mts +17 -16
  85. package/dist/runner/worker/serial-runner.mjs +1 -1
  86. package/dist/selector/types.d.mts +22 -23
  87. package/dist/step/types.d.mts +4 -119
  88. package/dist/support/filesystem-errors.mjs +1 -0
  89. package/dist/support/hash.mjs +1 -0
  90. package/dist/support/path.mjs +1 -0
  91. package/dist/support/sha256.mjs +1 -0
  92. package/dist/support/types.d.mts +38 -0
  93. package/dist/vitest/adapter.d.mts +5 -6
  94. package/dist/vitest/adapter.mjs +1 -1
  95. package/dist/vitest/index.d.mts +0 -1
  96. package/dist/vitest/index.mjs +1 -1
  97. package/dist/vitest/node/index.d.mts +2 -0
  98. package/dist/vitest/node/index.mjs +1 -0
  99. package/dist/vitest/node/setup-project.d.mts +60 -0
  100. package/dist/vitest/node/setup-project.mjs +1 -0
  101. package/dist/vm/plain-module-vm.d.mts +13 -0
  102. package/dist/vm/plain-module-vm.mjs +8 -0
  103. package/dist/vm/types.d.mts +142 -0
  104. package/package.json +17 -9
  105. package/agent/geospec-authoring/api-types-2.md +0 -85
@@ -1,18 +1,17 @@
1
+ import { BuiltinModule, BundleResult, CreateModuleVm, VmFileSystem, VmIssue } from "../vm/types.mjs";
1
2
  import { GeometryDiagnostic, Vec3 } from "../mesh/types.mjs";
2
3
  import { GeometrySelector } from "../selector/types.mjs";
3
4
  import { GeoSpecLoadRegion } from "../model/types.mjs";
4
5
  import { GeoSpecModelLoadEvidence, GeoSpecNativeModelLoader } from "../model/native-model-loader.mjs";
5
6
  import { GeoSpecCanonicalClaimReport, GeoSpecNativeSubject } from "../engine/client.mjs";
6
7
  import { GeoSpecAssertionClientOptions } from "../assertion-client/client.mjs";
7
- import "../assertion-client/index.mjs";
8
- import { BuiltinModule, BundleResult, VmFileSystem, VmIssue } from "@taucad/esbuild/vm";
9
8
  //#region src/runner/types.d.ts
10
9
  /**
11
10
  * Axis-keyed numeric expectation used by high-level geometry matchers.
12
11
  *
13
12
  * @public
14
13
  */
15
- type GeoSpecAxisExpectation = {
14
+ export type GeoSpecAxisExpectation = {
16
15
  x?: number;
17
16
  y?: number;
18
17
  z?: number;
@@ -22,7 +21,7 @@ type GeoSpecAxisExpectation = {
22
21
  *
23
22
  * @public
24
23
  */
25
- type GeoSpecBoundingBoxExpectation = {
24
+ export type GeoSpecBoundingBoxExpectation = {
26
25
  min?: Vec3 | Partial<Record<keyof GeoSpecAxisExpectation, GeoSpecNumericExpectation>>;
27
26
  max?: Vec3 | Partial<Record<keyof GeoSpecAxisExpectation, GeoSpecNumericExpectation>>;
28
27
  size?: Vec3 | Partial<Record<keyof GeoSpecAxisExpectation, GeoSpecNumericExpectation>>;
@@ -35,7 +34,7 @@ type GeoSpecBoundingBoxExpectation = {
35
34
  *
36
35
  * @public
37
36
  */
38
- type GeoSpecConnectedComponentsExpectation = {
37
+ export type GeoSpecConnectedComponentsExpectation = {
39
38
  count: number;
40
39
  tolerance?: number;
41
40
  toleranceMm?: number;
@@ -45,14 +44,14 @@ type GeoSpecConnectedComponentsExpectation = {
45
44
  *
46
45
  * @public
47
46
  */
48
- type GeoSpecComponentSelector = string | RegExp;
47
+ export type GeoSpecComponentSelector = string | RegExp;
49
48
  /**
50
49
  * A pair-specific component-interference check accepted by
51
50
  * `expectGeo(...).toHaveNoComponentInterference(...)`.
52
51
  *
53
52
  * @public
54
53
  */
55
- type GeoSpecComponentInterferencePairExpectation = {
54
+ export type GeoSpecComponentInterferencePairExpectation = {
56
55
  left: GeoSpecComponentSelector;
57
56
  right: GeoSpecComponentSelector;
58
57
  };
@@ -62,7 +61,7 @@ type GeoSpecComponentInterferencePairExpectation = {
62
61
  *
63
62
  * @public
64
63
  */
65
- type GeoSpecComponentInterferenceAllowance = {
64
+ export type GeoSpecComponentInterferenceAllowance = {
66
65
  kind?: 'intentionalInterference';
67
66
  left: GeoSpecComponentSelector;
68
67
  right: GeoSpecComponentSelector;
@@ -82,7 +81,7 @@ type GeoSpecComponentInterferenceAllowance = {
82
81
  *
83
82
  * @public
84
83
  */
85
- type GeoSpecComponentInterferenceExpectation = {
84
+ export type GeoSpecComponentInterferenceExpectation = {
86
85
  tolerance?: number;
87
86
  pairs?: GeoSpecComponentInterferencePairExpectation[];
88
87
  allowances?: GeoSpecComponentInterferenceAllowance[];
@@ -92,7 +91,7 @@ type GeoSpecComponentInterferenceExpectation = {
92
91
  *
93
92
  * @public
94
93
  */
95
- type GeoSpecNumericExpectation = number | {
94
+ export type GeoSpecNumericExpectation = number | {
96
95
  value?: number;
97
96
  greaterThan?: number;
98
97
  greaterThanOrEqual?: number;
@@ -104,13 +103,13 @@ type GeoSpecNumericExpectation = number | {
104
103
  *
105
104
  * @public
106
105
  */
107
- type GeoSpecPointExpectation = Vec3 | GeoSpecAxisExpectation;
106
+ export type GeoSpecPointExpectation = Vec3 | GeoSpecAxisExpectation;
108
107
  /**
109
108
  * Surface-area expectation accepted by `expectGeo(...).toHaveSurfaceArea(...)`.
110
109
  *
111
110
  * @public
112
111
  */
113
- type GeoSpecSurfaceAreaExpectation = {
112
+ export type GeoSpecSurfaceAreaExpectation = {
114
113
  value: number | GeoSpecNumericExpectation;
115
114
  tolerance?: number;
116
115
  };
@@ -119,7 +118,7 @@ type GeoSpecSurfaceAreaExpectation = {
119
118
  *
120
119
  * @public
121
120
  */
122
- type GeoSpecVolumeExpectation = {
121
+ export type GeoSpecVolumeExpectation = {
123
122
  value: number | GeoSpecNumericExpectation;
124
123
  tolerance?: number;
125
124
  };
@@ -128,7 +127,7 @@ type GeoSpecVolumeExpectation = {
128
127
  *
129
128
  * @public
130
129
  */
131
- type GeoSpecMassExpectation = {
130
+ export type GeoSpecMassExpectation = {
132
131
  value: number | GeoSpecNumericExpectation;
133
132
  density?: number;
134
133
  tolerance?: number;
@@ -138,7 +137,7 @@ type GeoSpecMassExpectation = {
138
137
  *
139
138
  * @public
140
139
  */
141
- type GeoSpecExpectOptions = {
140
+ export type GeoSpecExpectOptions = {
142
141
  /**
143
142
  * Deterministic work-unit budget for every claim in this chain: a positive integer no
144
143
  * greater than the host's maximum (default `geoSpecMaximumWorkUnitLimit`, 512 000 000). Omitted uses the subject's
@@ -153,7 +152,7 @@ type GeoSpecExpectOptions = {
153
152
  *
154
153
  * @public
155
154
  */
156
- type GeoSpecCenterOfMassExpectation = {
155
+ export type GeoSpecCenterOfMassExpectation = {
157
156
  /** Exact expected point in millimetres; per-axis ranges such as `{ greaterThan }` are not supported. */
158
157
  point: GeoSpecPointExpectation;
159
158
  tolerance?: number;
@@ -163,7 +162,7 @@ type GeoSpecCenterOfMassExpectation = {
163
162
  *
164
163
  * @public
165
164
  */
166
- type GeoSpecPlanarFaceExpectation = {
165
+ export type GeoSpecPlanarFaceExpectation = {
167
166
  normal: GeoSpecPointExpectation;
168
167
  offset: number;
169
168
  area?: GeoSpecNumericExpectation;
@@ -175,7 +174,7 @@ type GeoSpecPlanarFaceExpectation = {
175
174
  *
176
175
  * @public
177
176
  */
178
- type GeoSpecCylindricalFaceExpectation = {
177
+ export type GeoSpecCylindricalFaceExpectation = {
179
178
  radius: number;
180
179
  axis: 'x' | 'y' | 'z';
181
180
  tolerance?: number;
@@ -185,7 +184,7 @@ type GeoSpecCylindricalFaceExpectation = {
185
184
  *
186
185
  * @public
187
186
  */
188
- type GeoSpecCircularHoleExpectation = {
187
+ export type GeoSpecCircularHoleExpectation = {
189
188
  diameter: number;
190
189
  through?: boolean;
191
190
  axis?: 'x' | 'y' | 'z';
@@ -198,7 +197,7 @@ type GeoSpecCircularHoleExpectation = {
198
197
  *
199
198
  * @public
200
199
  */
201
- type GeoSpecChamferFeatureExpectation = {
200
+ export type GeoSpecChamferFeatureExpectation = {
202
201
  distance: number;
203
202
  selection?: string;
204
203
  tolerance?: number;
@@ -209,7 +208,7 @@ type GeoSpecChamferFeatureExpectation = {
209
208
  *
210
209
  * @public
211
210
  */
212
- type GeoSpecMinimumWallThicknessExpectation = {
211
+ export type GeoSpecMinimumWallThicknessExpectation = {
213
212
  value: GeoSpecNumericExpectation;
214
213
  tolerance?: number;
215
214
  };
@@ -220,7 +219,7 @@ type GeoSpecMinimumWallThicknessExpectation = {
220
219
  *
221
220
  * @public
222
221
  */
223
- type GeoSpecVoidWaypoint = Vec3 | {
222
+ export type GeoSpecVoidWaypoint = Vec3 | {
224
223
  occurrence: string;
225
224
  };
226
225
  /**
@@ -236,7 +235,7 @@ type GeoSpecVoidWaypoint = Vec3 | {
236
235
  *
237
236
  * @public
238
237
  */
239
- type GeoSpecVoidContinuityExpectation = {
238
+ export type GeoSpecVoidContinuityExpectation = {
240
239
  /** Ordered waypoints (>= 1) known to lie in the void being proven. */
241
240
  path: GeoSpecVoidWaypoint[];
242
241
  /**
@@ -262,7 +261,7 @@ type GeoSpecVoidContinuityExpectation = {
262
261
  *
263
262
  * @public
264
263
  */
265
- type GeoSpecTopologyCountsExpectation = {
264
+ export type GeoSpecTopologyCountsExpectation = {
266
265
  vertices?: GeoSpecNumericExpectation;
267
266
  edges?: GeoSpecNumericExpectation;
268
267
  wires?: GeoSpecNumericExpectation;
@@ -277,7 +276,7 @@ type GeoSpecTopologyCountsExpectation = {
277
276
  *
278
277
  * @public
279
278
  */
280
- type GeoSpecStepUnitsExpectation = {
279
+ export type GeoSpecStepUnitsExpectation = {
281
280
  unit: string;
282
281
  };
283
282
  /**
@@ -285,7 +284,7 @@ type GeoSpecStepUnitsExpectation = {
285
284
  *
286
285
  * @public
287
286
  */
288
- type GeoSpecProductStructureExpectation = {
287
+ export type GeoSpecProductStructureExpectation = {
289
288
  names?: string[];
290
289
  count?: GeoSpecNumericExpectation;
291
290
  };
@@ -295,7 +294,7 @@ type GeoSpecProductStructureExpectation = {
295
294
  *
296
295
  * @public
297
296
  */
298
- type GeoSpecCircularHolePatternExpectation = {
297
+ export type GeoSpecCircularHolePatternExpectation = {
299
298
  count: number;
300
299
  holeDiameter: number;
301
300
  boltCircleDiameter?: number;
@@ -308,7 +307,7 @@ type GeoSpecCircularHolePatternExpectation = {
308
307
  *
309
308
  * @public
310
309
  */
311
- type GeoSpecFilletFeatureExpectation = {
310
+ export type GeoSpecFilletFeatureExpectation = {
312
311
  radius: number;
313
312
  selection?: string;
314
313
  tolerance?: number;
@@ -318,7 +317,7 @@ type GeoSpecFilletFeatureExpectation = {
318
317
  *
319
318
  * @public
320
319
  */
321
- type GeoSpecGeometrySelector = GeoSpecComponentSelector | {
320
+ export type GeoSpecGeometrySelector = GeoSpecComponentSelector | {
322
321
  kind: 'occurrence';
323
322
  /** Product or instance name to match (also matches the PRODUCT name shared by instanced parts). */
324
323
  name?: GeoSpecComponentSelector;
@@ -358,7 +357,7 @@ Exclude<GeometrySelector, string | {
358
357
  *
359
358
  * @public
360
359
  */
361
- type GeoSpecAssemblyOccurrenceExpectation = {
360
+ export type GeoSpecAssemblyOccurrenceExpectation = {
362
361
  name: GeoSpecComponentSelector;
363
362
  count?: GeoSpecNumericExpectation;
364
363
  bounds?: {
@@ -375,7 +374,7 @@ type GeoSpecAssemblyOccurrenceExpectation = {
375
374
  *
376
375
  * @public
377
376
  */
378
- type GeoSpecAssemblyOccurrencesExpectation = {
377
+ export type GeoSpecAssemblyOccurrencesExpectation = {
379
378
  occurrences: GeoSpecAssemblyOccurrenceExpectation[];
380
379
  uniqueNames?: boolean;
381
380
  };
@@ -395,7 +394,7 @@ type GeoSpecAssemblyOccurrencesExpectation = {
395
394
  *
396
395
  * @public
397
396
  */
398
- type GeoSpecSpatialRelationshipExpectation = {
397
+ export type GeoSpecSpatialRelationshipExpectation = {
399
398
  id?: string;
400
399
  kind: 'contact' | 'clearance' | 'coaxial' | 'concentric' | 'coplanar' | 'parallel' | 'perpendicular' | 'angle' | 'containment' | 'insertion' | 'interference';
401
400
  subject: GeoSpecGeometrySelector;
@@ -418,7 +417,7 @@ type GeoSpecSpatialRelationshipExpectation = {
418
417
  *
419
418
  * @public
420
419
  */
421
- type GeoSpecSpatialRelationshipsExpectation = {
420
+ export type GeoSpecSpatialRelationshipsExpectation = {
422
421
  relationships: GeoSpecSpatialRelationshipExpectation[];
423
422
  };
424
423
  /**
@@ -427,7 +426,7 @@ type GeoSpecSpatialRelationshipsExpectation = {
427
426
  *
428
427
  * @public
429
428
  */
430
- type GeoSpecMeshIntegrityExpectation = {
429
+ export type GeoSpecMeshIntegrityExpectation = {
431
430
  finitePositions?: boolean;
432
431
  degenerateTriangles?: {
433
432
  count?: number;
@@ -449,7 +448,7 @@ type GeoSpecMeshIntegrityExpectation = {
449
448
  *
450
449
  * @public
451
450
  */
452
- type GeoSpecNoDiagnosticsExpectation = {
451
+ export type GeoSpecNoDiagnosticsExpectation = {
453
452
  severities?: Array<GeometryDiagnostic['severity']>;
454
453
  };
455
454
  /**
@@ -457,7 +456,7 @@ type GeoSpecNoDiagnosticsExpectation = {
457
456
  *
458
457
  * @public
459
458
  */
460
- type GeoSpecValidBrepExpectation = {
459
+ export type GeoSpecValidBrepExpectation = {
461
460
  maxTolerance?: number;
462
461
  freeBounds?: {
463
462
  count?: GeoSpecNumericExpectation;
@@ -472,7 +471,7 @@ type GeoSpecValidBrepExpectation = {
472
471
  *
473
472
  * @public
474
473
  */
475
- type GeoSpecMatcher = {
474
+ export type GeoSpecMatcher = {
476
475
  /** Core-owned negation; missing or refused evidence still fails. */
477
476
  readonly not: Omit<GeoSpecMatcher, 'not'>;
478
477
  /** Assert the fixed rational plate contract. */
@@ -583,7 +582,7 @@ type GeoSpecMatcher = {
583
582
  *
584
583
  * @public
585
584
  */
586
- type GeoSpecAssertion = {
585
+ export type GeoSpecAssertion = {
587
586
  /** Assertion kind. */
588
587
  kind: 'boundingBox' | 'connectedComponents' | 'watertight' | 'componentInterference' | 'assemblyOccurrences' | 'spatialRelationships' | 'meshIntegrity' | 'noDiagnostics' | 'surfaceArea' | 'volume' | 'mass' | 'centerOfMass' | 'validBrep' | 'topologyCounts' | 'stepUnits' | 'productStructure' | 'planarFace' | 'cylindricalFace' | 'circularHole' | 'circularHolePattern' | 'chamferFeature' | 'filletFeature' | 'minimumWallThickness' | 'voidContinuity' | 'toSatisfyRationalPlate' | 'toSatisfyParallelPlaneDistance';
589
588
  /** User-authored value passed to expectGeo(). */
@@ -603,7 +602,7 @@ type GeoSpecAssertion = {
603
602
  * holds for this millimetre box, never for the whole model.
604
603
  */
605
604
  region?: GeoSpecLoadRegion;
606
- /** Wall-clock cost of matcher evaluation in milliseconds (R1: budgeted matchers only). */
605
+ /** Wall-clock cost of matcher evaluation in milliseconds (budgeted matchers only). */
607
606
  durationMs?: number;
608
607
  };
609
608
  /**
@@ -611,9 +610,9 @@ type GeoSpecAssertion = {
611
610
  *
612
611
  * @public
613
612
  */
614
- type GeoSpecTestStatus = 'passed' | 'failed' | 'unsupported' | 'inconclusive' | 'not-run' | 'skipped';
613
+ export type GeoSpecTestStatus = 'passed' | 'failed' | 'unsupported' | 'inconclusive' | 'not-run' | 'skipped';
615
614
  /** Test accounting for the actual module collection and execution. @public */
616
- type GeoSpecTestAccounting = {
615
+ export type GeoSpecTestAccounting = {
617
616
  discovered: number;
618
617
  selected: number;
619
618
  completed: number;
@@ -625,7 +624,7 @@ type GeoSpecTestAccounting = {
625
624
  notRun: number;
626
625
  };
627
626
  /** Consumed source and artifact identities retained without replacing earlier loads. @public */
628
- type GeoSpecRunLineage = {
627
+ export type GeoSpecRunLineage = {
629
628
  status: 'complete' | 'unavailable' | 'mixed';
630
629
  modules: ReadonlyArray<{
631
630
  entryPath: string;
@@ -652,7 +651,7 @@ type GeoSpecRunLineage = {
652
651
  *
653
652
  * @public
654
653
  */
655
- type GeoSpecModuleBundleCache = Map<string, {
654
+ export type GeoSpecModuleBundleCache = Map<string, {
656
655
  builtinIdentity: string;
657
656
  /** The run token embedded in `bundle.code`; a reuse executes a copy under its own run's token. */
658
657
  runToken: string;
@@ -673,7 +672,7 @@ type GeoSpecModuleBundleCache = Map<string, {
673
672
  *
674
673
  * @public
675
674
  */
676
- type GeoSpecTestCase = {
675
+ export type GeoSpecTestCase = {
677
676
  /** Registration ordinal before filtering, scoped to the source module's collection. */
678
677
  ordinal?: number;
679
678
  /** Hierarchical suite path. */
@@ -686,7 +685,7 @@ type GeoSpecTestCase = {
686
685
  status: GeoSpecTestStatus;
687
686
  /** Structured diagnostics emitted by test execution. */
688
687
  diagnostics: GeometryDiagnostic[];
689
- /** Wall-clock cost of the test body plus its pending assertions, in milliseconds (R1). */
688
+ /** Wall-clock cost of the test body plus its pending assertions, in milliseconds. */
690
689
  durationMs?: number;
691
690
  };
692
691
  /**
@@ -695,7 +694,7 @@ type GeoSpecTestCase = {
695
694
  *
696
695
  * @public
697
696
  */
698
- type GeoSpecTestEvent = {
697
+ export type GeoSpecTestEvent = {
699
698
  readonly type: 'test-start' | 'test-complete';
700
699
  readonly test: GeoSpecTestCase;
701
700
  };
@@ -704,7 +703,7 @@ type GeoSpecTestEvent = {
704
703
  *
705
704
  * @public
706
705
  */
707
- type RunGeoSpecModuleOptions = {
706
+ export type RunGeoSpecModuleOptions = {
708
707
  /** Filesystem containing the test module and its project imports. */
709
708
  filesystem: VmFileSystem;
710
709
  /** Filesystem-root-relative ESM test entry path. */
@@ -727,10 +726,15 @@ type RunGeoSpecModuleOptions = {
727
726
  }>;
728
727
  /** Additional in-memory modules made available to the VM. */
729
728
  builtinModules?: Record<string, BuiltinModule>;
729
+ /**
730
+ * Module VM factory; defaults to {@link import('../vm/plain-module-vm.js').createPlainModuleVm}, which resolves
731
+ * project files and builtins only. Inject one to resolve npm packages; Tau injects `createEsbuildModuleVm`.
732
+ */
733
+ createModuleVm?: CreateModuleVm;
730
734
  /** Successful bundle cache owned by a serial runner worker. @internal */
731
735
  bundleCache?: GeoSpecModuleBundleCache;
732
736
  /**
733
- * List-only collection pass (R3 shard splitting): execute the module to
737
+ * List-only collection pass (shard splitting): execute the module to
734
738
  * REGISTER tests, skip every body, and return all registered tests as
735
739
  * `skipped` in registration order. Used by the pool to split heavy files
736
740
  * into per-test shards.
@@ -742,7 +746,7 @@ type RunGeoSpecModuleOptions = {
742
746
  *
743
747
  * @public
744
748
  */
745
- type GeoSpecRunSuccess = {
749
+ export type GeoSpecRunSuccess = {
746
750
  success: true;
747
751
  /** True only when selected tests completed successfully with coherent available lineage. */
748
752
  passed: boolean;
@@ -756,7 +760,7 @@ type GeoSpecRunSuccess = {
756
760
  *
757
761
  * @public
758
762
  */
759
- type GeoSpecRunFailure = {
763
+ export type GeoSpecRunFailure = {
760
764
  success: false;
761
765
  issues: VmIssue[];
762
766
  bundle?: BundleResult;
@@ -770,6 +774,5 @@ type GeoSpecRunFailure = {
770
774
  *
771
775
  * @public
772
776
  */
773
- type GeoSpecRunResult = GeoSpecRunSuccess | GeoSpecRunFailure;
774
- //#endregion
775
- export { GeoSpecAssemblyOccurrenceExpectation, GeoSpecAssemblyOccurrencesExpectation, GeoSpecAssertion, GeoSpecAxisExpectation, GeoSpecBoundingBoxExpectation, GeoSpecCenterOfMassExpectation, GeoSpecChamferFeatureExpectation, GeoSpecCircularHoleExpectation, GeoSpecCircularHolePatternExpectation, GeoSpecComponentInterferenceAllowance, GeoSpecComponentInterferenceExpectation, GeoSpecComponentInterferencePairExpectation, GeoSpecComponentSelector, GeoSpecConnectedComponentsExpectation, GeoSpecCylindricalFaceExpectation, GeoSpecExpectOptions, GeoSpecFilletFeatureExpectation, GeoSpecGeometrySelector, GeoSpecMassExpectation, GeoSpecMatcher, GeoSpecMeshIntegrityExpectation, GeoSpecMinimumWallThicknessExpectation, GeoSpecModuleBundleCache, GeoSpecNoDiagnosticsExpectation, GeoSpecNumericExpectation, GeoSpecPlanarFaceExpectation, GeoSpecPointExpectation, GeoSpecProductStructureExpectation, GeoSpecRunFailure, GeoSpecRunLineage, GeoSpecRunResult, GeoSpecRunSuccess, GeoSpecSpatialRelationshipExpectation, GeoSpecSpatialRelationshipsExpectation, GeoSpecStepUnitsExpectation, GeoSpecSurfaceAreaExpectation, GeoSpecTestAccounting, GeoSpecTestCase, GeoSpecTestEvent, GeoSpecTestStatus, GeoSpecTopologyCountsExpectation, GeoSpecValidBrepExpectation, GeoSpecVoidContinuityExpectation, GeoSpecVoidWaypoint, GeoSpecVolumeExpectation, RunGeoSpecModuleOptions };
777
+ export type GeoSpecRunResult = GeoSpecRunSuccess | GeoSpecRunFailure;
778
+ //#endregion
@@ -1,4 +1,4 @@
1
- import { VmIssue } from "@taucad/esbuild/vm";
1
+ import { VmIssue } from "../../vm/types.mjs";
2
2
  //#region src/runner/worker/no-matching-tests-issue.d.ts
3
3
  /**
4
4
  * Create a run-level issue when filters select no tests.
@@ -7,6 +7,5 @@ import { VmIssue } from "@taucad/esbuild/vm";
7
7
  *
8
8
  * @public
9
9
  */
10
- declare const createNoMatchingGeoSpecTestsIssue: () => VmIssue;
11
- //#endregion
12
- export { createNoMatchingGeoSpecTestsIssue };
10
+ export declare const createNoMatchingGeoSpecTestsIssue: () => VmIssue;
11
+ //#endregion
@@ -1,22 +1,22 @@
1
+ import { VmFileSystem, VmIssue } from "../../vm/types.mjs";
1
2
  import { ManagedGeoSpecNativeModelLoader } from "../../model/native-model-loader.mjs";
2
3
  import { GeoSpecRunResult, GeoSpecTestAccounting, GeoSpecTestCase, RunGeoSpecModuleOptions } from "../types.mjs";
3
- import { VmFileSystem, VmIssue } from "@taucad/esbuild/vm";
4
4
  //#region src/runner/worker/runner-types.d.ts
5
5
  /**
6
6
  * One GeoSpec test file executed by a worker-style runner.
7
7
  *
8
8
  * @public
9
9
  */
10
- type GeoSpecRunnerFileResult = {
10
+ export type GeoSpecRunnerFileResult = {
11
11
  /** Absolute or project-relative GeoSpec test file path supplied to the runner. */
12
12
  file: string;
13
13
  /** Low-level module execution result for this file. */
14
14
  result: GeoSpecRunResult;
15
- /** Wall-clock cost of executing this file, in milliseconds (R1). */
15
+ /** Wall-clock cost of executing this file, in milliseconds. */
16
16
  durationMs?: number;
17
- /** First deterministic model-load cache key observed in this file (R9 affinity telemetry). */
17
+ /** First deterministic model-load cache key observed in this file (affinity telemetry). */
18
18
  primaryLoadKey?: string;
19
- /** Executing worker's isolate-resident memory at file completion, in bytes (R15 memory-class telemetry). */
19
+ /** Executing worker's isolate-resident memory at file completion, in bytes (memory-class telemetry). */
20
20
  workerMemoryBytes?: number;
21
21
  };
22
22
  /**
@@ -24,7 +24,7 @@ type GeoSpecRunnerFileResult = {
24
24
  *
25
25
  * @public
26
26
  */
27
- type GeoSpecRunnerResult = {
27
+ export type GeoSpecRunnerResult = {
28
28
  /** True when no files or tests failed and at least one test was selected. */
29
29
  success: boolean;
30
30
  /** Number of non-skipped tests that passed. */
@@ -37,7 +37,7 @@ type GeoSpecRunnerResult = {
37
37
  files: GeoSpecRunnerFileResult[];
38
38
  /** Run-level issues such as aborts or empty filter selections. */
39
39
  issues?: VmIssue[];
40
- /** Wall-clock cost of the whole run, in milliseconds (R1). */
40
+ /** Wall-clock cost of the whole run, in milliseconds. */
41
41
  durationMs?: number;
42
42
  /** Complete requested-file accounting; discovery may remain unknown in unstarted or broken modules. */
43
43
  accounting?: GeoSpecRunnerAccounting;
@@ -45,7 +45,7 @@ type GeoSpecRunnerResult = {
45
45
  lineageStatus?: 'complete' | 'unavailable' | 'mixed';
46
46
  };
47
47
  /** File and observed-test accounting for a worker run. @public */
48
- type GeoSpecRunnerAccounting = GeoSpecTestAccounting & {
48
+ export type GeoSpecRunnerAccounting = GeoSpecTestAccounting & {
49
49
  requestedFiles: readonly string[];
50
50
  completedFiles: readonly string[];
51
51
  notRunFiles: readonly string[];
@@ -54,7 +54,7 @@ type GeoSpecRunnerAccounting = GeoSpecTestAccounting & {
54
54
  bailed: boolean;
55
55
  };
56
56
  /** Identity of a test that has started but not settled. @public */
57
- type GeoSpecRunnerTestRef = {
57
+ export type GeoSpecRunnerTestRef = {
58
58
  readonly suite: readonly string[];
59
59
  readonly name: string;
60
60
  readonly ordinal?: number;
@@ -65,7 +65,7 @@ type GeoSpecRunnerTestRef = {
65
65
  *
66
66
  * @public
67
67
  */
68
- type GeoSpecRunnerEvent = {
68
+ export type GeoSpecRunnerEvent = {
69
69
  type: 'run-start';
70
70
  files: readonly string[];
71
71
  } | {
@@ -100,7 +100,7 @@ type GeoSpecRunnerEvent = {
100
100
  *
101
101
  * @public
102
102
  */
103
- type GeoSpecRunnerRunOptions = {
103
+ export type GeoSpecRunnerRunOptions = {
104
104
  /** GeoSpec test files to execute. Files run serially by default. */
105
105
  files: readonly string[];
106
106
  /** JavaScript regular expression matched against full `suite > test` names. */
@@ -114,7 +114,7 @@ type GeoSpecRunnerRunOptions = {
114
114
  */
115
115
  workUnitLimit?: number;
116
116
  /**
117
- * Stop after the first failing file (R1). Interactive fail-fast only —
117
+ * Stop after the first failing file. Interactive fail-fast only —
118
118
  * never the default for reward runs, which want the complete red set.
119
119
  */
120
120
  bail?: boolean;
@@ -124,7 +124,7 @@ type GeoSpecRunnerRunOptions = {
124
124
  *
125
125
  * @public
126
126
  */
127
- type GeoSpecRunnerOptions = {
127
+ export type GeoSpecRunnerOptions = {
128
128
  /** Filesystem containing the project and test modules. */
129
129
  filesystem: VmFileSystem;
130
130
  /** Protocol-3 assertion client shared by every authored assertion and model admission. */
@@ -133,13 +133,15 @@ type GeoSpecRunnerOptions = {
133
133
  nativeModelLoader?: ManagedGeoSpecNativeModelLoader;
134
134
  /** Additional in-memory modules made available to the VM. */
135
135
  builtinModules?: RunGeoSpecModuleOptions['builtinModules'];
136
+ /** Module VM factory for every file; defaults to GeoSpec's plain VM (see `RunGeoSpecModuleOptions`). */
137
+ createModuleVm?: RunGeoSpecModuleOptions['createModuleVm'];
136
138
  };
137
139
  /**
138
140
  * Public GeoSpec runner lifecycle surface.
139
141
  *
140
142
  * @public
141
143
  */
142
- type GeoSpecRunner = {
144
+ export type GeoSpecRunner = {
143
145
  /** Execute GeoSpec files and return a compact aggregate result. */
144
146
  run(options: GeoSpecRunnerRunOptions): Promise<GeoSpecRunnerResult>;
145
147
  /** Subscribe to one lifecycle event type. */
@@ -151,5 +153,4 @@ type GeoSpecRunner = {
151
153
  /** Close the runner and release owned resources. */
152
154
  close(): Promise<void>;
153
155
  };
154
- //#endregion
155
- export { GeoSpecRunner, GeoSpecRunnerAccounting, GeoSpecRunnerEvent, GeoSpecRunnerFileResult, GeoSpecRunnerOptions, GeoSpecRunnerResult, GeoSpecRunnerRunOptions, GeoSpecRunnerTestRef };
156
+ //#endregion
@@ -1 +1 @@
1
- import{createNoMatchingGeoSpecTestsIssue as e}from"./no-matching-tests-issue.mjs";import{runGeoSpecModule as t}from"../run-geospec-module.mjs";const n=()=>({code:`GEOSPEC_RUNNER_CLOSED`,message:`GeoSpec runner is closed.`,severity:`error`,type:`runtime`}),r=()=>({code:`GEOSPEC_RUNNER_ACTIVE`,message:`GeoSpec runner already has an active run.`,severity:`error`,type:`runtime`}),i=e=>({code:`GEOSPEC_RUNNER_ABORTED`,message:e?`GeoSpec run aborted: ${e}`:`GeoSpec run aborted.`,severity:`error`,type:`runtime`}),a=e=>({code:`GEOSPEC_RUNNER_BAILED`,message:`GeoSpec run stopped after first failure (--bail): ${e}. Remaining files were not executed.`,severity:`error`,type:`runtime`}),o=e=>{let t=0,n=0;for(let r of e)r.status!==`skipped`&&(r.status===`failed`?n+=1:r.status===`passed`&&(t+=1));return{passed:t,failed:n}},s=(e,t)=>{if(!t.success){e.failed+=1;return}e.selectedTests+=t.tests.length;let n=o(t.tests);e.passed+=n.passed,e.failed+=n.failed},c=async e=>{let{runner:n,file:r}=e;return t({filesystem:n.filesystem,entryPath:r,...e.testNamePattern===void 0?{}:{testNamePattern:e.testNamePattern},...e.testTimeout===void 0?{}:{testTimeout:e.testTimeout},...e.onTestEvent===void 0?{}:{onTestEvent:e.onTestEvent},nativeAssertions:e.workUnitLimit===void 0?n.nativeAssertions:{...n.nativeAssertions,workUnitLimit:e.workUnitLimit},...n.nativeModelLoader?{nativeModelLoader:n.nativeModelLoader}:{},...n.builtinModules?{builtinModules:n.builtinModules}:{},...e.bundleCache?{bundleCache:e.bundleCache}:{},...e.collectOnly===!0?{collectOnly:!0}:{}})},l=t=>{let o={closed:!1},l=new Set,u,d,f=new Map,p=e=>{for(let t of l)t(e)},m=()=>o.aborted,h=e=>({requestedFiles:[...e],completedFiles:[],notRunFiles:[...e],discoveryComplete:!1,discovered:0,selected:0,completed:0,passed:0,failed:0,unsupported:0,inconclusive:0,skipped:0,notRun:0,cancelled:!1,bailed:!1}),g=(e,t)=>({success:!1,passed:0,failed:1,selectedTests:0,files:[],issues:[e],accounting:h(t),lineageStatus:`unavailable`}),_=async n=>{let r=[...n.files],o=performance.now();p({type:`run-start`,files:r});let l=!1,u=async()=>{l||(l=!0,await t.nativeModelLoader?.releaseAll())},d=0,g=0,_=0,v=[],y=[],b=h(r),x=!0,S=`complete`,C=new Map;try{for(let e of r){let o=m();if(o!==void 0){let e=i(o);y.push(e),g+=1,p({type:`abort`,reason:o}),b.cancelled=!0,x=!1;break}p({type:`file-start`,file:e});let l=performance.now(),u=await c({runner:t,file:e,...n.testNamePattern===void 0?{}:{testNamePattern:n.testNamePattern},...n.testTimeout===void 0?{}:{testTimeout:n.testTimeout},...n.workUnitLimit===void 0?{}:{workUnitLimit:n.workUnitLimit},onTestEvent:t=>{p(t.type===`test-start`?{type:`test-start`,file:e,test:{suite:[...t.test.suite],name:t.test.name,...t.test.ordinal===void 0?{}:{ordinal:t.test.ordinal}}}:{type:`test-complete`,file:e,test:t.test})},bundleCache:f}).catch(e=>({success:!1,issues:[{code:`GEOSPEC_MODULE_INTERRUPTED`,message:e instanceof Error?e.message:String(e),severity:`error`,type:`runtime`}]})),h=performance.now()-l;p({type:`file-complete`,file:e,result:u,durationMs:h}),v.push({file:e,result:u,durationMs:h}),b.completedFiles=v.map(e=>e.file),b.notRunFiles=r.slice(v.length),x&&=u.success&&u.passed,u.lineage===void 0||u.lineage.status===`unavailable`?S!==`mixed`&&(S=`unavailable`):u.lineage.status===`mixed`&&(S=`mixed`);let w=u.lineage?.loads.flatMap(e=>{let{evidence:t}=e,n=t?.artifacts[0];return t?.exportOptions===void 0?[...(t?.artifacts??[]).flatMap(e=>e.sourcePath===void 0?[]:[{[e.sourcePath]:`sha256:${e.sha256}`}]),...t?.sourcePath===void 0||n===void 0?[]:[{[t.sourcePath]:`sha256:${n.sha256}`}]]:[]})??[];for(let e of[...u.lineage?.modules.map(e=>e.files)??[],...w,...u.lineage?.loads.map(e=>e.evidence?.sourceRevision?.files??{})??[]])for(let[t,n]of Object.entries(e))C.has(t)&&C.get(t)!==n&&(S=`mixed`),C.set(t,n);if(u.accounting!==void 0)for(let e of[`discovered`,`selected`,`completed`,`passed`,`failed`,`unsupported`,`inconclusive`,`skipped`,`notRun`])b[e]+=u.accounting[e];let T={passed:d,failed:g,selectedTests:_};if(s(T,u),{passed:d,failed:g,selectedTests:_}=T,n.bail===!0&&(!x||g>0)){y.push(a(e)),b.bailed=!0;break}}_===0&&g===0&&(y.push(e()),g+=1);try{await u()}catch(e){y.push({code:`GEOSPEC_NATIVE_CLEANUP_FAILED`,message:e instanceof Error?e.message:String(e),severity:`error`,type:`runtime`}),x=!1}b.discoveryComplete=b.notRunFiles.length===0&&v.every(e=>e.result.success&&e.result.accounting!==void 0);let l={success:x&&S===`complete`&&g===0&&y.length===0,passed:d,failed:g,selectedTests:_,files:v,...y.length>0?{issues:y}:{},durationMs:performance.now()-o,accounting:b,lineageStatus:S};return p({type:`run-complete`,result:l}),l}finally{await u()}};return{async run(e){if(new Set(e.files).size!==e.files.length)return g({code:`GEOSPEC_DUPLICATE_FILES`,message:`GeoSpec requested files must be unique.`,severity:`error`,type:`runtime`},e.files);if(o.closed)return g(n(),e.files);if(u!==void 0)return g(r(),e.files);delete o.aborted;let t=()=>void 0,i=new Promise(e=>{t=e});u=i;try{return await _(e)}finally{t(),u===i&&(u=void 0)}},on(e,t){let n=n=>{n.type===e&&t(n)};return l.add(n),()=>l.delete(n)},abort(e){o.aborted=e??`requested`},async close(){d===void 0&&(o.closed=!0,o.aborted??=`runner closed`,d=(async()=>{await u,f.clear(),p({type:`close`})})()),await d}}};export{s as accumulateFileResult,o as countRunnerTests,l as createSerialGeoSpecRunner,c as executeGeoSpecFile};
1
+ import{createNoMatchingGeoSpecTestsIssue as e}from"./no-matching-tests-issue.mjs";import{runGeoSpecModule as t}from"../run-geospec-module.mjs";const n=()=>({code:`GEOSPEC_RUNNER_CLOSED`,message:`GeoSpec runner is closed.`,severity:`error`,type:`runtime`}),r=()=>({code:`GEOSPEC_RUNNER_ACTIVE`,message:`GeoSpec runner already has an active run.`,severity:`error`,type:`runtime`}),i=e=>({code:`GEOSPEC_RUNNER_ABORTED`,message:e?`GeoSpec run aborted: ${e}`:`GeoSpec run aborted.`,severity:`error`,type:`runtime`}),a=e=>({code:`GEOSPEC_RUNNER_BAILED`,message:`GeoSpec run stopped after first failure (--bail): ${e}. Remaining files were not executed.`,severity:`error`,type:`runtime`}),o=e=>{let t=0,n=0;for(let r of e)r.status!==`skipped`&&(r.status===`failed`?n+=1:r.status===`passed`&&(t+=1));return{passed:t,failed:n}},s=(e,t)=>{if(!t.success){e.failed+=1;return}e.selectedTests+=t.tests.length;let n=o(t.tests);e.passed+=n.passed,e.failed+=n.failed},c=async e=>{let{runner:n,file:r}=e;return t({filesystem:n.filesystem,entryPath:r,...e.testNamePattern===void 0?{}:{testNamePattern:e.testNamePattern},...e.testTimeout===void 0?{}:{testTimeout:e.testTimeout},...e.onTestEvent===void 0?{}:{onTestEvent:e.onTestEvent},nativeAssertions:e.workUnitLimit===void 0?n.nativeAssertions:{...n.nativeAssertions,workUnitLimit:e.workUnitLimit},...n.nativeModelLoader?{nativeModelLoader:n.nativeModelLoader}:{},...n.builtinModules?{builtinModules:n.builtinModules}:{},...n.createModuleVm?{createModuleVm:n.createModuleVm}:{},...e.bundleCache?{bundleCache:e.bundleCache}:{},...e.collectOnly===!0?{collectOnly:!0}:{}})},l=t=>{let o={closed:!1},l=/* @__PURE__ */ new Set,u,d,f=/* @__PURE__ */ new Map,p=e=>{for(let t of l)t(e)},m=()=>o.aborted,h=e=>({requestedFiles:[...e],completedFiles:[],notRunFiles:[...e],discoveryComplete:!1,discovered:0,selected:0,completed:0,passed:0,failed:0,unsupported:0,inconclusive:0,skipped:0,notRun:0,cancelled:!1,bailed:!1}),g=(e,t)=>({success:!1,passed:0,failed:1,selectedTests:0,files:[],issues:[e],accounting:h(t),lineageStatus:`unavailable`}),_=async n=>{let r=[...n.files],o=performance.now();p({type:`run-start`,files:r});let l=!1,u=async()=>{l||(l=!0,await t.nativeModelLoader?.releaseAll())},d=0,g=0,_=0,v=[],y=[],b=h(r),x=!0,S=`complete`,C=/* @__PURE__ */ new Map;try{for(let e of r){let o=m();if(o!==void 0){let e=i(o);y.push(e),g+=1,p({type:`abort`,reason:o}),b.cancelled=!0,x=!1;break}p({type:`file-start`,file:e});let l=performance.now(),u=await c({runner:t,file:e,...n.testNamePattern===void 0?{}:{testNamePattern:n.testNamePattern},...n.testTimeout===void 0?{}:{testTimeout:n.testTimeout},...n.workUnitLimit===void 0?{}:{workUnitLimit:n.workUnitLimit},onTestEvent:t=>{p(t.type===`test-start`?{type:`test-start`,file:e,test:{suite:[...t.test.suite],name:t.test.name,...t.test.ordinal===void 0?{}:{ordinal:t.test.ordinal}}}:{type:`test-complete`,file:e,test:t.test})},bundleCache:f}).catch(e=>({success:!1,issues:[{code:`GEOSPEC_MODULE_INTERRUPTED`,message:e instanceof Error?e.message:String(e),severity:`error`,type:`runtime`}]})),h=performance.now()-l;p({type:`file-complete`,file:e,result:u,durationMs:h}),v.push({file:e,result:u,durationMs:h}),b.completedFiles=v.map(e=>e.file),b.notRunFiles=r.slice(v.length),x&&=u.success&&u.passed,u.lineage===void 0||u.lineage.status===`unavailable`?S!==`mixed`&&(S=`unavailable`):u.lineage.status===`mixed`&&(S=`mixed`);let w=u.lineage?.loads.flatMap(e=>{let{evidence:t}=e,n=t?.artifacts[0];return t?.exportOptions===void 0?[...(t?.artifacts??[]).flatMap(e=>e.sourcePath===void 0?[]:[{[e.sourcePath]:`sha256:${e.sha256}`}]),...t?.sourcePath===void 0||n===void 0?[]:[{[t.sourcePath]:`sha256:${n.sha256}`}]]:[]})??[];for(let e of[...u.lineage?.modules.map(e=>e.files)??[],...w,...u.lineage?.loads.map(e=>e.evidence?.sourceRevision?.files??{})??[]])for(let[t,n]of Object.entries(e))C.has(t)&&C.get(t)!==n&&(S=`mixed`),C.set(t,n);if(u.accounting!==void 0)for(let e of[`discovered`,`selected`,`completed`,`passed`,`failed`,`unsupported`,`inconclusive`,`skipped`,`notRun`])b[e]+=u.accounting[e];let T={passed:d,failed:g,selectedTests:_};if(s(T,u),{passed:d,failed:g,selectedTests:_}=T,n.bail===!0&&(!x||g>0)){y.push(a(e)),b.bailed=!0;break}}_===0&&g===0&&(y.push(e()),g+=1);try{await u()}catch(e){y.push({code:`GEOSPEC_NATIVE_CLEANUP_FAILED`,message:e instanceof Error?e.message:String(e),severity:`error`,type:`runtime`}),x=!1}b.discoveryComplete=b.notRunFiles.length===0&&v.every(e=>e.result.success&&e.result.accounting!==void 0);let l={success:x&&S===`complete`&&g===0&&y.length===0,passed:d,failed:g,selectedTests:_,files:v,...y.length>0?{issues:y}:{},durationMs:performance.now()-o,accounting:b,lineageStatus:S};return p({type:`run-complete`,result:l}),l}finally{await u()}};return{async run(e){if(new Set(e.files).size!==e.files.length)return g({code:`GEOSPEC_DUPLICATE_FILES`,message:`GeoSpec requested files must be unique.`,severity:`error`,type:`runtime`},e.files);if(o.closed)return g(n(),e.files);if(u!==void 0)return g(r(),e.files);delete o.aborted;let t=()=>void 0,i=new Promise(e=>{t=e});u=i;try{return await _(e)}finally{t(),u===i&&(u=void 0)}},on(e,t){let n=n=>{n.type===e&&t(n)};return l.add(n),()=>l.delete(n)},abort(e){o.aborted=e??`requested`},async close(){d===void 0&&(o.closed=!0,o.aborted??=`runner closed`,d=(async()=>{await u,f.clear(),p({type:`close`})})()),await d}}};export{s as accumulateFileResult,o as countRunnerTests,l as createSerialGeoSpecRunner,c as executeGeoSpecFile};