@selvajs/compute 1.5.1 → 1.5.2-beta.1

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 (61) hide show
  1. package/README.md +12 -8
  2. package/dist/chunk-2D74PNQU.cjs +2 -0
  3. package/dist/chunk-2D74PNQU.cjs.map +1 -0
  4. package/dist/chunk-5465MDT4.cjs +2 -0
  5. package/dist/chunk-5465MDT4.cjs.map +1 -0
  6. package/dist/chunk-DADFXYBV.js +2 -0
  7. package/dist/chunk-DADFXYBV.js.map +1 -0
  8. package/dist/chunk-MZGKJZVP.cjs +2 -0
  9. package/dist/chunk-MZGKJZVP.cjs.map +1 -0
  10. package/dist/chunk-RHULSS7S.js +3 -0
  11. package/dist/chunk-RHULSS7S.js.map +1 -0
  12. package/dist/chunk-VWOEUM7C.cjs +3 -0
  13. package/dist/chunk-VWOEUM7C.cjs.map +1 -0
  14. package/dist/chunk-XIBQV4XW.js +2 -0
  15. package/dist/chunk-XIBQV4XW.js.map +1 -0
  16. package/dist/chunk-XLHA5YPH.js +2 -0
  17. package/dist/chunk-XLHA5YPH.js.map +1 -0
  18. package/dist/core.cjs +1 -1
  19. package/dist/core.d.cts +3 -21
  20. package/dist/core.d.ts +3 -21
  21. package/dist/core.js +1 -1
  22. package/dist/errors-CiA83qw2.d.cts +510 -0
  23. package/dist/errors-CiA83qw2.d.ts +510 -0
  24. package/dist/grasshopper.cjs +1 -1
  25. package/dist/grasshopper.d.cts +75 -142
  26. package/dist/grasshopper.d.ts +75 -142
  27. package/dist/grasshopper.js +1 -1
  28. package/dist/index.cjs +1 -1
  29. package/dist/index.d.cts +3 -5
  30. package/dist/index.d.ts +3 -5
  31. package/dist/index.js +1 -1
  32. package/dist/visualization-3HFOMXUY.cjs +2 -0
  33. package/dist/visualization-3HFOMXUY.cjs.map +1 -0
  34. package/dist/visualization-XXHESVUI.js +2 -0
  35. package/dist/visualization-XXHESVUI.js.map +1 -0
  36. package/dist/visualization.cjs +1 -1
  37. package/dist/visualization.cjs.map +1 -1
  38. package/dist/visualization.d.cts +1 -76
  39. package/dist/visualization.d.ts +1 -76
  40. package/dist/visualization.js +1 -1
  41. package/dist/visualization.js.map +1 -1
  42. package/package.json +1 -1
  43. package/LICENSE.md +0 -21
  44. package/dist/base-dtik4Dlu.d.cts +0 -138
  45. package/dist/base-dtik4Dlu.d.ts +0 -138
  46. package/dist/chunk-FRSLCR7G.cjs +0 -2
  47. package/dist/chunk-FRSLCR7G.cjs.map +0 -1
  48. package/dist/chunk-IJZNCO5X.cjs +0 -3
  49. package/dist/chunk-IJZNCO5X.cjs.map +0 -1
  50. package/dist/chunk-LNIUUPA5.cjs +0 -2
  51. package/dist/chunk-LNIUUPA5.cjs.map +0 -1
  52. package/dist/chunk-PZ4HZLFJ.js +0 -2
  53. package/dist/chunk-PZ4HZLFJ.js.map +0 -1
  54. package/dist/chunk-VK2TSW7S.js +0 -3
  55. package/dist/chunk-VK2TSW7S.js.map +0 -1
  56. package/dist/chunk-WXQGTKU6.js +0 -2
  57. package/dist/chunk-WXQGTKU6.js.map +0 -1
  58. package/dist/schemas-Ct7lU-IH.d.cts +0 -247
  59. package/dist/schemas-Ct7lU-IH.d.ts +0 -247
  60. package/dist/types-B24K2LG4.d.cts +0 -85
  61. package/dist/types-B24K2LG4.d.ts +0 -85
@@ -1,120 +1,6 @@
1
- import { R as RhinoComputeError, C as ComputeServerStats } from './base-dtik4Dlu.cjs';
2
- import { b as DataTreeDefault, O as OutputParamSchema, f as InputParamSchema, R as RetryPolicy, d as GrasshopperComputeResponse, a as DataTree, G as GrasshopperComputeConfig, C as ComputeConfig, c as DataTreePath } from './schemas-Ct7lU-IH.cjs';
3
- export { D as DataItem, e as GrasshopperRequestSchema, I as InnerTreeData, g as RhinoModelUnit } from './schemas-Ct7lU-IH.cjs';
1
+ import { R as RetryPolicy, h as GrasshopperComputeResponse, o as RhinoComputeError, b as DataTree, g as GrasshopperComputeConfig, a as ComputeServerStats, i as GrasshopperParsedIO, j as GrasshopperParsedIORaw, C as ComputeConfig, m as InputParamSchema, l as InputParam, c as DataTreeDefault, d as DataTreePath } from './errors-CiA83qw2.cjs';
2
+ export { B as BooleanInputType, D as DataItem, e as DefaultValue, F as FileInputType, G as GeometryInputType, k as GrasshopperRequestSchema, I as InnerTreeData, N as NumericInputType, O as OutputParamSchema, n as OutputType, p as RhinoModelUnit, T as TextInputType, V as ValueListInputType } from './errors-CiA83qw2.cjs';
4
3
  import * as THREE from 'three';
5
- import { M as MeshExtractionOptions } from './types-B24K2LG4.cjs';
6
-
7
- /**
8
- * Input and output parameter types
9
- */
10
-
11
- /**
12
- * Output types supported from Grasshopper/Rhino Compute
13
- */
14
- type OutputType = 'System.String' | 'System.Double' | 'System.Int32' | 'System.Boolean' | 'Rhino.Geometry.Point3d' | 'Rhino.Geometry.Line' | 'Rhino.Geometry.Circle' | 'Rhino.Geometry.Arc' | 'Rhino.Geometry.NurbsCurve' | 'Rhino.Geometry.Brep' | 'Rhino.Geometry.Mesh' | 'Rhino.Geometry.Vector3d' | 'Rhino.Geometry.Plane' | 'Rhino.Geometry.Box' | string;
15
- /**
16
- * Union type for all possible default value types
17
- */
18
- type DefaultValue<T> = T | T[] | DataTreeDefault<T> | undefined | null;
19
- /**
20
- * Base properties common to all processed input types.
21
- * Note: `groupName` and `id` require the custom Rhino Compute branch.
22
- */
23
- interface BaseInputType {
24
- description: string;
25
- name: string;
26
- nickname: string | null;
27
- treeAccess: boolean;
28
- /**
29
- * Name of the group this parameter belongs to.
30
- * @requires Custom branch of compute.rhino3d
31
- */
32
- groupName?: string;
33
- /**
34
- * Unique identifier for the parameter.
35
- * @requires Custom branch of compute.rhino3d
36
- */
37
- id?: string;
38
- }
39
- /**
40
- * Numeric input type (Number or Integer)
41
- */
42
- interface NumericInputType extends BaseInputType {
43
- paramType: 'Number' | 'Integer';
44
- minimum?: number | null;
45
- maximum?: number | null;
46
- atLeast?: number | null;
47
- atMost?: number | null;
48
- stepSize?: number | null;
49
- default: DefaultValue<number>;
50
- }
51
- /**
52
- * Text input type
53
- */
54
- interface TextInputType extends BaseInputType {
55
- paramType: 'Text';
56
- default: DefaultValue<string>;
57
- }
58
- /**
59
- * Boolean input type
60
- */
61
- interface BooleanInputType extends BaseInputType {
62
- paramType: 'Boolean';
63
- default: DefaultValue<boolean>;
64
- }
65
- /**
66
- * Geometry input type (generic geometry)
67
- */
68
- interface GeometryInputType extends BaseInputType {
69
- paramType: 'Geometry';
70
- default: DefaultValue<object | string>;
71
- }
72
- /**
73
- * ValueList input type (dropdown/select)
74
- */
75
- interface ValueListInputType extends BaseInputType {
76
- paramType: 'ValueList';
77
- values: Record<string, string>;
78
- default?: string;
79
- }
80
- /**
81
- * File input type
82
- */
83
- interface FileInputType extends BaseInputType {
84
- paramType: 'File';
85
- acceptedFormats?: string[];
86
- default: DefaultValue<object | string>;
87
- }
88
- /**
89
- * Color input type (stored as hex string)
90
- */
91
- interface ColorInputType extends BaseInputType {
92
- paramType: 'Color';
93
- default: DefaultValue<string>;
94
- }
95
- /**
96
- * Discriminated union of all input parameter types
97
- */
98
- type InputParam = NumericInputType | BooleanInputType | TextInputType | ValueListInputType | GeometryInputType | FileInputType | ColorInputType;
99
-
100
- /**
101
- * Parsed data structures for processed Grasshopper input/output
102
- */
103
-
104
- /**
105
- * Parsed input/output structure with raw schemas
106
- */
107
- interface GrasshopperParsedIORaw {
108
- inputs: InputParamSchema[];
109
- outputs: OutputParamSchema[];
110
- }
111
- /**
112
- * Parsed input/output structure with processed types
113
- */
114
- interface GrasshopperParsedIO {
115
- inputs: InputParam[];
116
- outputs: OutputParamSchema[];
117
- }
118
4
 
119
5
  /**
120
6
  * Scheduling mode — controls how concurrent `solve()` calls interact.
@@ -148,9 +34,9 @@ interface SolveSchedulerOptions {
148
34
  interface SolveContext {
149
35
  /** Stable hash of (definition, dataTree). */
150
36
  key: string;
151
- /** Wall-clock timestamp when scheduler.solve() was called. */
37
+ /** Timestamp when scheduler.solve() was called. */
152
38
  enqueuedAt: number;
153
- /** Wall-clock timestamp when execution actually started (after queueing). */
39
+ /** Timestamp when execution actually started (after queueing). */
154
40
  startedAt: number | null;
155
41
  }
156
42
  type SolveResult = {
@@ -237,10 +123,12 @@ declare class SolveScheduler {
237
123
  * Schedule a solve. Returns a promise that:
238
124
  * - Resolves with the compute response on success.
239
125
  * - Rejects with `RhinoComputeError` on failure.
240
- * - Rejects with `code: ErrorCodes.UNKNOWN_ERROR` and `message: 'Superseded'`
241
- * when the call was canceled because newer values arrived (latest-wins mode).
126
+ * - Rejects with `code: ErrorCodes.SUPERSEDED` when the call was canceled because
127
+ * newer values arrived (latest-wins mode).
128
+ * - Rejects with `code: ErrorCodes.ABORTED` when the call was canceled via
129
+ * caller-supplied signal or `cancelAll()`.
242
130
  *
243
- * Caller-supplied `signal` cancels just this call (rejects with abort error).
131
+ * Caller-supplied `signal` cancels just this call (rejects with `ABORTED`).
244
132
  */
245
133
  solve(definition: string | Uint8Array, dataTree: DataTree[], options?: {
246
134
  signal?: AbortSignal;
@@ -250,8 +138,11 @@ declare class SolveScheduler {
250
138
  private drainNext;
251
139
  private supersede;
252
140
  private makeAbortError;
141
+ private isAbortLikeError;
142
+ private normalizeExecutionError;
253
143
  /** Cancel everything — in-flight and pending. */
254
144
  cancelAll(): void;
145
+ private rejectAsAborted;
255
146
  private readCache;
256
147
  private writeCache;
257
148
  clearCache(): void;
@@ -259,13 +150,6 @@ declare class SolveScheduler {
259
150
  private runHook;
260
151
  }
261
152
 
262
- /**
263
- * Hash a (definition, dataTree) pair into a short stable key.
264
- * For Uint8Array definitions we use length + endpoint bytes rather than the
265
- * full content to keep hashing cheap.
266
- */
267
- declare function hashSolveInput(definition: string | Uint8Array, dataTree: unknown): string;
268
-
269
153
  /**
270
154
  * Per-call options that override the client's default ComputeConfig values.
271
155
  *
@@ -422,6 +306,31 @@ type FileBaseInfo = {
422
306
  filePath: string;
423
307
  };
424
308
 
309
+ /**
310
+ * Options for parsing mesh batch data.
311
+ */
312
+ interface MeshBatchParsingOptions {
313
+ /** Merge meshes with same material into single geometry (better performance). Defaults to true. */
314
+ mergeByMaterial?: boolean;
315
+ /** Apply coordinate system transformations (Rhino Z-up to Three.js Y-up). Defaults to true. */
316
+ applyTransforms?: boolean;
317
+ /** Enable performance monitoring in console. Defaults to false. */
318
+ debug?: boolean;
319
+ }
320
+ /**
321
+ * Options for extracting and processing meshes from compute responses.
322
+ */
323
+ interface MeshExtractionOptions {
324
+ /** Configuration for parsing mesh batches. */
325
+ parsing?: MeshBatchParsingOptions;
326
+ /** Apply scaling based on model units. Defaults to true. */
327
+ allowScaling?: boolean;
328
+ /** Apply automatic ground offset positioning (Z=0). Defaults to true. */
329
+ allowAutoPosition?: boolean;
330
+ /** Enable verbose logging. Defaults to false. */
331
+ debug?: boolean;
332
+ }
333
+
425
334
  interface ParsedContext {
426
335
  [key: string]: any;
427
336
  }
@@ -475,29 +384,31 @@ declare class GrasshopperResponseProcessor {
475
384
  */
476
385
  getValues<T = ParsedContext>(byId?: boolean, options?: GetValuesOptions): GetValuesResult<T>;
477
386
  /**
478
- * Retrieve a specific value using the parameter name.
387
+ * Retrieve a specific value by parameter name or ID.
479
388
  *
480
- * @param paramName - Human-readable parameter name from the Grasshopper definition.
389
+ * @param selector - `{ byName }` for the human-readable name, `{ byId }` for the parameter GUID.
481
390
  * @param options - Parsing configuration (e.g. disable parsing or enable Rhino).
482
391
  * @returns Single parsed value, array of values, or undefined if the parameter is absent.
483
392
  *
484
393
  * @example
485
394
  * ```ts
486
- * const schema = processor.getValueByParamName('Schema');
395
+ * const schema = processor.getValue({ byName: 'Schema' });
396
+ * const output = processor.getValue({ byId: 'a4be1c1e-23f9-4c27-b942-7f3bb2c45c6f' });
487
397
  * ```
398
+ *
399
+ * **Note:** `byId` only works with the custom VektorNode rhino.compute branch.
400
+ */
401
+ getValue(selector: {
402
+ byName: string;
403
+ } | {
404
+ byId: string;
405
+ }, options?: GetValuesOptions): any;
406
+ /**
407
+ * @deprecated Use `getValue({ byName })` instead.
488
408
  */
489
409
  getValueByParamName(paramName: string, options?: GetValuesOptions): any;
490
410
  /**
491
- * Retrieve a specific value using the parameter ID.
492
- *
493
- * @param paramId - Parameter GUID from the Grasshopper definition.
494
- * @param options - Parsing configuration (e.g. disable parsing or enable Rhino).
495
- * @returns Parsed value, array of values, or undefined if not present.
496
- *
497
- * @example
498
- * ```ts
499
- * const output = processor.getValueByParamId('a4be1c1e-23f9-4c27-b942-7f3bb2c45c6f');
500
- * ```
411
+ * @deprecated Use `getValue({ byId })` instead.
501
412
  */
502
413
  getValueByParamId(paramId: string, options?: GetValuesOptions): any;
503
414
  /**
@@ -569,6 +480,12 @@ declare class GrasshopperResponseProcessor {
569
480
  getAndDownloadFiles(folderName: string, additionalFiles?: FileBaseInfo[] | FileBaseInfo | null): void;
570
481
  }
571
482
 
483
+ /**
484
+ * Hash definition and data tree into a stable cache key.
485
+ * For Uint8Array, uses length + samples to keep hashing fast.
486
+ */
487
+ declare function hashSolveInput(definition: string | Uint8Array, dataTree: unknown): string;
488
+
572
489
  /**
573
490
  * Runs a Rhino Compute job using the provided tree prototypes and Grasshopper definition.
574
491
  *
@@ -886,6 +803,11 @@ declare class TreeBuilder {
886
803
  */
887
804
  static replaceTreeValue(trees: TreeBuilder[], paramName: string, newValue: DataTreeValue): TreeBuilder[];
888
805
  static replaceTreeValue(trees: DataTree[], paramName: string, newValue: DataTreeValue): DataTree[];
806
+ /**
807
+ * Build a TreeBuilder from a single value, dispatching on shape:
808
+ * DataTreeDefault structure, array, or scalar.
809
+ */
810
+ private static buildFromValue;
889
811
  /**
890
812
  * Extract a value from a TreeBuilder or InnerTree array by parameter name.
891
813
  *
@@ -930,6 +852,17 @@ declare class TreeBuilder {
930
852
  */
931
853
  static getTreeValue(trees: TreeBuilder[], paramName: string): DataTreeValue | null;
932
854
  static getTreeValue(trees: DataTree[], paramName: string): DataTreeValue | null;
855
+ /**
856
+ * Read all values for `paramName` across every branch of the matching builder.
857
+ * Returns null when the builder isn't found.
858
+ */
859
+ private static readFromBuilders;
860
+ /**
861
+ * Read values from the first branch of the matching compiled InnerTree
862
+ * (multi-branch responses are not flattened — current semantics, pinned by
863
+ * the "reads from the first branch path only" test).
864
+ */
865
+ private static readFromDataTrees;
933
866
  /**
934
867
  * Parse a TreeBuilder path string like "{0;1;2}" into [0, 1, 2].
935
868
  *
@@ -1011,4 +944,4 @@ declare const extractFilesFromComputeResponse: (downloadableFiles: FileData[], a
1011
944
  */
1012
945
  declare const downloadFileData: (downloadableFiles: FileData[], fileFoldername: string, additionalFiles?: FileBaseInfo[] | FileBaseInfo | null) => Promise<void>;
1013
946
 
1014
- export { type BooleanInputType, type CacheOptions, ComputeConfig, DataTree, DataTreeDefault, DataTreePath, type DataTreeValue, type DefaultValue, type FileBaseInfo, type FileData, type FileInputType, type GeometryInputType, type GetValuesOptions, type GetValuesResult, GrasshopperClient, GrasshopperComputeConfig, GrasshopperComputeResponse, type GrasshopperParsedIO, type GrasshopperParsedIORaw, GrasshopperResponseProcessor, type InputParam, InputParamSchema, type NumericInputType, OutputParamSchema, type OutputType, type ParsedContext, type ProcessedFile, RetryPolicy, RhinoComputeError, type SchedulerMode, type SolveContext, type SolveExecutor, type SolveOptions, type SolveResult, SolveScheduler, type SolveSchedulerOptions, type TextInputType, TreeBuilder, type ValueListInputType, downloadFileData, extractFilesFromComputeResponse, fetchDefinitionIO, fetchParsedDefinitionIO, hashSolveInput, processInput, processInputs, solveGrasshopperDefinition };
947
+ export { type CacheOptions, ComputeConfig, DataTree, DataTreeDefault, DataTreePath, type DataTreeValue, type FileBaseInfo, type FileData, type GetValuesOptions, type GetValuesResult, GrasshopperClient, GrasshopperComputeConfig, GrasshopperComputeResponse, GrasshopperParsedIO, GrasshopperParsedIORaw, GrasshopperResponseProcessor, InputParam, InputParamSchema, type ParsedContext, type ProcessedFile, RetryPolicy, RhinoComputeError, type SchedulerMode, type SolveContext, type SolveExecutor, type SolveOptions, type SolveResult, SolveScheduler, type SolveSchedulerOptions, TreeBuilder, downloadFileData, extractFilesFromComputeResponse, fetchDefinitionIO, fetchParsedDefinitionIO, hashSolveInput, processInput, processInputs, solveGrasshopperDefinition };
@@ -1,120 +1,6 @@
1
- import { R as RhinoComputeError, C as ComputeServerStats } from './base-dtik4Dlu.js';
2
- import { b as DataTreeDefault, O as OutputParamSchema, f as InputParamSchema, R as RetryPolicy, d as GrasshopperComputeResponse, a as DataTree, G as GrasshopperComputeConfig, C as ComputeConfig, c as DataTreePath } from './schemas-Ct7lU-IH.js';
3
- export { D as DataItem, e as GrasshopperRequestSchema, I as InnerTreeData, g as RhinoModelUnit } from './schemas-Ct7lU-IH.js';
1
+ import { R as RetryPolicy, h as GrasshopperComputeResponse, o as RhinoComputeError, b as DataTree, g as GrasshopperComputeConfig, a as ComputeServerStats, i as GrasshopperParsedIO, j as GrasshopperParsedIORaw, C as ComputeConfig, m as InputParamSchema, l as InputParam, c as DataTreeDefault, d as DataTreePath } from './errors-CiA83qw2.js';
2
+ export { B as BooleanInputType, D as DataItem, e as DefaultValue, F as FileInputType, G as GeometryInputType, k as GrasshopperRequestSchema, I as InnerTreeData, N as NumericInputType, O as OutputParamSchema, n as OutputType, p as RhinoModelUnit, T as TextInputType, V as ValueListInputType } from './errors-CiA83qw2.js';
4
3
  import * as THREE from 'three';
5
- import { M as MeshExtractionOptions } from './types-B24K2LG4.js';
6
-
7
- /**
8
- * Input and output parameter types
9
- */
10
-
11
- /**
12
- * Output types supported from Grasshopper/Rhino Compute
13
- */
14
- type OutputType = 'System.String' | 'System.Double' | 'System.Int32' | 'System.Boolean' | 'Rhino.Geometry.Point3d' | 'Rhino.Geometry.Line' | 'Rhino.Geometry.Circle' | 'Rhino.Geometry.Arc' | 'Rhino.Geometry.NurbsCurve' | 'Rhino.Geometry.Brep' | 'Rhino.Geometry.Mesh' | 'Rhino.Geometry.Vector3d' | 'Rhino.Geometry.Plane' | 'Rhino.Geometry.Box' | string;
15
- /**
16
- * Union type for all possible default value types
17
- */
18
- type DefaultValue<T> = T | T[] | DataTreeDefault<T> | undefined | null;
19
- /**
20
- * Base properties common to all processed input types.
21
- * Note: `groupName` and `id` require the custom Rhino Compute branch.
22
- */
23
- interface BaseInputType {
24
- description: string;
25
- name: string;
26
- nickname: string | null;
27
- treeAccess: boolean;
28
- /**
29
- * Name of the group this parameter belongs to.
30
- * @requires Custom branch of compute.rhino3d
31
- */
32
- groupName?: string;
33
- /**
34
- * Unique identifier for the parameter.
35
- * @requires Custom branch of compute.rhino3d
36
- */
37
- id?: string;
38
- }
39
- /**
40
- * Numeric input type (Number or Integer)
41
- */
42
- interface NumericInputType extends BaseInputType {
43
- paramType: 'Number' | 'Integer';
44
- minimum?: number | null;
45
- maximum?: number | null;
46
- atLeast?: number | null;
47
- atMost?: number | null;
48
- stepSize?: number | null;
49
- default: DefaultValue<number>;
50
- }
51
- /**
52
- * Text input type
53
- */
54
- interface TextInputType extends BaseInputType {
55
- paramType: 'Text';
56
- default: DefaultValue<string>;
57
- }
58
- /**
59
- * Boolean input type
60
- */
61
- interface BooleanInputType extends BaseInputType {
62
- paramType: 'Boolean';
63
- default: DefaultValue<boolean>;
64
- }
65
- /**
66
- * Geometry input type (generic geometry)
67
- */
68
- interface GeometryInputType extends BaseInputType {
69
- paramType: 'Geometry';
70
- default: DefaultValue<object | string>;
71
- }
72
- /**
73
- * ValueList input type (dropdown/select)
74
- */
75
- interface ValueListInputType extends BaseInputType {
76
- paramType: 'ValueList';
77
- values: Record<string, string>;
78
- default?: string;
79
- }
80
- /**
81
- * File input type
82
- */
83
- interface FileInputType extends BaseInputType {
84
- paramType: 'File';
85
- acceptedFormats?: string[];
86
- default: DefaultValue<object | string>;
87
- }
88
- /**
89
- * Color input type (stored as hex string)
90
- */
91
- interface ColorInputType extends BaseInputType {
92
- paramType: 'Color';
93
- default: DefaultValue<string>;
94
- }
95
- /**
96
- * Discriminated union of all input parameter types
97
- */
98
- type InputParam = NumericInputType | BooleanInputType | TextInputType | ValueListInputType | GeometryInputType | FileInputType | ColorInputType;
99
-
100
- /**
101
- * Parsed data structures for processed Grasshopper input/output
102
- */
103
-
104
- /**
105
- * Parsed input/output structure with raw schemas
106
- */
107
- interface GrasshopperParsedIORaw {
108
- inputs: InputParamSchema[];
109
- outputs: OutputParamSchema[];
110
- }
111
- /**
112
- * Parsed input/output structure with processed types
113
- */
114
- interface GrasshopperParsedIO {
115
- inputs: InputParam[];
116
- outputs: OutputParamSchema[];
117
- }
118
4
 
119
5
  /**
120
6
  * Scheduling mode — controls how concurrent `solve()` calls interact.
@@ -148,9 +34,9 @@ interface SolveSchedulerOptions {
148
34
  interface SolveContext {
149
35
  /** Stable hash of (definition, dataTree). */
150
36
  key: string;
151
- /** Wall-clock timestamp when scheduler.solve() was called. */
37
+ /** Timestamp when scheduler.solve() was called. */
152
38
  enqueuedAt: number;
153
- /** Wall-clock timestamp when execution actually started (after queueing). */
39
+ /** Timestamp when execution actually started (after queueing). */
154
40
  startedAt: number | null;
155
41
  }
156
42
  type SolveResult = {
@@ -237,10 +123,12 @@ declare class SolveScheduler {
237
123
  * Schedule a solve. Returns a promise that:
238
124
  * - Resolves with the compute response on success.
239
125
  * - Rejects with `RhinoComputeError` on failure.
240
- * - Rejects with `code: ErrorCodes.UNKNOWN_ERROR` and `message: 'Superseded'`
241
- * when the call was canceled because newer values arrived (latest-wins mode).
126
+ * - Rejects with `code: ErrorCodes.SUPERSEDED` when the call was canceled because
127
+ * newer values arrived (latest-wins mode).
128
+ * - Rejects with `code: ErrorCodes.ABORTED` when the call was canceled via
129
+ * caller-supplied signal or `cancelAll()`.
242
130
  *
243
- * Caller-supplied `signal` cancels just this call (rejects with abort error).
131
+ * Caller-supplied `signal` cancels just this call (rejects with `ABORTED`).
244
132
  */
245
133
  solve(definition: string | Uint8Array, dataTree: DataTree[], options?: {
246
134
  signal?: AbortSignal;
@@ -250,8 +138,11 @@ declare class SolveScheduler {
250
138
  private drainNext;
251
139
  private supersede;
252
140
  private makeAbortError;
141
+ private isAbortLikeError;
142
+ private normalizeExecutionError;
253
143
  /** Cancel everything — in-flight and pending. */
254
144
  cancelAll(): void;
145
+ private rejectAsAborted;
255
146
  private readCache;
256
147
  private writeCache;
257
148
  clearCache(): void;
@@ -259,13 +150,6 @@ declare class SolveScheduler {
259
150
  private runHook;
260
151
  }
261
152
 
262
- /**
263
- * Hash a (definition, dataTree) pair into a short stable key.
264
- * For Uint8Array definitions we use length + endpoint bytes rather than the
265
- * full content to keep hashing cheap.
266
- */
267
- declare function hashSolveInput(definition: string | Uint8Array, dataTree: unknown): string;
268
-
269
153
  /**
270
154
  * Per-call options that override the client's default ComputeConfig values.
271
155
  *
@@ -422,6 +306,31 @@ type FileBaseInfo = {
422
306
  filePath: string;
423
307
  };
424
308
 
309
+ /**
310
+ * Options for parsing mesh batch data.
311
+ */
312
+ interface MeshBatchParsingOptions {
313
+ /** Merge meshes with same material into single geometry (better performance). Defaults to true. */
314
+ mergeByMaterial?: boolean;
315
+ /** Apply coordinate system transformations (Rhino Z-up to Three.js Y-up). Defaults to true. */
316
+ applyTransforms?: boolean;
317
+ /** Enable performance monitoring in console. Defaults to false. */
318
+ debug?: boolean;
319
+ }
320
+ /**
321
+ * Options for extracting and processing meshes from compute responses.
322
+ */
323
+ interface MeshExtractionOptions {
324
+ /** Configuration for parsing mesh batches. */
325
+ parsing?: MeshBatchParsingOptions;
326
+ /** Apply scaling based on model units. Defaults to true. */
327
+ allowScaling?: boolean;
328
+ /** Apply automatic ground offset positioning (Z=0). Defaults to true. */
329
+ allowAutoPosition?: boolean;
330
+ /** Enable verbose logging. Defaults to false. */
331
+ debug?: boolean;
332
+ }
333
+
425
334
  interface ParsedContext {
426
335
  [key: string]: any;
427
336
  }
@@ -475,29 +384,31 @@ declare class GrasshopperResponseProcessor {
475
384
  */
476
385
  getValues<T = ParsedContext>(byId?: boolean, options?: GetValuesOptions): GetValuesResult<T>;
477
386
  /**
478
- * Retrieve a specific value using the parameter name.
387
+ * Retrieve a specific value by parameter name or ID.
479
388
  *
480
- * @param paramName - Human-readable parameter name from the Grasshopper definition.
389
+ * @param selector - `{ byName }` for the human-readable name, `{ byId }` for the parameter GUID.
481
390
  * @param options - Parsing configuration (e.g. disable parsing or enable Rhino).
482
391
  * @returns Single parsed value, array of values, or undefined if the parameter is absent.
483
392
  *
484
393
  * @example
485
394
  * ```ts
486
- * const schema = processor.getValueByParamName('Schema');
395
+ * const schema = processor.getValue({ byName: 'Schema' });
396
+ * const output = processor.getValue({ byId: 'a4be1c1e-23f9-4c27-b942-7f3bb2c45c6f' });
487
397
  * ```
398
+ *
399
+ * **Note:** `byId` only works with the custom VektorNode rhino.compute branch.
400
+ */
401
+ getValue(selector: {
402
+ byName: string;
403
+ } | {
404
+ byId: string;
405
+ }, options?: GetValuesOptions): any;
406
+ /**
407
+ * @deprecated Use `getValue({ byName })` instead.
488
408
  */
489
409
  getValueByParamName(paramName: string, options?: GetValuesOptions): any;
490
410
  /**
491
- * Retrieve a specific value using the parameter ID.
492
- *
493
- * @param paramId - Parameter GUID from the Grasshopper definition.
494
- * @param options - Parsing configuration (e.g. disable parsing or enable Rhino).
495
- * @returns Parsed value, array of values, or undefined if not present.
496
- *
497
- * @example
498
- * ```ts
499
- * const output = processor.getValueByParamId('a4be1c1e-23f9-4c27-b942-7f3bb2c45c6f');
500
- * ```
411
+ * @deprecated Use `getValue({ byId })` instead.
501
412
  */
502
413
  getValueByParamId(paramId: string, options?: GetValuesOptions): any;
503
414
  /**
@@ -569,6 +480,12 @@ declare class GrasshopperResponseProcessor {
569
480
  getAndDownloadFiles(folderName: string, additionalFiles?: FileBaseInfo[] | FileBaseInfo | null): void;
570
481
  }
571
482
 
483
+ /**
484
+ * Hash definition and data tree into a stable cache key.
485
+ * For Uint8Array, uses length + samples to keep hashing fast.
486
+ */
487
+ declare function hashSolveInput(definition: string | Uint8Array, dataTree: unknown): string;
488
+
572
489
  /**
573
490
  * Runs a Rhino Compute job using the provided tree prototypes and Grasshopper definition.
574
491
  *
@@ -886,6 +803,11 @@ declare class TreeBuilder {
886
803
  */
887
804
  static replaceTreeValue(trees: TreeBuilder[], paramName: string, newValue: DataTreeValue): TreeBuilder[];
888
805
  static replaceTreeValue(trees: DataTree[], paramName: string, newValue: DataTreeValue): DataTree[];
806
+ /**
807
+ * Build a TreeBuilder from a single value, dispatching on shape:
808
+ * DataTreeDefault structure, array, or scalar.
809
+ */
810
+ private static buildFromValue;
889
811
  /**
890
812
  * Extract a value from a TreeBuilder or InnerTree array by parameter name.
891
813
  *
@@ -930,6 +852,17 @@ declare class TreeBuilder {
930
852
  */
931
853
  static getTreeValue(trees: TreeBuilder[], paramName: string): DataTreeValue | null;
932
854
  static getTreeValue(trees: DataTree[], paramName: string): DataTreeValue | null;
855
+ /**
856
+ * Read all values for `paramName` across every branch of the matching builder.
857
+ * Returns null when the builder isn't found.
858
+ */
859
+ private static readFromBuilders;
860
+ /**
861
+ * Read values from the first branch of the matching compiled InnerTree
862
+ * (multi-branch responses are not flattened — current semantics, pinned by
863
+ * the "reads from the first branch path only" test).
864
+ */
865
+ private static readFromDataTrees;
933
866
  /**
934
867
  * Parse a TreeBuilder path string like "{0;1;2}" into [0, 1, 2].
935
868
  *
@@ -1011,4 +944,4 @@ declare const extractFilesFromComputeResponse: (downloadableFiles: FileData[], a
1011
944
  */
1012
945
  declare const downloadFileData: (downloadableFiles: FileData[], fileFoldername: string, additionalFiles?: FileBaseInfo[] | FileBaseInfo | null) => Promise<void>;
1013
946
 
1014
- export { type BooleanInputType, type CacheOptions, ComputeConfig, DataTree, DataTreeDefault, DataTreePath, type DataTreeValue, type DefaultValue, type FileBaseInfo, type FileData, type FileInputType, type GeometryInputType, type GetValuesOptions, type GetValuesResult, GrasshopperClient, GrasshopperComputeConfig, GrasshopperComputeResponse, type GrasshopperParsedIO, type GrasshopperParsedIORaw, GrasshopperResponseProcessor, type InputParam, InputParamSchema, type NumericInputType, OutputParamSchema, type OutputType, type ParsedContext, type ProcessedFile, RetryPolicy, RhinoComputeError, type SchedulerMode, type SolveContext, type SolveExecutor, type SolveOptions, type SolveResult, SolveScheduler, type SolveSchedulerOptions, type TextInputType, TreeBuilder, type ValueListInputType, downloadFileData, extractFilesFromComputeResponse, fetchDefinitionIO, fetchParsedDefinitionIO, hashSolveInput, processInput, processInputs, solveGrasshopperDefinition };
947
+ export { type CacheOptions, ComputeConfig, DataTree, DataTreeDefault, DataTreePath, type DataTreeValue, type FileBaseInfo, type FileData, type GetValuesOptions, type GetValuesResult, GrasshopperClient, GrasshopperComputeConfig, GrasshopperComputeResponse, GrasshopperParsedIO, GrasshopperParsedIORaw, GrasshopperResponseProcessor, InputParam, InputParamSchema, type ParsedContext, type ProcessedFile, RetryPolicy, RhinoComputeError, type SchedulerMode, type SolveContext, type SolveExecutor, type SolveOptions, type SolveResult, SolveScheduler, type SolveSchedulerOptions, TreeBuilder, downloadFileData, extractFilesFromComputeResponse, fetchDefinitionIO, fetchParsedDefinitionIO, hashSolveInput, processInput, processInputs, solveGrasshopperDefinition };
@@ -1,2 +1,2 @@
1
- import{a as b,b as c,c as d,d as e,e as f,f as g,g as h,h as i,i as j,j as k,k as l,l as m}from"./chunk-WXQGTKU6.js";import"./chunk-PZ4HZLFJ.js";import{d as a}from"./chunk-VK2TSW7S.js";export{d as GrasshopperClient,g as GrasshopperResponseProcessor,a as RhinoComputeError,c as SolveScheduler,m as TreeBuilder,f as downloadFileData,e as extractFilesFromComputeResponse,k as fetchDefinitionIO,l as fetchParsedDefinitionIO,b as hashSolveInput,i as processInput,j as processInputs,h as solveGrasshopperDefinition};
1
+ import{a as b,b as c,c as d,d as e,e as f,f as g,g as h,h as i,i as j,j as k,k as l,l as m}from"./chunk-XIBQV4XW.js";import"./chunk-XLHA5YPH.js";import{d as a}from"./chunk-RHULSS7S.js";export{d as GrasshopperClient,g as GrasshopperResponseProcessor,a as RhinoComputeError,c as SolveScheduler,m as TreeBuilder,f as downloadFileData,e as extractFilesFromComputeResponse,k as fetchDefinitionIO,l as fetchParsedDefinitionIO,b as hashSolveInput,i as processInput,j as processInputs,h as solveGrasshopperDefinition};
2
2
  //# sourceMappingURL=grasshopper.js.map
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkFRSLCR7Gcjs = require('./chunk-FRSLCR7G.cjs');require('./chunk-LNIUUPA5.cjs');var _chunkIJZNCO5Xcjs = require('./chunk-IJZNCO5X.cjs');exports.ComputeServerStats = _chunkIJZNCO5Xcjs.i; exports.ErrorCodes = _chunkIJZNCO5Xcjs.c; exports.GrasshopperClient = _chunkFRSLCR7Gcjs.c; exports.GrasshopperResponseProcessor = _chunkFRSLCR7Gcjs.f; exports.RhinoComputeError = _chunkIJZNCO5Xcjs.d; exports.SolveScheduler = _chunkFRSLCR7Gcjs.b; exports.TreeBuilder = _chunkFRSLCR7Gcjs.l; exports.camelcaseKeys = _chunkIJZNCO5Xcjs.k; exports.downloadFileData = _chunkFRSLCR7Gcjs.e; exports.enableDebugLogging = _chunkIJZNCO5Xcjs.g; exports.extractFilesFromComputeResponse = _chunkFRSLCR7Gcjs.d; exports.fetchDefinitionIO = _chunkFRSLCR7Gcjs.j; exports.fetchParsedDefinitionIO = _chunkFRSLCR7Gcjs.k; exports.fetchRhinoCompute = _chunkIJZNCO5Xcjs.h; exports.getLogger = _chunkIJZNCO5Xcjs.e; exports.hashSolveInput = _chunkFRSLCR7Gcjs.a; exports.processInput = _chunkFRSLCR7Gcjs.h; exports.processInputs = _chunkFRSLCR7Gcjs.i; exports.setLogger = _chunkIJZNCO5Xcjs.f; exports.solveGrasshopperDefinition = _chunkFRSLCR7Gcjs.g; exports.toCamelCase = _chunkIJZNCO5Xcjs.j;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk2D74PNQUcjs = require('./chunk-2D74PNQU.cjs');require('./chunk-MZGKJZVP.cjs');var _chunkVWOEUM7Ccjs = require('./chunk-VWOEUM7C.cjs');exports.ComputeServerStats = _chunkVWOEUM7Ccjs.i; exports.ErrorCodes = _chunkVWOEUM7Ccjs.c; exports.GrasshopperClient = _chunk2D74PNQUcjs.c; exports.GrasshopperResponseProcessor = _chunk2D74PNQUcjs.f; exports.RhinoComputeError = _chunkVWOEUM7Ccjs.d; exports.SolveScheduler = _chunk2D74PNQUcjs.b; exports.TreeBuilder = _chunk2D74PNQUcjs.l; exports.camelcaseKeys = _chunkVWOEUM7Ccjs.k; exports.downloadFileData = _chunk2D74PNQUcjs.e; exports.enableDebugLogging = _chunkVWOEUM7Ccjs.g; exports.extractFilesFromComputeResponse = _chunk2D74PNQUcjs.d; exports.fetchDefinitionIO = _chunk2D74PNQUcjs.j; exports.fetchParsedDefinitionIO = _chunk2D74PNQUcjs.k; exports.fetchRhinoCompute = _chunkVWOEUM7Ccjs.h; exports.getLogger = _chunkVWOEUM7Ccjs.e; exports.hashSolveInput = _chunk2D74PNQUcjs.a; exports.processInput = _chunk2D74PNQUcjs.h; exports.processInputs = _chunk2D74PNQUcjs.i; exports.setLogger = _chunkVWOEUM7Ccjs.f; exports.solveGrasshopperDefinition = _chunk2D74PNQUcjs.g; exports.toCamelCase = _chunkVWOEUM7Ccjs.j;
2
2
  //# sourceMappingURL=index.cjs.map
package/dist/index.d.cts CHANGED
@@ -1,6 +1,4 @@
1
- export { ErrorCode, ErrorCodes, Logger, camelcaseKeys, enableDebugLogging, fetchRhinoCompute, getLogger, setLogger, toCamelCase } from './core.cjs';
2
- export { C as ComputeServerStats, R as RhinoComputeError } from './base-dtik4Dlu.cjs';
3
- export { C as ComputeConfig, D as DataItem, a as DataTree, b as DataTreeDefault, c as DataTreePath, G as GrasshopperComputeConfig, d as GrasshopperComputeResponse, e as GrasshopperRequestSchema, I as InnerTreeData, f as InputParamSchema, O as OutputParamSchema, R as RetryPolicy, g as RhinoModelUnit } from './schemas-Ct7lU-IH.cjs';
4
- export { BooleanInputType, CacheOptions, DataTreeValue, DefaultValue, FileBaseInfo, FileData, FileInputType, GeometryInputType, GetValuesOptions, GetValuesResult, GrasshopperClient, GrasshopperParsedIO, GrasshopperParsedIORaw, GrasshopperResponseProcessor, InputParam, NumericInputType, OutputType, ParsedContext, ProcessedFile, SchedulerMode, SolveContext, SolveExecutor, SolveOptions, SolveResult, SolveScheduler, SolveSchedulerOptions, TextInputType, TreeBuilder, ValueListInputType, downloadFileData, extractFilesFromComputeResponse, fetchDefinitionIO, fetchParsedDefinitionIO, hashSolveInput, processInput, processInputs, solveGrasshopperDefinition } from './grasshopper.cjs';
1
+ export { Logger, camelcaseKeys, enableDebugLogging, fetchRhinoCompute, getLogger, setLogger, toCamelCase } from './core.cjs';
2
+ export { B as BooleanInputType, C as ComputeConfig, a as ComputeServerStats, D as DataItem, b as DataTree, c as DataTreeDefault, d as DataTreePath, e as DefaultValue, E as ErrorCode, f as ErrorCodes, F as FileInputType, G as GeometryInputType, g as GrasshopperComputeConfig, h as GrasshopperComputeResponse, i as GrasshopperParsedIO, j as GrasshopperParsedIORaw, k as GrasshopperRequestSchema, I as InnerTreeData, l as InputParam, m as InputParamSchema, N as NumericInputType, O as OutputParamSchema, n as OutputType, R as RetryPolicy, o as RhinoComputeError, p as RhinoModelUnit, T as TextInputType, V as ValueListInputType } from './errors-CiA83qw2.cjs';
3
+ export { CacheOptions, DataTreeValue, FileBaseInfo, FileData, GetValuesOptions, GetValuesResult, GrasshopperClient, GrasshopperResponseProcessor, ParsedContext, ProcessedFile, SchedulerMode, SolveContext, SolveExecutor, SolveOptions, SolveResult, SolveScheduler, SolveSchedulerOptions, TreeBuilder, downloadFileData, extractFilesFromComputeResponse, fetchDefinitionIO, fetchParsedDefinitionIO, hashSolveInput, processInput, processInputs, solveGrasshopperDefinition } from './grasshopper.cjs';
5
4
  import 'three';
6
- import './types-B24K2LG4.cjs';
package/dist/index.d.ts CHANGED
@@ -1,6 +1,4 @@
1
- export { ErrorCode, ErrorCodes, Logger, camelcaseKeys, enableDebugLogging, fetchRhinoCompute, getLogger, setLogger, toCamelCase } from './core.js';
2
- export { C as ComputeServerStats, R as RhinoComputeError } from './base-dtik4Dlu.js';
3
- export { C as ComputeConfig, D as DataItem, a as DataTree, b as DataTreeDefault, c as DataTreePath, G as GrasshopperComputeConfig, d as GrasshopperComputeResponse, e as GrasshopperRequestSchema, I as InnerTreeData, f as InputParamSchema, O as OutputParamSchema, R as RetryPolicy, g as RhinoModelUnit } from './schemas-Ct7lU-IH.js';
4
- export { BooleanInputType, CacheOptions, DataTreeValue, DefaultValue, FileBaseInfo, FileData, FileInputType, GeometryInputType, GetValuesOptions, GetValuesResult, GrasshopperClient, GrasshopperParsedIO, GrasshopperParsedIORaw, GrasshopperResponseProcessor, InputParam, NumericInputType, OutputType, ParsedContext, ProcessedFile, SchedulerMode, SolveContext, SolveExecutor, SolveOptions, SolveResult, SolveScheduler, SolveSchedulerOptions, TextInputType, TreeBuilder, ValueListInputType, downloadFileData, extractFilesFromComputeResponse, fetchDefinitionIO, fetchParsedDefinitionIO, hashSolveInput, processInput, processInputs, solveGrasshopperDefinition } from './grasshopper.js';
1
+ export { Logger, camelcaseKeys, enableDebugLogging, fetchRhinoCompute, getLogger, setLogger, toCamelCase } from './core.js';
2
+ export { B as BooleanInputType, C as ComputeConfig, a as ComputeServerStats, D as DataItem, b as DataTree, c as DataTreeDefault, d as DataTreePath, e as DefaultValue, E as ErrorCode, f as ErrorCodes, F as FileInputType, G as GeometryInputType, g as GrasshopperComputeConfig, h as GrasshopperComputeResponse, i as GrasshopperParsedIO, j as GrasshopperParsedIORaw, k as GrasshopperRequestSchema, I as InnerTreeData, l as InputParam, m as InputParamSchema, N as NumericInputType, O as OutputParamSchema, n as OutputType, R as RetryPolicy, o as RhinoComputeError, p as RhinoModelUnit, T as TextInputType, V as ValueListInputType } from './errors-CiA83qw2.js';
3
+ export { CacheOptions, DataTreeValue, FileBaseInfo, FileData, GetValuesOptions, GetValuesResult, GrasshopperClient, GrasshopperResponseProcessor, ParsedContext, ProcessedFile, SchedulerMode, SolveContext, SolveExecutor, SolveOptions, SolveResult, SolveScheduler, SolveSchedulerOptions, TreeBuilder, downloadFileData, extractFilesFromComputeResponse, fetchDefinitionIO, fetchParsedDefinitionIO, hashSolveInput, processInput, processInputs, solveGrasshopperDefinition } from './grasshopper.js';
5
4
  import 'three';
6
- import './types-B24K2LG4.js';
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import{a as b,b as c,c as d,d as g,e as h,f as i,g as j,h as k,i as l,j as n,k as q,l as s}from"./chunk-WXQGTKU6.js";import"./chunk-PZ4HZLFJ.js";import{c as o,d as r,e,f,g as m,h as p,i as t,j as x,k as a}from"./chunk-VK2TSW7S.js";export{t as ComputeServerStats,o as ErrorCodes,d as GrasshopperClient,i as GrasshopperResponseProcessor,r as RhinoComputeError,c as SolveScheduler,s as TreeBuilder,a as camelcaseKeys,h as downloadFileData,m as enableDebugLogging,g as extractFilesFromComputeResponse,n as fetchDefinitionIO,q as fetchParsedDefinitionIO,p as fetchRhinoCompute,e as getLogger,b as hashSolveInput,k as processInput,l as processInputs,f as setLogger,j as solveGrasshopperDefinition,x as toCamelCase};
1
+ import{a as b,b as c,c as d,d as g,e as h,f as i,g as j,h as k,i as l,j as n,k as q,l as s}from"./chunk-XIBQV4XW.js";import"./chunk-XLHA5YPH.js";import{c as o,d as r,e,f,g as m,h as p,i as t,j as x,k as a}from"./chunk-RHULSS7S.js";export{t as ComputeServerStats,o as ErrorCodes,d as GrasshopperClient,i as GrasshopperResponseProcessor,r as RhinoComputeError,c as SolveScheduler,s as TreeBuilder,a as camelcaseKeys,h as downloadFileData,m as enableDebugLogging,g as extractFilesFromComputeResponse,n as fetchDefinitionIO,q as fetchParsedDefinitionIO,p as fetchRhinoCompute,e as getLogger,b as hashSolveInput,k as processInput,l as processInputs,f as setLogger,j as solveGrasshopperDefinition,x as toCamelCase};
2
2
  //# sourceMappingURL=index.js.map