@camstack/types 1.2.556 → 1.2.558

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 (64) hide show
  1. package/CHANGELOG.md +19 -1
  2. package/dist/addon/fake-addon-context.d.ts +3 -0
  3. package/dist/addon.js +2 -2
  4. package/dist/addon.mjs +2 -2
  5. package/dist/automation/action-target.d.ts +8 -0
  6. package/dist/automation/action.d.ts +24 -54
  7. package/dist/automation/draft/draft-json.d.ts +1 -1
  8. package/dist/automation/draft/index.d.ts +0 -1
  9. package/dist/automation/index.d.ts +3 -2
  10. package/dist/automation/normalize-units.d.ts +3 -3
  11. package/dist/automation/offered.d.ts +18 -0
  12. package/dist/automation/recipe.d.ts +1156 -2598
  13. package/dist/automation/scheduler.d.ts +48 -108
  14. package/dist/automation/step-runner.d.ts +7 -0
  15. package/dist/capabilities/action-source.cap.d.ts +12 -27
  16. package/dist/capabilities/actions.cap.d.ts +84 -189
  17. package/dist/capabilities/device-export.cap.d.ts +36 -1
  18. package/dist/capabilities/hero-layout.cap.d.ts +92 -0
  19. package/dist/capabilities/index.d.ts +2 -2
  20. package/dist/capabilities/remote.cap.d.ts +2 -2
  21. package/dist/capabilities/scene-monitor.cap.d.ts +1 -1
  22. package/dist/capabilities/schedulers.cap.d.ts +96 -216
  23. package/dist/client.d.ts +1 -1
  24. package/dist/client.js +21 -3
  25. package/dist/client.mjs +20 -4
  26. package/dist/{composed-stable-id-CDNLq7Y8.js → composed-stable-id-BmJ_5GiE.js} +5 -0
  27. package/dist/{composed-stable-id-CPp3votu.mjs → composed-stable-id-iddnCQ51.mjs} +5 -0
  28. package/dist/composition/composition.d.ts +8 -0
  29. package/dist/composition/helpers/index.d.ts +1 -1
  30. package/dist/composition/helpers/save.d.ts +2 -0
  31. package/dist/composition/helpers/source-pick.d.ts +11 -5
  32. package/dist/composition/validate-composition.d.ts +2 -0
  33. package/dist/device/cap-vocabulary/action-index.d.ts +32 -0
  34. package/dist/device/cap-vocabulary/index.d.ts +2 -2
  35. package/dist/device/device-do-actions.d.ts +3 -105
  36. package/dist/device/device-kind.d.ts +36 -0
  37. package/dist/device/device-type.d.ts +5 -0
  38. package/dist/device/export-name.d.ts +65 -0
  39. package/dist/device/hero/hero-contribution-kit.d.ts +3 -0
  40. package/dist/device/hero/hero-fragment.d.ts +3 -0
  41. package/dist/device/hero/hero-look.d.ts +6 -0
  42. package/dist/device/hero/hero-measurement.d.ts +76 -0
  43. package/dist/device/hero/hero-model.d.ts +91 -0
  44. package/dist/device/hero/hero-row.d.ts +61 -0
  45. package/dist/device/hero/hero-scene.d.ts +1 -0
  46. package/dist/device/hero/index.d.ts +1 -0
  47. package/dist/device/index.d.ts +1 -1
  48. package/dist/generated/addon-api.d.ts +7 -0
  49. package/dist/generated/method-access-map.d.ts +1 -1
  50. package/dist/generated/system-proxy.d.ts +1 -1
  51. package/dist/{implemented-methods-5YMDeE3f.mjs → implemented-methods-CSTk6zYK.mjs} +147 -2
  52. package/dist/{implemented-methods-Cj65uy2F.js → implemented-methods-CfaRR_ki.js} +212 -1
  53. package/dist/index.d.ts +9 -8
  54. package/dist/index.js +3145 -2959
  55. package/dist/index.mjs +3095 -2936
  56. package/dist/node.js +2 -2
  57. package/dist/node.mjs +2 -2
  58. package/dist/notification/alarm-steps.d.ts +18 -0
  59. package/dist/remote/remote-config.d.ts +5 -5
  60. package/dist/{sleep-Czv-4wFH.mjs → sleep-BvVGLl30.mjs} +52 -2
  61. package/dist/{sleep-BRGFFgr9.js → sleep-CyWfD1LJ.js} +69 -1
  62. package/dist/testing.js +3 -3
  63. package/dist/testing.mjs +3 -3
  64. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -7,6 +7,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.2.558] - 2026-11-13
11
+
12
+ ### Changed
13
+
14
+ - New switch role switch-light: a relay driving an on/off-only lamp, drawn and exported as a light with power only
15
+ - Switch sub-role accessors (isOutlet, isSwitchFan, isSwitchHeater) and a light group accepts a switch-light relay as an on/off member.
16
+ - A device type retired since a record was written (thermostat) is read as its live type in stored grants, automation targets and composition targets instead of failing the parse
17
+ - The device-type wire schemas stay strict; stores rewrite the retired thermostat type where they read rows back, and the hero layout of a retired type is the climate one
18
+
19
+ ## [1.2.557] - 2026-11-12
20
+
21
+ ### Changed
22
+
23
+ - The device model carries the one reading of a simple sensor (value, unit, band, level, state word, since, history), with its number and quantity so every surface converts it through the display preferences; a control device offers an unbounded number field and an editable text field
24
+ - An automation, Action or scheduler step that calls a device is now a command step naming a vocabulary action; a step naming a device that does not offer the action is refused when it is saved.
25
+ - An automation or Action step whose action id the vocabulary no longer knows fails at that step, traced and logged with its device, instead of failing the whole run before any step runs; the alarm-step rule is on the client entry
26
+ - device-export gains setExposedName and an exposedName on exposeDevice / listExposedDevices: a per-instance device name that never changes the exported id.
27
+ - setExposedName takes dryRun (check only) and an export instance states its naming rule (nameRule).
28
+
10
29
  ## [1.2.556] - 2026-11-12
11
30
 
12
31
  ### Changed
@@ -24,7 +43,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
24
43
 
25
44
  ### Changed
26
45
 
27
-
28
46
  ## [1.2.554] - 2026-11-12
29
47
 
30
48
  ### Changed
@@ -5,6 +5,9 @@ export interface FakeSettings {
5
5
  readonly readAddonStore?: SettingsView['readAddonStore'];
6
6
  readonly writeAddonStore?: SettingsView['writeAddonStore'];
7
7
  readonly listDeviceStoreIds?: SettingsView['listDeviceStoreIds'];
8
+ readonly readDeviceStore?: SettingsView['readDeviceStore'];
9
+ readonly writeDeviceStore?: SettingsView['writeDeviceStore'];
10
+ readonly readDeviceStoreBatch?: SettingsView['readDeviceStoreBatch'];
8
11
  readonly readAddonStoreResult?: NonNullable<SettingsView['readAddonStoreResult']>;
9
12
  }
10
13
  export interface FakeAddonContextOptions {
package/dist/addon.js CHANGED
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_sleep = require("./sleep-BRGFFgr9.js");
2
+ const require_sleep = require("./sleep-CyWfD1LJ.js");
3
3
  const require_event_category = require("./event-category-Ps2LC8dN.js");
4
- const require_composed_stable_id = require("./composed-stable-id-CDNLq7Y8.js");
4
+ const require_composed_stable_id = require("./composed-stable-id-BmJ_5GiE.js");
5
5
  //#region src/generated/cap-input-defaults.ts
6
6
  /**
7
7
  * AUTO-GENERATED by scripts/generate-cap-input-defaults.ts — DO NOT EDIT.
package/dist/addon.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { $ as DEVICE_CHILDREN_BATCH_MAX, $r as RECORD_CLASSES, A as CAP_ADVANCE_FIELDS, Ai as RecordNotFoundError, Ar as SCOPED_SETTINGS_SCOPES, Bi as recordsErrorFromMessage, Bn as RecordKindDeclarationSchema, Ca as findMigrationsBlocked, Ci as DeclarationRefusedError, Cn as registerKnownSecret, Ct as createDebugEmitter, Di as NoCallerError, Dn as PEER_BYTES_MAX_OUTSTANDING, Ei as InvalidRecordError, En as PEER_BYTES_CHUNK_BYTES, F as withoutCallerStamp, Fi as RevConflictError, Fn as defineEntryKind, G as readNodePin, Gn as declarationsOf, Gr as mapSecretLeaves, H as commandOrigin, Hn as RecordRetentionSchema, Hr as secretViewsOf, I as customAction, Ii as TransactRefusedError, In as entryBody, J as PipelineRunResultBridge, Jn as collectZodSecretPaths, Jr as recordSecretCollection, Kn as defineRecordKinds, Kr as parseSecretPath, L as defineCustomActions, Li as UnindexedFilterError, Ln as EntryDescriptorSchema, Mi as RecordTooLargeError, Mn as DATAPLANE_SECRET_HEADER, Mr as resolveDeviceSettings, N as CAP_STATE_LEAVES, Ni as RecordUniqueViolationError, Nr as resolvedValues, O as HF_REPO, Oi as PlaintextSecretError, On as PEER_BYTES_STALL_MS, P as CALLER_STAMPED_CAPABILITIES, Pi as RecordsError, Pn as DisposerChain, Q as deviceOpsCapability, Qr as RECORD_BATCH_MAX_BYTES, R as describeCustomActions, Ri as UnknownRecordKindError, Rn as RecordFieldPathSchema, Sa as AddonMigrationsBlockedError, Si as BatchTooLargeError, Sn as knownSecretCount, T as isCommand, Ti as ForeignSecretMarkerError, Tn as shortSecretRefHash, U as nodePin, Un as StoredRecordKindDeclarationSchema, Ur as REMOVE_LEAF, Vn as RecordKindNameSchema, W as readCommandOrigin, Wn as assertValidDeclaration, Wr as collectSecretLeaves, X as MIGRATION_API_VERSION, Xi as createEvent, Xr as secretArrayPrefixes, Y as PipelineStepInputSchema, Yn as isZodSecret, Yr as recordSecretRef, Zi as emitReadiness, Zr as RECORD_BATCH_MAX, _i as normalizeSecretOwner, _n as REVALIDATE_AFTER_MS, _r as BaseAddon, ai as RECORD_MAX_INDEXES, bn as clearKnownSecrets, br as normalizeAddonInitResult, c as asString, ca as classifySecretWrite, ci as RECORD_SECRET_COLLECTION_PREFIX, d as parseJsonUnknown, da as isSecretMarker, di as SECRET_REF_SCHEME, dn as RuleFireOriginSchema, dt as ReadinessRegistry, ei as RECORD_DATABASES, et as adminUiCapability, f as hfModelUrl, fa as isSecretMarkerLike, fi as arrayItemFieldPath, fn as ruleFireOfClaim, fr as ErrorI18nPayloadSchema, ft as ReadinessTimeoutError, g as createDeviceProxy, gi as isSecretRef, gn as resolveSecretViewsIn, h as isDeviceScopedCap, hi as globalSecretScope, hn as assertTransactScope, hr as readErrorI18n, ht as scopeKey, ii as RECORD_MAX_DATA_BYTES, j as CAP_METHOD_TIMEOUTS_MS, ji as RecordSecretUnavailableError, jn as CALLER_USERNAME_HEADER, jr as nodeIdOfScopedKey, ki as RECORDS_ERROR_CODES, kn as PEER_BYTES_TICKET_TTL_MS, la as isSecretClear, li as RECORD_SETTINGS_MAX_ROWS, m as DEVICE_SCOPED_CAPS, ma as toSecretFieldView, mi as formatSecretScope, mn as createRecordsAccess, ni as RECORD_DELETE_BATCH, nt as addonPagesSourceCapability, o as asJsonObject, oi as RECORD_MAX_INDEX_FIELDS, p as BOOT_RECOVERY_BACKOFF_MS, pa as makeSecretMarker, pi as buildSecretRef, pn as makeInMemoryRecords, q as viewerUiCapability, qr as recordArrayItemPath, r as maskUrlCredentials, ri as RECORD_ID_MAX_LENGTH, rr as expandCapMethods, sa as SECRET_CLEAR, si as RECORD_QUERY_MAX, t as sleep, ti as RECORD_DEFAULT_MAX_DATA_BYTES, ua as isSecretFieldView, ui as RECORD_SWEEP_INTERVAL_MS, un as CommandOriginClaimSchema, ut as MODEL_FORMATS, v as addonSliceHandleApi, vi as parseSecretRef, vn as createSecretsAccess, wi as FilterRequiredError, wn as scrubKnownSecrets, xn as forgetKnownSecret, y as createEventBusSliceSource, yn as MIN_SCRUBBED_LENGTH, zi as asRecordsError, zn as RecordIndexSchema } from "./sleep-Czv-4wFH.mjs";
1
+ import { $ as DEVICE_CHILDREN_BATCH_MAX, $i as createEvent, $r as secretArrayPrefixes, A as CAP_ADVANCE_FIELDS, Ai as NoCallerError, An as PEER_BYTES_MAX_OUTSTANDING, Bi as UnindexedFilterError, Bn as EntryDescriptorSchema, Cn as clearKnownSecrets, Cr as normalizeAddonInitResult, Di as FilterRequiredError, Dn as scrubKnownSecrets, Ea as findMigrationsBlocked, Ei as DeclarationRefusedError, En as registerKnownSecret, Et as createDebugEmitter, F as withoutCallerStamp, Fi as RecordTooLargeError, Fn as DATAPLANE_SECRET_HEADER, Fr as resolveDeviceSettings, G as readNodePin, Gn as RecordRetentionSchema, Gr as secretViewsOf, H as commandOrigin, Hi as asRecordsError, Hn as RecordIndexSchema, I as customAction, Ii as RecordUniqueViolationError, Ir as resolvedValues, J as PipelineRunResultBridge, Jn as declarationsOf, Jr as mapSecretLeaves, Kn as StoredRecordKindDeclarationSchema, Kr as REMOVE_LEAF, L as defineCustomActions, Li as RecordsError, Ln as DisposerChain, Mi as RECORDS_ERROR_CODES, Mn as PEER_BYTES_TICKET_TTL_MS, N as CAP_STATE_LEAVES, Ni as RecordNotFoundError, Nr as SCOPED_SETTINGS_SCOPES, O as HF_REPO, Oi as ForeignSecretMarkerError, On as shortSecretRefHash, P as CALLER_STAMPED_CAPABILITIES, Pi as RecordSecretUnavailableError, Pn as CALLER_USERNAME_HEADER, Pr as nodeIdOfScopedKey, Q as deviceOpsCapability, Qn as isZodSecret, Qr as recordSecretRef, R as describeCustomActions, Ri as RevConflictError, Rn as defineEntryKind, Sn as MIN_SCRUBBED_LENGTH, T as isCommand, Ta as AddonMigrationsBlockedError, Ti as BatchTooLargeError, Tn as knownSecretCount, U as nodePin, Ui as recordsErrorFromMessage, Un as RecordKindDeclarationSchema, Vi as UnknownRecordKindError, Vn as RecordFieldPathSchema, W as readCommandOrigin, Wn as RecordKindNameSchema, X as MIGRATION_API_VERSION, Xr as recordArrayItemPath, Y as PipelineStepInputSchema, Yn as defineRecordKinds, Yr as parseSecretPath, Zn as collectZodSecretPaths, Zr as recordSecretCollection, _a as toSecretFieldView, _i as formatSecretScope, _n as createRecordsAccess, ai as RECORD_DELETE_BATCH, bi as normalizeSecretOwner, bn as REVALIDATE_AFTER_MS, br as BaseAddon, c as asString, ci as RECORD_MAX_INDEXES, d as parseJsonUnknown, da as classifySecretWrite, di as RECORD_SECRET_COLLECTION_PREFIX, ea as emitReadiness, ei as RECORD_BATCH_MAX, et as adminUiCapability, f as hfModelUrl, fa as isSecretClear, fi as RECORD_SETTINGS_MAX_ROWS, g as createDeviceProxy, ga as makeSecretMarker, gi as buildSecretRef, gn as makeInMemoryRecords, h as isDeviceScopedCap, ha as isSecretMarkerLike, hi as arrayItemFieldPath, hn as ruleFireOfClaim, hr as ErrorI18nPayloadSchema, ht as ReadinessTimeoutError, ii as RECORD_DEFAULT_MAX_DATA_BYTES, j as CAP_METHOD_TIMEOUTS_MS, ji as PlaintextSecretError, jn as PEER_BYTES_STALL_MS, ki as InvalidRecordError, kn as PEER_BYTES_CHUNK_BYTES, li as RECORD_MAX_INDEX_FIELDS, m as DEVICE_SCOPED_CAPS, ma as isSecretMarker, mi as SECRET_REF_SCHEME, mn as RuleFireOriginSchema, mt as ReadinessRegistry, ni as RECORD_CLASSES, nt as addonPagesSourceCapability, o as asJsonObject, oi as RECORD_ID_MAX_LENGTH, or as expandCapMethods, p as BOOT_RECOVERY_BACKOFF_MS, pa as isSecretFieldView, pi as RECORD_SWEEP_INTERVAL_MS, pn as CommandOriginClaimSchema, pt as MODEL_FORMATS, q as viewerUiCapability, qn as assertValidDeclaration, qr as collectSecretLeaves, r as maskUrlCredentials, ri as RECORD_DATABASES, si as RECORD_MAX_DATA_BYTES, t as sleep, ti as RECORD_BATCH_MAX_BYTES, ua as SECRET_CLEAR, ui as RECORD_QUERY_MAX, v as addonSliceHandleApi, vi as globalSecretScope, vn as assertTransactScope, vr as readErrorI18n, vt as scopeKey, wn as forgetKnownSecret, xi as parseSecretRef, xn as createSecretsAccess, y as createEventBusSliceSource, yi as isSecretRef, yn as resolveSecretViewsIn, zi as TransactRefusedError, zn as entryBody } from "./sleep-BvVGLl30.mjs";
2
2
  import { t as EventCategory } from "./event-category-Dv-Gcv1f.mjs";
3
- import { a as DeviceType, s as errMsg, t as COMPOSED_DEVICE_STABLE_ID_PREFIX } from "./composed-stable-id-CPp3votu.mjs";
3
+ import { a as DeviceType, s as errMsg, t as COMPOSED_DEVICE_STABLE_ID_PREFIX } from "./composed-stable-id-iddnCQ51.mjs";
4
4
  //#region src/generated/cap-input-defaults.ts
5
5
  /**
6
6
  * AUTO-GENERATED by scripts/generate-cap-input-defaults.ts — DO NOT EDIT.
@@ -34,6 +34,14 @@ export declare const ActionTargetSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
34
34
  name: z.ZodString;
35
35
  }, z.core.$strip>], "kind">;
36
36
  export type ActionTarget = z.infer<typeof ActionTargetSchema>;
37
+ /**
38
+ * A STORED list of steps, read back: a `domain` target may name a device type
39
+ * D1033 retired (`thermostat`). The step schema stays a strict enum on the
40
+ * wire, so the store rewrites the retired name to its canonical type before
41
+ * it parses the row — on the step and on each step of its `else` list. Any
42
+ * other value is returned untouched, for the schema to judge.
43
+ */
44
+ export declare function canonicalStoredStepTargets(steps: unknown): unknown;
37
45
  /** What a resolver needs to know about one device. */
38
46
  export interface DirectoryDevice {
39
47
  readonly id: number;
@@ -91,9 +91,8 @@ export declare const ActionEntrySchema: z.ZodObject<{
91
91
  kind: z.ZodLiteral<"wait">;
92
92
  seconds: z.ZodNumber;
93
93
  }, z.core.$strip>, z.ZodObject<{
94
- kind: z.ZodLiteral<"cap">;
95
- actionId: z.ZodOptional<z.ZodString>;
96
- target: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
94
+ kind: z.ZodLiteral<"command">;
95
+ target: z.ZodDiscriminatedUnion<[z.ZodObject<{
97
96
  kind: z.ZodLiteral<"devices">;
98
97
  ids: z.ZodArray<z.ZodNumber>;
99
98
  }, z.core.$strip>, z.ZodObject<{
@@ -103,19 +102,14 @@ export declare const ActionEntrySchema: z.ZodObject<{
103
102
  }, z.core.$strip>, z.ZodObject<{
104
103
  kind: z.ZodLiteral<"var">;
105
104
  name: z.ZodString;
106
- }, z.core.$strip>], "kind">>;
107
- deviceId: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>, z.ZodObject<{
108
- $var: z.ZodString;
109
- }, z.core.$strip>]>>;
110
- cap: z.ZodString;
111
- method: z.ZodString;
105
+ }, z.core.$strip>], "kind">;
106
+ actionId: z.ZodString;
112
107
  args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
113
108
  argUnits: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
114
109
  }, z.core.$strip>], "kind">>>;
115
110
  }, z.core.$strip>, z.ZodObject<{
116
- kind: z.ZodLiteral<"cap">;
117
- actionId: z.ZodOptional<z.ZodString>;
118
- target: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
111
+ kind: z.ZodLiteral<"command">;
112
+ target: z.ZodDiscriminatedUnion<[z.ZodObject<{
119
113
  kind: z.ZodLiteral<"devices">;
120
114
  ids: z.ZodArray<z.ZodNumber>;
121
115
  }, z.core.$strip>, z.ZodObject<{
@@ -125,12 +119,8 @@ export declare const ActionEntrySchema: z.ZodObject<{
125
119
  }, z.core.$strip>, z.ZodObject<{
126
120
  kind: z.ZodLiteral<"var">;
127
121
  name: z.ZodString;
128
- }, z.core.$strip>], "kind">>;
129
- deviceId: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>, z.ZodObject<{
130
- $var: z.ZodString;
131
- }, z.core.$strip>]>>;
132
- cap: z.ZodString;
133
- method: z.ZodString;
122
+ }, z.core.$strip>], "kind">;
123
+ actionId: z.ZodString;
134
124
  args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
135
125
  argUnits: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
136
126
  if: z.ZodOptional<z.ZodType<import("./when.js").AutomationWhen, unknown, z.core.$ZodTypeInternals<import("./when.js").AutomationWhen, unknown>>>;
@@ -138,9 +128,8 @@ export declare const ActionEntrySchema: z.ZodObject<{
138
128
  kind: z.ZodLiteral<"wait">;
139
129
  seconds: z.ZodNumber;
140
130
  }, z.core.$strip>, z.ZodObject<{
141
- kind: z.ZodLiteral<"cap">;
142
- actionId: z.ZodOptional<z.ZodString>;
143
- target: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
131
+ kind: z.ZodLiteral<"command">;
132
+ target: z.ZodDiscriminatedUnion<[z.ZodObject<{
144
133
  kind: z.ZodLiteral<"devices">;
145
134
  ids: z.ZodArray<z.ZodNumber>;
146
135
  }, z.core.$strip>, z.ZodObject<{
@@ -150,12 +139,8 @@ export declare const ActionEntrySchema: z.ZodObject<{
150
139
  }, z.core.$strip>, z.ZodObject<{
151
140
  kind: z.ZodLiteral<"var">;
152
141
  name: z.ZodString;
153
- }, z.core.$strip>], "kind">>;
154
- deviceId: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>, z.ZodObject<{
155
- $var: z.ZodString;
156
- }, z.core.$strip>]>>;
157
- cap: z.ZodString;
158
- method: z.ZodString;
142
+ }, z.core.$strip>], "kind">;
143
+ actionId: z.ZodString;
159
144
  args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
160
145
  argUnits: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
161
146
  }, z.core.$strip>], "kind">>>;
@@ -192,9 +177,8 @@ export declare const ActionInputSchema: z.ZodObject<{
192
177
  kind: z.ZodLiteral<"wait">;
193
178
  seconds: z.ZodNumber;
194
179
  }, z.core.$strip>, z.ZodObject<{
195
- kind: z.ZodLiteral<"cap">;
196
- actionId: z.ZodOptional<z.ZodString>;
197
- target: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
180
+ kind: z.ZodLiteral<"command">;
181
+ target: z.ZodDiscriminatedUnion<[z.ZodObject<{
198
182
  kind: z.ZodLiteral<"devices">;
199
183
  ids: z.ZodArray<z.ZodNumber>;
200
184
  }, z.core.$strip>, z.ZodObject<{
@@ -204,19 +188,14 @@ export declare const ActionInputSchema: z.ZodObject<{
204
188
  }, z.core.$strip>, z.ZodObject<{
205
189
  kind: z.ZodLiteral<"var">;
206
190
  name: z.ZodString;
207
- }, z.core.$strip>], "kind">>;
208
- deviceId: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>, z.ZodObject<{
209
- $var: z.ZodString;
210
- }, z.core.$strip>]>>;
211
- cap: z.ZodString;
212
- method: z.ZodString;
191
+ }, z.core.$strip>], "kind">;
192
+ actionId: z.ZodString;
213
193
  args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
214
194
  argUnits: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
215
195
  }, z.core.$strip>], "kind">>>;
216
196
  }, z.core.$strip>, z.ZodObject<{
217
- kind: z.ZodLiteral<"cap">;
218
- actionId: z.ZodOptional<z.ZodString>;
219
- target: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
197
+ kind: z.ZodLiteral<"command">;
198
+ target: z.ZodDiscriminatedUnion<[z.ZodObject<{
220
199
  kind: z.ZodLiteral<"devices">;
221
200
  ids: z.ZodArray<z.ZodNumber>;
222
201
  }, z.core.$strip>, z.ZodObject<{
@@ -226,12 +205,8 @@ export declare const ActionInputSchema: z.ZodObject<{
226
205
  }, z.core.$strip>, z.ZodObject<{
227
206
  kind: z.ZodLiteral<"var">;
228
207
  name: z.ZodString;
229
- }, z.core.$strip>], "kind">>;
230
- deviceId: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>, z.ZodObject<{
231
- $var: z.ZodString;
232
- }, z.core.$strip>]>>;
233
- cap: z.ZodString;
234
- method: z.ZodString;
208
+ }, z.core.$strip>], "kind">;
209
+ actionId: z.ZodString;
235
210
  args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
236
211
  argUnits: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
237
212
  if: z.ZodOptional<z.ZodType<import("./when.js").AutomationWhen, unknown, z.core.$ZodTypeInternals<import("./when.js").AutomationWhen, unknown>>>;
@@ -239,9 +214,8 @@ export declare const ActionInputSchema: z.ZodObject<{
239
214
  kind: z.ZodLiteral<"wait">;
240
215
  seconds: z.ZodNumber;
241
216
  }, z.core.$strip>, z.ZodObject<{
242
- kind: z.ZodLiteral<"cap">;
243
- actionId: z.ZodOptional<z.ZodString>;
244
- target: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
217
+ kind: z.ZodLiteral<"command">;
218
+ target: z.ZodDiscriminatedUnion<[z.ZodObject<{
245
219
  kind: z.ZodLiteral<"devices">;
246
220
  ids: z.ZodArray<z.ZodNumber>;
247
221
  }, z.core.$strip>, z.ZodObject<{
@@ -251,12 +225,8 @@ export declare const ActionInputSchema: z.ZodObject<{
251
225
  }, z.core.$strip>, z.ZodObject<{
252
226
  kind: z.ZodLiteral<"var">;
253
227
  name: z.ZodString;
254
- }, z.core.$strip>], "kind">>;
255
- deviceId: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>, z.ZodObject<{
256
- $var: z.ZodString;
257
- }, z.core.$strip>]>>;
258
- cap: z.ZodString;
259
- method: z.ZodString;
228
+ }, z.core.$strip>], "kind">;
229
+ actionId: z.ZodString;
260
230
  args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
261
231
  argUnits: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
262
232
  }, z.core.$strip>], "kind">>>;
@@ -1,2 +1,2 @@
1
+ /** Shared shape guard of the draft readers. */
1
2
  export declare function isRecord(value: unknown): value is Readonly<Record<string, unknown>>;
2
- export declare function expandDraft(value: unknown): unknown;
@@ -5,7 +5,6 @@
5
5
  export * from './draft-types.js';
6
6
  export { compareDraft } from './compare-draft.js';
7
7
  export { COMPOSITION_TARGET_CAP_NAMES, compositionTargetCaps } from './composition-caps.js';
8
- export { expandDraft } from './draft-json.js';
9
8
  export { buildDraftPrompt, buildRepairPrompt, type DraftPrompt, FEW_SHOT_COUNT, GRAMMAR_MAX_LINES, grammarFor, selectFewShots, } from './draft-prompt.js';
10
9
  export { buildDraftJsonSchema, WHEN_UNROLL_DEPTH } from './draft-schemas.js';
11
10
  export { validateDraft } from './validate-draft.js';
@@ -26,8 +26,8 @@ export type { CooldownInput, CooldownVerdict, RunGateAdmission } from './run-gat
26
26
  export { RunGate } from './run-gate.js';
27
27
  export type { AutomationConditionTraceNode, AutomationRunOutcome, AutomationRunTrace, AutomationRunVerdict, AutomationStateDoc, AutomationStepTrace, NestedStepTrace, AutomationTriggerTrace, StepDeviceTrace, TraceNodeOutcome, TraceValue, } from './trace.js';
28
28
  export { AutomationConditionTraceNodeSchema, EMPTY_AUTOMATION_STATE, mergeSkipTraces, AutomationRunOutcomeSchema, AutomationRunTraceSchema, AutomationRunVerdictSchema, AutomationStateDocSchema, AutomationStepTraceSchema, AutomationTriggerTraceSchema, appendTrace, buildStepArgsTrace, buildTriggerTrace, isSkippedTrace, MAX_TRACE_ARG_LENGTH, MAX_STEP_DEVICE_OUTCOMES, MAX_TRACE_ARGS, REDACTED_ARG, skipSignature, StepDeviceTraceSchema, TraceNodeOutcomeSchema, TraceValueSchema, } from './trace.js';
29
- export type { ActionStep, AutomationAction, AutomationCapStep, AutomationRecipe, AutomationRunMode, LegacyAutomationRecipe, AutomationBodyStep, AutomationBranchStep, AutomationRecipeInput, AutomationChooseStep, AutomationWaitUntilStep, AutomationParallelStep, AutomationRepeatLoop, AutomationRepeatStep, AutomationSetStep, StepConditionRef, AutomationStopStep, NormalizedCapStep, } from './recipe.js';
30
- export { ActionStepSchema, AutomationActionSchema, AutomationCapStepSchema, AutomationWaitStepSchema, AutomationChooseStepSchema, AutomationWaitUntilStepSchema, AutomationParallelStepSchema, AutomationRepeatLoopSchema, AutomationRepeatStepSchema, AutomationSetStepSchema, CHOOSE_BRANCHES_MAX, WAIT_UNTIL_TIMEOUT_MAX_S, PARALLEL_STEPS_MAX, REPEAT_COUNT_MAX, REPEAT_DEVICES_MAX, REPEAT_ITEM_VAR, REPEAT_ITERATIONS_MAX, REPEAT_STEPS_MAX, STEP_NEST_MAX, PARALLEL_STEPS_MIN, nestedStepsOf, stepConditionsOf, AutomationStopStepSchema, RESERVED_RUN_VARS, SET_VAR_NAME_RE, SET_VAR_VALUE_MAX, SET_VARS_MAX, STOP_REASON_MAX, stepGuardOf, WAIT_MAX_SECONDS, AutomationRecipeSchema, AutomationRunModeSchema, CurrentAutomationRecipeSchema, convertLegacyRecipe, DEFAULT_TRACE_KEEP, LegacyAutomationRecipeSchema, MAX_TRACE_KEEP, MAX_CONDITION_DEPTH, MAX_CONDITION_LEAVES, normalizeCapStep, normalizeStepTargets, validateRecipeBounds, } from './recipe.js';
29
+ export type { ActionStep, AutomationAction, AutomationCommandStep, AutomationRecipe, AutomationRunMode, LegacyAutomationRecipe, AutomationBodyStep, AutomationBranchStep, AutomationRecipeInput, AutomationChooseStep, AutomationWaitUntilStep, AutomationParallelStep, AutomationRepeatLoop, AutomationRepeatStep, AutomationSetStep, StepConditionRef, AutomationStopStep, } from './recipe.js';
30
+ export { ActionStepSchema, AutomationActionSchema, AutomationCommandStepBaseSchema, AutomationCommandStepSchema, AutomationWaitStepSchema, AutomationChooseStepSchema, AutomationWaitUntilStepSchema, AutomationParallelStepSchema, AutomationRepeatLoopSchema, AutomationRepeatStepSchema, AutomationSetStepSchema, CHOOSE_BRANCHES_MAX, WAIT_UNTIL_TIMEOUT_MAX_S, PARALLEL_STEPS_MAX, REPEAT_COUNT_MAX, REPEAT_DEVICES_MAX, REPEAT_ITEM_VAR, REPEAT_ITERATIONS_MAX, REPEAT_STEPS_MAX, STEP_NEST_MAX, PARALLEL_STEPS_MIN, nestedStepsOf, stepConditionsOf, AutomationStopStepSchema, RESERVED_RUN_VARS, SET_VAR_NAME_RE, SET_VAR_VALUE_MAX, SET_VARS_MAX, STOP_REASON_MAX, stepGuardOf, WAIT_MAX_SECONDS, AutomationRecipeSchema, AutomationRunModeSchema, CurrentAutomationRecipeSchema, convertLegacyRecipe, DEFAULT_TRACE_KEEP, LegacyAutomationRecipeSchema, MAX_TRACE_KEEP, MAX_CONDITION_DEPTH, MAX_CONDITION_LEAVES, validateRecipeBounds, } from './recipe.js';
31
31
  export type { AutomationAll, AutomationAny, AutomationConditionOperator, AutomationEventLeaf, AutomationLeaf, AutomationNot, AutomationStateLeaf, AutomationWhen, DetectionLeaf, DeviceBecomesLeaf, DeviceFiredLeaf, DeviceFiredMatch, DeviceIsLeaf, ExpressionLeaf, TimeIsLeaf, TriggeredByLeaf, IdentifiedEventLeaf, StationaryLeaf, StationaryPresentLeaf, } from './when.js';
32
32
  export { AutomationConditionOperatorSchema, AutomationWhenSchema, DeviceFiredMatchSchema, countWhenLeaves, eventLeafIdAt, identifiedEventLeaves, hasTriggeredByLeaves, triggeredByIssue, EVENT_LEAF_ID_RE, TRIGGERED_BY_MAX_IDS, forEachLeaf, hasEventLeaves, isEventLeaf, isLeaf, MAX_WHEN_DEPTH, MAX_WHEN_LEAVES, validateWhenTree, whenDepth, } from './when.js';
33
33
  export type { LegacyCondition, LegacyTrigger, } from './legacy-recipe.js';
@@ -36,6 +36,7 @@ export type { DetectionLabelSource, DetectionSubject, IdentityLabel, PlateLabel,
36
36
  export { anySubjectMatches, DETECTION_LABEL_SOURCES, DetectionSubjectSchema, describeSubject, StationarySubjectSchema, subClassesOf, subjectFromClassName, subjectMatches, } from './detection-subject.js';
37
37
  export * from './action.js';
38
38
  export * from './action-target.js';
39
+ export { assertStepsOffered, type BoundCapsReader } from './offered.js';
39
40
  export * from './step-condition.js';
40
41
  export * from './step-runner.js';
41
42
  export * from './wait-until.js';
@@ -24,7 +24,7 @@ import type { CapabilityDefinition } from '../capabilities/capability-definition
24
24
  import { type ParamMeta } from '../units/quantity-input.js';
25
25
  import type { ReadingQuantity } from '../units/quantity.js';
26
26
  import { z } from 'zod';
27
- import { type AutomationAction, type AutomationCapStep, type AutomationRecipe } from './recipe.js';
27
+ import { type AutomationAction, type AutomationCommandStep, type AutomationRecipe } from './recipe.js';
28
28
  import type { AutomationWhen } from './when.js';
29
29
  /** What the boundary needs to know about caps. */
30
30
  export interface UnitResolver {
@@ -52,9 +52,9 @@ export declare function capUnitResolver(defs: readonly CapabilityDefinition[]):
52
52
  /** Normalise every leaf of a condition tree. Throws {@link QuantityUnitError}. */
53
53
  export declare function normalizeConditionUnits(condition: AutomationWhen, resolver: UnitResolver, path?: string): UnitsNormalized<AutomationWhen>;
54
54
  /**
55
- * Normalise the cap steps of an action list (an internal Action's steps, or a
55
+ * Normalise the command steps of an action list (an internal Action's steps, or a
56
56
  * recipe's actions). Other step kinds pass through. Throws {@link QuantityUnitError}.
57
57
  */
58
- export declare function normalizeActionUnits<A extends AutomationAction>(actions: readonly A[], resolver: UnitResolver, path?: string): UnitsNormalized<(A | AutomationCapStep)[]>;
58
+ export declare function normalizeActionUnits<A extends AutomationAction>(actions: readonly A[], resolver: UnitResolver, path?: string): UnitsNormalized<(A | AutomationCommandStep)[]>;
59
59
  /** Normalise a whole recipe: its `when` tree and its actions. */
60
60
  export declare function normalizeRecipeUnits(recipe: AutomationRecipe, resolver: UnitResolver): UnitsNormalized<AutomationRecipe>;
@@ -0,0 +1,18 @@
1
+ import type { AutomationAction, AutomationBodyStep } from './recipe.js';
2
+ /** The cap names each named device is bound to, from its own binding map. */
3
+ export interface BoundCapsReader {
4
+ boundCapsOf(deviceIds: readonly number[]): Promise<ReadonlyMap<number, readonly string[]>>;
5
+ }
6
+ interface CommandRef {
7
+ readonly actionId: string;
8
+ readonly ids: readonly number[];
9
+ }
10
+ type AnyStep = AutomationAction | AutomationBodyStep;
11
+ /** Every command step at any depth: its own, its `else`, and every nested branch. */
12
+ export declare function commandsIn(step: AnyStep): CommandRef[];
13
+ /**
14
+ * Refuse a step list naming a device that does not offer the step's action.
15
+ * Throws `VocabActionError` (`not-offered`, or `unknown-action`).
16
+ */
17
+ export declare function assertStepsOffered(steps: readonly AutomationAction[], reader: BoundCapsReader): Promise<void>;
18
+ export {};