geospec 0.0.0 → 0.1.0-beta.2
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 +47 -0
- package/agent/geospec-authoring/SKILL.md +496 -0
- package/agent/geospec-authoring/api-classes.md +13 -0
- package/agent/geospec-authoring/api-constants.md +6 -0
- package/agent/geospec-authoring/api-functions.md +49 -0
- package/agent/geospec-authoring/api-index.md +362 -0
- package/agent/geospec-authoring/api-types.md +1700 -0
- package/agent/geospec-authoring/public-api-classes.md +22 -0
- package/agent/geospec-authoring/public-api-constants.md +19 -0
- package/agent/geospec-authoring/public-api-functions.md +196 -0
- package/agent/geospec-authoring/public-api-index.md +856 -0
- package/agent/geospec-authoring/public-api-types-2.md +1513 -0
- package/agent/geospec-authoring/public-api-types.md +2048 -0
- package/agent/resources.d.ts +19 -0
- package/agent/resources.js +26 -0
- package/agent/skills.d.cts +13 -0
- package/agent/skills.json +27 -0
- package/dist/assertion-client/client.d.mts +124 -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 +49 -0
- package/dist/create-geospec.mjs +1 -0
- package/dist/engine/client.d.mts +93 -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 +63 -0
- package/dist/model/export-intent.mjs +1 -0
- package/dist/model/index.d.mts +6 -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 +119 -0
- package/dist/model/native-model-loader.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 +207 -0
- package/dist/runner/collector.d.mts +62 -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 +6 -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/types.d.mts +743 -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 +146 -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 @@
|
|
|
1
|
+
import{bindGeoSpecSubject as e,rawSubjectResidency as t}from"./subject.mjs";import{createGeoSpecAssertionClient as n}from"../assertion-client/client.mjs";import{GeoSpecModelLoadError as r}from"./errors.mjs";import{createGeoSpecNativeModelLoader as i}from"./native-model-loader.mjs";async function a(e){throw new r([{code:`GEOSPEC_MODEL_LOADER_UNAVAILABLE`,severity:`error`,message:`No GeoSpec model loader is active outside a GeoSpec runner.`,suggestion:`Run this test through the GeoSpec CLI or Tau test runner, or call createModelLoader({ engine }).`}])}const o=r=>{let{engine:a,readSource:o,format:s,...c}=r,l={...c,...s===void 0?{}:{format:s}},u=i({...c,engine:a,...o===void 0?{}:{readSource:o}}),d=n({engine:a}),f=0;return Object.assign(async n=>{let r=f,i=await u({...l,...n}),o=t(i);return e({client:d,engine:a,identity:{subjectHash:i.subjectHash},...i.load===void 0?{}:{load:i.load},isLive:()=>f===r,...o===void 0?{}:{ensureResident:o}})},{async dispose(){try{await u.releaseAll()}finally{f+=1}}})};export{o as createModelLoader,a as loadModel};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { GeoSpecModelFormat, GeoSpecRuntimeClient, GeoSpecRuntimeClientFactory, GeoSpecRuntimeSourceAdapter, LoadModelOptions, LoadModelSourceOptions } from "./types.mjs";
|
|
2
|
+
import { GeoSpecNativeEngine, GeoSpecNativeSubject } from "../engine/client.mjs";
|
|
3
|
+
import "../assertion-client/index.mjs";
|
|
4
|
+
import { SourceRevision } from "@taucad/runtime/types";
|
|
5
|
+
//#region src/model/native-model-loader.d.ts
|
|
6
|
+
/** Native engine operations required for model admission and run-level cleanup. @public */
|
|
7
|
+
type GeoSpecNativeModelEngine = GeoSpecNativeEngine & {
|
|
8
|
+
ingestSubject(request: Uint8Array<ArrayBuffer>, primary: Uint8Array<ArrayBuffer>, resources: ReadonlyArray<Uint8Array<ArrayBuffer>>): Uint8Array<ArrayBuffer>;
|
|
9
|
+
subjectHandle(request: Uint8Array<ArrayBuffer>): Uint8Array<ArrayBuffer>;
|
|
10
|
+
releaseSubject(request: Uint8Array<ArrayBuffer>): Uint8Array<ArrayBuffer>;
|
|
11
|
+
};
|
|
12
|
+
/** One named external resource referenced by a direct glTF-family source. @public */
|
|
13
|
+
type GeoSpecNativeModelResource = {
|
|
14
|
+
readonly name: string;
|
|
15
|
+
readonly source: LoadModelSourceOptions['source'];
|
|
16
|
+
};
|
|
17
|
+
/** Native additions accepted by the injected `geospec/runner/native` loader. @public */
|
|
18
|
+
type GeoSpecNativeLoadModelOptions<Code extends Record<string, string> = Record<string, string>> = LoadModelOptions<Code> & {
|
|
19
|
+
/** Ordered external resource payloads declared to the native admission request. */
|
|
20
|
+
readonly resources?: readonly GeoSpecNativeModelResource[];
|
|
21
|
+
/** Format-specific native ingest options. */
|
|
22
|
+
readonly ingestOptions?: Readonly<Record<string, unknown>>;
|
|
23
|
+
};
|
|
24
|
+
/** Subject identity returned by native STEP/GLB admission. @public */
|
|
25
|
+
type GeoSpecNativeModelSubject = GeoSpecNativeSubject & {
|
|
26
|
+
readonly subjectHash: string;
|
|
27
|
+
/** Exact successful-load evidence retained by the admitting host, when available. */
|
|
28
|
+
readonly load?: GeoSpecModelLoadEvidence;
|
|
29
|
+
};
|
|
30
|
+
/** Immutable identity of the inputs and artifacts consumed by one model load. @public */
|
|
31
|
+
type GeoSpecModelLoadEvidence = {
|
|
32
|
+
readonly loadId: string;
|
|
33
|
+
readonly status: 'complete' | 'unavailable';
|
|
34
|
+
readonly format: string;
|
|
35
|
+
readonly parameters: Readonly<Record<string, unknown>>;
|
|
36
|
+
readonly exportOptions?: Readonly<Record<string, unknown>>;
|
|
37
|
+
readonly ingestOptions: Readonly<Record<string, unknown>>;
|
|
38
|
+
readonly sourceRevision?: SourceRevision;
|
|
39
|
+
/** Actual direct-source locator, when the load read one; absent for anonymous in-memory bytes. */
|
|
40
|
+
readonly sourcePath?: string;
|
|
41
|
+
readonly artifacts: ReadonlyArray<{
|
|
42
|
+
readonly name: string;
|
|
43
|
+
readonly sha256: string;
|
|
44
|
+
readonly byteLength: number;
|
|
45
|
+
/** Actual source locator consumed by a direct load; absent for bytes and Runtime exports. */
|
|
46
|
+
readonly sourcePath?: string;
|
|
47
|
+
}>;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Resolve a non-memory source into ordinary ArrayBuffer-backed bytes.
|
|
51
|
+
*
|
|
52
|
+
* The loader takes ownership of the returned bytes and admits them without a
|
|
53
|
+
* copy, so a reader must return bytes that nothing mutates afterwards (a fresh
|
|
54
|
+
* read, not a view of a shared or reused buffer).
|
|
55
|
+
*
|
|
56
|
+
* @public
|
|
57
|
+
*/
|
|
58
|
+
type GeoSpecNativeSourceReader = (source: LoadModelSourceOptions['source']) => Promise<Uint8Array<ArrayBuffer>>;
|
|
59
|
+
/** Defaults and host dependencies for a managed native model loader. @public */
|
|
60
|
+
type CreateGeoSpecNativeModelLoaderOptions = {
|
|
61
|
+
readonly engine: GeoSpecNativeModelEngine;
|
|
62
|
+
readonly format?: Extract<GeoSpecModelFormat, 'glb' | 'step' | 'stp'>;
|
|
63
|
+
readonly projectPath?: string;
|
|
64
|
+
readonly readSource?: GeoSpecNativeSourceReader;
|
|
65
|
+
readonly runtime?: GeoSpecRuntimeClient | GeoSpecRuntimeClientFactory;
|
|
66
|
+
readonly sourceAdapters?: readonly GeoSpecRuntimeSourceAdapter[];
|
|
67
|
+
/**
|
|
68
|
+
* Subject handles carried between the release scopes of loaders that share one engine, keyed by
|
|
69
|
+
* subjectHash. With a carrier, `releaseAll` keeps this scope's subjects for the next scope and
|
|
70
|
+
* releases only the previous scope's subjects this scope did not load again, so reloading
|
|
71
|
+
* unchanged bytes in the next scope is digest-only. Share one carrier per engine and run its
|
|
72
|
+
* scopes one at a time: a scope's release touches only subjects whose scope has settled.
|
|
73
|
+
*/
|
|
74
|
+
readonly carried?: Map<string, unknown>;
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Model loader injected into native VM runs.
|
|
78
|
+
*
|
|
79
|
+
* The freshness unit is one load: every call reads its source again (the
|
|
80
|
+
* source reader or a Runtime export) and the engine digests those exact bytes.
|
|
81
|
+
* Nothing is deduplicated per run or per scope; bytes equal to an admitted
|
|
82
|
+
* subject's reuse that subject by digest, length and descriptor, and edited
|
|
83
|
+
* bytes admit a new subject. Only concurrent identical inline-code Runtime
|
|
84
|
+
* loads share one in-flight export.
|
|
85
|
+
*
|
|
86
|
+
* @public
|
|
87
|
+
*/
|
|
88
|
+
type GeoSpecNativeModelLoader = <Code extends Record<string, string> = Record<string, string>>(options: GeoSpecNativeLoadModelOptions<Code>) => Promise<GeoSpecNativeModelSubject>;
|
|
89
|
+
/**
|
|
90
|
+
* Reusable native model loader whose admitted subjects can be released as one run.
|
|
91
|
+
* The caller owns the engine and the boundaries between load scopes.
|
|
92
|
+
* @public
|
|
93
|
+
*/
|
|
94
|
+
type ManagedGeoSpecNativeModelLoader = GeoSpecNativeModelLoader & {
|
|
95
|
+
/**
|
|
96
|
+
* Drain registered admissions, including additions while drainage awaits,
|
|
97
|
+
* then release this scope's subjects (with a carrier: the previous scope's
|
|
98
|
+
* subjects this scope did not load again) and owned Runtime clients.
|
|
99
|
+
*
|
|
100
|
+
* Await the intended complete load chain before final release, and await
|
|
101
|
+
* this method before closing the caller-owned engine. Calls after it returns
|
|
102
|
+
* start a new scope requiring another release; future detached loads are not
|
|
103
|
+
* part of the completed scope.
|
|
104
|
+
*
|
|
105
|
+
* @returns Completion of the current scope's admission drain and release.
|
|
106
|
+
*/
|
|
107
|
+
releaseAll(): Promise<void>;
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* Create a native model loader that admits actual STEP/GLB bytes and retains
|
|
111
|
+
* generation-checked handles until the owning runner finishes.
|
|
112
|
+
*
|
|
113
|
+
* @param defaults - Native engine, Runtime defaults, and optional source reader.
|
|
114
|
+
* @returns A loader plus run-level cleanup operation.
|
|
115
|
+
* @public
|
|
116
|
+
*/
|
|
117
|
+
declare const createGeoSpecNativeModelLoader: (defaults: CreateGeoSpecNativeModelLoaderOptions) => ManagedGeoSpecNativeModelLoader;
|
|
118
|
+
//#endregion
|
|
119
|
+
export { CreateGeoSpecNativeModelLoaderOptions, GeoSpecModelLoadEvidence, GeoSpecNativeLoadModelOptions, GeoSpecNativeModelEngine, GeoSpecNativeModelLoader, GeoSpecNativeModelResource, GeoSpecNativeModelSubject, GeoSpecNativeSourceReader, ManagedGeoSpecNativeModelLoader, createGeoSpecNativeModelLoader };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{bindRawSubjectResidency as e}from"./subject.mjs";import{GeoSpecModelLoadError as t}from"./errors.mjs";import{resolveRuntimeExportIntent as n}from"./export-intent.mjs";import{sha256Bytes as r}from"@taucad/runtime/kernel";const i={canonicalProfile:`geospec-jcs-v1`,protocolVersion:3,registryVersion:5},a=new TextEncoder,o=new TextDecoder(`utf-8`,{fatal:!0}),s=new Set([`glb`,`step`,`stp`]),c=new WeakMap,l=16777216,u=e=>e instanceof Error&&`code`in e&&e.code===`limit-exceeded`&&e.message===`Engine exceeds the configured retained subject count.`,d=e=>{let t=c.get(e);if(t!==void 0)return t;let n=_(e.processRequest(h({...i,method:`initialize`,requestId:`configuration`})),`initialize response`),r=g(n.result,`initialize result`);if(n.requestId!==`configuration`||r.protocolVersion!==3||r.registryVersion!==5||r.canonicalProfile!==`geospec-jcs-v1`)throw TypeError(`Native GeoSpec residency requires a compatible initialize profile.`);let a=g(r.configuration,`initialize configuration`),o=g(a.binaryAdmissionLimits,`binary admission limits`),s=[o.maxSubjectBytes,o.maxTotalBinaryBytes].map(e=>{if(typeof e!=`number`||!Number.isSafeInteger(e)||e<=0)throw TypeError(`Native GeoSpec residency requires safe positive binary admission limits.`);return e}),l={inputs:new Map,resident:new Map,binaryLimit:Math.max(...s),binaryBytes:0,descriptorBytes:0};return c.set(e,l),l},f=e=>new t(e),p=e=>({code:e.code,severity:`error`,message:e.message,suggestion:e.suggestion,...e.details===void 0?{}:{details:e.details}}),m=e=>({code:e.code,severity:e.severity,message:e.message,suggestion:`Fix the model source or its Runtime export route, then retry the native run.`}),h=e=>a.encode(JSON.stringify(e)),g=(e,t)=>{if(typeof e!=`object`||!e||Array.isArray(e))throw TypeError(`Native GeoSpec returned a non-object ${t}.`);return e},_=(e,t)=>g(JSON.parse(o.decode(e)),t),v=async(e,t)=>{if(e instanceof Uint8Array)return Uint8Array.from(e);if(e instanceof ArrayBuffer)return Uint8Array.from(new Uint8Array(e));if(typeof Blob<`u`&&e instanceof Blob)return new Uint8Array(await e.arrayBuffer());if(t!==void 0)try{return await t(e)}catch(t){throw f([p({code:`GEOSPEC_NATIVE_SOURCE_READ_FAILED`,message:`The host source reader could not read ${typeof e==`string`?e:`this source`}: ${t instanceof Error?t.message:String(t)}`,suggestion:`Check that the source exists at a project-rooted path and is readable, then retry the load.`,...typeof e==`string`?{details:{source:e}}:{}})])}throw f([p({code:`GEOSPEC_NATIVE_SOURCE_READER_UNAVAILABLE`,message:`The native model loader cannot read this source form without a host source reader.`,suggestion:`Pass in-memory bytes or configure readSource on createGeoSpecNativeModelLoader().`})])},y=e=>`code`in e?{files:e.code,entry:e.file}:{path:e.file},b=(e,t)=>{let n=e.format??t??`glb`;if(!s.has(n))throw f([p({code:`GEOSPEC_NATIVE_MODEL_FORMAT_UNSUPPORTED`,message:`The native model host does not admit '${n}' models.`,suggestion:`Use 'step', 'stp', or 'glb' for native model assertions.`,details:{format:n}})]);return n},x=t=>{let a=0,o=new Map,s=new Map,x=0,S=new Set,C=new Map,w=new Set,T=new Map,E=e=>(a+=1,`geospec-native-model:${e}:${a}`),D=e=>(e.sourceAdapters??t.sourceAdapters)?.find(t=>t.extensions.some(t=>e.file.endsWith(t))),O=async e=>{let n=e.runtime??t.runtime;if(typeof n==`function`){let e=T.get(n);e===void 0&&(e=n(),T.set(n,e));let t=await e;return w.add(t),t}if(n!==void 0)return n;let r=D(e);if(r!==void 0){let n=await r.createRuntime({file:e.file,...(e.projectPath??t.projectPath)===void 0?{}:{projectPath:e.projectPath??t.projectPath}});return w.add(n),n}throw f([p({code:`GEOSPEC_NATIVE_RUNTIME_UNAVAILABLE`,message:`No Tau Runtime is configured to export '${e.file}' for native GeoSpec.`,suggestion:`Pass a Runtime client/factory or a matching source adapter to the native runner.`,details:{file:e.file}})])},k=e=>{t.engine.releaseSubject(h({...i,method:`releaseSubject`,requestId:E(`release`),subjectHandle:e}))},A=(e,n)=>{let r=c.get(t.engine),i=r?.inputs.get(e);if(r!==void 0&&i!==void 0&&(i.cleanupPending?.(),delete i.cleanupPending,i.owners.has(n))){if(i.owners.size>1){i.owners.delete(n);return}i.handle!==void 0&&(k(i.handle),delete i.handle),i.owners.delete(n),r.resident.delete(e),r.inputs.delete(e),r.binaryBytes-=i.resources.reduce((e,t)=>e+t.byteLength,i.primary.byteLength),r.descriptorBytes-=i.request.byteLength}},j=e=>{for(let[t,n]of e.inputs)n.cleanupPending!==void 0&&(n.cleanupPending(),delete n.cleanupPending,delete n.handle,e.resident.delete(t))},M=()=>[...t.carried??[]].filter(([e])=>!o.has(e)),N=(e,n)=>{let r=e.format===`stp`?`step`:e.format,a=d(t.engine);j(a);let c=h({...i,method:`ingestSubject`,requestId:E(`ingest`),format:r,frame:{coordinateSystem:`z-up`,sourceUnit:r===`step`?`auto`:e.sourceUnit??`m`,outputUnit:`mm`},ingestOptions:e.ingestOptions??{},...e.diagnostics===void 0||e.diagnostics.length===0?{}:{diagnostics:e.diagnostics},primaryByteLength:e.primary.byteLength,resources:e.resources.map(({name:e,bytes:t})=>({name:e,byteLength:t.byteLength}))}),f=e.resources.reduce((e,{bytes:t})=>e+t.byteLength,e.primary.byteLength);if(!Number.isSafeInteger(f)||f>a.binaryLimit||c.byteLength>l)throw Object.assign(RangeError(`GeoSpec retained admission input exceeds its byte limit.`),{code:`limit-exceeded`});let p=(e,t)=>e.length===t.length&&e.every((e,n)=>e===t[n]),m={..._(c,`admission request`),requestId:``},v=[...a.inputs.values()].find(t=>{let n={..._(t.request,`retained request`),requestId:``};return JSON.stringify(n)===JSON.stringify(m)&&p(t.primary,e.primary)&&t.resources.length===e.resources.length&&t.resources.every((t,n)=>p(t,e.resources[n].bytes))});if(v===void 0&&(f>a.binaryLimit-a.binaryBytes||c.byteLength>l-a.descriptorBytes))throw Object.assign(RangeError(`GeoSpec live admission snapshots exceed their retained input byte limit.`),{code:`limit-exceeded`});let y=v??{request:Uint8Array.from(c),primary:Uint8Array.from(e.primary),resources:e.resources.map(({bytes:e})=>Uint8Array.from(e)),owners:new Set},b=()=>t.engine.ingestSubject(c,e.primary,e.resources.map(({bytes:e})=>e)),x;try{x=b()}catch(e){let n=M();if(!u(e))throw e;let r=!1;for(let[e,i]of n){let n=a.inputs.get(e);if(n===void 0)k(i),r=!0;else{let i=n.owners.size===1&&n.handle!==void 0;A(e,t.carried),r||=i}t.carried?.delete(e)}if(!r){let t=a.resident.entries().next().value;if(t===void 0)throw e;k(t[1].handle),delete t[1].handle,a.resident.delete(t[0])}x=b()}let S=_(x,`admission response`),C=g(S.result,`admission result`),{subjectHash:w}=g(C.subject,`admitted subject`);if(typeof w!=`string`||!/^[0-9a-f]{64}$/u.test(w))throw TypeError(`Native GeoSpec admission did not return a valid subjectHash.`);let T=_(t.engine.subjectHandle(h({...i,method:`subjectHandle`,requestId:E(`handle`),subjectHash:w})),`subject-handle response`),D=g(T.result,`subject-handle result`).subjectHandle;if(D===void 0)throw TypeError(`Native GeoSpec did not return a subject handle.`);let O=a.inputs.get(w),N=O??y;O===void 0&&(a.inputs.set(w,N),a.binaryBytes+=f,a.descriptorBytes+=N.request.byteLength);for(let e of n)N.owners.add(e),s.set(e,w);return N.handle=D,a.resident.delete(w),a.resident.set(w,N),o.set(w,N),{subjectHash:w}},P=e=>{let n=o.get(e);if(n===void 0)throw TypeError(`This subject is not admitted by the active GeoSpec host.`);let r=d(t.engine);if(j(r),n.handle===void 0){let a=()=>t.engine.ingestSubject(n.request,n.primary,n.resources),o;try{o=a()}catch(e){let t=r.resident.entries().next().value;if(!u(e)||t===void 0)throw e;k(t[1].handle),delete t[1].handle,r.resident.delete(t[0]),o=a()}let s=()=>{let n=g(_(t.engine.subjectHandle(h({...i,method:`subjectHandle`,requestId:E(`restore-handle`),subjectHash:e})),`restored handle`).result,`restored handle result`),r=g(n.subjectHandle,`restored subject handle`);if(r.subjectHash!==e)throw TypeError(`Native GeoSpec restored handle changed its subject identity.`);return r};try{if(g(g(_(o,`restored admission`).result,`restored result`).subject,`restored subject`).subjectHash!==e)throw TypeError(`Native GeoSpec restored admission changed its subject identity.`);n.handle=s()}catch(e){throw n.cleanupPending=()=>{try{k(s())}catch(t){throw AggregateError([e,t],`Native GeoSpec restored admission failed and cleanup remains pending.`,{cause:e})}},n.cleanupPending(),delete n.cleanupPending,e}}r.resident.delete(e),r.resident.set(e,n)},F=async(e,n)=>{let i=b(e,t.format),a=await v(e.source,t.readSource),o=await Promise.all((e.resources??[]).map(async({name:e,source:n})=>({name:e,bytes:await v(n,t.readSource),...typeof n==`string`?{sourcePath:n}:{}}))),s=await Promise.all([{name:e.path??e.name??`primary`,bytes:a,...typeof e.source==`string`?{sourcePath:e.source}:{}},...o].map(async({name:e,bytes:t,sourcePath:n})=>({name:e,sha256:await r(t),byteLength:t.byteLength,...n===void 0?{}:{sourcePath:n}})));return{...N({format:i,primary:a,resources:o,...e.ingestOptions===void 0?{}:{ingestOptions:e.ingestOptions},...e.sourceUnit===void 0?{}:{sourceUnit:e.sourceUnit}},n),load:{loadId:``,status:`complete`,format:i,parameters:e.parameters??{},ingestOptions:e.ingestOptions??{},...typeof e.source==`string`?{sourcePath:e.source}:{},artifacts:s}}},I=async(e,i)=>{for(let t of[`sourceUnit`,`unit`,`scale`,`coordinateSystem`])if(t in e)throw f([p({code:`GEOSPEC_NATIVE_RUNTIME_FRAME_OVERRIDE`,message:`Native Runtime model loading rejects '${t}': the Runtime export intent owns the frame.`,suggestion:`Remove the frame override and let GeoSpec request canonical Z-up millimetre evidence.`,details:{key:t}})]);let a=b(e,t.format),o=a===`stp`?`step`:a,s=await O(e);await s.connect();let c={runtime:s,format:o,...e.meshLinearTolerance===void 0?{}:{meshLinearTolerance:e.meshLinearTolerance},...e.meshAngularToleranceDegrees===void 0?{}:{meshAngularToleranceDegrees:e.meshAngularToleranceDegrees}},l=n(c);if(`success`in l)throw f(l.diagnostics);let u=structuredClone(l.options),d=s.open({source:y(e),...e.parameters===void 0?{}:{parameters:e.parameters},watch:!1}),h=await(async()=>{try{return await d.export(o,{options:structuredClone(u)})}finally{d.close()}})();if(!h.success)throw f(h.issues.map(m));let g=[...h.files],[_,...v]=g;if(_===void 0)throw f([p({code:`GEOSPEC_NATIVE_MODEL_EXPORT_EMPTY`,message:`The Tau Runtime exported no ${o.toUpperCase()} artifact for '${e.file}'.`,suggestion:`Check that the selected source exports geometry in the requested format.`,details:{file:e.file,format:o}})]);let x=n(c);if(`success`in x)throw f(x.diagnostics);let S=await Promise.all(g.map(async({name:e,bytes:t})=>({name:e,sha256:await r(t),byteLength:t.byteLength}))),C=h.sourceRevision===void 0?void 0:structuredClone(h.sourceRevision),w=C!==void 0&&/^sha256:[0-9a-f]{64}$/u.test(C.files[C.entry]??``)&&Object.values(C.files).every(e=>e===`missing`||/^sha256:[0-9a-f]{64}$/u.test(e));return{...N({format:o,primary:_.bytes,resources:v,sourceUnit:x.sourceUnit,diagnostics:h.issues.map(m),...e.ingestOptions===void 0?{}:{ingestOptions:e.ingestOptions}},i),load:{loadId:``,status:w?`complete`:`unavailable`,format:o,parameters:e.parameters??{},exportOptions:u,ingestOptions:e.ingestOptions??{},...C===void 0?{}:{sourceRevision:C},artifacts:S}}},L=async(e,n)=>{let r=e.runtime??t.runtime;if(!(`code`in e)||r===void 0||e.parameters!==void 0||e.ingestOptions!==void 0||[`sourceUnit`,`unit`,`scale`,`coordinateSystem`].some(t=>t in e))return I(e,new Set([n]));let i=Object.getPrototypeOf(e.code);if(i!==Object.prototype&&i!==null||Object.values(Object.getOwnPropertyDescriptors(e.code)).some(e=>!(`value`in e)||typeof e.value!=`string`))return I(e,new Set([n]));let a=Object.entries(e.code),o=Object.fromEntries(a),s=JSON.stringify({file:e.file,files:a,format:e.format??t.format??`glb`,meshLinearTolerance:e.meshLinearTolerance,meshAngularToleranceDegrees:e.meshAngularToleranceDegrees}),c=C.get(r);c===void 0&&(c=new Map,C.set(r,c));let l=c.get(s);if(l!==void 0)return l.owners.add(n),l.pending;let u=new Set([n]),d=I({...e,code:o},u);c.set(s,{pending:d,owners:u});let f=()=>{c.delete(s),c.size===0&&C.delete(r)};return d.then(f,f),d};return Object.assign(n=>{let r={},i=E(`load`),a={...n,...`code`in n?{code:Object.fromEntries(Object.entries(n.code))}:{},...n.parameters===void 0?{}:{parameters:structuredClone(n.parameters)},...n.ingestOptions===void 0?{}:{ingestOptions:structuredClone(n.ingestOptions)}},c=n.format??t.format??`glb`,l=[`stepStreaming`,...n.mesh===!1&&(c===`step`||c===`stp`)?[]:[`mesh`],...`source`in n?[`meshLinearTolerance`,`meshAngularToleranceDegrees`,...c===`step`||c===`stp`?[`sourceUnit`]:[]]:[]].find(e=>e in n);if(l!==void 0)return Promise.reject(f([p({code:`GEOSPEC_MODEL_OPTION_UNSUPPORTED`,message:`This GeoSpec host cannot honor model option '${l}'.`,suggestion:`Remove this option or configure a host that supports its declared behavior.`,details:{option:l}})]));let u=`source`in n?F(a,new Set([r])):L(a,r),d=(async()=>{let t=await u,n={...t,...t.load===void 0?{}:{load:{...t.load,loadId:i}}},a=x,c=!1;return e(n,{ensureResident(){if(a!==x||!s.has(r))throw TypeError(`This subject is not admitted by the active GeoSpec host.`);P(t.subjectHash)},dispose(){if(!(c||!s.has(r))){c=!0;try{A(t.subjectHash,r),s.delete(r),[...s.values()].includes(t.subjectHash)||o.delete(t.subjectHash)}finally{c=!1}}}}),n})();return S.add(d),d},{async releaseAll(){do{let e=[...S];await Promise.allSettled(e);for(let t of e)S.delete(t)}while(S.size>0);let e=[],{carried:n}=t;if(x+=1,n!==void 0){for(let[r,i]of M())try{c.get(t.engine)?.inputs.has(r)?A(r,n):k(i),n.delete(r)}catch(t){e.push(t)}for(let[e,t]of o)t.handle===void 0?(t.owners.delete(n),n.delete(e)):(t.owners.add(n),n.set(e,t.handle))}for(let[t,n]of[...s].reverse())try{A(n,t),s.delete(t),[...s.values()].includes(n)||o.delete(n)}catch(t){e.push(t)}for(let t of w)try{t.shutdown?await t.shutdown():t.terminate()}catch(t){e.push(t)}if(w.clear(),T.clear(),e.length>0)throw AggregateError(e,`Native GeoSpec model cleanup failed.`)}})};export{x as createGeoSpecNativeModelLoader};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{resolveGeoSpecSubject as e}from"./subject.mjs";import{createGeoSpecMatcherMethods as t}from"../assertion-client/client.mjs";import{diagnosticForTransport as n,geometryDiagnosticSchema as r}from"./errors.mjs";const i=i=>{let a=e(i),o=a.client.expectGeo(a.identity),s=s=>t({subject:i,polarity:s?`negative`:`positive`,invoke:t=>{e(i);let c=s?o.not:o,l=Reflect.apply(c[t.matcher],c,t.arguments),u=l.diagnostics.map(e=>n(r.parse(e)));return{kind:t.kind,subject:a.identity,...a.load===void 0?{}:{loadId:a.load.loadId},expected:t.expected,passed:l.status===`passed`,diagnostics:u,report:l}}});return Object.assign(s(!1),{not:s(!0)})};export{i as expectGeoSubject};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import "./native-model-loader.mjs";
|
|
2
|
+
import "../engine/client.mjs";
|
|
3
|
+
import "../assertion-client/client.mjs";
|
|
4
|
+
//#region src/model/subject.d.ts
|
|
5
|
+
declare const subjectBrand: unique symbol;
|
|
6
|
+
/** A model admitted by one live GeoSpec host scope. Load it through `geospec/model`. @public */
|
|
7
|
+
type GeoSpecSubject = {
|
|
8
|
+
readonly [subjectBrand]: true;
|
|
9
|
+
};
|
|
10
|
+
//#endregion
|
|
11
|
+
export { GeoSpecSubject };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=new WeakMap,t=new WeakMap,n=(n,r)=>{e.set(n,r),t.set(r.ensureResident,r)},r=t=>e.get(t)?.ensureResident,i=new WeakMap,a=e=>{let n=Object.freeze({});return i.set(n,{client:e.client,engine:e.engine,identity:e.identity,isLive:e.isLive,...e.load===void 0?{}:{load:e.load},...e.ensureResident===void 0?{}:{ensureResident:e.ensureResident},...e.ensureResident===void 0||!t.has(e.ensureResident)?{}:{lease:t.get(e.ensureResident)}}),n},o=(e,t)=>{let n=typeof e==`object`&&e?i.get(e):void 0;if(n===void 0||!n.isLive()||t!==void 0&&n.engine!==t)throw Object.assign(TypeError(`This subject is not admitted by the active GeoSpec host. Reload it within its live scope.`),{code:`GEOSPEC_SUBJECT_INVALID`});return n.ensureResident?.(),n};export{a as bindGeoSpecSubject,n as bindRawSubjectResidency,r as rawSubjectResidency,o as resolveGeoSpecSubject};
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { GeoSpecUnit } from "../geometry-unit.mjs";
|
|
2
|
+
import { StepSource, StepStreamingMode } from "../step/types.mjs";
|
|
3
|
+
import { MeshFileFormat } from "../mesh/types.mjs";
|
|
4
|
+
import { GeoSpecSubject } from "./subject.mjs";
|
|
5
|
+
import { GeoSpecNativeModelEngine, GeoSpecNativeSourceReader } from "./native-model-loader.mjs";
|
|
6
|
+
import { RuntimeClient } from "@taucad/runtime";
|
|
7
|
+
//#region src/model/types.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* In-memory triangle mesh source.
|
|
10
|
+
*
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
type MeshBufferSource = {
|
|
14
|
+
format: 'mesh-buffer';
|
|
15
|
+
positions: Float32Array<ArrayBuffer> | number[];
|
|
16
|
+
indices?: Uint32Array<ArrayBuffer> | Uint16Array<ArrayBuffer> | number[];
|
|
17
|
+
name?: string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Mesh source forms accepted by {@link import('./load-model.js').loadModel}.
|
|
21
|
+
*
|
|
22
|
+
* @public
|
|
23
|
+
*/
|
|
24
|
+
type MeshSource = Uint8Array<ArrayBuffer> | ArrayBuffer | Blob | File | URL | string | MeshBufferSource;
|
|
25
|
+
/**
|
|
26
|
+
* Geometry formats accepted by {@link import('./load-model.js').loadModel}.
|
|
27
|
+
*
|
|
28
|
+
* @public
|
|
29
|
+
*/
|
|
30
|
+
type GeoSpecModelFormat = MeshFileFormat | 'step' | 'stp';
|
|
31
|
+
/**
|
|
32
|
+
* Runtime client surface consumed by `geospec/model`.
|
|
33
|
+
*
|
|
34
|
+
* GeoSpec accepts concrete Tau runtime clients from multiple call sites but
|
|
35
|
+
* only needs connection lifecycle and request-scoped documents. Keep this shape
|
|
36
|
+
* small so typed runtime clients do not have to widen their full generic
|
|
37
|
+
* method surface to GeoSpec's testing DSL. A client with `shutdown` is awaited
|
|
38
|
+
* through it when GeoSpec releases an owned runtime, so its host resources are
|
|
39
|
+
* closed before the caller (for example a worker thread) exits.
|
|
40
|
+
*
|
|
41
|
+
* @public
|
|
42
|
+
*/
|
|
43
|
+
type GeoSpecRuntimeClient = Pick<RuntimeClient, 'connect' | 'terminate'> & Partial<Pick<RuntimeClient, 'shutdown'>> & {
|
|
44
|
+
open: (input: Pick<Parameters<RuntimeClient['open']>[0], 'source' | 'parameters' | 'stage' | 'watch' | 'signal'>) => Pick<ReturnType<RuntimeClient['open']>, 'export' | 'close'>;
|
|
45
|
+
on?(event: 'telemetry', handler: (batch: {
|
|
46
|
+
readonly entries: ReadonlyArray<{
|
|
47
|
+
name: string;
|
|
48
|
+
duration: number;
|
|
49
|
+
startTime: number;
|
|
50
|
+
workerTimeOrigin: number;
|
|
51
|
+
}>;
|
|
52
|
+
}) => void): () => void;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Lazy runtime factory consumed by `geospec/model`.
|
|
56
|
+
*
|
|
57
|
+
* @public
|
|
58
|
+
*/
|
|
59
|
+
type GeoSpecRuntimeClientFactory = () => Promise<GeoSpecRuntimeClient>;
|
|
60
|
+
/**
|
|
61
|
+
* Explicit source adapter for formats whose runtime setup is not part of the
|
|
62
|
+
* generic Tau runtime preset.
|
|
63
|
+
*
|
|
64
|
+
* @public
|
|
65
|
+
*/
|
|
66
|
+
type GeoSpecRuntimeSourceAdapter = {
|
|
67
|
+
id: string;
|
|
68
|
+
extensions: readonly string[];
|
|
69
|
+
createRuntime(options: {
|
|
70
|
+
projectPath?: string;
|
|
71
|
+
file?: string;
|
|
72
|
+
}): Promise<GeoSpecRuntimeClient>;
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Direct geometry-source model load options.
|
|
76
|
+
*
|
|
77
|
+
* @public
|
|
78
|
+
*/
|
|
79
|
+
type LoadModelSourceOptions = {
|
|
80
|
+
/** Geometry bytes, path, browser file/blob, or in-memory mesh buffer. */
|
|
81
|
+
source: MeshSource | StepSource;
|
|
82
|
+
/** Named external resources consumed alongside the direct geometry bytes. */
|
|
83
|
+
resources?: ReadonlyArray<{
|
|
84
|
+
readonly name: string;
|
|
85
|
+
readonly source: MeshSource | StepSource;
|
|
86
|
+
}>;
|
|
87
|
+
/** Source geometry format. Defaults to `glb`. */
|
|
88
|
+
format?: GeoSpecModelFormat;
|
|
89
|
+
/** Source path recorded in provenance. */
|
|
90
|
+
path?: string;
|
|
91
|
+
/** Human-readable source name recorded in provenance. */
|
|
92
|
+
name?: string;
|
|
93
|
+
/** Coordinate unit of raw GLB/glTF or mesh-buffer data before canonical millimetre normalization. */
|
|
94
|
+
sourceUnit?: GeoSpecUnit;
|
|
95
|
+
/** Explicit parameters recorded in provenance. */
|
|
96
|
+
parameters?: Record<string, unknown>;
|
|
97
|
+
/** STEP reader strategy used for STEP sources. */
|
|
98
|
+
stepStreaming?: StepStreamingMode;
|
|
99
|
+
/** Whether STEP loading should also produce mesh evidence. Defaults to true. */
|
|
100
|
+
mesh?: boolean;
|
|
101
|
+
/** Linear tolerance used while meshing exact BRep evidence. */
|
|
102
|
+
meshLinearTolerance?: number;
|
|
103
|
+
/** Angular tolerance in degrees used while meshing exact BRep evidence. */
|
|
104
|
+
meshAngularToleranceDegrees?: number;
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* Inline code-CAD model load options.
|
|
108
|
+
*
|
|
109
|
+
* @public
|
|
110
|
+
*/
|
|
111
|
+
type LoadModelCodeOptions<Code extends Record<string, string> = Record<string, string>> = {
|
|
112
|
+
/** Source files keyed by project-relative path. */
|
|
113
|
+
code: Code;
|
|
114
|
+
/** Entry path to render from {@link code}. */
|
|
115
|
+
file: keyof Code & string;
|
|
116
|
+
/** Geometry format to export. Defaults to `glb`. */
|
|
117
|
+
format?: GeoSpecModelFormat;
|
|
118
|
+
/** Explicit parameters passed to the runtime. */
|
|
119
|
+
parameters?: Record<string, unknown>;
|
|
120
|
+
/** Runtime client or lazy runtime factory. */
|
|
121
|
+
runtime?: GeoSpecRuntimeClient | GeoSpecRuntimeClientFactory;
|
|
122
|
+
/** Source-specific runtime adapters, e.g. host-provided GPL-isolated kernels. */
|
|
123
|
+
sourceAdapters?: readonly GeoSpecRuntimeSourceAdapter[];
|
|
124
|
+
/** Project root used by runtime integrations. */
|
|
125
|
+
projectPath?: string;
|
|
126
|
+
/** STEP reader strategy used for STEP exports. */
|
|
127
|
+
stepStreaming?: StepStreamingMode;
|
|
128
|
+
/** Whether STEP loading should also produce mesh evidence. Defaults to true. */
|
|
129
|
+
mesh?: boolean;
|
|
130
|
+
/** Linear tolerance used while meshing exact BRep evidence. */
|
|
131
|
+
meshLinearTolerance?: number;
|
|
132
|
+
/** Angular tolerance in degrees used while meshing exact BRep evidence. */
|
|
133
|
+
meshAngularToleranceDegrees?: number;
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* Filesystem-backed model load options.
|
|
137
|
+
*
|
|
138
|
+
* @public
|
|
139
|
+
*/
|
|
140
|
+
type LoadModelFileOptions = {
|
|
141
|
+
/** Project-relative model file to render. */
|
|
142
|
+
file: string;
|
|
143
|
+
/** Project root used by runtime integrations. */
|
|
144
|
+
projectPath?: string;
|
|
145
|
+
/** Geometry format to export. Defaults to `glb`. */
|
|
146
|
+
format?: GeoSpecModelFormat;
|
|
147
|
+
/** Explicit parameters passed to the runtime. */
|
|
148
|
+
parameters?: Record<string, unknown>;
|
|
149
|
+
/** Runtime client or lazy runtime factory. */
|
|
150
|
+
runtime?: GeoSpecRuntimeClient | GeoSpecRuntimeClientFactory;
|
|
151
|
+
/** Source-specific runtime adapters, e.g. host-provided GPL-isolated kernels. */
|
|
152
|
+
sourceAdapters?: readonly GeoSpecRuntimeSourceAdapter[];
|
|
153
|
+
/** STEP reader strategy used for STEP exports. */
|
|
154
|
+
stepStreaming?: StepStreamingMode;
|
|
155
|
+
/** Whether STEP loading should also produce mesh evidence. Defaults to true. */
|
|
156
|
+
mesh?: boolean;
|
|
157
|
+
/** Linear tolerance used while meshing exact BRep evidence. */
|
|
158
|
+
meshLinearTolerance?: number;
|
|
159
|
+
/** Angular tolerance in degrees used while meshing exact BRep evidence. */
|
|
160
|
+
meshAngularToleranceDegrees?: number;
|
|
161
|
+
};
|
|
162
|
+
/**
|
|
163
|
+
* Options accepted by {@link import('./load-model.js').loadModel}.
|
|
164
|
+
*
|
|
165
|
+
* @public
|
|
166
|
+
*/
|
|
167
|
+
type LoadModelOptions<Code extends Record<string, string> = Record<string, string>> = LoadModelSourceOptions | LoadModelCodeOptions<Code> | LoadModelFileOptions;
|
|
168
|
+
/**
|
|
169
|
+
* Function shape used by GeoSpec runners to provide model loading inside VM
|
|
170
|
+
* executed test files.
|
|
171
|
+
*
|
|
172
|
+
* @public
|
|
173
|
+
*/
|
|
174
|
+
type GeoSpecModelLoader = <Code extends Record<string, string> = Record<string, string>>(options: LoadModelOptions<Code>) => Promise<GeoSpecSubject>;
|
|
175
|
+
/** A configured loader whose shared runtime can be released with its owner. @public */
|
|
176
|
+
type ManagedGeoSpecModelLoader = GeoSpecModelLoader & {
|
|
177
|
+
dispose(): Promise<void>;
|
|
178
|
+
};
|
|
179
|
+
/**
|
|
180
|
+
* Defaults accepted by {@link import('./load-model.js').createModelLoader}.
|
|
181
|
+
*
|
|
182
|
+
* @public
|
|
183
|
+
*/
|
|
184
|
+
type CreateModelLoaderOptions = {
|
|
185
|
+
/** Initialized compiled engine supplied by the host, never selected by an authored spec. */
|
|
186
|
+
engine: GeoSpecNativeModelEngine;
|
|
187
|
+
/** Rooted host reader for direct filesystem or URL sources. */
|
|
188
|
+
readSource?: GeoSpecNativeSourceReader;
|
|
189
|
+
/** Geometry format to export when an individual call does not specify one. */
|
|
190
|
+
format?: GeoSpecModelFormat;
|
|
191
|
+
/** Runtime client or lazy runtime factory. */
|
|
192
|
+
runtime?: GeoSpecRuntimeClient | GeoSpecRuntimeClientFactory;
|
|
193
|
+
/** Source-specific runtime adapters, e.g. host-provided GPL-isolated kernels. */
|
|
194
|
+
sourceAdapters?: readonly GeoSpecRuntimeSourceAdapter[];
|
|
195
|
+
/** Project root used by runtime integrations. */
|
|
196
|
+
projectPath?: string;
|
|
197
|
+
/** STEP reader strategy used for STEP sources or exports. */
|
|
198
|
+
stepStreaming?: StepStreamingMode;
|
|
199
|
+
/** Whether STEP loading should also produce mesh evidence. Defaults to true. */
|
|
200
|
+
mesh?: boolean;
|
|
201
|
+
/** Linear tolerance used while meshing exact BRep evidence. */
|
|
202
|
+
meshLinearTolerance?: number;
|
|
203
|
+
/** Angular tolerance in degrees used while meshing exact BRep evidence. */
|
|
204
|
+
meshAngularToleranceDegrees?: number;
|
|
205
|
+
};
|
|
206
|
+
//#endregion
|
|
207
|
+
export { CreateModelLoaderOptions, GeoSpecModelFormat, GeoSpecModelLoader, GeoSpecRuntimeClient, GeoSpecRuntimeClientFactory, GeoSpecRuntimeSourceAdapter, LoadModelCodeOptions, LoadModelFileOptions, LoadModelOptions, LoadModelSourceOptions, ManagedGeoSpecModelLoader, MeshBufferSource, MeshSource };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { GeometryDiagnostic } from "../mesh/types.mjs";
|
|
2
|
+
import { GeoSpecMatcher, GeoSpecTestCase } from "./types.mjs";
|
|
3
|
+
import { GeoSpecAssertionClientOptions } from "../assertion-client/client.mjs";
|
|
4
|
+
import "../assertion-client/index.mjs";
|
|
5
|
+
import { GeoSpecTestNamePattern } from "./filter.mjs";
|
|
6
|
+
//#region src/runner/collector.d.ts
|
|
7
|
+
type GeoSpecTestFunction = () => unknown | PromiseLike<unknown>;
|
|
8
|
+
/**
|
|
9
|
+
* Collects suites, tests, assertions, and async completion state for one
|
|
10
|
+
* GeoSpec module execution.
|
|
11
|
+
*
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
type GeoSpecCollector = {
|
|
15
|
+
tests: GeoSpecTestCase[];
|
|
16
|
+
describe(name: string, function_: GeoSpecTestFunction): void;
|
|
17
|
+
describeSkip(name: string, _function?: GeoSpecTestFunction): void;
|
|
18
|
+
it(name: string, function_: GeoSpecTestFunction): void;
|
|
19
|
+
itSkip(name: string, _function?: GeoSpecTestFunction): void;
|
|
20
|
+
expectGeo(subject: unknown): GeoSpecMatcher;
|
|
21
|
+
waitForCompletion(testTimeout?: number, testNamePattern?: GeoSpecTestNamePattern): Promise<void>;
|
|
22
|
+
};
|
|
23
|
+
/** Per-module collector configuration; native subject/engine lifetime stays with the host. @public */
|
|
24
|
+
type GeoSpecCollectorOptions = {
|
|
25
|
+
matcherWallBackstop?: number;
|
|
26
|
+
forensic?: boolean;
|
|
27
|
+
nativeAssertions: GeoSpecAssertionClientOptions;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Assertion error thrown by GeoSpec matchers when an expectation does not hold.
|
|
31
|
+
*
|
|
32
|
+
* Runner, CLI, and tool adapters unwrap this error to preserve structured
|
|
33
|
+
* diagnostics instead of collapsing them into a single string.
|
|
34
|
+
*
|
|
35
|
+
* @public
|
|
36
|
+
*/
|
|
37
|
+
declare class GeoSpecAssertionError extends Error {
|
|
38
|
+
readonly diagnostics: readonly GeometryDiagnostic[];
|
|
39
|
+
constructor(diagnostics: readonly GeometryDiagnostic[]);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Create the collector used by the embedded GeoSpec runner.
|
|
43
|
+
*
|
|
44
|
+
* @param options - The native assertion client configuration for this module.
|
|
45
|
+
* @returns A fresh collector whose matchers evaluate through the native engine.
|
|
46
|
+
* @public
|
|
47
|
+
*/
|
|
48
|
+
declare function createCollector(options: GeoSpecCollectorOptions): GeoSpecCollector;
|
|
49
|
+
/**
|
|
50
|
+
* Clear runner globals after a module finishes.
|
|
51
|
+
*/
|
|
52
|
+
/** @public */
|
|
53
|
+
declare const clearCollectorGlobals: () => void;
|
|
54
|
+
/**
|
|
55
|
+
* Install a collector into the current JavaScript global scope.
|
|
56
|
+
*
|
|
57
|
+
* @param collector - Collector for the active run.
|
|
58
|
+
*/
|
|
59
|
+
/** @public */
|
|
60
|
+
declare const installCollector: (collector: GeoSpecCollector) => void;
|
|
61
|
+
//#endregion
|
|
62
|
+
export { GeoSpecAssertionError, GeoSpecCollector, GeoSpecCollectorOptions, clearCollectorGlobals, createCollector, installCollector };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{resolveGeoSpecSubject as e}from"../model/subject.mjs";import{GeoSpecAssertionError as t,createGeoSpecAssertionClient as n,createGeoSpecMatcherMethods as r}from"../assertion-client/client.mjs";import{diagnosticForTransport as i,geometryDiagnosticSchema as a}from"../model/errors.mjs";import{matchesGeoSpecTestName as o}from"./filter.mjs";const s=`__GEOSPEC_COLLECTOR__`,c=globalThis,l=e=>typeof e==`object`&&!!e&&`then`in e&&typeof e.then==`function`;var u=class extends Error{diagnostics;constructor(e){super(e.map(e=>e.message).join(`
|
|
2
|
+
`)||`GeoSpec assertion failed.`),this.name=`GeoSpecAssertionError`,this.diagnostics=Object.freeze([...e])}};const d=e=>{if(e instanceof u)return[...e.diagnostics];if(typeof e==`object`&&e&&Reflect.get(e,`name`)===`GeoSpecModelLoadError`){let t=Reflect.get(e,`diagnostics`);if(Array.isArray(t)&&t.length>0)try{return t.map(e=>i(f(e)))}catch{}}let t=typeof e==`object`&&e&&typeof Reflect.get(e,`message`)==`string`?String(Reflect.get(e,`message`)):String(e),{details:n}=i({code:`TEST_FAILED`,severity:`error`,message:t,details:e});return t.includes(`model.volume is not a function`)?[{code:`GEOSPEC_SUBJECT_API_MISUSE`,severity:`error`,message:`GeoSpec GeometrySubject does not expose model.volume().`,suggestion:`Use expectGeo(model).toHaveVolume({ value, tolerance }) instead of reading model.volume().`,details:n}]:/Cannot read properties of undefined \(reading 'bounds'\)/u.test(t)?[{code:`GEOSPEC_SUBJECT_API_MISUSE`,severity:`error`,message:`GeoSpec GeometrySubject does not expose model.boundingBox.bounds.`,suggestion:`Use expectGeo(model).toHaveBoundingBox({ min, max, size, center, tolerance }) instead of reading model.boundingBox.`,details:n}]:[{code:`TEST_FAILED`,severity:`error`,message:t,details:n}]},f=e=>a.parse(e),p=(e,t)=>{if(e.passed=t.length===0,e.diagnostics=t,t.length>0)throw new u(t);return e};var m=class extends Error{};const h=async(e,t)=>{if(t===void 0)return e;let n;try{return await Promise.race([e,new Promise((e,r)=>{n=setTimeout(()=>{r(new m(`GeoSpec test timed out after ${t}ms.`))},t)})])}finally{n!==void 0&&clearTimeout(n)}},g=(e,t)=>{for(let n of e)n.status===`rejected`&&t(n.reason)},_=()=>{let e=c[s];if(!v(e))throw Error(`GeoSpec collector is not active. Run the module through runGeoSpecModule().`);return e},v=e=>typeof e==`object`&&!!e&&`describe`in e&&`it`in e&&`expectGeo`in e&&`tests`in e,y=e=>typeof e==`object`&&!!e&&`suite`in e&&`name`in e&&`assertions`in e;function b(a){let s=n(a.nativeAssertions),c=[],m=[],_=[],v=[],b=new WeakSet,x,S=!1,C=(e,t)=>{_.push((async()=>{try{await e}catch(e){t.onError(e)}finally{t.onFinally()}})())},w=e=>{m.push({ordinal:m.length,suite:[...c],name:e,assertions:[],status:`skipped`,diagnostics:[]})},T=n=>{if(!y(x))throw Error(`expectGeo() must be called inside it().`);let r={kind:n.kind,subject:null,expected:n.expected};x.assertions.push(r);let o=performance.now();try{let o=e(n.subject,a.nativeAssertions.engine);r.subject=o.identity,o.load!==void 0&&(r.loadId=o.load.loadId);let c=s.expectGeo(o.identity),l=(n.polarity===`negative`?c.not:c)[n.matcher],u;try{u=l(...n.arguments)}catch(e){if(!(e instanceof t))throw e;u=e.report}if(r.report=u,u.status===`passed`)return p(r,[]);let d=u.diagnostics.map(e=>i(f(e)));return p(r,d.length>0?d:[{code:`GEOSPEC_NATIVE_ASSERTION_FAILED`,severity:`error`,message:`Native claim '${u.claimId}' ended with status '${u.status}'.`,details:{claimId:u.claimId,status:u.status}}])}catch(e){throw e instanceof u&&r.report!==void 0&&b.add(e),r.passed=!1,r.diagnostics??=d(e),e}finally{r.durationMs=performance.now()-o}};return{describe(e,t){c.push(e);try{let n=t();if(l(n)){let t=[...c];C(n,{onError(n){m.push({ordinal:m.length,suite:t,name:e,assertions:[],status:`failed`,diagnostics:d(n)})},onFinally(){c.pop()}});return}}catch(t){m.push({ordinal:m.length,suite:[...c],name:e,assertions:[],status:`failed`,diagnostics:d(t)})}c.pop()},describeSkip(e){w(e)},it(e,t){let n={ordinal:m.length,suite:[...c],name:e,assertions:[],status:`not-run`,diagnostics:[]};m.push(n),v.push({test:n,function_:t})},itSkip(e){w(e)},expectGeo(e){return Object.assign(r({invoke:T,polarity:`positive`,subject:e}),{not:r({invoke:T,polarity:`negative`,subject:e})})},async waitForCompletion(e,t){if(S)return;S=!0;let n=Promise.allSettled(_);try{await h(n,e)}catch(e){throw await n,e}for(let n of v){if(!o(n.test,t))continue;let r=x;x=n.test,n.test.status=`passed`;let i=performance.now(),a=[],s=e=>{a.some(t=>Object.is(t,e))||a.push(e)};try{let t;try{t=Promise.resolve(n.function_()),await h(t,e)}catch(e){s(e)}if(t!==void 0&&g(await Promise.allSettled([t]),s),a.length>0||n.test.assertions.some(e=>e.passed===!1)){n.test.status=`failed`;for(let e of a)n.test.diagnostics.push(...d(e));let{assertions:e}=n.test;if(!(a.some(e=>!(e instanceof u)||!b.has(e))||e.some(e=>e.passed===!1&&(e.report===void 0||e.report.status===`invalid`||e.report.status===`engine-error`)))){let t=e.map(e=>e.report?.status);n.test.status=t.includes(`failed`)?`failed`:t.some(e=>e!==void 0&&e!==`passed`&&e!==`unsupported`)?`inconclusive`:t.includes(`unsupported`)?`unsupported`:`failed`}}}finally{x=r,n.test.durationMs=performance.now()-i}}},tests:m}}const x=()=>{Reflect.deleteProperty(c,s)},S=e=>{c[s]=e};export{u as GeoSpecAssertionError,x as clearCollectorGlobals,s as collectorGlobalKey,b as createCollector,_ as getCollector,S as installCollector};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
//#region src/runner/discovery.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Default file globs used by GeoSpec test discovery.
|
|
4
|
+
*
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
declare const defaultGeoSpecInclude: readonly ["**/*.geospec.{ts,js}"];
|
|
8
|
+
/**
|
|
9
|
+
* Directories skipped by recursive GeoSpec discovery unless callers provide
|
|
10
|
+
* their own ignored-directory list.
|
|
11
|
+
*
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
declare const defaultGeoSpecIgnoredDirectories: readonly [".git", "node_modules", "dist", "coverage", ".tau/cache", ".tau/artifacts", ".tau/transcripts"];
|
|
15
|
+
/**
|
|
16
|
+
* File kind returned by a GeoSpec discovery filesystem.
|
|
17
|
+
*
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
20
|
+
type GeoSpecDiscoveryFileKind = 'file' | 'directory';
|
|
21
|
+
/**
|
|
22
|
+
* Minimal stat object required for recursive GeoSpec test discovery.
|
|
23
|
+
*
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
26
|
+
type GeoSpecDiscoveryFileStat = {
|
|
27
|
+
kind: GeoSpecDiscoveryFileKind;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Minimal filesystem contract used by GeoSpec test discovery.
|
|
31
|
+
*
|
|
32
|
+
* Browser workers, Node CLI hosts, and embedded runners adapt their native
|
|
33
|
+
* filesystem APIs to this shape so discovery has one shared behavior.
|
|
34
|
+
*
|
|
35
|
+
* @public
|
|
36
|
+
*/
|
|
37
|
+
type GeoSpecDiscoveryFileSystem = {
|
|
38
|
+
readdir(path: string): Promise<readonly string[]>;
|
|
39
|
+
stat(path: string): Promise<GeoSpecDiscoveryFileStat>;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Options for recursive GeoSpec test discovery.
|
|
43
|
+
*
|
|
44
|
+
* `files` accepts either exact `*.geospec.ts` / `*.geospec.js` files or
|
|
45
|
+
* directory roots. When omitted, discovery starts at `projectPath`.
|
|
46
|
+
*
|
|
47
|
+
* `include` and `exclude` are Vitest-style file globs applied to
|
|
48
|
+
* project-relative GeoSpec paths after `files` roots have been expanded.
|
|
49
|
+
*
|
|
50
|
+
* @public
|
|
51
|
+
*/
|
|
52
|
+
type DiscoverGeoSpecFilesOptions = {
|
|
53
|
+
filesystem: GeoSpecDiscoveryFileSystem;
|
|
54
|
+
projectPath: string;
|
|
55
|
+
files?: readonly string[];
|
|
56
|
+
include?: readonly string[];
|
|
57
|
+
exclude?: readonly string[];
|
|
58
|
+
ignoredDirectories?: readonly string[];
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Result returned by recursive GeoSpec test discovery.
|
|
62
|
+
*
|
|
63
|
+
* `files` are project-relative, sorted, and de-duplicated. `unmatchedRoots`
|
|
64
|
+
* contains requested file or directory roots that did not select any GeoSpec
|
|
65
|
+
* files.
|
|
66
|
+
*
|
|
67
|
+
* @public
|
|
68
|
+
*/
|
|
69
|
+
type GeoSpecDiscoveryResult = {
|
|
70
|
+
files: string[];
|
|
71
|
+
unmatchedRoots: string[];
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Return true when a project-relative path names a GeoSpec test file.
|
|
75
|
+
*
|
|
76
|
+
* @param path - Project-relative path to inspect.
|
|
77
|
+
* @returns True when the path ends with `.geospec.ts` or `.geospec.js`.
|
|
78
|
+
* @public
|
|
79
|
+
*/
|
|
80
|
+
declare const isGeoSpecTestFile: (path: string) => boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Discover GeoSpec test files from exact files or directory roots.
|
|
83
|
+
*
|
|
84
|
+
* The returned `files` are project-relative paths suitable for
|
|
85
|
+
* `runGeoSpecModule` and runner factory APIs.
|
|
86
|
+
*
|
|
87
|
+
* @param options - Discovery options containing a filesystem adapter and project roots.
|
|
88
|
+
* @returns Sorted, de-duplicated project-relative GeoSpec files plus unmatched roots.
|
|
89
|
+
* @public
|
|
90
|
+
*/
|
|
91
|
+
declare const discoverGeoSpecFiles: (options: DiscoverGeoSpecFilesOptions) => Promise<GeoSpecDiscoveryResult>;
|
|
92
|
+
//#endregion
|
|
93
|
+
export { DiscoverGeoSpecFilesOptions, GeoSpecDiscoveryFileKind, GeoSpecDiscoveryFileStat, GeoSpecDiscoveryFileSystem, GeoSpecDiscoveryResult, defaultGeoSpecIgnoredDirectories, defaultGeoSpecInclude, discoverGeoSpecFiles, isGeoSpecTestFile };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{assertRootedPath as e}from"@taucad/runtime/kernel";const t=[`**/*.geospec.{ts,js}`],n=[`.git`,`node_modules`,`dist`,`coverage`,`.tau/cache`,`.tau/artifacts`,`.tau/transcripts`],r=/\.geospec\.(?:ts|js)$/u,i=e=>e.replaceAll(`\\`,`/`).replaceAll(/\/+/gu,`/`).replace(/^\.\//u,``),a=e=>{let t=i(e);return!t||t===`.`?``:t===`/`?t:t.replace(/\/$/u,``)},o=(t,n)=>{let r=e(t);return r===``?n:n===``?r:`${n.replace(/\/$/u,``)}/${r}`},s=(e,t)=>{let n=i(e).replace(/\/$/u,``);if(t===``)return n;let r=t.endsWith(`/`)?t:`${t}/`;return n===t?``:n.startsWith(r)?n.slice(r.length):n},c=e=>e.replaceAll(/[|\\{}()[\]^$+?.]/gu,String.raw`\$&`),l=e=>{let t=i(e),n=`^`;for(let e=0;e<t.length;){let r=t[e];if(r===void 0)break;let i=t[e+1];if(r===`*`&&i===`*`){t[e+2]===`/`?(n+=String.raw`(?:.*\/)?`,e+=3):(n+=`.*`,e+=2);continue}if(r===`*`){n+=`[^/]*`,e+=1;continue}if(r===`?`){n+=`[^/]`,e+=1;continue}if(r===`{`){let r=t.indexOf(`}`,e+1);if(r!==-1){let i=t.slice(e+1,r).split(`,`).map(e=>c(e));n+=`(?:${i.join(`|`)})`,e=r+1;continue}}n+=r===`/`?String.raw`\/`:c(r),e+=1}return RegExp(`${n}$`,`u`)},u=(e,t)=>l(t).test(i(e)),d=(e,t)=>t.some(t=>u(e,t)),f=(e,t)=>{let n=i(e).replace(/\/$/u,``),r=n.split(`/`).at(-1)??n;return t.has(n)||t.has(r)},p=e=>{if(typeof e!=`object`||!e)return!1;let t=`code`in e?e.code:void 0,n=`name`in e?e.name:void 0,r=e instanceof Error?e.message:``;return t===`ENOENT`||t===`ENOTDIR`||n===`NotFoundError`||r.startsWith(`ENOENT:`)||r.startsWith(`ENOTDIR:`)},m=e=>r.test(i(e)),h=async e=>{let t=await e.filesystem.readdir(e.directoryPath),n=[];for(let r of t){let t=e.directoryPath===``?r:`${e.directoryPath}/${r}`,i=s(t,e.projectPath);if((await e.filesystem.stat(t)).kind===`directory`){f(i,e.ignoredDirectories)||n.push(t);continue}m(i)&&e.selectedFiles.add(i)}n.sort((e,t)=>e.localeCompare(t));for(let t of n)await h({...e,directoryPath:t})},g=async e=>{let t=new Set,n=o(e.root,e.projectPath),r;try{r=await e.filesystem.stat(n)}catch(e){if(p(e))return[];throw e}if(r.kind===`file`){let r=s(n,e.projectPath);return m(r)&&t.add(r),[...t]}let i=s(n,e.projectPath);return i&&f(i,e.ignoredDirectories)?[]:(await h({filesystem:e.filesystem,directoryPath:n,projectPath:e.projectPath,ignoredDirectories:e.ignoredDirectories,selectedFiles:t}),[...t])},_=async e=>{let r=a(e.projectPath),o=e.include&&e.include.length>0?e.include:t,s=e.exclude??[],c=new Set(e.ignoredDirectories??n),l=e.files&&e.files.length>0?e.files:[``],u=new Set,f=[];for(let t of l){let n=await g({filesystem:e.filesystem,projectPath:r,root:t,ignoredDirectories:c});if(n.length===0){f.push(i(t)||`.`);continue}for(let e of n)u.add(e)}return{files:[...u].filter(e=>d(e,o)&&!d(e,s)).sort((e,t)=>e.localeCompare(t)),unmatchedRoots:f}};export{n as defaultGeoSpecIgnoredDirectories,t as defaultGeoSpecInclude,_ as discoverGeoSpecFiles,m as isGeoSpecTestFile};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { GeoSpecTestCase } from "./types.mjs";
|
|
2
|
+
import { VmIssue } from "@taucad/esbuild/vm";
|
|
3
|
+
//#region src/runner/filter.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Compiled Vitest-style test-name pattern used by a GeoSpec run.
|
|
6
|
+
*
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
type GeoSpecTestNamePattern = RegExp;
|
|
10
|
+
/**
|
|
11
|
+
* Compile a Vitest-style test-name pattern once for a GeoSpec run.
|
|
12
|
+
*
|
|
13
|
+
* String inputs are JavaScript regular expression sources matched against the
|
|
14
|
+
* full `suite > test` name. `RegExp` inputs are used as-is.
|
|
15
|
+
*
|
|
16
|
+
* @param testNamePattern - Optional regex source or precompiled expression.
|
|
17
|
+
* @returns A compiled pattern or a structured issue when the source is invalid.
|
|
18
|
+
*
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
declare const compileGeoSpecTestNamePattern: (testNamePattern: string | RegExp | undefined) => {
|
|
22
|
+
success: true;
|
|
23
|
+
pattern?: GeoSpecTestNamePattern;
|
|
24
|
+
} | {
|
|
25
|
+
success: false;
|
|
26
|
+
issue: VmIssue;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Return true when a collected GeoSpec test matches the supplied compiled
|
|
30
|
+
* Vitest-style test-name pattern.
|
|
31
|
+
*
|
|
32
|
+
* @public
|
|
33
|
+
*
|
|
34
|
+
* @param test - collected test metadata.
|
|
35
|
+
* @param testNamePattern - optional compiled regex.
|
|
36
|
+
* @returns whether the test should be included.
|
|
37
|
+
*/
|
|
38
|
+
declare const matchesGeoSpecTestName: (test: Pick<GeoSpecTestCase, "suite" | "name">, testNamePattern: GeoSpecTestNamePattern | undefined) => boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Filter collected GeoSpec tests by compiled test-name pattern.
|
|
41
|
+
*
|
|
42
|
+
* @public
|
|
43
|
+
*
|
|
44
|
+
* @param tests - collected tests.
|
|
45
|
+
* @param testNamePattern - optional compiled regex.
|
|
46
|
+
* @returns tests that match the filter.
|
|
47
|
+
*/
|
|
48
|
+
declare const filterGeoSpecTests: (tests: readonly GeoSpecTestCase[], testNamePattern: GeoSpecTestNamePattern | undefined) => GeoSpecTestCase[];
|
|
49
|
+
//#endregion
|
|
50
|
+
export { GeoSpecTestNamePattern, compileGeoSpecTestNamePattern, filterGeoSpecTests, matchesGeoSpecTestName };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=e=>[...e.suite,e.name].join(` > `),t=e=>{if(e===void 0||typeof e==`string`&&e.trim()===``)return{success:!0};if(e instanceof RegExp)return{success:!0,pattern:e};try{return{success:!0,pattern:new RegExp(e,`u`)}}catch(t){return{success:!1,issue:{code:`INVALID_GEOSPEC_TEST_NAME_PATTERN`,message:`testNamePattern is not a valid JavaScript regular expression.`,severity:`error`,type:`runtime`,details:{testNamePattern:e,reason:t instanceof Error?t.message:String(t)}}}}},n=(t,n)=>!n||(n.lastIndex=0,n.test(e(t))),r=(e,t)=>e.filter(e=>n(e,t));export{t as compileGeoSpecTestNamePattern,r as filterGeoSpecTests,n as matchesGeoSpecTestName};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { GeoSpecAssemblyOccurrenceExpectation, GeoSpecAssemblyOccurrencesExpectation, GeoSpecAssertion, GeoSpecAxisExpectation, GeoSpecBoundingBoxExpectation, GeoSpecCenterOfMassExpectation, GeoSpecChamferFeatureExpectation, GeoSpecCircularHoleExpectation, GeoSpecCircularHolePatternExpectation, GeoSpecComponentInterferenceAllowance, GeoSpecComponentInterferenceExpectation, GeoSpecComponentInterferencePairExpectation, GeoSpecConnectedComponentsExpectation, GeoSpecCylindricalFaceExpectation, GeoSpecFilletFeatureExpectation, GeoSpecGeometrySelector, GeoSpecMassExpectation, GeoSpecMatcher, GeoSpecMeshIntegrityExpectation, GeoSpecMinimumWallThicknessExpectation, GeoSpecModuleBundleCache, GeoSpecNumericExpectation, GeoSpecPlanarFaceExpectation, GeoSpecPointExpectation, GeoSpecProductStructureExpectation, GeoSpecRunFailure, GeoSpecRunResult, GeoSpecRunSuccess, GeoSpecSpatialRelationshipExpectation, GeoSpecSpatialRelationshipsExpectation, GeoSpecStepUnitsExpectation, GeoSpecSurfaceAreaExpectation, GeoSpecTestCase, GeoSpecTestStatus, GeoSpecTopologyCountsExpectation, GeoSpecValidBrepExpectation, GeoSpecVolumeExpectation, RunGeoSpecModuleOptions } from "./types.mjs";
|
|
2
|
+
import { GeoSpecTestNamePattern, compileGeoSpecTestNamePattern, filterGeoSpecTests, matchesGeoSpecTestName } from "./filter.mjs";
|
|
3
|
+
import { GeoSpecAssertionError, GeoSpecCollector, GeoSpecCollectorOptions, clearCollectorGlobals, createCollector, installCollector } from "./collector.mjs";
|
|
4
|
+
import { DiscoverGeoSpecFilesOptions, GeoSpecDiscoveryFileKind, GeoSpecDiscoveryFileStat, GeoSpecDiscoveryFileSystem, GeoSpecDiscoveryResult, defaultGeoSpecIgnoredDirectories, defaultGeoSpecInclude, discoverGeoSpecFiles, isGeoSpecTestFile } from "./discovery.mjs";
|
|
5
|
+
import { runGeoSpecModule } from "./run-geospec-module.mjs";
|
|
6
|
+
export { type DiscoverGeoSpecFilesOptions, type GeoSpecAssemblyOccurrenceExpectation, type GeoSpecAssemblyOccurrencesExpectation, type GeoSpecAssertion, GeoSpecAssertionError, type GeoSpecAxisExpectation, type GeoSpecBoundingBoxExpectation, type GeoSpecCenterOfMassExpectation, type GeoSpecChamferFeatureExpectation, type GeoSpecCircularHoleExpectation, type GeoSpecCircularHolePatternExpectation, type GeoSpecCollector, type GeoSpecCollectorOptions, type GeoSpecComponentInterferenceAllowance, type GeoSpecComponentInterferenceExpectation, type GeoSpecComponentInterferencePairExpectation, type GeoSpecConnectedComponentsExpectation, type GeoSpecCylindricalFaceExpectation, type GeoSpecDiscoveryFileKind, type GeoSpecDiscoveryFileStat, type GeoSpecDiscoveryFileSystem, type GeoSpecDiscoveryResult, type GeoSpecFilletFeatureExpectation, type GeoSpecGeometrySelector, type GeoSpecMassExpectation, type GeoSpecMatcher, type GeoSpecMeshIntegrityExpectation, type GeoSpecMinimumWallThicknessExpectation, type GeoSpecModuleBundleCache, type GeoSpecNumericExpectation, type GeoSpecPlanarFaceExpectation, type GeoSpecPointExpectation, type GeoSpecProductStructureExpectation, type GeoSpecRunFailure, type GeoSpecRunResult, type GeoSpecRunSuccess, type GeoSpecSpatialRelationshipExpectation, type GeoSpecSpatialRelationshipsExpectation, type GeoSpecStepUnitsExpectation, type GeoSpecSurfaceAreaExpectation, type GeoSpecTestCase, type GeoSpecTestNamePattern, type GeoSpecTestStatus, type GeoSpecTopologyCountsExpectation, type GeoSpecValidBrepExpectation, type GeoSpecVolumeExpectation, type RunGeoSpecModuleOptions, clearCollectorGlobals, compileGeoSpecTestNamePattern, createCollector, defaultGeoSpecIgnoredDirectories, defaultGeoSpecInclude, discoverGeoSpecFiles, filterGeoSpecTests, installCollector, isGeoSpecTestFile, matchesGeoSpecTestName, runGeoSpecModule };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{compileGeoSpecTestNamePattern as e,filterGeoSpecTests as t,matchesGeoSpecTestName as n}from"./filter.mjs";import{GeoSpecAssertionError as r,clearCollectorGlobals as i,createCollector as a,installCollector as o}from"./collector.mjs";import{defaultGeoSpecIgnoredDirectories as s,defaultGeoSpecInclude as c,discoverGeoSpecFiles as l,isGeoSpecTestFile as u}from"./discovery.mjs";import{runGeoSpecModule as d}from"./run-geospec-module.mjs";export{r as GeoSpecAssertionError,i as clearCollectorGlobals,e as compileGeoSpecTestNamePattern,a as createCollector,s as defaultGeoSpecIgnoredDirectories,c as defaultGeoSpecInclude,l as discoverGeoSpecFiles,t as filterGeoSpecTests,o as installCollector,u as isGeoSpecTestFile,n as matchesGeoSpecTestName,d as runGeoSpecModule};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { CreateGeoSpecNativeModelLoaderOptions, GeoSpecNativeLoadModelOptions, GeoSpecNativeModelEngine, GeoSpecNativeModelLoader, GeoSpecNativeModelResource, GeoSpecNativeModelSubject, GeoSpecNativeSourceReader, ManagedGeoSpecNativeModelLoader, createGeoSpecNativeModelLoader } from "../../model/native-model-loader.mjs";
|
|
2
|
+
import { GeoSpecNativeRunnerAssertions, GeoSpecNativeRunnerOptions, createNativeGeoSpecRunner } from "./native-serial-runner.mjs";
|
|
3
|
+
import { allocateNativePoolGrants } from "./native-pool-grants.mjs";
|
|
4
|
+
export { type CreateGeoSpecNativeModelLoaderOptions, type GeoSpecNativeLoadModelOptions, type GeoSpecNativeModelEngine, type GeoSpecNativeModelLoader, type GeoSpecNativeModelResource, type GeoSpecNativeModelSubject, type GeoSpecNativeRunnerAssertions, type GeoSpecNativeRunnerOptions, type GeoSpecNativeSourceReader, type ManagedGeoSpecNativeModelLoader, allocateNativePoolGrants, createGeoSpecNativeModelLoader, createNativeGeoSpecRunner };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createGeoSpecNativeModelLoader as e}from"../../model/native-model-loader.mjs";import{createNativeGeoSpecRunner as t}from"./native-serial-runner.mjs";import{allocateNativePoolGrants as n}from"./native-pool-grants.mjs";export{n as allocateNativePoolGrants,e as createGeoSpecNativeModelLoader,t as createNativeGeoSpecRunner};
|