@camstack/types 1.2.402 → 1.2.404

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 (57) hide show
  1. package/dist/addon.js +2 -2
  2. package/dist/addon.mjs +2 -2
  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 +3 -3
  8. package/dist/capabilities/pipeline-analytics.cap.d.ts +82 -0
  9. package/dist/capabilities/pipeline-executor.cap.d.ts +0 -64
  10. package/dist/capabilities/pipeline-orchestrator.cap.d.ts +32 -124
  11. package/dist/capabilities/plate-gallery.cap.d.ts +3 -0
  12. package/dist/capabilities/scene-monitor.cap.d.ts +3 -0
  13. package/dist/capabilities/training.cap.d.ts +91 -71
  14. package/dist/capabilities/user-management.cap.d.ts +108 -18
  15. package/dist/client.js +9 -8
  16. package/dist/client.mjs +9 -8
  17. package/dist/clips/clip-event-labels.d.ts +96 -0
  18. package/dist/device/cap-vocabulary/entries/actuators.d.ts +5 -0
  19. package/dist/device/cap-vocabulary/entries/appliances.d.ts +5 -0
  20. package/dist/device/cap-vocabulary/entries/camera.d.ts +5 -0
  21. package/dist/device/cap-vocabulary/entries/sensors.d.ts +5 -0
  22. package/dist/device/cap-vocabulary/entries/system.d.ts +8 -0
  23. package/dist/device/cap-vocabulary/index.d.ts +9 -0
  24. package/dist/device/cap-vocabulary/l10n.d.ts +7 -0
  25. package/dist/device/cap-vocabulary/resolve.d.ts +100 -0
  26. package/dist/device/cap-vocabulary/templates.d.ts +11 -0
  27. package/dist/device/cap-vocabulary/types.d.ts +398 -0
  28. package/dist/device/cap-vocabulary/vocabulary.d.ts +5 -0
  29. package/dist/device/device-do-actions.d.ts +8 -2
  30. package/dist/enums/event-category.d.ts +2 -3
  31. package/dist/enums.js +1 -1
  32. package/dist/enums.mjs +1 -1
  33. package/dist/{event-category-7AwNbPjm.js → event-category-CXrwjC3e.js} +2 -3
  34. package/dist/{event-category-BfJwUd2S.mjs → event-category-fDPduoeC.mjs} +2 -3
  35. package/dist/generated/addon-api.d.ts +52 -56
  36. package/dist/generated/device-proxy.d.ts +1 -1
  37. package/dist/generated/method-access-map.d.ts +4 -1
  38. package/dist/generated/method-device-selectors.d.ts +2 -2
  39. package/dist/generated/system-proxy.d.ts +3 -3
  40. package/dist/index.d.ts +8 -3
  41. package/dist/index.js +7406 -2133
  42. package/dist/index.mjs +7372 -2132
  43. package/dist/interfaces/api-responses.d.ts +1 -1
  44. package/dist/interfaces/auth.d.ts +2 -2
  45. package/dist/interfaces/birth-decision-ledger.d.ts +20 -0
  46. package/dist/interfaces/pipeline-executor-capability.d.ts +2 -8
  47. package/dist/pipeline/auto-tune/plan-schemas.d.ts +8 -80
  48. package/dist/pipeline/step-settings-layers.d.ts +7 -8
  49. package/dist/schemas/auth-records.d.ts +77 -13
  50. package/dist/schemas/device-selector.d.ts +23 -4
  51. package/dist/{sleep-DVovpDRU.js → sleep-BKS4OPMo.js} +2 -4
  52. package/dist/{sleep-CUp20JkO.mjs → sleep-CHIEEJkY.mjs} +2 -4
  53. package/dist/types/agent-pipeline-settings.d.ts +37 -70
  54. package/dist/types/camera-pipeline.d.ts +2 -2
  55. package/dist/types/detection.d.ts +19 -0
  56. package/dist/types/pipeline-step.d.ts +0 -16
  57. package/package.json +1 -1
@@ -48,7 +48,7 @@ export interface SafeUser {
48
48
  * for non-admins until an admin assigns scopes via `setUserScopes`.
49
49
  * Wire-side default `[]` from the Zod schema.
50
50
  */
51
- readonly scopes: readonly import('../schemas/auth-records.js').TokenScope[];
51
+ readonly scopes: readonly import('../schemas/auth-records.js').UserScope[];
52
52
  /**
53
53
  * True iff a confirmed TOTP enrollment exists for this user — surfaced
54
54
  * by `listUsers` so the admin UI can render the "Remove 2FA" action
@@ -1,5 +1,5 @@
1
1
  export { type UserRecord, type TokenScope } from '../schemas/auth-records.js';
2
- import type { TokenScope } from '../schemas/auth-records.js';
2
+ import type { UserScope } from '../schemas/auth-records.js';
3
3
  export interface UserPermissions {
4
4
  isAdmin: boolean;
5
5
  allowedProviders: string[] | '*';
@@ -34,7 +34,7 @@ export interface TokenPayload {
34
34
  * user's NEXT login — existing JWTs carry the snapshot from
35
35
  * issue-time. Re-issue on the client by logging out and back in.
36
36
  */
37
- scopes?: readonly TokenScope[];
37
+ scopes?: readonly UserScope[];
38
38
  iat?: number;
39
39
  exp?: number;
40
40
  }
@@ -84,6 +84,18 @@ export declare const BirthDecisionVerdictSchema: z.ZodEnum<{
84
84
  suppressed: "suppressed";
85
85
  }>;
86
86
  export type BirthDecisionVerdict = z.infer<typeof BirthDecisionVerdictSchema>;
87
+ /**
88
+ * Which pixels a gate verdict was taken on (D379): `native` is a full-resolution
89
+ * crop of the birth's own frame and the ONLY source that may suppress;
90
+ * `carried` is that instant at analysis resolution and `fallback` a later
91
+ * instant — both may only confirm.
92
+ */
93
+ export declare const BirthDecisionCropSourceSchema: z.ZodEnum<{
94
+ carried: "carried";
95
+ fallback: "fallback";
96
+ native: "native";
97
+ }>;
98
+ export type BirthDecisionCropSource = z.infer<typeof BirthDecisionCropSourceSchema>;
87
99
  /** One birth decision, as it is kept. */
88
100
  export declare const BirthDecisionRecordSchema: z.ZodObject<{
89
101
  id: z.ZodString;
@@ -97,6 +109,11 @@ export declare const BirthDecisionRecordSchema: z.ZodObject<{
97
109
  suppressed: "suppressed";
98
110
  }>;
99
111
  reason: z.ZodNullable<z.ZodString>;
112
+ cropSource: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
113
+ carried: "carried";
114
+ fallback: "fallback";
115
+ native: "native";
116
+ }>>>;
100
117
  attempts: z.ZodNumber;
101
118
  deferredForMs: z.ZodNumber;
102
119
  decidedOnCoastedFrame: z.ZodBoolean;
@@ -104,6 +121,9 @@ export declare const BirthDecisionRecordSchema: z.ZodObject<{
104
121
  decidedByBirthEvidence: z.ZodBoolean;
105
122
  bestScore: z.ZodNullable<z.ZodNumber>;
106
123
  appliedMinConfidence: z.ZodNullable<z.ZodNumber>;
124
+ detectorModelId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
125
+ detectorDeviceKey: z.ZodDefault<z.ZodNullable<z.ZodString>>;
126
+ detectorNodeId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
107
127
  firstSeen: z.ZodNullable<z.ZodNumber>;
108
128
  motionOnsetAt: z.ZodNullable<z.ZodNumber>;
109
129
  birthLatencyMs: z.ZodNullable<z.ZodNumber>;
@@ -1,6 +1,6 @@
1
- import type { PipelineEngineChoice, PipelineConfig } from '../types/pipeline.js';
1
+ import type { PipelineEngineChoice } from '../types/pipeline.js';
2
2
  import type { PipelineExecutionPlane } from '../types/pipeline-step.js';
3
- import type { PipelineSchema, PipelineDefaultStep } from '../types/pipeline-schema.js';
3
+ import type { PipelineSchema } from '../types/pipeline-schema.js';
4
4
  import type { ModelFormat } from '../types/models.js';
5
5
  import type { FrameInput } from '../types/io.js';
6
6
  import type { FrameRef } from '../types/frame-view.js';
@@ -112,12 +112,6 @@ export interface IPipelineExecutorProvider {
112
112
  getSchema(engine?: PipelineEngineChoice): Promise<PipelineSchema>;
113
113
  /** Get all available engines probed on this agent */
114
114
  getAvailableEngines(): Promise<PipelineEngineChoice[]>;
115
- /** Build default step tree for an engine */
116
- getDefaultSteps(engine: PipelineEngineChoice): Promise<PipelineDefaultStep[]>;
117
- /** Compute this node's hardware-aware default step tree (null when the catalog yields no steps). */
118
- getGlobalSteps(): Promise<PipelineDefaultStep[] | null>;
119
- /** Get the runner-ready pipeline config */
120
- getGlobalPipelineConfig(): Promise<PipelineConfig | null>;
121
115
  /**
122
116
  * Gate B (pre-init config-correctness gate). PURE COMPUTE against this
123
117
  * node's `currentEngine.format` — resolves `steps` the same way the
@@ -381,33 +381,15 @@ export declare const NodeDeviceChangeSchema: z.ZodObject<{
381
381
  keys: z.ZodReadonly<z.ZodArray<z.ZodString>>;
382
382
  }, z.core.$strip>>>;
383
383
  }, z.core.$strip>;
384
- export declare const CameraOverrideClearSchema: z.ZodObject<{
385
- deviceId: z.ZodNumber;
386
- source: z.ZodEnum<{
387
- "step-override": "step-override";
388
- wholesale: "wholesale";
389
- }>;
390
- nodeId: z.ZodString;
391
- deviceKey: z.ZodNullable<z.ZodString>;
392
- stepId: z.ZodString;
393
- modelIdBefore: z.ZodNullable<z.ZodString>;
394
- keys: z.ZodReadonly<z.ZodArray<z.ZodString>>;
395
- }, z.core.$strip>;
396
- export declare const DetectorStoreClearSchema: z.ZodObject<{
397
- deviceId: z.ZodNumber;
398
- keys: z.ZodReadonly<z.ZodArray<z.ZodString>>;
399
- }, z.core.$strip>;
384
+ /**
385
+ * Every model and model-bound threshold lives on the accelerator that runs it
386
+ * (D927), so the plan writes node / device entries only — there is no camera
387
+ * layer for it to clear.
388
+ */
400
389
  export declare const AutoTuneWarningSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
401
- kind: z.ZodLiteral<"detector-store-cluster-wide">;
402
- skippedNodes: z.ZodReadonly<z.ZodArray<z.ZodString>>;
403
- }, z.core.$strip>, z.ZodObject<{
404
- kind: z.ZodLiteral<"detector-store-unreadable">;
405
- error: z.ZodString;
406
- }, z.core.$strip>, z.ZodObject<{
407
390
  kind: z.ZodLiteral<"custom-pin-kept">;
408
391
  nodeId: z.ZodString;
409
- deviceKey: z.ZodNullable<z.ZodString>;
410
- deviceId: z.ZodNullable<z.ZodNumber>;
392
+ deviceKey: z.ZodString;
411
393
  modelId: z.ZodString;
412
394
  }, z.core.$strip>, z.ZodObject<{
413
395
  kind: z.ZodLiteral<"custom-registry-unreadable">;
@@ -596,33 +578,10 @@ export declare const AutoTunePlanSchema: z.ZodObject<{
596
578
  keys: z.ZodReadonly<z.ZodArray<z.ZodString>>;
597
579
  }, z.core.$strip>>>;
598
580
  }, z.core.$strip>>>;
599
- cameraClears: z.ZodReadonly<z.ZodArray<z.ZodObject<{
600
- deviceId: z.ZodNumber;
601
- source: z.ZodEnum<{
602
- "step-override": "step-override";
603
- wholesale: "wholesale";
604
- }>;
605
- nodeId: z.ZodString;
606
- deviceKey: z.ZodNullable<z.ZodString>;
607
- stepId: z.ZodString;
608
- modelIdBefore: z.ZodNullable<z.ZodString>;
609
- keys: z.ZodReadonly<z.ZodArray<z.ZodString>>;
610
- }, z.core.$strip>>>;
611
- detectorStoreClears: z.ZodReadonly<z.ZodArray<z.ZodObject<{
612
- deviceId: z.ZodNumber;
613
- keys: z.ZodReadonly<z.ZodArray<z.ZodString>>;
614
- }, z.core.$strip>>>;
615
581
  warnings: z.ZodReadonly<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
616
- kind: z.ZodLiteral<"detector-store-cluster-wide">;
617
- skippedNodes: z.ZodReadonly<z.ZodArray<z.ZodString>>;
618
- }, z.core.$strip>, z.ZodObject<{
619
- kind: z.ZodLiteral<"detector-store-unreadable">;
620
- error: z.ZodString;
621
- }, z.core.$strip>, z.ZodObject<{
622
582
  kind: z.ZodLiteral<"custom-pin-kept">;
623
583
  nodeId: z.ZodString;
624
- deviceKey: z.ZodNullable<z.ZodString>;
625
- deviceId: z.ZodNullable<z.ZodNumber>;
584
+ deviceKey: z.ZodString;
626
585
  modelId: z.ZodString;
627
586
  }, z.core.$strip>, z.ZodObject<{
628
587
  kind: z.ZodLiteral<"custom-registry-unreadable">;
@@ -636,8 +595,6 @@ export declare const AutoTuneApplyInputSchema: z.ZodObject<{
636
595
  }, z.core.$strip>;
637
596
  export declare const AutoTunePhaseResultSchema: z.ZodObject<{
638
597
  phase: z.ZodEnum<{
639
- "camera-overrides": "camera-overrides";
640
- "detector-thresholds": "detector-thresholds";
641
598
  download: "download";
642
599
  "node-models": "node-models";
643
600
  redispatch: "redispatch";
@@ -650,8 +607,6 @@ export declare const AutoTuneApplyResultSchema: z.ZodDiscriminatedUnion<[z.ZodOb
650
607
  planHash: z.ZodString;
651
608
  phases: z.ZodReadonly<z.ZodArray<z.ZodObject<{
652
609
  phase: z.ZodEnum<{
653
- "camera-overrides": "camera-overrides";
654
- "detector-thresholds": "detector-thresholds";
655
610
  download: "download";
656
611
  "node-models": "node-models";
657
612
  redispatch: "redispatch";
@@ -663,8 +618,6 @@ export declare const AutoTuneApplyResultSchema: z.ZodDiscriminatedUnion<[z.ZodOb
663
618
  kind: z.ZodLiteral<"aborted">;
664
619
  phases: z.ZodReadonly<z.ZodArray<z.ZodObject<{
665
620
  phase: z.ZodEnum<{
666
- "camera-overrides": "camera-overrides";
667
- "detector-thresholds": "detector-thresholds";
668
621
  download: "download";
669
622
  "node-models": "node-models";
670
623
  redispatch: "redispatch";
@@ -853,33 +806,10 @@ export declare const AutoTuneApplyResultSchema: z.ZodDiscriminatedUnion<[z.ZodOb
853
806
  keys: z.ZodReadonly<z.ZodArray<z.ZodString>>;
854
807
  }, z.core.$strip>>>;
855
808
  }, z.core.$strip>>>;
856
- cameraClears: z.ZodReadonly<z.ZodArray<z.ZodObject<{
857
- deviceId: z.ZodNumber;
858
- source: z.ZodEnum<{
859
- "step-override": "step-override";
860
- wholesale: "wholesale";
861
- }>;
862
- nodeId: z.ZodString;
863
- deviceKey: z.ZodNullable<z.ZodString>;
864
- stepId: z.ZodString;
865
- modelIdBefore: z.ZodNullable<z.ZodString>;
866
- keys: z.ZodReadonly<z.ZodArray<z.ZodString>>;
867
- }, z.core.$strip>>>;
868
- detectorStoreClears: z.ZodReadonly<z.ZodArray<z.ZodObject<{
869
- deviceId: z.ZodNumber;
870
- keys: z.ZodReadonly<z.ZodArray<z.ZodString>>;
871
- }, z.core.$strip>>>;
872
809
  warnings: z.ZodReadonly<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
873
- kind: z.ZodLiteral<"detector-store-cluster-wide">;
874
- skippedNodes: z.ZodReadonly<z.ZodArray<z.ZodString>>;
875
- }, z.core.$strip>, z.ZodObject<{
876
- kind: z.ZodLiteral<"detector-store-unreadable">;
877
- error: z.ZodString;
878
- }, z.core.$strip>, z.ZodObject<{
879
810
  kind: z.ZodLiteral<"custom-pin-kept">;
880
811
  nodeId: z.ZodString;
881
- deviceKey: z.ZodNullable<z.ZodString>;
882
- deviceId: z.ZodNullable<z.ZodNumber>;
812
+ deviceKey: z.ZodString;
883
813
  modelId: z.ZodString;
884
814
  }, z.core.$strip>, z.ZodObject<{
885
815
  kind: z.ZodLiteral<"custom-registry-unreadable">;
@@ -898,8 +828,6 @@ export type AutoTuneApplyInput = z.infer<typeof AutoTuneApplyInputSchema>;
898
828
  export type AutoTuneApplyResult = z.infer<typeof AutoTuneApplyResultSchema>;
899
829
  export type AutoTunePhaseResult = z.infer<typeof AutoTunePhaseResultSchema>;
900
830
  export type AutoTuneWarning = z.infer<typeof AutoTuneWarningSchema>;
901
- export type DetectorStoreClear = z.infer<typeof DetectorStoreClearSchema>;
902
- export type AutoTuneCameraOverrideClear = z.infer<typeof CameraOverrideClearSchema>;
903
831
  export type AutoTuneNodeDeviceChange = z.infer<typeof NodeDeviceChangeSchema>;
904
832
  export type HardwareClassId = z.infer<typeof HardwareClassIdSchema>;
905
833
  export type AcceleratorKind = z.infer<typeof AcceleratorKindSchema>;
@@ -1,13 +1,13 @@
1
1
  /**
2
2
  * The layers of a detection step's settings, and the field-level edits on them
3
- * (D754).
3
+ * (D754, D927).
4
4
  *
5
- * A step's settings reach a session through up to three stored layers, merged
6
- * key by key — a key in a higher layer wins:
5
+ * A step's settings reach a session through two stored layers, merged key by
6
+ * key — a key in the higher layer wins:
7
7
  *
8
- * node the node's folded base (`inferenceDevices[node][*].steps`)
9
- * camera `cameraSettings[cam].stepSettings[step]` — every accelerator
10
- * accelerator `cameraSettings[cam].stepOverridesByDevice[node][key][step].settings`
8
+ * node the node's base for the accelerator that runs the step
9
+ * camera `cameraSettings[cam].stepSettings[step]` — camera-semantic
10
+ * keys only, on every accelerator (never a model-bound field)
11
11
  *
12
12
  * Below them sits the default: the running model's (D738) or the field's own.
13
13
  *
@@ -27,12 +27,11 @@
27
27
  export type StepSettingsBag = Readonly<Record<string, unknown>>;
28
28
  /** The stored layers, from the top. `undefined` = the layer stores nothing for this step. */
29
29
  export interface StepSettingsLayers {
30
- readonly accelerator?: StepSettingsBag;
31
30
  readonly camera?: StepSettingsBag;
32
31
  readonly node?: StepSettingsBag;
33
32
  }
34
33
  /** Which stored layer supplies a field, or `default` when none does. */
35
- export type StepSettingSource = 'accelerator' | 'camera' | 'node' | 'default';
34
+ export type StepSettingSource = 'camera' | 'node' | 'default';
36
35
  /**
37
36
  * The keys one field occupies in a bag: its own, plus its binding key when it
38
37
  * binds to a model. `boundKeys` = `collectModelBoundKeys(schema)`.
@@ -1,14 +1,3 @@
1
- /**
2
- * Zod schemas for persisted record types.
3
- *
4
- * These schemas serve as the single source of truth for types that are
5
- * stored in the settings-store backend and retrieved via tRPC. They
6
- * replace the manual TypeScript interfaces with schema-derived types,
7
- * enabling runtime validation when reading from the backend.
8
- *
9
- * Convention: each schema is named `<Type>Schema`, the inferred TS type
10
- * keeps the original name for backward compatibility.
11
- */
12
1
  import { z } from 'zod';
13
2
  import { DeviceType } from '../device/device-type.js';
14
3
  /**
@@ -141,6 +130,71 @@ export declare const TokenScopeSchema: z.ZodPreprocess<z.ZodDiscriminatedUnion<[
141
130
  includeLinked: z.ZodOptional<z.ZodBoolean>;
142
131
  }, z.core.$strip>], "type">>;
143
132
  export type TokenScope = z.infer<typeof TokenScopeSchema>;
133
+ /**
134
+ * What a PERSON's grant set holds (D921): the capability rows above (legacy
135
+ * users, integration-style tokens) or the viewer row, which is decided by its
136
+ * own rules alone. Kept apart from {@link TokenScope} so every surface that
137
+ * edits capability rows (the scope picker, token minting) keeps its shape.
138
+ */
139
+ export declare const UserScopeSchema: z.ZodUnion<readonly [z.ZodObject<{
140
+ type: z.ZodLiteral<"viewer">;
141
+ allow: z.ZodUnion<readonly [z.ZodLiteral<"*">, z.ZodArray<z.ZodNumber>]>;
142
+ block: z.ZodArray<z.ZodNumber>;
143
+ features: z.ZodArray<z.ZodEnum<{
144
+ "face-assignment": "face-assignment";
145
+ "plate-assignment": "plate-assignment";
146
+ retrain: "retrain";
147
+ scenes: "scenes";
148
+ }>>;
149
+ }, z.core.$strip>, z.ZodPreprocess<z.ZodDiscriminatedUnion<[z.ZodObject<{
150
+ type: z.ZodLiteral<"category">;
151
+ target: z.ZodEnum<{
152
+ device: "device";
153
+ system: "system";
154
+ }>;
155
+ access: z.ZodArray<z.ZodEnum<{
156
+ create: "create";
157
+ delete: "delete";
158
+ view: "view";
159
+ }>>;
160
+ }, z.core.$strip>, z.ZodObject<{
161
+ type: z.ZodLiteral<"capability">;
162
+ target: z.ZodString;
163
+ access: z.ZodArray<z.ZodEnum<{
164
+ create: "create";
165
+ delete: "delete";
166
+ view: "view";
167
+ }>>;
168
+ }, z.core.$strip>, z.ZodObject<{
169
+ type: z.ZodLiteral<"addon">;
170
+ target: z.ZodString;
171
+ access: z.ZodArray<z.ZodEnum<{
172
+ create: "create";
173
+ delete: "delete";
174
+ view: "view";
175
+ }>>;
176
+ }, z.core.$strip>, z.ZodObject<{
177
+ type: z.ZodLiteral<"device">;
178
+ selector: z.ZodDiscriminatedUnion<[z.ZodObject<{
179
+ kind: z.ZodLiteral<"all">;
180
+ }, z.core.$strip>, z.ZodObject<{
181
+ kind: z.ZodLiteral<"ids">;
182
+ ids: z.ZodArray<z.ZodNumber>;
183
+ }, z.core.$strip>, z.ZodObject<{
184
+ kind: z.ZodLiteral<"types">;
185
+ types: z.ZodArray<z.ZodEnum<typeof DeviceType>>;
186
+ }, z.core.$strip>, z.ZodObject<{
187
+ kind: z.ZodLiteral<"locations">;
188
+ locations: z.ZodArray<z.ZodString>;
189
+ }, z.core.$strip>], "kind">;
190
+ access: z.ZodArray<z.ZodEnum<{
191
+ create: "create";
192
+ delete: "delete";
193
+ view: "view";
194
+ }>>;
195
+ includeLinked: z.ZodOptional<z.ZodBoolean>;
196
+ }, z.core.$strip>], "type">>]>;
197
+ export type UserScope = z.infer<typeof UserScopeSchema>;
144
198
  /** The `device`-typed member of {@link TokenScope}, narrowed for matchers. */
145
199
  export type DeviceTokenScope = z.infer<typeof DeviceTokenScopeSchema>;
146
200
  export declare const UserRecordSchema: z.ZodObject<{
@@ -150,7 +204,17 @@ export declare const UserRecordSchema: z.ZodObject<{
150
204
  isAdmin: z.ZodDefault<z.ZodBoolean>;
151
205
  allowedProviders: z.ZodUnion<readonly [z.ZodLiteral<"*">, z.ZodArray<z.ZodString>]>;
152
206
  allowedDevices: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<"*">, z.ZodArray<z.ZodString>]>>;
153
- scopes: z.ZodDefault<z.ZodArray<z.ZodPreprocess<z.ZodDiscriminatedUnion<[z.ZodObject<{
207
+ scopes: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
208
+ type: z.ZodLiteral<"viewer">;
209
+ allow: z.ZodUnion<readonly [z.ZodLiteral<"*">, z.ZodArray<z.ZodNumber>]>;
210
+ block: z.ZodArray<z.ZodNumber>;
211
+ features: z.ZodArray<z.ZodEnum<{
212
+ "face-assignment": "face-assignment";
213
+ "plate-assignment": "plate-assignment";
214
+ retrain: "retrain";
215
+ scenes: "scenes";
216
+ }>>;
217
+ }, z.core.$strip>, z.ZodPreprocess<z.ZodDiscriminatedUnion<[z.ZodObject<{
154
218
  type: z.ZodLiteral<"category">;
155
219
  target: z.ZodEnum<{
156
220
  device: "device";
@@ -197,7 +261,7 @@ export declare const UserRecordSchema: z.ZodObject<{
197
261
  view: "view";
198
262
  }>>;
199
263
  includeLinked: z.ZodOptional<z.ZodBoolean>;
200
- }, z.core.$strip>], "type">>>>;
264
+ }, z.core.$strip>], "type">>]>>>;
201
265
  createdAt: z.ZodNumber;
202
266
  updatedAt: z.ZodNumber;
203
267
  }, z.core.$strip>;
@@ -13,7 +13,14 @@
13
13
  *
14
14
  * No I/O, no registry — the fleet + parentage are passed in.
15
15
  */
16
- import type { DeviceSelector, DeviceTokenScope, MethodAccess, TokenScope } from './auth-records.js';
16
+ import type { DeviceSelector, DeviceTokenScope, MethodAccess, TokenScope, UserScope } from './auth-records.js';
17
+ import { type ViewerFeatureId, type ViewerTokenScope } from '../auth/viewer-access.js';
18
+ /**
19
+ * The viewer grant that decides this principal, or `null`. A set holding one
20
+ * is decided by it ALONE (D921): the first viewer row wins, the rest of the
21
+ * set is ignored, so a leftover grant can never widen a viewer.
22
+ */
23
+ export declare function viewerScopeOf(scopes: readonly UserScope[]): ViewerTokenScope | null;
17
24
  /** The minimal device shape selectors resolve against. */
18
25
  export interface DeviceMetaLike {
19
26
  readonly id: number;
@@ -39,7 +46,12 @@ export declare function scopeInherits(scope: DeviceTokenScope, access: MethodAcc
39
46
  * grant inherits) against an ancestor, so a parent grant covers its
40
47
  * accessories.
41
48
  */
42
- export declare function resolveViewableDeviceIds(scopes: readonly TokenScope[], fleet: readonly DeviceMetaLike[], access: MethodAccess): Set<number>;
49
+ export declare function resolveViewableDeviceIds(scopes: readonly UserScope[], fleet: readonly DeviceMetaLike[], access: MethodAccess): Set<number>;
50
+ /**
51
+ * The capability rows of a set — a viewer row (D921) dropped. For surfaces
52
+ * that edit or display capability rows and have no meaning for a viewer row.
53
+ */
54
+ export declare function grantRowsOf(scopes: readonly UserScope[]): TokenScope[];
43
55
  /**
44
56
  * Normalise a raw scope array read off a JWT payload or a stored record into
45
57
  * validated v3 `TokenScope`s, migrating any v2 `device:targets` grant on the
@@ -51,7 +63,7 @@ export declare function resolveViewableDeviceIds(scopes: readonly TokenScope[],
51
63
  * a lockout, and a lockout reads as broken. A non-array input yields `[]`
52
64
  * (fail closed).
53
65
  */
54
- export declare function normalizeTokenScopes(raw: unknown): TokenScope[];
66
+ export declare function normalizeTokenScopes(raw: unknown): UserScope[];
55
67
  /** A capability/addon grant flattened for the UI. */
56
68
  export interface ScopeGrantSummary {
57
69
  readonly name: string;
@@ -70,6 +82,13 @@ export interface DeviceReachSummary {
70
82
  */
71
83
  export interface EffectiveScope {
72
84
  readonly isAdmin: boolean;
85
+ /**
86
+ * `admin`, `viewer` (D921), or `scoped` — a legacy grant set decided by the
87
+ * pre-D921 matcher until the operator converts it.
88
+ */
89
+ readonly role: 'admin' | 'viewer' | 'scoped';
90
+ /** The features granted to a viewer; empty for every other role. */
91
+ readonly features: readonly ViewerFeatureId[];
73
92
  /** true iff every device is viewable (admin, `category:device[view]`, or a
74
93
  * device grant with an `all` selector). */
75
94
  readonly allDevicesViewable: boolean;
@@ -85,4 +104,4 @@ export interface EffectiveScope {
85
104
  readonly addons: readonly ScopeGrantSummary[];
86
105
  }
87
106
  /** Build the {@link EffectiveScope} for a caller from their scopes + the fleet. */
88
- export declare function summarizeEffectiveScope(scopes: readonly TokenScope[], fleet: readonly DeviceMetaLike[], isAdmin: boolean): EffectiveScope;
107
+ export declare function summarizeEffectiveScope(scopes: readonly UserScope[], fleet: readonly DeviceMetaLike[], isAdmin: boolean): EffectiveScope;
@@ -1,4 +1,4 @@
1
- const require_event_category = require("./event-category-7AwNbPjm.js");
1
+ const require_event_category = require("./event-category-CXrwjC3e.js");
2
2
  let zod = require("zod");
3
3
  //#region src/audio/audio-chunk-format.ts
4
4
  /**
@@ -6175,6 +6175,7 @@ function method(input, output, options) {
6175
6175
  kind: options?.kind ?? "query",
6176
6176
  ...options?.auth !== void 0 ? { auth: options.auth } : {},
6177
6177
  ...options?.access !== void 0 ? { access: options.access } : {},
6178
+ ...options?.role !== void 0 ? { role: options.role } : {},
6178
6179
  ...options?.caller !== void 0 ? { caller: options.caller } : {},
6179
6180
  timeoutMs: options?.timeoutMs
6180
6181
  };
@@ -7539,10 +7540,7 @@ function createDeviceProxy(api, binding, opts) {
7539
7540
  setCameraStepToggle: (input) => dispatchSystem("pipelineOrchestrator", "setCameraStepToggle", "mutation", input),
7540
7541
  getCameraDetectionSource: (input) => dispatchSystem("pipelineOrchestrator", "getCameraDetectionSource", "query", input),
7541
7542
  setCameraDetectionSource: (input) => dispatchSystem("pipelineOrchestrator", "setCameraDetectionSource", "mutation", input),
7542
- getCameraStepOverrides: (input) => dispatchSystem("pipelineOrchestrator", "getCameraStepOverrides", "query", input),
7543
- setCameraStepOverride: (input) => dispatchSystem("pipelineOrchestrator", "setCameraStepOverride", "mutation", input),
7544
7543
  setCameraStepSettings: (input) => dispatchSystem("pipelineOrchestrator", "setCameraStepSettings", "mutation", input),
7545
- setCameraPipelineForAgent: (input) => dispatchSystem("pipelineOrchestrator", "setCameraPipelineForAgent", "mutation", input),
7546
7544
  resolvePipeline: (input) => dispatchSystem("pipelineOrchestrator", "resolvePipeline", "query", input),
7547
7545
  getCameraSwitches: (input) => dispatchSystem("pipelineOrchestrator", "getCameraSwitches", "query", input),
7548
7546
  setCameraSwitch: (input) => dispatchSystem("pipelineOrchestrator", "setCameraSwitch", "mutation", input),
@@ -1,4 +1,4 @@
1
- import { t as EventCategory } from "./event-category-BfJwUd2S.mjs";
1
+ import { t as EventCategory } from "./event-category-fDPduoeC.mjs";
2
2
  import { z } from "zod";
3
3
  //#region src/audio/audio-chunk-format.ts
4
4
  /**
@@ -6175,6 +6175,7 @@ function method(input, output, options) {
6175
6175
  kind: options?.kind ?? "query",
6176
6176
  ...options?.auth !== void 0 ? { auth: options.auth } : {},
6177
6177
  ...options?.access !== void 0 ? { access: options.access } : {},
6178
+ ...options?.role !== void 0 ? { role: options.role } : {},
6178
6179
  ...options?.caller !== void 0 ? { caller: options.caller } : {},
6179
6180
  timeoutMs: options?.timeoutMs
6180
6181
  };
@@ -7539,10 +7540,7 @@ function createDeviceProxy(api, binding, opts) {
7539
7540
  setCameraStepToggle: (input) => dispatchSystem("pipelineOrchestrator", "setCameraStepToggle", "mutation", input),
7540
7541
  getCameraDetectionSource: (input) => dispatchSystem("pipelineOrchestrator", "getCameraDetectionSource", "query", input),
7541
7542
  setCameraDetectionSource: (input) => dispatchSystem("pipelineOrchestrator", "setCameraDetectionSource", "mutation", input),
7542
- getCameraStepOverrides: (input) => dispatchSystem("pipelineOrchestrator", "getCameraStepOverrides", "query", input),
7543
- setCameraStepOverride: (input) => dispatchSystem("pipelineOrchestrator", "setCameraStepOverride", "mutation", input),
7544
7543
  setCameraStepSettings: (input) => dispatchSystem("pipelineOrchestrator", "setCameraStepSettings", "mutation", input),
7545
- setCameraPipelineForAgent: (input) => dispatchSystem("pipelineOrchestrator", "setCameraPipelineForAgent", "mutation", input),
7546
7544
  resolvePipeline: (input) => dispatchSystem("pipelineOrchestrator", "resolvePipeline", "query", input),
7547
7545
  getCameraSwitches: (input) => dispatchSystem("pipelineOrchestrator", "getCameraSwitches", "query", input),
7548
7546
  setCameraSwitch: (input) => dispatchSystem("pipelineOrchestrator", "setCameraSwitch", "mutation", input),
@@ -9,39 +9,21 @@
9
9
  * 2. Camera opts in or out of specific addonIds via a boolean overlay
10
10
  * (`stepToggles`). Absent = inherit agent. Present = force.
11
11
  *
12
- * 3. Escape hatch: camera can pin a full pipeline wholesale for a
13
- * specific agent via `pipelineByAgent[agentNodeId]`. When set, it
14
- * bypasses addonDefaults + stepToggles entirely.
12
+ * 3. A model is chosen by the accelerator that runs it (D927): a camera
13
+ * turns steps on or off and may carry camera-semantic step settings,
14
+ * never a model, a model-bound threshold or a tree of its own.
15
15
  *
16
16
  * The resolver walks this chain and emits the existing
17
17
  * `CameraPipelineConfig` shape that the runner consumes — no changes
18
18
  * required downstream of the orchestrator.
19
19
  */
20
- import type { CameraPipelineConfig } from './camera-pipeline.js';
21
20
  import type { NodeColorId } from '../node-color.js';
22
- /**
23
- * LEGACY per-addon configuration (the removed per-node model layer,
24
- * `agent.addonDefaults[addonId]`). Retained ONLY for the one-shot boot
25
- * migration that strips `addonDefaults`, and for UI/library code pending
26
- * the per-(node,device) rework. New code carries model/settings per
27
- * `(node,device)` via {@link DeviceStepConfig}.
28
- *
29
- * modelId present ONLY when the operator explicitly chose a model;
30
- * absent = use this node's format default (resolved on-the-fly by the
31
- * provider).
32
- */
33
- export interface AgentAddonConfig {
34
- readonly enabled: boolean;
35
- readonly modelId?: string;
36
- readonly settings: Readonly<Record<string, unknown>>;
37
- }
38
21
  /**
39
22
  * Per-(node,device) BASE provisioning for one step: the model + intrinsic
40
23
  * settings the executing node applies for EVERY camera landing on that
41
24
  * accelerator. Both fields optional — absent = the executor resolves its own
42
- * format default at runtime. This is the same shape carried by the
43
- * per-camera-device OVERRIDE ({@link CameraStepOverridePatch}); the dispatch
44
- * provisioning stage merges override on top of base (`override ?? base`).
25
+ * format default at runtime. The ONE authority over which model a step runs
26
+ * on an accelerator (D927) — no camera layer overrides it.
45
27
  */
46
28
  export interface DeviceStepConfig {
47
29
  readonly modelId?: string;
@@ -55,17 +37,6 @@ export interface DeviceStepConfig {
55
37
  */
56
38
  readonly jumpDeviceKey?: string;
57
39
  }
58
- /**
59
- * Per-(camera,node,device,step) override patch over the per-(node,device)
60
- * base ({@link DeviceStepConfig}). Both fields optional — unset means
61
- * "inherit from the device base". Enablement is NOT carried here: which
62
- * steps run is the per-camera `stepToggles` authority. When `settings` is
63
- * present it merges over the base `settings` (override keys win).
64
- */
65
- export interface CameraStepOverridePatch {
66
- readonly modelId?: string;
67
- readonly settings?: Readonly<Record<string, unknown>>;
68
- }
69
40
  /**
70
41
  * Per-agent pipeline settings. Phase 2f: engine + hwaccel + audio
71
42
  * ownership moved to per-addon global settings (detection-pipeline,
@@ -128,6 +99,15 @@ export interface AgentPipelineSettings {
128
99
  * `assignNodeColorId(nodeId)` when missing.
129
100
  */
130
101
  readonly color?: NodeColorId;
102
+ /**
103
+ * NODE-wide step settings (D927): `[stepId] → { fieldKey → value }`, the
104
+ * content that holds on every accelerator of this node (an allow-list of
105
+ * species, an IoU). Never a model or a model-bound threshold — those belong
106
+ * to the accelerator (`inferenceDevices[key].steps[step]`). Merged under
107
+ * the device's own settings at dispatch; a sibling device entry is never
108
+ * read.
109
+ */
110
+ readonly stepSettings?: Readonly<Record<string, Readonly<Record<string, unknown>>>>;
131
111
  /**
132
112
  * Multi-device inference opt-in (Phase 4 multi-device). Maps a device key
133
113
  * (`openvino:npu`, `openvino:gpu`, `edgetpu:usb`, `edgetpu:usb:1`, `cpu`, …
@@ -142,8 +122,8 @@ export interface AgentPipelineSettings {
142
122
  *
143
123
  * `steps` (per-(node,device) BASE provisioning) — an optional
144
124
  * `stepId → {modelId?, settings?}` map: the default model + intrinsic
145
- * settings for EVERY camera landing on that accelerator, overridable
146
- * per-camera via `cameraSettings.stepOverridesByDevice`. A stepId ABSENT ⇒
125
+ * settings for EVERY camera landing on that accelerator (no camera layer
126
+ * overrides the model, D927). A stepId ABSENT ⇒
147
127
  * that step uses the device format default. A pinned modelId MUST have a
148
128
  * build for the device's FORMAT, else the executor's `resolveInputSteps`
149
129
  * substitutes it back to the format default (the UI only offers
@@ -166,40 +146,27 @@ export interface AgentPipelineSettings {
166
146
  export interface CameraPipelineSettings {
167
147
  readonly stepToggles?: Readonly<Record<string, boolean>>;
168
148
  /**
169
- * Camera-wide step SETTINGS (D754): `[addonId] → { fieldKey → value }`, the
170
- * fields this camera overrides on EVERY accelerator it is balanced onto. A
171
- * sparse, field-level bag — a key present here is an override, an absent key
172
- * inherits the node. Merge order at dispatch, per key:
173
- * node (folded base) ⊕ this ⊕ `stepOverridesByDevice[node][deviceKey]`.
174
- * A model-bound field (D738) is always written with its binding key.
175
- * Settings only: a model is a per-accelerator question (formats differ), so
176
- * it stays in `stepOverridesByDevice`.
149
+ * Camera-wide step SETTINGS (D754, narrowed by D927): `[addonId] → { fieldKey
150
+ * → value }`, the CAMERA-SEMANTIC fields this camera overrides on every
151
+ * accelerator it is balanced onto (an allow-list of classes, a zone-driven
152
+ * option). A sparse, field-level bag — a key present here is an override, an
153
+ * absent key inherits the node. Merge order at dispatch, per key:
154
+ * node ⊕ this. Never a model and never a model-bound threshold
155
+ * ({@link isModelScopedStepSettingKey}): those belong to the accelerator that
156
+ * runs the model — the writer refuses them and dispatch ignores a stored one.
177
157
  */
178
158
  readonly stepSettings?: Readonly<Record<string, Readonly<Record<string, unknown>>>>;
179
- /**
180
- * Per-(camera,node,device) model/settings override. Addressed by
181
- * `[agentNodeId][deviceKey][addonId]` because the camera is balanced onto
182
- * one `(node,deviceKey)` per session and a node's accelerators share no
183
- * format. Overrides the per-(node,device) base
184
- * (`inferenceDevices[node][deviceKey].steps`) for one camera on one
185
- * accelerator; the wholesale `pipelineByAgent[agent]` escape hatch, when
186
- * present, still bypasses this. Enablement is orthogonal (`stepToggles`).
187
- */
188
- readonly stepOverridesByDevice?: Readonly<Record<string, Readonly<Record<string, Readonly<Record<string, CameraStepOverridePatch>>>>>>;
189
- /**
190
- * Per-agent wholesale pipeline override. Engine is NOT stored here —
191
- * the override runs under the engine selected on that agent via the
192
- * detection-pipeline addon's global settings. Operator picks steps
193
- * + audio model/enabled only. This keeps the override portable
194
- * across agent-moves and prevents a camera from being pinned to an
195
- * engine the agent doesn't host. `modelId` absent = data-only model
196
- * selection — the executing node resolves its own format default.
197
- */
198
- readonly pipelineByAgent?: Readonly<Record<string, {
199
- readonly steps: CameraPipelineConfig['steps'];
200
- readonly audio: {
201
- readonly modelId?: string;
202
- readonly enabled: boolean;
203
- } | null;
204
- }>>;
205
159
  }
160
+ /**
161
+ * Is `key` a step setting that only the accelerator running the model may
162
+ * carry (D927)? A model id, a model binding (`<key>ModelId`, D738) or a
163
+ * confidence floor (`minConfidence*` — every `bindsToModel` field). A camera
164
+ * layer never stores one: the floor of one model is wrong on the next, and a
165
+ * camera does not know which accelerator — or which model — it lands on.
166
+ * (Per-camera thresholds are a possible future extension, see D927.)
167
+ */
168
+ export declare function isModelScopedStepSettingKey(key: string): boolean;
169
+ /** The keys of `bag` a camera layer may not carry ({@link isModelScopedStepSettingKey}), sorted. */
170
+ export declare function modelScopedStepSettingKeys(bag: Readonly<Record<string, unknown>>): string[];
171
+ /** `bag` without its model-scoped keys — what a camera layer contributes at dispatch. Fresh object. */
172
+ export declare function cameraScopedStepSettings(bag: Readonly<Record<string, unknown>>): Record<string, unknown>;