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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/README.md +34 -9
  2. package/agent/doctrine.md +2 -1
  3. package/agent/geospec-authoring/SKILL.md +3 -3
  4. package/agent/geospec-authoring/api-index.md +20 -92
  5. package/agent/geospec-authoring/api-types.md +85 -480
  6. package/agent/geospec-authoring/public-api-functions.md +21 -1
  7. package/agent/geospec-authoring/public-api-index.md +215 -319
  8. package/agent/geospec-authoring/public-api-types-2.md +480 -352
  9. package/agent/geospec-authoring/public-api-types-3.md +79 -215
  10. package/agent/geospec-authoring/public-api-types.md +334 -849
  11. package/agent/resources.js +12 -13
  12. package/agent/skills.json +2 -3
  13. package/dist/assertion-client/client.d.mts +14 -15
  14. package/dist/assertion-client/client.mjs +1 -1
  15. package/dist/cli/check.mjs +2 -0
  16. package/dist/cli/cli.d.mts +5 -5
  17. package/dist/cli/cli.mjs +20 -3
  18. package/dist/cli/node-host.d.mts +5 -4
  19. package/dist/cli/node-host.mjs +1 -1
  20. package/dist/cli/wire-value.mjs +1 -1
  21. package/dist/config/define-config.d.mts +2 -3
  22. package/dist/config/node/index.mjs +1 -1
  23. package/dist/config/node/load.d.mts +2 -3
  24. package/dist/config/node/load.mjs +1 -1
  25. package/dist/config/read-geospec-config.d.mts +10 -6
  26. package/dist/config/read-geospec-config.mjs +1 -1
  27. package/dist/config/types.d.mts +6 -7
  28. package/dist/create-geospec.d.mts +7 -6
  29. package/dist/engine/client.d.mts +15 -15
  30. package/dist/engine/client.mjs +1 -1
  31. package/dist/engine/matchers.d.mts +10 -11
  32. package/dist/engine/pmi.types.d.mts +11 -12
  33. package/dist/engine/protocol.d.mts +7 -8
  34. package/dist/engine/protocol.mjs +1 -1
  35. package/dist/geometry-unit.d.mts +2 -3
  36. package/dist/index.d.mts +2 -2
  37. package/dist/index.mjs +1 -1
  38. package/dist/mesh/index.d.mts +2 -2
  39. package/dist/mesh/types.d.mts +8 -505
  40. package/dist/model/errors.d.mts +2 -3
  41. package/dist/model/load-model.d.mts +3 -4
  42. package/dist/model/mesh-evidence-matchers.d.mts +2 -3
  43. package/dist/model/native-model-loader.d.mts +14 -17
  44. package/dist/model/native-model-loader.mjs +1 -1
  45. package/dist/model/node/command-exporter.d.mts +3 -4
  46. package/dist/model/node/command-exporter.mjs +1 -1
  47. package/dist/model/node/index.mjs +1 -1
  48. package/dist/model/region-scope.d.mts +3 -6
  49. package/dist/model/region-scope.mjs +1 -1
  50. package/dist/model/subject.d.mts +2 -5
  51. package/dist/model/subject.mjs +1 -1
  52. package/dist/model/types.d.mts +19 -20
  53. package/dist/runner/collector.d.mts +7 -8
  54. package/dist/runner/collector.mjs +3 -1
  55. package/dist/runner/discovery.d.mts +10 -11
  56. package/dist/runner/discovery.mjs +5 -1
  57. package/dist/runner/filter.d.mts +6 -7
  58. package/dist/runner/filter.mjs +3 -1
  59. package/dist/runner/index.d.mts +3 -1
  60. package/dist/runner/index.mjs +1 -1
  61. package/dist/runner/native/native-pool-grants.d.mts +2 -3
  62. package/dist/runner/native/native-serial-runner.d.mts +4 -7
  63. package/dist/runner/native/native-serial-runner.mjs +1 -1
  64. package/dist/runner/node/engine.d.mts +5 -6
  65. package/dist/runner/node/index.mjs +1 -1
  66. package/dist/runner/node/node-vm-filesystem.d.mts +4 -5
  67. package/dist/runner/node/node-vm-filesystem.mjs +1 -1
  68. package/dist/runner/node/pool-runner.d.mts +15 -6
  69. package/dist/runner/node/pool-runner.mjs +1 -1
  70. package/dist/runner/node/pool-worker-entry.d.mts +9 -6
  71. package/dist/runner/node/pool-worker-entry.mjs +1 -1
  72. package/dist/runner/pool/events.mjs +1 -1
  73. package/dist/runner/pool/pool-messages.d.mts +8 -9
  74. package/dist/runner/pool/pool.d.mts +4 -6
  75. package/dist/runner/pool/pool.mjs +1 -1
  76. package/dist/runner/pool/shard-timings.d.mts +3 -4
  77. package/dist/runner/pool/worker-host.d.mts +6 -5
  78. package/dist/runner/pool/worker-host.mjs +1 -1
  79. package/dist/runner/run-geospec-module.d.mts +2 -3
  80. package/dist/runner/run-geospec-module.mjs +2 -2
  81. package/dist/runner/timeout-codes.d.mts +6 -8
  82. package/dist/runner/types.d.mts +56 -53
  83. package/dist/runner/worker/no-matching-tests-issue.d.mts +3 -4
  84. package/dist/runner/worker/runner-types.d.mts +17 -16
  85. package/dist/runner/worker/serial-runner.mjs +1 -1
  86. package/dist/selector/types.d.mts +22 -23
  87. package/dist/step/types.d.mts +4 -119
  88. package/dist/support/filesystem-errors.mjs +1 -0
  89. package/dist/support/hash.mjs +1 -0
  90. package/dist/support/path.mjs +1 -0
  91. package/dist/support/sha256.mjs +1 -0
  92. package/dist/support/types.d.mts +38 -0
  93. package/dist/vitest/adapter.d.mts +5 -6
  94. package/dist/vitest/adapter.mjs +1 -1
  95. package/dist/vitest/index.d.mts +0 -1
  96. package/dist/vitest/index.mjs +1 -1
  97. package/dist/vitest/node/index.d.mts +2 -0
  98. package/dist/vitest/node/index.mjs +1 -0
  99. package/dist/vitest/node/setup-project.d.mts +60 -0
  100. package/dist/vitest/node/setup-project.mjs +1 -0
  101. package/dist/vm/plain-module-vm.d.mts +13 -0
  102. package/dist/vm/plain-module-vm.mjs +8 -0
  103. package/dist/vm/types.d.mts +142 -0
  104. package/package.json +17 -9
  105. package/agent/geospec-authoring/api-types-2.md +0 -85
@@ -0,0 +1,142 @@
1
+ //#region src/vm/types.d.ts
2
+ /**
3
+ * The module VM contract GeoSpec runs specs and configs through.
4
+ *
5
+ * GeoSpec owns these types structurally, so a host can inject any VM that satisfies them, Tau's
6
+ * `createEsbuildModuleVm` from Tau's esbuild plugin among them, while `geospec` itself depends on no Tau package.
7
+ */
8
+ /**
9
+ * A diagnostic emitted while bundling or executing a VM module.
10
+ *
11
+ * @public
12
+ */
13
+ export type VmIssue = {
14
+ /** Human-readable diagnostic message. */
15
+ message: string;
16
+ /** Stable machine-readable code. */
17
+ code: string;
18
+ /** Diagnostic category. */
19
+ type: string;
20
+ /** Diagnostic severity. */
21
+ severity: 'error' | 'warning' | 'info';
22
+ /** Optional source location. */
23
+ location?: {
24
+ fileName?: string;
25
+ startLineNumber?: number;
26
+ startColumn?: number;
27
+ endLineNumber?: number;
28
+ endColumn?: number;
29
+ };
30
+ /** Optional original error object or metadata. */
31
+ details?: unknown;
32
+ };
33
+ /**
34
+ * Minimal filesystem contract required by the VM bundler. Paths are rooted: `''` is the root and descendants carry
35
+ * no leading slash.
36
+ *
37
+ * @public
38
+ */
39
+ export type VmFileSystem = {
40
+ /** Return true when a path exists. */
41
+ exists(path: string): Promise<boolean>;
42
+ /** Read a file as binary bytes. */
43
+ readFile(path: string): Promise<Uint8Array<ArrayBuffer>>;
44
+ /** Read a file as UTF-8 text. */
45
+ readFile(path: string, encoding: 'utf8'): Promise<string>;
46
+ /** Write a UTF-8 text file. */
47
+ writeFile(path: string, content: string): Promise<void>;
48
+ /** Ensure a directory exists, creating parents as needed. */
49
+ ensureDir(path: string): Promise<void>;
50
+ };
51
+ /**
52
+ * A pre-bundled module served from memory under its import specifier.
53
+ *
54
+ * @public
55
+ */
56
+ export type BuiltinModule = {
57
+ /** ESM source of the module. */
58
+ code: string;
59
+ /** Version reported for the module. */
60
+ version: string;
61
+ /** Script global that bundles bind to this module; bound only when `registryExpression` is set. */
62
+ globalName?: string;
63
+ /** The npm package this module stands for, as a project declares it in `package.json`. */
64
+ package?: {
65
+ readonly name: string;
66
+ readonly spec: string;
67
+ };
68
+ /** JavaScript expression evaluating to the module's exports, which a bundle binds to `globalName`. */
69
+ registryExpression?: string;
70
+ };
71
+ /**
72
+ * Outcome of bundling an entry point: executable code plus diagnostics.
73
+ *
74
+ * @public
75
+ */
76
+ export type BundleResult = {
77
+ code: string;
78
+ sourceMap?: string;
79
+ issues: VmIssue[];
80
+ success: boolean;
81
+ dependencies: string[];
82
+ unresolvedPaths: string[];
83
+ };
84
+ /**
85
+ * Result of executing bundled ESM code.
86
+ *
87
+ * @public
88
+ */
89
+ export type VmExecuteResult<T = unknown> = {
90
+ success: true;
91
+ value: T;
92
+ entryUrl?: string;
93
+ } | {
94
+ success: false;
95
+ issues: VmIssue[];
96
+ };
97
+ /**
98
+ * The ESM module VM GeoSpec bundles and executes specs and configs with.
99
+ *
100
+ * @public
101
+ */
102
+ export type ModuleVm = {
103
+ /** Detect bare specifiers and project dependencies without fetching anything. */
104
+ detectImports(entryPath: string, signal?: AbortSignal): Promise<{
105
+ detectedModules: string[];
106
+ dependencies: string[];
107
+ }>;
108
+ /** Bundle an ESM entry point and its transitive dependency graph. */
109
+ bundle(entryPath: string, signal?: AbortSignal): Promise<BundleResult>;
110
+ /** Execute bundled ESM code in the current JavaScript environment. */
111
+ execute<T = unknown>(code: string, signal?: AbortSignal): Promise<VmExecuteResult<T>>;
112
+ /** Register an in-memory builtin module. */
113
+ registerModule(name: string, module: BuiltinModule): void;
114
+ /** Release VM-owned resources. */
115
+ dispose(): void;
116
+ };
117
+ /**
118
+ * Options GeoSpec passes when it creates a module VM.
119
+ *
120
+ * @public
121
+ */
122
+ export type ModuleVmOptions = {
123
+ /** Filesystem the VM reads project files from. */
124
+ filesystem: VmFileSystem;
125
+ };
126
+ /**
127
+ * Create a module VM. A host injects one to replace GeoSpec's plain default (see `createPlainModuleVm`), for
128
+ * example to resolve npm packages; Tau injects `createEsbuildModuleVm` from its esbuild plugin.
129
+ *
130
+ * @public
131
+ */
132
+ export type CreateModuleVm = (options: ModuleVmOptions) => Promise<ModuleVm>;
133
+ /**
134
+ * A module a Node pool worker imports by URL for its module VM: a worker receives strings only, so a host that
135
+ * injects a VM into a pool names a module whose default export is the factory.
136
+ *
137
+ * @public
138
+ */
139
+ export type GeoSpecModuleVmModule = {
140
+ default: CreateModuleVm;
141
+ };
142
+ //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "geospec",
3
- "version": "0.1.0-beta.9",
3
+ "version": "0.4.1-next.331",
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": [
@@ -12,12 +12,12 @@
12
12
  "private": false,
13
13
  "repository": {
14
14
  "type": "git",
15
- "url": "git+https://github.com/taucad/tau.git",
15
+ "url": "git+https://github.com/taucad/geospec.git",
16
16
  "directory": "packages/geospec"
17
17
  },
18
- "homepage": "https://github.com/taucad/tau/tree/main/packages/geospec#readme",
18
+ "homepage": "https://github.com/taucad/geospec/tree/main/packages/geospec#readme",
19
19
  "bugs": {
20
- "url": "https://github.com/taucad/tau/issues"
20
+ "url": "https://github.com/taucad/geospec/issues"
21
21
  },
22
22
  "main": "./dist/index.mjs",
23
23
  "types": "./dist/index.d.mts",
@@ -97,6 +97,11 @@
97
97
  "import": "./dist/vitest/index.mjs",
98
98
  "default": "./dist/vitest/index.mjs"
99
99
  },
100
+ "./vitest/node": {
101
+ "types": "./dist/vitest/node/index.d.mts",
102
+ "import": "./dist/vitest/node/index.mjs",
103
+ "default": "./dist/vitest/node/index.mjs"
104
+ },
100
105
  "./config": {
101
106
  "types": "./dist/config/index.d.mts",
102
107
  "import": "./dist/config/index.mjs",
@@ -118,13 +123,16 @@
118
123
  },
119
124
  "imports": {},
120
125
  "dependencies": {
121
- "geospec-engine": "0.3.1",
122
- "zod": "4.4.3",
123
- "@taucad/esbuild": "0.1.0-beta.9",
124
- "@taucad/runtime": "0.1.0-beta.9"
126
+ "esbuild": "0.28.2",
127
+ "zod": "4.6.7",
128
+ "geospec-engine": "0.4.1-next.331"
125
129
  },
126
130
  "devDependencies": {
127
- "@gltf-transform/core": "^4.5.1"
131
+ "@gltf-transform/core": "4.5.1",
132
+ "@vitest/coverage-v8": "4.1.11",
133
+ "fast-check": "4.10.2",
134
+ "vitest": "4.1.11",
135
+ "vitest-mock-extended": "4.0.0"
128
136
  },
129
137
  "tau": {
130
138
  "skills": "./agent/skills.json"
@@ -1,85 +0,0 @@
1
- # geospec — Types (2)
2
-
3
- 1 top-level symbols. Signatures are verbatim typescript.
4
-
5
- // Direct geometry-source model load options
6
- LoadModelSourceOptions: {
7
- /** Geometry bytes, path, browser file/blob, or in-memory mesh buffer. */
8
- source: MeshSource | StepSource;
9
- /** Named external resources consumed alongside the direct geometry bytes. */
10
- resources?: ReadonlyArray<{
11
- readonly name: string;
12
- readonly source: MeshSource | StepSource;
13
- }>;
14
- /**
15
- * Project-relative folder a path `source` and each resource path resolve in. Omitted, they resolve against the
16
- * project root. Recorded in the load evidence.
17
- */
18
- rootDir?: string;
19
- /** Source geometry format. Defaults to `glb`. */
20
- format?: GeoSpecModelFormat;
21
- /** Source path recorded in provenance. */
22
- path?: string;
23
- /** Human-readable source name recorded in provenance. */
24
- name?: string;
25
- /** Coordinate unit of raw GLB/glTF or mesh-buffer data before canonical millimetre normalization. */
26
- sourceUnit?: GeoSpecUnit;
27
- /** Explicit parameters recorded in provenance. */
28
- parameters?: Record<string, unknown>;
29
- /** STEP reader strategy used for STEP sources. */
30
- stepStreaming?: StepStreamingMode;
31
- /** Whether STEP loading should also produce mesh evidence. Defaults to true. */
32
- mesh?: boolean;
33
- /** Linear tolerance used while meshing exact BRep evidence. */
34
- meshLinearTolerance?: number;
35
- /** Angular tolerance in degrees used while meshing exact BRep evidence. */
36
- meshAngularToleranceDegrees?: number;
37
- /**
38
- * Default work-unit budget for every claim on this subject: a positive integer no greater than
39
- * the host's maximum (default `geoSpecMaximumWorkUnitLimit`, 512 000 000). `expectGeo(subject, { workUnitLimit })` overrides
40
- * it per chain. Recorded in the load evidence; it never changes the exported or admitted bytes.
41
- */
42
- workUnitLimit?: number;
43
- }
44
-
45
- // Geometry bytes, path, browser file/blob, or in-memory mesh buffer
46
- source: MeshSource | StepSource
47
-
48
- // Named external resources consumed alongside the direct geometry bytes
49
- resources?: ReadonlyArray<{
50
- readonly name: string;
51
- readonly source: MeshSource | StepSource;
52
- }>
53
-
54
- // Project-relative folder a path `source` and each resource path resolve in
55
- rootDir?: string
56
-
57
- // Source geometry format
58
- format?: GeoSpecModelFormat
59
-
60
- // Source path recorded in provenance
61
- path?: string
62
-
63
- // Human-readable source name recorded in provenance
64
- name?: string
65
-
66
- // Coordinate unit of raw GLB/glTF or mesh-buffer data before canonical millimetre normalization
67
- sourceUnit?: GeoSpecUnit
68
-
69
- // Explicit parameters recorded in provenance
70
- parameters?: Record<string, unknown>
71
-
72
- // STEP reader strategy used for STEP sources
73
- stepStreaming?: StepStreamingMode
74
-
75
- // Whether STEP loading should also produce mesh evidence
76
- mesh?: boolean
77
-
78
- // Linear tolerance used while meshing exact BRep evidence
79
- meshLinearTolerance?: number
80
-
81
- // Angular tolerance in degrees used while meshing exact BRep evidence
82
- meshAngularToleranceDegrees?: number
83
-
84
- // Default work-unit budget for every claim on this subject
85
- workUnitLimit?: number