tempest-react-sdk 0.31.1 → 0.32.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 (78) hide show
  1. package/README.md +2 -0
  2. package/bin/lib/design/collect.mjs +103 -0
  3. package/bin/lib/design/findings.mjs +70 -0
  4. package/bin/lib/design/functions.mjs +188 -0
  5. package/bin/lib/design/functions.test.mjs +127 -0
  6. package/bin/lib/design/index.mjs +80 -0
  7. package/bin/lib/design/index.test.mjs +129 -0
  8. package/bin/lib/design/markers.mjs +76 -0
  9. package/bin/lib/design/markers.test.mjs +60 -0
  10. package/bin/lib/design/mask.mjs +209 -0
  11. package/bin/lib/design/mask.test.mjs +69 -0
  12. package/bin/lib/design/scan.mjs +229 -0
  13. package/bin/lib/design/scan.test.mjs +218 -0
  14. package/bin/lib/doctor/doctor.e2e.test.mjs +79 -2
  15. package/bin/tempest.mjs +83 -3
  16. package/dist/imaging/canvas.cjs +2 -0
  17. package/dist/imaging/canvas.cjs.map +1 -0
  18. package/dist/imaging/canvas.js +23 -0
  19. package/dist/imaging/canvas.js.map +1 -0
  20. package/dist/imaging/compress.cjs +2 -0
  21. package/dist/imaging/compress.cjs.map +1 -0
  22. package/dist/imaging/compress.js +43 -0
  23. package/dist/imaging/compress.js.map +1 -0
  24. package/dist/imaging/decode.cjs +2 -0
  25. package/dist/imaging/decode.cjs.map +1 -0
  26. package/dist/imaging/decode.js +42 -0
  27. package/dist/imaging/decode.js.map +1 -0
  28. package/dist/imaging/encode.cjs +2 -0
  29. package/dist/imaging/encode.cjs.map +1 -0
  30. package/dist/imaging/encode.js +48 -0
  31. package/dist/imaging/encode.js.map +1 -0
  32. package/dist/imaging/exceptions.cjs +2 -0
  33. package/dist/imaging/exceptions.cjs.map +1 -0
  34. package/dist/imaging/exceptions.js +26 -0
  35. package/dist/imaging/exceptions.js.map +1 -0
  36. package/dist/imaging/thumbnails.cjs +2 -0
  37. package/dist/imaging/thumbnails.cjs.map +1 -0
  38. package/dist/imaging/thumbnails.js +34 -0
  39. package/dist/imaging/thumbnails.js.map +1 -0
  40. package/dist/imaging/transform.cjs +2 -0
  41. package/dist/imaging/transform.cjs.map +1 -0
  42. package/dist/imaging/transform.js +97 -0
  43. package/dist/imaging/transform.js.map +1 -0
  44. package/dist/imaging/use-image-processing.cjs +2 -0
  45. package/dist/imaging/use-image-processing.cjs.map +1 -0
  46. package/dist/imaging/use-image-processing.js +45 -0
  47. package/dist/imaging/use-image-processing.js.map +1 -0
  48. package/dist/imaging.cjs +1 -0
  49. package/dist/imaging.d.ts +541 -0
  50. package/dist/imaging.js +9 -0
  51. package/dist/tabular/assets.cjs +2 -0
  52. package/dist/tabular/assets.cjs.map +1 -0
  53. package/dist/tabular/assets.js +19 -0
  54. package/dist/tabular/assets.js.map +1 -0
  55. package/dist/tabular/cache.cjs +2 -0
  56. package/dist/tabular/cache.cjs.map +1 -0
  57. package/dist/tabular/cache.js +48 -0
  58. package/dist/tabular/cache.js.map +1 -0
  59. package/dist/tabular/exceptions.cjs +2 -0
  60. package/dist/tabular/exceptions.cjs.map +1 -0
  61. package/dist/tabular/exceptions.js +30 -0
  62. package/dist/tabular/exceptions.js.map +1 -0
  63. package/dist/tabular/manifest.cjs +2 -0
  64. package/dist/tabular/manifest.cjs.map +1 -0
  65. package/dist/tabular/manifest.js +42 -0
  66. package/dist/tabular/manifest.js.map +1 -0
  67. package/dist/tabular/predictor.cjs +2 -0
  68. package/dist/tabular/predictor.cjs.map +1 -0
  69. package/dist/tabular/predictor.js +111 -0
  70. package/dist/tabular/predictor.js.map +1 -0
  71. package/dist/tabular/use-tabular-predictor.cjs +2 -0
  72. package/dist/tabular/use-tabular-predictor.cjs.map +1 -0
  73. package/dist/tabular/use-tabular-predictor.js +51 -0
  74. package/dist/tabular/use-tabular-predictor.js.map +1 -0
  75. package/dist/tabular.cjs +1 -0
  76. package/dist/tabular.d.ts +489 -0
  77. package/dist/tabular.js +7 -0
  78. package/package.json +11 -1
@@ -0,0 +1,489 @@
1
+ /**
2
+ * Store model bytes without downloading them.
3
+ *
4
+ * For an app that already has the bytes — from a file input, or from a
5
+ * bundle it unpacked — and wants the next load to find them cached.
6
+ *
7
+ * @param url The URL to key the entry under.
8
+ * @param bytes The model bytes.
9
+ * @param cacheName Cache Storage bucket name.
10
+ * @returns `true` when the entry was stored, `false` without Cache Storage.
11
+ */
12
+ export declare function cacheModelBytes(url: string, bytes: Uint8Array, cacheName?: string): Promise<boolean>;
13
+
14
+ /**
15
+ * Drop cached models.
16
+ *
17
+ * @param url A specific model to evict; omit to delete the whole bucket.
18
+ * @param cacheName Cache Storage bucket name.
19
+ * @returns `true` when something was deleted.
20
+ */
21
+ export declare function clearModelCache(url?: string, cacheName?: string): Promise<boolean>;
22
+
23
+ /**
24
+ * Point ONNX Runtime Web at locally served WebAssembly binaries.
25
+ *
26
+ * Call once, before creating any predictor.
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * configureOrtAssets("/ort/");
31
+ * const predictor = await TabularPredictor.create("/models/classifier.onnx");
32
+ * ```
33
+ *
34
+ * @param basePath Directory the binaries are served from, with a trailing
35
+ * slash. Copy them there at build time — for Vite, from
36
+ * `node_modules/onnxruntime-web/dist/`.
37
+ */
38
+ export declare function configureOrtAssets(basePath: string): void;
39
+
40
+ /** Cache Storage bucket used when the caller does not name one. */
41
+ export declare const DEFAULT_MODEL_CACHE = "tempest-tabular-models";
42
+
43
+ /**
44
+ * Execution providers used when the caller does not choose.
45
+ *
46
+ * WebAssembly only, and deliberately: scikit-learn graphs are `ai.onnx.ml`
47
+ * operators, which the WebGPU backend does not implement. There is no
48
+ * speed left on the table here — a 10-tree forest predicts a row in about
49
+ * 0.05 ms in Chromium.
50
+ */
51
+ export declare const DEFAULT_TABULAR_PROVIDERS: readonly string[];
52
+
53
+ /** The package manifest, as written by `edge_pipeline`. */
54
+ export declare interface EdgeManifest {
55
+ readonly schema_version: number;
56
+ readonly name: string;
57
+ readonly version: string;
58
+ readonly created_at: string;
59
+ readonly sdk_version: string;
60
+ readonly estimator: string;
61
+ readonly model: ManifestModelFile;
62
+ readonly input: ManifestInput;
63
+ readonly output: ManifestOutput;
64
+ readonly verified: boolean | null;
65
+ readonly baseline_file: string | null;
66
+ readonly baseline_samples: number;
67
+ }
68
+
69
+ /** One row of feature values, in the column order the model was trained on. */
70
+ export declare type FeatureRow = readonly number[];
71
+
72
+ /** The rows do not match what the model expects. */
73
+ export declare class FeatureShapeError extends TabularError {
74
+ constructor(message: string, options?: ErrorOptions);
75
+ }
76
+
77
+ /**
78
+ * Read a package's manifest.
79
+ *
80
+ * Cheap: it is a few hundred bytes, so an app can check for a new version
81
+ * without downloading a model it may already have.
82
+ *
83
+ * @example
84
+ * ```ts
85
+ * const manifest = await fetchEdgeManifest("/models/risk/");
86
+ * if (manifest.version !== localStorage.getItem("risk-version")) {
87
+ * // a new model was published
88
+ * }
89
+ * ```
90
+ *
91
+ * @param directoryUrl URL of the package directory, with or without a
92
+ * trailing slash. A full URL to the manifest file also works.
93
+ * @param requestInit `fetch` options.
94
+ * @returns The parsed manifest.
95
+ * @throws {@link ModelFetchError} when the manifest cannot be read, or when
96
+ * its `schema_version` is newer than this reader understands — loading it
97
+ * anyway would risk misreading the field that defines column order.
98
+ */
99
+ export declare function fetchEdgeManifest(directoryUrl: string, requestInit?: RequestInit): Promise<EdgeManifest>;
100
+
101
+ /**
102
+ * Fetch the model bytes, preferring the on-device copy.
103
+ *
104
+ * @example
105
+ * ```ts
106
+ * const bytes = await fetchModelBytes("/models/classifier-v3.onnx");
107
+ * const predictor = await TabularPredictor.create(bytes);
108
+ * ```
109
+ *
110
+ * @param url Where the model lives.
111
+ * @param options Cache bucket, revalidation and `fetch` options.
112
+ * @returns The model bytes.
113
+ * @throws {@link ModelFetchError} when the model is neither cached nor
114
+ * reachable — which is the "offline and never warmed" case, and the
115
+ * message says so.
116
+ */
117
+ export declare function fetchModelBytes(url: string, options?: ModelCacheOptions): Promise<Uint8Array>;
118
+
119
+ /** The session ran but its outputs could not be read. */
120
+ export declare class InferenceError extends TabularError {
121
+ constructor(message: string, options?: ErrorOptions);
122
+ }
123
+
124
+ /**
125
+ * Whether a model is already on the device.
126
+ *
127
+ * Useful for showing "available offline" in the UI, and for deciding
128
+ * whether to prefetch on a metered connection.
129
+ *
130
+ * @param url The model URL.
131
+ * @param cacheName Cache Storage bucket name.
132
+ * @returns `true` when the bytes are cached.
133
+ */
134
+ export declare function isModelCached(url: string, cacheName?: string): Promise<boolean>;
135
+
136
+ /** A package loaded and ready to answer. */
137
+ export declare interface LoadedEdgePackage {
138
+ /** What was published. */
139
+ readonly manifest: EdgeManifest;
140
+ /** The running model. */
141
+ readonly predictor: TabularPredictor;
142
+ /** Column order the rows must follow. */
143
+ readonly featureNames: readonly string[];
144
+ /** Class names behind each probability column. */
145
+ readonly classes: readonly string[];
146
+ /**
147
+ * Map a prediction's scores onto class names.
148
+ *
149
+ * @param probabilities One row of scores.
150
+ * @returns Name/score pairs, highest first.
151
+ */
152
+ readonly explain: (probabilities: readonly number[]) => {
153
+ name: string;
154
+ score: number;
155
+ }[];
156
+ }
157
+
158
+ /**
159
+ * Load a whole edge package: manifest, model, and the names to read it by.
160
+ *
161
+ * @example
162
+ * ```ts
163
+ * const pkg = await loadEdgePackage("/models/risk/");
164
+ *
165
+ * console.log(pkg.featureNames); // ["age", "income", "tenure", "score", "visits"]
166
+ *
167
+ * const { probabilities } = await pkg.predictor.predict([[41, 5200, 3, 0.82, 12]]);
168
+ * console.log(pkg.explain(probabilities[0]!)); // [{ name: "approved", score: 0.91 }, ...]
169
+ * ```
170
+ *
171
+ * @param directoryUrl URL of the package directory.
172
+ * @param options Predictor options plus caching.
173
+ * @returns The loaded package.
174
+ * @throws {@link ModelFetchError} when the manifest or model cannot be read.
175
+ */
176
+ export declare function loadEdgePackage(directoryUrl: string, options?: LoadEdgePackageOptions): Promise<LoadedEdgePackage>;
177
+
178
+ /** Options for {@link loadEdgePackage}. */
179
+ export declare interface LoadEdgePackageOptions extends TabularPredictorOptions {
180
+ /** Cache the model bytes for offline use. `true` by default. */
181
+ readonly cache?: boolean | ModelCacheOptions;
182
+ }
183
+
184
+ /** Fixed filename inside a package directory. */
185
+ export declare const MANIFEST_FILENAME = "manifest.json";
186
+
187
+ /** What the graph expects per row. */
188
+ export declare interface ManifestInput {
189
+ readonly name: string;
190
+ readonly features: number;
191
+ /** Column order used at training time. */
192
+ readonly feature_names: readonly string[];
193
+ }
194
+
195
+ /** The graph file and how to check you got it whole. */
196
+ export declare interface ManifestModelFile {
197
+ readonly file: string;
198
+ readonly sha256: string;
199
+ readonly bytes: number;
200
+ readonly gzip_file: string | null;
201
+ readonly gzip_bytes: number | null;
202
+ readonly opset: number;
203
+ readonly dtype: string;
204
+ }
205
+
206
+ /** What the graph answers. */
207
+ export declare interface ManifestOutput {
208
+ readonly is_classifier: boolean;
209
+ readonly label_output: string;
210
+ readonly probability_output: string | null;
211
+ /** Class labels in score-column order. */
212
+ readonly classes: readonly string[];
213
+ }
214
+
215
+ /** Options for {@link fetchModelBytes}. */
216
+ export declare interface ModelCacheOptions {
217
+ /** Cache Storage bucket name. */
218
+ readonly cacheName?: string;
219
+ /**
220
+ * Go to the network first and fall back to the cache.
221
+ *
222
+ * For a URL that serves "whatever is current" rather than a pinned
223
+ * version. Costs a round trip on every load when online.
224
+ */
225
+ readonly revalidate?: boolean;
226
+ /** `fetch` options, e.g. credentials for a private model endpoint. */
227
+ readonly requestInit?: RequestInit;
228
+ }
229
+
230
+ /**
231
+ * The model bytes could not be fetched or read from the cache.
232
+ *
233
+ * Distinct from {@link ModelLoadError}: this one means the app is offline
234
+ * and nothing was cached, which is a deployment problem, not a model
235
+ * problem.
236
+ */
237
+ export declare class ModelFetchError extends TabularError {
238
+ constructor(message: string, options?: ErrorOptions);
239
+ }
240
+
241
+ /** The model bytes could not be loaded into a session. */
242
+ export declare class ModelLoadError extends TabularError {
243
+ constructor(message: string, options?: ErrorOptions);
244
+ }
245
+
246
+ /**
247
+ * The WebAssembly binaries ONNX Runtime Web may request.
248
+ *
249
+ * Which one is fetched depends on the browser's threading and SIMD support,
250
+ * so an app that must work everywhere ships all of them. Chromium with the
251
+ * default entry point fetched the `jsep` build.
252
+ */
253
+ export declare const ORT_WASM_ASSETS: readonly string[];
254
+
255
+ /**
256
+ * The URLs a service worker should precache for offline inference.
257
+ *
258
+ * The model file is not included: it is cached by
259
+ * {@link fetchModelBytes} on first use, under its own bucket.
260
+ *
261
+ * @example
262
+ * ```ts
263
+ * installPrecache([...ortAssetUrls("/ort/"), "/index.html"]);
264
+ * ```
265
+ *
266
+ * @param basePath Directory the binaries are served from.
267
+ * @returns Absolute-from-root URLs for every runtime asset.
268
+ */
269
+ export declare function ortAssetUrls(basePath: string): string[];
270
+
271
+ /**
272
+ * A predicted class label.
273
+ *
274
+ * scikit-learn classifiers export an int64 label tensor, which ONNX Runtime
275
+ * Web surfaces as `bigint`. Those are converted to `number` — a class index
276
+ * never approaches `Number.MAX_SAFE_INTEGER`, and leaving `bigint` in the
277
+ * result would break `JSON.stringify` and every `=== 1` comparison a caller
278
+ * writes. A model trained on string labels keeps them as strings.
279
+ */
280
+ export declare type PredictedLabel = number | string;
281
+
282
+ /** Manifest schema version this reader was written against. */
283
+ export declare const SUPPORTED_MANIFEST_SCHEMA = 1;
284
+
285
+ /**
286
+ * Errors thrown by the tabular inference module.
287
+ *
288
+ * Each one exists because the underlying failure is unreadable on its own:
289
+ * ONNX Runtime reports a missing operator registration, and the actual cause
290
+ * is an import path chosen three files away.
291
+ *
292
+ * Every subclass sets `name` to a **literal** string rather than to
293
+ * `new.target.name`. Measured in a real build: the minifier renames the
294
+ * class, so the derived form ships as `error.name === "t"` — useless in a
295
+ * log and in any consumer that branches on the name.
296
+ */
297
+ /** Base class for every error this module throws. */
298
+ export declare class TabularError extends Error {
299
+ constructor(message: string, options?: ErrorOptions);
300
+ }
301
+
302
+ /**
303
+ * Types for browser inference over tabular models exported from scikit-learn.
304
+ */
305
+ /** Anything `InferenceSession.create` accepts as a model. */
306
+ export declare type TabularModelSource = string | ArrayBufferLike | Uint8Array;
307
+
308
+ /** One batch of predictions. */
309
+ export declare interface TabularPrediction {
310
+ /** Predicted class or regressed value per row. */
311
+ readonly labels: readonly PredictedLabel[];
312
+ /** Class scores per row; empty for a regressor. */
313
+ readonly probabilities: readonly (readonly number[])[];
314
+ /** Rows predicted. */
315
+ readonly numRows: number;
316
+ /** Wall-clock inference duration in milliseconds. */
317
+ readonly ms: number;
318
+ }
319
+
320
+ /**
321
+ * A loaded tabular model, ready to answer.
322
+ *
323
+ * @example
324
+ * ```ts
325
+ * const predictor = await TabularPredictor.create("/models/classifier.onnx");
326
+ * const { labels, probabilities } = await predictor.predict([[5.1, 3.5, 1.4, 0.2]]);
327
+ * ```
328
+ */
329
+ export declare class TabularPredictor {
330
+ private readonly session;
331
+ /** What is loaded and how it is configured. */
332
+ readonly info: TabularPredictorInfo;
333
+ private constructor();
334
+ /**
335
+ * Load a model and describe its graph.
336
+ *
337
+ * @param source A URL string, or the model bytes (which is what an
338
+ * offline app passes, having read them from the cache).
339
+ * @param options Providers, warm-up and pass-through session options.
340
+ * @throws {@link UnsupportedGraphError} when the runtime build lacks the
341
+ * `ai.onnx.ml` operators — the WebGPU entry point does.
342
+ * @throws {@link ModelLoadError} for any other load failure.
343
+ */
344
+ static create(source: TabularModelSource, options?: TabularPredictorOptions): Promise<TabularPredictor>;
345
+ /**
346
+ * Run one throwaway inference so the first real call is not the slow one.
347
+ *
348
+ * Skipped when the graph does not declare a feature count, since there
349
+ * is no shape to synthesise. Failures are swallowed: a warm-up that
350
+ * cannot run is not a reason to refuse to serve.
351
+ */
352
+ warmUp(): Promise<void>;
353
+ /**
354
+ * Predict for a batch of rows.
355
+ *
356
+ * @param rows One array of feature values per row, in training column
357
+ * order. A single row is still wrapped: `[[...]]`.
358
+ * @returns Labels, class scores when the model produces them, and the
359
+ * call's duration.
360
+ * @throws {@link FeatureShapeError} when the batch is empty, ragged, or
361
+ * the wrong width — checked here so the failure names the mismatch
362
+ * instead of surfacing as an opaque runtime error.
363
+ * @throws {@link InferenceError} when the session runs but its outputs
364
+ * cannot be read.
365
+ */
366
+ predict(rows: readonly FeatureRow[]): Promise<TabularPrediction>;
367
+ /**
368
+ * Release the session's memory.
369
+ *
370
+ * Worth calling on a route that swaps models: the WebAssembly heap does
371
+ * not shrink on garbage collection alone.
372
+ */
373
+ dispose(): Promise<void>;
374
+ }
375
+
376
+ /** What a loaded predictor is, and how it is configured. */
377
+ export declare interface TabularPredictorInfo {
378
+ /** Graph input name. Not a constant: exporters choose it. */
379
+ readonly inputName: string;
380
+ /** Features per row, or `null` when the graph does not declare it. */
381
+ readonly numFeatures: number | null;
382
+ /** Every graph output, in order. */
383
+ readonly outputNames: readonly string[];
384
+ /** The output holding predicted classes or regressed values. */
385
+ readonly labelOutput: string;
386
+ /** The output holding class scores, when the graph produces them. */
387
+ readonly probabilityOutput: string | null;
388
+ /** Whether a score output was found. */
389
+ readonly isClassifier: boolean;
390
+ /** Execution providers actually in use. */
391
+ readonly providers: readonly string[];
392
+ }
393
+
394
+ /** Options for {@link TabularPredictor.create}. */
395
+ export declare interface TabularPredictorOptions {
396
+ /**
397
+ * Execution providers in preference order.
398
+ *
399
+ * Defaults to `["wasm"]`, and that is not a placeholder: scikit-learn
400
+ * graphs are built from `ai.onnx.ml` operators (`TreeEnsembleClassifier`,
401
+ * `LinearClassifier`, `Scaler`), which only the WebAssembly backend
402
+ * implements.
403
+ */
404
+ readonly providers?: readonly string[];
405
+ /**
406
+ * Run one throwaway inference at creation, so the first real prediction
407
+ * does not pay for allocation and kernel selection.
408
+ */
409
+ readonly warmup?: boolean;
410
+ /** Session options forwarded verbatim to ONNX Runtime Web. */
411
+ readonly sessionOptions?: Record<string, unknown>;
412
+ }
413
+
414
+ /** Lifecycle of the model behind the hook. */
415
+ export declare type TabularPredictorStatus = "idle" | "loading" | "ready" | "error";
416
+
417
+ /**
418
+ * The runtime has no kernels for this graph's operators.
419
+ *
420
+ * Measured, and the reason this class exists: importing
421
+ * `onnxruntime-web/webgpu` loads a WebAssembly build without the
422
+ * `ai.onnx.ml` domain, so creating a session over any scikit-learn export
423
+ * fails with `No Op registered for TreeEnsembleClassifier`. The message
424
+ * names the fix, because the raw error points at the model instead of at
425
+ * the import.
426
+ */
427
+ export declare class UnsupportedGraphError extends TabularError {
428
+ constructor(message: string, options?: ErrorOptions);
429
+ }
430
+
431
+ /**
432
+ * Load a tabular model and keep it for the component's lifetime.
433
+ *
434
+ * @example
435
+ * ```tsx
436
+ * function RiskWidget() {
437
+ * const { predict, isReady } = useTabularPredictor("/models/risk-v3.onnx");
438
+ * const [score, setScore] = useState<number | null>(null);
439
+ *
440
+ * async function onSubmit(features: number[]) {
441
+ * const { probabilities } = await predict([features]);
442
+ * setScore(probabilities[0]?.[1] ?? null);
443
+ * }
444
+ *
445
+ * return <button disabled={!isReady} onClick={() => onSubmit([1, 2, 3, 4])}>Score</button>;
446
+ * }
447
+ * ```
448
+ *
449
+ * @param source Model URL, or the bytes when the app already has them.
450
+ * Pass `null` to hold off loading (a gate, a lazy tab).
451
+ * @param options Predictor options plus caching.
452
+ * @returns The predictor, its status, and a `predict` bound to it.
453
+ */
454
+ export declare function useTabularPredictor(source: TabularModelSource | null, options?: UseTabularPredictorOptions): UseTabularPredictorResult;
455
+
456
+ /** Options for {@link useTabularPredictor}. */
457
+ export declare interface UseTabularPredictorOptions extends TabularPredictorOptions {
458
+ /**
459
+ * Cache the model bytes on the device, so later loads work offline.
460
+ *
461
+ * On by default when the source is a URL: an app that runs inference in
462
+ * the browser almost always wants it to keep working without a network,
463
+ * and the failure mode of not caching only shows up in a tunnel.
464
+ */
465
+ readonly cache?: boolean | ModelCacheOptions;
466
+ }
467
+
468
+ /** What {@link useTabularPredictor} returns. */
469
+ export declare interface UseTabularPredictorResult {
470
+ /** The loaded predictor, or `null` while loading or on error. */
471
+ readonly predictor: TabularPredictor | null;
472
+ /** Where the load is. */
473
+ readonly status: TabularPredictorStatus;
474
+ /** Why the load failed. */
475
+ readonly error: Error | null;
476
+ /** Whether the model is loaded and can answer. */
477
+ readonly isReady: boolean;
478
+ /**
479
+ * Predict for a batch of rows.
480
+ *
481
+ * @throws When called before the model is ready — awaiting `isReady`
482
+ * is the caller's job, and a silent empty result would hide the bug.
483
+ */
484
+ readonly predict: (rows: readonly FeatureRow[]) => Promise<TabularPrediction>;
485
+ /** Load the model again, e.g. after a failure or a new version. */
486
+ readonly reload: () => void;
487
+ }
488
+
489
+ export { }
@@ -0,0 +1,7 @@
1
+ import { ORT_WASM_ASSETS as e, configureOrtAssets as t, ortAssetUrls as n } from "./tabular/assets.js";
2
+ import { FeatureShapeError as r, InferenceError as i, ModelFetchError as a, ModelLoadError as o, TabularError as s, UnsupportedGraphError as c } from "./tabular/exceptions.js";
3
+ import { DEFAULT_MODEL_CACHE as l, cacheModelBytes as u, clearModelCache as d, fetchModelBytes as f, isModelCached as p } from "./tabular/cache.js";
4
+ import { DEFAULT_TABULAR_PROVIDERS as m, TabularPredictor as h } from "./tabular/predictor.js";
5
+ import { MANIFEST_FILENAME as g, SUPPORTED_MANIFEST_SCHEMA as _, fetchEdgeManifest as v, loadEdgePackage as y } from "./tabular/manifest.js";
6
+ import { useTabularPredictor as b } from "./tabular/use-tabular-predictor.js";
7
+ export { l as DEFAULT_MODEL_CACHE, m as DEFAULT_TABULAR_PROVIDERS, r as FeatureShapeError, i as InferenceError, g as MANIFEST_FILENAME, a as ModelFetchError, o as ModelLoadError, e as ORT_WASM_ASSETS, _ as SUPPORTED_MANIFEST_SCHEMA, s as TabularError, h as TabularPredictor, c as UnsupportedGraphError, u as cacheModelBytes, d as clearModelCache, t as configureOrtAssets, v as fetchEdgeManifest, f as fetchModelBytes, p as isModelCached, y as loadEdgePackage, n as ortAssetUrls, b as useTabularPredictor };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tempest-react-sdk",
3
- "version": "0.31.1",
3
+ "version": "0.32.0",
4
4
  "description": "SDK público da Tempest com componentes, hooks e integrações para projetos React.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -70,6 +70,16 @@
70
70
  "import": "./dist/editor.js",
71
71
  "require": "./dist/editor.cjs"
72
72
  },
73
+ "./imaging": {
74
+ "types": "./dist/imaging.d.ts",
75
+ "import": "./dist/imaging.js",
76
+ "require": "./dist/imaging.cjs"
77
+ },
78
+ "./tabular": {
79
+ "types": "./dist/tabular.d.ts",
80
+ "import": "./dist/tabular.js",
81
+ "require": "./dist/tabular.cjs"
82
+ },
73
83
  "./vision": {
74
84
  "types": "./dist/vision.d.ts",
75
85
  "import": "./dist/vision.js",