@camstack/types 1.2.406 → 1.2.408

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 (45) hide show
  1. package/dist/capabilities/battery.cap.d.ts +46 -0
  2. package/dist/capabilities/capability-definition.d.ts +8 -0
  3. package/dist/capabilities/composer.cap.d.ts +22 -0
  4. package/dist/capabilities/consumables.cap.d.ts +110 -0
  5. package/dist/capabilities/customize-catalog.d.ts +72 -0
  6. package/dist/capabilities/customize-spec.d.ts +202 -0
  7. package/dist/capabilities/doorbell.cap.d.ts +39 -0
  8. package/dist/capabilities/index.d.ts +3 -3
  9. package/dist/capabilities/motion.cap.d.ts +39 -0
  10. package/dist/capabilities/running-state.cap.d.ts +68 -4
  11. package/dist/catalogs/sensor-active-state.d.ts +1 -1
  12. package/dist/client.js +1 -1
  13. package/dist/client.mjs +1 -1
  14. package/dist/composition/customize/__fixtures__/refs.d.ts +27 -0
  15. package/dist/composition/customize/__fixtures__/stored-cases.d.ts +13 -0
  16. package/dist/composition/customize/event-compile.d.ts +20 -0
  17. package/dist/composition/customize/event-decode.d.ts +19 -0
  18. package/dist/composition/customize/event-eval.d.ts +35 -0
  19. package/dist/composition/customize/event-status.d.ts +49 -0
  20. package/dist/composition/customize/field-source.d.ts +5 -0
  21. package/dist/composition/customize/keyed-array-compile.d.ts +26 -0
  22. package/dist/composition/customize/keyed-array-decode.d.ts +20 -0
  23. package/dist/composition/customize/keyed-array-expr.d.ts +10 -0
  24. package/dist/composition/customize/keyed-array-status.d.ts +22 -0
  25. package/dist/composition/customize/normalize.d.ts +4 -0
  26. package/dist/composition/customize/override-draft.d.ts +311 -0
  27. package/dist/composition/customize/scalar-compile.d.ts +13 -0
  28. package/dist/composition/customize/scalar-decode.d.ts +17 -0
  29. package/dist/composition/customize/scalar-expr.d.ts +33 -0
  30. package/dist/composition/customize/scalar-status.d.ts +31 -0
  31. package/dist/composition/customize/stored.d.ts +15 -0
  32. package/dist/composition/index.d.ts +0 -1
  33. package/dist/{composition-xz-ud5EQ.mjs → composition-BJ8iAZb3.mjs} +1 -1
  34. package/dist/{composition-RmnnN39T.js → composition-CSLSFGTO.js} +1 -1
  35. package/dist/generated/customize-catalog.d.ts +229 -0
  36. package/dist/index.d.ts +14 -1
  37. package/dist/index.js +2277 -292
  38. package/dist/index.mjs +2254 -288
  39. package/dist/node.js +1 -1
  40. package/dist/node.mjs +1 -1
  41. package/dist/running-state/defaults.d.ts +3 -0
  42. package/dist/running-state/from-operation.d.ts +4 -4
  43. package/package.json +1 -1
  44. package/dist/composition/presets/doorbell-feature.d.ts +0 -20
  45. package/dist/running-state/assignment.d.ts +0 -34
@@ -160,6 +160,52 @@ export declare const batteryCapability: {
160
160
  };
161
161
  };
162
162
  };
163
+ readonly customize: {
164
+ readonly version: 1;
165
+ readonly targets: readonly [{
166
+ readonly id: 'percentage';
167
+ readonly cardinality: 'scalar';
168
+ readonly vocabulary: {
169
+ readonly cap: 'battery';
170
+ readonly stateField: 'percentage';
171
+ };
172
+ readonly deviceTypes: readonly [DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.Thermostat];
173
+ readonly apply: 'add-or-replace';
174
+ readonly path: 'percentage';
175
+ readonly sources: readonly [{
176
+ readonly kind: 'field';
177
+ readonly valueKinds: readonly ["number", "string"];
178
+ readonly transforms: readonly [{
179
+ readonly kind: 'identity';
180
+ }, {
181
+ readonly kind: 'linear';
182
+ readonly defaultScale: 1;
183
+ readonly defaultOffset: 0;
184
+ readonly clampMin: 0;
185
+ readonly clampMax: 100;
186
+ }];
187
+ }];
188
+ readonly companions: readonly [{
189
+ readonly kind: 'constant';
190
+ readonly path: 'charging';
191
+ readonly value: 'unknown';
192
+ readonly when: 'add';
193
+ }, {
194
+ readonly kind: 'constant';
195
+ readonly path: 'sleeping';
196
+ readonly value: false;
197
+ readonly when: 'add';
198
+ }, {
199
+ readonly kind: 'clock';
200
+ readonly path: 'lastUpdated';
201
+ readonly when: 'add';
202
+ }];
203
+ readonly sourceReport: {
204
+ readonly status: 'assignment-status';
205
+ };
206
+ readonly advancedExpression: true;
207
+ }];
208
+ };
163
209
  /** Clock fields: written, but excluded from the compare that decides
164
210
  * whether persisting is worth a SQLite commit. */
165
211
  readonly volatileStateFields: readonly ["lastUpdated"];
@@ -16,6 +16,7 @@ import { DeviceType } from '../device/device-type.js';
16
16
  import type { ConfigUISchemaWithValues } from '../interfaces/config-ui.js';
17
17
  import type { ExtensionSlotDescriptor } from '../device-extension/slot-descriptor.js';
18
18
  import type { MethodRoleDecl } from '../auth/viewer-access.js';
19
+ import type { CapabilityCustomizeSpec } from './customize-spec.js';
19
20
  /**
20
21
  * tRPC procedure kind.
21
22
  * - 'query': read-only, no side effects
@@ -650,6 +651,13 @@ export interface CapabilityDefinition<TName extends string = string, TMethods ex
650
651
  * `generated/history-catalog.ts`.
651
652
  */
652
653
  readonly history?: CapabilityHistory;
654
+ /**
655
+ * Generic Customize override (D936). When present, admin-ui offers the
656
+ * declared targets instead of a cap-specific card. Codegen projects it
657
+ * into `generated/customize-catalog.ts`. `scripts/check-customize-declaration.ts`
658
+ * rejects a path, type or vocabulary the cap does not have.
659
+ */
660
+ readonly customize?: CapabilityCustomizeSpec;
653
661
  /**
654
662
  * Declarative settings spec. When present, the device-manager's
655
663
  * settings aggregator auto-derives the ConfigUISchema and routes
@@ -123,6 +123,14 @@ export declare const ComposerUnreadableBlockSchema: z.ZodObject<{
123
123
  error: z.ZodString;
124
124
  }, z.core.$strip>;
125
125
  export type ComposerUnreadableBlock = z.infer<typeof ComposerUnreadableBlockSchema>;
126
+ /** A confirmed release the hub did not accept. `deviceId` is the claim's device. */
127
+ export declare const UnreleasedClaimSchema: z.ZodObject<{
128
+ deviceId: z.ZodNumber;
129
+ capName: z.ZodString;
130
+ owner: z.ZodString;
131
+ error: z.ZodString;
132
+ }, z.core.$strip>;
133
+ export type UnreleasedClaim = z.infer<typeof UnreleasedClaimSchema>;
126
134
  export declare const ComposerApplyInputSchema: z.ZodObject<{
127
135
  integrationId: z.ZodNullable<z.ZodString>;
128
136
  storeLoaded: z.ZodBoolean;
@@ -233,6 +241,7 @@ export declare const ComposerApplyInputSchema: z.ZodObject<{
233
241
  name: z.ZodNullable<z.ZodString>;
234
242
  error: z.ZodString;
235
243
  }, z.core.$strip>>;
244
+ retiredBlockIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
236
245
  }, z.core.$strip>;
237
246
  export type ComposerApplyInput = z.infer<typeof ComposerApplyInputSchema>;
238
247
  export declare const ComposerBlockVerdictSchema: z.ZodObject<{
@@ -260,6 +269,12 @@ export declare const ComposerApplyResultSchema: z.ZodObject<{
260
269
  reason: z.ZodOptional<z.ZodString>;
261
270
  }, z.core.$strip>>;
262
271
  acted: z.ZodBoolean;
272
+ unreleasedClaims: z.ZodOptional<z.ZodArray<z.ZodObject<{
273
+ deviceId: z.ZodNumber;
274
+ capName: z.ZodString;
275
+ owner: z.ZodString;
276
+ error: z.ZodString;
277
+ }, z.core.$strip>>>;
263
278
  }, z.core.$strip>;
264
279
  export type ComposerApplyResult = z.infer<typeof ComposerApplyResultSchema>;
265
280
  export declare const composerCapability: {
@@ -382,6 +397,7 @@ export declare const composerCapability: {
382
397
  name: z.ZodNullable<z.ZodString>;
383
398
  error: z.ZodString;
384
399
  }, z.core.$strip>>;
400
+ retiredBlockIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
385
401
  }, z.core.$strip>, z.ZodObject<{
386
402
  blocks: z.ZodArray<z.ZodObject<{
387
403
  blockId: z.ZodString;
@@ -395,6 +411,12 @@ export declare const composerCapability: {
395
411
  reason: z.ZodOptional<z.ZodString>;
396
412
  }, z.core.$strip>>;
397
413
  acted: z.ZodBoolean;
414
+ unreleasedClaims: z.ZodOptional<z.ZodArray<z.ZodObject<{
415
+ deviceId: z.ZodNumber;
416
+ capName: z.ZodString;
417
+ owner: z.ZodString;
418
+ error: z.ZodString;
419
+ }, z.core.$strip>>>;
398
420
  }, z.core.$strip>, "mutation">;
399
421
  readonly getStates: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
400
422
  blockIds: z.ZodArray<z.ZodString>;
@@ -378,6 +378,116 @@ export declare const consumablesCapability: {
378
378
  * brush's remaining life and a dishwasher's salt are each recorded the moment
379
379
  * their provider reports them; an item that appears later gets its series.
380
380
  */
381
+ readonly customize: {
382
+ version: 1;
383
+ targets: {
384
+ id: string;
385
+ cardinality: "keyedArray";
386
+ vocabulary: {
387
+ cap: string;
388
+ };
389
+ deviceTypes: DeviceType[];
390
+ apply: "add";
391
+ path: string;
392
+ keyField: string;
393
+ labelField: string;
394
+ itemSchema: z.ZodObject<{
395
+ key: z.ZodString;
396
+ label: z.ZodString;
397
+ level: z.ZodNullable<z.ZodNumber>;
398
+ status: z.ZodNullable<z.ZodEnum<{
399
+ empty: "empty";
400
+ full: "full";
401
+ low: "low";
402
+ ok: "ok";
403
+ replace: "replace";
404
+ }>>;
405
+ kind: z.ZodOptional<z.ZodEnum<{
406
+ supply: "supply";
407
+ waste: "waste";
408
+ wear: "wear";
409
+ }>>;
410
+ form: z.ZodOptional<z.ZodEnum<{
411
+ bin: "bin";
412
+ part: "part";
413
+ product: "product";
414
+ tank: "tank";
415
+ }>>;
416
+ lastResetAt: z.ZodNullable<z.ZodNumber>;
417
+ resettable: z.ZodBoolean;
418
+ remaining: z.ZodOptional<z.ZodObject<{
419
+ value: z.ZodNullable<z.ZodNumber>;
420
+ unit: z.ZodEnum<{
421
+ cycles: "cycles";
422
+ days: "days";
423
+ hours: "hours";
424
+ }>;
425
+ }, z.core.$strip>>;
426
+ }, z.core.$strip>;
427
+ nativeItems: "read-only";
428
+ sourceReport: {
429
+ status: "assignment-status";
430
+ };
431
+ fields: ({
432
+ path: string;
433
+ sources: {
434
+ kind: "numeric";
435
+ transforms: ({
436
+ kind: "identity";
437
+ defaultScale?: undefined;
438
+ defaultOffset?: undefined;
439
+ clampMin?: undefined;
440
+ clampMax?: undefined;
441
+ } | {
442
+ kind: "linear";
443
+ defaultScale: number;
444
+ defaultOffset: number;
445
+ clampMin: number;
446
+ clampMax: number;
447
+ })[];
448
+ }[];
449
+ literals?: undefined;
450
+ } | {
451
+ path: string;
452
+ sources: {
453
+ kind: "numeric";
454
+ transforms: {
455
+ kind: "identity";
456
+ }[];
457
+ }[];
458
+ literals: {
459
+ path: string;
460
+ values: ("cycles" | "days" | "hours")[];
461
+ }[];
462
+ } | {
463
+ literals?: undefined;
464
+ path: string;
465
+ sources: {
466
+ kind: "enum";
467
+ transforms: {
468
+ kind: "enum-map";
469
+ outputValues: ("empty" | "full" | "low" | "ok" | "replace")[];
470
+ unmapped: null;
471
+ }[];
472
+ }[];
473
+ })[];
474
+ traits: ({
475
+ path: string;
476
+ values: ("supply" | "waste" | "wear")[];
477
+ defaultValue: string;
478
+ } | {
479
+ path: string;
480
+ values: ("bin" | "part" | "product" | "tank")[];
481
+ defaultValue: string;
482
+ })[];
483
+ companions: {
484
+ kind: "clock";
485
+ path: string;
486
+ when: "add";
487
+ }[];
488
+ advancedExpression: true;
489
+ }[];
490
+ };
381
491
  readonly history: {
382
492
  readonly fields: {};
383
493
  readonly items: {
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Serializable Customize catalog (D936). No Zod objects: admin-ui and the
3
+ * server read this projection, not the cap module.
4
+ */
5
+ import type { DeviceType } from '../device/device-type.js';
6
+ import type { CameraSensorCustomizeMode, CustomizeApplyAuthority, CustomizeApplyMode, CustomizeCardinality, CustomizeCompanion, CustomizeEventEdge, CustomizeSourceReport, CustomizeValueKind } from './customize-spec.js';
7
+ export type CustomizeCatalogValueKind = 'boolean' | 'number' | 'string' | 'enum';
8
+ export interface CustomizeCatalogSource {
9
+ readonly kind: string;
10
+ readonly valueKinds?: readonly CustomizeValueKind[];
11
+ readonly transformKinds: readonly string[];
12
+ readonly requiredUnit?: string;
13
+ }
14
+ export interface CustomizeCatalogLiteral {
15
+ readonly path: string;
16
+ readonly values: readonly string[];
17
+ }
18
+ export interface CustomizeCatalogTrait {
19
+ readonly path: string;
20
+ readonly values: readonly string[];
21
+ readonly defaultValue: string;
22
+ }
23
+ export interface CustomizeCatalogField {
24
+ readonly path: string;
25
+ readonly valueKind: CustomizeCatalogValueKind;
26
+ readonly nullable: boolean;
27
+ readonly enumValues?: readonly string[];
28
+ readonly sources: readonly CustomizeCatalogSource[];
29
+ readonly literals?: readonly CustomizeCatalogLiteral[];
30
+ }
31
+ export interface CustomizeCatalogTarget {
32
+ readonly id: string;
33
+ readonly cardinality: CustomizeCardinality;
34
+ readonly shape?: 'pulse' | 'span';
35
+ readonly path?: string;
36
+ readonly valueKind?: CustomizeCatalogValueKind;
37
+ readonly nullable?: boolean;
38
+ readonly enumValues?: readonly string[];
39
+ readonly keyField?: string;
40
+ readonly labelField?: string;
41
+ readonly fields?: readonly CustomizeCatalogField[];
42
+ readonly traits?: readonly CustomizeCatalogTrait[];
43
+ readonly nativeItems?: 'read-only';
44
+ readonly deviceTypes: readonly DeviceType[];
45
+ readonly apply: CustomizeApplyMode;
46
+ /** Absent on a scalar or keyed array: those compile to a composition claim. */
47
+ readonly applyAuthority?: CustomizeApplyAuthority;
48
+ readonly eventName?: string;
49
+ readonly edges?: readonly CustomizeEventEdge[];
50
+ readonly timestampPath?: string;
51
+ readonly counterPath?: string;
52
+ readonly highWater?: 'composer-advance';
53
+ readonly debounceMs?: number;
54
+ readonly combine?: 'any';
55
+ readonly timeoutMs?: number;
56
+ readonly cooldownMs?: number;
57
+ readonly sourceModes?: readonly CameraSensorCustomizeMode[];
58
+ readonly start?: 'rising-edge';
59
+ readonly end?: 'falling-edge-or-timeout';
60
+ readonly vocabularyCap: string;
61
+ readonly vocabularyStateField?: string;
62
+ readonly vocabularyEvent?: string;
63
+ readonly sources: readonly CustomizeCatalogSource[];
64
+ readonly companions?: readonly CustomizeCompanion[];
65
+ readonly sourceReport: CustomizeSourceReport;
66
+ readonly advancedExpression: boolean;
67
+ }
68
+ export interface CustomizeCatalogEntry {
69
+ readonly version: 1;
70
+ readonly targets: readonly CustomizeCatalogTarget[];
71
+ }
72
+ export type CustomizeCatalog = Readonly<Record<string, CustomizeCatalogEntry>>;
@@ -0,0 +1,202 @@
1
+ /**
2
+ * Cap-declared Customize contract (D936).
3
+ *
4
+ * A declaration says what an operator may pick and how the result lands.
5
+ * Codegen projects the serializable catalog; Zod stays in this module and
6
+ * never in the catalog. Names follow the approved design.
7
+ */
8
+ import type { z } from 'zod';
9
+ import type { DeviceType } from '../device/device-type.js';
10
+ export type CustomizeCardinality = 'scalar' | 'keyedArray' | 'event';
11
+ export type CustomizeValueKind = 'boolean' | 'number' | 'string' | 'enum';
12
+ export type CustomizeApplyMode = 'add' | 'replace' | 'add-or-replace';
13
+ export interface CapabilityCustomizeSpec {
14
+ readonly version: 1;
15
+ readonly targets: readonly CapabilityCustomizeTarget[];
16
+ }
17
+ export type CapabilityCustomizeTarget = ScalarCustomizeTarget | KeyedArrayCustomizeTarget | EventCustomizeTarget;
18
+ export interface CustomizeVocabularyRef {
19
+ readonly cap: string;
20
+ readonly stateField?: string;
21
+ readonly eventName?: string;
22
+ }
23
+ export interface CustomizeTargetBase {
24
+ readonly id: string;
25
+ readonly vocabulary: CustomizeVocabularyRef;
26
+ readonly deviceTypes?: readonly DeviceType[];
27
+ readonly apply: CustomizeApplyMode;
28
+ readonly sourceReport: CustomizeSourceReport;
29
+ readonly advancedExpression?: boolean;
30
+ }
31
+ export type CustomizeSourceSpec = SwitchSourceSpec | BinarySourceSpec | NumericSourceSpec | EnumSourceSpec | FieldSourceSpec;
32
+ export interface SwitchSourceSpec {
33
+ readonly kind: 'switch';
34
+ readonly transforms: readonly SwitchTransformSpec[];
35
+ }
36
+ export interface BinarySourceSpec {
37
+ readonly kind: 'binary';
38
+ readonly transforms: readonly BinaryTransformSpec[];
39
+ }
40
+ export interface NumericSourceSpec {
41
+ readonly kind: 'numeric';
42
+ readonly requiredUnit?: string;
43
+ readonly transforms: readonly NumericTransformSpec[];
44
+ }
45
+ export interface EnumSourceSpec {
46
+ readonly kind: 'enum';
47
+ readonly transforms: readonly EnumTransformSpec[];
48
+ }
49
+ export interface FieldSourceSpec {
50
+ readonly kind: 'field';
51
+ readonly valueKinds: readonly CustomizeValueKind[];
52
+ readonly transforms: readonly CustomizeTransformSpec[];
53
+ }
54
+ export interface IdentityTransformSpec {
55
+ readonly kind: 'identity';
56
+ }
57
+ export interface InvertTransformSpec {
58
+ readonly kind: 'invert';
59
+ }
60
+ export interface ThresholdTransformSpec {
61
+ readonly kind: 'threshold';
62
+ readonly comparison: 'gte' | 'lte';
63
+ readonly defaultThreshold: number;
64
+ readonly defaultStartDwellMs: number;
65
+ readonly defaultStopDwellMs: number;
66
+ readonly thresholdUnit?: string;
67
+ }
68
+ export interface LinearTransformSpec {
69
+ readonly kind: 'linear';
70
+ readonly defaultScale: number;
71
+ readonly defaultOffset: number;
72
+ readonly clampMin?: number;
73
+ readonly clampMax?: number;
74
+ }
75
+ export interface EnumMapTransformSpec {
76
+ readonly kind: 'enum-map';
77
+ readonly outputValues: readonly string[];
78
+ readonly unmapped: null | string;
79
+ }
80
+ export interface RisingEdgeTransformSpec {
81
+ readonly kind: 'rising-edge';
82
+ readonly defaultDebounceMs: number;
83
+ readonly changedAtRequired: true;
84
+ }
85
+ export type SwitchTransformSpec = IdentityTransformSpec;
86
+ export type BinaryTransformSpec = IdentityTransformSpec | InvertTransformSpec;
87
+ /** A pulse or span reads a level, or an event the source cap already emits. */
88
+ export interface EventSourceSpec {
89
+ readonly kind: 'switch' | 'binary' | 'native-event';
90
+ }
91
+ export type CustomizeEventEdge = 'rising' | 'button' | 'native-event';
92
+ /**
93
+ * Where the compiled target is written. Scalar and keyed-array targets use a
94
+ * composition claim. A span may name an authority that already owns the event.
95
+ */
96
+ export type CustomizeApplyAuthority = {
97
+ readonly kind: 'composition-claim';
98
+ } | {
99
+ readonly kind: 'camera-sensors';
100
+ /** The span timeout is this existing pipeline-runner field. */
101
+ readonly timeoutField: 'motionCooldownMs';
102
+ };
103
+ export type NumericTransformSpec = IdentityTransformSpec | ThresholdTransformSpec | LinearTransformSpec;
104
+ export type EnumTransformSpec = IdentityTransformSpec | EnumMapTransformSpec;
105
+ export type CustomizeTransformSpec = IdentityTransformSpec | InvertTransformSpec | ThresholdTransformSpec | LinearTransformSpec | EnumMapTransformSpec;
106
+ export interface CustomizeSourceReport {
107
+ readonly status: 'assignment-status';
108
+ readonly runtimeField?: string;
109
+ readonly nativeValue?: string;
110
+ readonly assignedValue?: string;
111
+ }
112
+ export type CustomizeCompanion = CustomizeConstantCompanion | CustomizeClockCompanion | CustomizeTransitionTimeCompanion;
113
+ export interface CustomizeConstantCompanion {
114
+ readonly kind: 'constant';
115
+ readonly path: string;
116
+ readonly value: string | number | boolean | null;
117
+ readonly when: 'add' | 'always';
118
+ }
119
+ export interface CustomizeClockCompanion {
120
+ readonly kind: 'clock';
121
+ readonly path: string;
122
+ readonly when: 'add' | 'always';
123
+ }
124
+ export interface CustomizeTransitionTimeCompanion {
125
+ readonly kind: 'transition-time';
126
+ readonly path: string;
127
+ readonly sourceChangedAt: 'prefer' | 'ignore';
128
+ }
129
+ export interface ScalarCustomizeTarget extends CustomizeTargetBase {
130
+ readonly cardinality: 'scalar';
131
+ readonly path: string;
132
+ readonly sources: readonly CustomizeSourceSpec[];
133
+ readonly companions?: readonly CustomizeCompanion[];
134
+ }
135
+ /** A closed enum the operator sets on the item. It is not read from a source. */
136
+ export interface KeyedArrayTraitSpec {
137
+ readonly path: string;
138
+ readonly values: readonly string[];
139
+ readonly defaultValue: string;
140
+ }
141
+ /** A closed enum written beside one assigned field (the field's required sibling). */
142
+ export interface KeyedArrayLiteralSpec {
143
+ readonly path: string;
144
+ readonly values: readonly string[];
145
+ }
146
+ export interface KeyedArrayFieldTarget {
147
+ readonly path: string;
148
+ readonly sources: readonly CustomizeSourceSpec[];
149
+ readonly literals?: readonly KeyedArrayLiteralSpec[];
150
+ }
151
+ export interface KeyedArrayCustomizeTarget extends CustomizeTargetBase {
152
+ /**
153
+ * Row schema. Zod stays on the declaration; the catalog projects paths
154
+ * and leaf kinds instead of this object. Loose so a specific item schema
155
+ * assigns (Zod 4 raw shapes do not).
156
+ */
157
+ readonly itemSchema: z.ZodObject<z.core.$ZodLooseShape>;
158
+ readonly cardinality: 'keyedArray';
159
+ readonly path: string;
160
+ readonly keyField: string;
161
+ readonly labelField: string;
162
+ readonly fields: readonly KeyedArrayFieldTarget[];
163
+ readonly traits?: readonly KeyedArrayTraitSpec[];
164
+ readonly companions?: readonly CustomizeCompanion[];
165
+ readonly nativeItems: 'read-only';
166
+ }
167
+ export interface EventCustomizeTargetBase extends CustomizeTargetBase {
168
+ readonly cardinality: 'event';
169
+ readonly eventName: string;
170
+ /** One source firing is enough. */
171
+ readonly combine: 'any';
172
+ readonly sources: readonly EventSourceSpec[];
173
+ readonly applyAuthority: CustomizeApplyAuthority;
174
+ }
175
+ /**
176
+ * A pulse has no duration. A rising edge, a button press or a native event
177
+ * advances a timestamp and a counter. Presses inside `debounce` are one pulse.
178
+ */
179
+ export interface PulseEventCustomizeTarget extends EventCustomizeTargetBase {
180
+ readonly shape: 'pulse';
181
+ readonly edges: readonly CustomizeEventEdge[];
182
+ readonly timestampPath: string;
183
+ readonly counterPath: string;
184
+ /** The composer already tracks this path's advance (D670). */
185
+ readonly highWater: 'composer-advance';
186
+ readonly debounce: RisingEdgeTransformSpec;
187
+ }
188
+ export type CameraSensorCustomizeMode = 'in-addition' | 'confirm' | 'replace';
189
+ /**
190
+ * A span starts on a rising edge and ends on a falling edge or when
191
+ * `timeoutMs` elapses. `cooldownMs` is present only when the authority has a
192
+ * quiet period that is not the timeout.
193
+ */
194
+ export interface SpanEventCustomizeTarget extends EventCustomizeTargetBase {
195
+ readonly shape: 'span';
196
+ readonly start: 'rising-edge';
197
+ readonly end: 'falling-edge-or-timeout';
198
+ readonly timeoutMs: number;
199
+ readonly cooldownMs?: number;
200
+ readonly sourceModes?: readonly CameraSensorCustomizeMode[];
201
+ }
202
+ export type EventCustomizeTarget = PulseEventCustomizeTarget | SpanEventCustomizeTarget;
@@ -1,6 +1,8 @@
1
1
  import { z } from 'zod';
2
2
  import { type InferProvider } from './capability-definition.js';
3
3
  import { DeviceType } from '../device/device-type.js';
4
+ /** A rise closer than this to the previous one is the same press (D671). */
5
+ export declare const DOORBELL_RISE_DEBOUNCE_MS = 2000;
4
6
  export declare const DoorbellStatusSchema: z.ZodObject<{
5
7
  lastPressedAt: z.ZodNullable<z.ZodNumber>;
6
8
  pressCountSinceStart: z.ZodNumber;
@@ -78,5 +80,42 @@ export declare const doorbellCapability: {
78
80
  * History (D850): none — `pressCountSinceStart` resets with the addon, so it is not a monotonic meter; presses live in the events ledger.
79
81
  */
80
82
  readonly history: 'none';
83
+ readonly customize: {
84
+ readonly version: 1;
85
+ readonly targets: readonly [{
86
+ readonly id: 'pressed';
87
+ readonly cardinality: 'event';
88
+ readonly shape: 'pulse';
89
+ readonly vocabulary: {
90
+ readonly cap: 'doorbell';
91
+ readonly eventName: 'onPressed';
92
+ };
93
+ readonly deviceTypes: readonly [DeviceType.Camera];
94
+ readonly apply: 'add';
95
+ readonly applyAuthority: {
96
+ readonly kind: 'composition-claim';
97
+ };
98
+ readonly eventName: 'onPressed';
99
+ readonly edges: readonly ["rising"];
100
+ readonly timestampPath: 'lastPressedAt';
101
+ readonly counterPath: 'pressCountSinceStart';
102
+ readonly highWater: 'composer-advance';
103
+ readonly combine: 'any';
104
+ readonly debounce: {
105
+ readonly kind: 'rising-edge';
106
+ readonly defaultDebounceMs: 2000;
107
+ readonly changedAtRequired: true;
108
+ };
109
+ readonly sources: readonly [{
110
+ readonly kind: 'binary';
111
+ }, {
112
+ readonly kind: 'switch';
113
+ }];
114
+ readonly sourceReport: {
115
+ readonly status: 'assignment-status';
116
+ };
117
+ readonly advancedExpression: true;
118
+ }];
119
+ };
81
120
  };
82
121
  export type IDoorbellProvider = InferProvider<typeof doorbellCapability>;
@@ -38,7 +38,7 @@ export { cameraStreamsCapability, type ICameraStreamsProvider, type PickedCamStr
38
38
  export { emitsCollectionSelector, extractNestedAddonId, isArrayOutputSchema, isCollectionArrayMethod, isObjectInput, isVoidInput, kebabToCamel, looseSchema, objectInputDeclaresAddonId, objectInputDeclaresRequiredDeviceId, procedureAuthKey, resolveMethodAuth, } from './cap-router-predicates.js';
39
39
  export type { CapabilityDefinition, CapabilityEventSchema, CapabilityMethodAuth, CapabilityMethodCaller, CapabilityMethodKind, CapabilityMethodOptions, CapabilityMethodSchema, CapabilityMountHint, CapabilityMountKind, CapabilityStatusItemArray, CapabilityStatusKind, CapabilityStatusSchema, CapCaller, DeviceConfigDerivedFormUi, DeviceConfigSpec, DeviceConfigUiSpec, DeviceConfigWidgetUi, DeviceSettingsContribution, InferDeviceProxyCap, InferEvents, InferName, InferNativeProvider, InferProvider, InferRuntimeState, CapabilityHistory, CapabilityHistoryField, CapabilityHistoryItems, HistoryUnit, ProviderKind, RuntimeStateDurability, UiContribution, UiContributionKind, UiContributionRemote, } from './capability-definition.js';
40
40
  export { DEFAULT_RUNTIME_STATE_DURABILITY, HISTORY_DEFAULT_MIN_INTERVAL_MS, HISTORY_UNIT_LABELS, historyItemFieldPath, DEVICE_SETTINGS_CONTRIBUTION_METHODS, DEVICE_STATUS_METHOD, event, expandCapMethods, isDeviceConfigCap, method, optionalMethod, PROVIDER_PIN_FIELD, resolveCapMount, } from './capability-definition.js';
41
- export { COMPOSER_RUNNER_ID, type ComposerApplyInput, ComposerApplyInputSchema, type ComposerApplyResult, ComposerApplyResultSchema, type ComposerBlock, ComposerBlockSchema, type ComposerBlockVerdict, ComposerBlockVerdictSchema, type ComposerUnreadableBlock, ComposerUnreadableBlockSchema, composerCapability, type IComposerProvider, } from './composer.cap.js';
41
+ export { COMPOSER_RUNNER_ID, type ComposerApplyInput, ComposerApplyInputSchema, type ComposerApplyResult, ComposerApplyResultSchema, type ComposerBlock, ComposerBlockSchema, type ComposerBlockVerdict, ComposerBlockVerdictSchema, type ComposerUnreadableBlock, ComposerUnreadableBlockSchema, composerCapability, type IComposerProvider, type UnreleasedClaim, UnreleasedClaimSchema, } from './composer.cap.js';
42
42
  export { CORE_BLOCK_ADDON_PREFIX, CORE_BLOCKS_ADDON_ID, type CompositionBlockInput, CompositionBlockInputSchema, type CompositionBlockPatch, type CompositionCustomizationRead, CompositionCustomizationReadSchema, type CompositionGetRead, CompositionGetReadSchema, type CompositionListRead, CompositionListReadSchema, type CompositionStateRead, CompositionStateReadSchema, type CompositionView, CompositionViewSchema, type CoreBlock, type CoreBlockCompileInput, CoreBlockCompileInputSchema, type CoreBlockCompileResult, CoreBlockCompileResultSchema, type CoreBlockFiles, CoreBlockFilesSchema, type CoreBlockInput, CoreBlockInputFieldsSchema, CoreBlockInputSchema, type CoreBlockPlacement, CoreBlockPlacementSchema, CoreBlockSchema, type CoreBlockSource, type CoreBlockSourceKind, CoreBlockSourceSchema, type CoreBlockStatus, CoreBlockStatusSchema, coreBlockAddonId, coreBlockComposition, coreBlockIdFromAddonId, coreBlockSourceKind, coreBlocksCapability, DEFAULT_CORE_BLOCK_ENTRY, type ICoreBlocksProvider, normalizeCoreBlockWrite, resolveCoreBlockEntry, resolveCoreBlockFiles, } from './core-blocks.cap.js';
43
43
  export * from './custom-actions.js';
44
44
  export type { CustomModelDescriptor, ICustomModelRegistryProvider, ImportModelBundleInput, ImportModelBundleResult, ModelBundleFile, } from './custom-model-registry.cap.js';
@@ -176,7 +176,7 @@ export { type DeviceDiscoveryStatus, DeviceDiscoveryStatusSchema, type Discovere
176
176
  export { deviceOpsCapability, type IDeviceOpsProvider, type RawStateResult, RawStateResultSchema, } from './device-ops.cap.js';
177
177
  export { type DeviceStatus, DeviceStatusSchema, deviceStatusCapability, type IDeviceStatusProvider, } from './device-status.cap.js';
178
178
  export { type DishwasherAccess, DishwasherAccessSchema, type DishwasherAvailability, DishwasherAvailabilitySchema, type DishwasherOperationState, DishwasherOperationStateSchema, type DishwasherOptionDescriptor, DishwasherOptionDescriptorSchema, type DishwasherOptions, DishwasherOptionsSchema, type DishwasherProgram, DishwasherProgramSchema, type DishwasherState, DishwasherStateSchema, type DishwasherStatus, DishwasherStatusSchema, type DishwasherValue, DishwasherValueSchema, dishwasherCapability, type IDishwasherProvider, } from './dishwasher.cap.js';
179
- export { type DoorbellPressEvent, DoorbellPressEventSchema, type DoorbellStatus, DoorbellStatusSchema, doorbellCapability, type IDoorbellProvider, } from './doorbell.cap.js';
179
+ export { DOORBELL_RISE_DEBOUNCE_MS, type DoorbellPressEvent, DoorbellPressEventSchema, type DoorbellStatus, DoorbellStatusSchema, doorbellCapability, type IDoorbellProvider, } from './doorbell.cap.js';
180
180
  export { type EnumSensorDateTimeFormat, EnumSensorDateTimeFormatSchema, type EnumSensorStatus, EnumSensorStatusSchema, enumSensorCapability, type IEnumSensorProvider, } from './enum-sensor.cap.js';
181
181
  export { type EventEmitterStatus, EventEmitterStatusSchema, type EventFire, EventFireSchema, eventEmitterCapability, type IEventEmitterProvider, } from './event-emitter.cap.js';
182
182
  export { type FaceCluster, type FaceInfo, type FaceSortDirection, type FaceSortField, faceGalleryCapability, type Identity, type IdentitySampleAudit, type IdentitySampleAuditRow, type IdentitySampleInfo, type IFaceGalleryProvider, type ListRecentFacesInput, type SuggestFaceClustersInput, } from './face-gallery.cap.js';
@@ -197,7 +197,7 @@ export { type ILockControlProvider, type LockControlStatus, LockControlStatusSch
197
197
  export { type MaskGridDims, MaskGridDimsSchema, type MaskGridShape, MaskGridShapeSchema, type MaskLineShape, MaskLineShapeSchema, type MaskPoint, MaskPointSchema, type MaskPolygonShape, MaskPolygonShapeSchema, type MaskPolygonVertices, MaskPolygonVerticesSchema, type MaskRectShape, MaskRectShapeSchema, type MaskShape, type MaskShapeKind, MaskShapeKindSchema, MaskShapeSchema, } from './mask-shape.js';
198
198
  export { type IMediaPlayerProvider, type MediaInfo, type MediaPlayerRepeat, MediaPlayerRepeatSchema, type MediaPlayerState, MediaPlayerStateSchema, type MediaPlayerStatus, MediaPlayerStatusSchema, mediaPlayerCapability, } from './media-player.cap.js';
199
199
  export { type IMeshNetworkProvider, type MeshEndpoint, type MeshPeer, MeshPeerSchema, type MeshStatus, MeshStatusSchema, meshNetworkCapability, } from './mesh-network.cap.js';
200
- export { type IMotionProvider, MOTION_CLOSE_AFTER_MS, type MotionOnMotionChangedData, MotionOnMotionChangedDataSchema, type MotionStatus, MotionStatusSchema, motionCapability, } from './motion.cap.js';
200
+ export { type IMotionProvider, MOTION_CLOSE_AFTER_MS, MOTION_SPAN_TIMEOUT_MS, type MotionOnMotionChangedData, MotionOnMotionChangedDataSchema, type MotionStatus, MotionStatusSchema, motionCapability, } from './motion.cap.js';
201
201
  export { type IMotionTriggerProvider, type MotionTriggerRuntimeState, MotionTriggerRuntimeStateSchema, type MotionTriggerStatus, MotionTriggerStatusSchema, motionTriggerCapability, } from './motion-trigger.cap.js';
202
202
  export { type IMotionZonesProvider, type MotionZoneOptions, MotionZoneOptionsSchema, type MotionZonePatch, MotionZonePatchSchema, type MotionZoneRegion, MotionZoneRegionSchema, type MotionZoneStatus, MotionZoneStatusSchema, motionZonesCapability, } from './motion-zones.cap.js';
203
203
  export { type INativeObjectDetectionProvider, type NativeDetection, NativeDetectionSchema, type NativeObjectClass, NativeObjectClassEnum, type NativeObjectDetectionOptions, NativeObjectDetectionOptionsSchema, type NativeObjectDetectionRuntimeState, NativeObjectDetectionRuntimeStateSchema, type NativeObjectDetectionSettingsPatch, NativeObjectDetectionSettingsPatchSchema, type NativeObjectDetectionStatus, NativeObjectDetectionStatusSchema, type NativeObjectGeometry, NativeObjectGeometryEnum, nativeObjectDetectionCapability, } from './native-object-detection.cap.js';
@@ -1,6 +1,12 @@
1
1
  import { z } from 'zod';
2
2
  import { DeviceType } from '../device/device-type.js';
3
3
  import { type InferProvider } from './capability-definition.js';
4
+ /**
5
+ * Span timeout for a camera's attached sensors. This is the pipeline-runner
6
+ * `motionCooldownMs` default: the window after which a heartbeat-only edge
7
+ * no longer counts. The span does not declare a separate cooldown.
8
+ */
9
+ export declare const MOTION_SPAN_TIMEOUT_MS = 30000;
4
10
  /**
5
11
  * Hardware / firmware motion sensor cap — binary detected state plus
6
12
  * a timestamp of the last observation. Distinct from
@@ -179,5 +185,38 @@ export declare const motionCapability: {
179
185
  };
180
186
  };
181
187
  };
188
+ readonly customize: {
189
+ readonly version: 1;
190
+ readonly targets: readonly [{
191
+ readonly id: 'detected';
192
+ readonly cardinality: 'event';
193
+ readonly shape: 'span';
194
+ readonly vocabulary: {
195
+ readonly cap: 'motion';
196
+ readonly eventName: 'onMotionChanged';
197
+ };
198
+ readonly deviceTypes: readonly [DeviceType.Camera];
199
+ readonly apply: 'replace';
200
+ readonly applyAuthority: {
201
+ readonly kind: 'camera-sensors';
202
+ readonly timeoutField: 'motionCooldownMs';
203
+ };
204
+ readonly eventName: 'onMotionChanged';
205
+ readonly start: 'rising-edge';
206
+ readonly end: 'falling-edge-or-timeout';
207
+ readonly timeoutMs: 30000;
208
+ readonly combine: 'any';
209
+ readonly sourceModes: readonly ["in-addition", "confirm", "replace"];
210
+ readonly sources: readonly [{
211
+ readonly kind: 'binary';
212
+ }, {
213
+ readonly kind: 'switch';
214
+ }];
215
+ readonly sourceReport: {
216
+ readonly status: 'assignment-status';
217
+ };
218
+ readonly advancedExpression: false;
219
+ }];
220
+ };
182
221
  };
183
222
  export type IMotionProvider = InferProvider<typeof motionCapability>;