@camstack/types 1.1.20 → 1.1.21
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/dist/addon.js +1 -1
- package/dist/addon.mjs +1 -1
- package/dist/capabilities/device-manager.cap.d.ts +269 -6
- package/dist/capabilities/pipeline-orchestrator.cap.d.ts +7 -3
- package/dist/device/device-management.d.ts +61 -2
- package/dist/device/index.d.ts +1 -1
- package/dist/expression/ast.d.ts +56 -0
- package/dist/expression/builtins.d.ts +19 -0
- package/dist/expression/compile.d.ts +17 -0
- package/dist/expression/errors.d.ts +16 -0
- package/dist/expression/evaluator.d.ts +14 -0
- package/dist/expression/index.d.ts +25 -0
- package/dist/expression/limits.d.ts +30 -0
- package/dist/expression/link-expression.d.ts +44 -0
- package/dist/expression/parser.d.ts +12 -0
- package/dist/expression/tokenizer.d.ts +38 -0
- package/dist/generated/addon-api.d.ts +346 -0
- package/dist/generated/device-proxy.d.ts +1 -1
- package/dist/generated/method-access-map.d.ts +1 -1
- package/dist/generated/system-proxy.d.ts +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +1268 -27
- package/dist/index.mjs +1240 -28
- package/dist/interfaces/agent.d.ts +14 -0
- package/dist/{sleep-MHm--th-.mjs → sleep-BO1nweKv.mjs} +1 -0
- package/dist/{sleep-BabrCASa.js → sleep-DaQgDq90.js} +1 -0
- package/dist/units/convert.d.ts +49 -0
- package/dist/units/index.d.ts +8 -0
- package/dist/units/unit-table.d.ts +270 -0
- package/package.json +1 -1
package/dist/addon.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_sleep = require("./sleep-
|
|
2
|
+
const require_sleep = require("./sleep-DaQgDq90.js");
|
|
3
3
|
const require_err_msg = require("./err-msg-COpsHMw2.js");
|
|
4
4
|
exports.BaseAddon = require_sleep.BaseAddon;
|
|
5
5
|
exports.DATAPLANE_SECRET_HEADER = require_sleep.DATAPLANE_SECRET_HEADER;
|
package/dist/addon.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { A as ReadinessRegistry, C as asJsonObject, O as parseJsonUnknown, P as scopeKey, T as asString, a as adminUiCapability, b as DeviceType, gt as DisposerChain, ht as EventCategory, i as deviceOpsCapability, j as ReadinessTimeoutError, k as DATAPLANE_SECRET_HEADER, o as createDeviceProxy, ot as BaseAddon, p as expandCapMethods, st as normalizeAddonInitResult, t as sleep, ut as emitReadiness } from "./sleep-
|
|
1
|
+
import { A as ReadinessRegistry, C as asJsonObject, O as parseJsonUnknown, P as scopeKey, T as asString, a as adminUiCapability, b as DeviceType, gt as DisposerChain, ht as EventCategory, i as deviceOpsCapability, j as ReadinessTimeoutError, k as DATAPLANE_SECRET_HEADER, o as createDeviceProxy, ot as BaseAddon, p as expandCapMethods, st as normalizeAddonInitResult, t as sleep, ut as emitReadiness } from "./sleep-BO1nweKv.mjs";
|
|
2
2
|
import { t as errMsg } from "./err-msg-IQTHeDzc.mjs";
|
|
3
3
|
export { BaseAddon, DATAPLANE_SECRET_HEADER, DeviceType, DisposerChain, EventCategory, ReadinessRegistry, ReadinessTimeoutError, adminUiCapability, asJsonObject, asString, createDeviceProxy, deviceOpsCapability, emitReadiness, errMsg, expandCapMethods, normalizeAddonInitResult, parseJsonUnknown, scopeKey, sleep };
|
|
@@ -19,12 +19,6 @@
|
|
|
19
19
|
import { z } from 'zod';
|
|
20
20
|
import { DeviceType } from '../device/device-type.js';
|
|
21
21
|
import { StreamSourceEntrySchema } from './schemas/streaming-shared.js';
|
|
22
|
-
/** Cap-wire shape of a DeviceLink — structurally mirrors `DeviceLink` in
|
|
23
|
-
* `device-management.ts`. Source is a union: a FIELD source copies a sibling
|
|
24
|
-
* accessory's status field (`kind` optional/absent for wire compat); a
|
|
25
|
-
* LITERAL source carries a per-device constant (no sibling is read); a
|
|
26
|
-
* GLOBAL source (P2e) copies ANY device's status field, addressed by the
|
|
27
|
-
* source device's full re-sync-stable `stableId`. */
|
|
28
22
|
export declare const DeviceLinkSchema: z.ZodObject<{
|
|
29
23
|
id: z.ZodString;
|
|
30
24
|
source: z.ZodUnion<readonly [z.ZodObject<{
|
|
@@ -40,6 +34,23 @@ export declare const DeviceLinkSchema: z.ZodObject<{
|
|
|
40
34
|
sourceStableId: z.ZodString;
|
|
41
35
|
cap: z.ZodString;
|
|
42
36
|
fieldPath: z.ZodString;
|
|
37
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
38
|
+
kind: z.ZodLiteral<"expression">;
|
|
39
|
+
expr: z.ZodString;
|
|
40
|
+
bindings: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
|
|
41
|
+
kind: z.ZodOptional<z.ZodLiteral<"field">>;
|
|
42
|
+
sourceKey: z.ZodString;
|
|
43
|
+
cap: z.ZodString;
|
|
44
|
+
fieldPath: z.ZodString;
|
|
45
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
46
|
+
kind: z.ZodLiteral<"literal">;
|
|
47
|
+
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
|
|
48
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
49
|
+
kind: z.ZodLiteral<"global">;
|
|
50
|
+
sourceStableId: z.ZodString;
|
|
51
|
+
cap: z.ZodString;
|
|
52
|
+
fieldPath: z.ZodString;
|
|
53
|
+
}, z.core.$strip>]>>;
|
|
43
54
|
}, z.core.$strip>]>;
|
|
44
55
|
target: z.ZodObject<{
|
|
45
56
|
cap: z.ZodString;
|
|
@@ -59,6 +70,34 @@ export declare const DeviceLinkSchema: z.ZodObject<{
|
|
|
59
70
|
clamp: z.ZodOptional<z.ZodReadonly<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
|
|
60
71
|
}, z.core.$strip>], "kind">>;
|
|
61
72
|
}, z.core.$strip>;
|
|
73
|
+
/** Cap-wire shape of a per-cap display refinement — mirrors
|
|
74
|
+
* `DeviceCapDisplayOverride` in `device-management.ts`. */
|
|
75
|
+
export declare const DeviceCapDisplayOverrideSchema: z.ZodObject<{
|
|
76
|
+
unit: z.ZodOptional<z.ZodString>;
|
|
77
|
+
precision: z.ZodOptional<z.ZodNumber>;
|
|
78
|
+
}, z.core.$strip>;
|
|
79
|
+
/** Cap-wire shape of an operator-authored per-device display override —
|
|
80
|
+
* mirrors `DeviceDisplayOverride` in `device-management.ts`. `precision`
|
|
81
|
+
* bounds mirror `numeric-sensor.cap.ts` (`int 0-10`). */
|
|
82
|
+
export declare const DeviceDisplayOverrideSchema: z.ZodObject<{
|
|
83
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
84
|
+
label: z.ZodOptional<z.ZodString>;
|
|
85
|
+
unit: z.ZodOptional<z.ZodString>;
|
|
86
|
+
precision: z.ZodOptional<z.ZodNumber>;
|
|
87
|
+
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
88
|
+
perCap: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
89
|
+
unit: z.ZodOptional<z.ZodString>;
|
|
90
|
+
precision: z.ZodOptional<z.ZodNumber>;
|
|
91
|
+
}, z.core.$strip>>>;
|
|
92
|
+
}, z.core.$strip>;
|
|
93
|
+
/** Cap-wire shape of a per-role display default — mirrors `RoleDisplayDefault`
|
|
94
|
+
* in `device-management.ts`. Keyed by `DeviceRole` string (role strings cross
|
|
95
|
+
* the wire as plain strings everywhere else — cf. `DeviceInfoSchema.role`). */
|
|
96
|
+
export declare const RoleDisplayDefaultSchema: z.ZodObject<{
|
|
97
|
+
unit: z.ZodOptional<z.ZodString>;
|
|
98
|
+
precision: z.ZodOptional<z.ZodNumber>;
|
|
99
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
100
|
+
}, z.core.$strip>;
|
|
62
101
|
/**
|
|
63
102
|
* Serializable projection of a live IDevice.
|
|
64
103
|
* Returned by listAll, getDevice, getChildren.
|
|
@@ -110,6 +149,23 @@ export declare const DeviceInfoSchema: z.ZodObject<{
|
|
|
110
149
|
sourceStableId: z.ZodString;
|
|
111
150
|
cap: z.ZodString;
|
|
112
151
|
fieldPath: z.ZodString;
|
|
152
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
153
|
+
kind: z.ZodLiteral<"expression">;
|
|
154
|
+
expr: z.ZodString;
|
|
155
|
+
bindings: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
|
|
156
|
+
kind: z.ZodOptional<z.ZodLiteral<"field">>;
|
|
157
|
+
sourceKey: z.ZodString;
|
|
158
|
+
cap: z.ZodString;
|
|
159
|
+
fieldPath: z.ZodString;
|
|
160
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
161
|
+
kind: z.ZodLiteral<"literal">;
|
|
162
|
+
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
|
|
163
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
164
|
+
kind: z.ZodLiteral<"global">;
|
|
165
|
+
sourceStableId: z.ZodString;
|
|
166
|
+
cap: z.ZodString;
|
|
167
|
+
fieldPath: z.ZodString;
|
|
168
|
+
}, z.core.$strip>]>>;
|
|
113
169
|
}, z.core.$strip>]>;
|
|
114
170
|
target: z.ZodObject<{
|
|
115
171
|
cap: z.ZodString;
|
|
@@ -129,6 +185,17 @@ export declare const DeviceInfoSchema: z.ZodObject<{
|
|
|
129
185
|
clamp: z.ZodOptional<z.ZodReadonly<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
|
|
130
186
|
}, z.core.$strip>], "kind">>;
|
|
131
187
|
}, z.core.$strip>>>>;
|
|
188
|
+
display: z.ZodOptional<z.ZodObject<{
|
|
189
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
190
|
+
label: z.ZodOptional<z.ZodString>;
|
|
191
|
+
unit: z.ZodOptional<z.ZodString>;
|
|
192
|
+
precision: z.ZodOptional<z.ZodNumber>;
|
|
193
|
+
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
194
|
+
perCap: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
195
|
+
unit: z.ZodOptional<z.ZodString>;
|
|
196
|
+
precision: z.ZodOptional<z.ZodNumber>;
|
|
197
|
+
}, z.core.$strip>>>;
|
|
198
|
+
}, z.core.$strip>>;
|
|
132
199
|
}, z.core.$strip>;
|
|
133
200
|
export declare const ConfigEntrySchema: z.ZodObject<{
|
|
134
201
|
key: z.ZodString;
|
|
@@ -191,6 +258,23 @@ export declare const DeviceMetaSchema: z.ZodObject<{
|
|
|
191
258
|
sourceStableId: z.ZodString;
|
|
192
259
|
cap: z.ZodString;
|
|
193
260
|
fieldPath: z.ZodString;
|
|
261
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
262
|
+
kind: z.ZodLiteral<"expression">;
|
|
263
|
+
expr: z.ZodString;
|
|
264
|
+
bindings: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
|
|
265
|
+
kind: z.ZodOptional<z.ZodLiteral<"field">>;
|
|
266
|
+
sourceKey: z.ZodString;
|
|
267
|
+
cap: z.ZodString;
|
|
268
|
+
fieldPath: z.ZodString;
|
|
269
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
270
|
+
kind: z.ZodLiteral<"literal">;
|
|
271
|
+
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
|
|
272
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
273
|
+
kind: z.ZodLiteral<"global">;
|
|
274
|
+
sourceStableId: z.ZodString;
|
|
275
|
+
cap: z.ZodString;
|
|
276
|
+
fieldPath: z.ZodString;
|
|
277
|
+
}, z.core.$strip>]>>;
|
|
194
278
|
}, z.core.$strip>]>;
|
|
195
279
|
target: z.ZodObject<{
|
|
196
280
|
cap: z.ZodString;
|
|
@@ -211,6 +295,17 @@ export declare const DeviceMetaSchema: z.ZodObject<{
|
|
|
211
295
|
}, z.core.$strip>], "kind">>;
|
|
212
296
|
}, z.core.$strip>>>>;
|
|
213
297
|
role: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
298
|
+
display: z.ZodOptional<z.ZodObject<{
|
|
299
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
300
|
+
label: z.ZodOptional<z.ZodString>;
|
|
301
|
+
unit: z.ZodOptional<z.ZodString>;
|
|
302
|
+
precision: z.ZodOptional<z.ZodNumber>;
|
|
303
|
+
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
304
|
+
perCap: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
305
|
+
unit: z.ZodOptional<z.ZodString>;
|
|
306
|
+
precision: z.ZodOptional<z.ZodNumber>;
|
|
307
|
+
}, z.core.$strip>>>;
|
|
308
|
+
}, z.core.$strip>>;
|
|
214
309
|
}, z.core.$strip>;
|
|
215
310
|
export declare const DeviceRegisterPayloadSchema: z.ZodObject<{
|
|
216
311
|
addonId: z.ZodString;
|
|
@@ -325,6 +420,23 @@ export declare const deviceManagerCapability: {
|
|
|
325
420
|
sourceStableId: z.ZodString;
|
|
326
421
|
cap: z.ZodString;
|
|
327
422
|
fieldPath: z.ZodString;
|
|
423
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
424
|
+
kind: z.ZodLiteral<"expression">;
|
|
425
|
+
expr: z.ZodString;
|
|
426
|
+
bindings: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
|
|
427
|
+
kind: z.ZodOptional<z.ZodLiteral<"field">>;
|
|
428
|
+
sourceKey: z.ZodString;
|
|
429
|
+
cap: z.ZodString;
|
|
430
|
+
fieldPath: z.ZodString;
|
|
431
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
432
|
+
kind: z.ZodLiteral<"literal">;
|
|
433
|
+
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
|
|
434
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
435
|
+
kind: z.ZodLiteral<"global">;
|
|
436
|
+
sourceStableId: z.ZodString;
|
|
437
|
+
cap: z.ZodString;
|
|
438
|
+
fieldPath: z.ZodString;
|
|
439
|
+
}, z.core.$strip>]>>;
|
|
328
440
|
}, z.core.$strip>]>;
|
|
329
441
|
target: z.ZodObject<{
|
|
330
442
|
cap: z.ZodString;
|
|
@@ -345,6 +457,17 @@ export declare const deviceManagerCapability: {
|
|
|
345
457
|
}, z.core.$strip>], "kind">>;
|
|
346
458
|
}, z.core.$strip>>>>;
|
|
347
459
|
role: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
460
|
+
display: z.ZodOptional<z.ZodObject<{
|
|
461
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
462
|
+
label: z.ZodOptional<z.ZodString>;
|
|
463
|
+
unit: z.ZodOptional<z.ZodString>;
|
|
464
|
+
precision: z.ZodOptional<z.ZodNumber>;
|
|
465
|
+
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
466
|
+
perCap: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
467
|
+
unit: z.ZodOptional<z.ZodString>;
|
|
468
|
+
precision: z.ZodOptional<z.ZodNumber>;
|
|
469
|
+
}, z.core.$strip>>>;
|
|
470
|
+
}, z.core.$strip>>;
|
|
348
471
|
}, z.core.$strip>>, import("./capability-definition.js").CapabilityMethodKind>;
|
|
349
472
|
/** Update the operator-edited display name. Persists to the meta
|
|
350
473
|
* row + emits `EventCategory.DeviceMetaChanged`. */
|
|
@@ -425,6 +548,23 @@ export declare const deviceManagerCapability: {
|
|
|
425
548
|
sourceStableId: z.ZodString;
|
|
426
549
|
cap: z.ZodString;
|
|
427
550
|
fieldPath: z.ZodString;
|
|
551
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
552
|
+
kind: z.ZodLiteral<"expression">;
|
|
553
|
+
expr: z.ZodString;
|
|
554
|
+
bindings: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
|
|
555
|
+
kind: z.ZodOptional<z.ZodLiteral<"field">>;
|
|
556
|
+
sourceKey: z.ZodString;
|
|
557
|
+
cap: z.ZodString;
|
|
558
|
+
fieldPath: z.ZodString;
|
|
559
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
560
|
+
kind: z.ZodLiteral<"literal">;
|
|
561
|
+
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
|
|
562
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
563
|
+
kind: z.ZodLiteral<"global">;
|
|
564
|
+
sourceStableId: z.ZodString;
|
|
565
|
+
cap: z.ZodString;
|
|
566
|
+
fieldPath: z.ZodString;
|
|
567
|
+
}, z.core.$strip>]>>;
|
|
428
568
|
}, z.core.$strip>]>;
|
|
429
569
|
target: z.ZodObject<{
|
|
430
570
|
cap: z.ZodString;
|
|
@@ -445,6 +585,45 @@ export declare const deviceManagerCapability: {
|
|
|
445
585
|
}, z.core.$strip>], "kind">>;
|
|
446
586
|
}, z.core.$strip>>>;
|
|
447
587
|
}, z.core.$strip>, z.ZodVoid, "mutation">;
|
|
588
|
+
/** Set (or clear) the per-device display override on the meta row. Mirrors
|
|
589
|
+
* `setChildLayout` persistence; `null` clears the override entirely. The
|
|
590
|
+
* override unit(s) are normalized (`normalizeUnit`) at write so the render
|
|
591
|
+
* path's `UNIT_TABLE` lookups always hit canonical spellings. Persisted,
|
|
592
|
+
* projected, and preserved across re-register/restore. Idempotent. */
|
|
593
|
+
readonly setDisplay: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
|
|
594
|
+
deviceId: z.ZodNumber;
|
|
595
|
+
display: z.ZodNullable<z.ZodObject<{
|
|
596
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
597
|
+
label: z.ZodOptional<z.ZodString>;
|
|
598
|
+
unit: z.ZodOptional<z.ZodString>;
|
|
599
|
+
precision: z.ZodOptional<z.ZodNumber>;
|
|
600
|
+
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
601
|
+
perCap: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
602
|
+
unit: z.ZodOptional<z.ZodString>;
|
|
603
|
+
precision: z.ZodOptional<z.ZodNumber>;
|
|
604
|
+
}, z.core.$strip>>>;
|
|
605
|
+
}, z.core.$strip>>;
|
|
606
|
+
}, z.core.$strip>, z.ZodVoid, "mutation">;
|
|
607
|
+
/** Read the operator-authored per-role display defaults (unit/precision/
|
|
608
|
+
* icon), keyed by `DeviceRole` string. Empty record when none set. */
|
|
609
|
+
readonly getRoleDisplayDefaults: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
|
|
610
|
+
defaults: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
611
|
+
unit: z.ZodOptional<z.ZodString>;
|
|
612
|
+
precision: z.ZodOptional<z.ZodNumber>;
|
|
613
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
614
|
+
}, z.core.$strip>>;
|
|
615
|
+
}, z.core.$strip>, "query">;
|
|
616
|
+
/** Replace the per-role display defaults whole-record (full replace — the
|
|
617
|
+
* caller sends the complete map). Override unit(s) are normalized at write.
|
|
618
|
+
* Not per-device, so nothing is emitted; the UI invalidates its own query
|
|
619
|
+
* on mutate. */
|
|
620
|
+
readonly setRoleDisplayDefaults: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
|
|
621
|
+
defaults: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
622
|
+
unit: z.ZodOptional<z.ZodString>;
|
|
623
|
+
precision: z.ZodOptional<z.ZodNumber>;
|
|
624
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
625
|
+
}, z.core.$strip>>;
|
|
626
|
+
}, z.core.$strip>, z.ZodVoid, "mutation">;
|
|
448
627
|
/** List the wireable status-schema fields per cap bound to a device.
|
|
449
628
|
* Powers the Wiring tab's field pickers. Caps without a status schema are
|
|
450
629
|
* omitted. Item-array caps (`status.itemArray`, e.g. consumables) also
|
|
@@ -603,6 +782,23 @@ export declare const deviceManagerCapability: {
|
|
|
603
782
|
sourceStableId: z.ZodString;
|
|
604
783
|
cap: z.ZodString;
|
|
605
784
|
fieldPath: z.ZodString;
|
|
785
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
786
|
+
kind: z.ZodLiteral<"expression">;
|
|
787
|
+
expr: z.ZodString;
|
|
788
|
+
bindings: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
|
|
789
|
+
kind: z.ZodOptional<z.ZodLiteral<"field">>;
|
|
790
|
+
sourceKey: z.ZodString;
|
|
791
|
+
cap: z.ZodString;
|
|
792
|
+
fieldPath: z.ZodString;
|
|
793
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
794
|
+
kind: z.ZodLiteral<"literal">;
|
|
795
|
+
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
|
|
796
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
797
|
+
kind: z.ZodLiteral<"global">;
|
|
798
|
+
sourceStableId: z.ZodString;
|
|
799
|
+
cap: z.ZodString;
|
|
800
|
+
fieldPath: z.ZodString;
|
|
801
|
+
}, z.core.$strip>]>>;
|
|
606
802
|
}, z.core.$strip>]>;
|
|
607
803
|
target: z.ZodObject<{
|
|
608
804
|
cap: z.ZodString;
|
|
@@ -622,6 +818,17 @@ export declare const deviceManagerCapability: {
|
|
|
622
818
|
clamp: z.ZodOptional<z.ZodReadonly<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
|
|
623
819
|
}, z.core.$strip>], "kind">>;
|
|
624
820
|
}, z.core.$strip>>>>;
|
|
821
|
+
display: z.ZodOptional<z.ZodObject<{
|
|
822
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
823
|
+
label: z.ZodOptional<z.ZodString>;
|
|
824
|
+
unit: z.ZodOptional<z.ZodString>;
|
|
825
|
+
precision: z.ZodOptional<z.ZodNumber>;
|
|
826
|
+
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
827
|
+
perCap: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
828
|
+
unit: z.ZodOptional<z.ZodString>;
|
|
829
|
+
precision: z.ZodOptional<z.ZodNumber>;
|
|
830
|
+
}, z.core.$strip>>>;
|
|
831
|
+
}, z.core.$strip>>;
|
|
625
832
|
}, z.core.$strip>>, import("./capability-definition.js").CapabilityMethodKind>;
|
|
626
833
|
/** Get a single device by numeric deviceId. */
|
|
627
834
|
readonly getDevice: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
|
|
@@ -672,6 +879,23 @@ export declare const deviceManagerCapability: {
|
|
|
672
879
|
sourceStableId: z.ZodString;
|
|
673
880
|
cap: z.ZodString;
|
|
674
881
|
fieldPath: z.ZodString;
|
|
882
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
883
|
+
kind: z.ZodLiteral<"expression">;
|
|
884
|
+
expr: z.ZodString;
|
|
885
|
+
bindings: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
|
|
886
|
+
kind: z.ZodOptional<z.ZodLiteral<"field">>;
|
|
887
|
+
sourceKey: z.ZodString;
|
|
888
|
+
cap: z.ZodString;
|
|
889
|
+
fieldPath: z.ZodString;
|
|
890
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
891
|
+
kind: z.ZodLiteral<"literal">;
|
|
892
|
+
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
|
|
893
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
894
|
+
kind: z.ZodLiteral<"global">;
|
|
895
|
+
sourceStableId: z.ZodString;
|
|
896
|
+
cap: z.ZodString;
|
|
897
|
+
fieldPath: z.ZodString;
|
|
898
|
+
}, z.core.$strip>]>>;
|
|
675
899
|
}, z.core.$strip>]>;
|
|
676
900
|
target: z.ZodObject<{
|
|
677
901
|
cap: z.ZodString;
|
|
@@ -691,6 +915,17 @@ export declare const deviceManagerCapability: {
|
|
|
691
915
|
clamp: z.ZodOptional<z.ZodReadonly<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
|
|
692
916
|
}, z.core.$strip>], "kind">>;
|
|
693
917
|
}, z.core.$strip>>>>;
|
|
918
|
+
display: z.ZodOptional<z.ZodObject<{
|
|
919
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
920
|
+
label: z.ZodOptional<z.ZodString>;
|
|
921
|
+
unit: z.ZodOptional<z.ZodString>;
|
|
922
|
+
precision: z.ZodOptional<z.ZodNumber>;
|
|
923
|
+
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
924
|
+
perCap: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
925
|
+
unit: z.ZodOptional<z.ZodString>;
|
|
926
|
+
precision: z.ZodOptional<z.ZodNumber>;
|
|
927
|
+
}, z.core.$strip>>>;
|
|
928
|
+
}, z.core.$strip>>;
|
|
694
929
|
}, z.core.$strip>>, import("./capability-definition.js").CapabilityMethodKind>;
|
|
695
930
|
/** List children of a parent device (by parent numeric id). */
|
|
696
931
|
readonly getChildren: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
|
|
@@ -741,6 +976,23 @@ export declare const deviceManagerCapability: {
|
|
|
741
976
|
sourceStableId: z.ZodString;
|
|
742
977
|
cap: z.ZodString;
|
|
743
978
|
fieldPath: z.ZodString;
|
|
979
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
980
|
+
kind: z.ZodLiteral<"expression">;
|
|
981
|
+
expr: z.ZodString;
|
|
982
|
+
bindings: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
|
|
983
|
+
kind: z.ZodOptional<z.ZodLiteral<"field">>;
|
|
984
|
+
sourceKey: z.ZodString;
|
|
985
|
+
cap: z.ZodString;
|
|
986
|
+
fieldPath: z.ZodString;
|
|
987
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
988
|
+
kind: z.ZodLiteral<"literal">;
|
|
989
|
+
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
|
|
990
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
991
|
+
kind: z.ZodLiteral<"global">;
|
|
992
|
+
sourceStableId: z.ZodString;
|
|
993
|
+
cap: z.ZodString;
|
|
994
|
+
fieldPath: z.ZodString;
|
|
995
|
+
}, z.core.$strip>]>>;
|
|
744
996
|
}, z.core.$strip>]>;
|
|
745
997
|
target: z.ZodObject<{
|
|
746
998
|
cap: z.ZodString;
|
|
@@ -760,6 +1012,17 @@ export declare const deviceManagerCapability: {
|
|
|
760
1012
|
clamp: z.ZodOptional<z.ZodReadonly<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
|
|
761
1013
|
}, z.core.$strip>], "kind">>;
|
|
762
1014
|
}, z.core.$strip>>>>;
|
|
1015
|
+
display: z.ZodOptional<z.ZodObject<{
|
|
1016
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
1017
|
+
label: z.ZodOptional<z.ZodString>;
|
|
1018
|
+
unit: z.ZodOptional<z.ZodString>;
|
|
1019
|
+
precision: z.ZodOptional<z.ZodNumber>;
|
|
1020
|
+
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
1021
|
+
perCap: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
1022
|
+
unit: z.ZodOptional<z.ZodString>;
|
|
1023
|
+
precision: z.ZodOptional<z.ZodNumber>;
|
|
1024
|
+
}, z.core.$strip>>>;
|
|
1025
|
+
}, z.core.$strip>>;
|
|
763
1026
|
}, z.core.$strip>>, import("./capability-definition.js").CapabilityMethodKind>;
|
|
764
1027
|
/** Get stream sources for a camera device. */
|
|
765
1028
|
readonly getStreamSources: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
|
|
@@ -459,7 +459,10 @@ export declare const pipelineOrchestratorCapability: {
|
|
|
459
459
|
readonly methods: {
|
|
460
460
|
/**
|
|
461
461
|
* Pin a camera's pipeline to a specific agent (L1 affinity).
|
|
462
|
-
* The orchestrator re-evaluates the assignment immediately
|
|
462
|
+
* The orchestrator re-evaluates the assignment immediately and persists
|
|
463
|
+
* the pin under the canonical `pipelineNodeId` device-store key (the
|
|
464
|
+
* legacy `preferredAgent` key is nulled on write and kept only as a
|
|
465
|
+
* read-only fallback for stores written before the unification).
|
|
463
466
|
*/
|
|
464
467
|
readonly assignPipeline: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
|
|
465
468
|
deviceId: z.ZodNumber;
|
|
@@ -469,8 +472,9 @@ export declare const pipelineOrchestratorCapability: {
|
|
|
469
472
|
}, z.core.$strip>, "mutation">;
|
|
470
473
|
/**
|
|
471
474
|
* Clear a camera's pipeline pin and let the auto-balancer re-pick
|
|
472
|
-
* the optimal agent. The orchestrator persists
|
|
473
|
-
*
|
|
475
|
+
* the optimal agent. The orchestrator persists the canonical
|
|
476
|
+
* `pipelineNodeId='auto'` (and nulls the legacy `preferredAgent`),
|
|
477
|
+
* then re-runs the balancer with the
|
|
474
478
|
* cached `RunnerCameraConfig` and migrates only when the chosen
|
|
475
479
|
* node differs. The camera stays in `getPipelineAssignments()` —
|
|
476
480
|
* just with `pinned=false`. If no runner is currently available
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { z } from 'zod';
|
|
2
|
-
import type { DeviceType } from './device-type.js';
|
|
3
2
|
import type { IDevice } from './device.js';
|
|
3
|
+
import type { DeviceType } from './device-type.js';
|
|
4
4
|
import type { SourceInfo } from './source-info.js';
|
|
5
5
|
export interface DeviceManualCreation {
|
|
6
6
|
getChildCreationSchema(type: DeviceType): z.ZodObject<z.core.$ZodLooseShape>;
|
|
@@ -127,7 +127,22 @@ export interface DeviceLinkGlobalSource {
|
|
|
127
127
|
readonly cap: string;
|
|
128
128
|
readonly fieldPath: string;
|
|
129
129
|
}
|
|
130
|
-
|
|
130
|
+
/** The source kinds a single expression BINDING may use — a sibling FIELD, a
|
|
131
|
+
* per-device LITERAL, or a GLOBAL device field. Never another expression:
|
|
132
|
+
* bindings do not nest, so an expression cannot reference another expression. */
|
|
133
|
+
export type DeviceLinkExpressionBinding = DeviceLinkFieldSource | DeviceLinkLiteralSource | DeviceLinkGlobalSource;
|
|
134
|
+
/** Expression source (Stage X): compute the target field from N named source
|
|
135
|
+
* bindings via a safe, non-Turing-complete infix expression (see
|
|
136
|
+
* `packages/types/src/expression/`). Each binding resolves to an
|
|
137
|
+
* `ExpressionValue` and is exposed to the expression under its record key.
|
|
138
|
+
* `now` (epoch ms) is auto-injected and is a reserved binding name. The
|
|
139
|
+
* evaluated result flows through `transform` exactly like a scalar source. */
|
|
140
|
+
export interface DeviceLinkExpressionSource {
|
|
141
|
+
readonly kind: 'expression';
|
|
142
|
+
readonly expr: string;
|
|
143
|
+
readonly bindings: Readonly<Record<string, DeviceLinkExpressionBinding>>;
|
|
144
|
+
}
|
|
145
|
+
export type DeviceLinkSource = DeviceLinkFieldSource | DeviceLinkLiteralSource | DeviceLinkGlobalSource | DeviceLinkExpressionSource;
|
|
131
146
|
/** The target field a link writes: a dot-path into the target cap's status. */
|
|
132
147
|
export interface DeviceLinkTarget {
|
|
133
148
|
readonly cap: string;
|
|
@@ -156,6 +171,42 @@ export interface DeviceLink {
|
|
|
156
171
|
readonly transform?: DeviceLinkTransform;
|
|
157
172
|
}
|
|
158
173
|
export type DeviceLinks = readonly DeviceLink[];
|
|
174
|
+
/** Per-cap display refinement inside a `DeviceDisplayOverride` — unit/precision
|
|
175
|
+
* only (icon/label/hidden are device-level). Keyed by cap name for devices
|
|
176
|
+
* carrying several numeric caps (e.g. power-meter). */
|
|
177
|
+
export interface DeviceCapDisplayOverride {
|
|
178
|
+
readonly unit?: string;
|
|
179
|
+
readonly precision?: number;
|
|
180
|
+
}
|
|
181
|
+
/** Operator-authored per-device display override. Rides the `DeviceMeta`
|
|
182
|
+
* lifecycle (persist/preserve/project/pre-seed) — deliberately NOT a new
|
|
183
|
+
* cap/store. All fields optional; an empty object is equivalent to absent.
|
|
184
|
+
* `unit` triggers render-time conversion when same-dimension as the live
|
|
185
|
+
* slice unit (storage stays in source units); `precision` applies AFTER
|
|
186
|
+
* conversion; `hidden` removes the device from list surfaces (distinct from
|
|
187
|
+
* the HA-only accessories-cap `hiddenChildIds` mechanism). */
|
|
188
|
+
export interface DeviceDisplayOverride {
|
|
189
|
+
/** Key into ui-library's display icon registry. */
|
|
190
|
+
readonly icon?: string;
|
|
191
|
+
/** Overrides the `DEVICE_ROLE_META` label (NOT the device name). */
|
|
192
|
+
readonly label?: string;
|
|
193
|
+
/** Canonical spelling (`normalizeUnit` applied at write). */
|
|
194
|
+
readonly unit?: string;
|
|
195
|
+
/** Int 0-10, same contract as the slice `precision` field. */
|
|
196
|
+
readonly precision?: number;
|
|
197
|
+
readonly hidden?: boolean;
|
|
198
|
+
readonly perCap?: Readonly<Record<string, DeviceCapDisplayOverride>>;
|
|
199
|
+
}
|
|
200
|
+
/** Operator-authored per-role display default (unit/precision/icon), keyed by
|
|
201
|
+
* `DeviceRole` string. Resolution merges these UNDER any per-device
|
|
202
|
+
* `DeviceDisplayOverride`. Stored whole-record (full replace) in the
|
|
203
|
+
* device-manager addon store's `roleDisplayDefaults` key — NOT on any device's
|
|
204
|
+
* meta row. */
|
|
205
|
+
export interface RoleDisplayDefault {
|
|
206
|
+
readonly unit?: string;
|
|
207
|
+
readonly precision?: number;
|
|
208
|
+
readonly icon?: string;
|
|
209
|
+
}
|
|
159
210
|
export interface DeviceMeta {
|
|
160
211
|
readonly id: number;
|
|
161
212
|
readonly stableId: string;
|
|
@@ -207,6 +258,12 @@ export interface DeviceMeta {
|
|
|
207
258
|
* cap field). Same create/persist/project/restore lifecycle as `childLayout`.
|
|
208
259
|
* Absent ⇒ no links. Overlaid onto the target cap's `getStatus` at read time. */
|
|
209
260
|
readonly deviceLinks?: DeviceLinks;
|
|
261
|
+
/** Operator-authored per-device display override (icon/label/unit/precision/
|
|
262
|
+
* hidden). Same create/persist/project/restore lifecycle as `deviceLinks`.
|
|
263
|
+
* Absent ⇒ no override; the renderer falls back to role default → live slice
|
|
264
|
+
* → canonical unit. Applied at RENDER time only — storage stays in source
|
|
265
|
+
* units. */
|
|
266
|
+
readonly display?: DeviceDisplayOverride;
|
|
210
267
|
}
|
|
211
268
|
/**
|
|
212
269
|
* Initial meta a provider supplies on `onCreateDevice`. Differs
|
|
@@ -237,6 +294,8 @@ export interface InitialDeviceMeta {
|
|
|
237
294
|
readonly childLayout?: ChildLayout;
|
|
238
295
|
/** Cross-device field wirings set at create. Mirrors `DeviceMeta.deviceLinks`. */
|
|
239
296
|
readonly deviceLinks?: DeviceLinks;
|
|
297
|
+
/** Per-device display override set at create. Mirrors `DeviceMeta.display`. */
|
|
298
|
+
readonly display?: DeviceDisplayOverride;
|
|
240
299
|
}
|
|
241
300
|
/**
|
|
242
301
|
* Single-call payload returned by `BaseDeviceProvider.onCreateDevice`.
|
package/dist/device/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export type { IDevice } from './device.js';
|
|
|
11
11
|
export { DEVICE_PROFILES, BATTERY_DEVICE_PROFILE, deviceMatchesProfile, resolveDeviceProfile, } from './device-profile.js';
|
|
12
12
|
export type { DeviceProfile, DeviceProfileMatch, DeviceProfileDefaults, PipelinePhaseMode, } from './device-profile.js';
|
|
13
13
|
export type { ICameraDevice, StreamSourceEntry } from './camera-device.js';
|
|
14
|
-
export type { DeviceManualCreation, DeviceDiscovery, DiscoveredDevice, SavedDevice, DeviceMeta, InitialDeviceMeta, CreateDeviceSpec, ChildLayout, ChildLayoutEntry, DeviceLinkFieldSource, DeviceLinkLiteralSource, DeviceLinkGlobalSource, DeviceLinkSource, DeviceLinkTarget, DeviceLinkTransform, DeviceLink, DeviceLinks, } from './device-management.js';
|
|
14
|
+
export type { DeviceManualCreation, DeviceDiscovery, DiscoveredDevice, SavedDevice, DeviceMeta, InitialDeviceMeta, CreateDeviceSpec, ChildLayout, ChildLayoutEntry, DeviceLinkFieldSource, DeviceLinkLiteralSource, DeviceLinkGlobalSource, DeviceLinkExpressionBinding, DeviceLinkExpressionSource, DeviceLinkSource, DeviceLinkTarget, DeviceLinkTransform, DeviceLink, DeviceLinks, } from './device-management.js';
|
|
15
15
|
export { zodEntriesToConfigUI } from './zod-to-config-ui.js';
|
|
16
16
|
export type { DeviceConfigEntry } from './zod-to-config-ui.js';
|
|
17
17
|
export { createRuntimeStateBridge } from './runtime-state-helpers.js';
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AST for the safe expression mini-language.
|
|
3
|
+
*
|
|
4
|
+
* SECURITY BY CONSTRUCTION (spec §4 rule 3): there is deliberately NO member
|
|
5
|
+
* node, NO index node, NO assignment node and NO lambda/function node in this
|
|
6
|
+
* union. `a.b`, `a["b"]`, `a = b` and `() => …` are therefore UNREPRESENTABLE —
|
|
7
|
+
* `__proto__` / `constructor` / `prototype` traversal is impossible at the type
|
|
8
|
+
* level, not by a runtime denylist. `ExpressionCallNode.callee` is a plain
|
|
9
|
+
* string (a builtin name), never a node, so a computed call like `(min)(1)` is
|
|
10
|
+
* unparseable.
|
|
11
|
+
*
|
|
12
|
+
* The value domain is the four JSON primitives — no objects, arrays or
|
|
13
|
+
* functions ever flow through the evaluator.
|
|
14
|
+
*/
|
|
15
|
+
/** The only value types the engine produces or consumes. */
|
|
16
|
+
export type ExpressionValue = number | string | boolean | null;
|
|
17
|
+
export type ExpressionBinaryOperator = '+' | '-' | '*' | '/' | '%' | '==' | '!=' | '<' | '<=' | '>' | '>=';
|
|
18
|
+
export type ExpressionLogicalOperator = '&&' | '||';
|
|
19
|
+
export type ExpressionUnaryOperator = '-' | '!';
|
|
20
|
+
export interface ExpressionLiteralNode {
|
|
21
|
+
readonly kind: 'literal';
|
|
22
|
+
readonly value: ExpressionValue;
|
|
23
|
+
}
|
|
24
|
+
export interface ExpressionIdentifierNode {
|
|
25
|
+
readonly kind: 'identifier';
|
|
26
|
+
readonly name: string;
|
|
27
|
+
}
|
|
28
|
+
export interface ExpressionUnaryNode {
|
|
29
|
+
readonly kind: 'unary';
|
|
30
|
+
readonly op: ExpressionUnaryOperator;
|
|
31
|
+
readonly operand: ExpressionNode;
|
|
32
|
+
}
|
|
33
|
+
export interface ExpressionBinaryNode {
|
|
34
|
+
readonly kind: 'binary';
|
|
35
|
+
readonly op: ExpressionBinaryOperator;
|
|
36
|
+
readonly left: ExpressionNode;
|
|
37
|
+
readonly right: ExpressionNode;
|
|
38
|
+
}
|
|
39
|
+
export interface ExpressionLogicalNode {
|
|
40
|
+
readonly kind: 'logical';
|
|
41
|
+
readonly op: ExpressionLogicalOperator;
|
|
42
|
+
readonly left: ExpressionNode;
|
|
43
|
+
readonly right: ExpressionNode;
|
|
44
|
+
}
|
|
45
|
+
export interface ExpressionConditionalNode {
|
|
46
|
+
readonly kind: 'conditional';
|
|
47
|
+
readonly test: ExpressionNode;
|
|
48
|
+
readonly consequent: ExpressionNode;
|
|
49
|
+
readonly alternate: ExpressionNode;
|
|
50
|
+
}
|
|
51
|
+
export interface ExpressionCallNode {
|
|
52
|
+
readonly kind: 'call';
|
|
53
|
+
readonly callee: string;
|
|
54
|
+
readonly args: readonly ExpressionNode[];
|
|
55
|
+
}
|
|
56
|
+
export type ExpressionNode = ExpressionLiteralNode | ExpressionIdentifierNode | ExpressionUnaryNode | ExpressionBinaryNode | ExpressionLogicalNode | ExpressionConditionalNode | ExpressionCallNode;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ExpressionValue } from './ast.js';
|
|
2
|
+
/** Optional runtime hooks the evaluator threads through to builtins. Stage U
|
|
3
|
+
* installs the real unit-conversion table here; absent → the `convert` stub. */
|
|
4
|
+
export interface ExpressionEvalHooks {
|
|
5
|
+
/** Convert `value` from unit `from` to unit `to`; `null` when the pair is
|
|
6
|
+
* not convertible. Absent hook → `convert` uses its identity-only stub. */
|
|
7
|
+
readonly convert?: (value: number, from: string, to: string) => number | null;
|
|
8
|
+
}
|
|
9
|
+
export interface ExpressionBuiltin {
|
|
10
|
+
readonly minArgs: number;
|
|
11
|
+
/** `Number.POSITIVE_INFINITY` for variadic builtins. */
|
|
12
|
+
readonly maxArgs: number;
|
|
13
|
+
readonly apply: (args: readonly ExpressionValue[], hooks: ExpressionEvalHooks) => ExpressionValue;
|
|
14
|
+
}
|
|
15
|
+
/** Frozen, null-prototype builtin table. */
|
|
16
|
+
export declare const EXPRESSION_BUILTINS: Readonly<Record<string, ExpressionBuiltin>>;
|
|
17
|
+
/** The set of valid builtin names — used by the parser to reject unknown
|
|
18
|
+
* callees at parse time (immediate author feedback). */
|
|
19
|
+
export declare const EXPRESSION_BUILTIN_NAMES: ReadonlySet<string>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type ParsedExpression } from './parser.js';
|
|
2
|
+
export type CompileResult = {
|
|
3
|
+
readonly ok: true;
|
|
4
|
+
readonly parsed: ParsedExpression;
|
|
5
|
+
} | {
|
|
6
|
+
readonly ok: false;
|
|
7
|
+
readonly error: string;
|
|
8
|
+
};
|
|
9
|
+
/** Compile `source` to a `ParsedExpression`, throwing `ExpressionParseError`
|
|
10
|
+
* on failure. LRU/negative-cached. */
|
|
11
|
+
export declare function compileExpression(source: string): ParsedExpression;
|
|
12
|
+
/** Compile `source`, returning a discriminated result instead of throwing.
|
|
13
|
+
* Used by read paths that must degrade rather than raise. LRU/negative-cached. */
|
|
14
|
+
export declare function compileExpressionSafe(source: string): CompileResult;
|
|
15
|
+
/** Test-only: clear the module-level cache. Not part of the public engine
|
|
16
|
+
* surface — used to make cache-behaviour assertions deterministic. */
|
|
17
|
+
export declare function __clearExpressionCompileCache(): void;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error types for the safe expression engine. Two distinct classes so callers
|
|
3
|
+
* can tell a compile-time (grammar) failure from a runtime (evaluation)
|
|
4
|
+
* failure — both are non-fatal to the host: read paths degrade to "skip link".
|
|
5
|
+
*/
|
|
6
|
+
/** Thrown by the tokenizer / parser. Carries a 0-based source `position` when
|
|
7
|
+
* the failure is anchored to a character (author-facing inline feedback). */
|
|
8
|
+
export declare class ExpressionParseError extends Error {
|
|
9
|
+
readonly position?: number;
|
|
10
|
+
constructor(message: string, position?: number);
|
|
11
|
+
}
|
|
12
|
+
/** Thrown by the evaluator (unknown identifier, type mismatch, non-finite
|
|
13
|
+
* result, unknown builtin, step-budget exceeded). */
|
|
14
|
+
export declare class ExpressionEvalError extends Error {
|
|
15
|
+
constructor(message: string);
|
|
16
|
+
}
|