geospec 0.1.0-beta.6 → 0.1.0-beta.7

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.
@@ -1,6 +1,6 @@
1
1
  # geospec — Types (2)
2
2
 
3
- 67 top-level symbols. Signatures are verbatim typescript.
3
+ 63 top-level symbols. Signatures are verbatim typescript.
4
4
 
5
5
  // Inline code-CAD model load options
6
6
  LoadModelCodeOptions: {
@@ -8,6 +8,8 @@ LoadModelCodeOptions: {
8
8
  code: Code;
9
9
  /** Entry path to render from {@link code}. */
10
10
  file: keyof Code & string;
11
+ /** Not accepted: inline code has no project folder to resolve in, and a load naming one is refused. */
12
+ rootDir?: never;
11
13
  /** Geometry format to export. Defaults to `glb`. */
12
14
  format?: GeoSpecModelFormat;
13
15
  /** Explicit parameters passed to the runtime. */
@@ -49,6 +51,9 @@ LoadModelCodeOptions: {
49
51
  // Entry path to render from {@link code }
50
52
  file: keyof Code & string
51
53
 
54
+ // Not accepted
55
+ rootDir?: never
56
+
52
57
  // Geometry format to export
53
58
  format?: GeoSpecModelFormat
54
59
 
@@ -84,8 +89,17 @@ LoadModelCodeOptions: {
84
89
 
85
90
  // Filesystem-backed model load options
86
91
  LoadModelFileOptions: {
87
- /** Project-relative model file to render. */
92
+ /**
93
+ * Model file to render, as a path from the project root: the same root every tool's `targetFile` resolves
94
+ * against, which the result names as `projectRoot` where the host reports it, as `tau mcp` does.
95
+ */
88
96
  file: string;
97
+ /**
98
+ * Project-relative folder `file` resolves in, for a suite that loads from somewhere other than the project root:
99
+ * `loadModel({ file: 'main.ts', rootDir: 'parts/gear' })` loads `parts/gear/main.ts`. Recorded in the load
100
+ * evidence.
101
+ */
102
+ rootDir?: string;
89
103
  /** Project root used by runtime integrations. */
90
104
  projectPath?: string;
91
105
  /** Geometry format to export. Defaults to `glb`. */
@@ -121,9 +135,12 @@ LoadModelFileOptions: {
121
135
  region?: GeoSpecLoadRegion;
122
136
  }
123
137
 
124
- // Project-relative model file to render
138
+ // Model file to render, as a path from the project root
125
139
  file: string
126
140
 
141
+ // Project-relative folder `file` resolves in, for a suite that loads from somewhere other than the project root
142
+ rootDir?: string
143
+
127
144
  // Project root used by runtime integrations
128
145
  projectPath?: string
129
146
 
@@ -160,6 +177,9 @@ LoadModelFileOptions: {
160
177
  // Options accepted by {@link import ('./load-model.js').loadModel}
161
178
  LoadModelOptions: LoadModelSourceOptions | LoadModelCodeOptions<Code> | LoadModelFileOptions
162
179
 
180
+ // Project-relative folder `file` resolves in, for a suite that loads from somewhere other than the project root
181
+ rootDir?: string
182
+
163
183
  // Geometry format to export
164
184
  format?: GeoSpecModelFormat
165
185
 
@@ -190,6 +210,11 @@ LoadModelSourceOptions: {
190
210
  readonly name: string;
191
211
  readonly source: MeshSource | StepSource;
192
212
  }>;
213
+ /**
214
+ * Project-relative folder a path `source` and each resource path resolve in. Omitted, they resolve against the
215
+ * project root. Recorded in the load evidence.
216
+ */
217
+ rootDir?: string;
193
218
  /** Source geometry format. Defaults to `glb`. */
194
219
  format?: GeoSpecModelFormat;
195
220
  /** Source path recorded in provenance. */
@@ -225,6 +250,9 @@ LoadModelSourceOptions: {
225
250
  readonly source: MeshSource | StepSource;
226
251
  }>
227
252
 
253
+ // Project-relative folder a path `source` and each resource path resolve in
254
+ rootDir?: string
255
+
228
256
  // Source geometry format
229
257
  format?: GeoSpecModelFormat
230
258
 
@@ -670,6 +698,9 @@ GeoSpecNativeLoadModelOptions: LoadModelOptions<Code> & {
670
698
  readonly ingestOptions?: Readonly<Record<string, unknown>>;
671
699
  }
672
700
 
701
+ // Project-relative folder `file` resolves in, for a suite that loads from somewhere other than the project root
702
+ rootDir?: string
703
+
673
704
  // Geometry format to export
674
705
  format?: GeoSpecModelFormat
675
706
 
@@ -1282,7 +1313,7 @@ MinimumDistanceResult: {
1282
1313
  readonly fact: MinimumDistanceFact;
1283
1314
  } | {
1284
1315
  readonly status: 'refused';
1285
- readonly code: 'unsupported-evidence' | 'invalid-selection' | 'work-limit';
1316
+ readonly code: 'unsupported-evidence' | 'invalid-selection' | 'work-limit' | 'analysis-limit' | 'resource-limit';
1286
1317
  readonly message: string;
1287
1318
  } | {
1288
1319
  readonly status: 'interrupted';
@@ -1494,67 +1525,3 @@ GeoSpecPmiQueryValue: {
1494
1525
  readonly subjectHash: string
1495
1526
 
1496
1527
  readonly provenance: Readonly<Record<string, unknown>>
1497
-
1498
- // Full native assertion result with the exact core-owned bytes retained
1499
- GeoSpecCanonicalClaimReport: {
1500
- readonly canonicalClaim: Uint8Array<ArrayBuffer>;
1501
- readonly canonicalPlan: Uint8Array<ArrayBuffer>;
1502
- readonly canonicalResult: Uint8Array<ArrayBuffer>;
1503
- readonly claim: Readonly<Record<string, JSONValue>>;
1504
- readonly claimId: string;
1505
- /** Engine diagnostics; a `MATCHER_TIMEOUT` row also carries `details.limit`, `details.used` and `details.maximumLimit`. */
1506
- readonly diagnostics: readonly JSONValue[];
1507
- readonly evidence?: JSONValue;
1508
- readonly polarity: GeoSpecClaimPolarity;
1509
- readonly result: Readonly<Record<string, JSONValue>>;
1510
- readonly status: GeoSpecCanonicalClaimStatus;
1511
- }
1512
-
1513
- readonly canonicalClaim: Uint8Array<ArrayBuffer>
1514
-
1515
- readonly canonicalPlan: Uint8Array<ArrayBuffer>
1516
-
1517
- readonly canonicalResult: Uint8Array<ArrayBuffer>
1518
-
1519
- readonly claim: Readonly<Record<string, JSONValue>>
1520
-
1521
- readonly claimId: string
1522
-
1523
- // Engine diagnostics
1524
- readonly diagnostics: readonly JSONValue[]
1525
-
1526
- readonly evidence?: JSONValue
1527
-
1528
- readonly polarity: GeoSpecClaimPolarity
1529
-
1530
- readonly result: Readonly<Record<string, JSONValue>>
1531
-
1532
- readonly status: GeoSpecCanonicalClaimStatus
1533
-
1534
- // Exact core bytes of one claim evaluated in one engine call
1535
- GeoSpecNativeClaimEvaluation: {
1536
- readonly canonicalClaim: Uint8Array<ArrayBuffer>;
1537
- readonly canonicalPlan: Uint8Array<ArrayBuffer>;
1538
- readonly canonicalResult: Uint8Array<ArrayBuffer>;
1539
- }
1540
-
1541
- readonly canonicalClaim: Uint8Array<ArrayBuffer>
1542
-
1543
- readonly canonicalPlan: Uint8Array<ArrayBuffer>
1544
-
1545
- readonly canonicalResult: Uint8Array<ArrayBuffer>
1546
-
1547
- // Byte-only engine surface consumed by the runner-independent assertion client
1548
- GeoSpecNativeEngine: {
1549
- evaluateClaim(request: Uint8Array<ArrayBuffer>): GeoSpecNativeClaimEvaluation;
1550
- processRequest(request: Uint8Array<ArrayBuffer>): Uint8Array<ArrayBuffer>;
1551
- }
1552
-
1553
- // GeoSpecNativeEngine.evaluateClaim (method)
1554
- evaluateClaim(request: Uint8Array<ArrayBuffer>): GeoSpecNativeClaimEvaluation;
1555
-
1556
- // GeoSpecNativeEngine.processRequest (method)
1557
- processRequest(request: Uint8Array<ArrayBuffer>): Uint8Array<ArrayBuffer>;
1558
-
1559
- // Success-evidence profile a product selects for its plans (PERF-OUTPUT-01)
1560
- GeoSpecNativeEvidenceProfile: 'bounded' | 'complete'
@@ -1,6 +1,70 @@
1
1
  # geospec — Types (3)
2
2
 
3
- 10 top-level symbols. Signatures are verbatim typescript.
3
+ 14 top-level symbols. Signatures are verbatim typescript.
4
+
5
+ // Full native assertion result with the exact core-owned bytes retained
6
+ GeoSpecCanonicalClaimReport: {
7
+ readonly canonicalClaim: Uint8Array<ArrayBuffer>;
8
+ readonly canonicalPlan: Uint8Array<ArrayBuffer>;
9
+ readonly canonicalResult: Uint8Array<ArrayBuffer>;
10
+ readonly claim: Readonly<Record<string, JSONValue>>;
11
+ readonly claimId: string;
12
+ /** Engine diagnostics; a `MATCHER_TIMEOUT` row also carries `details.limit`, `details.used` and `details.maximumLimit`. */
13
+ readonly diagnostics: readonly JSONValue[];
14
+ readonly evidence?: JSONValue;
15
+ readonly polarity: GeoSpecClaimPolarity;
16
+ readonly result: Readonly<Record<string, JSONValue>>;
17
+ readonly status: GeoSpecCanonicalClaimStatus;
18
+ }
19
+
20
+ readonly canonicalClaim: Uint8Array<ArrayBuffer>
21
+
22
+ readonly canonicalPlan: Uint8Array<ArrayBuffer>
23
+
24
+ readonly canonicalResult: Uint8Array<ArrayBuffer>
25
+
26
+ readonly claim: Readonly<Record<string, JSONValue>>
27
+
28
+ readonly claimId: string
29
+
30
+ // Engine diagnostics
31
+ readonly diagnostics: readonly JSONValue[]
32
+
33
+ readonly evidence?: JSONValue
34
+
35
+ readonly polarity: GeoSpecClaimPolarity
36
+
37
+ readonly result: Readonly<Record<string, JSONValue>>
38
+
39
+ readonly status: GeoSpecCanonicalClaimStatus
40
+
41
+ // Exact core bytes of one claim evaluated in one engine call
42
+ GeoSpecNativeClaimEvaluation: {
43
+ readonly canonicalClaim: Uint8Array<ArrayBuffer>;
44
+ readonly canonicalPlan: Uint8Array<ArrayBuffer>;
45
+ readonly canonicalResult: Uint8Array<ArrayBuffer>;
46
+ }
47
+
48
+ readonly canonicalClaim: Uint8Array<ArrayBuffer>
49
+
50
+ readonly canonicalPlan: Uint8Array<ArrayBuffer>
51
+
52
+ readonly canonicalResult: Uint8Array<ArrayBuffer>
53
+
54
+ // Byte-only engine surface consumed by the runner-independent assertion client
55
+ GeoSpecNativeEngine: {
56
+ evaluateClaim(request: Uint8Array<ArrayBuffer>): GeoSpecNativeClaimEvaluation;
57
+ processRequest(request: Uint8Array<ArrayBuffer>): Uint8Array<ArrayBuffer>;
58
+ }
59
+
60
+ // GeoSpecNativeEngine.evaluateClaim (method)
61
+ evaluateClaim(request: Uint8Array<ArrayBuffer>): GeoSpecNativeClaimEvaluation;
62
+
63
+ // GeoSpecNativeEngine.processRequest (method)
64
+ processRequest(request: Uint8Array<ArrayBuffer>): Uint8Array<ArrayBuffer>;
65
+
66
+ // Success-evidence profile a product selects for its plans (PERF-OUTPUT-01)
67
+ GeoSpecNativeEvidenceProfile: 'bounded' | 'complete'
4
68
 
5
69
  // Content-addressed subject accepted by a protocol-3 assertion plan
6
70
  GeoSpecNativeSubject: {
@@ -4,23 +4,23 @@ export default Object.freeze([
4
4
  slug: "geospec-authoring",
5
5
  name: "GeoSpec authoring",
6
6
  description: "Guides canonical GeoSpec geometry tests in TypeScript or JavaScript for every Tau kernel. Use for *.geospec.ts and *.geospec.js tests.",
7
- version: "0.1.0-beta.6",
7
+ version: "0.1.0-beta.7",
8
8
  whenToUse: "Use before creating or editing *.geospec.ts or *.geospec.js tests, for a model in any kernel.",
9
- body: "---\nname: geospec-authoring\ndescription: Guides canonical GeoSpec geometry tests in TypeScript or JavaScript for every Tau kernel. Use for *.geospec.ts and *.geospec.js tests.\n---\n\n# GeoSpec authoring\n\nWrite tests before implementation; assert deterministic, measurable properties.\n\n## Test shape\n\n- Use `*.geospec.ts` or `*.geospec.js`. Import `describe`, `it` and `expectGeo` from `geospec`, and `loadModel` from `geospec/model`.\n- Await `loadModel`, then assert synchronously with `expectGeo(model)`. The host supplies the compiled binding; authoring does not select an engine.\n- Await or return the complete model-load chain from the test callback; detached future loads are not part of a completed test.\n- Omit `parameters` for model-code defaults; use `{ file, parameters }` for variants. Loaded subjects are opaque.\n\nCanonical TypeScript authoring:\n\n```ts\nimport { describe, expectGeo, it } from 'geospec';\nimport { loadModel } from 'geospec/model';\n\ndescribe('main geometry', () => {\n it('has the intended envelope', async () => {\n const model = await loadModel({ file: 'main.ts', parameters: { width: 120 } });\n expectGeo(model).toHaveBoundingBox({ size: { x: 120 }, tolerance: 1 });\n });\n});\n```\n\nSpecs are always TypeScript or JavaScript, whatever the model's kernel: `loadModel({ file })` evaluates `main.ts`, `main.tsx`, `main.py`, `main.scad`, `main.kcl` or `main.cs` through Tau's runtime. `test_model` discovers `*.geospec.ts` and `*.geospec.js` only.\n\nEvery matcher takes one expectation object:\n\n- Wrong: `expectGeo(model).toHaveVolume(5000, { tolerance: 5 })`. Correct: `expectGeo(model).toHaveVolume({ value: 5000, tolerance: 5 })`.\n- Wrong: `await expectGeo(model)…`. Correct: await `loadModel`, then assert synchronously.\n- Wrong: exact-feature matchers on a mesh kernel (Manifold, JSCAD, OpenSCAD, PicoGK, PicoVoxel). Correct: `toBeValidBrep`, `toHaveTopologyCounts`, the face, hole, pattern, chamfer, fillet and wall-thickness matchers, `toHaveStepUnits`, `toHaveProductStructure` and `toHaveVoidContinuity` need STEP BRep evidence and report unsupported on meshes; assert meshes with bounds, volume, surface area, connected components and `toBeWatertight`.\n\n## Loads and budgets\n\n- GeoSpec has no `beforeAll`. Write each `loadModel` inside its own `it`: within one run, identical loads (same file or code, parameters, format, tolerances and region) share one export and one admission. Each load keeps its own `loadId` and records `reused: true`, and a file is reused only while its source closure is unchanged.\n- `loadModel({ file, workUnitLimit })` sets the default claim budget for that subject, and `expectGeo(model, { workUnitLimit })` overrides it for one chain. The budget is a positive integer no greater than 512000000. A `MATCHER_TIMEOUT` refusal reports `details.limit` and, when measured, `details.used`; raise the budget within the bound or simplify the model, and never treat the refusal as a pass.\n- `loadModel({ file, region: { min: [x, y, z], max: [x, y, z] } })` makes a separate claim about one millimetre box, never a stand-in for a whole-model claim. The kernel crops before export (PicoVoxel trims Voxels parts), and other kernels, STEP loads and unconfirmed crops refuse with a typed diagnostic. A cropped subject answers only bounding box, volume, surface area, mass and center of mass of its region, and its assertions record the region. Every other matcher on it refuses with `GEOSPEC_REGION_WHOLE_MODEL_CLAIM`. Name the region in the test, and keep whole-model claims on whole-model loads.\n- A host or engine limit leaves a claim undecided, never false. Keep the model as designed: never coarsen, shrink or crop it to fit. Raise `workUnitLimit` or `testTimeout` within the host's maximum, which the host can raise, or report the claim as not decided at this capacity.\n- `toHaveCenterOfMass({ point, tolerance })` takes an exact point. Per-axis ranges such as `{ y: { greaterThan: 1 } }` are refused.\n\n## Coverage\n\nBounds and physical properties are insufficient. Cover major components, named features, variants, dimensions/positions, disjoint counts, closure, interference and supported exact features. Explicitly report unsupported requirements; proxies cannot fulfill them.\n\n- `toHaveBoundingBox`: size/position.\n- `toHaveConnectedComponents`: qualified material connectivity; visual touching cannot justify tolerance changes.\n- `toBeWatertight`: closed edge incidence, not manifold validity, fusion or material connectivity. Bounds prove none of these. Missing evidence is unsupported.\n- `toHaveSurfaceArea`, `toHaveVolume`, `toHaveCenterOfMass`, `toHaveMass`: physical measurements.\n- `toHaveNoComponentInterference`: overlap; allow deliberate press fits.\n- `loadModel({ file, format: 'step' })`: use BRep evidence for supported topology and feature assertions. Missing occurrence, interference, clearance, containment, lumen, wall, section or motion evidence is unsupported, not a pass or an envelope substitute.\n\nTest assemblies and independent units; preserve sibling coverage when adding files. Non-top-level geometry needs kernel export/invocation, not test removal.\n\nFix geometry at its root; never weaken tolerances, delete assertions, or reduce detail to pass.\n\n`public-api-index.md` covers the host and framework API; authoring needs only the Core API below and `api-*` files.\n\n## Core API\n\nThe symbols real Tau models use most, as verbatim declarations. Anything not shown is in the API reference below.\n\n### Functions\n\n```ts\n// Start a geometry assertion chain\nexport declare function expectGeo(subject: GeoSpecSubject, options?: GeoSpecExpectOptions): GeoSpecMatcher;\n\n// A model admitted by one live GeoSpec host scope\nGeoSpecSubject: {\n readonly [subjectBrand]: true\n}\n\n// Per-chain options accepted by `expectGeo(subject, options)`\nGeoSpecExpectOptions: {\n // Deterministic work-unit budget for every claim in this chain\n readonly workUnitLimit?: number\n}\n\n// Load a CAD model into GeoSpec evidence\nexport declare function loadModel<Code extends Record<string, string> = Record<string, string>>(_options: LoadModelOptions<Code>): Promise<GeoSpecSubject>;\n\n// Options accepted by {@link import ('./load-model.js').loadModel}\nLoadModelOptions: LoadModelSourceOptions | LoadModelCodeOptions<Code> | LoadModelFileOptions\n // Geometry format to export\n format?: GeoSpecModelFormat\n // Explicit parameters passed to the runtime\n parameters?: Record<string, unknown>\n // STEP reader strategy used for STEP exports\n stepStreaming?: StepStreamingMode\n // Whether STEP loading should also produce mesh evidence\n mesh?: boolean\n // Linear tolerance used while meshing exact BRep evidence\n meshLinearTolerance?: number\n // Angular tolerance in degrees used while meshing exact BRep evidence\n meshAngularToleranceDegrees?: number\n // Default work-unit budget for every claim on this subject\n workUnitLimit?: number\n\n// Geometry formats accepted by {@link import ('./load-model.js').loadModel}\nGeoSpecModelFormat: MeshFileFormat | 'step' | 'stp'\n```\n\n### Types\n\n```ts\n// Assertion chain returned by `expectGeo(subject)`\nGeoSpecMatcher: {\n // Core-owned negation\n readonly not: Omit<GeoSpecMatcher, 'not'>\n // Assert the fixed rational plate contract\n toSatisfyRationalPlate(): GeoSpecAssertion;\n // Assert the fixed parallel-plane distance contract\n toSatisfyParallelPlaneDistance(): GeoSpecAssertion;\n // Assert axis-aligned bounds, size, or center for a loaded geometry subject\n toHaveBoundingBox(first: Vec3 | GeoSpecBoundingBoxExpectation, second?: Vec3): GeoSpecAssertion;\n // Assert how many spatially disjoint chunks the mesh contains\n toHaveConnectedComponents(expected: GeoSpecConnectedComponentsExpectation): GeoSpecAssertion;\n // Assert closed mesh edge incidence\n toBeWatertight(): GeoSpecAssertion;\n // Assert that separate assembly components do not occupy the same solid volume\n toHaveNoComponentInterference(expected?: GeoSpecComponentInterferenceExpectation): GeoSpecAssertion;\n // Assert that named assembly occurrences exist with expected counts and bounds\n toHaveAssemblyOccurrences(expected: GeoSpecAssemblyOccurrencesExpectation): GeoSpecAssertion;\n // Assert that selected entities satisfy declared spatial relationships\n toHaveSpatialRelationships(expected: GeoSpecSpatialRelationshipsExpectation): GeoSpecAssertion;\n // Assert rendered mesh evidence is internally trustworthy for downstream checks\n toHaveMeshIntegrity(expected: GeoSpecMeshIntegrityExpectation): GeoSpecAssertion;\n // Assert that the subject carries no diagnostics at the rejected severities\n toHaveNoDiagnostics(expected?: GeoSpecNoDiagnosticsExpectation): GeoSpecAssertion;\n // Assert total surface area, preferring exact BRep mass properties when available\n toHaveSurfaceArea(expected: GeoSpecSurfaceAreaExpectation): GeoSpecAssertion;\n // Assert enclosed volume, preferring exact BRep mass properties when available\n toHaveVolume(expected: GeoSpecVolumeExpectation): GeoSpecAssertion;\n // Assert mass derived from exact mass properties or volume times density\n toHaveMass(expected: GeoSpecMassExpectation): GeoSpecAssertion;\n // Assert the center of mass or mesh-derived centroid for a closed subject\n toHaveCenterOfMass(expected: GeoSpecCenterOfMassExpectation): GeoSpecAssertion;\n // Assert that exact BRep evidence reports a valid shape\n toBeValidBrep(expected?: GeoSpecValidBrepExpectation): GeoSpecAssertion;\n // Assert exact BRep topology counts\n toHaveTopologyCounts(expected: GeoSpecTopologyCountsExpectation): GeoSpecAssertion;\n // Assert the STEP unit evidence\n toHaveStepUnits(expected: GeoSpecStepUnitsExpectation): GeoSpecAssertion;\n // Assert STEP product-structure evidence\n toHaveProductStructure(expected: GeoSpecProductStructureExpectation): GeoSpecAssertion;\n // Assert that BRep evidence contains a planar face matching the requested constraints\n toHavePlanarFace(expected: GeoSpecPlanarFaceExpectation): GeoSpecAssertion;\n // Assert that BRep evidence contains a cylindrical face with the requested radius and axis\n toHaveCylindricalFace(expected: GeoSpecCylindricalFaceExpectation): GeoSpecAssertion;\n // Assert that BRep evidence contains a circular hole matching diameter, center, and axis\n toHaveCircularHole(expected: GeoSpecCircularHoleExpectation): GeoSpecAssertion;\n // Assert that BRep evidence contains a repeated circular-hole pattern\n toHaveCircularHolePattern(expected: GeoSpecCircularHolePatternExpectation): GeoSpecAssertion;\n // Assert that BRep evidence contains a chamfer feature with the requested distance\n toHaveChamferFeature(expected: GeoSpecChamferFeatureExpectation): GeoSpecAssertion;\n // Assert that BRep evidence contains a fillet feature with the requested radius\n toHaveFilletFeature(expected: GeoSpecFilletFeatureExpectation): GeoSpecAssertion;\n // Assert that BRep evidence reports a minimum wall thickness satisfying the expectation\n toHaveMinimumWallThickness(expected: GeoSpecMinimumWallThicknessExpectation): GeoSpecAssertion;\n // Assert that the declared waypoints share one connected void, stay isolated from the declared…\n toHaveVoidContinuity(expected: GeoSpecVoidContinuityExpectation): GeoSpecAssertion;\n}\n\n// Numeric 3D vector\nVec3: readonly [number, number, number]\n\n// Bounding-box expectation accepted by `expectGeo(...).toHaveBoundingBox(...)`\nGeoSpecBoundingBoxExpectation: {\n min?: Vec3 | Partial<Record<keyof GeoSpecAxisExpectation, GeoSpecNumericExpectation>>\n max?: Vec3 | Partial<Record<keyof GeoSpecAxisExpectation, GeoSpecNumericExpectation>>\n size?: Vec3 | Partial<Record<keyof GeoSpecAxisExpectation, GeoSpecNumericExpectation>>\n center?: Vec3 | Partial<Record<keyof GeoSpecAxisExpectation, GeoSpecNumericExpectation>>\n tolerance?: number\n}\n\n// Connected-components expectation accepted by `expectGeo(...).toHaveConnectedComponents(...)`\nGeoSpecConnectedComponentsExpectation: {\n count: number\n tolerance?: number\n toleranceMm?: number\n}\n\n// Component-interference expectation accepted by `expectGeo(...).toHaveNoComponentInterference(...)`\nGeoSpecComponentInterferenceExpectation: {\n tolerance?: number\n pairs?: GeoSpecComponentInterferencePairExpectation[]\n allowances?: GeoSpecComponentInterferenceAllowance[]\n}\n\n// Assembly occurrence expectation accepted by `expectGeo(...).toHaveAssemblyOccurrences(...)`\nGeoSpecAssemblyOccurrencesExpectation: {\n occurrences: GeoSpecAssemblyOccurrenceExpectation[]\n uniqueNames?: boolean\n}\n\n// Spatial relationship expectation accepted by `expectGeo(...).toHaveSpatialRelationships(...)`\nGeoSpecSpatialRelationshipsExpectation: {\n relationships: GeoSpecSpatialRelationshipExpectation[]\n}\n\n// Mesh integrity expectation accepted by `expectGeo(...).toHaveMeshIntegrity(...)`\nGeoSpecMeshIntegrityExpectation: {\n finitePositions?: boolean\n degenerateTriangles?: {\n count?: number;\n maxCount?: number;\n areaTolerance?: number;\n }\n duplicateFaces?: {\n count?: number;\n maxCount?: number;\n }\n watertight?: boolean\n triangleCount?: GeoSpecNumericExpectation\n}\n\n// Diagnostic severities rejected by `expectGeo(...).toHaveNoDiagnostics(...)`\nGeoSpecNoDiagnosticsExpectation: {\n severities?: Array<GeometryDiagnostic['severity']>\n}\n\n// Surface-area expectation accepted by `expectGeo(...).toHaveSurfaceArea(...)`\nGeoSpecSurfaceAreaExpectation: {\n value: number | GeoSpecNumericExpectation\n tolerance?: number\n}\n\n// Volume expectation accepted by `expectGeo(...).toHaveVolume(...)`\nGeoSpecVolumeExpectation: {\n value: number | GeoSpecNumericExpectation\n tolerance?: number\n}\n\n// Mass expectation accepted by `expectGeo(...).toHaveMass(...)`\nGeoSpecMassExpectation: {\n value: number | GeoSpecNumericExpectation\n density?: number\n tolerance?: number\n}\n\n// Center-of-mass expectation accepted by `expectGeo(...).toHaveCenterOfMass(...)`\nGeoSpecCenterOfMassExpectation: {\n // Exact expected point in millimetres\n point: GeoSpecPointExpectation\n tolerance?: number\n}\n\n// Exact BRep validity expectation accepted by `expectGeo(...).toBeValidBrep(...)`\nGeoSpecValidBrepExpectation: {\n maxTolerance?: number\n freeBounds?: {\n count?: GeoSpecNumericExpectation;\n }\n minEdgeLength?: number\n sameParameter?: boolean\n closedShells?: boolean\n closedWires?: boolean\n}\n\n// Topology-count expectation accepted by `expectGeo(...).toHaveTopologyCounts(...)`\nGeoSpecTopologyCountsExpectation: {\n vertices?: GeoSpecNumericExpectation\n edges?: GeoSpecNumericExpectation\n wires?: GeoSpecNumericExpectation\n faces?: GeoSpecNumericExpectation\n shells?: GeoSpecNumericExpectation\n solids?: GeoSpecNumericExpectation\n compounds?: GeoSpecNumericExpectation\n tolerance?: number\n}\n\n// STEP unit expectation accepted by `expectGeo(...).toHaveStepUnits(...)`\nGeoSpecStepUnitsExpectation: {\n unit: string\n}\n\n// Product-structure expectation accepted by `expectGeo(...).toHaveProductStructure(...)`\nGeoSpecProductStructureExpectation: {\n names?: string[]\n count?: GeoSpecNumericExpectation\n}\n\n// Planar-face expectation accepted by `expectGeo(...).toHavePlanarFace(...)`\nGeoSpecPlanarFaceExpectation: {\n normal: GeoSpecPointExpectation\n offset: number\n area?: GeoSpecNumericExpectation\n tolerance?: number\n}\n\n// Cylindrical-face expectation accepted by `expectGeo(...).toHaveCylindricalFace(...)`\nGeoSpecCylindricalFaceExpectation: {\n radius: number\n axis: 'x' | 'y' | 'z'\n tolerance?: number\n}\n\n// Circular-hole expectation accepted by `expectGeo(...).toHaveCircularHole(...)`\nGeoSpecCircularHoleExpectation: {\n diameter: number\n through?: boolean\n axis?: 'x' | 'y' | 'z'\n center?: GeoSpecPointExpectation\n tolerance?: number\n}\n\n// Circular-hole-pattern expectation accepted by `expectGeo(...).toHaveCircularHolePattern(...)`\nGeoSpecCircularHolePatternExpectation: {\n count: number\n holeDiameter: number\n boltCircleDiameter?: number\n axis?: 'x' | 'y' | 'z'\n center?: GeoSpecPointExpectation\n tolerance?: number\n}\n\n// Chamfer-feature expectation accepted by `expectGeo(...).toHaveChamferFeature(...)`\nGeoSpecChamferFeatureExpectation: {\n distance: number\n selection?: string\n tolerance?: number\n}\n\n// Fillet-feature expectation accepted by `expectGeo(...).toHaveFilletFeature(...)`\nGeoSpecFilletFeatureExpectation: {\n radius: number\n selection?: string\n tolerance?: number\n}\n\n// Minimum-wall-thickness expectation accepted by `expectGeo(...).toHaveMinimumWallThickness(...)`\nGeoSpecMinimumWallThicknessExpectation: {\n value: GeoSpecNumericExpectation\n tolerance?: number\n}\n\n// Void-continuity expectation accepted by `expectGeo(...).toHaveVoidContinuity(...)`\nGeoSpecVoidContinuityExpectation: {\n // Ordered waypoints (>= 1) known to lie in the void being proven\n path: GeoSpecVoidWaypoint[]\n // Occurrence names whose solids bound the void\n material?: string[]\n // Minimum required bottleneck cross-section (mm²), sampled\n minCrossSection?: number\n // Points that must NOT be reachable from the path void (isolation claim)\n isolatedFrom?: Vec3[]\n // Region bounded for the proof (subject frame)\n bounds?: {\n min: Vec3;\n max: Vec3;\n }\n}\n\n// Axis-keyed numeric expectation used by high-level geometry matchers\nGeoSpecAxisExpectation: {\n x?: number\n y?: number\n z?: number\n}\n\n// Shared scalar expectation used by geometry measurements\nGeoSpecNumericExpectation: number | {\n value?: number;\n greaterThan?: number;\n greaterThanOrEqual?: number;\n lessThan?: number;\n lessThanOrEqual?: number;\n}\n\n// A pair-specific component-interference check accepted by `expectGeo(...).toHaveNoComponentInterference(...)`\nGeoSpecComponentInterferencePairExpectation: {\n left: GeoSpecComponentSelector\n right: GeoSpecComponentSelector\n}\n\n// Intentional component interference allowance accepted by `expectGeo(...).toHaveNoComponentInterference(...)`\nGeoSpecComponentInterferenceAllowance: {\n kind?: 'intentionalInterference'\n left: GeoSpecComponentSelector\n right: GeoSpecComponentSelector\n maxVolume?: number\n reason: string\n}\n\n// Assembly occurrence rule accepted by `expectGeo(...).toHaveAssemblyOccurrences(...)`\nGeoSpecAssemblyOccurrenceExpectation: {\n name: GeoSpecComponentSelector\n count?: GeoSpecNumericExpectation\n bounds?: {\n within?: GeoSpecComponentSelector;\n min?: Vec3 | GeoSpecAxisExpectation;\n max?: Vec3 | GeoSpecAxisExpectation;\n center?: GeoSpecPointExpectation;\n tolerance?: number;\n }\n}\n\n// One spatial relationship accepted by `expectGeo(...).toHaveSpatialRelationships(...)`\nGeoSpecSpatialRelationshipExpectation: {\n id?: string\n kind: 'contact' | 'clearance' | 'coaxial' | 'concentric' | 'coplanar' | 'parallel' | 'perpendicular' | 'angle' | 'containment' | 'insertion' | 'interference'\n subject: GeoSpecGeometrySelector\n target: GeoSpecGeometrySelector\n tolerance?: number\n angularToleranceDegrees?: number\n // Expected angle in degrees for `kind\n angleDegrees?: number\n // Declared insertion axis (subject-frame direction) for `kind\n axis?: Vec3\n min?: number\n max?: number\n minVolume?: number\n maxVolume?: number\n reason?: string\n}\n\n// Shared scalar expectation used by geometry measurements\nGeoSpecNumericExpectation: number | {\n value?: number;\n greaterThan?: number;\n greaterThanOrEqual?: number;\n lessThan?: number;\n lessThanOrEqual?: number;\n}\n\n// Diagnostic emitted by GeoSpec loaders, analyzers, and matchers\nGeometryDiagnostic: {\n code: KernelIssueCode | (string & {})\n severity: 'error' | 'warning' | 'info'\n message: string\n suggestion?: string\n spatial?: {\n min?: Vec3;\n max?: Vec3;\n center?: Vec3;\n }\n details?: unknown\n}\n\n// Shared scalar expectation used by geometry measurements\nGeoSpecNumericExpectation: number | {\n value?: number;\n greaterThan?: number;\n greaterThanOrEqual?: number;\n lessThan?: number;\n lessThanOrEqual?: number;\n}\n\n// Shared scalar expectation used by geometry measurements\nGeoSpecNumericExpectation: number | {\n value?: number;\n greaterThan?: number;\n greaterThanOrEqual?: number;\n lessThan?: number;\n lessThanOrEqual?: number;\n}\n\n// Shared scalar expectation used by geometry measurements\nGeoSpecNumericExpectation: number | {\n value?: number;\n greaterThan?: number;\n greaterThanOrEqual?: number;\n lessThan?: number;\n lessThanOrEqual?: number;\n}\n\n// Point expectation accepted by center and feature matchers\nGeoSpecPointExpectation: Vec3 | GeoSpecAxisExpectation\n\n// Shared scalar expectation used by geometry measurements\nGeoSpecNumericExpectation: number | {\n value?: number;\n greaterThan?: number;\n greaterThanOrEqual?: number;\n lessThan?: number;\n lessThanOrEqual?: number;\n}\n```\n\n## API reference\n\nTo read any other signature, grep the skill directory for the name followed by `(` (or the bare type name): each hit is the declaration line and names its file; read a few lines around it for overloads and parameter notes. `api-index.md` lists all 360 symbols by file.\n\n- `api-functions.md` — Functions\n- `api-constants.md` — Constants\n- `api-types.md` — Types\n- `api-classes.md` — Classes\n\nRead ranges, not whole files. Never copy a reference into a source file.\n",
10
- fingerprint: "6702ecb11c4af8e8ed11f699edfbedfe123d1e0b23680db121cbf3f81cfcc326",
9
+ body: "---\nname: geospec-authoring\ndescription: Guides canonical GeoSpec geometry tests in TypeScript or JavaScript for every Tau kernel. Use for *.geospec.ts and *.geospec.js tests.\n---\n\n# GeoSpec authoring\n\nWrite tests before implementation; assert deterministic, measurable properties.\n\n## Test shape\n\n- Use `*.geospec.ts` or `*.geospec.js`. Import `describe`, `it` and `expectGeo` from `geospec`, and `loadModel` from `geospec/model`.\n- Await `loadModel`, then assert synchronously with `expectGeo(model)`. The host supplies the compiled binding; authoring does not select an engine.\n- Await or return the complete model-load chain from the test callback; detached future loads are not part of a completed test.\n- Omit `parameters` for model-code defaults; use `{ file, parameters }` for variants. Loaded subjects are opaque.\n- `loadModel({ file })` resolves `file` against the project root, the same root as every tool's `targetFile`; the result names that root as `projectRoot` where the host reports it, as `tau mcp` does. A suite in a subfolder names the model by its path from that root, or passes `rootDir`, the project-relative folder the model is in: `loadModel({ file: 'main.ts', rootDir: 'parts/gear' })` loads `parts/gear/main.ts`. A file the root does not hold refuses with `GEOSPEC_MODEL_SOURCE_NOT_FOUND`, which names the root and the path it looked for.\n\nCanonical TypeScript authoring:\n\n```ts\nimport { describe, expectGeo, it } from 'geospec';\nimport { loadModel } from 'geospec/model';\n\ndescribe('main geometry', () => {\n it('has the intended envelope', async () => {\n const model = await loadModel({ file: 'main.ts', parameters: { width: 120 } });\n expectGeo(model).toHaveBoundingBox({ size: { x: 120 }, tolerance: 1 });\n });\n});\n```\n\nSpecs are always TypeScript or JavaScript, whatever the model's kernel: `loadModel({ file })` evaluates `main.ts`, `main.tsx`, `main.py`, `main.scad`, `main.kcl` or `main.cs` through Tau's runtime. `test_model` discovers `*.geospec.ts` and `*.geospec.js` only.\n\nEvery matcher takes one expectation object:\n\n- Wrong: `expectGeo(model).toHaveVolume(5000, { tolerance: 5 })`. Correct: `expectGeo(model).toHaveVolume({ value: 5000, tolerance: 5 })`.\n- Wrong: `await expectGeo(model)…`. Correct: await `loadModel`, then assert synchronously.\n- Wrong: exact-feature matchers on a mesh kernel (Manifold, JSCAD, OpenSCAD, PicoGK, PicoVoxel). Correct: `toBeValidBrep`, `toHaveTopologyCounts`, the face, hole, pattern, chamfer, fillet and wall-thickness matchers, `toHaveStepUnits`, `toHaveProductStructure` and `toHaveVoidContinuity` need STEP BRep evidence and report unsupported on meshes; assert meshes with bounds, volume, surface area, connected components and `toBeWatertight`.\n\n## Loads and budgets\n\n- GeoSpec has no `beforeAll`. Write each `loadModel` inside its own `it`: within one run, identical loads (same file or code, parameters, format, tolerances and region) share one export and one admission. Each load keeps its own `loadId` and records `reused: true`, and a file is reused only while its source closure is unchanged.\n- `loadModel({ file, workUnitLimit })` sets the default claim budget for that subject, and `expectGeo(model, { workUnitLimit })` overrides it for one chain. The budget is a positive integer no greater than 512000000. A `MATCHER_TIMEOUT` refusal reports `details.limit` and, when measured, `details.used`; its `test_model` row (category `work-budget`) names in `limit.retry` the one `workUnitLimit` that can decide the claim, or `null` at the host maximum. Never treat the refusal as a pass.\n- `loadModel({ file, region: { min: [x, y, z], max: [x, y, z] } })` makes a separate claim about one millimetre box, never a stand-in for a whole-model claim. The kernel crops before export (PicoVoxel trims Voxels parts), and other kernels, STEP loads and unconfirmed crops refuse with a typed diagnostic. A cropped subject answers only bounding box, volume, surface area, mass and center of mass of its region, and its assertions record the region. Every other matcher on it refuses with `GEOSPEC_REGION_WHOLE_MODEL_CLAIM`. Name the region in the test, and keep whole-model claims on whole-model loads.\n- A host or engine limit leaves a claim undecided, never false: `test_model` reports it as inconclusive with category `analysis-limit`, `resource-limit` or `work-budget` and a typed `limit` naming the limit and its numbers. Keep the model as designed: never coarsen, shrink or crop it to fit. Only a `work-budget` row's `limit.retry` is a retry, and `testTimeout` only answers a `timeout` row; report every other limit row as not decided at this capacity.\n- `toHaveCenterOfMass({ point, tolerance })` takes an exact point. Per-axis ranges such as `{ y: { greaterThan: 1 } }` are refused.\n\n## Ceilings\n\nFixed in this release; design within them, and report a claim that meets one as not decided.\n\n| Ceiling | Value | Where an agent meets it |\n| ------------------------------------- | -------------------- | --------------------------------------------------------------------------------------------------------------------------------- |\n| `maxSubjectBytes`, `maxResourceBytes` | 64 MiB each | A mesh `loadModel({ file })` exports about 72 bytes per triangle, so admission refuses near 930,000 triangles (`resource-limit`). |\n| `maxTotalBinaryBytes` | 128 MiB | All subjects of one load together. |\n| `maxTriangles`, `maxVertices` | 4,000,000, 2,000,000 | A decoded mesh. |\n| `continuousEvidenceBytes` | 32 MiB | `toHaveNoComponentInterference` on a large assembly (`analysis-limit`). |\n| `workUnitLimit` | 512000000 at most | Any claim; the only limit an argument raises. |\n\nLoad `format: 'step'` only for the exact-BRep matchers above; every other matcher answers on the cheaper mesh.\n\n## Coverage\n\nBounds and physical properties are insufficient. Cover major components, named features, variants, dimensions/positions, disjoint counts, closure, interference and supported exact features. Explicitly report unsupported requirements; proxies cannot fulfill them.\n\n- `toHaveBoundingBox`: size/position.\n- `toHaveConnectedComponents`: qualified material connectivity; visual touching cannot justify tolerance changes.\n- `toBeWatertight`: closed edge incidence, not manifold validity, fusion or material connectivity. Bounds prove none of these. Missing evidence is unsupported.\n- `toHaveSurfaceArea`, `toHaveVolume`, `toHaveCenterOfMass`, `toHaveMass`: physical measurements.\n- `toHaveNoComponentInterference`: overlap; allow deliberate press fits.\n- `loadModel({ file, format: 'step' })`: use BRep evidence for supported topology and feature assertions. Missing occurrence, interference, clearance, containment, lumen, wall, section or motion evidence is unsupported, not a pass or an envelope substitute.\n\nTest assemblies and independent units; preserve sibling coverage when adding files. Non-top-level geometry needs kernel export/invocation, not test removal.\n\nFix geometry at its root; never weaken tolerances, delete assertions, or reduce detail to pass.\n\n`public-api-index.md` covers the host and framework API; authoring needs only the Core API below and `api-*` files.\n\n## Core API\n\nThe symbols real Tau models use most, as verbatim declarations. Anything not shown is in the API reference below.\n\n### Functions\n\n```ts\n// Start a geometry assertion chain\nexport declare function expectGeo(subject: GeoSpecSubject, options?: GeoSpecExpectOptions): GeoSpecMatcher;\n\n// A model admitted by one live GeoSpec host scope\nGeoSpecSubject: {\n readonly [subjectBrand]: true\n}\n\n// Per-chain options accepted by `expectGeo(subject, options)`\nGeoSpecExpectOptions: {\n // Deterministic work-unit budget for every claim in this chain\n readonly workUnitLimit?: number\n}\n\n// Load a CAD model into GeoSpec evidence\nexport declare function loadModel<Code extends Record<string, string> = Record<string, string>>(_options: LoadModelOptions<Code>): Promise<GeoSpecSubject>;\n\n// Options accepted by {@link import ('./load-model.js').loadModel}\nLoadModelOptions: LoadModelSourceOptions | LoadModelCodeOptions<Code> | LoadModelFileOptions\n // Project-relative folder `file` resolves in, for a suite that loads from somewhere other than…\n rootDir?: string\n // Geometry format to export\n format?: GeoSpecModelFormat\n // Explicit parameters passed to the runtime\n parameters?: Record<string, unknown>\n // STEP reader strategy used for STEP exports\n stepStreaming?: StepStreamingMode\n // Whether STEP loading should also produce mesh evidence\n mesh?: boolean\n // Linear tolerance used while meshing exact BRep evidence\n meshLinearTolerance?: number\n // Angular tolerance in degrees used while meshing exact BRep evidence\n meshAngularToleranceDegrees?: number\n // Default work-unit budget for every claim on this subject\n workUnitLimit?: number\n\n// Geometry formats accepted by {@link import ('./load-model.js').loadModel}\nGeoSpecModelFormat: MeshFileFormat | 'step' | 'stp'\n\n// GeoSpec test helper used inside VM-executed test modules\nexport declare function it(name: string, function_: GeoSpecTestCallback): void;\n skip(name: string, function_?: GeoSpecTestCallback): void;\n\n// GeoSpec suite helper used inside VM-executed test modules\nexport declare function describe(name: string, function_: GeoSpecTestCallback): void;\n skip(name: string, function_?: GeoSpecTestCallback): void;\n```\n\n### Types\n\n```ts\n// Assertion chain returned by `expectGeo(subject)`\nGeoSpecMatcher: {\n // Core-owned negation\n readonly not: Omit<GeoSpecMatcher, 'not'>\n // Assert the fixed rational plate contract\n toSatisfyRationalPlate(): GeoSpecAssertion;\n // Assert the fixed parallel-plane distance contract\n toSatisfyParallelPlaneDistance(): GeoSpecAssertion;\n // Assert axis-aligned bounds, size, or center for a loaded geometry subject\n toHaveBoundingBox(first: Vec3 | GeoSpecBoundingBoxExpectation, second?: Vec3): GeoSpecAssertion;\n // Assert how many spatially disjoint chunks the mesh contains\n toHaveConnectedComponents(expected: GeoSpecConnectedComponentsExpectation): GeoSpecAssertion;\n // Assert closed mesh edge incidence\n toBeWatertight(): GeoSpecAssertion;\n // Assert that separate assembly components do not occupy the same solid volume\n toHaveNoComponentInterference(expected?: GeoSpecComponentInterferenceExpectation): GeoSpecAssertion;\n // Assert that named assembly occurrences exist with expected counts and bounds\n toHaveAssemblyOccurrences(expected: GeoSpecAssemblyOccurrencesExpectation): GeoSpecAssertion;\n // Assert that selected entities satisfy declared spatial relationships\n toHaveSpatialRelationships(expected: GeoSpecSpatialRelationshipsExpectation): GeoSpecAssertion;\n // Assert rendered mesh evidence is internally trustworthy for downstream checks\n toHaveMeshIntegrity(expected: GeoSpecMeshIntegrityExpectation): GeoSpecAssertion;\n // Assert that the subject carries no diagnostics at the rejected severities\n toHaveNoDiagnostics(expected?: GeoSpecNoDiagnosticsExpectation): GeoSpecAssertion;\n // Assert total surface area, preferring exact BRep mass properties when available\n toHaveSurfaceArea(expected: GeoSpecSurfaceAreaExpectation): GeoSpecAssertion;\n // Assert enclosed volume, preferring exact BRep mass properties when available\n toHaveVolume(expected: GeoSpecVolumeExpectation): GeoSpecAssertion;\n // Assert mass derived from exact mass properties or volume times density\n toHaveMass(expected: GeoSpecMassExpectation): GeoSpecAssertion;\n // Assert the center of mass or mesh-derived centroid for a closed subject\n toHaveCenterOfMass(expected: GeoSpecCenterOfMassExpectation): GeoSpecAssertion;\n // Assert that exact BRep evidence reports a valid shape\n toBeValidBrep(expected?: GeoSpecValidBrepExpectation): GeoSpecAssertion;\n // Assert exact BRep topology counts\n toHaveTopologyCounts(expected: GeoSpecTopologyCountsExpectation): GeoSpecAssertion;\n // Assert the STEP unit evidence\n toHaveStepUnits(expected: GeoSpecStepUnitsExpectation): GeoSpecAssertion;\n // Assert STEP product-structure evidence\n toHaveProductStructure(expected: GeoSpecProductStructureExpectation): GeoSpecAssertion;\n // Assert that BRep evidence contains a planar face matching the requested constraints\n toHavePlanarFace(expected: GeoSpecPlanarFaceExpectation): GeoSpecAssertion;\n // Assert that BRep evidence contains a cylindrical face with the requested radius and axis\n toHaveCylindricalFace(expected: GeoSpecCylindricalFaceExpectation): GeoSpecAssertion;\n // Assert that BRep evidence contains a circular hole matching diameter, center, and axis\n toHaveCircularHole(expected: GeoSpecCircularHoleExpectation): GeoSpecAssertion;\n // Assert that BRep evidence contains a repeated circular-hole pattern\n toHaveCircularHolePattern(expected: GeoSpecCircularHolePatternExpectation): GeoSpecAssertion;\n // Assert that BRep evidence contains a chamfer feature with the requested distance\n toHaveChamferFeature(expected: GeoSpecChamferFeatureExpectation): GeoSpecAssertion;\n // Assert that BRep evidence contains a fillet feature with the requested radius\n toHaveFilletFeature(expected: GeoSpecFilletFeatureExpectation): GeoSpecAssertion;\n // Assert that BRep evidence reports a minimum wall thickness satisfying the expectation\n toHaveMinimumWallThickness(expected: GeoSpecMinimumWallThicknessExpectation): GeoSpecAssertion;\n // Assert that the declared waypoints share one connected void, stay isolated from the declared…\n toHaveVoidContinuity(expected: GeoSpecVoidContinuityExpectation): GeoSpecAssertion;\n}\n\n// Numeric 3D vector\nVec3: readonly [number, number, number]\n\n// Bounding-box expectation accepted by `expectGeo(...).toHaveBoundingBox(...)`\nGeoSpecBoundingBoxExpectation: {\n min?: Vec3 | Partial<Record<keyof GeoSpecAxisExpectation, GeoSpecNumericExpectation>>\n max?: Vec3 | Partial<Record<keyof GeoSpecAxisExpectation, GeoSpecNumericExpectation>>\n size?: Vec3 | Partial<Record<keyof GeoSpecAxisExpectation, GeoSpecNumericExpectation>>\n center?: Vec3 | Partial<Record<keyof GeoSpecAxisExpectation, GeoSpecNumericExpectation>>\n tolerance?: number\n}\n\n// Connected-components expectation accepted by `expectGeo(...).toHaveConnectedComponents(...)`\nGeoSpecConnectedComponentsExpectation: {\n count: number\n tolerance?: number\n toleranceMm?: number\n}\n\n// Component-interference expectation accepted by `expectGeo(...).toHaveNoComponentInterference(...)`\nGeoSpecComponentInterferenceExpectation: {\n tolerance?: number\n pairs?: GeoSpecComponentInterferencePairExpectation[]\n allowances?: GeoSpecComponentInterferenceAllowance[]\n}\n\n// Assembly occurrence expectation accepted by `expectGeo(...).toHaveAssemblyOccurrences(...)`\nGeoSpecAssemblyOccurrencesExpectation: {\n occurrences: GeoSpecAssemblyOccurrenceExpectation[]\n uniqueNames?: boolean\n}\n\n// Spatial relationship expectation accepted by `expectGeo(...).toHaveSpatialRelationships(...)`\nGeoSpecSpatialRelationshipsExpectation: {\n relationships: GeoSpecSpatialRelationshipExpectation[]\n}\n\n// Mesh integrity expectation accepted by `expectGeo(...).toHaveMeshIntegrity(...)`\nGeoSpecMeshIntegrityExpectation: {\n finitePositions?: boolean\n degenerateTriangles?: {\n count?: number;\n maxCount?: number;\n areaTolerance?: number;\n }\n duplicateFaces?: {\n count?: number;\n maxCount?: number;\n }\n watertight?: boolean\n triangleCount?: GeoSpecNumericExpectation\n}\n\n// Diagnostic severities rejected by `expectGeo(...).toHaveNoDiagnostics(...)`\nGeoSpecNoDiagnosticsExpectation: {\n severities?: Array<GeometryDiagnostic['severity']>\n}\n\n// Surface-area expectation accepted by `expectGeo(...).toHaveSurfaceArea(...)`\nGeoSpecSurfaceAreaExpectation: {\n value: number | GeoSpecNumericExpectation\n tolerance?: number\n}\n\n// Volume expectation accepted by `expectGeo(...).toHaveVolume(...)`\nGeoSpecVolumeExpectation: {\n value: number | GeoSpecNumericExpectation\n tolerance?: number\n}\n\n// Mass expectation accepted by `expectGeo(...).toHaveMass(...)`\nGeoSpecMassExpectation: {\n value: number | GeoSpecNumericExpectation\n density?: number\n tolerance?: number\n}\n\n// Center-of-mass expectation accepted by `expectGeo(...).toHaveCenterOfMass(...)`\nGeoSpecCenterOfMassExpectation: {\n // Exact expected point in millimetres\n point: GeoSpecPointExpectation\n tolerance?: number\n}\n\n// Exact BRep validity expectation accepted by `expectGeo(...).toBeValidBrep(...)`\nGeoSpecValidBrepExpectation: {\n maxTolerance?: number\n freeBounds?: {\n count?: GeoSpecNumericExpectation;\n }\n minEdgeLength?: number\n sameParameter?: boolean\n closedShells?: boolean\n closedWires?: boolean\n}\n\n// Topology-count expectation accepted by `expectGeo(...).toHaveTopologyCounts(...)`\nGeoSpecTopologyCountsExpectation: {\n vertices?: GeoSpecNumericExpectation\n edges?: GeoSpecNumericExpectation\n wires?: GeoSpecNumericExpectation\n faces?: GeoSpecNumericExpectation\n shells?: GeoSpecNumericExpectation\n solids?: GeoSpecNumericExpectation\n compounds?: GeoSpecNumericExpectation\n tolerance?: number\n}\n\n// STEP unit expectation accepted by `expectGeo(...).toHaveStepUnits(...)`\nGeoSpecStepUnitsExpectation: {\n unit: string\n}\n\n// Product-structure expectation accepted by `expectGeo(...).toHaveProductStructure(...)`\nGeoSpecProductStructureExpectation: {\n names?: string[]\n count?: GeoSpecNumericExpectation\n}\n\n// Planar-face expectation accepted by `expectGeo(...).toHavePlanarFace(...)`\nGeoSpecPlanarFaceExpectation: {\n normal: GeoSpecPointExpectation\n offset: number\n area?: GeoSpecNumericExpectation\n tolerance?: number\n}\n\n// Cylindrical-face expectation accepted by `expectGeo(...).toHaveCylindricalFace(...)`\nGeoSpecCylindricalFaceExpectation: {\n radius: number\n axis: 'x' | 'y' | 'z'\n tolerance?: number\n}\n\n// Circular-hole expectation accepted by `expectGeo(...).toHaveCircularHole(...)`\nGeoSpecCircularHoleExpectation: {\n diameter: number\n through?: boolean\n axis?: 'x' | 'y' | 'z'\n center?: GeoSpecPointExpectation\n tolerance?: number\n}\n\n// Circular-hole-pattern expectation accepted by `expectGeo(...).toHaveCircularHolePattern(...)`\nGeoSpecCircularHolePatternExpectation: {\n count: number\n holeDiameter: number\n boltCircleDiameter?: number\n axis?: 'x' | 'y' | 'z'\n center?: GeoSpecPointExpectation\n tolerance?: number\n}\n\n// Chamfer-feature expectation accepted by `expectGeo(...).toHaveChamferFeature(...)`\nGeoSpecChamferFeatureExpectation: {\n distance: number\n selection?: string\n tolerance?: number\n}\n\n// Fillet-feature expectation accepted by `expectGeo(...).toHaveFilletFeature(...)`\nGeoSpecFilletFeatureExpectation: {\n radius: number\n selection?: string\n tolerance?: number\n}\n\n// Minimum-wall-thickness expectation accepted by `expectGeo(...).toHaveMinimumWallThickness(...)`\nGeoSpecMinimumWallThicknessExpectation: {\n value: GeoSpecNumericExpectation\n tolerance?: number\n}\n\n// Void-continuity expectation accepted by `expectGeo(...).toHaveVoidContinuity(...)`\nGeoSpecVoidContinuityExpectation: {\n // Ordered waypoints (>= 1) known to lie in the void being proven\n path: GeoSpecVoidWaypoint[]\n // Occurrence names whose solids bound the void\n material?: string[]\n // Minimum required bottleneck cross-section (mm²), sampled\n minCrossSection?: number\n // Points that must NOT be reachable from the path void (isolation claim)\n isolatedFrom?: Vec3[]\n // Region bounded for the proof (subject frame)\n bounds?: {\n min: Vec3;\n max: Vec3;\n }\n}\n\n// Axis-keyed numeric expectation used by high-level geometry matchers\nGeoSpecAxisExpectation: {\n x?: number\n y?: number\n z?: number\n}\n\n// Shared scalar expectation used by geometry measurements\nGeoSpecNumericExpectation: number | {\n value?: number;\n greaterThan?: number;\n greaterThanOrEqual?: number;\n lessThan?: number;\n lessThanOrEqual?: number;\n}\n\n// A pair-specific component-interference check accepted by `expectGeo(...).toHaveNoComponentInterference(...)`\nGeoSpecComponentInterferencePairExpectation: {\n left: GeoSpecComponentSelector\n right: GeoSpecComponentSelector\n}\n\n// Intentional component interference allowance accepted by `expectGeo(...).toHaveNoComponentInterference(...)`\nGeoSpecComponentInterferenceAllowance: {\n kind?: 'intentionalInterference'\n left: GeoSpecComponentSelector\n right: GeoSpecComponentSelector\n maxVolume?: number\n reason: string\n}\n\n// Assembly occurrence rule accepted by `expectGeo(...).toHaveAssemblyOccurrences(...)`\nGeoSpecAssemblyOccurrenceExpectation: {\n name: GeoSpecComponentSelector\n count?: GeoSpecNumericExpectation\n bounds?: {\n within?: GeoSpecComponentSelector;\n min?: Vec3 | GeoSpecAxisExpectation;\n max?: Vec3 | GeoSpecAxisExpectation;\n center?: GeoSpecPointExpectation;\n tolerance?: number;\n }\n}\n\n// One spatial relationship accepted by `expectGeo(...).toHaveSpatialRelationships(...)`\nGeoSpecSpatialRelationshipExpectation: {\n id?: string\n kind: 'contact' | 'clearance' | 'coaxial' | 'concentric' | 'coplanar' | 'parallel' | 'perpendicular' | 'angle' | 'containment' | 'insertion' | 'interference'\n subject: GeoSpecGeometrySelector\n target: GeoSpecGeometrySelector\n tolerance?: number\n angularToleranceDegrees?: number\n // Expected angle in degrees for `kind\n angleDegrees?: number\n // Declared insertion axis (subject-frame direction) for `kind\n axis?: Vec3\n min?: number\n max?: number\n minVolume?: number\n maxVolume?: number\n reason?: string\n}\n\n// Diagnostic emitted by GeoSpec loaders, analyzers, and matchers\nGeometryDiagnostic: {\n code: KernelIssueCode | (string & {})\n severity: 'error' | 'warning' | 'info'\n message: string\n suggestion?: string\n spatial?: {\n min?: Vec3;\n max?: Vec3;\n center?: Vec3;\n }\n details?: unknown\n}\n\n// Point expectation accepted by center and feature matchers\nGeoSpecPointExpectation: Vec3 | GeoSpecAxisExpectation\n\n// One void-continuity waypoint\nGeoSpecVoidWaypoint: Vec3 | {\n occurrence: string;\n}\n\n// Inline code-CAD model load options\nLoadModelCodeOptions: {\n // Source files keyed by project-relative path\n code: Code\n // Geometry format to export\n format?: GeoSpecModelFormat\n // Explicit parameters passed to the runtime\n parameters?: Record<string, unknown>\n // Whether STEP loading should also produce mesh evidence\n mesh?: boolean\n // … 10 more members in the API reference: file, rootDir, runtime, sourceAdapters, projectPath, stepStreaming, meshLinearTolerance, meshAngularToleranceDegrees, workUnitLimit, region\n}\n\nRuntimeBackedModelFormat: Exclude<GeoSpecModelFormat, 'mesh-buffer'>\n```\n\n## API reference\n\nTo read any other signature, find its name in `api-index.md`, which lists all 364 symbols by file with the lines that hold each, and read that range of the named file.\n\n- `api-functions.md` — Functions\n- `api-constants.md` — Constants\n- `api-types.md` — Types\n- `api-classes.md` — Classes\n\nRead ranges, not whole files. Never copy a reference into a source file.\n",
10
+ fingerprint: "51b3bf4942f7eb6aa3c9907f5c900796bc7d65b8f141d1f1055579ebb4980f9a",
11
11
  files: Object.freeze([
12
- Object.freeze({ path: "SKILL.md", url: new URL("./geospec-authoring/SKILL.md", import.meta.url).href, byteLength: 21212, lineCount: 496, contentKind: 'text', mediaType: 'text/markdown', sha256: "d4197494f74a117493090401e3e4c082781f480d7d82637eaf5de1e816b52eb1" }),
13
- Object.freeze({ path: "api-index.md", url: new URL("./geospec-authoring/api-index.md", import.meta.url).href, byteLength: 28120, lineCount: 378, contentKind: 'text', mediaType: 'text/markdown', sha256: "b18891ec7303ab8dfe142692a766bb736e6401c394ed901313d88eb2e1359510" }),
12
+ Object.freeze({ path: "SKILL.md", url: new URL("./geospec-authoring/SKILL.md", import.meta.url).href, byteLength: 23589, lineCount: 496, contentKind: 'text', mediaType: 'text/markdown', sha256: "93fe59244e945e0f2ae78a01a63ab5e7711d4eca67d63c84403ef5064c8b14b9" }),
13
+ Object.freeze({ path: "api-index.md", url: new URL("./geospec-authoring/api-index.md", import.meta.url).href, byteLength: 29905, lineCount: 382, contentKind: 'text', mediaType: 'text/markdown', sha256: "97000dbdcc54be50157559d77e3323347bcd3cb1e69847a479b5e261aaff1d84" }),
14
14
  Object.freeze({ path: "api-functions.md", url: new URL("./geospec-authoring/api-functions.md", import.meta.url).href, byteLength: 2549, lineCount: 58, contentKind: 'text', mediaType: 'text/markdown', sha256: "733e9de321d6d1cc3db03a20af5ac211747dfc421f6091f461ed6629e8501d71" }),
15
15
  Object.freeze({ path: "api-constants.md", url: new URL("./geospec-authoring/api-constants.md", import.meta.url).href, byteLength: 1057, lineCount: 17, contentKind: 'text', mediaType: 'text/markdown', sha256: "42c29ab127efb592c0cd7c4d2024d6e2aea8315bec78e476f972166c1b8c1c6b" }),
16
- Object.freeze({ path: "api-types.md", url: new URL("./geospec-authoring/api-types.md", import.meta.url).href, byteLength: 59891, lineCount: 1789, contentKind: 'text', mediaType: 'text/markdown', sha256: "a7d3131badff9986d7e2e11f1f590e0f0e894d20e14076212f6544ef3371b230" }),
16
+ Object.freeze({ path: "api-types.md", url: new URL("./geospec-authoring/api-types.md", import.meta.url).href, byteLength: 61112, lineCount: 1817, contentKind: 'text', mediaType: 'text/markdown', sha256: "2841da4ddb764dca62a3137ceb59328867a3bf1496ad395219407cc7fa35def1" }),
17
17
  Object.freeze({ path: "api-classes.md", url: new URL("./geospec-authoring/api-classes.md", import.meta.url).href, byteLength: 550, lineCount: 14, contentKind: 'text', mediaType: 'text/markdown', sha256: "d34a48498cfd33aca05e2c5c1059ca3e2d1bec86046fbc75928d16b375fcae30" }),
18
- Object.freeze({ path: "public-api-index.md", url: new URL("./geospec-authoring/public-api-index.md", import.meta.url).href, byteLength: 63924, lineCount: 894, contentKind: 'text', mediaType: 'text/markdown', sha256: "9d6551ea44db83f72c8ea55a92fde8e76b0a6a37a7f47adc10c6f8ea9a0ff10e" }),
18
+ Object.freeze({ path: "public-api-index.md", url: new URL("./geospec-authoring/public-api-index.md", import.meta.url).href, byteLength: 68008, lineCount: 899, contentKind: 'text', mediaType: 'text/markdown', sha256: "61043425364c8895fb6781a43938ca72898f314d91bdd394eeb1890a108cdf3d" }),
19
19
  Object.freeze({ path: "public-api-functions.md", url: new URL("./geospec-authoring/public-api-functions.md", import.meta.url).href, byteLength: 11567, lineCount: 216, contentKind: 'text', mediaType: 'text/markdown', sha256: "a1a4e17ba9b9f2f2b997702f6b203da880efe65e7bf8d69c6bfab0b6e41d525d" }),
20
20
  Object.freeze({ path: "public-api-constants.md", url: new URL("./geospec-authoring/public-api-constants.md", import.meta.url).href, byteLength: 2521, lineCount: 52, contentKind: 'text', mediaType: 'text/markdown', sha256: "8d7ecd06cd47616d81d6b5ad0315eee3cb1ed980d6527d6e2edf40c44231d871" }),
21
21
  Object.freeze({ path: "public-api-types.md", url: new URL("./geospec-authoring/public-api-types.md", import.meta.url).href, byteLength: 59455, lineCount: 1949, contentKind: 'text', mediaType: 'text/markdown', sha256: "783ae4f4526780306cd63a87d52e7e108997d38b1892e73bd5587937c0da552b" }),
22
- Object.freeze({ path: "public-api-types-2.md", url: new URL("./geospec-authoring/public-api-types-2.md", import.meta.url).href, byteLength: 55415, lineCount: 1561, contentKind: 'text', mediaType: 'text/markdown', sha256: "ab10b858d556e0fcffe52cebf8476c8053401d2a28f4066a649a19357da0a62f" }),
23
- Object.freeze({ path: "public-api-types-3.md", url: new URL("./geospec-authoring/public-api-types-3.md", import.meta.url).href, byteLength: 7267, lineCount: 218, contentKind: 'text', mediaType: 'text/markdown', sha256: "cec1cdc42e06dbab4f7263198ec303ab5bc24e09d2ec8d95870caba070ee7507" }),
22
+ Object.freeze({ path: "public-api-types-2.md", url: new URL("./geospec-authoring/public-api-types-2.md", import.meta.url).href, byteLength: 54529, lineCount: 1528, contentKind: 'text', mediaType: 'text/markdown', sha256: "5619a3cc1743d704c77bff0eb9ac51d5deac2dc6562d5fca5900a32ce5db1178" }),
23
+ Object.freeze({ path: "public-api-types-3.md", url: new URL("./geospec-authoring/public-api-types-3.md", import.meta.url).href, byteLength: 9547, lineCount: 282, contentKind: 'text', mediaType: 'text/markdown', sha256: "b40b66a4ca44aa55f0fa9a4ebd1f286cf6db05583fb7c97c67629771f53b67f5" }),
24
24
  Object.freeze({ path: "public-api-classes.md", url: new URL("./geospec-authoring/public-api-classes.md", import.meta.url).href, byteLength: 1024, lineCount: 23, contentKind: 'text', mediaType: 'text/markdown', sha256: "569639b75b3a3fae86e3bcbe3dc61a746ddd67cb4dec7ccb6374556d419d02a9" })
25
25
  ]),
26
26
  }),
package/agent/skills.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "slug": "geospec-authoring",
5
5
  "name": "GeoSpec authoring",
6
6
  "description": "Guides canonical GeoSpec geometry tests in TypeScript or JavaScript for every Tau kernel. Use for *.geospec.ts and *.geospec.js tests.",
7
- "version": "0.1.0-beta.6",
7
+ "version": "0.1.0-beta.7",
8
8
  "whenToUse": "Use before creating or editing *.geospec.ts or *.geospec.js tests, for a model in any kernel.",
9
9
  "directory": "geospec-authoring",
10
10
  "files": [
@@ -22,7 +22,7 @@
22
22
  "public-api-types-3.md",
23
23
  "public-api-classes.md"
24
24
  ],
25
- "body": "---\nname: geospec-authoring\ndescription: Guides canonical GeoSpec geometry tests in TypeScript or JavaScript for every Tau kernel. Use for *.geospec.ts and *.geospec.js tests.\n---\n\n# GeoSpec authoring\n\nWrite tests before implementation; assert deterministic, measurable properties.\n\n## Test shape\n\n- Use `*.geospec.ts` or `*.geospec.js`. Import `describe`, `it` and `expectGeo` from `geospec`, and `loadModel` from `geospec/model`.\n- Await `loadModel`, then assert synchronously with `expectGeo(model)`. The host supplies the compiled binding; authoring does not select an engine.\n- Await or return the complete model-load chain from the test callback; detached future loads are not part of a completed test.\n- Omit `parameters` for model-code defaults; use `{ file, parameters }` for variants. Loaded subjects are opaque.\n\nCanonical TypeScript authoring:\n\n```ts\nimport { describe, expectGeo, it } from 'geospec';\nimport { loadModel } from 'geospec/model';\n\ndescribe('main geometry', () => {\n it('has the intended envelope', async () => {\n const model = await loadModel({ file: 'main.ts', parameters: { width: 120 } });\n expectGeo(model).toHaveBoundingBox({ size: { x: 120 }, tolerance: 1 });\n });\n});\n```\n\nSpecs are always TypeScript or JavaScript, whatever the model's kernel: `loadModel({ file })` evaluates `main.ts`, `main.tsx`, `main.py`, `main.scad`, `main.kcl` or `main.cs` through Tau's runtime. `test_model` discovers `*.geospec.ts` and `*.geospec.js` only.\n\nEvery matcher takes one expectation object:\n\n- Wrong: `expectGeo(model).toHaveVolume(5000, { tolerance: 5 })`. Correct: `expectGeo(model).toHaveVolume({ value: 5000, tolerance: 5 })`.\n- Wrong: `await expectGeo(model)…`. Correct: await `loadModel`, then assert synchronously.\n- Wrong: exact-feature matchers on a mesh kernel (Manifold, JSCAD, OpenSCAD, PicoGK, PicoVoxel). Correct: `toBeValidBrep`, `toHaveTopologyCounts`, the face, hole, pattern, chamfer, fillet and wall-thickness matchers, `toHaveStepUnits`, `toHaveProductStructure` and `toHaveVoidContinuity` need STEP BRep evidence and report unsupported on meshes; assert meshes with bounds, volume, surface area, connected components and `toBeWatertight`.\n\n## Loads and budgets\n\n- GeoSpec has no `beforeAll`. Write each `loadModel` inside its own `it`: within one run, identical loads (same file or code, parameters, format, tolerances and region) share one export and one admission. Each load keeps its own `loadId` and records `reused: true`, and a file is reused only while its source closure is unchanged.\n- `loadModel({ file, workUnitLimit })` sets the default claim budget for that subject, and `expectGeo(model, { workUnitLimit })` overrides it for one chain. The budget is a positive integer no greater than 512000000. A `MATCHER_TIMEOUT` refusal reports `details.limit` and, when measured, `details.used`; raise the budget within the bound or simplify the model, and never treat the refusal as a pass.\n- `loadModel({ file, region: { min: [x, y, z], max: [x, y, z] } })` makes a separate claim about one millimetre box, never a stand-in for a whole-model claim. The kernel crops before export (PicoVoxel trims Voxels parts), and other kernels, STEP loads and unconfirmed crops refuse with a typed diagnostic. A cropped subject answers only bounding box, volume, surface area, mass and center of mass of its region, and its assertions record the region. Every other matcher on it refuses with `GEOSPEC_REGION_WHOLE_MODEL_CLAIM`. Name the region in the test, and keep whole-model claims on whole-model loads.\n- A host or engine limit leaves a claim undecided, never false. Keep the model as designed: never coarsen, shrink or crop it to fit. Raise `workUnitLimit` or `testTimeout` within the host's maximum, which the host can raise, or report the claim as not decided at this capacity.\n- `toHaveCenterOfMass({ point, tolerance })` takes an exact point. Per-axis ranges such as `{ y: { greaterThan: 1 } }` are refused.\n\n## Coverage\n\nBounds and physical properties are insufficient. Cover major components, named features, variants, dimensions/positions, disjoint counts, closure, interference and supported exact features. Explicitly report unsupported requirements; proxies cannot fulfill them.\n\n- `toHaveBoundingBox`: size/position.\n- `toHaveConnectedComponents`: qualified material connectivity; visual touching cannot justify tolerance changes.\n- `toBeWatertight`: closed edge incidence, not manifold validity, fusion or material connectivity. Bounds prove none of these. Missing evidence is unsupported.\n- `toHaveSurfaceArea`, `toHaveVolume`, `toHaveCenterOfMass`, `toHaveMass`: physical measurements.\n- `toHaveNoComponentInterference`: overlap; allow deliberate press fits.\n- `loadModel({ file, format: 'step' })`: use BRep evidence for supported topology and feature assertions. Missing occurrence, interference, clearance, containment, lumen, wall, section or motion evidence is unsupported, not a pass or an envelope substitute.\n\nTest assemblies and independent units; preserve sibling coverage when adding files. Non-top-level geometry needs kernel export/invocation, not test removal.\n\nFix geometry at its root; never weaken tolerances, delete assertions, or reduce detail to pass.\n\n`public-api-index.md` covers the host and framework API; authoring needs only the Core API below and `api-*` files.\n\n## Core API\n\nThe symbols real Tau models use most, as verbatim declarations. Anything not shown is in the API reference below.\n\n### Functions\n\n```ts\n// Start a geometry assertion chain\nexport declare function expectGeo(subject: GeoSpecSubject, options?: GeoSpecExpectOptions): GeoSpecMatcher;\n\n// A model admitted by one live GeoSpec host scope\nGeoSpecSubject: {\n readonly [subjectBrand]: true\n}\n\n// Per-chain options accepted by `expectGeo(subject, options)`\nGeoSpecExpectOptions: {\n // Deterministic work-unit budget for every claim in this chain\n readonly workUnitLimit?: number\n}\n\n// Load a CAD model into GeoSpec evidence\nexport declare function loadModel<Code extends Record<string, string> = Record<string, string>>(_options: LoadModelOptions<Code>): Promise<GeoSpecSubject>;\n\n// Options accepted by {@link import ('./load-model.js').loadModel}\nLoadModelOptions: LoadModelSourceOptions | LoadModelCodeOptions<Code> | LoadModelFileOptions\n // Geometry format to export\n format?: GeoSpecModelFormat\n // Explicit parameters passed to the runtime\n parameters?: Record<string, unknown>\n // STEP reader strategy used for STEP exports\n stepStreaming?: StepStreamingMode\n // Whether STEP loading should also produce mesh evidence\n mesh?: boolean\n // Linear tolerance used while meshing exact BRep evidence\n meshLinearTolerance?: number\n // Angular tolerance in degrees used while meshing exact BRep evidence\n meshAngularToleranceDegrees?: number\n // Default work-unit budget for every claim on this subject\n workUnitLimit?: number\n\n// Geometry formats accepted by {@link import ('./load-model.js').loadModel}\nGeoSpecModelFormat: MeshFileFormat | 'step' | 'stp'\n```\n\n### Types\n\n```ts\n// Assertion chain returned by `expectGeo(subject)`\nGeoSpecMatcher: {\n // Core-owned negation\n readonly not: Omit<GeoSpecMatcher, 'not'>\n // Assert the fixed rational plate contract\n toSatisfyRationalPlate(): GeoSpecAssertion;\n // Assert the fixed parallel-plane distance contract\n toSatisfyParallelPlaneDistance(): GeoSpecAssertion;\n // Assert axis-aligned bounds, size, or center for a loaded geometry subject\n toHaveBoundingBox(first: Vec3 | GeoSpecBoundingBoxExpectation, second?: Vec3): GeoSpecAssertion;\n // Assert how many spatially disjoint chunks the mesh contains\n toHaveConnectedComponents(expected: GeoSpecConnectedComponentsExpectation): GeoSpecAssertion;\n // Assert closed mesh edge incidence\n toBeWatertight(): GeoSpecAssertion;\n // Assert that separate assembly components do not occupy the same solid volume\n toHaveNoComponentInterference(expected?: GeoSpecComponentInterferenceExpectation): GeoSpecAssertion;\n // Assert that named assembly occurrences exist with expected counts and bounds\n toHaveAssemblyOccurrences(expected: GeoSpecAssemblyOccurrencesExpectation): GeoSpecAssertion;\n // Assert that selected entities satisfy declared spatial relationships\n toHaveSpatialRelationships(expected: GeoSpecSpatialRelationshipsExpectation): GeoSpecAssertion;\n // Assert rendered mesh evidence is internally trustworthy for downstream checks\n toHaveMeshIntegrity(expected: GeoSpecMeshIntegrityExpectation): GeoSpecAssertion;\n // Assert that the subject carries no diagnostics at the rejected severities\n toHaveNoDiagnostics(expected?: GeoSpecNoDiagnosticsExpectation): GeoSpecAssertion;\n // Assert total surface area, preferring exact BRep mass properties when available\n toHaveSurfaceArea(expected: GeoSpecSurfaceAreaExpectation): GeoSpecAssertion;\n // Assert enclosed volume, preferring exact BRep mass properties when available\n toHaveVolume(expected: GeoSpecVolumeExpectation): GeoSpecAssertion;\n // Assert mass derived from exact mass properties or volume times density\n toHaveMass(expected: GeoSpecMassExpectation): GeoSpecAssertion;\n // Assert the center of mass or mesh-derived centroid for a closed subject\n toHaveCenterOfMass(expected: GeoSpecCenterOfMassExpectation): GeoSpecAssertion;\n // Assert that exact BRep evidence reports a valid shape\n toBeValidBrep(expected?: GeoSpecValidBrepExpectation): GeoSpecAssertion;\n // Assert exact BRep topology counts\n toHaveTopologyCounts(expected: GeoSpecTopologyCountsExpectation): GeoSpecAssertion;\n // Assert the STEP unit evidence\n toHaveStepUnits(expected: GeoSpecStepUnitsExpectation): GeoSpecAssertion;\n // Assert STEP product-structure evidence\n toHaveProductStructure(expected: GeoSpecProductStructureExpectation): GeoSpecAssertion;\n // Assert that BRep evidence contains a planar face matching the requested constraints\n toHavePlanarFace(expected: GeoSpecPlanarFaceExpectation): GeoSpecAssertion;\n // Assert that BRep evidence contains a cylindrical face with the requested radius and axis\n toHaveCylindricalFace(expected: GeoSpecCylindricalFaceExpectation): GeoSpecAssertion;\n // Assert that BRep evidence contains a circular hole matching diameter, center, and axis\n toHaveCircularHole(expected: GeoSpecCircularHoleExpectation): GeoSpecAssertion;\n // Assert that BRep evidence contains a repeated circular-hole pattern\n toHaveCircularHolePattern(expected: GeoSpecCircularHolePatternExpectation): GeoSpecAssertion;\n // Assert that BRep evidence contains a chamfer feature with the requested distance\n toHaveChamferFeature(expected: GeoSpecChamferFeatureExpectation): GeoSpecAssertion;\n // Assert that BRep evidence contains a fillet feature with the requested radius\n toHaveFilletFeature(expected: GeoSpecFilletFeatureExpectation): GeoSpecAssertion;\n // Assert that BRep evidence reports a minimum wall thickness satisfying the expectation\n toHaveMinimumWallThickness(expected: GeoSpecMinimumWallThicknessExpectation): GeoSpecAssertion;\n // Assert that the declared waypoints share one connected void, stay isolated from the declared…\n toHaveVoidContinuity(expected: GeoSpecVoidContinuityExpectation): GeoSpecAssertion;\n}\n\n// Numeric 3D vector\nVec3: readonly [number, number, number]\n\n// Bounding-box expectation accepted by `expectGeo(...).toHaveBoundingBox(...)`\nGeoSpecBoundingBoxExpectation: {\n min?: Vec3 | Partial<Record<keyof GeoSpecAxisExpectation, GeoSpecNumericExpectation>>\n max?: Vec3 | Partial<Record<keyof GeoSpecAxisExpectation, GeoSpecNumericExpectation>>\n size?: Vec3 | Partial<Record<keyof GeoSpecAxisExpectation, GeoSpecNumericExpectation>>\n center?: Vec3 | Partial<Record<keyof GeoSpecAxisExpectation, GeoSpecNumericExpectation>>\n tolerance?: number\n}\n\n// Connected-components expectation accepted by `expectGeo(...).toHaveConnectedComponents(...)`\nGeoSpecConnectedComponentsExpectation: {\n count: number\n tolerance?: number\n toleranceMm?: number\n}\n\n// Component-interference expectation accepted by `expectGeo(...).toHaveNoComponentInterference(...)`\nGeoSpecComponentInterferenceExpectation: {\n tolerance?: number\n pairs?: GeoSpecComponentInterferencePairExpectation[]\n allowances?: GeoSpecComponentInterferenceAllowance[]\n}\n\n// Assembly occurrence expectation accepted by `expectGeo(...).toHaveAssemblyOccurrences(...)`\nGeoSpecAssemblyOccurrencesExpectation: {\n occurrences: GeoSpecAssemblyOccurrenceExpectation[]\n uniqueNames?: boolean\n}\n\n// Spatial relationship expectation accepted by `expectGeo(...).toHaveSpatialRelationships(...)`\nGeoSpecSpatialRelationshipsExpectation: {\n relationships: GeoSpecSpatialRelationshipExpectation[]\n}\n\n// Mesh integrity expectation accepted by `expectGeo(...).toHaveMeshIntegrity(...)`\nGeoSpecMeshIntegrityExpectation: {\n finitePositions?: boolean\n degenerateTriangles?: {\n count?: number;\n maxCount?: number;\n areaTolerance?: number;\n }\n duplicateFaces?: {\n count?: number;\n maxCount?: number;\n }\n watertight?: boolean\n triangleCount?: GeoSpecNumericExpectation\n}\n\n// Diagnostic severities rejected by `expectGeo(...).toHaveNoDiagnostics(...)`\nGeoSpecNoDiagnosticsExpectation: {\n severities?: Array<GeometryDiagnostic['severity']>\n}\n\n// Surface-area expectation accepted by `expectGeo(...).toHaveSurfaceArea(...)`\nGeoSpecSurfaceAreaExpectation: {\n value: number | GeoSpecNumericExpectation\n tolerance?: number\n}\n\n// Volume expectation accepted by `expectGeo(...).toHaveVolume(...)`\nGeoSpecVolumeExpectation: {\n value: number | GeoSpecNumericExpectation\n tolerance?: number\n}\n\n// Mass expectation accepted by `expectGeo(...).toHaveMass(...)`\nGeoSpecMassExpectation: {\n value: number | GeoSpecNumericExpectation\n density?: number\n tolerance?: number\n}\n\n// Center-of-mass expectation accepted by `expectGeo(...).toHaveCenterOfMass(...)`\nGeoSpecCenterOfMassExpectation: {\n // Exact expected point in millimetres\n point: GeoSpecPointExpectation\n tolerance?: number\n}\n\n// Exact BRep validity expectation accepted by `expectGeo(...).toBeValidBrep(...)`\nGeoSpecValidBrepExpectation: {\n maxTolerance?: number\n freeBounds?: {\n count?: GeoSpecNumericExpectation;\n }\n minEdgeLength?: number\n sameParameter?: boolean\n closedShells?: boolean\n closedWires?: boolean\n}\n\n// Topology-count expectation accepted by `expectGeo(...).toHaveTopologyCounts(...)`\nGeoSpecTopologyCountsExpectation: {\n vertices?: GeoSpecNumericExpectation\n edges?: GeoSpecNumericExpectation\n wires?: GeoSpecNumericExpectation\n faces?: GeoSpecNumericExpectation\n shells?: GeoSpecNumericExpectation\n solids?: GeoSpecNumericExpectation\n compounds?: GeoSpecNumericExpectation\n tolerance?: number\n}\n\n// STEP unit expectation accepted by `expectGeo(...).toHaveStepUnits(...)`\nGeoSpecStepUnitsExpectation: {\n unit: string\n}\n\n// Product-structure expectation accepted by `expectGeo(...).toHaveProductStructure(...)`\nGeoSpecProductStructureExpectation: {\n names?: string[]\n count?: GeoSpecNumericExpectation\n}\n\n// Planar-face expectation accepted by `expectGeo(...).toHavePlanarFace(...)`\nGeoSpecPlanarFaceExpectation: {\n normal: GeoSpecPointExpectation\n offset: number\n area?: GeoSpecNumericExpectation\n tolerance?: number\n}\n\n// Cylindrical-face expectation accepted by `expectGeo(...).toHaveCylindricalFace(...)`\nGeoSpecCylindricalFaceExpectation: {\n radius: number\n axis: 'x' | 'y' | 'z'\n tolerance?: number\n}\n\n// Circular-hole expectation accepted by `expectGeo(...).toHaveCircularHole(...)`\nGeoSpecCircularHoleExpectation: {\n diameter: number\n through?: boolean\n axis?: 'x' | 'y' | 'z'\n center?: GeoSpecPointExpectation\n tolerance?: number\n}\n\n// Circular-hole-pattern expectation accepted by `expectGeo(...).toHaveCircularHolePattern(...)`\nGeoSpecCircularHolePatternExpectation: {\n count: number\n holeDiameter: number\n boltCircleDiameter?: number\n axis?: 'x' | 'y' | 'z'\n center?: GeoSpecPointExpectation\n tolerance?: number\n}\n\n// Chamfer-feature expectation accepted by `expectGeo(...).toHaveChamferFeature(...)`\nGeoSpecChamferFeatureExpectation: {\n distance: number\n selection?: string\n tolerance?: number\n}\n\n// Fillet-feature expectation accepted by `expectGeo(...).toHaveFilletFeature(...)`\nGeoSpecFilletFeatureExpectation: {\n radius: number\n selection?: string\n tolerance?: number\n}\n\n// Minimum-wall-thickness expectation accepted by `expectGeo(...).toHaveMinimumWallThickness(...)`\nGeoSpecMinimumWallThicknessExpectation: {\n value: GeoSpecNumericExpectation\n tolerance?: number\n}\n\n// Void-continuity expectation accepted by `expectGeo(...).toHaveVoidContinuity(...)`\nGeoSpecVoidContinuityExpectation: {\n // Ordered waypoints (>= 1) known to lie in the void being proven\n path: GeoSpecVoidWaypoint[]\n // Occurrence names whose solids bound the void\n material?: string[]\n // Minimum required bottleneck cross-section (mm²), sampled\n minCrossSection?: number\n // Points that must NOT be reachable from the path void (isolation claim)\n isolatedFrom?: Vec3[]\n // Region bounded for the proof (subject frame)\n bounds?: {\n min: Vec3;\n max: Vec3;\n }\n}\n\n// Axis-keyed numeric expectation used by high-level geometry matchers\nGeoSpecAxisExpectation: {\n x?: number\n y?: number\n z?: number\n}\n\n// Shared scalar expectation used by geometry measurements\nGeoSpecNumericExpectation: number | {\n value?: number;\n greaterThan?: number;\n greaterThanOrEqual?: number;\n lessThan?: number;\n lessThanOrEqual?: number;\n}\n\n// A pair-specific component-interference check accepted by `expectGeo(...).toHaveNoComponentInterference(...)`\nGeoSpecComponentInterferencePairExpectation: {\n left: GeoSpecComponentSelector\n right: GeoSpecComponentSelector\n}\n\n// Intentional component interference allowance accepted by `expectGeo(...).toHaveNoComponentInterference(...)`\nGeoSpecComponentInterferenceAllowance: {\n kind?: 'intentionalInterference'\n left: GeoSpecComponentSelector\n right: GeoSpecComponentSelector\n maxVolume?: number\n reason: string\n}\n\n// Assembly occurrence rule accepted by `expectGeo(...).toHaveAssemblyOccurrences(...)`\nGeoSpecAssemblyOccurrenceExpectation: {\n name: GeoSpecComponentSelector\n count?: GeoSpecNumericExpectation\n bounds?: {\n within?: GeoSpecComponentSelector;\n min?: Vec3 | GeoSpecAxisExpectation;\n max?: Vec3 | GeoSpecAxisExpectation;\n center?: GeoSpecPointExpectation;\n tolerance?: number;\n }\n}\n\n// One spatial relationship accepted by `expectGeo(...).toHaveSpatialRelationships(...)`\nGeoSpecSpatialRelationshipExpectation: {\n id?: string\n kind: 'contact' | 'clearance' | 'coaxial' | 'concentric' | 'coplanar' | 'parallel' | 'perpendicular' | 'angle' | 'containment' | 'insertion' | 'interference'\n subject: GeoSpecGeometrySelector\n target: GeoSpecGeometrySelector\n tolerance?: number\n angularToleranceDegrees?: number\n // Expected angle in degrees for `kind\n angleDegrees?: number\n // Declared insertion axis (subject-frame direction) for `kind\n axis?: Vec3\n min?: number\n max?: number\n minVolume?: number\n maxVolume?: number\n reason?: string\n}\n\n// Shared scalar expectation used by geometry measurements\nGeoSpecNumericExpectation: number | {\n value?: number;\n greaterThan?: number;\n greaterThanOrEqual?: number;\n lessThan?: number;\n lessThanOrEqual?: number;\n}\n\n// Diagnostic emitted by GeoSpec loaders, analyzers, and matchers\nGeometryDiagnostic: {\n code: KernelIssueCode | (string & {})\n severity: 'error' | 'warning' | 'info'\n message: string\n suggestion?: string\n spatial?: {\n min?: Vec3;\n max?: Vec3;\n center?: Vec3;\n }\n details?: unknown\n}\n\n// Shared scalar expectation used by geometry measurements\nGeoSpecNumericExpectation: number | {\n value?: number;\n greaterThan?: number;\n greaterThanOrEqual?: number;\n lessThan?: number;\n lessThanOrEqual?: number;\n}\n\n// Shared scalar expectation used by geometry measurements\nGeoSpecNumericExpectation: number | {\n value?: number;\n greaterThan?: number;\n greaterThanOrEqual?: number;\n lessThan?: number;\n lessThanOrEqual?: number;\n}\n\n// Shared scalar expectation used by geometry measurements\nGeoSpecNumericExpectation: number | {\n value?: number;\n greaterThan?: number;\n greaterThanOrEqual?: number;\n lessThan?: number;\n lessThanOrEqual?: number;\n}\n\n// Point expectation accepted by center and feature matchers\nGeoSpecPointExpectation: Vec3 | GeoSpecAxisExpectation\n\n// Shared scalar expectation used by geometry measurements\nGeoSpecNumericExpectation: number | {\n value?: number;\n greaterThan?: number;\n greaterThanOrEqual?: number;\n lessThan?: number;\n lessThanOrEqual?: number;\n}\n```\n\n## API reference\n\nTo read any other signature, grep the skill directory for the name followed by `(` (or the bare type name): each hit is the declaration line and names its file; read a few lines around it for overloads and parameter notes. `api-index.md` lists all 360 symbols by file.\n\n- `api-functions.md` — Functions\n- `api-constants.md` — Constants\n- `api-types.md` — Types\n- `api-classes.md` — Classes\n\nRead ranges, not whole files. Never copy a reference into a source file.\n"
25
+ "body": "---\nname: geospec-authoring\ndescription: Guides canonical GeoSpec geometry tests in TypeScript or JavaScript for every Tau kernel. Use for *.geospec.ts and *.geospec.js tests.\n---\n\n# GeoSpec authoring\n\nWrite tests before implementation; assert deterministic, measurable properties.\n\n## Test shape\n\n- Use `*.geospec.ts` or `*.geospec.js`. Import `describe`, `it` and `expectGeo` from `geospec`, and `loadModel` from `geospec/model`.\n- Await `loadModel`, then assert synchronously with `expectGeo(model)`. The host supplies the compiled binding; authoring does not select an engine.\n- Await or return the complete model-load chain from the test callback; detached future loads are not part of a completed test.\n- Omit `parameters` for model-code defaults; use `{ file, parameters }` for variants. Loaded subjects are opaque.\n- `loadModel({ file })` resolves `file` against the project root, the same root as every tool's `targetFile`; the result names that root as `projectRoot` where the host reports it, as `tau mcp` does. A suite in a subfolder names the model by its path from that root, or passes `rootDir`, the project-relative folder the model is in: `loadModel({ file: 'main.ts', rootDir: 'parts/gear' })` loads `parts/gear/main.ts`. A file the root does not hold refuses with `GEOSPEC_MODEL_SOURCE_NOT_FOUND`, which names the root and the path it looked for.\n\nCanonical TypeScript authoring:\n\n```ts\nimport { describe, expectGeo, it } from 'geospec';\nimport { loadModel } from 'geospec/model';\n\ndescribe('main geometry', () => {\n it('has the intended envelope', async () => {\n const model = await loadModel({ file: 'main.ts', parameters: { width: 120 } });\n expectGeo(model).toHaveBoundingBox({ size: { x: 120 }, tolerance: 1 });\n });\n});\n```\n\nSpecs are always TypeScript or JavaScript, whatever the model's kernel: `loadModel({ file })` evaluates `main.ts`, `main.tsx`, `main.py`, `main.scad`, `main.kcl` or `main.cs` through Tau's runtime. `test_model` discovers `*.geospec.ts` and `*.geospec.js` only.\n\nEvery matcher takes one expectation object:\n\n- Wrong: `expectGeo(model).toHaveVolume(5000, { tolerance: 5 })`. Correct: `expectGeo(model).toHaveVolume({ value: 5000, tolerance: 5 })`.\n- Wrong: `await expectGeo(model)…`. Correct: await `loadModel`, then assert synchronously.\n- Wrong: exact-feature matchers on a mesh kernel (Manifold, JSCAD, OpenSCAD, PicoGK, PicoVoxel). Correct: `toBeValidBrep`, `toHaveTopologyCounts`, the face, hole, pattern, chamfer, fillet and wall-thickness matchers, `toHaveStepUnits`, `toHaveProductStructure` and `toHaveVoidContinuity` need STEP BRep evidence and report unsupported on meshes; assert meshes with bounds, volume, surface area, connected components and `toBeWatertight`.\n\n## Loads and budgets\n\n- GeoSpec has no `beforeAll`. Write each `loadModel` inside its own `it`: within one run, identical loads (same file or code, parameters, format, tolerances and region) share one export and one admission. Each load keeps its own `loadId` and records `reused: true`, and a file is reused only while its source closure is unchanged.\n- `loadModel({ file, workUnitLimit })` sets the default claim budget for that subject, and `expectGeo(model, { workUnitLimit })` overrides it for one chain. The budget is a positive integer no greater than 512000000. A `MATCHER_TIMEOUT` refusal reports `details.limit` and, when measured, `details.used`; its `test_model` row (category `work-budget`) names in `limit.retry` the one `workUnitLimit` that can decide the claim, or `null` at the host maximum. Never treat the refusal as a pass.\n- `loadModel({ file, region: { min: [x, y, z], max: [x, y, z] } })` makes a separate claim about one millimetre box, never a stand-in for a whole-model claim. The kernel crops before export (PicoVoxel trims Voxels parts), and other kernels, STEP loads and unconfirmed crops refuse with a typed diagnostic. A cropped subject answers only bounding box, volume, surface area, mass and center of mass of its region, and its assertions record the region. Every other matcher on it refuses with `GEOSPEC_REGION_WHOLE_MODEL_CLAIM`. Name the region in the test, and keep whole-model claims on whole-model loads.\n- A host or engine limit leaves a claim undecided, never false: `test_model` reports it as inconclusive with category `analysis-limit`, `resource-limit` or `work-budget` and a typed `limit` naming the limit and its numbers. Keep the model as designed: never coarsen, shrink or crop it to fit. Only a `work-budget` row's `limit.retry` is a retry, and `testTimeout` only answers a `timeout` row; report every other limit row as not decided at this capacity.\n- `toHaveCenterOfMass({ point, tolerance })` takes an exact point. Per-axis ranges such as `{ y: { greaterThan: 1 } }` are refused.\n\n## Ceilings\n\nFixed in this release; design within them, and report a claim that meets one as not decided.\n\n| Ceiling | Value | Where an agent meets it |\n| ------------------------------------- | -------------------- | --------------------------------------------------------------------------------------------------------------------------------- |\n| `maxSubjectBytes`, `maxResourceBytes` | 64 MiB each | A mesh `loadModel({ file })` exports about 72 bytes per triangle, so admission refuses near 930,000 triangles (`resource-limit`). |\n| `maxTotalBinaryBytes` | 128 MiB | All subjects of one load together. |\n| `maxTriangles`, `maxVertices` | 4,000,000, 2,000,000 | A decoded mesh. |\n| `continuousEvidenceBytes` | 32 MiB | `toHaveNoComponentInterference` on a large assembly (`analysis-limit`). |\n| `workUnitLimit` | 512000000 at most | Any claim; the only limit an argument raises. |\n\nLoad `format: 'step'` only for the exact-BRep matchers above; every other matcher answers on the cheaper mesh.\n\n## Coverage\n\nBounds and physical properties are insufficient. Cover major components, named features, variants, dimensions/positions, disjoint counts, closure, interference and supported exact features. Explicitly report unsupported requirements; proxies cannot fulfill them.\n\n- `toHaveBoundingBox`: size/position.\n- `toHaveConnectedComponents`: qualified material connectivity; visual touching cannot justify tolerance changes.\n- `toBeWatertight`: closed edge incidence, not manifold validity, fusion or material connectivity. Bounds prove none of these. Missing evidence is unsupported.\n- `toHaveSurfaceArea`, `toHaveVolume`, `toHaveCenterOfMass`, `toHaveMass`: physical measurements.\n- `toHaveNoComponentInterference`: overlap; allow deliberate press fits.\n- `loadModel({ file, format: 'step' })`: use BRep evidence for supported topology and feature assertions. Missing occurrence, interference, clearance, containment, lumen, wall, section or motion evidence is unsupported, not a pass or an envelope substitute.\n\nTest assemblies and independent units; preserve sibling coverage when adding files. Non-top-level geometry needs kernel export/invocation, not test removal.\n\nFix geometry at its root; never weaken tolerances, delete assertions, or reduce detail to pass.\n\n`public-api-index.md` covers the host and framework API; authoring needs only the Core API below and `api-*` files.\n\n## Core API\n\nThe symbols real Tau models use most, as verbatim declarations. Anything not shown is in the API reference below.\n\n### Functions\n\n```ts\n// Start a geometry assertion chain\nexport declare function expectGeo(subject: GeoSpecSubject, options?: GeoSpecExpectOptions): GeoSpecMatcher;\n\n// A model admitted by one live GeoSpec host scope\nGeoSpecSubject: {\n readonly [subjectBrand]: true\n}\n\n// Per-chain options accepted by `expectGeo(subject, options)`\nGeoSpecExpectOptions: {\n // Deterministic work-unit budget for every claim in this chain\n readonly workUnitLimit?: number\n}\n\n// Load a CAD model into GeoSpec evidence\nexport declare function loadModel<Code extends Record<string, string> = Record<string, string>>(_options: LoadModelOptions<Code>): Promise<GeoSpecSubject>;\n\n// Options accepted by {@link import ('./load-model.js').loadModel}\nLoadModelOptions: LoadModelSourceOptions | LoadModelCodeOptions<Code> | LoadModelFileOptions\n // Project-relative folder `file` resolves in, for a suite that loads from somewhere other than…\n rootDir?: string\n // Geometry format to export\n format?: GeoSpecModelFormat\n // Explicit parameters passed to the runtime\n parameters?: Record<string, unknown>\n // STEP reader strategy used for STEP exports\n stepStreaming?: StepStreamingMode\n // Whether STEP loading should also produce mesh evidence\n mesh?: boolean\n // Linear tolerance used while meshing exact BRep evidence\n meshLinearTolerance?: number\n // Angular tolerance in degrees used while meshing exact BRep evidence\n meshAngularToleranceDegrees?: number\n // Default work-unit budget for every claim on this subject\n workUnitLimit?: number\n\n// Geometry formats accepted by {@link import ('./load-model.js').loadModel}\nGeoSpecModelFormat: MeshFileFormat | 'step' | 'stp'\n\n// GeoSpec test helper used inside VM-executed test modules\nexport declare function it(name: string, function_: GeoSpecTestCallback): void;\n skip(name: string, function_?: GeoSpecTestCallback): void;\n\n// GeoSpec suite helper used inside VM-executed test modules\nexport declare function describe(name: string, function_: GeoSpecTestCallback): void;\n skip(name: string, function_?: GeoSpecTestCallback): void;\n```\n\n### Types\n\n```ts\n// Assertion chain returned by `expectGeo(subject)`\nGeoSpecMatcher: {\n // Core-owned negation\n readonly not: Omit<GeoSpecMatcher, 'not'>\n // Assert the fixed rational plate contract\n toSatisfyRationalPlate(): GeoSpecAssertion;\n // Assert the fixed parallel-plane distance contract\n toSatisfyParallelPlaneDistance(): GeoSpecAssertion;\n // Assert axis-aligned bounds, size, or center for a loaded geometry subject\n toHaveBoundingBox(first: Vec3 | GeoSpecBoundingBoxExpectation, second?: Vec3): GeoSpecAssertion;\n // Assert how many spatially disjoint chunks the mesh contains\n toHaveConnectedComponents(expected: GeoSpecConnectedComponentsExpectation): GeoSpecAssertion;\n // Assert closed mesh edge incidence\n toBeWatertight(): GeoSpecAssertion;\n // Assert that separate assembly components do not occupy the same solid volume\n toHaveNoComponentInterference(expected?: GeoSpecComponentInterferenceExpectation): GeoSpecAssertion;\n // Assert that named assembly occurrences exist with expected counts and bounds\n toHaveAssemblyOccurrences(expected: GeoSpecAssemblyOccurrencesExpectation): GeoSpecAssertion;\n // Assert that selected entities satisfy declared spatial relationships\n toHaveSpatialRelationships(expected: GeoSpecSpatialRelationshipsExpectation): GeoSpecAssertion;\n // Assert rendered mesh evidence is internally trustworthy for downstream checks\n toHaveMeshIntegrity(expected: GeoSpecMeshIntegrityExpectation): GeoSpecAssertion;\n // Assert that the subject carries no diagnostics at the rejected severities\n toHaveNoDiagnostics(expected?: GeoSpecNoDiagnosticsExpectation): GeoSpecAssertion;\n // Assert total surface area, preferring exact BRep mass properties when available\n toHaveSurfaceArea(expected: GeoSpecSurfaceAreaExpectation): GeoSpecAssertion;\n // Assert enclosed volume, preferring exact BRep mass properties when available\n toHaveVolume(expected: GeoSpecVolumeExpectation): GeoSpecAssertion;\n // Assert mass derived from exact mass properties or volume times density\n toHaveMass(expected: GeoSpecMassExpectation): GeoSpecAssertion;\n // Assert the center of mass or mesh-derived centroid for a closed subject\n toHaveCenterOfMass(expected: GeoSpecCenterOfMassExpectation): GeoSpecAssertion;\n // Assert that exact BRep evidence reports a valid shape\n toBeValidBrep(expected?: GeoSpecValidBrepExpectation): GeoSpecAssertion;\n // Assert exact BRep topology counts\n toHaveTopologyCounts(expected: GeoSpecTopologyCountsExpectation): GeoSpecAssertion;\n // Assert the STEP unit evidence\n toHaveStepUnits(expected: GeoSpecStepUnitsExpectation): GeoSpecAssertion;\n // Assert STEP product-structure evidence\n toHaveProductStructure(expected: GeoSpecProductStructureExpectation): GeoSpecAssertion;\n // Assert that BRep evidence contains a planar face matching the requested constraints\n toHavePlanarFace(expected: GeoSpecPlanarFaceExpectation): GeoSpecAssertion;\n // Assert that BRep evidence contains a cylindrical face with the requested radius and axis\n toHaveCylindricalFace(expected: GeoSpecCylindricalFaceExpectation): GeoSpecAssertion;\n // Assert that BRep evidence contains a circular hole matching diameter, center, and axis\n toHaveCircularHole(expected: GeoSpecCircularHoleExpectation): GeoSpecAssertion;\n // Assert that BRep evidence contains a repeated circular-hole pattern\n toHaveCircularHolePattern(expected: GeoSpecCircularHolePatternExpectation): GeoSpecAssertion;\n // Assert that BRep evidence contains a chamfer feature with the requested distance\n toHaveChamferFeature(expected: GeoSpecChamferFeatureExpectation): GeoSpecAssertion;\n // Assert that BRep evidence contains a fillet feature with the requested radius\n toHaveFilletFeature(expected: GeoSpecFilletFeatureExpectation): GeoSpecAssertion;\n // Assert that BRep evidence reports a minimum wall thickness satisfying the expectation\n toHaveMinimumWallThickness(expected: GeoSpecMinimumWallThicknessExpectation): GeoSpecAssertion;\n // Assert that the declared waypoints share one connected void, stay isolated from the declared…\n toHaveVoidContinuity(expected: GeoSpecVoidContinuityExpectation): GeoSpecAssertion;\n}\n\n// Numeric 3D vector\nVec3: readonly [number, number, number]\n\n// Bounding-box expectation accepted by `expectGeo(...).toHaveBoundingBox(...)`\nGeoSpecBoundingBoxExpectation: {\n min?: Vec3 | Partial<Record<keyof GeoSpecAxisExpectation, GeoSpecNumericExpectation>>\n max?: Vec3 | Partial<Record<keyof GeoSpecAxisExpectation, GeoSpecNumericExpectation>>\n size?: Vec3 | Partial<Record<keyof GeoSpecAxisExpectation, GeoSpecNumericExpectation>>\n center?: Vec3 | Partial<Record<keyof GeoSpecAxisExpectation, GeoSpecNumericExpectation>>\n tolerance?: number\n}\n\n// Connected-components expectation accepted by `expectGeo(...).toHaveConnectedComponents(...)`\nGeoSpecConnectedComponentsExpectation: {\n count: number\n tolerance?: number\n toleranceMm?: number\n}\n\n// Component-interference expectation accepted by `expectGeo(...).toHaveNoComponentInterference(...)`\nGeoSpecComponentInterferenceExpectation: {\n tolerance?: number\n pairs?: GeoSpecComponentInterferencePairExpectation[]\n allowances?: GeoSpecComponentInterferenceAllowance[]\n}\n\n// Assembly occurrence expectation accepted by `expectGeo(...).toHaveAssemblyOccurrences(...)`\nGeoSpecAssemblyOccurrencesExpectation: {\n occurrences: GeoSpecAssemblyOccurrenceExpectation[]\n uniqueNames?: boolean\n}\n\n// Spatial relationship expectation accepted by `expectGeo(...).toHaveSpatialRelationships(...)`\nGeoSpecSpatialRelationshipsExpectation: {\n relationships: GeoSpecSpatialRelationshipExpectation[]\n}\n\n// Mesh integrity expectation accepted by `expectGeo(...).toHaveMeshIntegrity(...)`\nGeoSpecMeshIntegrityExpectation: {\n finitePositions?: boolean\n degenerateTriangles?: {\n count?: number;\n maxCount?: number;\n areaTolerance?: number;\n }\n duplicateFaces?: {\n count?: number;\n maxCount?: number;\n }\n watertight?: boolean\n triangleCount?: GeoSpecNumericExpectation\n}\n\n// Diagnostic severities rejected by `expectGeo(...).toHaveNoDiagnostics(...)`\nGeoSpecNoDiagnosticsExpectation: {\n severities?: Array<GeometryDiagnostic['severity']>\n}\n\n// Surface-area expectation accepted by `expectGeo(...).toHaveSurfaceArea(...)`\nGeoSpecSurfaceAreaExpectation: {\n value: number | GeoSpecNumericExpectation\n tolerance?: number\n}\n\n// Volume expectation accepted by `expectGeo(...).toHaveVolume(...)`\nGeoSpecVolumeExpectation: {\n value: number | GeoSpecNumericExpectation\n tolerance?: number\n}\n\n// Mass expectation accepted by `expectGeo(...).toHaveMass(...)`\nGeoSpecMassExpectation: {\n value: number | GeoSpecNumericExpectation\n density?: number\n tolerance?: number\n}\n\n// Center-of-mass expectation accepted by `expectGeo(...).toHaveCenterOfMass(...)`\nGeoSpecCenterOfMassExpectation: {\n // Exact expected point in millimetres\n point: GeoSpecPointExpectation\n tolerance?: number\n}\n\n// Exact BRep validity expectation accepted by `expectGeo(...).toBeValidBrep(...)`\nGeoSpecValidBrepExpectation: {\n maxTolerance?: number\n freeBounds?: {\n count?: GeoSpecNumericExpectation;\n }\n minEdgeLength?: number\n sameParameter?: boolean\n closedShells?: boolean\n closedWires?: boolean\n}\n\n// Topology-count expectation accepted by `expectGeo(...).toHaveTopologyCounts(...)`\nGeoSpecTopologyCountsExpectation: {\n vertices?: GeoSpecNumericExpectation\n edges?: GeoSpecNumericExpectation\n wires?: GeoSpecNumericExpectation\n faces?: GeoSpecNumericExpectation\n shells?: GeoSpecNumericExpectation\n solids?: GeoSpecNumericExpectation\n compounds?: GeoSpecNumericExpectation\n tolerance?: number\n}\n\n// STEP unit expectation accepted by `expectGeo(...).toHaveStepUnits(...)`\nGeoSpecStepUnitsExpectation: {\n unit: string\n}\n\n// Product-structure expectation accepted by `expectGeo(...).toHaveProductStructure(...)`\nGeoSpecProductStructureExpectation: {\n names?: string[]\n count?: GeoSpecNumericExpectation\n}\n\n// Planar-face expectation accepted by `expectGeo(...).toHavePlanarFace(...)`\nGeoSpecPlanarFaceExpectation: {\n normal: GeoSpecPointExpectation\n offset: number\n area?: GeoSpecNumericExpectation\n tolerance?: number\n}\n\n// Cylindrical-face expectation accepted by `expectGeo(...).toHaveCylindricalFace(...)`\nGeoSpecCylindricalFaceExpectation: {\n radius: number\n axis: 'x' | 'y' | 'z'\n tolerance?: number\n}\n\n// Circular-hole expectation accepted by `expectGeo(...).toHaveCircularHole(...)`\nGeoSpecCircularHoleExpectation: {\n diameter: number\n through?: boolean\n axis?: 'x' | 'y' | 'z'\n center?: GeoSpecPointExpectation\n tolerance?: number\n}\n\n// Circular-hole-pattern expectation accepted by `expectGeo(...).toHaveCircularHolePattern(...)`\nGeoSpecCircularHolePatternExpectation: {\n count: number\n holeDiameter: number\n boltCircleDiameter?: number\n axis?: 'x' | 'y' | 'z'\n center?: GeoSpecPointExpectation\n tolerance?: number\n}\n\n// Chamfer-feature expectation accepted by `expectGeo(...).toHaveChamferFeature(...)`\nGeoSpecChamferFeatureExpectation: {\n distance: number\n selection?: string\n tolerance?: number\n}\n\n// Fillet-feature expectation accepted by `expectGeo(...).toHaveFilletFeature(...)`\nGeoSpecFilletFeatureExpectation: {\n radius: number\n selection?: string\n tolerance?: number\n}\n\n// Minimum-wall-thickness expectation accepted by `expectGeo(...).toHaveMinimumWallThickness(...)`\nGeoSpecMinimumWallThicknessExpectation: {\n value: GeoSpecNumericExpectation\n tolerance?: number\n}\n\n// Void-continuity expectation accepted by `expectGeo(...).toHaveVoidContinuity(...)`\nGeoSpecVoidContinuityExpectation: {\n // Ordered waypoints (>= 1) known to lie in the void being proven\n path: GeoSpecVoidWaypoint[]\n // Occurrence names whose solids bound the void\n material?: string[]\n // Minimum required bottleneck cross-section (mm²), sampled\n minCrossSection?: number\n // Points that must NOT be reachable from the path void (isolation claim)\n isolatedFrom?: Vec3[]\n // Region bounded for the proof (subject frame)\n bounds?: {\n min: Vec3;\n max: Vec3;\n }\n}\n\n// Axis-keyed numeric expectation used by high-level geometry matchers\nGeoSpecAxisExpectation: {\n x?: number\n y?: number\n z?: number\n}\n\n// Shared scalar expectation used by geometry measurements\nGeoSpecNumericExpectation: number | {\n value?: number;\n greaterThan?: number;\n greaterThanOrEqual?: number;\n lessThan?: number;\n lessThanOrEqual?: number;\n}\n\n// A pair-specific component-interference check accepted by `expectGeo(...).toHaveNoComponentInterference(...)`\nGeoSpecComponentInterferencePairExpectation: {\n left: GeoSpecComponentSelector\n right: GeoSpecComponentSelector\n}\n\n// Intentional component interference allowance accepted by `expectGeo(...).toHaveNoComponentInterference(...)`\nGeoSpecComponentInterferenceAllowance: {\n kind?: 'intentionalInterference'\n left: GeoSpecComponentSelector\n right: GeoSpecComponentSelector\n maxVolume?: number\n reason: string\n}\n\n// Assembly occurrence rule accepted by `expectGeo(...).toHaveAssemblyOccurrences(...)`\nGeoSpecAssemblyOccurrenceExpectation: {\n name: GeoSpecComponentSelector\n count?: GeoSpecNumericExpectation\n bounds?: {\n within?: GeoSpecComponentSelector;\n min?: Vec3 | GeoSpecAxisExpectation;\n max?: Vec3 | GeoSpecAxisExpectation;\n center?: GeoSpecPointExpectation;\n tolerance?: number;\n }\n}\n\n// One spatial relationship accepted by `expectGeo(...).toHaveSpatialRelationships(...)`\nGeoSpecSpatialRelationshipExpectation: {\n id?: string\n kind: 'contact' | 'clearance' | 'coaxial' | 'concentric' | 'coplanar' | 'parallel' | 'perpendicular' | 'angle' | 'containment' | 'insertion' | 'interference'\n subject: GeoSpecGeometrySelector\n target: GeoSpecGeometrySelector\n tolerance?: number\n angularToleranceDegrees?: number\n // Expected angle in degrees for `kind\n angleDegrees?: number\n // Declared insertion axis (subject-frame direction) for `kind\n axis?: Vec3\n min?: number\n max?: number\n minVolume?: number\n maxVolume?: number\n reason?: string\n}\n\n// Diagnostic emitted by GeoSpec loaders, analyzers, and matchers\nGeometryDiagnostic: {\n code: KernelIssueCode | (string & {})\n severity: 'error' | 'warning' | 'info'\n message: string\n suggestion?: string\n spatial?: {\n min?: Vec3;\n max?: Vec3;\n center?: Vec3;\n }\n details?: unknown\n}\n\n// Point expectation accepted by center and feature matchers\nGeoSpecPointExpectation: Vec3 | GeoSpecAxisExpectation\n\n// One void-continuity waypoint\nGeoSpecVoidWaypoint: Vec3 | {\n occurrence: string;\n}\n\n// Inline code-CAD model load options\nLoadModelCodeOptions: {\n // Source files keyed by project-relative path\n code: Code\n // Geometry format to export\n format?: GeoSpecModelFormat\n // Explicit parameters passed to the runtime\n parameters?: Record<string, unknown>\n // Whether STEP loading should also produce mesh evidence\n mesh?: boolean\n // … 10 more members in the API reference: file, rootDir, runtime, sourceAdapters, projectPath, stepStreaming, meshLinearTolerance, meshAngularToleranceDegrees, workUnitLimit, region\n}\n\nRuntimeBackedModelFormat: Exclude<GeoSpecModelFormat, 'mesh-buffer'>\n```\n\n## API reference\n\nTo read any other signature, find its name in `api-index.md`, which lists all 364 symbols by file with the lines that hold each, and read that range of the named file.\n\n- `api-functions.md` — Functions\n- `api-constants.md` — Constants\n- `api-types.md` — Types\n- `api-classes.md` — Classes\n\nRead ranges, not whole files. Never copy a reference into a source file.\n"
26
26
  }
27
27
  ]
28
28
  }
@@ -59,7 +59,7 @@ type MinimumDistanceResult = {
59
59
  readonly fact: MinimumDistanceFact;
60
60
  } | {
61
61
  readonly status: 'refused';
62
- readonly code: 'unsupported-evidence' | 'invalid-selection' | 'work-limit';
62
+ readonly code: 'unsupported-evidence' | 'invalid-selection' | 'work-limit' | 'analysis-limit' | 'resource-limit';
63
63
  readonly message: string;
64
64
  } | {
65
65
  readonly status: 'interrupted';
@@ -1,2 +1,2 @@
1
- import{geoSpecMatcherDescriptors as e,normalizeGeoSpecExpected as t}from"../engine/matchers.mjs";import{assertGeoSpecAuthoredWorkUnitLimit as n,evaluateGeoSpecNativeClaim as r,evaluateGeoSpecNativeQuery as i,resolveGeoSpecMaximumWorkUnitLimit as a,resolveGeoSpecNativeWorkUnitLimit as o,supportsGeoSpecNativeMinimumDistance as s}from"../engine/client.mjs";import{resolveGeoSpecSubject as c}from"../model/subject.mjs";const l=(e,t)=>{if(typeof e!=`object`||!e||Array.isArray(e))return;let{fact:n}=e;if(typeof n!=`object`||!n||Array.isArray(n))return;let{distance:r,points:i,occurrences:a,subjectHash:o}=n,s=e=>Array.isArray(e)&&e.length===3&&e.every(e=>typeof e==`number`&&Number.isFinite(e));if(!(e.profile!==`geospec-minimum-distance-v1`||n.source!==`ap242`||n.assurance!==`exact-brep`||n.unit!==`mm`||n.coordinateSystem!==`z-up`||n.algorithmProfile!==`geospec-minimum-distance-v1`||typeof o!=`string`||!/^[0-9a-f]{64}$/u.test(o)||o!==(t.subject.subjectHash??t.subject.contentHash)||typeof r!=`number`||!Number.isFinite(r)||r<0||!Array.isArray(a)||a.length!==2||a[0]!==t.payload.pair[0].occurrencePath||a[1]!==t.payload.pair[1].occurrencePath||!Array.isArray(i)||i.length!==2||!s(i[0])||!s(i[1])))return{source:`ap242`,assurance:`exact-brep`,unit:`mm`,coordinateSystem:`z-up`,subjectHash:o,algorithmProfile:`geospec-minimum-distance-v1`,occurrences:[a[0],a[1]],distance:r,points:[i[0],i[1]]}},u=(e,t)=>{if(e.status===`passed`){let n=l(e.evidence,t);return n===void 0?{status:`interrupted`,code:`engine-error`,message:`Native minimum returned malformed evidence.`}:{status:`complete`,fact:n}}let n=e.diagnostics.find(e=>typeof e==`object`&&!!e&&!Array.isArray(e)),r=typeof n==`object`&&n&&!Array.isArray(n)?n.code:void 0,i=typeof n==`object`&&n&&!Array.isArray(n)&&typeof n.message==`string`?n.message:`Native minimum is unavailable.`;return r===`GEOSPEC_INVALID_SELECTION`?{status:`refused`,code:`invalid-selection`,message:i}:r===`MATCHER_TIMEOUT`?{status:`refused`,code:`work-limit`,message:i}:r===`GEOSPEC_UNSUPPORTED_EVIDENCE`||r===`GEOSPEC_EVIDENCE_UNSUPPORTED`?{status:`refused`,code:`unsupported-evidence`,message:i}:{status:`interrupted`,code:`engine-error`,message:i}};var d=class extends Error{canonicalClaim;canonicalPlan;canonicalResult;claim;diagnostics;report;result;constructor(e){let t=e.diagnostics.flatMap(e=>{if(typeof e!=`object`||!e||Array.isArray(e))return[];let{message:t}=e;return typeof t==`string`?[t]:[]});super(t.join(`
1
+ import{geoSpecMatcherDescriptors as e,normalizeGeoSpecExpected as t}from"../engine/matchers.mjs";import{assertGeoSpecAuthoredWorkUnitLimit as n,evaluateGeoSpecNativeClaim as r,evaluateGeoSpecNativeQuery as i,resolveGeoSpecMaximumWorkUnitLimit as a,resolveGeoSpecNativeWorkUnitLimit as o,supportsGeoSpecNativeMinimumDistance as s}from"../engine/client.mjs";import{resolveGeoSpecSubject as c}from"../model/subject.mjs";const l=(e,t)=>{if(typeof e!=`object`||!e||Array.isArray(e))return;let{fact:n}=e;if(typeof n!=`object`||!n||Array.isArray(n))return;let{distance:r,points:i,occurrences:a,subjectHash:o}=n,s=e=>Array.isArray(e)&&e.length===3&&e.every(e=>typeof e==`number`&&Number.isFinite(e));if(!(e.profile!==`geospec-minimum-distance-v1`||n.source!==`ap242`||n.assurance!==`exact-brep`||n.unit!==`mm`||n.coordinateSystem!==`z-up`||n.algorithmProfile!==`geospec-minimum-distance-v1`||typeof o!=`string`||!/^[0-9a-f]{64}$/u.test(o)||o!==(t.subject.subjectHash??t.subject.contentHash)||typeof r!=`number`||!Number.isFinite(r)||r<0||!Array.isArray(a)||a.length!==2||a[0]!==t.payload.pair[0].occurrencePath||a[1]!==t.payload.pair[1].occurrencePath||!Array.isArray(i)||i.length!==2||!s(i[0])||!s(i[1])))return{source:`ap242`,assurance:`exact-brep`,unit:`mm`,coordinateSystem:`z-up`,subjectHash:o,algorithmProfile:`geospec-minimum-distance-v1`,occurrences:[a[0],a[1]],distance:r,points:[i[0],i[1]]}},u=(e,t)=>{if(e.status===`passed`){let n=l(e.evidence,t);return n===void 0?{status:`interrupted`,code:`engine-error`,message:`Native minimum returned malformed evidence.`}:{status:`complete`,fact:n}}let n=e.diagnostics.find(e=>typeof e==`object`&&!!e&&!Array.isArray(e)),r=typeof n==`object`&&n&&!Array.isArray(n)?n.code:void 0,i=typeof n==`object`&&n&&!Array.isArray(n)&&typeof n.message==`string`?n.message:`Native minimum is unavailable.`;return r===`GEOSPEC_INVALID_SELECTION`?{status:`refused`,code:`invalid-selection`,message:i}:r===`MATCHER_TIMEOUT`?{status:`refused`,code:`work-limit`,message:i}:r===`GEOSPEC_ANALYSIS_LIMIT`?{status:`refused`,code:`analysis-limit`,message:i}:r===`GEOSPEC_RESOURCE_LIMIT`?{status:`refused`,code:`resource-limit`,message:i}:r===`GEOSPEC_UNSUPPORTED_EVIDENCE`||r===`GEOSPEC_EVIDENCE_UNSUPPORTED`?{status:`refused`,code:`unsupported-evidence`,message:i}:{status:`interrupted`,code:`engine-error`,message:i}};var d=class extends Error{canonicalClaim;canonicalPlan;canonicalResult;claim;diagnostics;report;result;constructor(e){let t=e.diagnostics.flatMap(e=>{if(typeof e!=`object`||!e||Array.isArray(e))return[];let{message:t}=e;return typeof t==`string`?[t]:[]});super(t.join(`
2
2
  `)||`GeoSpec assertion '${e.claimId}' ended with status '${e.status}'.`),this.name=`GeoSpecAssertionError`,this.report=e,this.diagnostics=e.diagnostics,this.claim=e.claim,this.result=e.result,this.canonicalClaim=e.canonicalClaim,this.canonicalPlan=e.canonicalPlan,this.canonicalResult=e.canonicalResult}};const f=[`x`,`y`,`z`],p=e=>{if(typeof e!=`object`||!e||!(`point`in e))return;let{point:t}=e,n=Array.isArray(t)?t.map((e,t)=>[f[t]??String(t),e]):typeof t==`object`&&t?Object.entries(t):[];if(n.length===0&&!(typeof t==`object`&&t))throw TypeError(`GeoSpec matcher toHaveCenterOfMass needs point as [x, y, z] or { x, y, z } in millimetres, with an optional tolerance.`);for(let[e,t]of n)if(!(typeof t==`number`&&Number.isFinite(t)))throw TypeError(typeof t==`object`&&t&&!Array.isArray(t)?`GeoSpec matcher toHaveCenterOfMass point.${e} must be a finite number in millimetres: per-axis ranges such as { greaterThan } are not supported for center of mass. Assert the expected point with a tolerance instead.`:`GeoSpec matcher toHaveCenterOfMass point.${e} must be a finite number in millimetres.`)},m=n=>{let r={};for(let i of Object.keys(e)){let a=e[i];r[i]=(...e)=>{if(a.expected===`true`&&e.length>0)throw TypeError(`GeoSpec matcher ${i} does not accept arguments.`);return i===`toHaveCenterOfMass`&&p(e[0]),n.invoke({arguments:e,expected:t(a.expected,e),kind:a.kind,matcher:i,polarity:n.polarity,subject:n.subject})}}return r},h=e=>{let t=0,l=e.subjectSlot??`subject`,f,p=()=>(f??=a(e.maximumWorkUnitLimit),f),h,g=()=>(h??=o(e.engine,e.workUnitLimit),h),_=(n,i,a)=>m({subject:n,polarity:i,invoke:o=>{a.validate(),t+=1;let s={claimId:e.claimId?.(o.matcher,t)??`geospec-claim-${t}`,engine:e.engine,...e.evidenceProfile===void 0?{}:{evidenceProfile:e.evidenceProfile},polarity:i,subject:n,subjectSlot:l,workUnitLimit:a.workUnitLimit??g(),maximumWorkUnitLimit:p()},c=r({...s,arguments:o.arguments,capability:o.matcher,kind:o.kind});if(c.status!==`passed`)throw new d(c);return c}});async function v(n){let r=`claimId`in n?n.claimId??`geospec-claim-${++t}`:`geospec-claim-${++t}`;if(n.capability===`minimumDistance`){let t=n.payload?.pair,r=e=>{if(!(typeof e!=`object`||!e||!(`occurrencePath`in e)))return typeof e.occurrencePath==`string`&&e.occurrencePath.length>0?e.occurrencePath:void 0};if(!Array.isArray(t)||t.length!==2||r(t[0])===void 0||r(t[1])===void 0||r(t[0])===r(t[1]))return{status:`refused`,code:`invalid-selection`,message:`Select two distinct resolved AP242 occurrence paths.`};try{if(!s(e.engine))return{status:`refused`,code:`unsupported-evidence`,message:`This native engine does not advertise the complete minimum-distance profile.`}}catch{return{status:`refused`,code:`unsupported-evidence`,message:`This native engine cannot negotiate the complete minimum-distance profile.`}}}try{let t=i({capability:n.capability,claimId:r,engine:e.engine,...e.evidenceProfile===void 0?{}:{evidenceProfile:e.evidenceProfile},payload:n.payload,subject:n.subject,subjectSlot:l,workUnitLimit:g()});return n.capability===`minimumDistance`?u(t,n):t}catch(e){if(n.capability!==`minimumDistance`)throw e;return{status:`interrupted`,code:`engine-error`,message:e instanceof Error?e.message:`Native minimum query failed.`}}}return{query:v,expectGeo(t,r){n(r?.workUnitLimit,`expectGeo workUnitLimit`,p());let i=`subjectHash`in t||`contentHash`in t,a=i?void 0:c(t,e.engine),o=i?t:a.identity,s={validate:()=>{i||c(t,e.engine)},workUnitLimit:r?.workUnitLimit??a?.load?.workUnitLimit},l=_(o,`positive`,s);return Object.assign(l,{not:_(o,`negative`,s)})}}};export{d as GeoSpecAssertionError,h as createGeoSpecAssertionClient,m as createGeoSpecMatcherMethods};
@@ -1 +1 @@
1
- import{assertGeoSpecJsonValue as e,toGeoSpecProtocolJson as t}from"./protocol.mjs";import{geoSpecMatcherDescriptors as n}from"./matchers.mjs";const r=`geospec-jcs-v1`,i=512e6,a=e=>{if(e===void 0)return i;if(!Number.isSafeInteger(e)||e<=0)throw TypeError(`GeoSpec maximumWorkUnitLimit must be a positive safe integer; received ${String(e)}.`);return e},o=[`analyzeMesh`,`analyzeBrep`,`inspectGeometry`,`analyzeMeshOverlap`,`queryPmi`,`minimumDistance`],s=t=>{let n=JSON.parse(new TextDecoder(`utf-8`,{fatal:!0}).decode(t));return e(n),n},c=new TextEncoder().encode(`{"canonicalProfile":"geospec-jcs-v1","method":"initialize","protocolVersion":3,"registryVersion":5,"requestId":"configuration"}`),l=new WeakMap,u=new WeakMap,d=(e,t)=>{if(typeof e!=`object`||!e||Array.isArray(e))throw TypeError(`GeoSpec engine returned a malformed ${t}.`);return e},f=(e,t)=>{let{contentHash:n,subjectHash:r}=e;if(n===void 0==(r===void 0))throw TypeError(`A native GeoSpec subject requires exactly one of contentHash or subjectHash.`);let i=n??r;if(!/^[0-9a-f]{64}$/u.test(i))throw TypeError(`A native GeoSpec subject hash must contain 64 lowercase hexadecimal characters.`);return n===void 0?{slot:t,subjectHash:i}:{slot:t,contentHash:i}},p=e=>{if(!Number.isSafeInteger(e)||e<=0||e>9007199254740991)throw TypeError(`GeoSpec workUnitLimit must be a positive exact safe integer.`)},m=e=>{if(e.claimId.length===0||e.subjectSlot.length===0)throw TypeError(`GeoSpec claim IDs and subject slots must be non-empty strings.`);p(e.workUnitLimit)},h=(e,t,n=i)=>e===void 0||typeof e==`number`&&Number.isSafeInteger(e)&&e>0&&e<=n?void 0:`GeoSpec ${t} must be a positive integer no greater than this host's maximum of ${n} (the host can raise it with maximumWorkUnitLimit); received ${typeof e==`number`?String(e):typeof e}.`,g=(e,t,n)=>{let r=h(e,t,n);if(r!==void 0)throw TypeError(r)},_=(e,t)=>{if(t!==void 0)return p(t),t;let n=l.get(e);if(n!==void 0)return n;let i=d(s(Uint8Array.from(e.processRequest(Uint8Array.from(c)))),`initialize response envelope`);if(i.requestId!==`configuration`)throw TypeError(`GeoSpec engine returned an initialize response with the wrong requestId.`);let a=d(i.result,`initialize result`);if(a.canonicalProfile!==r||a.protocolVersion!==3||a.registryVersion!==5)throw TypeError(`GeoSpec engine returned an initialize response for an incompatible protocol profile.`);let o=d(a.configuration,`initialize configuration`),{capabilities:f}=a,m=Array.isArray(f)?f.filter(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&e.name===`minimumDistance`):[];if(u.set(e,m.length===1&&m.every(e=>e.profile===`geospec-minimum-distance-v1`&&e.implementation===`implemented`&&e.registryVersion===5)),o.configurationProfile!==`geospec-entry-config-v1`)throw TypeError(`GeoSpec engine returned an unsupported configuration profile.`);let h=o.defaultWorkUnitBudget;if(typeof h!=`number`)throw TypeError(`GeoSpec engine initialize configuration omitted defaultWorkUnitBudget.`);return p(h),l.set(e,h),h},v=e=>(_(e),u.get(e)===!0),y=e=>{if(e.capability===`toSatisfyRationalPlate`||e.capability===`toSatisfyParallelPlaneDistance`){if(e.arguments.length>0)throw TypeError(`GeoSpec matcher ${e.capability} does not accept arguments.`);return w({...e,payload:{contract:n[e.capability].contract}})}if(!(`kind`in e))throw TypeError(`This GeoSpec matcher requires its canonical kind.`);return w({...e,payload:{kind:e.kind,arguments:e.arguments.map(e=>t(e))}})},b=e=>{if(!o.includes(e.capability))throw TypeError(`GeoSpec query capability must name an ancillary operation.`);return w({...e,payload:t(e.payload),polarity:`positive`})},x=e=>typeof e==`number`&&Number.isSafeInteger(e)&&e>=0?e:void 0,S=e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&e.code===`MATCHER_TIMEOUT`,C=(e,t,n)=>{if(!S(e))return e;let{details:r}=e,i=typeof r==`object`&&r&&!Array.isArray(r)?r:{},a=x(i.budget)??x(i.workUnitBudget)??t,o=x(i.unitsUsed)??x(i.requiredWorkUnits);return{...e,details:{...i,limit:a,...o===void 0?{}:{used:o},maximumLimit:n}}},w=e=>{m(e);let t={method:`submitClaims`,requestId:e.claimId,protocolVersion:3,registryVersion:5,canonicalProfile:r,plan:{subjects:[f(e.subject,e.subjectSlot)],claims:[{claimId:e.claimId,capability:e.capability,subjectSlots:[e.subjectSlot],payload:e.payload,polarity:e.polarity,workUnitBudget:e.workUnitLimit}],...e.evidenceProfile===void 0?{}:{evidenceProfile:e.evidenceProfile}}},{canonicalClaim:n,canonicalPlan:i,canonicalResult:a}=e.engine.evaluateClaim(new TextEncoder().encode(JSON.stringify(t))),o=d(s(n),`canonical claim`);if(o.claimId!==e.claimId)throw TypeError(`GeoSpec engine returned a malformed canonical claim for '${e.claimId}'.`);let{results:c}=d(s(a),`canonical result envelope`);if(!Array.isArray(c)||c.length!==1)throw TypeError(`GeoSpec engine returned a canonical result envelope without exactly one result.`);let[l]=c,u=d(l,`canonical claim result`),{claimId:p,diagnostics:h,status:g}=u;if(p!==e.claimId||typeof g!=`string`||!Array.isArray(h))throw TypeError(`GeoSpec engine returned a malformed result for claim '${e.claimId}'.`);return{canonicalClaim:n,canonicalPlan:i,canonicalResult:a,claim:o,claimId:p,diagnostics:h.some(e=>S(e))?h.map(t=>C(t,e.workUnitLimit,e.maximumWorkUnitLimit??512e6)):h,...u.evidence===void 0?{}:{evidence:u.evidence},polarity:e.polarity,result:u,status:g}};export{g as assertGeoSpecAuthoredWorkUnitLimit,y as evaluateGeoSpecNativeClaim,b as evaluateGeoSpecNativeQuery,h as geoSpecAuthoredWorkUnitLimitProblem,i as geoSpecMaximumWorkUnitLimit,a as resolveGeoSpecMaximumWorkUnitLimit,_ as resolveGeoSpecNativeWorkUnitLimit,v as supportsGeoSpecNativeMinimumDistance};
1
+ import{assertGeoSpecJsonValue as e,toGeoSpecProtocolJson as t}from"./protocol.mjs";import{geoSpecMatcherDescriptors as n}from"./matchers.mjs";const r=`geospec-jcs-v1`,i=512e6,a=e=>{if(e===void 0)return i;if(!Number.isSafeInteger(e)||e<=0)throw TypeError(`GeoSpec maximumWorkUnitLimit must be a positive safe integer; received ${String(e)}.`);return e},o=[`analyzeMesh`,`analyzeBrep`,`inspectGeometry`,`analyzeMeshOverlap`,`queryPmi`,`minimumDistance`],s=t=>{let n=JSON.parse(new TextDecoder(`utf-8`,{fatal:!0}).decode(t));return e(n),n},c=new TextEncoder().encode(`{"canonicalProfile":"geospec-jcs-v1","method":"initialize","protocolVersion":3,"registryVersion":5,"requestId":"configuration"}`),l=new WeakMap,u=new WeakMap,d=(e,t)=>{if(typeof e!=`object`||!e||Array.isArray(e))throw TypeError(`GeoSpec engine returned a malformed ${t}.`);return e},f=(e,t)=>{let{contentHash:n,subjectHash:r}=e;if(n===void 0==(r===void 0))throw TypeError(`A native GeoSpec subject requires exactly one of contentHash or subjectHash.`);let i=n??r;if(!/^[0-9a-f]{64}$/u.test(i))throw TypeError(`A native GeoSpec subject hash must contain 64 lowercase hexadecimal characters.`);return n===void 0?{slot:t,subjectHash:i}:{slot:t,contentHash:i}},p=e=>{if(!Number.isSafeInteger(e)||e<=0||e>9007199254740991)throw TypeError(`GeoSpec workUnitLimit must be a positive exact safe integer.`)},m=e=>{if(e.claimId.length===0||e.subjectSlot.length===0)throw TypeError(`GeoSpec claim IDs and subject slots must be non-empty strings.`);p(e.workUnitLimit)},h=(e,t,n=i)=>e===void 0||typeof e==`number`&&Number.isSafeInteger(e)&&e>0&&e<=n?void 0:`GeoSpec ${t} must be a positive integer no greater than this host's maximum of ${n} (the host can raise it with maximumWorkUnitLimit); received ${typeof e==`number`?String(e):typeof e}.`,g=(e,t,n)=>{let r=h(e,t,n);if(r!==void 0)throw TypeError(r)},_=(e,t)=>{if(t!==void 0)return p(t),t;let n=l.get(e);if(n!==void 0)return n;let i=d(s(Uint8Array.from(e.processRequest(Uint8Array.from(c)))),`initialize response envelope`);if(i.requestId!==`configuration`)throw TypeError(`GeoSpec engine returned an initialize response with the wrong requestId.`);let a=d(i.result,`initialize result`);if(a.canonicalProfile!==r||a.protocolVersion!==3||a.registryVersion!==5)throw TypeError(`GeoSpec engine returned an initialize response for an incompatible protocol profile.`);let o=d(a.configuration,`initialize configuration`),{capabilities:f}=a,m=Array.isArray(f)?f.filter(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&e.name===`minimumDistance`):[];u.set(e,m.length===1&&m.every(e=>e.profile===`geospec-minimum-distance-v1`&&e.implementation===`implemented`&&e.registryVersion===5));let{configurationProfile:h}=o;if(h!==`geospec-entry-config-v1`&&!(typeof h==`string`&&h.startsWith(`geospec-host-config-v1-`)))throw TypeError(`GeoSpec engine returned an unsupported configuration profile.`);let g=o.defaultWorkUnitBudget;if(typeof g!=`number`)throw TypeError(`GeoSpec engine initialize configuration omitted defaultWorkUnitBudget.`);return p(g),l.set(e,g),g},v=e=>(_(e),u.get(e)===!0),y=e=>{if(e.capability===`toSatisfyRationalPlate`||e.capability===`toSatisfyParallelPlaneDistance`){if(e.arguments.length>0)throw TypeError(`GeoSpec matcher ${e.capability} does not accept arguments.`);return w({...e,payload:{contract:n[e.capability].contract}})}if(!(`kind`in e))throw TypeError(`This GeoSpec matcher requires its canonical kind.`);return w({...e,payload:{kind:e.kind,arguments:e.arguments.map(e=>t(e))}})},b=e=>{if(!o.includes(e.capability))throw TypeError(`GeoSpec query capability must name an ancillary operation.`);return w({...e,payload:t(e.payload),polarity:`positive`})},x=e=>typeof e==`number`&&Number.isSafeInteger(e)&&e>=0?e:void 0,S=e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&e.code===`MATCHER_TIMEOUT`,C=(e,t,n)=>{if(!S(e))return e;let{details:r}=e,i=typeof r==`object`&&r&&!Array.isArray(r)?r:{},a=x(i.budget)??x(i.workUnitBudget)??t,o=x(i.unitsUsed)??x(i.requiredWorkUnits);return{...e,details:{...i,limit:a,...o===void 0?{}:{used:o},maximumLimit:n}}},w=e=>{m(e);let t={method:`submitClaims`,requestId:e.claimId,protocolVersion:3,registryVersion:5,canonicalProfile:r,plan:{subjects:[f(e.subject,e.subjectSlot)],claims:[{claimId:e.claimId,capability:e.capability,subjectSlots:[e.subjectSlot],payload:e.payload,polarity:e.polarity,workUnitBudget:e.workUnitLimit}],...e.evidenceProfile===void 0?{}:{evidenceProfile:e.evidenceProfile}}},{canonicalClaim:n,canonicalPlan:i,canonicalResult:a}=e.engine.evaluateClaim(new TextEncoder().encode(JSON.stringify(t))),o=d(s(n),`canonical claim`);if(o.claimId!==e.claimId)throw TypeError(`GeoSpec engine returned a malformed canonical claim for '${e.claimId}'.`);let{results:c}=d(s(a),`canonical result envelope`);if(!Array.isArray(c)||c.length!==1)throw TypeError(`GeoSpec engine returned a canonical result envelope without exactly one result.`);let[l]=c,u=d(l,`canonical claim result`),{claimId:p,diagnostics:h,status:g}=u;if(p!==e.claimId||typeof g!=`string`||!Array.isArray(h))throw TypeError(`GeoSpec engine returned a malformed result for claim '${e.claimId}'.`);return{canonicalClaim:n,canonicalPlan:i,canonicalResult:a,claim:o,claimId:p,diagnostics:h.some(e=>S(e))?h.map(t=>C(t,e.workUnitLimit,e.maximumWorkUnitLimit??512e6)):h,...u.evidence===void 0?{}:{evidence:u.evidence},polarity:e.polarity,result:u,status:g}};export{g as assertGeoSpecAuthoredWorkUnitLimit,y as evaluateGeoSpecNativeClaim,b as evaluateGeoSpecNativeQuery,h as geoSpecAuthoredWorkUnitLimitProblem,i as geoSpecMaximumWorkUnitLimit,a as resolveGeoSpecMaximumWorkUnitLimit,_ as resolveGeoSpecNativeWorkUnitLimit,v as supportsGeoSpecNativeMinimumDistance};
@@ -38,6 +38,8 @@ type GeoSpecModelLoadEvidence = {
38
38
  readonly sourceRevision?: SourceRevision;
39
39
  /** Actual direct-source locator, when the load read one; absent for anonymous in-memory bytes. */
40
40
  readonly sourcePath?: string;
41
+ /** The project-relative folder the load resolved its paths in, when it named one with `rootDir`. */
42
+ readonly rootDir?: string;
41
43
  /** Authored default work-unit budget for claims on this subject. */
42
44
  readonly workUnitLimit?: number;
43
45
  /**