geospec 0.1.0-beta.7 → 0.1.0-beta.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/agent/geospec-authoring/SKILL.md +11 -11
  2. package/agent/geospec-authoring/api-functions.md +1 -16
  3. package/agent/geospec-authoring/api-index.md +50 -46
  4. package/agent/geospec-authoring/api-types.md +188 -168
  5. package/agent/geospec-authoring/public-api-functions.md +29 -22
  6. package/agent/geospec-authoring/public-api-index.md +196 -183
  7. package/agent/geospec-authoring/public-api-types-2.md +188 -220
  8. package/agent/geospec-authoring/public-api-types-3.md +112 -99
  9. package/agent/geospec-authoring/public-api-types.md +236 -125
  10. package/agent/resources.js +12 -12
  11. package/agent/skills.json +2 -2
  12. package/dist/config/index.d.mts +1 -2
  13. package/dist/config/index.mjs +1 -1
  14. package/dist/config/types.d.mts +0 -3
  15. package/dist/config/validate.mjs +1 -1
  16. package/dist/mesh/index.d.mts +2 -2
  17. package/dist/model/index.d.mts +3 -3
  18. package/dist/model/index.mjs +1 -1
  19. package/dist/model/mesh-evidence-matchers.d.mts +12 -0
  20. package/dist/model/mesh-evidence-matchers.mjs +1 -0
  21. package/dist/model/native-model-loader.d.mts +8 -8
  22. package/dist/model/native-model-loader.mjs +1 -1
  23. package/dist/model/node/command-exporter.d.mts +31 -0
  24. package/dist/model/node/command-exporter.mjs +1 -0
  25. package/dist/model/node/index.d.mts +2 -0
  26. package/dist/model/node/index.mjs +1 -0
  27. package/dist/model/types.d.mts +111 -63
  28. package/dist/runner/collector.d.mts +0 -2
  29. package/dist/runner/node/index.d.mts +2 -0
  30. package/dist/runner/node/index.mjs +1 -0
  31. package/dist/runner/node/node-vm-filesystem.d.mts +22 -0
  32. package/dist/runner/node/node-vm-filesystem.mjs +1 -0
  33. package/dist/runner/pool/events.mjs +1 -0
  34. package/dist/runner/pool/pool-messages.d.mts +0 -10
  35. package/dist/runner/pool/pool.d.mts +36 -0
  36. package/dist/runner/pool/pool.mjs +1 -0
  37. package/dist/runner/pool/shard-planner.mjs +1 -0
  38. package/dist/runner/pool/shard-timings.d.mts +36 -0
  39. package/dist/runner/pool/transport.mjs +1 -0
  40. package/dist/runner/pool/worker-host.d.mts +36 -0
  41. package/dist/runner/pool/worker-host.mjs +1 -0
  42. package/dist/runner/run-geospec-module.mjs +1 -1
  43. package/dist/runner/types.d.mts +0 -4
  44. package/dist/runner/worker/index.d.mts +5 -2
  45. package/dist/runner/worker/index.mjs +1 -1
  46. package/dist/runner/worker/runner-types.d.mts +2 -14
  47. package/dist/runner/worker/serial-runner.mjs +1 -1
  48. package/package.json +14 -4
  49. package/dist/config/tau-project-artifact.d.mts +0 -54
  50. package/dist/config/tau-project-artifact.mjs +0 -3
  51. package/dist/model/export-intent.d.mts +0 -79
  52. package/dist/model/export-intent.mjs +0 -1
@@ -1 +1 @@
1
- import{runGeoSpecModule as e}from"../run-geospec-module.mjs";import{createNoMatchingGeoSpecTestsIssue as t}from"./no-matching-tests-issue.mjs";const n=()=>({code:`GEOSPEC_RUNNER_CLOSED`,message:`GeoSpec runner is closed.`,severity:`error`,type:`runtime`}),r=()=>({code:`GEOSPEC_RUNNER_ACTIVE`,message:`GeoSpec runner already has an active run.`,severity:`error`,type:`runtime`}),i=e=>({code:`GEOSPEC_RUNNER_ABORTED`,message:e?`GeoSpec run aborted: ${e}`:`GeoSpec run aborted.`,severity:`error`,type:`runtime`}),a=e=>({code:`GEOSPEC_RUNNER_BAILED`,message:`GeoSpec run stopped after first failure (--bail): ${e}. Remaining files were not executed.`,severity:`error`,type:`runtime`}),o=e=>{let t=0,n=0;for(let r of e)r.status!==`skipped`&&(r.status===`failed`?n+=1:r.status===`passed`&&(t+=1));return{passed:t,failed:n}},s=s=>{let c={closed:!1},l=new Set,u,d,f=new Map,p=e=>{for(let t of l)t(e)},m=()=>c.aborted,h=e=>({requestedFiles:[...e],completedFiles:[],notRunFiles:[...e],discoveryComplete:!1,discovered:0,selected:0,completed:0,passed:0,failed:0,unsupported:0,inconclusive:0,skipped:0,notRun:0,cancelled:!1,bailed:!1}),g=(e,t)=>({success:!1,passed:0,failed:1,selectedTests:0,files:[],issues:[e],accounting:h(t),lineageStatus:`unavailable`}),_=async n=>{let r=[...n.files],c=performance.now();p({type:`run-start`,files:r});let l=!1,u=async()=>{l||(l=!0,await s.nativeModelLoader?.releaseAll())},d=0,g=0,_=0,v=[],y=[],b=h(r),x=!0,S=`complete`,C=new Map;try{for(let t of r){let c=m();if(c!==void 0){let e=i(c);y.push(e),g+=1,p({type:`abort`,reason:c}),b.cancelled=!0,x=!1;break}p({type:`file-start`,file:t});let l=performance.now(),u=await e({filesystem:s.filesystem,entryPath:t,testNamePattern:n.testNamePattern,testTimeout:n.testTimeout,matcherWallBackstop:n.matcherWallBackstop,forensic:n.forensic,onTestEvent:e=>{p(e.type===`test-start`?{type:`test-start`,file:t,test:{suite:[...e.test.suite],name:e.test.name,...e.test.ordinal===void 0?{}:{ordinal:e.test.ordinal}}}:{type:`test-complete`,file:t,test:e.test})},bundleCache:f,nativeAssertions:n.workUnitLimit===void 0?s.nativeAssertions:{...s.nativeAssertions,workUnitLimit:n.workUnitLimit},...s.nativeModelLoader?{nativeModelLoader:s.nativeModelLoader}:{},...s.builtinModules?{builtinModules:s.builtinModules}:{}}).catch(e=>({success:!1,issues:[{code:`GEOSPEC_MODULE_INTERRUPTED`,message:e instanceof Error?e.message:String(e),severity:`error`,type:`runtime`}]})),h=performance.now()-l;p({type:`file-complete`,file:t,result:u,durationMs:h}),v.push({file:t,result:u,durationMs:h}),b.completedFiles=v.map(e=>e.file),b.notRunFiles=r.slice(v.length),x&&=u.success&&u.passed,u.lineage===void 0||u.lineage.status===`unavailable`?S!==`mixed`&&(S=`unavailable`):u.lineage.status===`mixed`&&(S=`mixed`);let w=u.lineage?.loads.flatMap(e=>{let{evidence:t}=e,n=t?.artifacts[0];return t?.exportOptions===void 0?[...(t?.artifacts??[]).flatMap(e=>e.sourcePath===void 0?[]:[{[e.sourcePath]:`sha256:${e.sha256}`}]),...t?.sourcePath===void 0||n===void 0?[]:[{[t.sourcePath]:`sha256:${n.sha256}`}]]:[]})??[];for(let e of[...u.lineage?.modules.map(e=>e.files)??[],...w,...u.lineage?.loads.map(e=>e.evidence?.sourceRevision?.files??{})??[]])for(let[t,n]of Object.entries(e))C.has(t)&&C.get(t)!==n&&(S=`mixed`),C.set(t,n);if(u.accounting!==void 0)for(let e of[`discovered`,`selected`,`completed`,`passed`,`failed`,`unsupported`,`inconclusive`,`skipped`,`notRun`])b[e]+=u.accounting[e];if(u.success){_+=u.tests.length;let e=o(u.tests);d+=e.passed,g+=e.failed}else g+=1;if(n.bail===!0&&(!x||g>0)){y.push(a(t)),b.bailed=!0;break}}_===0&&g===0&&(y.push(t()),g+=1);try{await u()}catch(e){y.push({code:`GEOSPEC_NATIVE_CLEANUP_FAILED`,message:e instanceof Error?e.message:String(e),severity:`error`,type:`runtime`}),x=!1}b.discoveryComplete=b.notRunFiles.length===0&&v.every(e=>e.result.success&&e.result.accounting!==void 0);let l={success:x&&S===`complete`&&g===0&&y.length===0,passed:d,failed:g,selectedTests:_,files:v,...y.length>0?{issues:y}:{},durationMs:performance.now()-c,accounting:b,lineageStatus:S};return p({type:`run-complete`,result:l}),l}finally{await u()}};return{async run(e){if(new Set(e.files).size!==e.files.length)return g({code:`GEOSPEC_DUPLICATE_FILES`,message:`GeoSpec requested files must be unique.`,severity:`error`,type:`runtime`},e.files);if(c.closed)return g(n(),e.files);if(u!==void 0)return g(r(),e.files);delete c.aborted;let t=()=>void 0,i=new Promise(e=>{t=e});u=i;try{return await _(e)}finally{t(),u===i&&(u=void 0)}},on(e,t){let n=n=>{n.type===e&&t(n)};return l.add(n),()=>l.delete(n)},abort(e){c.aborted=e??`requested`},async close(){d===void 0&&(c.closed=!0,c.aborted??=`runner closed`,d=(async()=>{await u,f.clear(),p({type:`close`})})()),await d}}};export{o as countRunnerTests,s as createSerialGeoSpecRunner};
1
+ import{runGeoSpecModule as e}from"../run-geospec-module.mjs";import{createNoMatchingGeoSpecTestsIssue as t}from"./no-matching-tests-issue.mjs";const n=()=>({code:`GEOSPEC_RUNNER_CLOSED`,message:`GeoSpec runner is closed.`,severity:`error`,type:`runtime`}),r=()=>({code:`GEOSPEC_RUNNER_ACTIVE`,message:`GeoSpec runner already has an active run.`,severity:`error`,type:`runtime`}),i=e=>({code:`GEOSPEC_RUNNER_ABORTED`,message:e?`GeoSpec run aborted: ${e}`:`GeoSpec run aborted.`,severity:`error`,type:`runtime`}),a=e=>({code:`GEOSPEC_RUNNER_BAILED`,message:`GeoSpec run stopped after first failure (--bail): ${e}. Remaining files were not executed.`,severity:`error`,type:`runtime`}),o=e=>{let t=0,n=0;for(let r of e)r.status!==`skipped`&&(r.status===`failed`?n+=1:r.status===`passed`&&(t+=1));return{passed:t,failed:n}},s=(e,t)=>{if(!t.success){e.failed+=1;return}e.selectedTests+=t.tests.length;let n=o(t.tests);e.passed+=n.passed,e.failed+=n.failed},c=async t=>{let{runner:n,file:r}=t;return e({filesystem:n.filesystem,entryPath:r,...t.testNamePattern===void 0?{}:{testNamePattern:t.testNamePattern},...t.testTimeout===void 0?{}:{testTimeout:t.testTimeout},...t.onTestEvent===void 0?{}:{onTestEvent:t.onTestEvent},nativeAssertions:t.workUnitLimit===void 0?n.nativeAssertions:{...n.nativeAssertions,workUnitLimit:t.workUnitLimit},...n.nativeModelLoader?{nativeModelLoader:n.nativeModelLoader}:{},...n.builtinModules?{builtinModules:n.builtinModules}:{},...t.bundleCache?{bundleCache:t.bundleCache}:{},...t.collectOnly===!0?{collectOnly:!0}:{}})},l=e=>{let o={closed:!1},l=new Set,u,d,f=new Map,p=e=>{for(let t of l)t(e)},m=()=>o.aborted,h=e=>({requestedFiles:[...e],completedFiles:[],notRunFiles:[...e],discoveryComplete:!1,discovered:0,selected:0,completed:0,passed:0,failed:0,unsupported:0,inconclusive:0,skipped:0,notRun:0,cancelled:!1,bailed:!1}),g=(e,t)=>({success:!1,passed:0,failed:1,selectedTests:0,files:[],issues:[e],accounting:h(t),lineageStatus:`unavailable`}),_=async n=>{let r=[...n.files],o=performance.now();p({type:`run-start`,files:r});let l=!1,u=async()=>{l||(l=!0,await e.nativeModelLoader?.releaseAll())},d=0,g=0,_=0,v=[],y=[],b=h(r),x=!0,S=`complete`,C=new Map;try{for(let t of r){let o=m();if(o!==void 0){let e=i(o);y.push(e),g+=1,p({type:`abort`,reason:o}),b.cancelled=!0,x=!1;break}p({type:`file-start`,file:t});let l=performance.now(),u=await c({runner:e,file:t,...n.testNamePattern===void 0?{}:{testNamePattern:n.testNamePattern},...n.testTimeout===void 0?{}:{testTimeout:n.testTimeout},...n.workUnitLimit===void 0?{}:{workUnitLimit:n.workUnitLimit},onTestEvent:e=>{p(e.type===`test-start`?{type:`test-start`,file:t,test:{suite:[...e.test.suite],name:e.test.name,...e.test.ordinal===void 0?{}:{ordinal:e.test.ordinal}}}:{type:`test-complete`,file:t,test:e.test})},bundleCache:f}).catch(e=>({success:!1,issues:[{code:`GEOSPEC_MODULE_INTERRUPTED`,message:e instanceof Error?e.message:String(e),severity:`error`,type:`runtime`}]})),h=performance.now()-l;p({type:`file-complete`,file:t,result:u,durationMs:h}),v.push({file:t,result:u,durationMs:h}),b.completedFiles=v.map(e=>e.file),b.notRunFiles=r.slice(v.length),x&&=u.success&&u.passed,u.lineage===void 0||u.lineage.status===`unavailable`?S!==`mixed`&&(S=`unavailable`):u.lineage.status===`mixed`&&(S=`mixed`);let w=u.lineage?.loads.flatMap(e=>{let{evidence:t}=e,n=t?.artifacts[0];return t?.exportOptions===void 0?[...(t?.artifacts??[]).flatMap(e=>e.sourcePath===void 0?[]:[{[e.sourcePath]:`sha256:${e.sha256}`}]),...t?.sourcePath===void 0||n===void 0?[]:[{[t.sourcePath]:`sha256:${n.sha256}`}]]:[]})??[];for(let e of[...u.lineage?.modules.map(e=>e.files)??[],...w,...u.lineage?.loads.map(e=>e.evidence?.sourceRevision?.files??{})??[]])for(let[t,n]of Object.entries(e))C.has(t)&&C.get(t)!==n&&(S=`mixed`),C.set(t,n);if(u.accounting!==void 0)for(let e of[`discovered`,`selected`,`completed`,`passed`,`failed`,`unsupported`,`inconclusive`,`skipped`,`notRun`])b[e]+=u.accounting[e];let T={passed:d,failed:g,selectedTests:_};if(s(T,u),{passed:d,failed:g,selectedTests:_}=T,n.bail===!0&&(!x||g>0)){y.push(a(t)),b.bailed=!0;break}}_===0&&g===0&&(y.push(t()),g+=1);try{await u()}catch(e){y.push({code:`GEOSPEC_NATIVE_CLEANUP_FAILED`,message:e instanceof Error?e.message:String(e),severity:`error`,type:`runtime`}),x=!1}b.discoveryComplete=b.notRunFiles.length===0&&v.every(e=>e.result.success&&e.result.accounting!==void 0);let l={success:x&&S===`complete`&&g===0&&y.length===0,passed:d,failed:g,selectedTests:_,files:v,...y.length>0?{issues:y}:{},durationMs:performance.now()-o,accounting:b,lineageStatus:S};return p({type:`run-complete`,result:l}),l}finally{await u()}};return{async run(e){if(new Set(e.files).size!==e.files.length)return g({code:`GEOSPEC_DUPLICATE_FILES`,message:`GeoSpec requested files must be unique.`,severity:`error`,type:`runtime`},e.files);if(o.closed)return g(n(),e.files);if(u!==void 0)return g(r(),e.files);delete o.aborted;let t=()=>void 0,i=new Promise(e=>{t=e});u=i;try{return await _(e)}finally{t(),u===i&&(u=void 0)}},on(e,t){let n=n=>{n.type===e&&t(n)};return l.add(n),()=>l.delete(n)},abort(e){o.aborted=e??`requested`},async close(){d===void 0&&(o.closed=!0,o.aborted??=`runner closed`,d=(async()=>{await u,f.clear(),p({type:`close`})})()),await d}}};export{s as accumulateFileResult,o as countRunnerTests,l as createSerialGeoSpecRunner,c as executeGeoSpecFile};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "geospec",
3
- "version": "0.1.0-beta.7",
3
+ "version": "0.1.0-beta.8",
4
4
  "description": "Geometry specification API for CAD models: DSL, selector language, diagnostics schema, and the native runner integration",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -53,6 +53,11 @@
53
53
  "import": "./dist/model/index.mjs",
54
54
  "default": "./dist/model/index.mjs"
55
55
  },
56
+ "./model/node": {
57
+ "types": "./dist/model/node/index.d.mts",
58
+ "import": "./dist/model/node/index.mjs",
59
+ "default": "./dist/model/node/index.mjs"
60
+ },
56
61
  "./runner": {
57
62
  "types": "./dist/runner/index.d.mts",
58
63
  "import": "./dist/runner/index.mjs",
@@ -63,6 +68,11 @@
63
68
  "import": "./dist/runner/native/index.mjs",
64
69
  "default": "./dist/runner/native/index.mjs"
65
70
  },
71
+ "./runner/node": {
72
+ "types": "./dist/runner/node/index.d.mts",
73
+ "import": "./dist/runner/node/index.mjs",
74
+ "default": "./dist/runner/node/index.mjs"
75
+ },
66
76
  "./runner/worker": {
67
77
  "types": "./dist/runner/worker/index.d.mts",
68
78
  "import": "./dist/runner/worker/index.mjs",
@@ -96,9 +106,9 @@
96
106
  "imports": {},
97
107
  "dependencies": {
98
108
  "zod": "4.4.3",
99
- "@taucad/esbuild": "0.1.0-beta.7",
100
- "@taucad/runtime": "0.1.0-beta.7",
101
- "@taucad/project-core": "0.1.0-beta.7"
109
+ "@taucad/esbuild": "0.1.0-beta.8",
110
+ "@taucad/project-core": "0.1.0-beta.8",
111
+ "@taucad/runtime": "0.1.0-beta.8"
102
112
  },
103
113
  "devDependencies": {
104
114
  "@gltf-transform/core": "^4.5.1"
@@ -1,54 +0,0 @@
1
- import { GeometryExportIntent } from "../mesh/types.mjs";
2
- import { RuntimeClientWithRoutes } from "../model/export-intent.mjs";
3
- import { GeoSpecTauProjectDescriptor } from "./types.mjs";
4
- import { ProjectManifest } from "@taucad/project-core";
5
- import { KernelResult, RuntimeSourceSnapshotFile } from "@taucad/runtime/types";
6
- import { RuntimeClient } from "@taucad/runtime/client";
7
- //#region src/config/tau-project-artifact.d.ts
8
- /** Runtime surface required to snapshot and export one Tau project. @public */
9
- type GeoSpecTauProjectRuntime = RuntimeClientWithRoutes & Pick<RuntimeClient, 'shutdown' | 'snapshotSource'>;
10
- /** Input for exporting one validated Tau project descriptor. @public */
11
- type ExportTauProjectArtifactOptions = {
12
- readonly descriptor: GeoSpecTauProjectDescriptor;
13
- /** Called twice so source discovery and export use separate runtime lifetimes. */
14
- readonly createRuntime: () => GeoSpecTauProjectRuntime | Promise<GeoSpecTauProjectRuntime>;
15
- readonly signal?: AbortSignal;
16
- };
17
- /** Finalized geometry bytes and the exact source/export metadata that produced them. @public */
18
- type GeoSpecTauProjectArtifact = {
19
- readonly format: 'step' | 'glb';
20
- readonly name: string;
21
- readonly mimeType: string;
22
- readonly bytes: Uint8Array<ArrayBuffer>;
23
- readonly frame: {
24
- readonly coordinateSystem: 'z-up';
25
- readonly lengthUnit: 'millimeter';
26
- readonly sourceUnit: 'mm';
27
- };
28
- readonly source: {
29
- readonly manifestPath: string;
30
- readonly manifestBytes: Uint8Array<ArrayBuffer>;
31
- readonly manifest: ProjectManifest;
32
- readonly projectEntryPath: string;
33
- readonly entryPath: string;
34
- readonly kernelId: string;
35
- readonly files: readonly RuntimeSourceSnapshotFile[];
36
- };
37
- readonly export: {
38
- readonly options: Readonly<Record<string, unknown>>;
39
- readonly route: NonNullable<GeometryExportIntent['route']>;
40
- };
41
- };
42
- /**
43
- * Export one Tau project from Runtime's coherent source snapshot.
44
- *
45
- * This helper preserves finalized bytes and provenance metadata. It does not
46
- * certify mathematical geometry or grant the runtime trusted-evaluator authority.
47
- *
48
- * @param options - Descriptor, fresh-runtime factory, and optional cancellation signal.
49
- * @returns Runtime-style success or failure with the exact finalized artifact.
50
- * @public
51
- */
52
- declare const exportTauProjectArtifact: (options: ExportTauProjectArtifactOptions) => Promise<KernelResult<GeoSpecTauProjectArtifact>>;
53
- //#endregion
54
- export { ExportTauProjectArtifactOptions, GeoSpecTauProjectArtifact, GeoSpecTauProjectRuntime, exportTauProjectArtifact };
@@ -1,3 +0,0 @@
1
- import{resolveRuntimeExportIntent as e}from"../model/export-intent.mjs";import{resolveGeoSpecConfig as t}from"./validate.mjs";import{parseProjectManifestBytes as n,projectManifestSchema as r,projectRelativePathSchema as i,serializeProjectManifest as a}from"@taucad/project-core";const o=(e,t,n={})=>({success:!1,issues:[...n.priorIssues??[],{code:e,message:t,severity:`error`,type:`runtime`,...n.details===void 0?{}:{details:n.details}}]}),s=(e,t)=>e.byteLength===t.byteLength&&e.every((e,n)=>e===t[n]),c=(e,t)=>{let n=e.lastIndexOf(`/`);return i.parse(n===-1?t:`${e.slice(0,n)}/${t}`)},l=(e,t)=>t.bytes.byteLength===0?!1:e===`step`?t.mimeType===`application/step`:t.mimeType===`model/gltf-binary`,u=async i=>{let u=t({subjects:{selected:i.descriptor}}).subjects?.selected;if(!u)throw TypeError(`GeoSpec Tau descriptor is required.`);let d=structuredClone(u),f=r.safeParse(d.manifest);if(!f.success)throw TypeError(`GeoSpec Tau descriptor manifest must match the current Tau project schema.`);let p=c(d.manifestPath,f.data.assets.main.entryPath),m=await i.createRuntime(),h,g;try{await m.connect(),h=await m.snapshotSource({source:{path:p},additionalPaths:[{path:d.manifestPath,required:!0}],...i.signal===void 0?{}:{signal:i.signal}}),h.success&&(g=structuredClone(e({runtime:m,format:d.format,kernelId:h.data.kernelId})))}finally{await m.shutdown()}if(!h.success)return h;if(!g)throw TypeError(`Runtime export intent was not resolved from the successful source snapshot.`);if(`success`in g)return o(`KERNEL_CAPABILITY_MISSING`,g.diagnostics.map(({message:e})=>e).join(`
2
- `),{details:{diagnostics:g.diagnostics},priorIssues:h.issues});let _=g.provenance.route,v=g.provenance.honored;if(_?.kernelId!==h.data.kernelId||_.targetFormat!==d.format||v?.coordinateSystem!==`z-up`||v.sourceUnit!==`mm`||d.format===`glb`&&v.unit?.length!==`millimeter`)return o(`KERNEL_CAPABILITY_MISSING`,`Runtime route did not honor the snapshotted provider and Z-up/mm export.`,{details:{snapshotKernelId:h.data.kernelId,route:_,honored:v},priorIssues:h.issues});if(h.data.entryPath!==p||h.data.unresolvedPaths.length>0)return o(`SOURCE_SNAPSHOT_INVALID`,`Runtime did not return the requested complete Tau source closure.`,{details:{expectedEntryPath:p,actualEntryPath:h.data.entryPath,unresolvedPaths:h.data.unresolvedPaths},priorIssues:h.issues});let y=h.data.files.filter(({path:e})=>e===d.manifestPath);if(y.length!==1)return o(`SOURCE_SNAPSHOT_INVALID`,`Runtime source closure must contain exactly one requested Tau manifest.`,{details:{manifestPath:d.manifestPath,actualCount:y.length},priorIssues:h.issues});let b=y[0],x=n(b.content);if(!x.success)return o(`SOURCE_SNAPSHOT_INVALID`,`Runtime source closure contains an invalid Tau manifest.`,{details:x.issue,priorIssues:h.issues});if(!s(a(f.data),a(x.data)))return o(`SOURCE_SNAPSHOT_CHANGED`,`Imported Tau descriptor does not match the snapshotted manifest bytes.`,{details:{manifestPath:d.manifestPath},priorIssues:h.issues});if(c(d.manifestPath,x.data.assets.main.entryPath)!==h.data.entryPath)return o(`SOURCE_SNAPSHOT_CHANGED`,`Snapshotted Tau manifest selects a different main asset.`,{details:{manifestPath:d.manifestPath},priorIssues:h.issues});let S={};for(let e of h.data.files){if(S[e.path]!==void 0)return o(`SOURCE_SNAPSHOT_INVALID`,`Runtime source closure contains duplicate paths.`,{details:{path:e.path},priorIssues:h.issues});S[e.path]=e.content}let C=await i.createRuntime();if(C===m)throw TypeError(`createRuntime must return a fresh runtime for source replay.`);try{await C.connect();let t=C.open({source:{files:S,entry:h.data.entryPath},parameters:d.parameters??{},watch:!1,...i.signal===void 0?{}:{signal:i.signal}}),n=await(async()=>{try{return await t.export(d.format,{options:g.options,...i.signal===void 0?{}:{signal:i.signal}})}finally{t.close()}})();if(!n.success)return{success:!1,issues:[...h.issues,...n.issues]};let r=e({runtime:C,format:d.format});if(`success`in r)return o(`KERNEL_CAPABILITY_MISSING`,r.diagnostics.map(({message:e})=>e).join(`
3
- `),{details:{diagnostics:r.diagnostics},priorIssues:[...h.issues,...n.issues]});let a=r.provenance.route,s=r.provenance.honored;if(a?.kernelId!==h.data.kernelId||a.targetFormat!==d.format||s?.coordinateSystem!==`z-up`||s.sourceUnit!==`mm`||d.format===`glb`&&s.unit?.length!==`millimeter`||JSON.stringify(a)!==JSON.stringify(_)||JSON.stringify(r.options)!==JSON.stringify(g.options))return o(`KERNEL_CAPABILITY_MISSING`,`Export runtime did not retain the requested source-bound route and Z-up/mm frame.`,{details:{snapshotKernelId:h.data.kernelId,requested:g,actual:r},priorIssues:[...h.issues,...n.issues]});let c=[...n.files];if(c.length!==1)return o(`EXPORT_ARTIFACT_SET_INVALID`,`Tau project export must produce exactly one usable artifact.`,{details:{actualCount:c.length},priorIssues:[...h.issues,...n.issues]});let[u]=c;if(!u||!l(d.format,u))return o(`EXPORT_ARTIFACT_SET_INVALID`,`Tau project export did not produce the requested usable artifact.`,{details:{format:d.format,artifact:u&&{name:u.name,mimeType:u.mimeType,byteLength:u.bytes.byteLength}},priorIssues:[...h.issues,...n.issues]});let{bytes:f,mimeType:p,name:m}=u;return{success:!0,data:{format:d.format,name:m,mimeType:p,bytes:f,frame:{coordinateSystem:`z-up`,lengthUnit:`millimeter`,sourceUnit:`mm`},source:{manifestPath:d.manifestPath,manifestBytes:b.content,manifest:x.data,projectEntryPath:x.data.assets.main.entryPath,entryPath:h.data.entryPath,kernelId:h.data.kernelId,files:h.data.files},export:{options:g.options,route:a}},issues:[...h.issues,...n.issues]}}finally{await C.shutdown()}};export{u as exportTauProjectArtifact};
@@ -1,79 +0,0 @@
1
- import { GeoSpecUnit } from "../geometry-unit.mjs";
2
- import { GeometryDiagnostic, GeometryExportIntent } from "../mesh/types.mjs";
3
- import { GeoSpecModelFormat, GeoSpecRuntimeClient } from "./types.mjs";
4
- import { ExportRoute } from "@taucad/runtime/types";
5
- //#region src/model/export-intent.d.ts
6
- /**
7
- *
8
- *
9
- * @public
10
- */
11
- type RuntimeBackedModelFormat = Exclude<GeoSpecModelFormat, 'mesh-buffer'>;
12
- /** Runtime route metadata used to decide whether a runtime export can honor GeoSpec evidence requirements.
13
- *
14
- * @public
15
- */
16
- type GeoSpecExportRoute = Partial<ExportRoute> & {
17
- kernelId?: string;
18
- sourceFormat?: string;
19
- targetFormat?: string;
20
- transcoderId?: string;
21
- fidelity?: string;
22
- exportOptions?: {
23
- schema?: {
24
- properties?: Record<string, unknown>;
25
- };
26
- defaults?: Record<string, unknown>;
27
- };
28
- };
29
- /** Runtime client shape for route-aware Tau runtimes.
30
- *
31
- * @public
32
- */
33
- type RuntimeClientWithRoutes = GeoSpecRuntimeClient & {
34
- bestRouteFor(format: string, options?: {
35
- readonly kernelId?: string;
36
- }): GeoSpecExportRoute | undefined;
37
- };
38
- /** Resolved runtime export request and provenance for a GeoSpec model load.
39
- *
40
- * @public
41
- */
42
- type RuntimeExportIntent = {
43
- options: Record<string, unknown>;
44
- provenance: GeometryExportIntent;
45
- sourceUnit: GeoSpecUnit;
46
- };
47
- /** Structured failure returned when a runtime cannot provide the requested GeoSpec evidence.
48
- *
49
- * @public
50
- */
51
- type RuntimeExportIntentFailure = {
52
- success: false;
53
- diagnostics: GeometryDiagnostic[];
54
- };
55
- /**
56
- * The matchers mesh evidence answers, as the GeoSpec authoring skill lists
57
- * them (`packages/geospec/agent/geospec-authoring/SKILL.md`): bounds, volume,
58
- * surface area, connected components and watertightness. Every other
59
- * exact-feature matcher needs STEP BRep evidence.
60
- *
61
- * @public
62
- */
63
- declare const geoSpecMeshEvidenceMatchers: readonly ["toHaveBoundingBox", "toHaveVolume", "toHaveSurfaceArea", "toHaveConnectedComponents", "toBeWatertight"];
64
- /** @public */
65
- declare const resolveRuntimeExportIntent: (options: {
66
- runtime: GeoSpecRuntimeClient;
67
- format: RuntimeBackedModelFormat;
68
- meshLinearTolerance?: number;
69
- meshAngularToleranceDegrees?: number;
70
- /**
71
- * The kernel that evaluates this source, when the host knows it. Routes are
72
- * then chosen among that kernel's own, so a mesh-only kernel is told its
73
- * BRep matchers are unsupported instead of being sent to another kernel's
74
- * STEP route.
75
- */
76
- kernelId?: string;
77
- }) => RuntimeExportIntent | RuntimeExportIntentFailure;
78
- //#endregion
79
- export { GeoSpecExportRoute, RuntimeBackedModelFormat, RuntimeClientWithRoutes, RuntimeExportIntent, RuntimeExportIntentFailure, geoSpecMeshEvidenceMatchers, resolveRuntimeExportIntent };
@@ -1 +0,0 @@
1
- const e=new Set([`step`,`stp`]),t=[`toHaveBoundingBox`,`toHaveVolume`,`toHaveSurfaceArea`,`toHaveConnectedComponents`,`toBeWatertight`],n=(e,t)=>({format:e,coordinateSystem:`z-up`,unit:{length:`millimeter`},...t===void 0?{}:{tessellation:t}}),r=e=>e===void 0?{}:{tessellation:{...e.linearTolerance===void 0?{}:{linearTolerance:e.linearTolerance},...e.angularToleranceDegrees===void 0?{}:{angularTolerance:e.angularToleranceDegrees}}},i=e=>{let t=n(e.format,e.tessellation);return{options:e.exportOptions,sourceUnit:`mm`,provenance:{requested:t,honored:{format:t.format,coordinateSystem:`z-up`,unit:{length:`millimeter`},sourceUnit:`mm`,...e.tessellation===void 0?{}:{tessellation:e.tessellation}}}}},a=e=>e?{...e.kernelId===void 0?{}:{kernelId:e.kernelId},...e.sourceFormat===void 0?{}:{sourceFormat:e.sourceFormat},...e.targetFormat===void 0?{}:{targetFormat:e.targetFormat},...e.transcoderId===void 0?{}:{transcoderId:e.transcoderId},...e.fidelity===void 0?{}:{fidelity:e.fidelity},direct:d(e)}:void 0,o=`loadModel({ file, format: 'glb' }) with mesh-supported matchers (${t.join(`, `)})`,s=e=>({success:!1,diagnostics:[{code:`GEOSPEC_KERNEL_BREP_UNSUPPORTED`,severity:`error`,message:`${e.kernelId===void 0?`No kernel in this runtime`:`Kernel '${e.kernelId}'`} has no direct STEP/BRep export route, so exact BRep evidence is unavailable and BRep matchers are unsupported on ${e.kernelId===void 0?`it`:`this kernel`}.`,suggestion:`Keep the requirement and report it as unsupported on this kernel. Load mesh evidence with ${o} for the requirements a mesh can answer.`,details:{format:`step`,...e.kernelId===void 0?{}:{kernelId:e.kernelId},...e.route===void 0?{}:{route:a(e.route)},meshAlternative:{format:`glb`,matchers:[...t]}}}]}),c=e=>typeof e.bestRouteFor==`function`,l=(e,t)=>{let{capabilities:n}=e;if((n?.routes?.length??0)>0)return!0;let{routesFor:r}=e;return typeof r==`function`&&r(t).length>0},u=(e,t)=>t in(e?.exportOptions?.schema.properties??{}),d=e=>e.transcoderId===void 0,f=e=>({success:!1,diagnostics:[{code:`GEOSPEC_CANONICAL_EXPORT_UNSUPPORTED`,severity:`error`,message:`GeoSpec cannot request canonical Z-up millimeter ${e.format.toUpperCase()} evidence from this runtime route.`,suggestion:`Use a runtime route whose export schema exposes coordinateSystem and unit.length, or pass a custom runtime that returns canonical millimeter geometry bytes.`,details:{format:e.format,missing:e.missing,route:a(e.route)}}]}),p=p=>{let{runtime:m,format:h}=p,g=p.meshLinearTolerance===void 0&&p.meshAngularToleranceDegrees===void 0?void 0:{...p.meshLinearTolerance===void 0?{}:{linearTolerance:p.meshLinearTolerance},...p.meshAngularToleranceDegrees===void 0?{}:{angularToleranceDegrees:p.meshAngularToleranceDegrees}},_=c(m),{kernelId:v}=p,y=_?v===void 0?m.bestRouteFor(h):m.bestRouteFor(h,{kernelId:v}):void 0;if(e.has(h)){let e=y!==void 0&&d(y)&&y.fidelity===`brep`;if(_&&!e&&v!==void 0&&l(m,h))return s({kernelId:v,route:y});if(y&&!e)return{success:!1,diagnostics:[{code:`GEOSPEC_DIRECT_STEP_ROUTE_REQUIRED`,severity:`error`,message:`GeoSpec exact BRep evidence requires a direct STEP/BRep runtime export route.`,suggestion:`No kernel in this runtime offers a direct STEP/BRep route, so keep the requirement and report it as unsupported here. Load mesh evidence with ${o} for the requirements a mesh can answer.`,details:{route:a(y),meshAlternative:{format:`glb`,matchers:[...t]}}}]};let n={},r={format:h,sourceUnit:`mm`};return u(y,`coordinateSystem`)&&(n.coordinateSystem=`z-up`,r.coordinateSystem=`z-up`),{options:n,sourceUnit:`mm`,provenance:{requested:{format:h},honored:r,route:a(y)}}}let b=n(h,g);if(!_)return i({format:h,exportOptions:{coordinateSystem:`z-up`,unit:{length:`millimeter`},...r(g)},...g===void 0?{}:{tessellation:g}});if(!y)return l(m,h)?f({format:h,missing:[`route`]}):i({format:h,exportOptions:{coordinateSystem:`z-up`,unit:{length:`millimeter`},...r(g)},...g===void 0?{}:{tessellation:g}});let x=[`coordinateSystem`,`unit`,...g===void 0?[]:[`tessellation`]].filter(e=>!u(y,e));return x.length>0?f({format:h,route:y,missing:x}):{options:{coordinateSystem:`z-up`,unit:{length:`millimeter`},...r(g)},sourceUnit:`mm`,provenance:{requested:b,honored:{format:b.format,coordinateSystem:`z-up`,unit:{length:`millimeter`},sourceUnit:`mm`,...g===void 0?{}:{tessellation:g}},route:a(y)}}};export{t as geoSpecMeshEvidenceMatchers,p as resolveRuntimeExportIntent};