@selvajs/compute 1.5.2 → 2.0.0-beta.0

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 (66) hide show
  1. package/dist/chunk-3N5WXYQZ.js +2 -0
  2. package/dist/chunk-3N5WXYQZ.js.map +1 -0
  3. package/dist/chunk-I6BYCRNM.cjs +2 -0
  4. package/dist/chunk-I6BYCRNM.cjs.map +1 -0
  5. package/dist/chunk-KWNSHZE3.js +2 -0
  6. package/dist/chunk-KWNSHZE3.js.map +1 -0
  7. package/dist/chunk-LKSMZAOW.js +4 -0
  8. package/dist/chunk-LKSMZAOW.js.map +1 -0
  9. package/dist/chunk-MQKJ46HT.cjs +4 -0
  10. package/dist/chunk-MQKJ46HT.cjs.map +1 -0
  11. package/dist/chunk-PTMR332C.cjs +2 -0
  12. package/dist/chunk-PTMR332C.cjs.map +1 -0
  13. package/dist/core.cjs +1 -1
  14. package/dist/core.cjs.map +1 -1
  15. package/dist/core.d.cts +10 -15
  16. package/dist/core.d.ts +10 -15
  17. package/dist/core.js +1 -1
  18. package/dist/grasshopper.cjs +1 -1
  19. package/dist/grasshopper.cjs.map +1 -1
  20. package/dist/grasshopper.d.cts +77 -101
  21. package/dist/grasshopper.d.ts +77 -101
  22. package/dist/grasshopper.js +1 -1
  23. package/dist/handle-files-BU9vu1Fd.d.cts +260 -0
  24. package/dist/handle-files-BU9vu1Fd.d.ts +260 -0
  25. package/dist/index.cjs +1 -1
  26. package/dist/index.cjs.map +1 -1
  27. package/dist/index.d.cts +4 -4
  28. package/dist/index.d.ts +4 -4
  29. package/dist/index.js +1 -1
  30. package/dist/{types-Dfeei0dD.d.cts → types-CJ092lxB.d.cts} +116 -73
  31. package/dist/types-D1SkNje_.d.cts +87 -0
  32. package/dist/types-D1SkNje_.d.ts +87 -0
  33. package/dist/{types-Dfeei0dD.d.ts → types-XCUrJGby.d.ts} +116 -73
  34. package/dist/visualization-AQNCY6MG.js +2 -0
  35. package/dist/visualization-PRUUKBYP.cjs +2 -0
  36. package/dist/visualization-PRUUKBYP.cjs.map +1 -0
  37. package/dist/visualization.cjs +1 -1
  38. package/dist/visualization.cjs.map +1 -1
  39. package/dist/visualization.d.cts +16 -21
  40. package/dist/visualization.d.ts +16 -21
  41. package/dist/visualization.js +1 -1
  42. package/package.json +18 -7
  43. package/dist/chunk-FWK2WGU5.js +0 -2
  44. package/dist/chunk-FWK2WGU5.js.map +0 -1
  45. package/dist/chunk-OEDLGVIQ.js +0 -2
  46. package/dist/chunk-OEDLGVIQ.js.map +0 -1
  47. package/dist/chunk-OW6HV6QP.js +0 -2
  48. package/dist/chunk-OW6HV6QP.js.map +0 -1
  49. package/dist/chunk-RBNF6MNH.cjs +0 -3
  50. package/dist/chunk-RBNF6MNH.cjs.map +0 -1
  51. package/dist/chunk-SVEXPGHW.cjs +0 -2
  52. package/dist/chunk-SVEXPGHW.cjs.map +0 -1
  53. package/dist/chunk-XBIEAJBK.js +0 -3
  54. package/dist/chunk-XBIEAJBK.js.map +0 -1
  55. package/dist/chunk-ZH5AZFGB.cjs +0 -2
  56. package/dist/chunk-ZH5AZFGB.cjs.map +0 -1
  57. package/dist/chunk-ZRQRYG6F.cjs +0 -2
  58. package/dist/chunk-ZRQRYG6F.cjs.map +0 -1
  59. package/dist/errors-CEy4nM1J.d.cts +0 -149
  60. package/dist/errors-CEy4nM1J.d.ts +0 -149
  61. package/dist/types-COCuQEMk.d.cts +0 -93
  62. package/dist/types-COCuQEMk.d.ts +0 -93
  63. package/dist/visualization-ENMBHWIN.js +0 -2
  64. package/dist/visualization-TBPFFBFU.cjs +0 -2
  65. package/dist/visualization-TBPFFBFU.cjs.map +0 -1
  66. /package/dist/{visualization-ENMBHWIN.js.map → visualization-AQNCY6MG.js.map} +0 -0
@@ -1,149 +0,0 @@
1
- /**
2
- * ComputeServerStats provides methods to query Rhino Compute server statistics.
3
- *
4
- * @public Use this for server health monitoring and statistics.
5
- *
6
- * @example
7
- * ```typescript
8
- * const stats = new ComputeServerStats('http://localhost:6500', 'your-api-key');
9
- *
10
- * try {
11
- * const isOnline = await stats.isServerOnline();
12
- * const children = await stats.getActiveChildren();
13
- * const version = await stats.getVersion();
14
- *
15
- * // Or get everything at once
16
- * const allStats = await stats.getServerStats();
17
- * } finally {
18
- * await stats.dispose(); // Clean up resources
19
- * }
20
- * ```
21
- */
22
- declare class ComputeServerStats {
23
- private readonly serverUrl;
24
- private readonly apiKey?;
25
- private disposed;
26
- private activeMonitors;
27
- private activeTimeouts;
28
- /**
29
- * @param serverUrl - Base URL of the Rhino Compute server with http:// or https:// scheme (e.g., 'http://localhost:6500')
30
- * @param apiKey - Optional API key for authentication
31
- */
32
- constructor(serverUrl: string, apiKey?: string);
33
- /**
34
- * Build request headers with optional API key.
35
- */
36
- private buildHeaders;
37
- /**
38
- * Check if the server is online.
39
- */
40
- isServerOnline(): Promise<boolean>;
41
- /**
42
- * Get the number of active child processes on the server.
43
- *
44
- * @returns Number of active children, or null if unavailable
45
- */
46
- getActiveChildren(): Promise<number | null>;
47
- /**
48
- * Get the server version information.
49
- *
50
- * @returns Version object with rhino, compute, and git_sha, or null if unavailable
51
- */
52
- getVersion(): Promise<{
53
- rhino: string;
54
- compute: string;
55
- git_sha: string | null;
56
- } | null>;
57
- /**
58
- * Get comprehensive server statistics.
59
- * Fetches all available server information in parallel.
60
- *
61
- * @returns Object containing server status and available stats
62
- */
63
- getServerStats(): Promise<{
64
- isOnline: boolean;
65
- version?: {
66
- rhino: string;
67
- compute: string;
68
- git_sha: string | null;
69
- };
70
- activeChildren?: number;
71
- }>;
72
- /**
73
- * Continuously monitor server stats at specified interval.
74
- *
75
- * @param callback - Function called with stats on each interval
76
- * @param intervalMs - Milliseconds between checks (default: 5000)
77
- * @returns Function to stop monitoring
78
- *
79
- * @example
80
- * ```typescript
81
- * const stopMonitoring = stats.monitor((data) => {
82
- * console.log('Server stats:', data);
83
- * }, 3000);
84
- *
85
- * // Later...
86
- * stopMonitoring();
87
- * ```
88
- */
89
- monitor(callback: (stats: Awaited<ReturnType<typeof this.getServerStats>>) => void, intervalMs?: number): () => void;
90
- /**
91
- * Disposes of all resources and stops all active monitors.
92
- * Call this when you're done using the stats instance.
93
- */
94
- dispose(): Promise<void>;
95
- /**
96
- * Ensures the instance hasn't been disposed.
97
- */
98
- private ensureNotDisposed;
99
- }
100
-
101
- /**
102
- * Error types and codes for `@selvajs/compute`.
103
- */
104
- declare const ErrorCodes: {
105
- readonly NETWORK_ERROR: "NETWORK_ERROR";
106
- readonly AUTH_ERROR: "AUTH_ERROR";
107
- readonly VALIDATION_ERROR: "VALIDATION_ERROR";
108
- readonly COMPUTATION_ERROR: "COMPUTATION_ERROR";
109
- readonly TIMEOUT_ERROR: "TIMEOUT_ERROR";
110
- readonly CORS_ERROR: "CORS_ERROR";
111
- readonly UNKNOWN_ERROR: "UNKNOWN_ERROR";
112
- readonly INVALID_STATE: "INVALID_STATE";
113
- readonly INVALID_INPUT: "INVALID_INPUT";
114
- readonly INVALID_CONFIG: "INVALID_CONFIG";
115
- readonly BROWSER_ONLY: "BROWSER_ONLY";
116
- readonly ENVIRONMENT_ERROR: "ENVIRONMENT_ERROR";
117
- readonly ENCODING_ERROR: "ENCODING_ERROR";
118
- /** Scheduler latest-wins: this call was replaced by a newer one. */
119
- readonly SUPERSEDED: "SUPERSEDED";
120
- /** Scheduler / caller-supplied AbortSignal: this call was aborted. */
121
- readonly ABORTED: "ABORTED";
122
- };
123
- type ErrorCode = (typeof ErrorCodes)[keyof typeof ErrorCodes];
124
- /**
125
- * Simplified error for Rhino Compute operations
126
- *
127
- * @public Use this for error handling with error codes and context.
128
- */
129
- declare class RhinoComputeError extends Error {
130
- readonly code: string;
131
- readonly statusCode?: number;
132
- readonly context?: Record<string, unknown>;
133
- readonly originalError?: Error;
134
- constructor(message: string, code?: string, options?: {
135
- statusCode?: number;
136
- context?: Record<string, unknown>;
137
- originalError?: Error;
138
- });
139
- /**
140
- * Create an error for missing/empty values
141
- */
142
- static missingValues(inputName: string, expectedType?: string, context?: Record<string, unknown>): RhinoComputeError;
143
- /**
144
- * Create an error for unknown parameter type
145
- */
146
- static unknownParamType(paramType: string, paramName?: string, context?: Record<string, unknown>): RhinoComputeError;
147
- }
148
-
149
- export { ComputeServerStats as C, type ErrorCode as E, RhinoComputeError as R, ErrorCodes as a };
@@ -1,93 +0,0 @@
1
- /**
2
- * Material properties for Three.js rendering.
3
- */
4
- interface SerializableMaterial {
5
- color: string;
6
- metalness: number;
7
- roughness: number;
8
- opacity: number;
9
- transparent: boolean;
10
- }
11
- /**
12
- * Metadata for a single mesh within a batch.
13
- *
14
- * Offsets and counts are expressed in **vertex-count units** (not float components) and
15
- * **index-count units**. To address the typed-array storage:
16
- * - vertex component offset = `vertexStart * 3`
17
- * - vertex component count = `vertexCount * 3`
18
- * - index byte offset = `indexStart * 4`
19
- * - index count = `indexCount`
20
- */
21
- interface MeshMetadata {
22
- name: string;
23
- /** Layer path for grouping in the scene manager (e.g. 'Structure/Walls') */
24
- layer: string;
25
- /** Original index in the GH input tree before material grouping. Combined with
26
- * MeshBatch.sourceComponentId to uniquely identify the GH source geometry. */
27
- originalIndex: number;
28
- /** Number of vertices in this mesh (each vertex is 3 components: x, y, z). */
29
- vertexCount: number;
30
- /** Number of indices in this mesh (3 per triangle). */
31
- indexCount: number;
32
- /** Index of this mesh's first vertex in the combined vertex array, in vertex-count units.
33
- * The corresponding component offset into the int16/float32 typed array is `vertexStart * 3`. */
34
- vertexStart: number;
35
- /** Index of this mesh's first index in the combined index array, in index-count units. */
36
- indexStart: number;
37
- /** Arbitrary key-value pairs from the GH Metadata input */
38
- metadata?: Record<string, string>;
39
- }
40
- /**
41
- * A group of meshes sharing the same material.
42
- */
43
- interface MaterialGroup {
44
- /** Reference to the material ID in the materials array */
45
- materialId: number;
46
- /** Individual meshes in this group */
47
- meshes: MeshMetadata[];
48
- }
49
- /**
50
- * Batched mesh data optimized for Three.js rendering.
51
- *
52
- * `compressedData` contains the binary "SLVA" blob (header + metadata JSON + quantized int16 or
53
- * float32 vertices + uint32 indices), base64-encoded for transit inside the values JSON envelope.
54
- * The blob is opaque to the outer JSON: a future binary WebSocket frame can drop the base64 step
55
- * without changing this shape.
56
- */
57
- interface MeshBatch {
58
- /** Array of unique materials */
59
- materials: SerializableMaterial[];
60
- /** Groups of meshes organized by material */
61
- groups: MaterialGroup[];
62
- /** Base64-encoded binary blob (SLVA wire format). */
63
- compressedData: string;
64
- /** InstanceGuid of the WebDisplay GH component that produced this batch.
65
- * Combined with MeshMetadata.originalIndex to backtrack any mesh to its GH source. */
66
- sourceComponentId?: string;
67
- }
68
- /**
69
- * Options for parsing mesh batch data.
70
- */
71
- interface MeshBatchParsingOptions {
72
- /** Merge meshes with same material into single geometry (better performance). Defaults to true. */
73
- mergeByMaterial?: boolean;
74
- /** Apply coordinate system transformations (Rhino Z-up to Three.js Y-up). Defaults to true. */
75
- applyTransforms?: boolean;
76
- /** Enable performance monitoring in console. Defaults to false. */
77
- debug?: boolean;
78
- }
79
- /**
80
- * Options for extracting and processing meshes from compute responses.
81
- */
82
- interface MeshExtractionOptions {
83
- /** Configuration for parsing mesh batches. */
84
- parsing?: MeshBatchParsingOptions;
85
- /** Apply scaling based on model units. Defaults to true. */
86
- allowScaling?: boolean;
87
- /** Apply automatic ground offset positioning (Z=0). Defaults to true. */
88
- allowAutoPosition?: boolean;
89
- /** Enable verbose logging. Defaults to false. */
90
- debug?: boolean;
91
- }
92
-
93
- export type { MeshExtractionOptions as M, MeshBatch as a };
@@ -1,93 +0,0 @@
1
- /**
2
- * Material properties for Three.js rendering.
3
- */
4
- interface SerializableMaterial {
5
- color: string;
6
- metalness: number;
7
- roughness: number;
8
- opacity: number;
9
- transparent: boolean;
10
- }
11
- /**
12
- * Metadata for a single mesh within a batch.
13
- *
14
- * Offsets and counts are expressed in **vertex-count units** (not float components) and
15
- * **index-count units**. To address the typed-array storage:
16
- * - vertex component offset = `vertexStart * 3`
17
- * - vertex component count = `vertexCount * 3`
18
- * - index byte offset = `indexStart * 4`
19
- * - index count = `indexCount`
20
- */
21
- interface MeshMetadata {
22
- name: string;
23
- /** Layer path for grouping in the scene manager (e.g. 'Structure/Walls') */
24
- layer: string;
25
- /** Original index in the GH input tree before material grouping. Combined with
26
- * MeshBatch.sourceComponentId to uniquely identify the GH source geometry. */
27
- originalIndex: number;
28
- /** Number of vertices in this mesh (each vertex is 3 components: x, y, z). */
29
- vertexCount: number;
30
- /** Number of indices in this mesh (3 per triangle). */
31
- indexCount: number;
32
- /** Index of this mesh's first vertex in the combined vertex array, in vertex-count units.
33
- * The corresponding component offset into the int16/float32 typed array is `vertexStart * 3`. */
34
- vertexStart: number;
35
- /** Index of this mesh's first index in the combined index array, in index-count units. */
36
- indexStart: number;
37
- /** Arbitrary key-value pairs from the GH Metadata input */
38
- metadata?: Record<string, string>;
39
- }
40
- /**
41
- * A group of meshes sharing the same material.
42
- */
43
- interface MaterialGroup {
44
- /** Reference to the material ID in the materials array */
45
- materialId: number;
46
- /** Individual meshes in this group */
47
- meshes: MeshMetadata[];
48
- }
49
- /**
50
- * Batched mesh data optimized for Three.js rendering.
51
- *
52
- * `compressedData` contains the binary "SLVA" blob (header + metadata JSON + quantized int16 or
53
- * float32 vertices + uint32 indices), base64-encoded for transit inside the values JSON envelope.
54
- * The blob is opaque to the outer JSON: a future binary WebSocket frame can drop the base64 step
55
- * without changing this shape.
56
- */
57
- interface MeshBatch {
58
- /** Array of unique materials */
59
- materials: SerializableMaterial[];
60
- /** Groups of meshes organized by material */
61
- groups: MaterialGroup[];
62
- /** Base64-encoded binary blob (SLVA wire format). */
63
- compressedData: string;
64
- /** InstanceGuid of the WebDisplay GH component that produced this batch.
65
- * Combined with MeshMetadata.originalIndex to backtrack any mesh to its GH source. */
66
- sourceComponentId?: string;
67
- }
68
- /**
69
- * Options for parsing mesh batch data.
70
- */
71
- interface MeshBatchParsingOptions {
72
- /** Merge meshes with same material into single geometry (better performance). Defaults to true. */
73
- mergeByMaterial?: boolean;
74
- /** Apply coordinate system transformations (Rhino Z-up to Three.js Y-up). Defaults to true. */
75
- applyTransforms?: boolean;
76
- /** Enable performance monitoring in console. Defaults to false. */
77
- debug?: boolean;
78
- }
79
- /**
80
- * Options for extracting and processing meshes from compute responses.
81
- */
82
- interface MeshExtractionOptions {
83
- /** Configuration for parsing mesh batches. */
84
- parsing?: MeshBatchParsingOptions;
85
- /** Apply scaling based on model units. Defaults to true. */
86
- allowScaling?: boolean;
87
- /** Apply automatic ground offset positioning (Z=0). Defaults to true. */
88
- allowAutoPosition?: boolean;
89
- /** Enable verbose logging. Defaults to false. */
90
- debug?: boolean;
91
- }
92
-
93
- export type { MeshExtractionOptions as M, MeshBatch as a };
@@ -1,2 +0,0 @@
1
- import{a as e,b as r,c as o,d as t,e as a,f as s,g as i,h as p,i as n,j as h,k as M,l as f,m,n as B,o as C}from"./chunk-OEDLGVIQ.js";import"./chunk-OW6HV6QP.js";import"./chunk-XBIEAJBK.js";export{i as BINARY_MESH_MAGIC,p as BINARY_MESH_VERSION,n as FLAG_FLOAT32,s as Materials,B as SCALE_FACTORS,t as applyOffset,a as computeCombinedBoundingBox,C as getThreeMeshesFromComputeResponse,e as initThree,h as parseBinaryMeshBatch,o as parseColor,M as parseMeshBatch,m as parseMeshBatchBlob,f as parseMeshBatchObject,r as updateScene};
2
- //# sourceMappingURL=visualization-ENMBHWIN.js.map
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkSVEXPGHWcjs = require('./chunk-SVEXPGHW.cjs');require('./chunk-ZRQRYG6F.cjs');require('./chunk-RBNF6MNH.cjs');exports.BINARY_MESH_MAGIC = _chunkSVEXPGHWcjs.g; exports.BINARY_MESH_VERSION = _chunkSVEXPGHWcjs.h; exports.FLAG_FLOAT32 = _chunkSVEXPGHWcjs.i; exports.Materials = _chunkSVEXPGHWcjs.f; exports.SCALE_FACTORS = _chunkSVEXPGHWcjs.n; exports.applyOffset = _chunkSVEXPGHWcjs.d; exports.computeCombinedBoundingBox = _chunkSVEXPGHWcjs.e; exports.getThreeMeshesFromComputeResponse = _chunkSVEXPGHWcjs.o; exports.initThree = _chunkSVEXPGHWcjs.a; exports.parseBinaryMeshBatch = _chunkSVEXPGHWcjs.j; exports.parseColor = _chunkSVEXPGHWcjs.c; exports.parseMeshBatch = _chunkSVEXPGHWcjs.k; exports.parseMeshBatchBlob = _chunkSVEXPGHWcjs.m; exports.parseMeshBatchObject = _chunkSVEXPGHWcjs.l; exports.updateScene = _chunkSVEXPGHWcjs.b;
2
- //# sourceMappingURL=visualization-TBPFFBFU.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["/home/runner/work/selva-compute/selva-compute/dist/visualization-TBPFFBFU.cjs"],"names":[],"mappings":"AAAA,iIAAqI,gCAA6B,gCAA6B,itBAAoV","file":"/home/runner/work/selva-compute/selva-compute/dist/visualization-TBPFFBFU.cjs"}