@camstack/types 1.2.46 → 1.2.48

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 (37) hide show
  1. package/dist/addon.js +4 -3
  2. package/dist/addon.mjs +4 -3
  3. package/dist/{fmp4-box-splitter-B53u9-Nu.mjs → canonical-hash-rO1sRmEK.mjs} +34 -34
  4. package/dist/capabilities/core-blocks.cap.d.ts +52 -0
  5. package/dist/capabilities/device-manager.cap.d.ts +11 -427
  6. package/dist/capabilities/face-gallery.cap.d.ts +4 -0
  7. package/dist/capabilities/index.d.ts +2 -2
  8. package/dist/capabilities/motion-detection.cap.d.ts +6 -1
  9. package/dist/capabilities/notification-rules.cap.d.ts +24 -24
  10. package/dist/capabilities/oauth-integration.cap.d.ts +4 -0
  11. package/dist/capabilities/osd-manager.cap.d.ts +12 -12
  12. package/dist/capabilities/pipeline-analytics.cap.d.ts +7 -1
  13. package/dist/capabilities/sso-bridge.cap.d.ts +3 -0
  14. package/dist/capabilities/stream-broker.cap.d.ts +1 -0
  15. package/dist/capabilities/user-management.cap.d.ts +3 -1
  16. package/dist/capabilities/videoclips.cap.d.ts +5 -0
  17. package/dist/device/declared-device.d.ts +197 -0
  18. package/dist/device/device-binding.d.ts +15 -9
  19. package/dist/device/device-management.d.ts +1 -83
  20. package/dist/device/index.d.ts +20 -19
  21. package/dist/expression/binding-source.d.ts +85 -0
  22. package/dist/expression/{link-expression.d.ts → expression-source.d.ts} +22 -13
  23. package/dist/expression/index.d.ts +17 -14
  24. package/dist/expression/limits.d.ts +1 -1
  25. package/dist/generated/addon-api.d.ts +11 -11
  26. package/dist/generated/device-proxy.d.ts +1 -1
  27. package/dist/generated/system-proxy.d.ts +1 -1
  28. package/dist/index.d.ts +9 -8
  29. package/dist/index.js +2361 -2058
  30. package/dist/index.mjs +2336 -2044
  31. package/dist/node.js +7 -7
  32. package/dist/node.mjs +1 -1
  33. package/dist/{sleep-BbYwFLG6.mjs → sleep-7WqNZVcL.mjs} +0 -1
  34. package/dist/{sleep-CyN9nHr_.js → sleep-ocMLM2o5.js} +0 -1
  35. package/package.json +1 -1
  36. package/dist/device/device-link-transform.d.ts +0 -5
  37. package/dist/{fmp4-box-splitter-BkWH7O3L.js → canonical-hash-DNV8S5ET.js} +33 -33
@@ -99,10 +99,10 @@ export declare const NcOccupancyConditionSchema: z.ZodObject<{
99
99
  zoneId: z.ZodOptional<z.ZodString>;
100
100
  className: z.ZodOptional<z.ZodString>;
101
101
  op: z.ZodDefault<z.ZodEnum<{
102
- "<=": "<=";
103
- ">=": ">=";
104
102
  "became-occupied": "became-occupied";
105
103
  "became-free": "became-free";
104
+ ">=": ">=";
105
+ "<=": "<=";
106
106
  }>>;
107
107
  count: z.ZodDefault<z.ZodNumber>;
108
108
  sustainSeconds: z.ZodDefault<z.ZodNumber>;
@@ -358,10 +358,10 @@ export declare const NcConditionsSchema: z.ZodObject<{
358
358
  zoneId: z.ZodOptional<z.ZodString>;
359
359
  className: z.ZodOptional<z.ZodString>;
360
360
  op: z.ZodDefault<z.ZodEnum<{
361
- "<=": "<=";
362
- ">=": ">=";
363
361
  "became-occupied": "became-occupied";
364
362
  "became-free": "became-free";
363
+ ">=": ">=";
364
+ "<=": "<=";
365
365
  }>>;
366
366
  count: z.ZodDefault<z.ZodNumber>;
367
367
  sustainSeconds: z.ZodDefault<z.ZodNumber>;
@@ -525,10 +525,10 @@ export declare const NcRuleInputSchema: z.ZodObject<{
525
525
  zoneId: z.ZodOptional<z.ZodString>;
526
526
  className: z.ZodOptional<z.ZodString>;
527
527
  op: z.ZodDefault<z.ZodEnum<{
528
- "<=": "<=";
529
- ">=": ">=";
530
528
  "became-occupied": "became-occupied";
531
529
  "became-free": "became-free";
530
+ ">=": ">=";
531
+ "<=": "<=";
532
532
  }>>;
533
533
  count: z.ZodDefault<z.ZodNumber>;
534
534
  sustainSeconds: z.ZodDefault<z.ZodNumber>;
@@ -705,10 +705,10 @@ export declare const NcRulePatchSchema: z.ZodObject<{
705
705
  zoneId: z.ZodOptional<z.ZodString>;
706
706
  className: z.ZodOptional<z.ZodString>;
707
707
  op: z.ZodDefault<z.ZodEnum<{
708
- "<=": "<=";
709
- ">=": ">=";
710
708
  "became-occupied": "became-occupied";
711
709
  "became-free": "became-free";
710
+ ">=": ">=";
711
+ "<=": "<=";
712
712
  }>>;
713
713
  count: z.ZodDefault<z.ZodNumber>;
714
714
  sustainSeconds: z.ZodDefault<z.ZodNumber>;
@@ -878,10 +878,10 @@ export declare const NcRuleSchema: z.ZodObject<{
878
878
  zoneId: z.ZodOptional<z.ZodString>;
879
879
  className: z.ZodOptional<z.ZodString>;
880
880
  op: z.ZodDefault<z.ZodEnum<{
881
- "<=": "<=";
882
- ">=": ">=";
883
881
  "became-occupied": "became-occupied";
884
882
  "became-free": "became-free";
883
+ ">=": ">=";
884
+ "<=": "<=";
885
885
  }>>;
886
886
  count: z.ZodDefault<z.ZodNumber>;
887
887
  sustainSeconds: z.ZodDefault<z.ZodNumber>;
@@ -1371,10 +1371,10 @@ export declare const notificationRulesCapability: {
1371
1371
  zoneId: z.ZodOptional<z.ZodString>;
1372
1372
  className: z.ZodOptional<z.ZodString>;
1373
1373
  op: z.ZodDefault<z.ZodEnum<{
1374
- "<=": "<=";
1375
- ">=": ">=";
1376
1374
  "became-occupied": "became-occupied";
1377
1375
  "became-free": "became-free";
1376
+ ">=": ">=";
1377
+ "<=": "<=";
1378
1378
  }>>;
1379
1379
  count: z.ZodDefault<z.ZodNumber>;
1380
1380
  sustainSeconds: z.ZodDefault<z.ZodNumber>;
@@ -1550,10 +1550,10 @@ export declare const notificationRulesCapability: {
1550
1550
  zoneId: z.ZodOptional<z.ZodString>;
1551
1551
  className: z.ZodOptional<z.ZodString>;
1552
1552
  op: z.ZodDefault<z.ZodEnum<{
1553
- "<=": "<=";
1554
- ">=": ">=";
1555
1553
  "became-occupied": "became-occupied";
1556
1554
  "became-free": "became-free";
1555
+ ">=": ">=";
1556
+ "<=": "<=";
1557
1557
  }>>;
1558
1558
  count: z.ZodDefault<z.ZodNumber>;
1559
1559
  sustainSeconds: z.ZodDefault<z.ZodNumber>;
@@ -1727,10 +1727,10 @@ export declare const notificationRulesCapability: {
1727
1727
  zoneId: z.ZodOptional<z.ZodString>;
1728
1728
  className: z.ZodOptional<z.ZodString>;
1729
1729
  op: z.ZodDefault<z.ZodEnum<{
1730
- "<=": "<=";
1731
- ">=": ">=";
1732
1730
  "became-occupied": "became-occupied";
1733
1731
  "became-free": "became-free";
1732
+ ">=": ">=";
1733
+ "<=": "<=";
1734
1734
  }>>;
1735
1735
  count: z.ZodDefault<z.ZodNumber>;
1736
1736
  sustainSeconds: z.ZodDefault<z.ZodNumber>;
@@ -1898,10 +1898,10 @@ export declare const notificationRulesCapability: {
1898
1898
  zoneId: z.ZodOptional<z.ZodString>;
1899
1899
  className: z.ZodOptional<z.ZodString>;
1900
1900
  op: z.ZodDefault<z.ZodEnum<{
1901
- "<=": "<=";
1902
- ">=": ">=";
1903
1901
  "became-occupied": "became-occupied";
1904
1902
  "became-free": "became-free";
1903
+ ">=": ">=";
1904
+ "<=": "<=";
1905
1905
  }>>;
1906
1906
  count: z.ZodDefault<z.ZodNumber>;
1907
1907
  sustainSeconds: z.ZodDefault<z.ZodNumber>;
@@ -2078,10 +2078,10 @@ export declare const notificationRulesCapability: {
2078
2078
  zoneId: z.ZodOptional<z.ZodString>;
2079
2079
  className: z.ZodOptional<z.ZodString>;
2080
2080
  op: z.ZodDefault<z.ZodEnum<{
2081
- "<=": "<=";
2082
- ">=": ">=";
2083
2081
  "became-occupied": "became-occupied";
2084
2082
  "became-free": "became-free";
2083
+ ">=": ">=";
2084
+ "<=": "<=";
2085
2085
  }>>;
2086
2086
  count: z.ZodDefault<z.ZodNumber>;
2087
2087
  sustainSeconds: z.ZodDefault<z.ZodNumber>;
@@ -2250,10 +2250,10 @@ export declare const notificationRulesCapability: {
2250
2250
  zoneId: z.ZodOptional<z.ZodString>;
2251
2251
  className: z.ZodOptional<z.ZodString>;
2252
2252
  op: z.ZodDefault<z.ZodEnum<{
2253
- "<=": "<=";
2254
- ">=": ">=";
2255
2253
  "became-occupied": "became-occupied";
2256
2254
  "became-free": "became-free";
2255
+ ">=": ">=";
2256
+ "<=": "<=";
2257
2257
  }>>;
2258
2258
  count: z.ZodDefault<z.ZodNumber>;
2259
2259
  sustainSeconds: z.ZodDefault<z.ZodNumber>;
@@ -2475,10 +2475,10 @@ export declare const notificationRulesCapability: {
2475
2475
  zoneId: z.ZodOptional<z.ZodString>;
2476
2476
  className: z.ZodOptional<z.ZodString>;
2477
2477
  op: z.ZodDefault<z.ZodEnum<{
2478
- "<=": "<=";
2479
- ">=": ">=";
2480
2478
  "became-occupied": "became-occupied";
2481
2479
  "became-free": "became-free";
2480
+ ">=": ">=";
2481
+ "<=": "<=";
2482
2482
  }>>;
2483
2483
  count: z.ZodDefault<z.ZodNumber>;
2484
2484
  sustainSeconds: z.ZodDefault<z.ZodNumber>;
@@ -47,6 +47,8 @@ declare const OauthIntegrationDescriptorSchema: z.ZodObject<{
47
47
  }>>;
48
48
  }, z.core.$strip>], "type">>;
49
49
  allowedRedirectPrefixes: z.ZodArray<z.ZodString>;
50
+ allowedPrivateHostPaths: z.ZodOptional<z.ZodArray<z.ZodString>>;
51
+ requiresPkce: z.ZodOptional<z.ZodBoolean>;
50
52
  hubUrl: z.ZodOptional<z.ZodString>;
51
53
  }, z.core.$strip>;
52
54
  export declare const oauthIntegrationCapability: {
@@ -95,6 +97,8 @@ export declare const oauthIntegrationCapability: {
95
97
  }>>;
96
98
  }, z.core.$strip>], "type">>;
97
99
  allowedRedirectPrefixes: z.ZodArray<z.ZodString>;
100
+ allowedPrivateHostPaths: z.ZodOptional<z.ZodArray<z.ZodString>>;
101
+ requiresPkce: z.ZodOptional<z.ZodBoolean>;
98
102
  hubUrl: z.ZodOptional<z.ZodString>;
99
103
  }, z.core.$strip>, import("./capability-definition.js").CapabilityMethodKind>;
100
104
  };
@@ -133,10 +133,10 @@ export declare const OsdSlotBindingSchema: z.ZodObject<{
133
133
  zoneId: z.ZodOptional<z.ZodString>;
134
134
  className: z.ZodOptional<z.ZodString>;
135
135
  op: z.ZodDefault<z.ZodEnum<{
136
- "<=": "<=";
137
- ">=": ">=";
138
136
  "became-occupied": "became-occupied";
139
137
  "became-free": "became-free";
138
+ ">=": ">=";
139
+ "<=": "<=";
140
140
  }>>;
141
141
  count: z.ZodDefault<z.ZodNumber>;
142
142
  sustainSeconds: z.ZodDefault<z.ZodNumber>;
@@ -242,10 +242,10 @@ export declare const OsdSlotViewSchema: z.ZodObject<{
242
242
  zoneId: z.ZodOptional<z.ZodString>;
243
243
  className: z.ZodOptional<z.ZodString>;
244
244
  op: z.ZodDefault<z.ZodEnum<{
245
- "<=": "<=";
246
- ">=": ">=";
247
245
  "became-occupied": "became-occupied";
248
246
  "became-free": "became-free";
247
+ ">=": ">=";
248
+ "<=": "<=";
249
249
  }>>;
250
250
  count: z.ZodDefault<z.ZodNumber>;
251
251
  sustainSeconds: z.ZodDefault<z.ZodNumber>;
@@ -423,10 +423,10 @@ export declare const osdManagerCapability: {
423
423
  zoneId: z.ZodOptional<z.ZodString>;
424
424
  className: z.ZodOptional<z.ZodString>;
425
425
  op: z.ZodDefault<z.ZodEnum<{
426
- "<=": "<=";
427
- ">=": ">=";
428
426
  "became-occupied": "became-occupied";
429
427
  "became-free": "became-free";
428
+ ">=": ">=";
429
+ "<=": "<=";
430
430
  }>>;
431
431
  count: z.ZodDefault<z.ZodNumber>;
432
432
  sustainSeconds: z.ZodDefault<z.ZodNumber>;
@@ -615,10 +615,10 @@ export declare const osdManagerCapability: {
615
615
  zoneId: z.ZodOptional<z.ZodString>;
616
616
  className: z.ZodOptional<z.ZodString>;
617
617
  op: z.ZodDefault<z.ZodEnum<{
618
- "<=": "<=";
619
- ">=": ">=";
620
618
  "became-occupied": "became-occupied";
621
619
  "became-free": "became-free";
620
+ ">=": ">=";
621
+ "<=": "<=";
622
622
  }>>;
623
623
  count: z.ZodDefault<z.ZodNumber>;
624
624
  sustainSeconds: z.ZodDefault<z.ZodNumber>;
@@ -723,10 +723,10 @@ export declare const osdManagerCapability: {
723
723
  zoneId: z.ZodOptional<z.ZodString>;
724
724
  className: z.ZodOptional<z.ZodString>;
725
725
  op: z.ZodDefault<z.ZodEnum<{
726
- "<=": "<=";
727
- ">=": ">=";
728
726
  "became-occupied": "became-occupied";
729
727
  "became-free": "became-free";
728
+ ">=": ">=";
729
+ "<=": "<=";
730
730
  }>>;
731
731
  count: z.ZodDefault<z.ZodNumber>;
732
732
  sustainSeconds: z.ZodDefault<z.ZodNumber>;
@@ -851,10 +851,10 @@ export declare const osdManagerCapability: {
851
851
  zoneId: z.ZodOptional<z.ZodString>;
852
852
  className: z.ZodOptional<z.ZodString>;
853
853
  op: z.ZodDefault<z.ZodEnum<{
854
- "<=": "<=";
855
- ">=": ">=";
856
854
  "became-occupied": "became-occupied";
857
855
  "became-free": "became-free";
856
+ ">=": ">=";
857
+ "<=": "<=";
858
858
  }>>;
859
859
  count: z.ZodDefault<z.ZodNumber>;
860
860
  sustainSeconds: z.ZodDefault<z.ZodNumber>;
@@ -202,7 +202,7 @@ export type TrackEnvelope = z.infer<typeof TrackEnvelopeSchema>;
202
202
  * `snapshots[]` references — megabytes across a page of tracks. `slim`
203
203
  * keeps every scalar the list surfaces actually render (ids, class(es),
204
204
  * label / audioLabels / importance enrichment, firstSeen/lastSeen, state,
205
- * zonesVisited, bestEventId, envelope) and returns `positions` /
205
+ * zonesVisited, bestEventId, envelope, hasFace) and returns `positions` /
206
206
  * `snapshots` as EMPTY arrays — detail views re-fetch the full row via
207
207
  * `getTrack`. Mirrors the event-store `projection` convention
208
208
  * (`getObjectEvents` et al.).
@@ -429,6 +429,7 @@ declare const TrackSchema: z.ZodObject<{
429
429
  maxX: z.ZodNumber;
430
430
  maxY: z.ZodNumber;
431
431
  }, z.core.$strip>>;
432
+ hasFace: z.ZodOptional<z.ZodBoolean>;
432
433
  label: z.ZodOptional<z.ZodString>;
433
434
  labelScore: z.ZodOptional<z.ZodNumber>;
434
435
  labelMeta: z.ZodOptional<z.ZodObject<{
@@ -1072,6 +1073,7 @@ declare const RecentTracksPageSchema: z.ZodObject<{
1072
1073
  maxX: z.ZodNumber;
1073
1074
  maxY: z.ZodNumber;
1074
1075
  }, z.core.$strip>>;
1076
+ hasFace: z.ZodOptional<z.ZodBoolean>;
1075
1077
  label: z.ZodOptional<z.ZodString>;
1076
1078
  labelScore: z.ZodOptional<z.ZodNumber>;
1077
1079
  labelMeta: z.ZodOptional<z.ZodObject<{
@@ -1315,6 +1317,7 @@ export declare const pipelineAnalyticsCapability: {
1315
1317
  maxX: z.ZodNumber;
1316
1318
  maxY: z.ZodNumber;
1317
1319
  }, z.core.$strip>>;
1320
+ hasFace: z.ZodOptional<z.ZodBoolean>;
1318
1321
  label: z.ZodOptional<z.ZodString>;
1319
1322
  labelScore: z.ZodOptional<z.ZodNumber>;
1320
1323
  labelMeta: z.ZodOptional<z.ZodObject<{
@@ -1405,6 +1408,7 @@ export declare const pipelineAnalyticsCapability: {
1405
1408
  maxX: z.ZodNumber;
1406
1409
  maxY: z.ZodNumber;
1407
1410
  }, z.core.$strip>>;
1411
+ hasFace: z.ZodOptional<z.ZodBoolean>;
1408
1412
  label: z.ZodOptional<z.ZodString>;
1409
1413
  labelScore: z.ZodOptional<z.ZodNumber>;
1410
1414
  labelMeta: z.ZodOptional<z.ZodObject<{
@@ -1517,6 +1521,7 @@ export declare const pipelineAnalyticsCapability: {
1517
1521
  maxX: z.ZodNumber;
1518
1522
  maxY: z.ZodNumber;
1519
1523
  }, z.core.$strip>>;
1524
+ hasFace: z.ZodOptional<z.ZodBoolean>;
1520
1525
  label: z.ZodOptional<z.ZodString>;
1521
1526
  labelScore: z.ZodOptional<z.ZodNumber>;
1522
1527
  labelMeta: z.ZodOptional<z.ZodObject<{
@@ -1625,6 +1630,7 @@ export declare const pipelineAnalyticsCapability: {
1625
1630
  maxX: z.ZodNumber;
1626
1631
  maxY: z.ZodNumber;
1627
1632
  }, z.core.$strip>>;
1633
+ hasFace: z.ZodOptional<z.ZodBoolean>;
1628
1634
  label: z.ZodOptional<z.ZodString>;
1629
1635
  labelScore: z.ZodOptional<z.ZodNumber>;
1630
1636
  labelMeta: z.ZodOptional<z.ZodObject<{
@@ -61,6 +61,7 @@ declare const SsoBridgeClaimsSchema: z.ZodObject<{
61
61
  redirectUri: z.ZodOptional<z.ZodString>;
62
62
  integrationId: z.ZodOptional<z.ZodString>;
63
63
  jti: z.ZodOptional<z.ZodString>;
64
+ codeChallenge: z.ZodOptional<z.ZodString>;
64
65
  sessionId: z.ZodOptional<z.ZodString>;
65
66
  }, z.core.$strip>;
66
67
  export declare const ssoBridgeCapability: {
@@ -117,6 +118,7 @@ export declare const ssoBridgeCapability: {
117
118
  redirectUri: z.ZodOptional<z.ZodString>;
118
119
  integrationId: z.ZodOptional<z.ZodString>;
119
120
  jti: z.ZodOptional<z.ZodString>;
121
+ codeChallenge: z.ZodOptional<z.ZodString>;
120
122
  sessionId: z.ZodOptional<z.ZodString>;
121
123
  }, z.core.$strip>;
122
124
  ttlSec: z.ZodOptional<z.ZodNumber>;
@@ -172,6 +174,7 @@ export declare const ssoBridgeCapability: {
172
174
  redirectUri: z.ZodOptional<z.ZodString>;
173
175
  integrationId: z.ZodOptional<z.ZodString>;
174
176
  jti: z.ZodOptional<z.ZodString>;
177
+ codeChallenge: z.ZodOptional<z.ZodString>;
175
178
  sessionId: z.ZodOptional<z.ZodString>;
176
179
  }, z.core.$strip>>, import("./capability-definition.js").CapabilityMethodKind>;
177
180
  };
@@ -727,6 +727,7 @@ export declare const streamBrokerCapability: {
727
727
  }>>>;
728
728
  gifMaxWidth: z.ZodDefault<z.ZodNumber>;
729
729
  gifFps: z.ZodDefault<z.ZodNumber>;
730
+ gifSpeed: z.ZodDefault<z.ZodNumber>;
730
731
  speed: z.ZodDefault<z.ZodNumber>;
731
732
  }, z.core.$strip>, z.ZodObject<{
732
733
  media: z.ZodReadonly<z.ZodArray<z.ZodObject<{
@@ -937,12 +937,14 @@ export declare const userManagementCapability: {
937
937
  }, z.core.$strip>], "type">>;
938
938
  redirectUri: z.ZodString;
939
939
  hubUrl: z.ZodString;
940
+ codeChallenge: z.ZodOptional<z.ZodString>;
940
941
  }, z.core.$strip>, z.ZodObject<{
941
942
  code: z.ZodString;
942
943
  }, z.core.$strip>, "mutation">;
943
944
  readonly oauthExchangeCode: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
944
945
  code: z.ZodString;
945
946
  redirectUri: z.ZodString;
947
+ codeVerifier: z.ZodOptional<z.ZodString>;
946
948
  }, z.core.$strip>, z.ZodNullable<z.ZodObject<{
947
949
  accessToken: z.ZodString;
948
950
  refreshToken: z.ZodString;
@@ -1050,4 +1052,4 @@ export declare const userManagementCapability: {
1050
1052
  };
1051
1053
  };
1052
1054
  export type IUserManagementProvider = InferProvider<typeof userManagementCapability>;
1053
- export { UserSummarySchema, CreateUserInputSchema, UpdateUserInputSchema, ApiKeySummarySchema, CreateApiKeyInputSchema, CreateApiKeyResultSchema, ScopedTokenSummarySchema, CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, OauthSessionSummarySchema, };
1055
+ export { ApiKeySummarySchema, CreateApiKeyInputSchema, CreateApiKeyResultSchema, CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, CreateUserInputSchema, OauthSessionSummarySchema, ScopedTokenSummarySchema, UpdateUserInputSchema, UserSummarySchema, };
@@ -1,4 +1,5 @@
1
1
  import { z } from 'zod';
2
+ import { DeviceType } from '../device/device-type.js';
2
3
  import { type InferProvider } from './capability-definition.js';
3
4
  /**
4
5
  * `videoclips` — the unified, navigable-clip surface for a camera.
@@ -42,6 +43,10 @@ export declare const videoclipsCapability: {
42
43
  readonly mode: "singleton";
43
44
  readonly kind: "wrapper";
44
45
  readonly defaultActive: true;
46
+ /** A clip is a window over a camera's footage — the cap is meaningless on a
47
+ * sensor, a button or an event emitter, and the `defaultActive` auto-bind
48
+ * reads this to decide which devices it may claim. */
49
+ readonly deviceTypes: readonly [DeviceType.Camera];
45
50
  readonly methods: {
46
51
  readonly listClips: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
47
52
  deviceId: z.ZodNumber;
@@ -0,0 +1,197 @@
1
+ /**
2
+ * Declared devices — the ownership primitive for a device an addon DECLARES
3
+ * rather than discovers.
4
+ *
5
+ * A provider adopts what a vendor reports. A *declaration* is the other shape:
6
+ * a device exists because an addon says so, in code, on every boot. The NC
7
+ * alarm panel is the live instance of it (device 1023) and, until this module,
8
+ * the only one — hand-rolled inline with eight injected dependencies.
9
+ *
10
+ * What this owns, and why each part is here rather than at the call site:
11
+ *
12
+ * - **Idempotence.** `reconcile` is `get-or-create` on `(addonId, stableId)`
13
+ * and is safe to run on every boot and on every convergence tick. Nothing
14
+ * here is one-shot.
15
+ * - **Reconcile, not one-shot (D49).** The destructive branch — "the index does
16
+ * not list it, so CREATE it with its declared meta" — re-stamps the declared
17
+ * name over an operator's rename. It therefore requires a SECOND read of the
18
+ * index to agree before it runs. A read that fails changes nothing at all:
19
+ * the pass aborts, and the next one converges.
20
+ * - **The name follows the authority.** A declared device's name is seeded ONCE,
21
+ * at create. Every later pass adopts without meta, because a rename belongs to
22
+ * the operator and re-stamping it every boot is the losing half of two writers
23
+ * (D62).
24
+ * - **`fixed` is re-asserted every pass.** The defect the hand-rolled version
25
+ * shipped with wrote `info.fixed` only on the create path, so an install that
26
+ * already had the integration never received the flag — the kernel kept
27
+ * allowing its deletion. Get-or-create is not enough for a flag; it has to be
28
+ * re-asserted.
29
+ * - **Withdrawal is cleanup.** A declaration removed from the code removes its
30
+ * device, bounded to the addon's own FIXED integration and logged per device.
31
+ * Nothing outside that integration is ever touched.
32
+ * - **One owner node.** An addon that runs on every node must not race to own a
33
+ * cluster singleton. The default placement is `'hub'`.
34
+ *
35
+ * What this deliberately does NOT own: writing a declared device's STATE. The
36
+ * authority for a cap slice is already `deviceState.setCapSlice` (via
37
+ * `BaseDevice.runtimeState` / `ctx.fetchDevice(id)`). A third alias for it would
38
+ * be a second writer of a value that already has one.
39
+ */
40
+ import type { IScopedLogger } from '../interfaces/logging.js';
41
+ import type { IDevice } from './device.js';
42
+ import type { DeviceConstructor, DeviceManagerApi } from './device-context.js';
43
+ import type { DeviceType } from './device-type.js';
44
+ /** Marker written to a declared integration's `info`. */
45
+ export declare const DECLARED_INTEGRATION_FIXED_KEY = "fixed";
46
+ /** One row of the addon's own device index, as `deviceManager.listAll` reports it. */
47
+ export interface DeclaredDeviceRow {
48
+ readonly id: number;
49
+ readonly stableId: string;
50
+ readonly integrationId?: string | null;
51
+ }
52
+ /** An integration as the integrations store reports it. */
53
+ export interface DeclaredIntegrationRow {
54
+ readonly id: string;
55
+ readonly info?: Record<string, unknown> | null;
56
+ }
57
+ /**
58
+ * The narrow surface `DeclaredDevices` drives.
59
+ *
60
+ * Ports rather than a whole `AddonContext` for one reason that has cost this
61
+ * repo twice: a fake of the whole context supplies values production forgets to
62
+ * fetch. Five named operations can be faked without inventing behaviour.
63
+ */
64
+ export interface DeclaredDevicePorts {
65
+ readonly logger: IScopedLogger;
66
+ /** The declaring addon's id — the owner half of `(addonId, stableId)`. */
67
+ readonly addonId: string;
68
+ /** `ctx.kernel.devices`. */
69
+ readonly devices: DeviceManagerApi;
70
+ /** `ctx.kernel.localNodeId`. A forked child reads `<node>/<addon>`. */
71
+ readonly localNodeId?: string | undefined;
72
+ /** `integrations.getByAddonId` — null when this addon has none yet. */
73
+ readonly getIntegration: (addonId: string) => Promise<DeclaredIntegrationRow | null>;
74
+ readonly createIntegration: (input: {
75
+ addonId: string;
76
+ name: string;
77
+ info: Record<string, unknown>;
78
+ }) => Promise<{
79
+ readonly id: string;
80
+ }>;
81
+ /** Merge `info` onto an EXISTING integration. Used to re-assert `fixed`. */
82
+ readonly updateIntegration: (input: {
83
+ id: string;
84
+ info: Record<string, unknown>;
85
+ }) => Promise<void>;
86
+ /**
87
+ * Every device row this addon owns.
88
+ *
89
+ * FALLIBLE on purpose: this is the read the D49 discipline applies to. It may
90
+ * throw, and it may transiently answer `[]` while the registry is cold — which
91
+ * is indistinguishable from "the operator deleted everything".
92
+ */
93
+ readonly listOwnDevices: () => Promise<readonly DeclaredDeviceRow[]>;
94
+ }
95
+ /** One device an addon declares. */
96
+ export interface DeviceDeclaration<T extends IDevice = IDevice> {
97
+ /** Stable within the addon, never derived from the name — a rename must not
98
+ * mint a second device. */
99
+ readonly stableId: string;
100
+ /** Seeded ONCE, at create. Never re-stamped (D62). */
101
+ readonly name: string;
102
+ readonly type: DeviceType;
103
+ readonly DeviceClass: DeviceConstructor<T>;
104
+ /** Initial config blob, written before the constructor runs. Create only. */
105
+ readonly config?: Record<string, unknown>;
106
+ /** Optional semantic role, stamped at create alongside the type. */
107
+ readonly role?: string;
108
+ }
109
+ /** Where the declaration is owned. */
110
+ export type DeclarationPlacement = 'hub' | 'this-node';
111
+ export interface DeclaredDevicesSpec {
112
+ /** Display name of the FIXED integration the devices hang from. */
113
+ readonly integrationName: string;
114
+ readonly devices: readonly DeviceDeclaration[];
115
+ /**
116
+ * Default `'hub'`: a declaration is cluster state and belongs to the node
117
+ * that is always there. `'this-node'` is for a declaration that is genuinely
118
+ * per-node.
119
+ */
120
+ readonly placement?: DeclarationPlacement;
121
+ }
122
+ export interface DeclaredDeviceOutcome {
123
+ readonly stableId: string;
124
+ readonly deviceId: number;
125
+ readonly device: IDevice;
126
+ /** True only on the boot that created it — the operator sees one line, once. */
127
+ readonly created: boolean;
128
+ }
129
+ export interface DeclaredDevicesResult {
130
+ /** Null when this node does not own the declaration (see `placement`). */
131
+ readonly integrationId: string | null;
132
+ readonly devices: readonly DeclaredDeviceOutcome[];
133
+ /** Device ids removed because their declaration was withdrawn. */
134
+ readonly removed: readonly number[];
135
+ /** False when the placement gate skipped this node entirely. */
136
+ readonly owned: boolean;
137
+ }
138
+ /**
139
+ * Strip the `<node>/<addon>` suffix a forked child carries.
140
+ *
141
+ * Comparing `ctx.kernel.localNodeId` raw skipped EVERY node — including the one
142
+ * that was supposed to act — because on the hub it reads `hub/<addon>`.
143
+ */
144
+ export declare function declarationOwnerNodeId(localNodeId: string | undefined): string;
145
+ /** Cap on how many rows one withdrawal pass may delete. */
146
+ export declare const DECLARED_DEVICE_SWEEP_LIMIT = 32;
147
+ /**
148
+ * The one way an addon owns a device it declares.
149
+ *
150
+ * Construct once with the addon's ports, then call {@link reconcile} on boot and
151
+ * on every convergence tick. There is no second get-or-create helper — a guard
152
+ * in `scripts/` enforces that.
153
+ */
154
+ export declare class DeclaredDevices {
155
+ private readonly ports;
156
+ constructor(ports: DeclaredDevicePorts);
157
+ /**
158
+ * Converge the declared set. Idempotent, and safe to call repeatedly.
159
+ *
160
+ * Throws only what the ports throw on the FIRST index read; every other
161
+ * failure is per-device and logged, so one bad declaration never takes the
162
+ * others down.
163
+ */
164
+ reconcile(spec: DeclaredDevicesSpec): Promise<DeclaredDevicesResult>;
165
+ /**
166
+ * Get-or-create the FIXED integration, and RE-ASSERT the flag every pass.
167
+ *
168
+ * The re-assertion is the fix for the defect the hand-rolled version shipped
169
+ * with: writing `info.fixed` only on the create path left every pre-existing
170
+ * install without it, and the kernel kept offering to delete an integration
171
+ * the addon owns.
172
+ */
173
+ private ensureIntegration;
174
+ private readIndex;
175
+ /**
176
+ * One declaration: adopt what exists, create what does not.
177
+ *
178
+ * The create branch is the destructive one — it seeds `initialMeta`, and
179
+ * `initialMeta.name` lands as an unconditional `setName`. A transiently empty
180
+ * index therefore looks exactly like a first boot and would silently re-stamp
181
+ * the declared name over the operator's rename. D49: that branch needs a
182
+ * second read to agree.
183
+ */
184
+ private applyDeclaration;
185
+ /**
186
+ * Remove rows under the addon's FIXED integration whose declaration is gone.
187
+ *
188
+ * Bounded to that integration: a declared integration has no operator
189
+ * add-flow, so every row under it got there by declaration. Devices this
190
+ * addon owns OUTSIDE it (a provider's adopted devices) are never candidates.
191
+ *
192
+ * Bounded in count, and every deletion is logged with its `deviceId` — a
193
+ * withdrawal that removes an operator-visible row silently is the failure
194
+ * mode, not the removal itself.
195
+ */
196
+ private sweepWithdrawn;
197
+ }
@@ -6,19 +6,25 @@
6
6
  */
7
7
  export interface DeviceBindingEntry {
8
8
  capName: string;
9
- /** `native`/`wrapped` = a real provider serves the cap. `linked` = the cap
10
- * is SYNTHESIZED from device-links (no provider the getStatus dispatcher
11
- * routes to device-manager's resolveLinkedStatus). UI metadata only
12
- * consumers must never branch on it for routing (D13). */
13
- kind: 'native' | 'wrapped' | 'linked';
9
+ /**
10
+ * Which shape of provider serves the cap. UI metadata only — consumers must
11
+ * never branch on it for routing (D13); resolve a `(cap, device)` pair
12
+ * through `getProviderForDevice`.
13
+ *
14
+ * There were three. `linked` denoted a cap SYNTHESIZED from device-links with
15
+ * no provider at all, and it existed so a link-only cap would still render a
16
+ * panel — a fifth binding kind and a virtual-binding path the kernel paid for
17
+ * one feature. Wiring was deleted on 2026-08-08 (0 links across 302 devices)
18
+ * and the kind went with it: a composed device's caps are native to it, so
19
+ * nothing needs to be synthesized out of nowhere.
20
+ */
21
+ kind: 'native' | 'wrapped';
14
22
  /** Currently-active provider. For kind='native', equal to `nativeAddonId`.
15
- * For kind='wrapped', the wrapper addon id. For kind='linked', the
16
- * device-manager addon id (the synthesize owner). */
23
+ * For kind='wrapped', the wrapper addon id. */
17
24
  providerAddonId: string;
18
25
  /** Node where the active provider runs. 'hub' for native; may vary for wrappers. */
19
26
  providerNodeId: string;
20
- /** Always the addon id of the underlying native provider for the device.
21
- * Empty for kind='linked' (no native exists). */
27
+ /** Always the addon id of the underlying native provider for the device. */
22
28
  nativeAddonId: string;
23
29
  }
24
30
  export interface DeviceBinding {