@selvajs/compute 3.1.1 → 4.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.
- package/README.md +2 -11
- package/dist/chunk-G7NVQAK5.cjs +2 -0
- package/dist/chunk-G7NVQAK5.cjs.map +1 -0
- package/dist/chunk-LLUNR66G.cjs +4 -0
- package/dist/chunk-LLUNR66G.cjs.map +1 -0
- package/dist/chunk-RFFCVRKM.js +2 -0
- package/dist/chunk-RFFCVRKM.js.map +1 -0
- package/dist/chunk-XT3XWDDV.js +4 -0
- package/dist/chunk-XT3XWDDV.js.map +1 -0
- package/dist/core.cjs +1 -1
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +13 -4
- package/dist/core.d.ts +13 -4
- package/dist/core.js +1 -1
- package/dist/grasshopper.cjs +1 -1
- package/dist/grasshopper.cjs.map +1 -1
- package/dist/grasshopper.d.cts +387 -34
- package/dist/grasshopper.d.ts +387 -34
- package/dist/grasshopper.js +1 -1
- package/dist/{handle-files-BISo_wob.d.cts → handle-files-DcA24IkS.d.cts} +45 -1
- package/dist/{handle-files-BISo_wob.d.ts → handle-files-DcA24IkS.d.ts} +45 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -7
- package/dist/index.d.ts +3 -7
- package/dist/index.js +1 -1
- package/package.json +8 -29
- package/dist/chunk-FQKQISPG.cjs +0 -2
- package/dist/chunk-FQKQISPG.cjs.map +0 -1
- package/dist/chunk-H3FZW6OX.cjs +0 -4
- package/dist/chunk-H3FZW6OX.cjs.map +0 -1
- package/dist/chunk-N2WCSETE.js +0 -120
- package/dist/chunk-N2WCSETE.js.map +0 -1
- package/dist/chunk-RFE763NG.cjs +0 -120
- package/dist/chunk-RFE763NG.cjs.map +0 -1
- package/dist/chunk-S3VUIIRE.js +0 -2
- package/dist/chunk-S3VUIIRE.js.map +0 -1
- package/dist/chunk-Y3M7P3BW.js +0 -4
- package/dist/chunk-Y3M7P3BW.js.map +0 -1
- package/dist/types-4FMvnx2j.d.ts +0 -556
- package/dist/types-BGhtYxZ-.d.cts +0 -45
- package/dist/types-BGhtYxZ-.d.ts +0 -45
- package/dist/types-BpOl6U02.d.cts +0 -556
- package/dist/visualization-E6BTQZCA.cjs +0 -2
- package/dist/visualization-E6BTQZCA.cjs.map +0 -1
- package/dist/visualization-HDBKPJGQ.js +0 -2
- package/dist/visualization-HDBKPJGQ.js.map +0 -1
- package/dist/visualization.cjs +0 -2
- package/dist/visualization.cjs.map +0 -1
- package/dist/visualization.d.cts +0 -1093
- package/dist/visualization.d.ts +0 -1093
- package/dist/visualization.js +0 -2
- package/dist/visualization.js.map +0 -1
package/dist/grasshopper.d.cts
CHANGED
|
@@ -1,11 +1,335 @@
|
|
|
1
|
-
import { R as RhinoComputeError,
|
|
2
|
-
export {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { C as ComputeConfig, e as RhinoModelUnit, R as RetryPolicy, d as RhinoComputeError, a as ComputeServerStats, F as FileBaseInfo } from './handle-files-DcA24IkS.cjs';
|
|
2
|
+
export { c as FileData, P as ProcessedFile, f as downloadFileData, g as extractFilesFromComputeResponse } from './handle-files-DcA24IkS.cjs';
|
|
3
|
+
|
|
4
|
+
type DataTreePath = `{${string}}`;
|
|
5
|
+
interface DataItem {
|
|
6
|
+
type: string;
|
|
7
|
+
data: string;
|
|
8
|
+
id: string;
|
|
9
|
+
}
|
|
10
|
+
type DataTreeDefault<T = any> = {
|
|
11
|
+
[K in DataTreePath]?: T[];
|
|
12
|
+
};
|
|
13
|
+
type InnerTreeData = {
|
|
14
|
+
[path in DataTreePath]: DataItem[];
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Tree with parameter metadata (used in compute requests and responses).
|
|
18
|
+
*
|
|
19
|
+
* Field casing varies by server branch: stock mcneel compute (8.x/9.x)
|
|
20
|
+
* serializes `Resthopper.IO.DataTree` in PascalCase (`ParamName`/`InnerTree`
|
|
21
|
+
* — the C# class carries no `[JsonProperty]` attributes), while
|
|
22
|
+
* camelCase-serializing forks return `paramName`/`innerTree` instead. This
|
|
23
|
+
* client always *sends* PascalCase (see `DataTree.toCompute()` in
|
|
24
|
+
* `data-tree.ts`), so the PascalCase fields remain the canonical/required
|
|
25
|
+
* shape; the optional camelCase fields exist so responses from camelCase
|
|
26
|
+
* forks are representable without casts. Code that must read trees across
|
|
27
|
+
* both server families should use `readField`/`hasField`
|
|
28
|
+
* (`@/core/utils/read-field`, case-insensitive) rather than direct property
|
|
29
|
+
* access — `warnOnEmptyInnerTrees` in `solve.ts` is the reference example.
|
|
30
|
+
*/
|
|
31
|
+
interface DataTree {
|
|
32
|
+
/** PascalCase — stock mcneel servers, and the request shape this client sends. */
|
|
33
|
+
InnerTree: InnerTreeData;
|
|
34
|
+
/** PascalCase — stock mcneel servers, and the request shape this client sends. */
|
|
35
|
+
ParamName: string;
|
|
36
|
+
/** camelCase — sent instead of `InnerTree` by camelCase server forks. */
|
|
37
|
+
innerTree?: InnerTreeData;
|
|
38
|
+
/** camelCase — sent instead of `ParamName` by camelCase server forks. */
|
|
39
|
+
paramName?: string;
|
|
40
|
+
}
|
|
41
|
+
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 & {});
|
|
42
|
+
/**
|
|
43
|
+
* Union type for all possible default value types
|
|
44
|
+
*/
|
|
45
|
+
type DefaultValue<T> = T | T[] | DataTreeDefault<T> | undefined | null;
|
|
46
|
+
/**
|
|
47
|
+
* Base properties common to all processed input types.
|
|
48
|
+
* Note: `groupName` and `id` require the custom Rhino Compute branch.
|
|
49
|
+
*/
|
|
50
|
+
interface BaseInputType {
|
|
51
|
+
description: string;
|
|
52
|
+
name: string;
|
|
53
|
+
nickname: string | null;
|
|
54
|
+
treeAccess: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Name of the group this parameter belongs to.
|
|
57
|
+
* @requires Custom branch of compute.rhino3d
|
|
58
|
+
*/
|
|
59
|
+
groupName?: string;
|
|
60
|
+
/**
|
|
61
|
+
* Unique identifier for the parameter.
|
|
62
|
+
* @requires Custom branch of compute.rhino3d
|
|
63
|
+
*/
|
|
64
|
+
id?: string;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Numeric input type (Number or Integer)
|
|
68
|
+
*/
|
|
69
|
+
interface NumericInputType extends BaseInputType {
|
|
70
|
+
paramType: 'Number' | 'Integer';
|
|
71
|
+
minimum?: number | null;
|
|
72
|
+
maximum?: number | null;
|
|
73
|
+
atLeast?: number | null;
|
|
74
|
+
atMost?: number | null;
|
|
75
|
+
stepSize?: number | null;
|
|
76
|
+
default: DefaultValue<number>;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Text input type
|
|
80
|
+
*/
|
|
81
|
+
interface TextInputType extends BaseInputType {
|
|
82
|
+
paramType: 'Text';
|
|
83
|
+
default: DefaultValue<string>;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Boolean input type
|
|
87
|
+
*/
|
|
88
|
+
interface BooleanInputType extends BaseInputType {
|
|
89
|
+
paramType: 'Boolean';
|
|
90
|
+
default: DefaultValue<boolean>;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Geometry input type (generic geometry)
|
|
94
|
+
*/
|
|
95
|
+
interface GeometryInputType extends BaseInputType {
|
|
96
|
+
paramType: 'Geometry';
|
|
97
|
+
default: DefaultValue<object | string>;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* ValueList input type (dropdown/select)
|
|
101
|
+
*/
|
|
102
|
+
interface ValueListInputType extends BaseInputType {
|
|
103
|
+
paramType: 'ValueList';
|
|
104
|
+
values: Record<string, string>;
|
|
105
|
+
default?: string;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* File input type
|
|
109
|
+
*/
|
|
110
|
+
interface FileInputType extends BaseInputType {
|
|
111
|
+
paramType: 'File';
|
|
112
|
+
acceptedFormats?: string[];
|
|
113
|
+
default: DefaultValue<object | string>;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Color input type (stored as hex string)
|
|
117
|
+
*/
|
|
118
|
+
interface ColorInputType extends BaseInputType {
|
|
119
|
+
paramType: 'Color';
|
|
120
|
+
default: DefaultValue<string>;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Discriminated union of all input parameter types
|
|
124
|
+
*/
|
|
125
|
+
type InputParam = NumericInputType | BooleanInputType | TextInputType | ValueListInputType | GeometryInputType | FileInputType | ColorInputType;
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Base Grasshopper schema properties shared by config, args, and response
|
|
129
|
+
*/
|
|
130
|
+
interface GrasshopperBaseSchema {
|
|
131
|
+
/** Absolute tolerance used in computation */
|
|
132
|
+
absolutetolerance?: number | null;
|
|
133
|
+
/** Angular tolerance used in computation */
|
|
134
|
+
angletolerance?: number | null;
|
|
135
|
+
/** Model units used */
|
|
136
|
+
modelunits?: RhinoModelUnit | null;
|
|
137
|
+
/** Data version (7 or 8) */
|
|
138
|
+
dataversion?: 7 | 8 | null;
|
|
139
|
+
/** Whether to use cached solution */
|
|
140
|
+
cachesolve?: boolean | null;
|
|
141
|
+
/**
|
|
142
|
+
* Opt-in: cache a solve even when the definition reported GH errors. Default
|
|
143
|
+
* (false/unset) means errored solves are never cached server-side. Some
|
|
144
|
+
* definitions throw GH errors by design (a guarded Python component, a
|
|
145
|
+
* filtered branch) while still producing correct geometry — set this so those
|
|
146
|
+
* still benefit from the server's solve cache. Only meaningful with
|
|
147
|
+
* `cachesolve`. Requires a server that honors it (VektorNode fork).
|
|
148
|
+
*/
|
|
149
|
+
cacheerroredsolves?: boolean | null;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Definition source (used in args and response)
|
|
153
|
+
*/
|
|
154
|
+
interface GrasshopperDefinitionSource {
|
|
155
|
+
/** Base64 encoded algorithm (if embedded) */
|
|
156
|
+
algo?: string | null;
|
|
157
|
+
/** URL pointer to definition file */
|
|
158
|
+
pointer?: string | null;
|
|
159
|
+
/** Filename of the definition */
|
|
160
|
+
filename?: string | null;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Configuration for Grasshopper compute operations
|
|
164
|
+
* Combines server config with optional Grasshopper-specific computation settings
|
|
165
|
+
*
|
|
166
|
+
* Note: The definition source (pointer/algo) is NOT part of config.
|
|
167
|
+
* Instead, pass the definition directly to methods like solve(), getIO(), etc.
|
|
168
|
+
*/
|
|
169
|
+
interface GrasshopperComputeConfig extends ComputeConfig {
|
|
170
|
+
/** Absolute tolerance used in computation */
|
|
171
|
+
absolutetolerance?: number | null;
|
|
172
|
+
/** Angular tolerance used in computation */
|
|
173
|
+
angletolerance?: number | null;
|
|
174
|
+
/** Model units used */
|
|
175
|
+
modelunits?: RhinoModelUnit | null;
|
|
176
|
+
/** Data version (7 or 8) */
|
|
177
|
+
dataversion?: 7 | 8 | null;
|
|
178
|
+
/** Whether to use cached solution */
|
|
179
|
+
cachesolve?: boolean | null;
|
|
180
|
+
/**
|
|
181
|
+
* Opt-in: cache a solve even when the definition reported GH errors. See
|
|
182
|
+
* {@link GrasshopperBaseSchema.cacheerroredsolves}. Only meaningful with
|
|
183
|
+
* `cachesolve`.
|
|
184
|
+
*/
|
|
185
|
+
cacheerroredsolves?: boolean | null;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Arguments sent to Grasshopper compute endpoint
|
|
189
|
+
* Includes config options + definition source + input values
|
|
190
|
+
*/
|
|
191
|
+
interface GrasshopperRequestSchema extends GrasshopperBaseSchema, GrasshopperDefinitionSource {
|
|
192
|
+
/** Input values organized by parameter */
|
|
193
|
+
values?: DataTree[];
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Response from Grasshopper compute server
|
|
197
|
+
* Includes all schema fields + computed results
|
|
198
|
+
*
|
|
199
|
+
* `pointer` is deliberately excluded (`Omit`): the solve layer (`runSolve` in
|
|
200
|
+
* `solve.ts`) splits the server's echoed `pointer` off as the solve's
|
|
201
|
+
* `cacheKey` and strips it from the returned response, so client-returned
|
|
202
|
+
* responses never carry it.
|
|
203
|
+
*
|
|
204
|
+
* The schema-echo fields (`cachesolve`/`modelunits`/`dataversion`) stay
|
|
205
|
+
* optional as inherited from {@link GrasshopperBaseSchema}: the server echoes
|
|
206
|
+
* them back when set, but nothing client-side enforces their presence — don't
|
|
207
|
+
* rely on them without a fallback.
|
|
208
|
+
*/
|
|
209
|
+
interface GrasshopperComputeResponse extends GrasshopperBaseSchema, Omit<GrasshopperDefinitionSource, 'pointer'> {
|
|
210
|
+
/**
|
|
211
|
+
* Model units the definition was solved in. Every conforming server response
|
|
212
|
+
* carries this (it drives downstream scaling, e.g. the webdisplay parser),
|
|
213
|
+
* but note it is not validated client-side — a non-conforming server or
|
|
214
|
+
* hand-built mock may omit it at runtime.
|
|
215
|
+
*/
|
|
216
|
+
modelunits: RhinoModelUnit;
|
|
217
|
+
/**
|
|
218
|
+
* The server echoes the request's full base64 definition back as `algo`, but the client strips
|
|
219
|
+
* it before returning — retaining it would pin a multi-MB copy of the definition per response,
|
|
220
|
+
* multiplied by every cache that holds responses. Always `undefined` on client-returned
|
|
221
|
+
* responses (inherited optional field from {@link GrasshopperDefinitionSource}).
|
|
222
|
+
*/
|
|
223
|
+
algo?: string | null;
|
|
224
|
+
/** Filename of the definition (always present in response) */
|
|
225
|
+
filename: string | null;
|
|
226
|
+
/** Recursion level used */
|
|
227
|
+
recursionlevel?: number;
|
|
228
|
+
/** Output values organized by parameter */
|
|
229
|
+
values: DataTree[];
|
|
230
|
+
/** Computation errors */
|
|
231
|
+
errors?: string[];
|
|
232
|
+
/** Computation warnings */
|
|
233
|
+
warnings?: string[];
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Output parameter
|
|
237
|
+
*/
|
|
238
|
+
interface OutputParamSchema {
|
|
239
|
+
name: string;
|
|
240
|
+
nickname: string | null;
|
|
241
|
+
paramType: string;
|
|
242
|
+
/**
|
|
243
|
+
* Grasshopper parameter instance GUID
|
|
244
|
+
*/
|
|
245
|
+
id: string;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Input parameter
|
|
249
|
+
*/
|
|
250
|
+
interface InputParamSchema {
|
|
251
|
+
/**
|
|
252
|
+
* Grasshopper parameter instance GUID
|
|
253
|
+
*/
|
|
254
|
+
id: string;
|
|
255
|
+
name: string;
|
|
256
|
+
nickname: string | null;
|
|
257
|
+
description: string;
|
|
258
|
+
paramType: string;
|
|
259
|
+
treeAccess: boolean;
|
|
260
|
+
minimum: number | null;
|
|
261
|
+
maximum: number | null;
|
|
262
|
+
atLeast: number;
|
|
263
|
+
atMost: number;
|
|
264
|
+
stepSize?: number;
|
|
265
|
+
default: any;
|
|
266
|
+
/**
|
|
267
|
+
* Key-value pairs for dropdown options
|
|
268
|
+
*/
|
|
269
|
+
values?: Record<string, string>;
|
|
270
|
+
/**
|
|
271
|
+
* Accepted file formats for File input
|
|
272
|
+
*/
|
|
273
|
+
acceptedFormats?: string[];
|
|
274
|
+
groupName?: string | null;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Parsed input/output structure with raw schemas.
|
|
279
|
+
*
|
|
280
|
+
* `loadWarnings` / `loadErrors` carry the server's definition-load diagnostics
|
|
281
|
+
* (missing plugin, broken component, etc.) from the `/io` response. They are
|
|
282
|
+
* distinct from per-input parse failures (`InputParseError`): these come from
|
|
283
|
+
* the server loading the definition, those from the client typing an input.
|
|
284
|
+
*/
|
|
285
|
+
interface GrasshopperParsedIORaw {
|
|
286
|
+
inputs: InputParamSchema[];
|
|
287
|
+
outputs: OutputParamSchema[];
|
|
288
|
+
/** Server-side definition-load warnings, if any. */
|
|
289
|
+
loadWarnings?: string[];
|
|
290
|
+
/** Server-side definition-load errors, if any (e.g. missing plugin). */
|
|
291
|
+
loadErrors?: string[];
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Per-input parse failure. The corresponding entry in `inputs` was filled
|
|
295
|
+
* with a safe default so the rest of the pipeline can keep going — but the
|
|
296
|
+
* caller should surface this so the user knows their definition has a
|
|
297
|
+
* misconfigured parameter.
|
|
298
|
+
*/
|
|
299
|
+
interface InputParseError {
|
|
300
|
+
/** The input's `name` (or `'unknown'` if the schema didn't have one). */
|
|
301
|
+
inputName: string;
|
|
302
|
+
/** The declared paramType from the raw schema. */
|
|
303
|
+
paramType: string;
|
|
304
|
+
/** Human-readable reason from the underlying RhinoComputeError. */
|
|
305
|
+
message: string;
|
|
306
|
+
/** Error code from the underlying RhinoComputeError, if available. */
|
|
307
|
+
code?: string;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Parsed input/output structure with processed types.
|
|
311
|
+
*
|
|
312
|
+
* `parseErrors` is populated when one or more inputs failed validation and
|
|
313
|
+
* fell back to a safe default. The result is still usable, but the UI should
|
|
314
|
+
* surface these so the user can fix their definition.
|
|
315
|
+
*/
|
|
316
|
+
interface GrasshopperParsedIO {
|
|
317
|
+
inputs: InputParam[];
|
|
318
|
+
outputs: OutputParamSchema[];
|
|
319
|
+
parseErrors?: InputParseError[];
|
|
320
|
+
/**
|
|
321
|
+
* Server-side definition-load warnings from the `/io` response (e.g. an
|
|
322
|
+
* obsolete component). Surface these so the user understands a degraded IO
|
|
323
|
+
* list. Distinct from `parseErrors` (client-side input typing failures).
|
|
324
|
+
*/
|
|
325
|
+
loadWarnings?: string[];
|
|
326
|
+
/**
|
|
327
|
+
* Server-side definition-load errors from the `/io` response (e.g. a missing
|
|
328
|
+
* plugin that left inputs unresolved). When present, the inputs/outputs may
|
|
329
|
+
* be incomplete — the user needs to fix their server/definition.
|
|
330
|
+
*/
|
|
331
|
+
loadErrors?: string[];
|
|
332
|
+
}
|
|
9
333
|
|
|
10
334
|
/**
|
|
11
335
|
* By-reference definition form for solves.
|
|
@@ -157,10 +481,6 @@ type SolveResult = {
|
|
|
157
481
|
} | {
|
|
158
482
|
status: 'superseded';
|
|
159
483
|
};
|
|
160
|
-
/**
|
|
161
|
-
* Adapter for the underlying solve function. Lets the scheduler be tested
|
|
162
|
-
* without a real Compute server, and decouples it from the client class.
|
|
163
|
-
*/
|
|
164
484
|
type SolveExecutor = (definition: SolveDefinition, dataTree: DataTree[], config: GrasshopperComputeConfig) => Promise<GrasshopperComputeResponse>;
|
|
165
485
|
/**
|
|
166
486
|
* Cache-key-aware executor. When `cacheKey` is provided, the executor solves by
|
|
@@ -178,6 +498,7 @@ type CacheKeyExecutor = (definition: SolveDefinition, dataTree: DataTree[], cach
|
|
|
178
498
|
cacheKey: string | null;
|
|
179
499
|
missed: boolean;
|
|
180
500
|
}>;
|
|
501
|
+
|
|
181
502
|
/**
|
|
182
503
|
* Robust scheduler for Grasshopper solves.
|
|
183
504
|
*
|
|
@@ -227,6 +548,15 @@ declare class SolveScheduler {
|
|
|
227
548
|
private readonly cache;
|
|
228
549
|
/** Sum of `sizeBytes` across retained cache entries. */
|
|
229
550
|
private cacheBytes;
|
|
551
|
+
/**
|
|
552
|
+
* Cumulative hit/miss/eviction counters for {@link cacheStats}. Deliberately
|
|
553
|
+
* NOT reset by `clearCache()` — they measure this scheduler's whole lifetime,
|
|
554
|
+
* so a hit rate stays comparable across a session rather than restarting at
|
|
555
|
+
* every clear.
|
|
556
|
+
*/
|
|
557
|
+
private cacheHits;
|
|
558
|
+
private cacheMisses;
|
|
559
|
+
private cacheEvictions;
|
|
230
560
|
/** Optional cache-key-aware executor and whether server-def-cache reuse is on. */
|
|
231
561
|
private readonly cacheKeyExecutor?;
|
|
232
562
|
private readonly reuseServerDefinitionCache;
|
|
@@ -357,10 +687,22 @@ declare class SolveScheduler {
|
|
|
357
687
|
/** Remove one cache entry and release its bytes from the running total. */
|
|
358
688
|
private dropCacheEntry;
|
|
359
689
|
clearCache(): void;
|
|
360
|
-
/**
|
|
690
|
+
/**
|
|
691
|
+
* Observability snapshot of the solve cache: current size plus lifetime
|
|
692
|
+
* hit/miss/eviction counters.
|
|
693
|
+
*
|
|
694
|
+
* `hits`/`misses` count cache CONSULTATIONS, so `hits / (hits + misses)` is the
|
|
695
|
+
* hit rate. A TTL-expired entry counts as a miss (the solve runs either way).
|
|
696
|
+
* `evictions` counts only entries dropped under size/byte pressure — not
|
|
697
|
+
* replace-in-place writes or TTL expiry, which are not capacity signals.
|
|
698
|
+
* Counters are cumulative and survive `clearCache()`.
|
|
699
|
+
*/
|
|
361
700
|
cacheStats(): {
|
|
362
701
|
entries: number;
|
|
363
702
|
bytes: number;
|
|
703
|
+
hits: number;
|
|
704
|
+
misses: number;
|
|
705
|
+
evictions: number;
|
|
364
706
|
};
|
|
365
707
|
dispose(): void;
|
|
366
708
|
private runHook;
|
|
@@ -509,9 +851,31 @@ interface GetValuesResult<T = ParsedContext> {
|
|
|
509
851
|
* when working with Grasshopper results in client applications.
|
|
510
852
|
*/
|
|
511
853
|
declare class GrasshopperResponseProcessor {
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
854
|
+
/**
|
|
855
|
+
* The raw compute response. Public so callers can hand it to a renderer-side parser — e.g.
|
|
856
|
+
* `getThreeMeshesFromComputeResponse` in `@selvajs/visualization/parse`, which replaced this
|
|
857
|
+
* class's former `extractMeshesFromResponse()`.
|
|
858
|
+
*/
|
|
859
|
+
readonly response: GrasshopperComputeResponse;
|
|
860
|
+
/**
|
|
861
|
+
* Retained for call-signature compatibility. Its only consumer was the removed
|
|
862
|
+
* `extractMeshesFromResponse()`, which merged it into the parse options; pass `debug`
|
|
863
|
+
* directly to the parser in `@selvajs/visualization/parse` instead.
|
|
864
|
+
*/
|
|
865
|
+
readonly debug: boolean;
|
|
866
|
+
constructor(
|
|
867
|
+
/**
|
|
868
|
+
* The raw compute response. Public so callers can hand it to a renderer-side parser — e.g.
|
|
869
|
+
* `getThreeMeshesFromComputeResponse` in `@selvajs/visualization/parse`, which replaced this
|
|
870
|
+
* class's former `extractMeshesFromResponse()`.
|
|
871
|
+
*/
|
|
872
|
+
response: GrasshopperComputeResponse,
|
|
873
|
+
/**
|
|
874
|
+
* Retained for call-signature compatibility. Its only consumer was the removed
|
|
875
|
+
* `extractMeshesFromResponse()`, which merged it into the parse options; pass `debug`
|
|
876
|
+
* directly to the parser in `@selvajs/visualization/parse` instead.
|
|
877
|
+
*/
|
|
878
|
+
debug?: boolean);
|
|
515
879
|
/**
|
|
516
880
|
* Extract all values in the response.
|
|
517
881
|
*
|
|
@@ -549,22 +913,17 @@ declare class GrasshopperResponseProcessor {
|
|
|
549
913
|
byId: string;
|
|
550
914
|
}, options?: GetValuesOptions): any;
|
|
551
915
|
/**
|
|
552
|
-
*
|
|
553
|
-
*
|
|
554
|
-
*
|
|
555
|
-
* Requires the **Selva Display** Grasshopper component and the VektorNode
|
|
556
|
-
* rhino.compute branch. Three.js is loaded dynamically, so install it as a
|
|
557
|
-
* peer dependency before calling this.
|
|
916
|
+
* REMOVED: `extractMeshesFromResponse()`. Mesh decoding lives in `@selvajs/visualization` now, so
|
|
917
|
+
* this package stays pure solve/data and carries no `three` dependency. Call the parser directly
|
|
918
|
+
* with the raw response:
|
|
558
919
|
*
|
|
559
|
-
* @throws {RhinoComputeError} If the three.js visualization module can't load.
|
|
560
|
-
*
|
|
561
|
-
* @example
|
|
562
920
|
* ```ts
|
|
563
|
-
*
|
|
921
|
+
* import { getThreeMeshesFromComputeResponse } from '@selvajs/visualization/parse';
|
|
922
|
+
*
|
|
923
|
+
* const meshes = await getThreeMeshesFromComputeResponse(processor.response, { rhino });
|
|
564
924
|
* scene.add(...meshes);
|
|
565
925
|
* ```
|
|
566
926
|
*/
|
|
567
|
-
extractMeshesFromResponse(options?: MeshExtractionOptions): Promise<THREE.Object3D<THREE.Object3DEventMap>[]>;
|
|
568
927
|
private getFileData;
|
|
569
928
|
/**
|
|
570
929
|
* Download all files generated by Grasshopper, optionally including
|
|
@@ -722,12 +1081,6 @@ declare function fetchParsedDefinitionIO(definition: string | Uint8Array, config
|
|
|
722
1081
|
* {@link processInputWithError} to receive them.
|
|
723
1082
|
*/
|
|
724
1083
|
declare function processInput(rawInput: InputParamSchema): InputParam;
|
|
725
|
-
/**
|
|
726
|
-
* Parse an array of raw input schemas into typed {@link InputParam}s, each via
|
|
727
|
-
* {@link processInput}. Use {@link processInputsWithErrors} to also collect the
|
|
728
|
-
* inputs that failed validation.
|
|
729
|
-
*/
|
|
730
|
-
declare function processInputs(rawInputs: InputParamSchema[]): InputParam[];
|
|
731
1084
|
|
|
732
1085
|
/**
|
|
733
1086
|
* Value types that can be stored in a DataTree
|
|
@@ -1003,4 +1356,4 @@ declare class TreeBuilder {
|
|
|
1003
1356
|
private static clampValue;
|
|
1004
1357
|
}
|
|
1005
1358
|
|
|
1006
|
-
export { type CacheOptions,
|
|
1359
|
+
export { type BooleanInputType, type CacheOptions, type DataItem, type DataTree, type DataTreeDefault, type DataTreePath, type DataTreeValue, type DefaultValue, type DefinitionRef, FileBaseInfo, type FileInputType, type GeometryInputType, type GetValuesOptions, type GetValuesResult, GrasshopperClient, type GrasshopperComputeConfig, type GrasshopperComputeResponse, type GrasshopperParsedIO, type GrasshopperParsedIORaw, type GrasshopperRequestSchema, GrasshopperResponseProcessor, type InnerTreeData, type InputParam, type InputParamSchema, type NumericInputType, type OutputParamSchema, type OutputType, type ParsedContext, type SchedulerMode, type SolveContext, type SolveDefinition, type SolveOptions, type SolveResult, SolveScheduler, type SolveSchedulerOptions, type TextInputType, TreeBuilder, type ValueListInputType, fetchDefinitionIO, fetchParsedDefinitionIO, hashDefinition, hashSolveInput, isDefinitionRef, processInput, solveGrasshopperDefinition, stableStringify };
|