@camstack/types 1.2.268 → 1.2.270

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 (33) hide show
  1. package/dist/addon.js +1 -1
  2. package/dist/addon.mjs +1 -1
  3. package/dist/capabilities/capability-definition.d.ts +8 -1
  4. package/dist/capabilities/composer.cap.d.ts +6 -0
  5. package/dist/capabilities/core-blocks.cap.d.ts +54 -3
  6. package/dist/capabilities/device-manager.cap.d.ts +4 -4
  7. package/dist/capabilities/doorbell.cap.d.ts +4 -0
  8. package/dist/capabilities/media-player.cap.d.ts +4 -4
  9. package/dist/capabilities/recording-archive.cap.d.ts +5 -3
  10. package/dist/catalogs/sensor-active-state.d.ts +25 -1
  11. package/dist/composition/composition-events.d.ts +42 -0
  12. package/dist/composition/composition-report.d.ts +22 -10
  13. package/dist/composition/composition.d.ts +8 -0
  14. package/dist/composition/evaluate-field.d.ts +8 -0
  15. package/dist/composition/expression-kinds.d.ts +1 -0
  16. package/dist/composition/index.d.ts +1 -0
  17. package/dist/composition/plan-result.d.ts +2 -0
  18. package/dist/{composition-QlOB7QTG.js → composition-BAH3n-zq.js} +412 -14
  19. package/dist/{composition-CPFIlFfw.mjs → composition-D5BQywfe.mjs} +311 -15
  20. package/dist/expression/ast.d.ts +2 -0
  21. package/dist/expression/builtins.d.ts +9 -0
  22. package/dist/expression/evaluator.d.ts +8 -2
  23. package/dist/expression/expression-source.d.ts +26 -4
  24. package/dist/expression/index.d.ts +6 -6
  25. package/dist/index.d.ts +3 -3
  26. package/dist/index.js +335 -329
  27. package/dist/index.mjs +313 -319
  28. package/dist/interfaces/recording-config.d.ts +3 -3
  29. package/dist/node.js +1 -1
  30. package/dist/node.mjs +1 -1
  31. package/dist/{sleep-BSzia-xT.js → sleep-Bg0IB7gg.js} +4 -15
  32. package/dist/{sleep-jkRQgtSc.mjs → sleep-E6eD4yQS.mjs} +4 -15
  33. package/package.json +1 -1
@@ -0,0 +1,42 @@
1
+ import { z } from 'zod';
2
+ import type { CapabilityDefinition } from '../capabilities/capability-definition.js';
3
+ import { EventCategory } from '../enums/event-category.js';
4
+ export declare const COMPOSITION_EVENT_CATEGORY: {
5
+ readonly 'doorbell.onPressed': EventCategory.DoorbellOnPressed;
6
+ };
7
+ export declare const CompositionEventPlanSchema: z.ZodObject<{
8
+ featureIndex: z.ZodNumber;
9
+ cap: z.ZodString;
10
+ eventName: z.ZodString;
11
+ category: z.ZodEnum<typeof EventCategory>;
12
+ stateField: z.ZodString;
13
+ fieldKey: z.ZodString;
14
+ }, z.core.$strip>;
15
+ export type CompositionEventPlan = z.infer<typeof CompositionEventPlanSchema>;
16
+ type EventProblemCode = 'unknown-field' | 'kind-mismatch' | 'not-composable';
17
+ export interface CompositionEventProblem {
18
+ readonly code: EventProblemCode;
19
+ readonly path: string;
20
+ readonly message: string;
21
+ }
22
+ export interface CompositionEventFeatureInput {
23
+ readonly featureIndex: number;
24
+ readonly cap: string;
25
+ readonly mode: 'new' | 'add' | 'replace';
26
+ }
27
+ export interface CompositionEventFieldInput {
28
+ readonly featureIndex: number;
29
+ readonly cap: string;
30
+ readonly path: string;
31
+ readonly item?: unknown;
32
+ }
33
+ export interface CompositionEventPlanningResult {
34
+ readonly problems: readonly CompositionEventProblem[];
35
+ readonly events: readonly CompositionEventPlan[];
36
+ }
37
+ /**
38
+ * Plan one capability's state-derived events after its feature mode and fields
39
+ * are known. A native replacement never becomes a second event authority.
40
+ */
41
+ export declare function planCompositionEvents(def: CapabilityDefinition, feature: CompositionEventFeatureInput, fields: readonly CompositionEventFieldInput[]): CompositionEventPlanningResult;
42
+ export {};
@@ -5,15 +5,15 @@
5
5
  import { z } from 'zod';
6
6
  export declare const CompositionProblemCodeSchema: z.ZodEnum<{
7
7
  "source-missing": "source-missing";
8
+ "unknown-field": "unknown-field";
9
+ "kind-mismatch": "kind-mismatch";
10
+ "not-composable": "not-composable";
8
11
  "reserved-variant": "reserved-variant";
9
12
  "unknown-capability": "unknown-capability";
10
- "not-composable": "not-composable";
11
13
  "wrong-device-type": "wrong-device-type";
12
14
  "has-commands": "has-commands";
13
- "unknown-field": "unknown-field";
14
15
  "nested-field": "nested-field";
15
16
  "missing-field": "missing-field";
16
- "kind-mismatch": "kind-mismatch";
17
17
  "may-be-null": "may-be-null";
18
18
  "source-unreadable": "source-unreadable";
19
19
  "source-capability-missing": "source-capability-missing";
@@ -32,15 +32,15 @@ export type CompositionProblemCode = z.infer<typeof CompositionProblemCodeSchema
32
32
  export declare const CompositionProblemSchema: z.ZodObject<{
33
33
  code: z.ZodEnum<{
34
34
  "source-missing": "source-missing";
35
+ "unknown-field": "unknown-field";
36
+ "kind-mismatch": "kind-mismatch";
37
+ "not-composable": "not-composable";
35
38
  "reserved-variant": "reserved-variant";
36
39
  "unknown-capability": "unknown-capability";
37
- "not-composable": "not-composable";
38
40
  "wrong-device-type": "wrong-device-type";
39
41
  "has-commands": "has-commands";
40
- "unknown-field": "unknown-field";
41
42
  "nested-field": "nested-field";
42
43
  "missing-field": "missing-field";
43
- "kind-mismatch": "kind-mismatch";
44
44
  "may-be-null": "may-be-null";
45
45
  "source-unreadable": "source-unreadable";
46
46
  "source-capability-missing": "source-capability-missing";
@@ -80,12 +80,14 @@ export declare const CompositionUnavailableModeSchema: z.ZodEnum<{
80
80
  export type CompositionUnavailableMode = z.infer<typeof CompositionUnavailableModeSchema>;
81
81
  /**
82
82
  * `derived` reads a source · `clock` reads only `now`, recomputed when a sibling
83
- * field of its cap changes value · `constant` reads nothing, computed once.
83
+ * field of its cap changes value · `constant` reads nothing, computed once ·
84
+ * `accumulator` advances from the target's seed/current output.
84
85
  */
85
86
  export declare const CompositionFieldRoleSchema: z.ZodEnum<{
86
87
  derived: "derived";
87
88
  clock: "clock";
88
89
  constant: "constant";
90
+ accumulator: "accumulator";
89
91
  }>;
90
92
  export type CompositionFieldRole = z.infer<typeof CompositionFieldRoleSchema>;
91
93
  /** The item a planned field belongs to; its `path` is then the dotted path INSIDE the item. */
@@ -122,6 +124,7 @@ export declare const CompositionFieldPlanSchema: z.ZodObject<{
122
124
  derived: "derived";
123
125
  clock: "clock";
124
126
  constant: "constant";
127
+ accumulator: "accumulator";
125
128
  }>;
126
129
  source: z.ZodDiscriminatedUnion<[z.ZodObject<{
127
130
  source: z.ZodObject<{
@@ -188,15 +191,15 @@ export declare const CompositionValidationSchema: z.ZodObject<{
188
191
  problems: z.ZodArray<z.ZodObject<{
189
192
  code: z.ZodEnum<{
190
193
  "source-missing": "source-missing";
194
+ "unknown-field": "unknown-field";
195
+ "kind-mismatch": "kind-mismatch";
196
+ "not-composable": "not-composable";
191
197
  "reserved-variant": "reserved-variant";
192
198
  "unknown-capability": "unknown-capability";
193
- "not-composable": "not-composable";
194
199
  "wrong-device-type": "wrong-device-type";
195
200
  "has-commands": "has-commands";
196
- "unknown-field": "unknown-field";
197
201
  "nested-field": "nested-field";
198
202
  "missing-field": "missing-field";
199
- "kind-mismatch": "kind-mismatch";
200
203
  "may-be-null": "may-be-null";
201
204
  "source-unreadable": "source-unreadable";
202
205
  "source-capability-missing": "source-capability-missing";
@@ -240,6 +243,7 @@ export declare const CompositionValidationSchema: z.ZodObject<{
240
243
  derived: "derived";
241
244
  clock: "clock";
242
245
  constant: "constant";
246
+ accumulator: "accumulator";
243
247
  }>;
244
248
  source: z.ZodDiscriminatedUnion<[z.ZodObject<{
245
249
  source: z.ZodObject<{
@@ -286,6 +290,14 @@ export declare const CompositionValidationSchema: z.ZodObject<{
286
290
  add: "add";
287
291
  }>;
288
292
  }, z.core.$strip>>;
293
+ events: z.ZodArray<z.ZodObject<{
294
+ featureIndex: z.ZodNumber;
295
+ cap: z.ZodString;
296
+ eventName: z.ZodString;
297
+ category: z.ZodEnum<typeof import("../index.js").EventCategory>;
298
+ stateField: z.ZodString;
299
+ fieldKey: z.ZodString;
300
+ }, z.core.$strip>>;
289
301
  }, z.core.$strip>;
290
302
  export type CompositionValidation = z.infer<typeof CompositionValidationSchema>;
291
303
  /**
@@ -203,6 +203,7 @@ export type CompositionItemEntry = z.infer<typeof CompositionItemEntrySchema>;
203
203
  export declare const CompositionFieldsFeatureSchema: z.ZodObject<{
204
204
  kind: z.ZodLiteral<"fields">;
205
205
  cap: z.ZodString;
206
+ enabled: z.ZodOptional<z.ZodBoolean>;
206
207
  fields: z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
207
208
  source: z.ZodObject<{
208
209
  addonId: z.ZodString;
@@ -278,6 +279,7 @@ export type CompositionFieldsFeature = z.infer<typeof CompositionFieldsFeatureSc
278
279
  export declare const CompositionPassthroughFeatureSchema: z.ZodObject<{
279
280
  kind: z.ZodLiteral<"passthrough">;
280
281
  cap: z.ZodString;
282
+ enabled: z.ZodOptional<z.ZodBoolean>;
281
283
  source: z.ZodObject<{
282
284
  addonId: z.ZodString;
283
285
  stableId: z.ZodString;
@@ -287,6 +289,7 @@ export type CompositionPassthroughFeature = z.infer<typeof CompositionPassthroug
287
289
  export declare const CompositionFeatureSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
288
290
  kind: z.ZodLiteral<"fields">;
289
291
  cap: z.ZodString;
292
+ enabled: z.ZodOptional<z.ZodBoolean>;
290
293
  fields: z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
291
294
  source: z.ZodObject<{
292
295
  addonId: z.ZodString;
@@ -359,12 +362,15 @@ export declare const CompositionFeatureSchema: z.ZodDiscriminatedUnion<[z.ZodObj
359
362
  }, z.core.$strip>, z.ZodObject<{
360
363
  kind: z.ZodLiteral<"passthrough">;
361
364
  cap: z.ZodString;
365
+ enabled: z.ZodOptional<z.ZodBoolean>;
362
366
  source: z.ZodObject<{
363
367
  addonId: z.ZodString;
364
368
  stableId: z.ZodString;
365
369
  }, z.core.$strip>;
366
370
  }, z.core.$strip>], "kind">;
367
371
  export type CompositionFeature = z.infer<typeof CompositionFeatureSchema>;
372
+ /** Only an explicit `false` disables a feature; omitted preserves the existing wire default. */
373
+ export declare function compositionFeatureEnabled(feature: CompositionFeature): boolean;
368
374
  /**
369
375
  * A NEW device. It has no `name` of its own: the block's name IS the device's
370
376
  * name (2026-08-08). A second copy here would be a second writer of one string (D62).
@@ -411,6 +417,7 @@ export declare const CompositionSchema: z.ZodObject<{
411
417
  features: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
412
418
  kind: z.ZodLiteral<"fields">;
413
419
  cap: z.ZodString;
420
+ enabled: z.ZodOptional<z.ZodBoolean>;
414
421
  fields: z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
415
422
  source: z.ZodObject<{
416
423
  addonId: z.ZodString;
@@ -483,6 +490,7 @@ export declare const CompositionSchema: z.ZodObject<{
483
490
  }, z.core.$strip>, z.ZodObject<{
484
491
  kind: z.ZodLiteral<"passthrough">;
485
492
  cap: z.ZodString;
493
+ enabled: z.ZodOptional<z.ZodBoolean>;
486
494
  source: z.ZodObject<{
487
495
  addonId: z.ZodString;
488
496
  stableId: z.ZodString;
@@ -30,6 +30,7 @@
30
30
  * source) behind an early return.
31
31
  */
32
32
  import type { ExpressionValue } from '../expression/ast.js';
33
+ import { type StatefulExpressionMemory } from '../expression/expression-source.js';
33
34
  import { type CompositionFieldRead, type CompositionFieldSource } from './composition.js';
34
35
  export interface SourceFreshReading {
35
36
  readonly state: 'fresh';
@@ -71,5 +72,12 @@ export interface EvaluateCompositionFieldInput {
71
72
  readonly source: CompositionFieldSource;
72
73
  readonly read: SourceReader;
73
74
  readonly now: number;
75
+ readonly stateful?: {
76
+ readonly currentOutput: unknown;
77
+ readonly expressionMemory: StatefulExpressionMemory;
78
+ readonly startedAtMs: number;
79
+ /** Scope structural AST paths to their owning output field. */
80
+ readonly callPathPrefix?: string;
81
+ };
74
82
  }
75
83
  export declare function evaluateCompositionField(input: EvaluateCompositionFieldInput): FieldOutcome;
@@ -33,4 +33,5 @@ export interface InferenceFailure {
33
33
  }
34
34
  export type InferExpressionKindsResult = InferredKinds | InferenceFailure;
35
35
  export declare function kindOfValue(value: ExpressionValue): ExpressionValueKind;
36
+ export declare function expressionContainsBuiltinCall(expr: string, callee: string): boolean;
36
37
  export declare function inferExpressionKinds(input: InferExpressionKindsInput): InferExpressionKindsResult;
@@ -3,6 +3,7 @@
3
3
  * inside @camstack/types import the deep modules, never this file.
4
4
  */
5
5
  export * from './composition.js';
6
+ export * from './composition-events.js';
6
7
  export * from './composition-graph.js';
7
8
  export * from './composition-items.js';
8
9
  export * from './composition-report.js';
@@ -4,11 +4,13 @@
4
4
  * barrel (`problem`/`refused` are too generic a name for `@camstack/types`).
5
5
  */
6
6
  import type { CompositionFeaturePlan, CompositionFieldPlan, CompositionProblem, CompositionProblemCode } from './composition-report.js';
7
+ import type { CompositionEventPlan } from './composition-events.js';
7
8
  export interface CompositionPlanResult {
8
9
  readonly problems: readonly CompositionProblem[];
9
10
  readonly fields: readonly CompositionFieldPlan[];
10
11
  /** One entry per planned feature, with its mode; empty for a per-field or per-item result. */
11
12
  readonly features: readonly CompositionFeaturePlan[];
13
+ readonly events: readonly CompositionEventPlan[];
12
14
  }
13
15
  export declare function problem(code: CompositionProblemCode, path: string, message: string): CompositionProblem;
14
16
  export declare function refused(...problems: readonly CompositionProblem[]): CompositionPlanResult;