@camstack/types 1.2.401 → 1.2.403

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 (44) hide show
  1. package/dist/addon.js +1 -1
  2. package/dist/addon.mjs +1 -1
  3. package/dist/auth/credential-scope.d.ts +23 -3
  4. package/dist/auth/viewer-access.d.ts +112 -0
  5. package/dist/capabilities/capability-definition.d.ts +14 -0
  6. package/dist/capabilities/face-gallery.cap.d.ts +3 -0
  7. package/dist/capabilities/index.d.ts +2 -2
  8. package/dist/capabilities/pipeline-analytics.cap.d.ts +79 -0
  9. package/dist/capabilities/pipeline-orchestrator.cap.d.ts +28 -0
  10. package/dist/capabilities/plate-gallery.cap.d.ts +3 -0
  11. package/dist/capabilities/platform-probe.cap.d.ts +74 -0
  12. package/dist/capabilities/scene-monitor.cap.d.ts +3 -0
  13. package/dist/capabilities/user-management.cap.d.ts +108 -18
  14. package/dist/client.js +15 -0
  15. package/dist/client.mjs +15 -0
  16. package/dist/clips/clip-event-labels.d.ts +96 -0
  17. package/dist/device/cap-vocabulary/entries/actuators.d.ts +5 -0
  18. package/dist/device/cap-vocabulary/entries/appliances.d.ts +5 -0
  19. package/dist/device/cap-vocabulary/entries/camera.d.ts +5 -0
  20. package/dist/device/cap-vocabulary/entries/sensors.d.ts +5 -0
  21. package/dist/device/cap-vocabulary/entries/system.d.ts +8 -0
  22. package/dist/device/cap-vocabulary/index.d.ts +9 -0
  23. package/dist/device/cap-vocabulary/l10n.d.ts +7 -0
  24. package/dist/device/cap-vocabulary/resolve.d.ts +100 -0
  25. package/dist/device/cap-vocabulary/templates.d.ts +11 -0
  26. package/dist/device/cap-vocabulary/types.d.ts +398 -0
  27. package/dist/device/cap-vocabulary/vocabulary.d.ts +5 -0
  28. package/dist/device/device-do-actions.d.ts +8 -2
  29. package/dist/generated/addon-api.d.ts +52 -0
  30. package/dist/generated/method-access-map.d.ts +4 -1
  31. package/dist/generated/system-proxy.d.ts +1 -1
  32. package/dist/index.d.ts +6 -2
  33. package/dist/index.js +7384 -1893
  34. package/dist/index.mjs +7355 -1894
  35. package/dist/interfaces/api-responses.d.ts +1 -1
  36. package/dist/interfaces/auth.d.ts +2 -2
  37. package/dist/interfaces/birth-decision-ledger.d.ts +17 -0
  38. package/dist/pipeline/load-balancing/effective-shares.d.ts +6 -0
  39. package/dist/schemas/auth-records.d.ts +77 -13
  40. package/dist/schemas/device-selector.d.ts +23 -4
  41. package/dist/{sleep-CUp20JkO.mjs → sleep-6AqUnQIT.mjs} +1 -0
  42. package/dist/{sleep-DVovpDRU.js → sleep-Ch67uumJ.js} +1 -0
  43. package/dist/types/detection.d.ts +9 -0
  44. package/package.json +1 -1
@@ -0,0 +1,398 @@
1
+ /**
2
+ * The SHAPE of the cap vocabulary (D920): what an operator can make a device
3
+ * DO, and what a device can be WATCHED for, phrased for humans — keyed by
4
+ * capability name, typed against the capability definitions themselves.
5
+ *
6
+ * Every key type here is DERIVED from the cap registry
7
+ * (`generated/capability-router-map.ts`, imported as a TYPE only — no runtime
8
+ * cost, no Zod graph in a browser bundle): a method, status field or event
9
+ * name that does not exist on the cap is a TypeScript error, and so is a
10
+ * missing cap. `scripts/check-cap-vocabulary.ts` checks what a type cannot:
11
+ * that every operate method is phrased or excused, that offered values agree
12
+ * with the method's Zod input, that every placeholder has an arg, and that
13
+ * every label carries both languages.
14
+ *
15
+ * Translations live INLINE (`{ en, it }`) next to the entry they translate —
16
+ * one source, so a new action cannot ship in one language.
17
+ */
18
+ import type { z } from 'zod';
19
+ import type * as CapRegistry from '../../generated/capability-router-map.js';
20
+ import type { EventCategory } from '../../enums/event-category.js';
21
+ import type { ICON_KEYS } from '../icon-catalog.generated.js';
22
+ import type { DeviceRole, DeviceType } from '../device-type.js';
23
+ /** One catalog icon key (lucide id) — the same vocabulary as `IconKey`. */
24
+ export type VocabIcon = (typeof ICON_KEYS)[number];
25
+ /** A human string in every language the map carries. */
26
+ export interface L10n {
27
+ readonly en: string;
28
+ readonly it: string;
29
+ }
30
+ /** A language the vocabulary is written in. */
31
+ export type VocabLocale = keyof L10n;
32
+ type CapRegistryModule = typeof CapRegistry;
33
+ /** The minimal structural shape that tells a cap definition export apart. */
34
+ interface CapDefinitionLike {
35
+ readonly name: string;
36
+ readonly scope: 'system' | 'device';
37
+ readonly methods: object;
38
+ }
39
+ /** Cap name → its definition TYPE, for every cap the registry exports. */
40
+ export type CapDefinitionsByName = {
41
+ readonly [K in keyof CapRegistryModule as CapRegistryModule[K] extends CapDefinitionLike ? CapRegistryModule[K]['name'] : never]: CapRegistryModule[K];
42
+ };
43
+ /** Every capability name. */
44
+ export type VocabCapName = keyof CapDefinitionsByName & string;
45
+ type CapDef<C extends VocabCapName> = CapDefinitionsByName[C];
46
+ /** Device-scoped cap names (the ones a device's vocabulary is made of). */
47
+ export type DeviceVocabCapName = {
48
+ [C in VocabCapName]: CapDef<C>['scope'] extends 'device' ? C : never;
49
+ }[VocabCapName];
50
+ /** System-scoped cap names (never part of a device's vocabulary). */
51
+ export type SystemVocabCapName = Exclude<VocabCapName, DeviceVocabCapName>;
52
+ /** A method name declared by cap `C`. */
53
+ export type CapMethodName<C extends VocabCapName> = keyof CapDef<C>['methods'] & string;
54
+ type MethodSchemaOf<C extends VocabCapName, M extends CapMethodName<C>> = CapDef<C>['methods'][M];
55
+ type MethodInputOf<C extends VocabCapName, M extends CapMethodName<C>> = MethodSchemaOf<C, M> extends {
56
+ readonly input: infer I extends z.ZodType;
57
+ } ? z.input<I> : never;
58
+ /** The operator-supplied part of a method input (`deviceId` is the target). */
59
+ export type ActionArgs<C extends VocabCapName, M extends CapMethodName<C>> = MethodInputOf<C, M> extends object ? Omit<MethodInputOf<C, M>, 'deviceId'> : Record<never, never>;
60
+ /** A key of {@link ActionArgs}. */
61
+ export type ActionArgKey<C extends VocabCapName, M extends CapMethodName<C>> = keyof ActionArgs<C, M> & string;
62
+ type StatusOf<C extends VocabCapName> = CapDef<C> extends {
63
+ readonly status: {
64
+ readonly schema: infer S extends z.ZodType;
65
+ };
66
+ } ? z.output<S> : CapDef<C> extends {
67
+ readonly runtimeState: infer R extends z.ZodType;
68
+ } ? z.output<R> : never;
69
+ /** A top-level status field of cap `C`. */
70
+ export type CapStatusField<C extends VocabCapName> = [StatusOf<C>] extends [never] ? never : keyof StatusOf<C> & string;
71
+ /** An event name declared by cap `C`. */
72
+ export type CapEventName<C extends VocabCapName> = CapDef<C> extends {
73
+ readonly events: infer E;
74
+ } ? keyof E & string : never;
75
+ /** One choice of a closed set, with its label. */
76
+ export interface VocabChoice {
77
+ readonly value: string | number;
78
+ readonly label: L10n;
79
+ }
80
+ /** A closed set — every value MUST be one the method's Zod input accepts. */
81
+ export interface EnumOffer {
82
+ readonly kind: 'enum';
83
+ readonly values: readonly VocabChoice[];
84
+ }
85
+ /** A number, within the Zod input's bounds. `unit` is a display suffix. */
86
+ export interface NumberOffer {
87
+ readonly kind: 'number';
88
+ readonly min?: number;
89
+ readonly max?: number;
90
+ readonly step?: number;
91
+ readonly unit?: string;
92
+ }
93
+ /** Free text. */
94
+ export interface TextOffer {
95
+ readonly kind: 'text';
96
+ /** True for a secret the UI should mask (a PIN code). */
97
+ readonly secret?: boolean;
98
+ }
99
+ /** A yes/no. */
100
+ export interface BooleanOffer {
101
+ readonly kind: 'boolean';
102
+ }
103
+ /**
104
+ * Values the DEVICE knows, read at authoring time from the same cap:
105
+ * a status field holding a list, or a read method returning one.
106
+ * `valueKey` / `labelKey` pick the fields of an object item (omit both for a
107
+ * list of strings); `where` keeps only items whose field equals a value.
108
+ */
109
+ export type DynamicOffer<C extends VocabCapName> = {
110
+ readonly kind: 'dynamic';
111
+ readonly from: 'status';
112
+ readonly field: CapStatusField<C>;
113
+ readonly valueKey?: string;
114
+ readonly labelKey?: string;
115
+ readonly where?: {
116
+ readonly key: string;
117
+ readonly equals: string | number | boolean;
118
+ };
119
+ /** The type of the value the method takes (default string). */
120
+ readonly valueKind?: 'string' | 'number';
121
+ } | {
122
+ readonly kind: 'dynamic';
123
+ readonly from: 'method';
124
+ readonly method: CapMethodName<C>;
125
+ readonly valueKey?: string;
126
+ readonly labelKey?: string;
127
+ readonly where?: {
128
+ readonly key: string;
129
+ readonly equals: string | number | boolean;
130
+ };
131
+ readonly valueKind?: 'string' | 'number';
132
+ };
133
+ /** How the authoring UI offers a value for an open arg. */
134
+ export type VocabOffer<C extends VocabCapName> = EnumOffer | NumberOffer | TextOffer | BooleanOffer | DynamicOffer<C>;
135
+ /** An arg the operator fills after picking the action. */
136
+ export interface VocabOpenArg<C extends VocabCapName, K extends string> {
137
+ readonly key: K;
138
+ readonly label: L10n;
139
+ readonly offer: VocabOffer<C>;
140
+ /** The method accepts the call without it. */
141
+ readonly optional?: boolean;
142
+ }
143
+ /** One operator-facing action: a cap method call with a phrase. */
144
+ export interface VocabActionFor<C extends VocabCapName, M extends CapMethodName<C>> {
145
+ /** Stable id — persisted by pickers as a select value (`switch.on`). */
146
+ readonly id: string;
147
+ readonly method: M;
148
+ /** Short label for a picker ("Turn on"). */
149
+ readonly label: L10n;
150
+ /**
151
+ * The sentence ("Turn on {device}", "Move {device} to {presetId}").
152
+ * Placeholders: `{device}` and any open or fixed arg key.
153
+ */
154
+ readonly phrase: L10n;
155
+ readonly icon: VocabIcon;
156
+ /** Args baked into the action — never asked. */
157
+ readonly args?: Partial<ActionArgs<C, M>>;
158
+ /** Args the operator fills. */
159
+ readonly openArgs?: readonly VocabOpenArg<C, ActionArgKey<C, M>>[];
160
+ }
161
+ /** Any action of cap `C`, discriminated by `method`. */
162
+ export type VocabAction<C extends VocabCapName> = {
163
+ [M in CapMethodName<C>]: VocabActionFor<C, M>;
164
+ }[CapMethodName<C>];
165
+ /** A true/false field: one phrase per edge. */
166
+ export interface BooleanStateTrigger<C extends VocabCapName> {
167
+ readonly kind: 'boolean';
168
+ readonly field: CapStatusField<C>;
169
+ /** What the field is ("Contact", "Motion") — a picker label. */
170
+ readonly label: L10n;
171
+ readonly whenTrue: L10n;
172
+ readonly whenFalse: L10n;
173
+ readonly icon: VocabIcon;
174
+ }
175
+ /** A number: rises above / falls below / changes by, with a unit. */
176
+ export interface NumericStateTrigger<C extends VocabCapName> {
177
+ readonly kind: 'numeric';
178
+ readonly field: CapStatusField<C>;
179
+ /** The quantity WITH its article, as it reads in a sentence ("the temperature" / "la temperatura"). */
180
+ readonly quantity: L10n;
181
+ readonly label: L10n;
182
+ /** Display unit; omit when the device states it (see `unitField`). */
183
+ readonly unit?: string;
184
+ /** A status field carrying the device's own unit (`numeric-sensor.unit`). */
185
+ readonly unitField?: CapStatusField<C>;
186
+ readonly icon: VocabIcon;
187
+ }
188
+ /** One value of an enum field, with how "becomes" reads for it. */
189
+ export interface EnumStateValue {
190
+ readonly value: string;
191
+ readonly label: L10n;
192
+ /** Override of the default "When {device} changes to {value}". */
193
+ readonly phrase?: L10n;
194
+ }
195
+ /** A closed set of states. */
196
+ export interface EnumStateTrigger<C extends VocabCapName> {
197
+ readonly kind: 'enum';
198
+ readonly field: CapStatusField<C>;
199
+ readonly label: L10n;
200
+ readonly values: readonly EnumStateValue[];
201
+ readonly icon: VocabIcon;
202
+ }
203
+ /** A free string the device reports (a presence zone, an enum sensor's state). */
204
+ export interface ValueStateTrigger<C extends VocabCapName> {
205
+ readonly kind: 'value';
206
+ readonly field: CapStatusField<C>;
207
+ readonly label: L10n;
208
+ /** Where known values come from, when the device lists them. */
209
+ readonly offer?: DynamicOffer<C>;
210
+ /** Override of the default "When {device} changes to {value}". */
211
+ readonly phrase?: L10n;
212
+ readonly icon: VocabIcon;
213
+ }
214
+ /** A state field worth triggering on. */
215
+ export type VocabStateTrigger<C extends VocabCapName> = BooleanStateTrigger<C> | NumericStateTrigger<C> | EnumStateTrigger<C> | ValueStateTrigger<C>;
216
+ /** A bus event the device emits, phrased ("When {device} rings"). */
217
+ export interface VocabEventTrigger {
218
+ readonly category: EventCategory;
219
+ readonly label: L10n;
220
+ readonly phrase: L10n;
221
+ readonly icon: VocabIcon;
222
+ }
223
+ /** A declared cap event that is not an automation trigger, and why. */
224
+ export interface VocabEventExcused {
225
+ readonly notOperatorFacing: string;
226
+ }
227
+ /** Re-wording of one action for a kind of device. */
228
+ export interface VocabActionWording {
229
+ readonly label?: L10n;
230
+ readonly phrase?: L10n;
231
+ readonly icon?: VocabIcon;
232
+ }
233
+ /** Re-wording of one state trigger for a kind of device. */
234
+ export interface VocabStateWording {
235
+ readonly label?: L10n;
236
+ readonly whenTrue?: L10n;
237
+ readonly whenFalse?: L10n;
238
+ readonly quantity?: L10n;
239
+ readonly icon?: VocabIcon;
240
+ }
241
+ /** Wording that differs for a device type or role (a switch that is a siren). */
242
+ export interface VocabWording<C extends VocabCapName> {
243
+ /** Keyed by action id. */
244
+ readonly actions?: Readonly<Record<string, VocabActionWording>>;
245
+ readonly state?: {
246
+ readonly [F in CapStatusField<C>]?: VocabStateWording;
247
+ };
248
+ }
249
+ /** Overrides, keyed in the same map: a role beats a type. */
250
+ export interface VocabOverrides<C extends VocabCapName> {
251
+ readonly byType?: {
252
+ readonly [T in DeviceType]?: VocabWording<C>;
253
+ };
254
+ readonly byRole?: {
255
+ readonly [R in DeviceRole]?: VocabWording<C>;
256
+ };
257
+ }
258
+ type DeviceEventsBlock<C extends VocabCapName> = [CapEventName<C>] extends [never] ? {
259
+ readonly events?: undefined;
260
+ } : {
261
+ /** EVERY declared cap event: a trigger, or an excuse. */
262
+ readonly events: {
263
+ readonly [E in CapEventName<C>]: VocabEventTrigger | VocabEventExcused;
264
+ };
265
+ };
266
+ /** The vocabulary of a device-scoped cap. */
267
+ export type DeviceCapVocabulary<C extends VocabCapName> = {
268
+ readonly scope: 'device';
269
+ /** What the cap is, for grouping ("Switch" / "Interruttore"). */
270
+ readonly noun: L10n;
271
+ readonly actions?: readonly VocabAction<C>[];
272
+ /** Operate methods deliberately NOT offered, with the reason. */
273
+ readonly notOperatorFacing?: {
274
+ readonly [M in CapMethodName<C>]?: string;
275
+ };
276
+ readonly state?: readonly VocabStateTrigger<C>[];
277
+ /** Bus events the cap's devices emit with no declared cap event behind them. */
278
+ readonly extraEvents?: readonly VocabEventTrigger[];
279
+ readonly overrides?: VocabOverrides<C>;
280
+ } & DeviceEventsBlock<C>;
281
+ /** A system-scoped cap: never a device's vocabulary, and why. */
282
+ export interface SystemCapVocabulary {
283
+ readonly scope: 'system';
284
+ readonly notOperatorFacing: string;
285
+ }
286
+ /** The entry a cap must have. */
287
+ export type CapVocabularyEntry<C extends VocabCapName> = CapDef<C>['scope'] extends 'device' ? DeviceCapVocabulary<C> : SystemCapVocabulary;
288
+ /** The complete map: one entry per cap, no more, no fewer. */
289
+ export type CapVocabularyMap = {
290
+ readonly [C in VocabCapName]: CapVocabularyEntry<C>;
291
+ };
292
+ /** A slice of the map, for files that hold a family of caps. */
293
+ export type CapVocabularySlice<K extends VocabCapName> = {
294
+ readonly [C in K]: CapVocabularyEntry<C>;
295
+ };
296
+ /** A dynamic offer with no cap-specific key type. */
297
+ export type LooseDynamicOffer = {
298
+ readonly kind: 'dynamic';
299
+ readonly from: 'status';
300
+ readonly field: string;
301
+ readonly valueKey?: string;
302
+ readonly labelKey?: string;
303
+ readonly where?: {
304
+ readonly key: string;
305
+ readonly equals: string | number | boolean;
306
+ };
307
+ readonly valueKind?: 'string' | 'number';
308
+ } | {
309
+ readonly kind: 'dynamic';
310
+ readonly from: 'method';
311
+ readonly method: string;
312
+ readonly valueKey?: string;
313
+ readonly labelKey?: string;
314
+ readonly where?: {
315
+ readonly key: string;
316
+ readonly equals: string | number | boolean;
317
+ };
318
+ readonly valueKind?: 'string' | 'number';
319
+ };
320
+ /** An offer as a consumer reads it. */
321
+ export type LooseVocabOffer = EnumOffer | NumberOffer | TextOffer | BooleanOffer | LooseDynamicOffer;
322
+ /** An open arg as a consumer reads it, with no cap-specific key type. */
323
+ export interface LooseVocabOpenArg {
324
+ readonly key: string;
325
+ readonly label: L10n;
326
+ readonly offer: LooseVocabOffer;
327
+ readonly optional?: boolean;
328
+ }
329
+ /** An action as a consumer reads it. */
330
+ export interface LooseVocabAction {
331
+ readonly id: string;
332
+ readonly method: string;
333
+ readonly label: L10n;
334
+ readonly phrase: L10n;
335
+ readonly icon: VocabIcon;
336
+ readonly args?: Readonly<Record<string, unknown>>;
337
+ readonly openArgs?: readonly LooseVocabOpenArg[];
338
+ }
339
+ /** A boolean state trigger, string-keyed. */
340
+ export interface LooseBooleanStateTrigger {
341
+ readonly kind: 'boolean';
342
+ readonly field: string;
343
+ readonly label: L10n;
344
+ readonly whenTrue: L10n;
345
+ readonly whenFalse: L10n;
346
+ readonly icon: VocabIcon;
347
+ }
348
+ /** A numeric state trigger, string-keyed. */
349
+ export interface LooseNumericStateTrigger {
350
+ readonly kind: 'numeric';
351
+ readonly field: string;
352
+ readonly quantity: L10n;
353
+ readonly label: L10n;
354
+ readonly unit?: string;
355
+ readonly unitField?: string;
356
+ readonly icon: VocabIcon;
357
+ }
358
+ /** An enum state trigger, string-keyed. */
359
+ export interface LooseEnumStateTrigger {
360
+ readonly kind: 'enum';
361
+ readonly field: string;
362
+ readonly label: L10n;
363
+ readonly values: readonly EnumStateValue[];
364
+ readonly icon: VocabIcon;
365
+ }
366
+ /** A free-value state trigger, string-keyed. */
367
+ export interface LooseValueStateTrigger {
368
+ readonly kind: 'value';
369
+ readonly field: string;
370
+ readonly label: L10n;
371
+ readonly offer?: LooseDynamicOffer;
372
+ readonly phrase?: L10n;
373
+ readonly icon: VocabIcon;
374
+ }
375
+ /** A state trigger as a consumer reads it. */
376
+ export type LooseVocabStateTrigger = LooseBooleanStateTrigger | LooseNumericStateTrigger | LooseEnumStateTrigger | LooseValueStateTrigger;
377
+ /** Wording overrides as a consumer reads them. */
378
+ export interface LooseVocabWording {
379
+ readonly actions?: Readonly<Record<string, VocabActionWording>>;
380
+ readonly state?: Readonly<Record<string, VocabStateWording | undefined>>;
381
+ }
382
+ /** Overrides as a consumer reads them. */
383
+ export interface LooseVocabOverrides {
384
+ readonly byType?: Readonly<Record<string, LooseVocabWording | undefined>>;
385
+ readonly byRole?: Readonly<Record<string, LooseVocabWording | undefined>>;
386
+ }
387
+ /** Any entry of the map, string-keyed. */
388
+ export interface LooseCapVocabularyEntry {
389
+ readonly scope: 'device' | 'system';
390
+ readonly noun?: L10n;
391
+ readonly actions?: readonly LooseVocabAction[];
392
+ readonly notOperatorFacing?: string | Readonly<Record<string, string | undefined>>;
393
+ readonly state?: readonly LooseVocabStateTrigger[];
394
+ readonly events?: Readonly<Record<string, VocabEventTrigger | VocabEventExcused>>;
395
+ readonly extraEvents?: readonly VocabEventTrigger[];
396
+ readonly overrides?: LooseVocabOverrides;
397
+ }
398
+ export {};
@@ -0,0 +1,5 @@
1
+ import type { CapVocabularyMap, LooseCapVocabularyEntry } from './types.js';
2
+ /** Every capability's vocabulary, keyed by cap name. */
3
+ export declare const CAP_VOCABULARY: CapVocabularyMap;
4
+ /** The same map, read by a string cap name (a binding names caps as strings). */
5
+ export declare const CAP_VOCABULARY_BY_NAME: Readonly<Record<string, LooseCapVocabularyEntry>>;
@@ -1,9 +1,14 @@
1
+ import type { LooseVocabOffer } from './cap-vocabulary/types.js';
1
2
  import { DeviceType } from './device-type.js';
2
3
  /** An arg the authoring UI collects (not baked into the catalogue entry). */
3
4
  export interface DeviceDoOpenArg {
4
5
  readonly key: string;
5
6
  readonly label: string;
6
7
  readonly kind: 'string' | 'number';
8
+ /** How the vocabulary says to offer values (enum, range, the device's own list). */
9
+ readonly offer?: LooseVocabOffer;
10
+ /** The method accepts the call without it. */
11
+ readonly optional?: boolean;
7
12
  }
8
13
  /** One operator-facing action that becomes a cap method call. */
9
14
  export interface DeviceDoAction {
@@ -22,8 +27,9 @@ export interface DeviceDoAction {
22
27
  readonly openArgs?: readonly DeviceDoOpenArg[];
23
28
  }
24
29
  /**
25
- * The curated catalogue. Order is the order the select draws.
26
- * Args are baked in so the authoring UI never asks for JSON for these.
30
+ * The catalogue: every device-cap action of the vocabulary, in the
31
+ * vocabulary's order (the order the select draws). Args are baked in so the
32
+ * authoring UI never asks for JSON for these.
27
33
  */
28
34
  export declare const DEVICE_DO_ACTIONS: readonly DeviceDoAction[];
29
35
  /** True when METHOD_ACCESS_MAP still exposes this cap.method as actuatable. */
@@ -7272,6 +7272,13 @@ export type AppRouter = TrpcCoreRouter<{
7272
7272
  output: z.infer<typeof pipelineOrchestratorCapability.methods.getNodeInferenceDevices.output>;
7273
7273
  meta: object;
7274
7274
  }>;
7275
+ forgetInferenceDevice: TRPCMutationProcedure<{
7276
+ input: {
7277
+ [x: string]: unknown;
7278
+ } & z.input<typeof pipelineOrchestratorCapability.methods.forgetInferenceDevice.input>;
7279
+ output: z.infer<typeof pipelineOrchestratorCapability.methods.forgetInferenceDevice.output>;
7280
+ meta: object;
7281
+ }>;
7275
7282
  resetNodePipelineDefaults: TRPCMutationProcedure<{
7276
7283
  input: {
7277
7284
  [x: string]: unknown;
@@ -7777,6 +7784,13 @@ export type AppRouter = TrpcCoreRouter<{
7777
7784
  output: z.infer<typeof platformProbeCapability.methods.resolveHwAccel.output>;
7778
7785
  meta: object;
7779
7786
  }>;
7787
+ rescanAccelerators: TRPCMutationProcedure<{
7788
+ input: {
7789
+ nodeId?: string | undefined;
7790
+ } | undefined;
7791
+ output: z.infer<typeof platformProbeCapability.methods.rescanAccelerators.output>;
7792
+ meta: object;
7793
+ }>;
7780
7794
  }>>;
7781
7795
  powerMeter: TRPCBuiltRouter<{
7782
7796
  ctx: TrpcContext;
@@ -12928,6 +12942,11 @@ export type AppRouter = TrpcCoreRouter<{
12928
12942
  access: ("delete" | "view" | "create")[];
12929
12943
  } | {
12930
12944
  type: "preferences-self";
12945
+ } | {
12946
+ type: "viewer";
12947
+ allow: "*" | number[];
12948
+ block: number[];
12949
+ features: ("face-assignment" | "plate-assignment" | "retrain" | "scenes")[];
12931
12950
  })[];
12932
12951
  createdAt: number;
12933
12952
  expiresAt: number | null;
@@ -12985,6 +13004,11 @@ export type AppRouter = TrpcCoreRouter<{
12985
13004
  access: ("delete" | "view" | "create")[];
12986
13005
  } | {
12987
13006
  type: "preferences-self";
13007
+ } | {
13008
+ type: "viewer";
13009
+ allow: "*" | number[];
13010
+ block: number[];
13011
+ features: ("face-assignment" | "plate-assignment" | "retrain" | "scenes")[];
12988
13012
  })[];
12989
13013
  createdAt: number;
12990
13014
  expiresAt: number | null;
@@ -13042,6 +13066,11 @@ export type AppRouter = TrpcCoreRouter<{
13042
13066
  access: ("delete" | "view" | "create")[];
13043
13067
  } | {
13044
13068
  type: "preferences-self";
13069
+ } | {
13070
+ type: "viewer";
13071
+ allow: "*" | number[];
13072
+ block: number[];
13073
+ features: ("face-assignment" | "plate-assignment" | "retrain" | "scenes")[];
13045
13074
  })[];
13046
13075
  createdAt: number;
13047
13076
  expiresAt: number | null;
@@ -13536,6 +13565,8 @@ export type AppRouter = TrpcCoreRouter<{
13536
13565
  isApiKey: boolean;
13537
13566
  scope?: {
13538
13567
  isAdmin: boolean;
13568
+ role: "scoped" | "admin" | "viewer";
13569
+ features: readonly ("face-assignment" | "plate-assignment" | "retrain" | "scenes")[];
13539
13570
  allDevicesViewable: boolean;
13540
13571
  viewableDeviceCount: number;
13541
13572
  device: {
@@ -13572,6 +13603,8 @@ export type AppRouter = TrpcCoreRouter<{
13572
13603
  };
13573
13604
  output: {
13574
13605
  isAdmin: boolean;
13606
+ role: "scoped" | "admin" | "viewer";
13607
+ features: readonly ("face-assignment" | "plate-assignment" | "retrain" | "scenes")[];
13575
13608
  allDevicesViewable: boolean;
13576
13609
  viewableDeviceCount: number;
13577
13610
  device: {
@@ -13904,6 +13937,11 @@ export type AppRouter = TrpcCoreRouter<{
13904
13937
  access: ("delete" | "view" | "create")[];
13905
13938
  } | {
13906
13939
  type: "preferences-self";
13940
+ } | {
13941
+ type: "viewer";
13942
+ allow: "*" | number[];
13943
+ block: number[];
13944
+ features: ("face-assignment" | "plate-assignment" | "retrain" | "scenes")[];
13907
13945
  })[];
13908
13946
  createdAt: number;
13909
13947
  expiresAt: number | null;
@@ -13961,6 +13999,11 @@ export type AppRouter = TrpcCoreRouter<{
13961
13999
  access: ("delete" | "view" | "create")[];
13962
14000
  } | {
13963
14001
  type: "preferences-self";
14002
+ } | {
14003
+ type: "viewer";
14004
+ allow: "*" | number[];
14005
+ block: number[];
14006
+ features: ("face-assignment" | "plate-assignment" | "retrain" | "scenes")[];
13964
14007
  })[];
13965
14008
  createdAt: number;
13966
14009
  expiresAt: number | null;
@@ -14018,6 +14061,11 @@ export type AppRouter = TrpcCoreRouter<{
14018
14061
  access: ("delete" | "view" | "create")[];
14019
14062
  } | {
14020
14063
  type: "preferences-self";
14064
+ } | {
14065
+ type: "viewer";
14066
+ allow: "*" | number[];
14067
+ block: number[];
14068
+ features: ("face-assignment" | "plate-assignment" | "retrain" | "scenes")[];
14021
14069
  })[];
14022
14070
  createdAt: number;
14023
14071
  expiresAt: number | null;
@@ -14512,6 +14560,8 @@ export type AppRouter = TrpcCoreRouter<{
14512
14560
  isApiKey: boolean;
14513
14561
  scope?: {
14514
14562
  isAdmin: boolean;
14563
+ role: "scoped" | "admin" | "viewer";
14564
+ features: readonly ("face-assignment" | "plate-assignment" | "retrain" | "scenes")[];
14515
14565
  allDevicesViewable: boolean;
14516
14566
  viewableDeviceCount: number;
14517
14567
  device: {
@@ -14548,6 +14598,8 @@ export type AppRouter = TrpcCoreRouter<{
14548
14598
  };
14549
14599
  output: {
14550
14600
  isAdmin: boolean;
14601
+ role: "scoped" | "admin" | "viewer";
14602
+ features: readonly ("face-assignment" | "plate-assignment" | "retrain" | "scenes")[];
14551
14603
  allDevicesViewable: boolean;
14552
14604
  viewableDeviceCount: number;
14553
14605
  device: {
@@ -6,14 +6,17 @@
6
6
  * scope+access check inside `protectedProcedure` (see
7
7
  * `server/backend/src/api/trpc/trpc.middleware.ts`).
8
8
  *
9
- * Coverage: 1382 method paths across 179 capabilities.
9
+ * Coverage: 1384 method paths across 179 capabilities.
10
10
  */
11
+ import type { MethodRole } from '../auth/viewer-access.js';
11
12
  import type { CapabilityMethodAccess } from '../capabilities/capability-definition.js';
12
13
  export interface MethodAccessRecord {
13
14
  readonly capName: string;
14
15
  readonly capScope: 'device' | 'system';
15
16
  readonly addonId: string | null;
16
17
  readonly access: CapabilityMethodAccess;
18
+ /** What the method is for a viewer (D921): `public`, `viewer`, `admin` or `feature:<id>`. */
19
+ readonly role: MethodRole;
17
20
  }
18
21
  export declare const METHOD_ACCESS_MAP: Readonly<Record<string, MethodAccessRecord>>;
19
22
  /** Set of all known cap names — handy for the scope picker. */
@@ -98,7 +98,7 @@ export interface SystemProxy {
98
98
  readonly oidcConnections: Pick<InferProvider<typeof oidcConnectionsCapability>, 'connectionFormSchema' | 'listConnections' | 'createConnection' | 'updateConnection' | 'deleteConnection'>;
99
99
  readonly osdManager: Pick<InferProvider<typeof osdManagerCapability>, 'getConditionSupport' | 'copyDeviceConfiguration' | 'listTemplates' | 'upsertTemplate' | 'deleteTemplate'>;
100
100
  readonly pipelineExecutor: Pick<InferProvider<typeof pipelineExecutorCapability>, 'getAvailableEngines' | 'getSelectedEngine' | 'getDefaultSteps' | 'getEngineProvisioning' | 'getVideoPipelineSteps' | 'setVideoPipelineSteps' | 'clearDeviceOverrides' | 'clearModelBoundDeviceOverrides' | 'getInferenceDeviceHealth' | 'rearmInferenceDevice' | 'getSchema' | 'getGlobalSteps' | 'getGlobalPipelineConfig' | 'getOrchestratorConfigSchema' | 'validatePipeline' | 'getCapabilities' | 'getAddonModels' | 'downloadModel' | 'deleteModel' | 'cacheFrameInPool' | 'inferCached' | 'uncacheFrame' | 'getEffectiveTuning' | 'listLoadedEngines' | 'spinEngine' | 'killEngine' | 'listReferenceImages' | 'getReferenceImage' | 'getReferenceAudioFiles' | 'getReferenceAudio' | 'getAudioCapabilities' | 'runAudioTest' | 'getDetectionConfigSchema'>;
101
- readonly pipelineOrchestrator: Pick<InferProvider<typeof pipelineOrchestratorCapability>, 'requestOccupancyLook' | 'pauseForStorageMigration' | 'resumeForStorageMigration' | 'rebalance' | 'getPipelineAssignments' | 'getAgentLoad' | 'getClusterModelChoice' | 'getGlobalMetrics' | 'getCapabilityBindings' | 'setCapabilityBinding' | 'getIngestOwner' | 'getAudioNodeLoad' | 'getAudioAssignments' | 'getAgentSettings' | 'listAgentSettings' | 'removeAgentSettings' | 'setAgentMaxCameras' | 'setAgentCapabilities' | 'setAgentDecodeLimits' | 'setAgentReachableHost' | 'setAgentInferenceDevices' | 'getNodeInferenceDevices' | 'resetNodePipelineDefaults' | 'planAutoTune' | 'applyAutoTune' | 'setLoadBalancingShares' | 'getPlacementStats' | 'suggestShares' | 'getEffectiveShares' | 'setShareSource' | 'getNodeBenchmarkPreflight' | 'startNodeBenchmark' | 'getNodeBenchmarkStatus' | 'abortNodeBenchmark' | 'getNodeBenchmarkCandidates' | 'listNodeBenchmarkResults' | 'deleteNodeBenchmarkResult' | 'getCameraStatuses' | 'setCameraSensors' | 'reconcileFromDisk' | 'getReconcileFromDiskStatus'>;
101
+ readonly pipelineOrchestrator: Pick<InferProvider<typeof pipelineOrchestratorCapability>, 'requestOccupancyLook' | 'pauseForStorageMigration' | 'resumeForStorageMigration' | 'rebalance' | 'getPipelineAssignments' | 'getAgentLoad' | 'getClusterModelChoice' | 'getGlobalMetrics' | 'getCapabilityBindings' | 'setCapabilityBinding' | 'getIngestOwner' | 'getAudioNodeLoad' | 'getAudioAssignments' | 'getAgentSettings' | 'listAgentSettings' | 'removeAgentSettings' | 'setAgentMaxCameras' | 'setAgentCapabilities' | 'setAgentDecodeLimits' | 'setAgentReachableHost' | 'setAgentInferenceDevices' | 'getNodeInferenceDevices' | 'forgetInferenceDevice' | 'resetNodePipelineDefaults' | 'planAutoTune' | 'applyAutoTune' | 'setLoadBalancingShares' | 'getPlacementStats' | 'suggestShares' | 'getEffectiveShares' | 'setShareSource' | 'getNodeBenchmarkPreflight' | 'startNodeBenchmark' | 'getNodeBenchmarkStatus' | 'abortNodeBenchmark' | 'getNodeBenchmarkCandidates' | 'listNodeBenchmarkResults' | 'deleteNodeBenchmarkResult' | 'getCameraStatuses' | 'setCameraSensors' | 'reconcileFromDisk' | 'getReconcileFromDiskStatus'>;
102
102
  readonly pipelineRunner: Pick<InferProvider<typeof pipelineRunnerCapability>, 'attachCamera' | 'reportMotion' | 'getLocalLoad' | 'getLocalMetrics' | 'getAllCameraMetrics' | 'getLocalCameras' | 'getNativeCrop' | 'runStatelessStep' | 'startNodeBench' | 'getNodeBenchStatus' | 'abortNodeBench'>;
103
103
  readonly plateGallery: Pick<InferProvider<typeof plateGalleryCapability>, 'getPlateMedia' | 'searchPlates' | 'suggestPlateClusters' | 'correctPlateText' | 'deletePlate' | 'listVehicles' | 'createVehicle' | 'renameVehicle' | 'deleteVehicle' | 'listVehicleSamples' | 'removeVehicleSample' | 'assignPlate' | 'unassignPlate' | 'assignPlates' | 'unassignPlates'>;
104
104
  readonly recordEntries: Pick<InferProvider<typeof recordEntriesCapability>, 'listEntryKinds' | 'listEntries' | 'putEntry' | 'deleteEntry'>;
package/dist/index.d.ts CHANGED
@@ -152,6 +152,7 @@ export * from './types/pipeline-step.js';
152
152
  export * from './types/tracked.js';
153
153
  export { type BearerPayloadShape, type BearerPrincipal, classifyBearerPrincipal, methodAccessForHttpMethod, type PrincipalAddonReachInput, type PrincipalAddonReachVerdict, principalMayReachAddon, scopesAllowAddon, scopesAllowDeviceCap, } from './auth/principal-scope.js';
154
154
  export { ADMIN_SCOPE, ALL_METHOD_ACCESS, type AddonRoutesScope, AddonRoutesScopeSchema, capabilityScopesOf, CREDENTIAL_TOKEN_AUDIENCE, CREDENTIAL_TOKEN_KIND, isCredentialTokenPayload, type CredentialScope, CredentialScopeSchema, type CredentialTokenClaims, CredentialTokenClaimsSchema, parseCredentialScopes, PREFERENCES_SELF_SCOPE, type PreferencesSelfScope, PreferencesSelfScopeSchema, SHARE_VIEW_MAX_DEVICES, scopesAllowAddonRoutes, scopesAllowOwnPreferences, scopesGrantAdmin, type ShareViewGrant, ShareViewGrantSchema, type ShareViewScope, ShareViewScopeSchema, shareViewGrantOf, } from './auth/credential-scope.js';
155
+ export { DEFAULT_VIEWER_SCOPE, featureOfRole, type MethodRole, type MethodRoleDecl, type MethodRoleSource, methodRoleOf, resolveMethodRole, type ViewerAncestorLookup, viewerAdmitsDevice, type ViewerDeviceAllow, ViewerDeviceAllowSchema, VIEWER_FEATURE_IDS, VIEWER_FEATURES, type ViewerFeatureId, ViewerFeatureIdSchema, type ViewerFeatureSpec, viewerHoldsRole, type ViewerTokenScope, ViewerTokenScopeSchema, } from './auth/viewer-access.js';
155
156
  export { type PreferenceNamespace, PreferenceNamespaceSchema, type PreferenceRow, PreferenceRowSchema, type PreferenceValue, PreferenceValueSchema, PreferenceDeviceIdSchema, type PreferencesChangedSinceInput, PreferencesChangedSinceInputSchema, type PreferencesChangedSinceOutput, PreferencesChangedSinceOutputSchema, type PreferencesDeleteInput, PreferencesDeleteInputSchema, type PreferencesDeleteOutput, PreferencesDeleteOutputSchema, type PreferencesGetInput, PreferencesGetInputSchema, type PreferencesGetOutput, PreferencesGetOutputSchema, type PreferencesPutInput, PreferencesPutInputSchema, type PreferencesPutOutput, PreferencesPutOutputSchema, PREFERENCES_MAX_DEVICE_ID_LENGTH, PREFERENCES_MAX_NAMESPACES, PREFERENCES_MAX_VALUE_BYTES, PREFERENCES_NAMESPACE_PATTERN, } from './schemas/user-preferences.js';
156
157
  export { APP_AUTH_CALLBACK_MAX_LENGTH, APP_AUTH_CALLBACK_URLS, canonicalizeAppCallback, hasUrlScheme, parseAppAuthCallback, } from './auth/app-callback.js';
157
158
  export { APP_FLOW_DEFAULT_REDIRECT, APP_FLOW_REFUSAL_MESSAGES, APP_FLOW_STATE_PREFIX, APP_REFUSED_PATH, APP_START_REFUSAL_MESSAGES, type AppFlowParse, type AppFlowPurpose, AppFlowPurposeSchema, type AppFlowRefusal, type AppFlowRequest, type AppPageLang, AppPageLangSchema, type AppLoginPath, AppLoginPathSchema, type AppStartRefusal, appFlowLocation, isAppStartRefusal, parseAppFlowRequest, parseAppPageLang, } from './auth/app-flow.js';
@@ -162,6 +163,7 @@ export type { AutomationAction, AutomationCondition, AutomationConditionAll, Aut
162
163
  export { AutomationActionSchema, AutomationConditionOperatorSchema, AutomationConditionSchema, AutomationRecipeSchema, AutomationTriggerSchema, conditionDepth, countConditionLeaves, generateAutomationBlock, MAX_CONDITION_DEPTH, MAX_CONDITION_LEAVES, validateRecipeBounds, } from './automation/index.js';
163
164
  export * from './cap-call-context.js';
164
165
  export * from './capabilities/index.js';
166
+ export * from './clips/clip-event-labels.js';
165
167
  export * from './device-extension/index.js';
166
168
  export * from './composition/index.js';
167
169
  export { APPLE_SA_TO_MACRO, AUDIO_MACRO_LABELS, getAudioMacroClassIds, mapAudioLabelToMacro, YAMNET_TO_MACRO, } from './catalogs/audio-classmap.js';
@@ -197,6 +199,8 @@ export type { AccessoryControlInput, AccessoryControlKind, AccessoryControlPick,
197
199
  export { DEVICE_TYPE_CONTROL_KIND, hasMotionTrigger, isNode, MOTION_TRIGGER_FEATURE, pickAccessoryControl, resolveDeviceControlKind, resolveMutate, SENSOR_FEATURES, SENSOR_MAP, } from './device/device-control-resolution.js';
198
200
  export type { DeviceDoAction, DeviceDoOpenArg } from './device/device-do-actions.js';
199
201
  export { actionsForBoundCaps, actionsForDevice, actionsForDevices, actionsForDeviceType, allDoActions, DEVICE_DO_ACTIONS, DEVICE_TYPE_DO_CAPS, deviceDoFamily, doActionSelectValue, isDoActionActuatable, isDoPickerDeviceType, matchDoAction, sameDoFamily, } from './device/device-do-actions.js';
202
+ export type { CapVocabularyEntry, CapVocabularyMap, L10n as VocabL10n, LooseCapVocabularyEntry, LooseVocabOffer, LooseVocabOpenArg, ResolvedBooleanTrigger, ResolvedEnumTrigger, ResolvedEnumValue, ResolvedEventTrigger, ResolvedNumericTrigger, ResolvedValueTrigger, ResolvedVocabAction, ResolvedVocabTrigger, VocabBindingsInput, VocabCapName, VocabLocale, } from './device/cap-vocabulary/index.js';
203
+ export { actionsForDevice as vocabularyActionsForDevice, CAP_VOCABULARY, CAP_VOCABULARY_BY_NAME, renderVocabPhrase, triggersForDevice as vocabularyTriggersForDevice, VOCAB_TEMPLATES, } from './device/cap-vocabulary/index.js';
200
204
  export type { ChildLayout, ChildLayoutEntry, CreateDeviceSpec, DeviceCapDisplayOverride, DeviceDiscovery, DeviceDisplayOverride, DeviceManualCreation, DeviceMeta, DiscoveredDevice, InitialDeviceMeta, RoleDisplayDefault, SavedDevice, } from './device/device-management.js';
201
205
  export type { DeviceProfile, DeviceProfileDefaults, DeviceProfileMatch, PipelinePhaseMode, } from './device/device-profile.js';
202
206
  export { BATTERY_DEVICE_PROFILE, DEVICE_PROFILES, deviceMatchesProfile, resolveDeviceProfile, } from './device/device-profile.js';
@@ -303,8 +307,8 @@ export { DEFAULT_DETAIL_CROP_CONVENTION, DETAIL_CROP_PADDING_FIELD, DETAIL_CROP_
303
307
  export { FACE_RESCORE_INTERVAL_FIELD, FACE_RESCORE_INTERVAL_KEY, FACE_RESCORE_INTERVAL_MIN_RUNNING, FACE_RESCORE_SECTION_ID, type FaceRescoreSettingsView, pickFaceRescoreIntervalMinutes, readFaceRescoreIntervalMinutes, } from './pipeline/face-rescore-schedule.js';
304
308
  export { DEFAULT_NATIVE_LEASE_SETTINGS, NATIVE_LEASE_ACTIVITY_FIELD, NATIVE_LEASE_ACTIVITY_KEY, NATIVE_LEASE_ADMISSION_FIELD, NATIVE_LEASE_ADMISSION_KEY, NATIVE_LEASE_BUDGET_FIELD, NATIVE_LEASE_BUDGET_KEY, NATIVE_LEASE_HOLD_FIELD, NATIVE_LEASE_HOLD_KEY, NATIVE_LEASE_SCENE_BUDGET_FIELD, NATIVE_LEASE_SCENE_BUDGET_KEY, NATIVE_LEASE_SECTION_ID, NATIVE_LEASE_TILE_BUDGET_FIELD, NATIVE_LEASE_TILE_BUDGET_KEY, type NativeLeaseAdmission, NativeLeaseAdmissionSchema, type NativeLeaseKnob, type NativeLeaseNumberKnob, type NativeLeaseSettings, type NativeLeaseSettingsOverride, NativeLeaseSettingsSchema, pickNativeLeaseOverride, readNativeLeaseOverride, } from './pipeline/native-lease.js';
305
309
  export { ACCESS_ROLES, type AccessRoleAssignment, type AccessRoleId, type AccessRoleSpec, buildRoleScopes, detectAccessRole, roleSpec, } from './schemas/access-roles.js';
306
- export { type CapScope, CapScopeSchema, type DeviceSelector, DeviceSelectorSchema, type DeviceTokenScope, type MethodAccess, MethodAccessSchema, type ScopedToken, ScopedTokenSchema, type TokenScope, TokenScopeSchema, type UserRecord, UserRecordSchema, } from './schemas/auth-records.js';
307
- export { type DeviceMetaLike, type DeviceReachSummary, deviceSelectorMatches, type EffectiveScope, normalizeTokenScopes, resolveViewableDeviceIds, type ScopeGrantSummary, scopeInherits, summarizeEffectiveScope, } from './schemas/device-selector.js';
310
+ export { type CapScope, CapScopeSchema, type DeviceSelector, DeviceSelectorSchema, type DeviceTokenScope, type MethodAccess, MethodAccessSchema, type ScopedToken, ScopedTokenSchema, type TokenScope, TokenScopeSchema, type UserRecord, UserRecordSchema, type UserScope, UserScopeSchema, } from './schemas/auth-records.js';
311
+ export { type DeviceMetaLike, type DeviceReachSummary, deviceSelectorMatches, type EffectiveScope, grantRowsOf, normalizeTokenScopes, resolveViewableDeviceIds, type ScopeGrantSummary, scopeInherits, summarizeEffectiveScope, viewerScopeOf, } from './schemas/device-selector.js';
308
312
  export type { CameraDetectionCapabilities, CameraMotionConfig, CameraNativeDetectionConfig, } from './types/camera-detection.js';
309
313
  export { DEVICE_TYPE_INFO, type DeviceTypeInfo } from './types/device-type.js';
310
314
  export * from './units/index.js';