geospec 0.0.0 → 0.1.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +244 -0
- package/agent/doctrine.md +55 -0
- package/agent/geospec-authoring/SKILL.md +495 -0
- package/agent/geospec-authoring/api-classes.md +13 -0
- package/agent/geospec-authoring/api-constants.md +16 -0
- package/agent/geospec-authoring/api-functions.md +57 -0
- package/agent/geospec-authoring/api-index.md +377 -0
- package/agent/geospec-authoring/api-types.md +1788 -0
- package/agent/geospec-authoring/public-api-classes.md +22 -0
- package/agent/geospec-authoring/public-api-constants.md +51 -0
- package/agent/geospec-authoring/public-api-functions.md +215 -0
- package/agent/geospec-authoring/public-api-index.md +893 -0
- package/agent/geospec-authoring/public-api-types-2.md +1560 -0
- package/agent/geospec-authoring/public-api-types-3.md +217 -0
- package/agent/geospec-authoring/public-api-types.md +1948 -0
- package/agent/resources.d.ts +19 -0
- package/agent/resources.js +27 -0
- package/agent/skills.d.cts +13 -0
- package/agent/skills.json +28 -0
- package/dist/assertion-client/client.d.mts +134 -0
- package/dist/assertion-client/client.mjs +2 -0
- package/dist/assertion-client/index.d.mts +5 -0
- package/dist/assertion-client/index.mjs +1 -0
- package/dist/config/index.d.mts +3 -0
- package/dist/config/index.mjs +1 -0
- package/dist/config/node/index.d.mts +3 -0
- package/dist/config/node/index.mjs +1 -0
- package/dist/config/node/load.d.mts +19 -0
- package/dist/config/node/load.mjs +1 -0
- package/dist/config/tau-project-artifact.d.mts +54 -0
- package/dist/config/tau-project-artifact.mjs +3 -0
- package/dist/config/types.d.mts +57 -0
- package/dist/config/validate.mjs +1 -0
- package/dist/create-geospec.d.mts +50 -0
- package/dist/create-geospec.mjs +1 -0
- package/dist/engine/client.d.mts +113 -0
- package/dist/engine/client.mjs +1 -0
- package/dist/engine/index.d.mts +3 -0
- package/dist/engine/index.mjs +1 -0
- package/dist/engine/matchers.d.mts +70 -0
- package/dist/engine/matchers.mjs +1 -0
- package/dist/engine/pmi.types.d.mts +78 -0
- package/dist/engine/protocol.d.mts +20 -0
- package/dist/engine/protocol.mjs +1 -0
- package/dist/geometry-unit.d.mts +12 -0
- package/dist/index.d.mts +6 -0
- package/dist/index.mjs +1 -0
- package/dist/mesh/index.d.mts +4 -0
- package/dist/mesh/index.mjs +1 -0
- package/dist/mesh/types.d.mts +575 -0
- package/dist/model/errors.d.mts +20 -0
- package/dist/model/errors.mjs +2 -0
- package/dist/model/export-intent.d.mts +79 -0
- package/dist/model/export-intent.mjs +1 -0
- package/dist/model/index.d.mts +7 -0
- package/dist/model/index.mjs +1 -0
- package/dist/model/load-model.d.mts +25 -0
- package/dist/model/load-model.mjs +1 -0
- package/dist/model/native-model-loader.d.mts +142 -0
- package/dist/model/native-model-loader.mjs +1 -0
- package/dist/model/region-scope.d.mts +23 -0
- package/dist/model/region-scope.mjs +1 -0
- package/dist/model/subject-assertions.mjs +1 -0
- package/dist/model/subject.d.mts +11 -0
- package/dist/model/subject.mjs +1 -0
- package/dist/model/types.d.mts +254 -0
- package/dist/runner/collector.d.mts +64 -0
- package/dist/runner/collector.mjs +2 -0
- package/dist/runner/discovery.d.mts +93 -0
- package/dist/runner/discovery.mjs +1 -0
- package/dist/runner/filter.d.mts +50 -0
- package/dist/runner/filter.mjs +1 -0
- package/dist/runner/index.d.mts +7 -0
- package/dist/runner/index.mjs +1 -0
- package/dist/runner/native/index.d.mts +4 -0
- package/dist/runner/native/index.mjs +1 -0
- package/dist/runner/native/native-pool-grants.d.mts +21 -0
- package/dist/runner/native/native-pool-grants.mjs +1 -0
- package/dist/runner/native/native-serial-runner.d.mts +29 -0
- package/dist/runner/native/native-serial-runner.mjs +1 -0
- package/dist/runner/pool/pool-messages.d.mts +94 -0
- package/dist/runner/run-geospec-module.d.mts +13 -0
- package/dist/runner/run-geospec-module.mjs +47 -0
- package/dist/runner/timeout-codes.d.mts +45 -0
- package/dist/runner/timeout-codes.mjs +1 -0
- package/dist/runner/types.d.mts +776 -0
- package/dist/runner/worker/index.d.mts +4 -0
- package/dist/runner/worker/index.mjs +1 -0
- package/dist/runner/worker/no-matching-tests-issue.d.mts +12 -0
- package/dist/runner/worker/no-matching-tests-issue.mjs +1 -0
- package/dist/runner/worker/runner-types.d.mts +167 -0
- package/dist/runner/worker/serial-runner.mjs +1 -0
- package/dist/selector/types.d.mts +271 -0
- package/dist/step/types.d.mts +134 -0
- package/dist/vitest/adapter.d.mts +56 -0
- package/dist/vitest/adapter.mjs +3 -0
- package/dist/vitest/index.d.mts +4 -0
- package/dist/vitest/index.mjs +1 -0
- package/package.json +114 -5
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { GeoSpecFixedMatcherName } from "./matchers.mjs";
|
|
2
|
+
import { JSONValue } from "@taucad/runtime/types";
|
|
3
|
+
//#region src/engine/client.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Default largest work-unit budget a spec may author through `loadModel` or `expectGeo` options:
|
|
6
|
+
* 64 times the engine's current 8 000 000-unit default. It is host policy, not a ceiling: a host
|
|
7
|
+
* raises it with `maximumWorkUnitLimit` on its assertion client, runner or model loader. The
|
|
8
|
+
* host's own `workUnitLimit` keeps the full safe-integer range.
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
declare const geoSpecMaximumWorkUnitLimit = 512000000;
|
|
12
|
+
/**
|
|
13
|
+
* Resolve a host's largest authored work-unit budget.
|
|
14
|
+
*
|
|
15
|
+
* @param maximum - The host's configured maximum, when it sets one.
|
|
16
|
+
* @returns The maximum, defaulting to {@link geoSpecMaximumWorkUnitLimit}.
|
|
17
|
+
* @throws TypeError when the configured maximum is not a positive safe integer.
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
20
|
+
declare const resolveGeoSpecMaximumWorkUnitLimit: (maximum?: number) => number;
|
|
21
|
+
/**
|
|
22
|
+
* Exact core bytes of one claim evaluated in one engine call: the canonical plan, its one
|
|
23
|
+
* canonical claim and the canonical result, as fresh bytes the client retains without copying.
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
26
|
+
type GeoSpecNativeClaimEvaluation = {
|
|
27
|
+
readonly canonicalClaim: Uint8Array<ArrayBuffer>;
|
|
28
|
+
readonly canonicalPlan: Uint8Array<ArrayBuffer>;
|
|
29
|
+
readonly canonicalResult: Uint8Array<ArrayBuffer>;
|
|
30
|
+
};
|
|
31
|
+
/** Byte-only engine surface consumed by the runner-independent assertion client. @public */
|
|
32
|
+
type GeoSpecNativeEngine = {
|
|
33
|
+
evaluateClaim(request: Uint8Array<ArrayBuffer>): GeoSpecNativeClaimEvaluation;
|
|
34
|
+
processRequest(request: Uint8Array<ArrayBuffer>): Uint8Array<ArrayBuffer>;
|
|
35
|
+
};
|
|
36
|
+
/** Content-addressed subject accepted by a protocol-3 assertion plan. @public */
|
|
37
|
+
type GeoSpecNativeSubject = {
|
|
38
|
+
readonly contentHash?: string;
|
|
39
|
+
readonly subjectHash?: string;
|
|
40
|
+
};
|
|
41
|
+
/** Polarity evaluated exactly once by the native core. @public */
|
|
42
|
+
type GeoSpecClaimPolarity = 'negative' | 'positive';
|
|
43
|
+
/** Canonical claim status returned by the native core. @public */
|
|
44
|
+
type GeoSpecCanonicalClaimStatus = 'cancelled' | 'engine-error' | 'failed' | 'invalid' | 'passed' | 'refused' | 'unsupported' | (string & {});
|
|
45
|
+
/** Full native assertion result with the exact core-owned bytes retained. @public */
|
|
46
|
+
type GeoSpecCanonicalClaimReport = {
|
|
47
|
+
readonly canonicalClaim: Uint8Array<ArrayBuffer>;
|
|
48
|
+
readonly canonicalPlan: Uint8Array<ArrayBuffer>;
|
|
49
|
+
readonly canonicalResult: Uint8Array<ArrayBuffer>;
|
|
50
|
+
readonly claim: Readonly<Record<string, JSONValue>>;
|
|
51
|
+
readonly claimId: string;
|
|
52
|
+
/** Engine diagnostics; a `MATCHER_TIMEOUT` row also carries `details.limit`, `details.used` and `details.maximumLimit`. */
|
|
53
|
+
readonly diagnostics: readonly JSONValue[];
|
|
54
|
+
readonly evidence?: JSONValue;
|
|
55
|
+
readonly polarity: GeoSpecClaimPolarity;
|
|
56
|
+
readonly result: Readonly<Record<string, JSONValue>>;
|
|
57
|
+
readonly status: GeoSpecCanonicalClaimStatus;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Success-evidence profile a product selects for its plans (PERF-OUTPUT-01).
|
|
61
|
+
* `complete`, the default, keeps every evidence field. `bounded` keeps verdicts
|
|
62
|
+
* and drops evidence that grows with the subject on success: component gaps
|
|
63
|
+
* (nearest-neighbour gaps on failure), a closed mesh's per-primitive rows,
|
|
64
|
+
* undeclared duplicate faces, and all but the first matching circular hole.
|
|
65
|
+
* @public
|
|
66
|
+
*/
|
|
67
|
+
type GeoSpecNativeEvidenceProfile = 'bounded' | 'complete';
|
|
68
|
+
type GeoSpecNativeClaimContext = {
|
|
69
|
+
readonly claimId: string;
|
|
70
|
+
readonly engine: GeoSpecNativeEngine;
|
|
71
|
+
readonly evidenceProfile?: GeoSpecNativeEvidenceProfile;
|
|
72
|
+
readonly polarity: GeoSpecClaimPolarity;
|
|
73
|
+
readonly subject: GeoSpecNativeSubject;
|
|
74
|
+
readonly subjectSlot: string;
|
|
75
|
+
readonly workUnitLimit: number;
|
|
76
|
+
/** The host's largest authored budget, reported as `details.maximumLimit` on `MATCHER_TIMEOUT`. */
|
|
77
|
+
readonly maximumWorkUnitLimit?: number;
|
|
78
|
+
};
|
|
79
|
+
/** One authored matcher call lowered and evaluated by Rust in one engine call. @public */
|
|
80
|
+
type GeoSpecNativeClaimOptions = GeoSpecNativeClaimContext & ({
|
|
81
|
+
readonly arguments: readonly unknown[];
|
|
82
|
+
readonly capability: GeoSpecFixedMatcherName;
|
|
83
|
+
} | {
|
|
84
|
+
readonly arguments: readonly unknown[];
|
|
85
|
+
readonly capability: string;
|
|
86
|
+
readonly kind: string;
|
|
87
|
+
});
|
|
88
|
+
declare const geoSpecQueryCapabilities: readonly ["analyzeMesh", "analyzeBrep", "inspectGeometry", "analyzeMeshOverlap", "queryPmi", "minimumDistance"];
|
|
89
|
+
/** Existing positive-only ancillary operations owned by the native core. @public */
|
|
90
|
+
type GeoSpecQueryCapability = Exclude<(typeof geoSpecQueryCapabilities)[number], 'minimumDistance'>;
|
|
91
|
+
/**
|
|
92
|
+
* Flat native query transport options. Payloads use the existing authoring
|
|
93
|
+
* serializer, including ordinary RegExp values; omitted payloads encode null.
|
|
94
|
+
* The core validates selectors, pairs and all operation-specific constraints.
|
|
95
|
+
* @public
|
|
96
|
+
*/
|
|
97
|
+
type GeoSpecNativeQueryOptions = Omit<GeoSpecNativeClaimOptions, 'arguments' | 'capability' | 'kind' | 'polarity'> & {
|
|
98
|
+
readonly capability: GeoSpecQueryCapability | 'minimumDistance';
|
|
99
|
+
readonly payload?: unknown;
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* Submit an ancillary query with positive polarity through the native core.
|
|
103
|
+
*
|
|
104
|
+
* Queries return full reports even when failed or refused. Protocol errors
|
|
105
|
+
* propagate unchanged. Rust owns defaults, validation and canonical encoding.
|
|
106
|
+
*
|
|
107
|
+
* @param options - Query identity, subject and authored payload.
|
|
108
|
+
* @returns The complete report with exact canonical claim, plan and result bytes.
|
|
109
|
+
* @public
|
|
110
|
+
*/
|
|
111
|
+
declare const evaluateGeoSpecNativeQuery: (options: GeoSpecNativeQueryOptions) => GeoSpecCanonicalClaimReport;
|
|
112
|
+
//#endregion
|
|
113
|
+
export { GeoSpecCanonicalClaimReport, GeoSpecCanonicalClaimStatus, GeoSpecClaimPolarity, GeoSpecNativeClaimEvaluation, GeoSpecNativeClaimOptions, GeoSpecNativeEngine, GeoSpecNativeEvidenceProfile, GeoSpecNativeQueryOptions, GeoSpecNativeSubject, GeoSpecQueryCapability, evaluateGeoSpecNativeQuery, geoSpecMaximumWorkUnitLimit, resolveGeoSpecMaximumWorkUnitLimit };
|
|
@@ -0,0 +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};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { GeoSpecMatcherDescriptor, GeoSpecMatcherExpectedShape, GeoSpecMatcherMode, GeoSpecMatcherName, geoSpecMatcherDescriptors, normalizeGeoSpecExpected } from "./matchers.mjs";
|
|
2
|
+
import { assertGeoSpecJsonValue, decodeGeoSpecCanonicalJson, encodeGeoSpecCanonicalJson, isGeoSpecJsonValue, toGeoSpecProtocolJson } from "./protocol.mjs";
|
|
3
|
+
export { type GeoSpecMatcherDescriptor, type GeoSpecMatcherExpectedShape, type GeoSpecMatcherMode, type GeoSpecMatcherName, assertGeoSpecJsonValue, decodeGeoSpecCanonicalJson, encodeGeoSpecCanonicalJson, geoSpecMatcherDescriptors, isGeoSpecJsonValue, normalizeGeoSpecExpected, toGeoSpecProtocolJson };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{assertGeoSpecJsonValue as e,decodeGeoSpecCanonicalJson as t,encodeGeoSpecCanonicalJson as n,isGeoSpecJsonValue as r,toGeoSpecProtocolJson as i}from"./protocol.mjs";import{geoSpecMatcherDescriptors as a,normalizeGeoSpecExpected as o}from"./matchers.mjs";export{e as assertGeoSpecJsonValue,t as decodeGeoSpecCanonicalJson,n as encodeGeoSpecCanonicalJson,a as geoSpecMatcherDescriptors,r as isGeoSpecJsonValue,o as normalizeGeoSpecExpected,i as toGeoSpecProtocolJson};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { GeoSpecAssertion, GeoSpecMatcher } from "../runner/types.mjs";
|
|
2
|
+
//#region src/engine/matchers.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Every matcher name exposed by `expectGeo(...)`.
|
|
5
|
+
*
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
type GeoSpecMatcherName = Exclude<keyof GeoSpecMatcher, 'not'>;
|
|
9
|
+
/**
|
|
10
|
+
* How the substrate derives an assertion's recorded `expected` value from the
|
|
11
|
+
* arguments the spec author passed. Data, not code, so the registry stays
|
|
12
|
+
* emittable to non-TypeScript clients (DL13).
|
|
13
|
+
*
|
|
14
|
+
* - `first` — the first argument verbatim.
|
|
15
|
+
* - `first-or-empty` — the first argument, defaulting to `{}`.
|
|
16
|
+
* - `bounds` — `(min, max)` pairs collapse to `{ min, max }`; a lone object
|
|
17
|
+
* argument passes through.
|
|
18
|
+
* - `true` — nullary matchers record the literal `true`.
|
|
19
|
+
*
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
type GeoSpecMatcherExpectedShape = 'first' | 'first-or-empty' | 'bounds' | 'true';
|
|
23
|
+
/**
|
|
24
|
+
* Whether a matcher settles synchronously (throwing its
|
|
25
|
+
* `GeoSpecAssertionError` inside the `it()` body) or asynchronously (settled
|
|
26
|
+
* before the test completes). Part of the contract: it decides whether the
|
|
27
|
+
* deterministic work-unit budget (R13) brackets the evaluation.
|
|
28
|
+
*
|
|
29
|
+
* @public
|
|
30
|
+
*/
|
|
31
|
+
type GeoSpecMatcherMode = 'sync' | 'async';
|
|
32
|
+
/**
|
|
33
|
+
* One matcher's contract entry.
|
|
34
|
+
*
|
|
35
|
+
* @public
|
|
36
|
+
*/
|
|
37
|
+
type GeoSpecMatcherDescriptor = {
|
|
38
|
+
readonly kind: GeoSpecAssertion['kind'];
|
|
39
|
+
readonly expected: GeoSpecMatcherExpectedShape;
|
|
40
|
+
readonly mode: GeoSpecMatcherMode;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* The 26-entry matcher registry. Insertion order is contract: it fixes
|
|
44
|
+
* `geoSpecMatcherNames`, which `libs/api-extractor` and the LLM prompt
|
|
45
|
+
* pipeline consume.
|
|
46
|
+
*
|
|
47
|
+
* @public
|
|
48
|
+
*/
|
|
49
|
+
declare const geoSpecMatcherDescriptors: Readonly<{ [Name in GeoSpecMatcherName]: Name extends GeoSpecFixedMatcherName ? GeoSpecFixedMatcherDescriptor & {
|
|
50
|
+
readonly kind: Name;
|
|
51
|
+
} : GeoSpecMatcherDescriptor; }>;
|
|
52
|
+
/** A canonical fixed-contract matcher. @public */
|
|
53
|
+
type GeoSpecFixedMatcherDescriptor = {
|
|
54
|
+
readonly contract: 'geospec.plate-two-windows/v1' | 'geospec.pmi.parallel-plane-distance/v1';
|
|
55
|
+
readonly expected: 'true';
|
|
56
|
+
readonly mode: 'sync';
|
|
57
|
+
};
|
|
58
|
+
/** Every canonical fixed-contract matcher name. @public */
|
|
59
|
+
type GeoSpecFixedMatcherName = 'toSatisfyRationalPlate' | 'toSatisfyParallelPlaneDistance';
|
|
60
|
+
/**
|
|
61
|
+
* Derive the `expected` value an assertion records from the call arguments.
|
|
62
|
+
*
|
|
63
|
+
* @param shape - Normalization shape from the matcher's registry entry.
|
|
64
|
+
* @param callArguments - Arguments the spec author passed, in order.
|
|
65
|
+
* @returns The value recorded as the assertion's `expected`.
|
|
66
|
+
* @public
|
|
67
|
+
*/
|
|
68
|
+
declare const normalizeGeoSpecExpected: (shape: GeoSpecMatcherExpectedShape, callArguments: readonly unknown[]) => unknown;
|
|
69
|
+
//#endregion
|
|
70
|
+
export { GeoSpecFixedMatcherDescriptor, GeoSpecFixedMatcherName, GeoSpecMatcherDescriptor, GeoSpecMatcherExpectedShape, GeoSpecMatcherMode, GeoSpecMatcherName, geoSpecMatcherDescriptors, normalizeGeoSpecExpected };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=Object.freeze({toHaveBoundingBox:{kind:`boundingBox`,expected:`bounds`,mode:`sync`},toHaveConnectedComponents:{kind:`connectedComponents`,expected:`first`,mode:`sync`},toBeWatertight:{kind:`watertight`,expected:`true`,mode:`sync`},toHaveNoComponentInterference:{kind:`componentInterference`,expected:`first-or-empty`,mode:`sync`},toHaveAssemblyOccurrences:{kind:`assemblyOccurrences`,expected:`first`,mode:`sync`},toHaveSpatialRelationships:{kind:`spatialRelationships`,expected:`first`,mode:`sync`},toHaveMeshIntegrity:{kind:`meshIntegrity`,expected:`first`,mode:`sync`},toHaveNoDiagnostics:{kind:`noDiagnostics`,expected:`first-or-empty`,mode:`sync`},toHaveSurfaceArea:{kind:`surfaceArea`,expected:`first`,mode:`sync`},toHaveVolume:{kind:`volume`,expected:`first`,mode:`sync`},toHaveMass:{kind:`mass`,expected:`first`,mode:`sync`},toHaveCenterOfMass:{kind:`centerOfMass`,expected:`first`,mode:`sync`},toBeValidBrep:{kind:`validBrep`,expected:`first-or-empty`,mode:`sync`},toHaveTopologyCounts:{kind:`topologyCounts`,expected:`first`,mode:`sync`},toHaveStepUnits:{kind:`stepUnits`,expected:`first`,mode:`sync`},toHaveProductStructure:{kind:`productStructure`,expected:`first`,mode:`sync`},toHavePlanarFace:{kind:`planarFace`,expected:`first`,mode:`sync`},toHaveCylindricalFace:{kind:`cylindricalFace`,expected:`first`,mode:`sync`},toHaveCircularHole:{kind:`circularHole`,expected:`first`,mode:`sync`},toHaveCircularHolePattern:{kind:`circularHolePattern`,expected:`first`,mode:`sync`},toHaveChamferFeature:{kind:`chamferFeature`,expected:`first`,mode:`sync`},toHaveFilletFeature:{kind:`filletFeature`,expected:`first`,mode:`sync`},toHaveMinimumWallThickness:{kind:`minimumWallThickness`,expected:`first`,mode:`sync`},toHaveVoidContinuity:{kind:`voidContinuity`,expected:`first`,mode:`sync`},toSatisfyRationalPlate:{kind:`toSatisfyRationalPlate`,contract:`geospec.plate-two-windows/v1`,expected:`true`,mode:`sync`},toSatisfyParallelPlaneDistance:{kind:`toSatisfyParallelPlaneDistance`,contract:`geospec.pmi.parallel-plane-distance/v1`,expected:`true`,mode:`sync`}}),t=(e,t)=>{switch(e){case`true`:return!0;case`first-or-empty`:return t[0]??{};case`bounds`:return t[1]===void 0?t[0]:{min:t[0],max:t[1]};default:return t[0]}};export{e as geoSpecMatcherDescriptors,t as normalizeGeoSpecExpected};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
//#region src/engine/pmi.types.d.ts
|
|
2
|
+
/** Explicit support state for one source-attributed inventory field. @public */
|
|
3
|
+
type GeoSpecPmiField<Value> = {
|
|
4
|
+
readonly status: 'supported' | 'missing' | 'invalid' | 'ambiguous' | 'unsupported';
|
|
5
|
+
readonly value: Value | null;
|
|
6
|
+
readonly reason: string | null;
|
|
7
|
+
};
|
|
8
|
+
/** Original Part21 entity ID and exact source argument tokens. @public */
|
|
9
|
+
type GeoSpecPmiRawEntity = {
|
|
10
|
+
readonly sourceId: number;
|
|
11
|
+
readonly kind: string;
|
|
12
|
+
readonly arguments: readonly string[];
|
|
13
|
+
};
|
|
14
|
+
/** Source-authored scalar and Rust-normalized reduced rational millimetres. @public */
|
|
15
|
+
type GeoSpecPmiNumber = {
|
|
16
|
+
readonly sourceId: number;
|
|
17
|
+
readonly authoredText: string;
|
|
18
|
+
readonly unitId: number;
|
|
19
|
+
readonly unitRecords: readonly GeoSpecPmiRawEntity[];
|
|
20
|
+
readonly millimetres: string;
|
|
21
|
+
readonly name: string;
|
|
22
|
+
};
|
|
23
|
+
/** A uniquely forward-transferred face; null occurrence denotes the whole part. @public */
|
|
24
|
+
type GeoSpecPmiFaceAssociation = {
|
|
25
|
+
readonly sourceFaceId: number;
|
|
26
|
+
readonly occurrenceRoute: readonly number[];
|
|
27
|
+
readonly occurrence: number | null;
|
|
28
|
+
readonly publicFaceOrdinal: number;
|
|
29
|
+
};
|
|
30
|
+
/** One ordered role reference, including incomplete source/transfer evidence. @public */
|
|
31
|
+
type GeoSpecPmiShapeReference = {
|
|
32
|
+
readonly sourceAspectId: number | null;
|
|
33
|
+
readonly sourceUsageIds: readonly number[];
|
|
34
|
+
readonly sourceItemIds: readonly number[];
|
|
35
|
+
readonly requestedRoute: GeoSpecPmiField<readonly number[]>;
|
|
36
|
+
readonly associations: GeoSpecPmiField<readonly GeoSpecPmiFaceAssociation[]>;
|
|
37
|
+
};
|
|
38
|
+
/** Normalized authored limits; never an inferred geometric conformance verdict. @public */
|
|
39
|
+
type GeoSpecPmiLimits = {
|
|
40
|
+
readonly lowerMillimetres: string;
|
|
41
|
+
readonly upperMillimetres: string;
|
|
42
|
+
readonly basis: 'authored-limits' | 'nominal-plus-minus';
|
|
43
|
+
};
|
|
44
|
+
/** Source record preserving semantic/presentation separation and ordered roles. @public */
|
|
45
|
+
type GeoSpecPmiRecord = {
|
|
46
|
+
readonly sourceId: number;
|
|
47
|
+
readonly family: 'dimension' | 'datum' | 'tolerance' | 'presentation';
|
|
48
|
+
readonly channel: 'semantic' | 'presentation';
|
|
49
|
+
readonly kind: string;
|
|
50
|
+
readonly name: GeoSpecPmiField<string>;
|
|
51
|
+
readonly first: readonly GeoSpecPmiShapeReference[];
|
|
52
|
+
readonly second: readonly GeoSpecPmiShapeReference[];
|
|
53
|
+
readonly numbers: GeoSpecPmiField<readonly GeoSpecPmiNumber[]>;
|
|
54
|
+
readonly limits: GeoSpecPmiField<GeoSpecPmiLimits>;
|
|
55
|
+
readonly interpretation: GeoSpecPmiField<string>;
|
|
56
|
+
readonly raw: readonly GeoSpecPmiRawEntity[];
|
|
57
|
+
};
|
|
58
|
+
/** Positive-only inventory value inside the ordinary canonical query report. @public */
|
|
59
|
+
type GeoSpecPmiInventory = {
|
|
60
|
+
readonly contract: 'geospec.pmi.inventory/v1';
|
|
61
|
+
readonly status: 'semantic' | 'graphical-only' | 'empty';
|
|
62
|
+
readonly fileSchema: string;
|
|
63
|
+
readonly editionValidation: 'not-validated';
|
|
64
|
+
readonly records: readonly GeoSpecPmiRecord[];
|
|
65
|
+
};
|
|
66
|
+
/** Strict inventory output limits. Exceeding either refuses without truncation. @public */
|
|
67
|
+
type GeoSpecPmiQueryPayload = {
|
|
68
|
+
readonly maxRecords?: number;
|
|
69
|
+
readonly maxOutputBytes?: number;
|
|
70
|
+
};
|
|
71
|
+
/** Complete inventory value; provenance is the unchanged core identity descriptor. @public */
|
|
72
|
+
type GeoSpecPmiQueryValue = {
|
|
73
|
+
readonly inventory: GeoSpecPmiInventory;
|
|
74
|
+
readonly subjectHash: string;
|
|
75
|
+
readonly provenance: Readonly<Record<string, unknown>>;
|
|
76
|
+
};
|
|
77
|
+
//#endregion
|
|
78
|
+
export { GeoSpecPmiFaceAssociation, GeoSpecPmiField, GeoSpecPmiInventory, GeoSpecPmiLimits, GeoSpecPmiNumber, GeoSpecPmiQueryPayload, GeoSpecPmiQueryValue, GeoSpecPmiRawEntity, GeoSpecPmiRecord, GeoSpecPmiShapeReference };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { JSONValue } from "@taucad/runtime/types";
|
|
2
|
+
//#region src/engine/protocol.d.ts
|
|
3
|
+
/** Runtime JSON-value guard used at every protocol trust boundary. @public */
|
|
4
|
+
declare const isGeoSpecJsonValue: (value: unknown, ancestors?: Set<WeakKey>) => value is JSONValue;
|
|
5
|
+
/** Reject a non-wire value rather than letting JSON.stringify erase it. @public */
|
|
6
|
+
declare const assertGeoSpecJsonValue: (value: unknown) => asserts value is JSONValue;
|
|
7
|
+
/** Encode client-owned canonical claim bytes. @public */
|
|
8
|
+
declare const encodeGeoSpecCanonicalJson: (value: JSONValue) => Uint8Array<ArrayBuffer>;
|
|
9
|
+
/** Parse and validate canonical bytes without re-canonicalizing them. @public */
|
|
10
|
+
declare const decodeGeoSpecCanonicalJson: (bytes: Uint8Array<ArrayBuffer>) => JSONValue;
|
|
11
|
+
/**
|
|
12
|
+
* Convert an authoring value to protocol JSON, including the two explicit
|
|
13
|
+
* bindings the TypeScript client needs: regex data and opaque subject refs.
|
|
14
|
+
* Unsupported live objects fail before a request reaches the engine.
|
|
15
|
+
*
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
declare const toGeoSpecProtocolJson: (value: unknown, ancestors?: Set<WeakKey>) => JSONValue;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { assertGeoSpecJsonValue, decodeGeoSpecCanonicalJson, encodeGeoSpecCanonicalJson, isGeoSpecJsonValue, toGeoSpecProtocolJson };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=e=>{if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},t=(n,r=new Set)=>{if(n===null||typeof n==`string`||typeof n==`boolean`)return!0;if(typeof n==`number`)return Number.isFinite(n);if(!Array.isArray(n)&&!e(n)||r.has(n))return!1;r.add(n);let i=Array.isArray(n)?n.every(e=>t(e,r)):e(n)&&Object.values(n).every(e=>t(e,r));return r.delete(n),i},n=e=>{if(!t(e))throw TypeError(`GeoSpec protocol values must contain only finite JSON data.`)},r=e=>Array.isArray(e)?e.map(e=>r(e)):typeof e==`object`&&e?Object.fromEntries(Object.entries(e).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>[e,r(t)])):e,i=e=>(n(e),new TextEncoder().encode(JSON.stringify(r(e)))),a=e=>{let t=JSON.parse(new TextDecoder().decode(e));return n(t),t},o=(t,n=new Set)=>{if(t==null)return null;if(typeof t==`string`||typeof t==`boolean`)return t;if(typeof t==`number`){if(!Number.isFinite(t))throw TypeError(`GeoSpec claims cannot contain non-finite numbers.`);return t}if(t instanceof RegExp)return{type:`regexp`,pattern:t.source,flags:t.flags};if(typeof t!=`object`||n.has(t))throw TypeError(`GeoSpec claims cannot contain functions, symbols, bigint values, or cycles.`);let r=Reflect.get(t,`subjectId`);if(typeof r==`string`)return{type:`subject-reference`,subjectId:r};if(n.add(t),Array.isArray(t)){let e=t.map(e=>o(e,n));return n.delete(t),e}if(!e(t))throw TypeError(`GeoSpec claims cannot contain class instances.`);let i={};for(let[e,r]of Object.entries(t))r!==void 0&&(i[e]=o(r,n));return n.delete(t),i};export{n as assertGeoSpecJsonValue,a as decodeGeoSpecCanonicalJson,i as encodeGeoSpecCanonicalJson,t as isGeoSpecJsonValue,o as toGeoSpecProtocolJson};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/geometry-unit.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Geometry units accepted at GeoSpec evidence-loading boundaries.
|
|
4
|
+
*
|
|
5
|
+
* Loaded subjects normalize coordinates into canonical millimetres; this type
|
|
6
|
+
* describes source and provenance units, not a project-wide configuration.
|
|
7
|
+
*
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
type GeoSpecUnit = 'mm' | 'cm' | 'm' | 'in' | 'ft' | (string & {});
|
|
11
|
+
//#endregion
|
|
12
|
+
export { GeoSpecUnit };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { GeoSpecUnit } from "./geometry-unit.mjs";
|
|
2
|
+
import { BrepEvidence, GeometryCapability, GeometryDiagnostic, GeometryFileFormat, GeometryProvenance, GeometrySource, GeometrySubject, GeometrySubjectMeshEvidence, MeshEvidence, MeshFileFormat, MeshQualityStats, MeshTriangle, StepEvidence, Vec3 } from "./mesh/types.mjs";
|
|
3
|
+
import { GeoSpecSubject } from "./model/subject.mjs";
|
|
4
|
+
import { GeoSpecAssemblyOccurrenceExpectation, GeoSpecAssemblyOccurrencesExpectation, GeoSpecAssertion, GeoSpecAxisExpectation, GeoSpecBoundingBoxExpectation, GeoSpecCenterOfMassExpectation, GeoSpecChamferFeatureExpectation, GeoSpecCircularHoleExpectation, GeoSpecCircularHolePatternExpectation, GeoSpecComponentInterferenceAllowance, GeoSpecComponentInterferenceExpectation, GeoSpecComponentInterferencePairExpectation, GeoSpecConnectedComponentsExpectation, GeoSpecCylindricalFaceExpectation, GeoSpecExpectOptions, GeoSpecFilletFeatureExpectation, GeoSpecGeometrySelector, GeoSpecMassExpectation, GeoSpecMatcher, GeoSpecMeshIntegrityExpectation, GeoSpecMinimumWallThicknessExpectation, GeoSpecNoDiagnosticsExpectation, GeoSpecNumericExpectation, GeoSpecPlanarFaceExpectation, GeoSpecPointExpectation, GeoSpecProductStructureExpectation, GeoSpecSpatialRelationshipExpectation, GeoSpecSpatialRelationshipsExpectation, GeoSpecStepUnitsExpectation, GeoSpecSurfaceAreaExpectation, GeoSpecTopologyCountsExpectation, GeoSpecValidBrepExpectation, GeoSpecVoidContinuityExpectation, GeoSpecVoidWaypoint, GeoSpecVolumeExpectation } from "./runner/types.mjs";
|
|
5
|
+
import { describe, expectGeo, geoSpecMatcherNames, it, test } from "./create-geospec.mjs";
|
|
6
|
+
export { type BrepEvidence, type GeoSpecAssemblyOccurrenceExpectation, type GeoSpecAssemblyOccurrencesExpectation, type GeoSpecAssertion, type GeoSpecAxisExpectation, type GeoSpecBoundingBoxExpectation, type GeoSpecCenterOfMassExpectation, type GeoSpecChamferFeatureExpectation, type GeoSpecCircularHoleExpectation, type GeoSpecCircularHolePatternExpectation, type GeoSpecComponentInterferenceAllowance, type GeoSpecComponentInterferenceExpectation, type GeoSpecComponentInterferencePairExpectation, type GeoSpecConnectedComponentsExpectation, type GeoSpecCylindricalFaceExpectation, type GeoSpecExpectOptions, type GeoSpecFilletFeatureExpectation, type GeoSpecGeometrySelector, type GeoSpecMassExpectation, type GeoSpecMatcher, type GeoSpecMeshIntegrityExpectation, type GeoSpecMinimumWallThicknessExpectation, type GeoSpecNoDiagnosticsExpectation, type GeoSpecNumericExpectation, type GeoSpecPlanarFaceExpectation, type GeoSpecPointExpectation, type GeoSpecProductStructureExpectation, type GeoSpecSpatialRelationshipExpectation, type GeoSpecSpatialRelationshipsExpectation, type GeoSpecStepUnitsExpectation, type GeoSpecSubject, type GeoSpecSurfaceAreaExpectation, type GeoSpecTopologyCountsExpectation, type GeoSpecUnit, type GeoSpecValidBrepExpectation, type Vec3 as GeoSpecVec3, type GeoSpecVoidContinuityExpectation, type GeoSpecVoidWaypoint, type GeoSpecVolumeExpectation, type GeometryCapability, type GeometryDiagnostic, type GeometryFileFormat, type GeometryProvenance, type GeometrySource, type GeometrySubject, type GeometrySubjectMeshEvidence, type MeshEvidence, type MeshFileFormat, type MeshQualityStats, type MeshTriangle, type StepEvidence, type Vec3, describe, expectGeo, geoSpecMatcherNames, it, test };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{describe as e,expectGeo as t,geoSpecMatcherNames as n,it as r,test as i}from"./create-geospec.mjs";export{e as describe,t as expectGeo,n as geoSpecMatcherNames,r as it,i as test};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { GeoSpecUnit } from "../geometry-unit.mjs";
|
|
2
|
+
import { AabbMeters, BoundingBoxAxisExtremum, BoundingBoxAxisFailure, BoundingBoxFailure, BoundingBoxStats, BrepEvidence, CheckResult, ClusterGap, ClusterReport, ConnectedComponentsFailure, ConnectedComponentsResult, GeometryCapability, GeometryDiagnostic, GeometryEvidenceDiagnostic, GeometryFileFormat, GeometryProvenance, GeometrySource, GeometryStats, GeometrySubject, GeometrySubjectMeshEvidence, MeshEvidence, MeshFileFormat, MeshQualityStats, MeshTriangle, PrimitiveRecord, StepEvidence, Vec3, WatertightFailure, WatertightIrregularEdgeCluster, WatertightIrregularEdgeKind, WatertightIrregularEdgeSample, WatertightPrimitiveBreakdown, WatertightResult } from "./types.mjs";
|
|
3
|
+
import { MeshBufferSource, MeshSource } from "../model/types.mjs";
|
|
4
|
+
export type { AabbMeters, BoundingBoxAxisExtremum, BoundingBoxAxisFailure, BoundingBoxFailure, BoundingBoxStats, BrepEvidence, CheckResult, ClusterGap, ClusterReport, ConnectedComponentsFailure, ConnectedComponentsResult, GeoSpecUnit, GeometryCapability, GeometryDiagnostic, GeometryEvidenceDiagnostic, GeometryFileFormat, GeometryProvenance, GeometrySource, GeometryStats, GeometrySubject, GeometrySubjectMeshEvidence, MeshBufferSource, MeshEvidence, MeshFileFormat, MeshQualityStats, MeshSource, MeshTriangle, PrimitiveRecord, StepEvidence, Vec3, WatertightFailure, WatertightIrregularEdgeCluster, WatertightIrregularEdgeKind, WatertightIrregularEdgeSample, WatertightPrimitiveBreakdown, WatertightResult };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{};
|