@camstack/types 1.2.402 → 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 (40) 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 +1 -1
  8. package/dist/capabilities/pipeline-analytics.cap.d.ts +79 -0
  9. package/dist/capabilities/plate-gallery.cap.d.ts +3 -0
  10. package/dist/capabilities/scene-monitor.cap.d.ts +3 -0
  11. package/dist/capabilities/user-management.cap.d.ts +108 -18
  12. package/dist/client.js +7 -0
  13. package/dist/client.mjs +7 -0
  14. package/dist/clips/clip-event-labels.d.ts +96 -0
  15. package/dist/device/cap-vocabulary/entries/actuators.d.ts +5 -0
  16. package/dist/device/cap-vocabulary/entries/appliances.d.ts +5 -0
  17. package/dist/device/cap-vocabulary/entries/camera.d.ts +5 -0
  18. package/dist/device/cap-vocabulary/entries/sensors.d.ts +5 -0
  19. package/dist/device/cap-vocabulary/entries/system.d.ts +8 -0
  20. package/dist/device/cap-vocabulary/index.d.ts +9 -0
  21. package/dist/device/cap-vocabulary/l10n.d.ts +7 -0
  22. package/dist/device/cap-vocabulary/resolve.d.ts +100 -0
  23. package/dist/device/cap-vocabulary/templates.d.ts +11 -0
  24. package/dist/device/cap-vocabulary/types.d.ts +398 -0
  25. package/dist/device/cap-vocabulary/vocabulary.d.ts +5 -0
  26. package/dist/device/device-do-actions.d.ts +8 -2
  27. package/dist/generated/addon-api.d.ts +38 -0
  28. package/dist/generated/method-access-map.d.ts +3 -0
  29. package/dist/index.d.ts +6 -2
  30. package/dist/index.js +7323 -1909
  31. package/dist/index.mjs +7294 -1910
  32. package/dist/interfaces/api-responses.d.ts +1 -1
  33. package/dist/interfaces/auth.d.ts +2 -2
  34. package/dist/interfaces/birth-decision-ledger.d.ts +17 -0
  35. package/dist/schemas/auth-records.d.ts +77 -13
  36. package/dist/schemas/device-selector.d.ts +23 -4
  37. package/dist/{sleep-CUp20JkO.mjs → sleep-6AqUnQIT.mjs} +1 -0
  38. package/dist/{sleep-DVovpDRU.js → sleep-Ch67uumJ.js} +1 -0
  39. package/dist/types/detection.d.ts +9 -0
  40. 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;
@@ -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;
@@ -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
  };
@@ -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
  };
@@ -545,6 +545,15 @@ export interface FrameResult {
545
545
  * track keeps it so a later replay can name the original model (D646).
546
546
  */
547
547
  readonly rootModelId?: string;
548
+ /**
549
+ * The inference DEVICE the root ran on (`openvino:npu`, `edgetpu:pci`,
550
+ * `onnx:webgpu` …) — the pool the dispatch actually used, stamped beside
551
+ * {@link rootModelId}. A session can hop node or device between on-motion
552
+ * sessions (D916), so a stored track keeps the device of the frame that
553
+ * opened it and of the sighting that closed it. Absent on a frame no
554
+ * pipeline root produced, and from a runner older than the field.
555
+ */
556
+ readonly rootDeviceKey?: string;
548
557
  /**
549
558
  * The `package-detection` root RAN on this frame and was not shed — the
550
559
  * motion-settle governor dispatched it. The only way a consumer can tell
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/types",
3
- "version": "1.2.402",
3
+ "version": "1.2.403",
4
4
  "description": "Shared types, interfaces, and model catalogs for the CamStack detection ecosystem",
5
5
  "keywords": [
6
6
  "camstack",