@camstack/types 1.2.535 → 1.2.537

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/CHANGELOG.md +18 -9
  2. package/dist/addon.d.ts +1 -0
  3. package/dist/addon.js +5 -4
  4. package/dist/addon.mjs +3 -3
  5. package/dist/automation/action.d.ts +105 -0
  6. package/dist/automation/index.d.ts +1 -0
  7. package/dist/automation/recipe.d.ts +450 -6
  8. package/dist/automation/scheduler.d.ts +208 -0
  9. package/dist/automation/step-condition.d.ts +19 -0
  10. package/dist/automation/step-runner.d.ts +50 -5
  11. package/dist/automation/trace.d.ts +129 -0
  12. package/dist/capabilities/action-source.cap.d.ts +52 -0
  13. package/dist/capabilities/actions.cap.d.ts +406 -0
  14. package/dist/capabilities/core-blocks.cap.d.ts +3782 -120
  15. package/dist/capabilities/device-manager.cap.d.ts +97 -0
  16. package/dist/capabilities/fan-presets.cap.d.ts +312 -0
  17. package/dist/capabilities/hero-layout.cap.d.ts +12 -0
  18. package/dist/capabilities/index.d.ts +1 -1
  19. package/dist/capabilities/schedulers.cap.d.ts +458 -0
  20. package/dist/capabilities/timed-run.cap.d.ts +5 -0
  21. package/dist/client.d.ts +1 -1
  22. package/dist/client.js +45 -8
  23. package/dist/client.mjs +45 -9
  24. package/dist/{device-type-BfvqqzRp.js → composed-stable-id-C3J6LxC9.js} +14 -0
  25. package/dist/{device-type-DTTZKB2I.mjs → composed-stable-id-DLcPInGv.mjs} +9 -1
  26. package/dist/composition/composed-stable-id.d.ts +6 -0
  27. package/dist/composition/composition.d.ts +2 -2
  28. package/dist/{composition-C6TZGqUb.mjs → composition-BFJq1Y88.mjs} +2 -4
  29. package/dist/{composition-BxalDSTt.js → composition-BcVAbtBc.js} +4 -12
  30. package/dist/device/container-primary-child.d.ts +37 -5
  31. package/dist/device/device-context.d.ts +9 -2
  32. package/dist/device/hero/hero-model.d.ts +2 -0
  33. package/dist/device/hero/hero-row.d.ts +33 -2
  34. package/dist/expression/device-template.d.ts +80 -19
  35. package/dist/generated/addon-api.d.ts +14 -0
  36. package/dist/generated/method-access-map.d.ts +1 -1
  37. package/dist/generated/system-proxy.d.ts +1 -1
  38. package/dist/index.d.ts +4 -3
  39. package/dist/index.js +1564 -1024
  40. package/dist/index.mjs +705 -178
  41. package/dist/node.js +6 -6
  42. package/dist/node.mjs +2 -2
  43. package/dist/{sleep-DnVqHJc4.mjs → sleep-B36hHDDz.mjs} +1 -1
  44. package/dist/{sleep-CCAQ_PEp.js → sleep-DIg2Mx82.js} +36 -36
  45. package/package.json +1 -1
package/dist/client.js CHANGED
@@ -27476,12 +27476,42 @@ function remoteRoleLabel(role, locale) {
27476
27476
  * priority-in-sync.ts` fails the build when either drifts — the comment that
27477
27477
  * used to ask for this could not.
27478
27478
  *
27479
- * The rule has two halves and the ORDER matters: an operator's explicit pick
27480
- * wins outright, and only in its absence does type priority decide. The pick is
27481
- * keyed on the child's re-sync-stable `entityId`, not its numeric id, so it
27482
- * survives a re-sync that reallocates ids.
27479
+ * The rule has three halves and the ORDER matters: an operator's explicit pick
27480
+ * wins outright; else a declaration on the device type
27481
+ * ({@link CONTAINER_PRIMARY_CHILD_RULES}); else role, namesake, then type
27482
+ * priority. The pick is keyed on the child's re-sync-stable `entityId`, not
27483
+ * its numeric id, so it survives a re-sync that reallocates ids.
27483
27484
  */
27484
27485
  /**
27486
+ * Device types that name their primary child. A heat pump stands for itself:
27487
+ * its hero is the system row, not the climate circuit that type-rank would
27488
+ * otherwise pick.
27489
+ */
27490
+ var CONTAINER_PRIMARY_CHILD_RULES = [{
27491
+ deviceType: DeviceType.HeatPump,
27492
+ primary: "self"
27493
+ }];
27494
+ /**
27495
+ * The type declaration, before the heuristic. `fall-through` means the
27496
+ * heuristic still decides: the type declared nothing, or it named a child
27497
+ * type that is not among the children.
27498
+ */
27499
+ function declaredChildType(primary) {
27500
+ if (primary === "self") return void 0;
27501
+ return primary.childType;
27502
+ }
27503
+ function applyPrimaryChildRule(rule, children) {
27504
+ if (rule === void 0) return { kind: "fall-through" };
27505
+ const childType = declaredChildType(rule.primary);
27506
+ if (childType === void 0) return { kind: "none" };
27507
+ const match = children.find((child) => child.type === childType);
27508
+ if (match === void 0) return { kind: "fall-through" };
27509
+ return {
27510
+ kind: "child",
27511
+ child: match
27512
+ };
27513
+ }
27514
+ /**
27485
27515
  * Type priority, most→least "primary". An actuator (climate / lock / cover / …)
27486
27516
  * outranks a bare `switch` so a container's defining child wins over its
27487
27517
  * auxiliary switches. Unknown or absent types sort after every entry.
@@ -27568,9 +27598,10 @@ function rank(type) {
27568
27598
  }
27569
27599
  /**
27570
27600
  * The child a container stands for: the operator's pick when it still exists,
27571
- * else the highest-priority type. `null` for a childless container — a caller
27572
- * must decide what an empty container means for it, rather than being handed a
27573
- * child that is not there.
27601
+ * else the device type's declaration, else the highest-priority type. `null`
27602
+ * for a childless container, and for a type that stands for itself — a caller
27603
+ * must decide what "no child" means for it, rather than being handed a child
27604
+ * that is not the device.
27574
27605
  */
27575
27606
  /**
27576
27607
  * Two names for the same thing, compared the way an integration writes them.
@@ -27599,11 +27630,14 @@ function sameName(childName, containerName) {
27599
27630
  const flatten = (v) => v.toLowerCase().replace(/[-_\s]+/g, " ").trim();
27600
27631
  return flatten(childName) === flatten(containerName);
27601
27632
  }
27602
- function resolveContainerPrimaryChild(children, overrideEntityId, containerName) {
27633
+ function resolveContainerPrimaryChild(children, overrideEntityId, containerName, containerType) {
27603
27634
  if (overrideEntityId !== void 0 && overrideEntityId !== null) {
27604
27635
  const picked = children.find((c) => c.stableId === overrideEntityId) ?? children.find((c) => c.entityId !== void 0 && c.entityId === overrideEntityId);
27605
27636
  if (picked !== void 0) return picked;
27606
27637
  }
27638
+ const declared = applyPrimaryChildRule(CONTAINER_PRIMARY_CHILD_RULES.find((entry) => entry.deviceType === containerType), children);
27639
+ if (declared.kind === "none") return null;
27640
+ if (declared.kind === "child") return declared.child;
27607
27641
  const namesake = (c) => containerName !== void 0 && containerName.length > 0 && c.name !== void 0 && sameName(c.name, containerName) ? 0 : 1;
27608
27642
  return [...children].toSorted((a, b) => roleRank(a.role) - roleRank(b.role) || namesake(a) - namesake(b) || rank(a.type) - rank(b.type))[0] ?? null;
27609
27643
  }
@@ -29744,6 +29778,8 @@ function createSystemProxy(api) {
29744
29778
  registerDevice: (input) => dispatch("deviceManager", "registerDevice", "mutation", input),
29745
29779
  removeDevice: (input) => dispatch("deviceManager", "removeDevice", "mutation", input),
29746
29780
  persistConfig: (input) => dispatch("deviceManager", "persistConfig", "mutation", input),
29781
+ renderDeviceTemplates: (input) => dispatch("deviceManager", "renderDeviceTemplates", "query", input),
29782
+ checkDeviceTemplates: (input) => dispatch("deviceManager", "checkDeviceTemplates", "query", input),
29747
29783
  getRoleDisplayDefaults: (input) => dispatch("deviceManager", "getRoleDisplayDefaults", "query", input),
29748
29784
  setRoleDisplayDefaults: (input) => dispatch("deviceManager", "setRoleDisplayDefaults", "mutation", input),
29749
29785
  listLocations: (input) => dispatch("deviceManager", "listLocations", "query", input),
@@ -33909,6 +33945,7 @@ exports.AUDIO_MACRO_LABELS = AUDIO_MACRO_LABELS;
33909
33945
  exports.AlarmArmModeSchema = AlarmArmModeSchema;
33910
33946
  exports.CLIP_BROKER_PACED_RATES = CLIP_BROKER_PACED_RATES;
33911
33947
  exports.COCO_TO_MACRO = COCO_TO_MACRO;
33948
+ exports.CONTAINER_PRIMARY_CHILD_RULES = CONTAINER_PRIMARY_CHILD_RULES;
33912
33949
  exports.CamProfileSchema = CamProfileSchema;
33913
33950
  exports.DEFAULT_TIMELAPSE_PREVIEW_TEXT = DEFAULT_TIMELAPSE_PREVIEW_TEXT;
33914
33951
  exports.DEFINITIVE_DEVICE_REFUSALS = DEFINITIVE_DEVICE_REFUSALS;
package/dist/client.mjs CHANGED
@@ -27475,12 +27475,42 @@ function remoteRoleLabel(role, locale) {
27475
27475
  * priority-in-sync.ts` fails the build when either drifts — the comment that
27476
27476
  * used to ask for this could not.
27477
27477
  *
27478
- * The rule has two halves and the ORDER matters: an operator's explicit pick
27479
- * wins outright, and only in its absence does type priority decide. The pick is
27480
- * keyed on the child's re-sync-stable `entityId`, not its numeric id, so it
27481
- * survives a re-sync that reallocates ids.
27478
+ * The rule has three halves and the ORDER matters: an operator's explicit pick
27479
+ * wins outright; else a declaration on the device type
27480
+ * ({@link CONTAINER_PRIMARY_CHILD_RULES}); else role, namesake, then type
27481
+ * priority. The pick is keyed on the child's re-sync-stable `entityId`, not
27482
+ * its numeric id, so it survives a re-sync that reallocates ids.
27482
27483
  */
27483
27484
  /**
27485
+ * Device types that name their primary child. A heat pump stands for itself:
27486
+ * its hero is the system row, not the climate circuit that type-rank would
27487
+ * otherwise pick.
27488
+ */
27489
+ var CONTAINER_PRIMARY_CHILD_RULES = [{
27490
+ deviceType: DeviceType.HeatPump,
27491
+ primary: "self"
27492
+ }];
27493
+ /**
27494
+ * The type declaration, before the heuristic. `fall-through` means the
27495
+ * heuristic still decides: the type declared nothing, or it named a child
27496
+ * type that is not among the children.
27497
+ */
27498
+ function declaredChildType(primary) {
27499
+ if (primary === "self") return void 0;
27500
+ return primary.childType;
27501
+ }
27502
+ function applyPrimaryChildRule(rule, children) {
27503
+ if (rule === void 0) return { kind: "fall-through" };
27504
+ const childType = declaredChildType(rule.primary);
27505
+ if (childType === void 0) return { kind: "none" };
27506
+ const match = children.find((child) => child.type === childType);
27507
+ if (match === void 0) return { kind: "fall-through" };
27508
+ return {
27509
+ kind: "child",
27510
+ child: match
27511
+ };
27512
+ }
27513
+ /**
27484
27514
  * Type priority, most→least "primary". An actuator (climate / lock / cover / …)
27485
27515
  * outranks a bare `switch` so a container's defining child wins over its
27486
27516
  * auxiliary switches. Unknown or absent types sort after every entry.
@@ -27567,9 +27597,10 @@ function rank(type) {
27567
27597
  }
27568
27598
  /**
27569
27599
  * The child a container stands for: the operator's pick when it still exists,
27570
- * else the highest-priority type. `null` for a childless container — a caller
27571
- * must decide what an empty container means for it, rather than being handed a
27572
- * child that is not there.
27600
+ * else the device type's declaration, else the highest-priority type. `null`
27601
+ * for a childless container, and for a type that stands for itself — a caller
27602
+ * must decide what "no child" means for it, rather than being handed a child
27603
+ * that is not the device.
27573
27604
  */
27574
27605
  /**
27575
27606
  * Two names for the same thing, compared the way an integration writes them.
@@ -27598,11 +27629,14 @@ function sameName(childName, containerName) {
27598
27629
  const flatten = (v) => v.toLowerCase().replace(/[-_\s]+/g, " ").trim();
27599
27630
  return flatten(childName) === flatten(containerName);
27600
27631
  }
27601
- function resolveContainerPrimaryChild(children, overrideEntityId, containerName) {
27632
+ function resolveContainerPrimaryChild(children, overrideEntityId, containerName, containerType) {
27602
27633
  if (overrideEntityId !== void 0 && overrideEntityId !== null) {
27603
27634
  const picked = children.find((c) => c.stableId === overrideEntityId) ?? children.find((c) => c.entityId !== void 0 && c.entityId === overrideEntityId);
27604
27635
  if (picked !== void 0) return picked;
27605
27636
  }
27637
+ const declared = applyPrimaryChildRule(CONTAINER_PRIMARY_CHILD_RULES.find((entry) => entry.deviceType === containerType), children);
27638
+ if (declared.kind === "none") return null;
27639
+ if (declared.kind === "child") return declared.child;
27606
27640
  const namesake = (c) => containerName !== void 0 && containerName.length > 0 && c.name !== void 0 && sameName(c.name, containerName) ? 0 : 1;
27607
27641
  return [...children].toSorted((a, b) => roleRank(a.role) - roleRank(b.role) || namesake(a) - namesake(b) || rank(a.type) - rank(b.type))[0] ?? null;
27608
27642
  }
@@ -29743,6 +29777,8 @@ function createSystemProxy(api) {
29743
29777
  registerDevice: (input) => dispatch("deviceManager", "registerDevice", "mutation", input),
29744
29778
  removeDevice: (input) => dispatch("deviceManager", "removeDevice", "mutation", input),
29745
29779
  persistConfig: (input) => dispatch("deviceManager", "persistConfig", "mutation", input),
29780
+ renderDeviceTemplates: (input) => dispatch("deviceManager", "renderDeviceTemplates", "query", input),
29781
+ checkDeviceTemplates: (input) => dispatch("deviceManager", "checkDeviceTemplates", "query", input),
29746
29782
  getRoleDisplayDefaults: (input) => dispatch("deviceManager", "getRoleDisplayDefaults", "query", input),
29747
29783
  setRoleDisplayDefaults: (input) => dispatch("deviceManager", "setRoleDisplayDefaults", "mutation", input),
29748
29784
  listLocations: (input) => dispatch("deviceManager", "listLocations", "query", input),
@@ -33903,4 +33939,4 @@ var TimelapseRuleSchema = TimelapseRuleInputSchema.extend({
33903
33939
  updatedAt: z.number()
33904
33940
  });
33905
33941
  //#endregion
33906
- export { APPLE_SA_TO_MACRO, AUDIO_MACRO_LABELS, AlarmArmModeSchema, CLIP_BROKER_PACED_RATES, COCO_TO_MACRO, CamProfileSchema, DEFAULT_TIMELAPSE_PREVIEW_TEXT, DEFINITIVE_DEVICE_REFUSALS, DEVICE_CERT_RENEW_WINDOW_DAYS, DEVICE_CERT_SIGNATURE, DEVICE_DEFINITIVE_REFUSALS_BEFORE_DELETE, DEVICE_REFRESH_REFUSAL_PREFIX, DEVICE_SIGNATURE_MESSAGE_VERSION, DeviceType, EVENTFUL_CAP_NAMES, EVENT_KIND_BY_CAP, EVENT_TAXONOMY, ICON_CATEGORIES, ICON_ENTRIES, ICON_KEYS, ICON_VIEWER_MODULES, IconKeySchema, LOCATION_ICON_FALLBACK, MACRO_LABELS, NC_ALARM_DELAY_MAX_SEC, NC_ALARM_SENSORS_MAX, NC_ALARM_SYSTEM_EVENT_KINDS, NC_ALARM_TRIGGERED_MAX_SEC, NC_BATTERY_CONSUMABLE_SYSTEM_EVENT_KINDS, NC_CAMERA_SCOPE_CAP_NAME, NC_CONSUMABLE_LOW_PERCENT_DEFAULT, NC_CONSUMABLE_LOW_PERCENT_MAX, NC_GROUPING_DEFAULT_SEC, NC_GROUPING_MAX_SEC, NC_GROUPING_MIN_SEC, NC_RULE_EDITOR_SECTION_ORDER, NC_RULE_KIND_SPECS, NC_SENSOR_TRANSITION_UNSUPPORTED_REASON, NC_SYSTEM_EVENT_CLASS_SPECS, NC_SYSTEM_EVENT_FAMILY_FILTERS, NC_SYSTEM_EVENT_KIND_GROUP_SPECS, NC_SYSTEM_EVENT_SUMMARY_FAMILIES, NC_TEMPLATE_HELD_BACK_SYSTEM_EVENT_KINDS, NC_TEMPLATE_VARS, NcAlarmConfigSchema, NcAlarmSensorsSchema, NcAlarmSettingsPatchSchema, NcHistoryEntrySchema, NcRuleLastRunsSchema, NodeDirectorySchema, RECORDING_EXPORT_MAX_READ_BYTES, REMOTE_CUSTOM_ROLE_ICON, REMOTE_ROLE_VOCABULARY, RETRAIN_REVIEW_ADJUSTED_IOU, RETRAIN_REVIEW_MATCH_IOU, RETRAIN_REVIEW_STATUSES, RETRAIN_REVISION_CONFLICT, SystemMirror, TIMELAPSE_DENSE_FLOOR_SEC, TimelapseRuleSchema, YAMNET_TO_MACRO, alarmDeviceBlocksArming, alarmDeviceSecureOnArm, alarmPatchLanded, buildDeviceEnrollmentLink, buildDeviceSignatureMessage, buildSubjectPath, bundledCamstack, canonicalIconKey, classifyRetrainReview, conditionVisibleForKind, createSystemProxy, deviceRefusalFromMessage, droppedConditionsForKind, expandSystemEventClasses, iconCategoryLabel, iconEntry, iconsInCategory, isDefinitiveDeviceRefusal, isDrawableSubjectPath, isHeldBackTemplateVar, isIconKey, isSystemRuleKind, kindsForDiscriminator, knownValues, locationIconKey, nodePickerItems, packagePickerItems, paintHex, paletteResultSchema, parseDeviceEnrollmentLink, parseRetrainRevisionConflict, pickerForCondition, pickerForRuleClasses, projectSubjectPath, remoteRoleIcon, remoteRoleLabel, remoteRoleLegend, resolveContainerPrimaryChild, resolveIconKey, resolveModeDelays, retrainBoxIou, retrainRevisionConflictMessage, ruleDeviceCompatCapNames, ruleEditorSectionsForKind, ruleGroupingApplies, ruleKindOf, ruleKindSpec, ruleSeedForSection, searchIcons, sensorTransitionNeverFires, sensorTransitionOffered, stateLabel, subjectPathSampleFromBox, subjectPathSvgPoints, summarizeReview, systemEventClassKinds, systemEventClassesFor, systemEventDeliveryProblems, systemEventFilterAppliesToAnyKind, systemEventKindsOfFamily, systemFamilyOfKind, templateCarriesSummary, templateVarDeliveryApplies, templateVarKindApplies, templateVarSystemEventApplies, withSystemEventClasses };
33942
+ export { APPLE_SA_TO_MACRO, AUDIO_MACRO_LABELS, AlarmArmModeSchema, CLIP_BROKER_PACED_RATES, COCO_TO_MACRO, CONTAINER_PRIMARY_CHILD_RULES, CamProfileSchema, DEFAULT_TIMELAPSE_PREVIEW_TEXT, DEFINITIVE_DEVICE_REFUSALS, DEVICE_CERT_RENEW_WINDOW_DAYS, DEVICE_CERT_SIGNATURE, DEVICE_DEFINITIVE_REFUSALS_BEFORE_DELETE, DEVICE_REFRESH_REFUSAL_PREFIX, DEVICE_SIGNATURE_MESSAGE_VERSION, DeviceType, EVENTFUL_CAP_NAMES, EVENT_KIND_BY_CAP, EVENT_TAXONOMY, ICON_CATEGORIES, ICON_ENTRIES, ICON_KEYS, ICON_VIEWER_MODULES, IconKeySchema, LOCATION_ICON_FALLBACK, MACRO_LABELS, NC_ALARM_DELAY_MAX_SEC, NC_ALARM_SENSORS_MAX, NC_ALARM_SYSTEM_EVENT_KINDS, NC_ALARM_TRIGGERED_MAX_SEC, NC_BATTERY_CONSUMABLE_SYSTEM_EVENT_KINDS, NC_CAMERA_SCOPE_CAP_NAME, NC_CONSUMABLE_LOW_PERCENT_DEFAULT, NC_CONSUMABLE_LOW_PERCENT_MAX, NC_GROUPING_DEFAULT_SEC, NC_GROUPING_MAX_SEC, NC_GROUPING_MIN_SEC, NC_RULE_EDITOR_SECTION_ORDER, NC_RULE_KIND_SPECS, NC_SENSOR_TRANSITION_UNSUPPORTED_REASON, NC_SYSTEM_EVENT_CLASS_SPECS, NC_SYSTEM_EVENT_FAMILY_FILTERS, NC_SYSTEM_EVENT_KIND_GROUP_SPECS, NC_SYSTEM_EVENT_SUMMARY_FAMILIES, NC_TEMPLATE_HELD_BACK_SYSTEM_EVENT_KINDS, NC_TEMPLATE_VARS, NcAlarmConfigSchema, NcAlarmSensorsSchema, NcAlarmSettingsPatchSchema, NcHistoryEntrySchema, NcRuleLastRunsSchema, NodeDirectorySchema, RECORDING_EXPORT_MAX_READ_BYTES, REMOTE_CUSTOM_ROLE_ICON, REMOTE_ROLE_VOCABULARY, RETRAIN_REVIEW_ADJUSTED_IOU, RETRAIN_REVIEW_MATCH_IOU, RETRAIN_REVIEW_STATUSES, RETRAIN_REVISION_CONFLICT, SystemMirror, TIMELAPSE_DENSE_FLOOR_SEC, TimelapseRuleSchema, YAMNET_TO_MACRO, alarmDeviceBlocksArming, alarmDeviceSecureOnArm, alarmPatchLanded, buildDeviceEnrollmentLink, buildDeviceSignatureMessage, buildSubjectPath, bundledCamstack, canonicalIconKey, classifyRetrainReview, conditionVisibleForKind, createSystemProxy, deviceRefusalFromMessage, droppedConditionsForKind, expandSystemEventClasses, iconCategoryLabel, iconEntry, iconsInCategory, isDefinitiveDeviceRefusal, isDrawableSubjectPath, isHeldBackTemplateVar, isIconKey, isSystemRuleKind, kindsForDiscriminator, knownValues, locationIconKey, nodePickerItems, packagePickerItems, paintHex, paletteResultSchema, parseDeviceEnrollmentLink, parseRetrainRevisionConflict, pickerForCondition, pickerForRuleClasses, projectSubjectPath, remoteRoleIcon, remoteRoleLabel, remoteRoleLegend, resolveContainerPrimaryChild, resolveIconKey, resolveModeDelays, retrainBoxIou, retrainRevisionConflictMessage, ruleDeviceCompatCapNames, ruleEditorSectionsForKind, ruleGroupingApplies, ruleKindOf, ruleKindSpec, ruleSeedForSection, searchIcons, sensorTransitionNeverFires, sensorTransitionOffered, stateLabel, subjectPathSampleFromBox, subjectPathSvgPoints, summarizeReview, systemEventClassKinds, systemEventClassesFor, systemEventDeliveryProblems, systemEventFilterAppliesToAnyKind, systemEventKindsOfFamily, systemFamilyOfKind, templateCarriesSummary, templateVarDeliveryApplies, templateVarKindApplies, templateVarSystemEventApplies, withSystemEventClasses };
@@ -418,6 +418,20 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
418
418
  return DeviceRole;
419
419
  }({});
420
420
  //#endregion
421
+ //#region src/composition/composed-stable-id.ts
422
+ /**
423
+ * A composed device's stableId is this prefix plus the block id. Its own module,
424
+ * free of zod, so the addon runner can read it through `@camstack/types/addon`
425
+ * without loading the schema barrel (D28).
426
+ */
427
+ var COMPOSED_DEVICE_STABLE_ID_PREFIX = "composed-";
428
+ //#endregion
429
+ Object.defineProperty(exports, "COMPOSED_DEVICE_STABLE_ID_PREFIX", {
430
+ enumerable: true,
431
+ get: function() {
432
+ return COMPOSED_DEVICE_STABLE_ID_PREFIX;
433
+ }
434
+ });
421
435
  Object.defineProperty(exports, "ChargingStatus", {
422
436
  enumerable: true,
423
437
  get: function() {
@@ -418,4 +418,12 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
418
418
  return DeviceRole;
419
419
  }({});
420
420
  //#endregion
421
- export { featuresOfBoundCaps as a, DeviceType as i, DeviceFeature as n, errMsg as o, DeviceRole as r, ChargingStatus as t };
421
+ //#region src/composition/composed-stable-id.ts
422
+ /**
423
+ * A composed device's stableId is this prefix plus the block id. Its own module,
424
+ * free of zod, so the addon runner can read it through `@camstack/types/addon`
425
+ * without loading the schema barrel (D28).
426
+ */
427
+ var COMPOSED_DEVICE_STABLE_ID_PREFIX = "composed-";
428
+ //#endregion
429
+ export { DeviceType as a, DeviceRole as i, ChargingStatus as n, featuresOfBoundCaps as o, DeviceFeature as r, errMsg as s, COMPOSED_DEVICE_STABLE_ID_PREFIX as t };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * A composed device's stableId is this prefix plus the block id. Its own module,
3
+ * free of zod, so the addon runner can read it through `@camstack/types/addon`
4
+ * without loading the schema barrel (D28).
5
+ */
6
+ export declare const COMPOSED_DEVICE_STABLE_ID_PREFIX = "composed-";
@@ -28,8 +28,8 @@ export declare const COMPOSER_ADDON_ID = "composer";
28
28
  * customization apart: `composition.target.kind === 'existing'` says that (D663).
29
29
  */
30
30
  export declare const CUSTOMIZATION_BLOCK_NAME_PREFIX = "customize:";
31
- /** A composed device's stableId is this prefix plus the block id. */
32
- export declare const COMPOSED_DEVICE_STABLE_ID_PREFIX = "composed-";
31
+ import { COMPOSED_DEVICE_STABLE_ID_PREFIX } from './composed-stable-id.js';
32
+ export { COMPOSED_DEVICE_STABLE_ID_PREFIX };
33
33
  /** A device with more capabilities than this is two devices. */
34
34
  export declare const MAX_COMPOSITION_FEATURES = 16;
35
35
  export declare const MAX_COMPOSITION_FIELDS_PER_FEATURE = 32;
@@ -1,4 +1,4 @@
1
- import { i as DeviceType, r as DeviceRole } from "./device-type-DTTZKB2I.mjs";
1
+ import { a as DeviceType, i as DeviceRole, t as COMPOSED_DEVICE_STABLE_ID_PREFIX } from "./composed-stable-id-DLcPInGv.mjs";
2
2
  import { z } from "zod";
3
3
  import { createHash } from "node:crypto";
4
4
  //#region src/ffmpeg/invocation.ts
@@ -3099,8 +3099,6 @@ var COMPOSER_ADDON_ID = "composer";
3099
3099
  * customization apart: `composition.target.kind === 'existing'` says that (D663).
3100
3100
  */
3101
3101
  var CUSTOMIZATION_BLOCK_NAME_PREFIX = "customize:";
3102
- /** A composed device's stableId is this prefix plus the block id. */
3103
- var COMPOSED_DEVICE_STABLE_ID_PREFIX = "composed-";
3104
3102
  /** A device with more capabilities than this is two devices. */
3105
3103
  var MAX_COMPOSITION_FEATURES = 16;
3106
3104
  var MAX_COMPOSITION_FIELDS_PER_FEATURE = 32;
@@ -3401,4 +3399,4 @@ function featureSources(feature) {
3401
3399
  return featureFieldEntries(feature).map((e) => e.source);
3402
3400
  }
3403
3401
  //#endregion
3404
- export { ExpressionHelperSpecSchema as $, evaluateAst as $t, MAX_COMPOSITION_FIELDS_PER_FEATURE as A, sliceChangedAt as An, maxDurationMs as At, featureSources as B, RESTREAM_INPUT_PROBE as Bn, evaluateDerivative as Bt, CompositionPassthroughFeatureSchema as C, SOURCE_CAP_ACTIVE_FIELD as Cn, MIN_CUSTOM_MINUTES as Ct, FORWARD_INPUT_KEY as D, evaluateSensorLevelEdge as Dn, StatisticWindowSchema as Dt, CompositionTargetSchema as E, evaluateSensorEdge as En, RollingWindowSchema as Et, compositionItemFieldPath as F, getFfmpegArtifact as Fn, planStatisticTier as Ft, ARITHMETIC_OPS as G, buildVideoArgs as Gn, EXPRESSION_INJECTED_NOW as Gt, isForwardInputRef as H, buildAudioArgs as Hn, integrateReading as Ht, compositionReadKey as I, getFfmpegDownloadUrl as In, rollingDurationMs as It, ArithmeticHelperSpecSchema as J, logBannerArgs as Jn, evaluateExpressionSource as Jt, ActiveCriterionSchema as K, invocationFromEncodeProfile as Kn, cloneStatefulExpressionMemory as Kt, compositionSliceKey as L, canonicalHash as Ln, statisticCadenceMs as Lt, composedDeviceRef as M, chooseFfmpegBinary as Mn, openReset as Mt, composedDeviceStableId as N, ffmpegBinaryName as Nn, openStatistic as Nt, MAX_COMPOSITION_CODE_LENGTH as O, isSourceCap as On, historyRetentionFromSettings as Ot, compositionFeatureEnabled as P, FFMPEG_RELEASE as Pn, planResetTier as Pt, EXPRESSION_OUTPUTS as Q, createExpressionScope as Qt, compositionSourceKey as R, Fmp4BoxSplitter as Rn, SERIES_KINDS as Rt, CompositionNewTargetSchema as S, SOURCE_CAPS as Sn, MINUTE_MS as St, CompositionSeriesSourceSchema as T, SOURCE_DEVICE_TYPES as Tn, ROLLING_SPANS as Tt, ACTIVE_CRITERIA as U, buildFfmpegArgs as Un, KWH_PER_WATT_MS as Ut, fieldReads as V, audioPlanFromEncodeProfile as Vn, evaluateStatistic as Vt, AGGREGATE_REDUCERS as W, buildInputArgs as Wn, wattMillisecondsToKwh as Wt, DERIVATIVE_UNITS as X, resolveStreamMaps as Xn, toExpressionValue as Xt, BINARY_AGGREGATES as Y, pickVideoEncoder as Yn, evaluateStatefulExpressionCall as Yt, DerivativeHelperSpecSchema as Z, validateExpressionSource as Zt, CompositionForwardArgSchema as _, evaluateRose as _n, DEFAULT_HISTORY_RETENTION as _t, CUSTOMIZATION_BLOCK_NAME_PREFIX as a, EXPRESSION_IDENTIFIER_RE as an, INTEGRAL_OUTPUTS as at, CompositionItemEntrySchema as b, ExpressionParseError as bn, HISTORY_TIERS as bt, CompositionCodeSourceSchema as c, MAX_EXPRESSION_CALL_ARGS as cn, NUMERIC_AGGREGATES as ct, CompositionExpressionSourceSchema as d, RESERVED_BINDING_NAMES as dn, helperMembers as dt, compileExpression as en, GROUP_TEMPLATE_IDS as et, CompositionExtensionCommandSchema as f, EXPRESSION_BUILTINS as fn, isHistoryHelper as ft, CompositionFieldsFeatureSchema as g, evaluateDwell as gn, DAY_MS as gt, CompositionFieldSourceSchema as h, evaluateCount as hn, CalendarWindowSchema as ht, COMPOSITION_ITEM_KEY_RE as i, EXPRESSION_COMPILE_CACHE_CAPACITY as in, HelperSpecSchema as it, MAX_COMPOSITION_ITEMS as j, FFMPEG_PATH_ENV as jn, nextLocalMidnight as jt, MAX_COMPOSITION_FEATURES as k, sliceActiveValue as kn, integralCadenceMs as kt, CompositionCommandTargetSchema as l, MAX_EXPRESSION_EVAL_STEPS as ln, StatisticHelperSpecSchema as lt, CompositionFieldReadSchema as m, disarmRoseMemory as mn, CALENDAR_PERIODS as mt, COMPOSER_ADDON_ID as n, parseExpression as nn, GroupTemplateIdSchema as nt, CompositionAggregateSourceSchema as o, MAX_EXPRESSION_AST_NODES as on, IntegralHelperSpecSchema as ot, CompositionFeatureSchema as p, EXPRESSION_BUILTIN_NAMES as pn, CompositionSourceRefSchema as pt, AggregateReducerSchema as q, isSoftwareDecode as qn, createStatefulExpressionMemory as qt, COMPOSITION_ITEM_ARRAY_PATH as r, tokenize as rn, HelperMemberSchema as rt, CompositionBindingSchema as s, MAX_EXPRESSION_BINDINGS as sn, MAX_HELPER_MEMBERS as st, COMPOSED_DEVICE_STABLE_ID_PREFIX as t, compileExpressionSafe as tn, GroupHelperSpecSchema as tt, CompositionExistingTargetSchema as u, MAX_EXPRESSION_SOURCE_LENGTH as un, ThresholdHelperSpecSchema as ut, CompositionForwardCommandSchema as v, isStatefulBuiltin as vn, HISTORY_FAST_MS as vt, CompositionSchema as w, SOURCE_CAP_CHANGED_AT_FIELD as wn, RESET_PERIODS as wt, CompositionLiteralBindingSchema as x, DEFAULT_FIRST_SIGHTING_FRESHNESS_MS as xn, HOUR_MS as xt, CompositionFromSourceSchema as y, ExpressionEvalError as yn, HISTORY_SLOW_MS as yt, featureFieldEntries as z, AUDIO_PRESETS as zn, STATISTIC_STATS as zt };
3402
+ export { GROUP_TEMPLATE_IDS as $, compileExpression as $t, MAX_COMPOSITION_ITEMS as A, FFMPEG_PATH_ENV as An, nextLocalMidnight as At, fieldReads as B, audioPlanFromEncodeProfile as Bn, evaluateStatistic as Bt, CompositionSchema as C, SOURCE_CAP_CHANGED_AT_FIELD as Cn, RESET_PERIODS as Ct, MAX_COMPOSITION_CODE_LENGTH as D, isSourceCap as Dn, historyRetentionFromSettings as Dt, FORWARD_INPUT_KEY as E, evaluateSensorLevelEdge as En, StatisticWindowSchema as Et, compositionReadKey as F, getFfmpegDownloadUrl as Fn, rollingDurationMs as Ft, ActiveCriterionSchema as G, invocationFromEncodeProfile as Gn, cloneStatefulExpressionMemory as Gt, ACTIVE_CRITERIA as H, buildFfmpegArgs as Hn, KWH_PER_WATT_MS as Ht, compositionSliceKey as I, canonicalHash as In, statisticCadenceMs as It, BINARY_AGGREGATES as J, pickVideoEncoder as Jn, evaluateStatefulExpressionCall as Jt, AggregateReducerSchema as K, isSoftwareDecode as Kn, createStatefulExpressionMemory as Kt, compositionSourceKey as L, Fmp4BoxSplitter as Ln, SERIES_KINDS as Lt, composedDeviceStableId as M, ffmpegBinaryName as Mn, openStatistic as Mt, compositionFeatureEnabled as N, FFMPEG_RELEASE as Nn, planResetTier as Nt, MAX_COMPOSITION_FEATURES as O, sliceActiveValue as On, integralCadenceMs as Ot, compositionItemFieldPath as P, getFfmpegArtifact as Pn, planStatisticTier as Pt, ExpressionHelperSpecSchema as Q, evaluateAst as Qt, featureFieldEntries as R, AUDIO_PRESETS as Rn, STATISTIC_STATS as Rt, CompositionPassthroughFeatureSchema as S, SOURCE_CAP_ACTIVE_FIELD as Sn, MIN_CUSTOM_MINUTES as St, CompositionTargetSchema as T, evaluateSensorEdge as Tn, RollingWindowSchema as Tt, AGGREGATE_REDUCERS as U, buildInputArgs as Un, wattMillisecondsToKwh as Ut, isForwardInputRef as V, buildAudioArgs as Vn, integrateReading as Vt, ARITHMETIC_OPS as W, buildVideoArgs as Wn, EXPRESSION_INJECTED_NOW as Wt, DerivativeHelperSpecSchema as X, validateExpressionSource as Xt, DERIVATIVE_UNITS as Y, resolveStreamMaps as Yn, toExpressionValue as Yt, EXPRESSION_OUTPUTS as Z, createExpressionScope as Zt, CompositionForwardCommandSchema as _, isStatefulBuiltin as _n, HISTORY_FAST_MS as _t, CompositionAggregateSourceSchema as a, MAX_EXPRESSION_AST_NODES as an, IntegralHelperSpecSchema as at, CompositionLiteralBindingSchema as b, DEFAULT_FIRST_SIGHTING_FRESHNESS_MS as bn, HOUR_MS as bt, CompositionCommandTargetSchema as c, MAX_EXPRESSION_EVAL_STEPS as cn, StatisticHelperSpecSchema as ct, CompositionExtensionCommandSchema as d, EXPRESSION_BUILTINS as dn, isHistoryHelper as dt, compileExpressionSafe as en, GroupHelperSpecSchema as et, CompositionFeatureSchema as f, EXPRESSION_BUILTIN_NAMES as fn, CompositionSourceRefSchema as ft, CompositionForwardArgSchema as g, evaluateRose as gn, DEFAULT_HISTORY_RETENTION as gt, CompositionFieldsFeatureSchema as h, evaluateDwell as hn, DAY_MS as ht, CUSTOMIZATION_BLOCK_NAME_PREFIX as i, EXPRESSION_IDENTIFIER_RE as in, INTEGRAL_OUTPUTS as it, composedDeviceRef as j, chooseFfmpegBinary as jn, openReset as jt, MAX_COMPOSITION_FIELDS_PER_FEATURE as k, sliceChangedAt as kn, maxDurationMs as kt, CompositionExistingTargetSchema as l, MAX_EXPRESSION_SOURCE_LENGTH as ln, ThresholdHelperSpecSchema as lt, CompositionFieldSourceSchema as m, evaluateCount as mn, CalendarWindowSchema as mt, COMPOSITION_ITEM_ARRAY_PATH as n, tokenize as nn, HelperMemberSchema as nt, CompositionBindingSchema as o, MAX_EXPRESSION_BINDINGS as on, MAX_HELPER_MEMBERS as ot, CompositionFieldReadSchema as p, disarmRoseMemory as pn, CALENDAR_PERIODS as pt, ArithmeticHelperSpecSchema as q, logBannerArgs as qn, evaluateExpressionSource as qt, COMPOSITION_ITEM_KEY_RE as r, EXPRESSION_COMPILE_CACHE_CAPACITY as rn, HelperSpecSchema as rt, CompositionCodeSourceSchema as s, MAX_EXPRESSION_CALL_ARGS as sn, NUMERIC_AGGREGATES as st, COMPOSER_ADDON_ID as t, parseExpression as tn, GroupTemplateIdSchema as tt, CompositionExpressionSourceSchema as u, RESERVED_BINDING_NAMES as un, helperMembers as ut, CompositionFromSourceSchema as v, ExpressionEvalError as vn, HISTORY_SLOW_MS as vt, CompositionSeriesSourceSchema as w, SOURCE_DEVICE_TYPES as wn, ROLLING_SPANS as wt, CompositionNewTargetSchema as x, SOURCE_CAPS as xn, MINUTE_MS as xt, CompositionItemEntrySchema as y, ExpressionParseError as yn, HISTORY_TIERS as yt, featureSources as z, RESTREAM_INPUT_PROBE as zn, evaluateDerivative as zt };
@@ -1,4 +1,4 @@
1
- const require_device_type = require("./device-type-BfvqqzRp.js");
1
+ const require_composed_stable_id = require("./composed-stable-id-C3J6LxC9.js");
2
2
  let zod = require("zod");
3
3
  let node_crypto = require("node:crypto");
4
4
  //#region src/ffmpeg/invocation.ts
@@ -3099,8 +3099,6 @@ var COMPOSER_ADDON_ID = "composer";
3099
3099
  * customization apart: `composition.target.kind === 'existing'` says that (D663).
3100
3100
  */
3101
3101
  var CUSTOMIZATION_BLOCK_NAME_PREFIX = "customize:";
3102
- /** A composed device's stableId is this prefix plus the block id. */
3103
- var COMPOSED_DEVICE_STABLE_ID_PREFIX = "composed-";
3104
3102
  /** A device with more capabilities than this is two devices. */
3105
3103
  var MAX_COMPOSITION_FEATURES = 16;
3106
3104
  var MAX_COMPOSITION_FIELDS_PER_FEATURE = 32;
@@ -3309,8 +3307,8 @@ function compositionFeatureEnabled(feature) {
3309
3307
  */
3310
3308
  var CompositionNewTargetSchema = zod.z.object({
3311
3309
  kind: zod.z.literal("new"),
3312
- type: zod.z.enum(require_device_type.DeviceType),
3313
- role: zod.z.enum(require_device_type.DeviceRole).optional()
3310
+ type: zod.z.enum(require_composed_stable_id.DeviceType),
3311
+ role: zod.z.enum(require_composed_stable_id.DeviceRole).optional()
3314
3312
  });
3315
3313
  /** Customize an EXISTING device: each feature adds a capability or replaces fields of a native one (D663). */
3316
3314
  var CompositionExistingTargetSchema = zod.z.object({
@@ -3352,7 +3350,7 @@ function compositionReadKey(read) {
3352
3350
  return `${compositionSliceKey(read.source, read.cap)}.${read.fieldPath}`;
3353
3351
  }
3354
3352
  function composedDeviceStableId(blockId) {
3355
- return `${COMPOSED_DEVICE_STABLE_ID_PREFIX}${blockId}`;
3353
+ return `${require_composed_stable_id.COMPOSED_DEVICE_STABLE_ID_PREFIX}${blockId}`;
3356
3354
  }
3357
3355
  function composedDeviceRef(blockId) {
3358
3356
  return {
@@ -3455,12 +3453,6 @@ Object.defineProperty(exports, "CALENDAR_PERIODS", {
3455
3453
  return CALENDAR_PERIODS;
3456
3454
  }
3457
3455
  });
3458
- Object.defineProperty(exports, "COMPOSED_DEVICE_STABLE_ID_PREFIX", {
3459
- enumerable: true,
3460
- get: function() {
3461
- return COMPOSED_DEVICE_STABLE_ID_PREFIX;
3462
- }
3463
- });
3464
3456
  Object.defineProperty(exports, "COMPOSER_ADDON_ID", {
3465
3457
  enumerable: true,
3466
3458
  get: function() {
@@ -23,11 +23,43 @@
23
23
  * priority-in-sync.ts` fails the build when either drifts — the comment that
24
24
  * used to ask for this could not.
25
25
  *
26
- * The rule has two halves and the ORDER matters: an operator's explicit pick
27
- * wins outright, and only in its absence does type priority decide. The pick is
28
- * keyed on the child's re-sync-stable `entityId`, not its numeric id, so it
29
- * survives a re-sync that reallocates ids.
26
+ * The rule has three halves and the ORDER matters: an operator's explicit pick
27
+ * wins outright; else a declaration on the device type
28
+ * ({@link CONTAINER_PRIMARY_CHILD_RULES}); else role, namesake, then type
29
+ * priority. The pick is keyed on the child's re-sync-stable `entityId`, not
30
+ * its numeric id, so it survives a re-sync that reallocates ids.
30
31
  */
32
+ /**
33
+ * What a device type stands for, when it says so itself.
34
+ *
35
+ * `'self'` — the device's own surface is the hero; resolution returns no
36
+ * child. `{ childType }` — the child of that type is primary, ahead of the
37
+ * role / namesake / type-rank heuristic. A type absent from
38
+ * {@link CONTAINER_PRIMARY_CHILD_RULES} keeps the heuristic.
39
+ */
40
+ export type ContainerPrimaryDeclaration = 'self' | {
41
+ readonly childType: string;
42
+ };
43
+ export interface ContainerPrimaryChildRule {
44
+ /** A {@link DeviceType} value. Vendor names do not belong here. */
45
+ readonly deviceType: string;
46
+ readonly primary: ContainerPrimaryDeclaration;
47
+ }
48
+ /**
49
+ * Device types that name their primary child. A heat pump stands for itself:
50
+ * its hero is the system row, not the climate circuit that type-rank would
51
+ * otherwise pick.
52
+ */
53
+ export declare const CONTAINER_PRIMARY_CHILD_RULES: readonly ContainerPrimaryChildRule[];
54
+ export type AppliedPrimaryChildRule = {
55
+ readonly kind: 'fall-through';
56
+ } | {
57
+ readonly kind: 'none';
58
+ } | {
59
+ readonly kind: 'child';
60
+ readonly child: ContainerChildRef;
61
+ };
62
+ export declare function applyPrimaryChildRule(rule: ContainerPrimaryChildRule | undefined, children: readonly ContainerChildRef[]): AppliedPrimaryChildRule;
31
63
  /**
32
64
  * Type priority, most→least "primary". An actuator (climate / lock / cover / …)
33
65
  * outranks a bare `switch` so a container's defining child wins over its
@@ -90,4 +122,4 @@ export interface ContainerChildRef {
90
122
  * they are deliberately absent and fall through to type priority.
91
123
  */
92
124
  export declare const CONTAINER_CHILD_ROLE_PRIORITY: readonly string[];
93
- export declare function resolveContainerPrimaryChild(children: readonly ContainerChildRef[], overrideEntityId: string | null | undefined, containerName?: string): ContainerChildRef | null;
125
+ export declare function resolveContainerPrimaryChild(children: readonly ContainerChildRef[], overrideEntityId: string | null | undefined, containerName: string | undefined, containerType: string | undefined): ContainerChildRef | null;
@@ -139,6 +139,11 @@ export interface DeviceContext {
139
139
  export type DeviceConstructor<T extends IDevice = IDevice> = new (ctx: DeviceContext) => T;
140
140
  /** Map entry helper — concrete camera/hub classes widen to `DeviceConstructor<IDevice>`. */
141
141
  export declare function widenDeviceConstructor<T extends IDevice>(ctor: DeviceConstructor<T>): DeviceConstructor<IDevice>;
142
+ /** Who is writing a device name. Absent means the operator. */
143
+ export interface DeviceNameWrite {
144
+ /** False when the writer is the system, not an operator rename. */
145
+ readonly stampUserNamed: boolean;
146
+ }
142
147
  export interface DeviceManagerApi {
143
148
  /**
144
149
  * Create, register, and persist a device in one call.
@@ -205,8 +210,10 @@ export interface DeviceManagerApi {
205
210
  * initial wizard"). */
206
211
  persistInitialConfig(stableId: string, config: Record<string, unknown>): Promise<number>;
207
212
  /** Update the device's display name. Surfaces immediately in
208
- * the UI device list + on `IDevice.name` for live consumers. */
209
- setName(deviceId: number, name: string): Promise<void>;
213
+ * the UI device list + on `IDevice.name` for live consumers.
214
+ * `stampUserNamed: false` is the system writer (a block name copied
215
+ * onto a composed device); omitted, the write is the operator's. */
216
+ setName(deviceId: number, name: string, opts?: DeviceNameWrite): Promise<void>;
210
217
  /** Set the operator-organisational location label
211
218
  * ("Kitchen" / "Front yard" / …). Pass `null` to clear. */
212
219
  setLocation(deviceId: number, location: string | null): Promise<void>;
@@ -613,6 +613,7 @@ export declare const HeroTimedRunSlotSchema: z.ZodObject<{
613
613
  unlock: "unlock";
614
614
  }>>;
615
615
  }, z.core.$strip>;
616
+ remaining: z.ZodNullable<z.ZodNumber>;
616
617
  }, z.core.$strip>;
617
618
  export type HeroTimedRunSlot = z.infer<typeof HeroTimedRunSlotSchema>;
618
619
  export declare const HeroPowerSupplySlotSchema: z.ZodObject<{
@@ -1286,6 +1287,7 @@ export declare const HeroModelSchema: z.ZodObject<{
1286
1287
  unlock: "unlock";
1287
1288
  }>>;
1288
1289
  }, z.core.$strip>;
1290
+ remaining: z.ZodNullable<z.ZodNumber>;
1289
1291
  }, z.core.$strip>>;
1290
1292
  powerSupply: z.ZodNullable<z.ZodObject<{
1291
1293
  on: z.ZodNullable<z.ZodBoolean>;
@@ -8,12 +8,15 @@
8
8
  * 4. a trailing fact (power, else battery, else consumables).
9
9
  *
10
10
  * Selection rules, all taken from the model:
11
- * - ONE control is ever shown: the device's own power; else the FIRST control of
11
+ * - the primary control is the device's own power; else the FIRST control of
12
12
  * the FIRST row that has any (a later row's control is never promoted). When
13
13
  * the model lists that part in `gated`, the row has no inline control: the
14
14
  * projection never falls through to another control the caller could use.
15
+ * - a timed run, when the model carries the slot, sits beside that primary:
16
+ * Run while idle, Stop while armed. Gating the slot hides the control.
15
17
  * - the status line is the head (what plays, else the state) plus at most
16
- * {@link ROW_STATUS_FACTS_MAX} facts, the trailing fact excluded;
18
+ * {@link ROW_STATUS_FACTS_MAX} facts, the trailing fact excluded, then the
19
+ * time left on an armed timed run;
17
20
  * - the trailing fact is the first of power, battery, consumables.
18
21
  *
19
22
  * `projectDeviceRow` is pure and computes nothing: it selects from a
@@ -22,6 +25,23 @@
22
25
  */
23
26
  import { z } from 'zod';
24
27
  import { type HeroModel } from './hero-model.js';
28
+ /**
29
+ * The row's timed-run control. `id` is `timed-run.run` while idle and
30
+ * `timed-run.cancel` while armed; `duration` and `unit` are the one-tap run
31
+ * a Run press starts.
32
+ */
33
+ export declare const HeroRowTimedRunSchema: z.ZodObject<{
34
+ id: z.ZodEnum<{
35
+ "timed-run.cancel": "timed-run.cancel";
36
+ "timed-run.run": "timed-run.run";
37
+ }>;
38
+ duration: z.ZodNumber;
39
+ unit: z.ZodEnum<{
40
+ min: "min";
41
+ s: "s";
42
+ }>;
43
+ }, z.core.$strip>;
44
+ export type HeroRowTimedRun = z.infer<typeof HeroRowTimedRunSchema>;
25
45
  export declare const HeroRowModelSchema: z.ZodObject<{
26
46
  deviceId: z.ZodNumber;
27
47
  name: z.ZodString;
@@ -241,6 +261,17 @@ export declare const HeroRowModelSchema: z.ZodObject<{
241
261
  }, z.core.$strip>;
242
262
  valueArg: z.ZodString;
243
263
  }, z.core.$strip>], "kind">>;
264
+ timedRun: z.ZodNullable<z.ZodObject<{
265
+ id: z.ZodEnum<{
266
+ "timed-run.cancel": "timed-run.cancel";
267
+ "timed-run.run": "timed-run.run";
268
+ }>;
269
+ duration: z.ZodNumber;
270
+ unit: z.ZodEnum<{
271
+ min: "min";
272
+ s: "s";
273
+ }>;
274
+ }, z.core.$strip>>;
244
275
  trailing: z.ZodNullable<z.ZodObject<{
245
276
  id: z.ZodEnum<{
246
277
  "air-quality": "air-quality";
@@ -30,27 +30,88 @@ export interface DeviceTemplateRef {
30
30
  readonly alias: string;
31
31
  readonly path: readonly (string | number)[];
32
32
  }
33
- export type DeviceTemplateRefusalReason = 'too-long' | 'syntax' | 'forbidden-syntax' | 'forbidden-member' | 'unknown-filter' | 'ambiguous-field' | 'busy' | 'budget-exceeded' | 'timeout' | 'output-too-large' | 'render-failed';
33
+ export declare const DEVICE_TEMPLATE_REFUSAL_REASONS: readonly ['too-long', 'syntax', 'forbidden-syntax', 'forbidden-member', 'unknown-filter', 'ambiguous-field', 'busy', 'budget-exceeded', 'timeout', 'output-too-large', 'render-failed',
34
+ /** The template names a device the caller was not proven to see (D1021 run-time contract). */
35
+ 'out-of-scope',
36
+ /** No renderer on this node, or the call to it failed: the template was not run. */
37
+ 'unavailable'];
38
+ export type DeviceTemplateRefusalReason = (typeof DEVICE_TEMPLATE_REFUSAL_REASONS)[number];
39
+ export declare const DeviceTemplateRefusalSchema: z.ZodObject<{
40
+ reason: z.ZodEnum<{
41
+ "ambiguous-field": "ambiguous-field";
42
+ "budget-exceeded": "budget-exceeded";
43
+ busy: "busy";
44
+ "forbidden-member": "forbidden-member";
45
+ "forbidden-syntax": "forbidden-syntax";
46
+ "out-of-scope": "out-of-scope";
47
+ "output-too-large": "output-too-large";
48
+ "render-failed": "render-failed";
49
+ syntax: "syntax";
50
+ timeout: "timeout";
51
+ "too-long": "too-long";
52
+ unavailable: "unavailable";
53
+ "unknown-filter": "unknown-filter";
54
+ }>;
55
+ message: z.ZodString;
56
+ }, z.core.$strip>;
34
57
  /** A template the engine will not run, or a render that did not finish — named, never a bare string. */
35
- export interface DeviceTemplateRefusal {
36
- readonly reason: DeviceTemplateRefusalReason;
37
- readonly message: string;
38
- }
39
- export type DeviceTemplateTraceReason = 'unknown-alias' | 'unknown-field' | 'no-field' | 'unavailable';
58
+ export type DeviceTemplateRefusal = z.infer<typeof DeviceTemplateRefusalSchema>;
59
+ export declare const DEVICE_TEMPLATE_TRACE_REASONS: readonly ['unknown-alias', 'unknown-field', 'no-field', 'unavailable'];
60
+ export type DeviceTemplateTraceReason = (typeof DEVICE_TEMPLATE_TRACE_REASONS)[number];
61
+ export declare const DeviceTemplateTraceEntrySchema: z.ZodObject<{
62
+ ref: z.ZodString;
63
+ reason: z.ZodEnum<{
64
+ "no-field": "no-field";
65
+ unavailable: "unavailable";
66
+ "unknown-alias": "unknown-alias";
67
+ "unknown-field": "unknown-field";
68
+ }>;
69
+ }, z.core.$strip>;
40
70
  /** One value that rendered as `—`, and why. */
41
- export interface DeviceTemplateTraceEntry {
42
- readonly ref: string;
43
- readonly reason: DeviceTemplateTraceReason;
44
- }
45
- export type DeviceTemplateRender = {
46
- readonly ok: true;
47
- readonly text: string;
48
- readonly trace: readonly DeviceTemplateTraceEntry[];
49
- } | {
50
- readonly ok: false;
51
- readonly refusal: DeviceTemplateRefusal;
52
- readonly trace: readonly DeviceTemplateTraceEntry[];
53
- };
71
+ export type DeviceTemplateTraceEntry = z.infer<typeof DeviceTemplateTraceEntrySchema>;
72
+ export declare const DeviceTemplateRenderSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
73
+ ok: z.ZodLiteral<true>;
74
+ text: z.ZodString;
75
+ trace: z.ZodArray<z.ZodObject<{
76
+ ref: z.ZodString;
77
+ reason: z.ZodEnum<{
78
+ "no-field": "no-field";
79
+ unavailable: "unavailable";
80
+ "unknown-alias": "unknown-alias";
81
+ "unknown-field": "unknown-field";
82
+ }>;
83
+ }, z.core.$strip>>;
84
+ }, z.core.$strip>, z.ZodObject<{
85
+ ok: z.ZodLiteral<false>;
86
+ refusal: z.ZodObject<{
87
+ reason: z.ZodEnum<{
88
+ "ambiguous-field": "ambiguous-field";
89
+ "budget-exceeded": "budget-exceeded";
90
+ busy: "busy";
91
+ "forbidden-member": "forbidden-member";
92
+ "forbidden-syntax": "forbidden-syntax";
93
+ "out-of-scope": "out-of-scope";
94
+ "output-too-large": "output-too-large";
95
+ "render-failed": "render-failed";
96
+ syntax: "syntax";
97
+ timeout: "timeout";
98
+ "too-long": "too-long";
99
+ unavailable: "unavailable";
100
+ "unknown-filter": "unknown-filter";
101
+ }>;
102
+ message: z.ZodString;
103
+ }, z.core.$strip>;
104
+ trace: z.ZodArray<z.ZodObject<{
105
+ ref: z.ZodString;
106
+ reason: z.ZodEnum<{
107
+ "no-field": "no-field";
108
+ unavailable: "unavailable";
109
+ "unknown-alias": "unknown-alias";
110
+ "unknown-field": "unknown-field";
111
+ }>;
112
+ }, z.core.$strip>>;
113
+ }, z.core.$strip>], "ok">;
114
+ export type DeviceTemplateRender = z.infer<typeof DeviceTemplateRenderSchema>;
54
115
  /** What the renderer knows about one device when it resolves an alias. */
55
116
  export interface DeviceTemplateView {
56
117
  readonly deviceId: number;
@@ -2677,6 +2677,20 @@ export type AppRouter = TrpcCoreRouter<{
2677
2677
  output: z.infer<typeof deviceManagerCapability.methods.setAlias.output>;
2678
2678
  meta: object;
2679
2679
  }>;
2680
+ renderDeviceTemplates: TRPCQueryProcedure<{
2681
+ input: {
2682
+ [x: string]: unknown;
2683
+ } & z.input<typeof deviceManagerCapability.methods.renderDeviceTemplates.input>;
2684
+ output: z.infer<typeof deviceManagerCapability.methods.renderDeviceTemplates.output>;
2685
+ meta: object;
2686
+ }>;
2687
+ checkDeviceTemplates: TRPCQueryProcedure<{
2688
+ input: {
2689
+ [x: string]: unknown;
2690
+ } & z.input<typeof deviceManagerCapability.methods.checkDeviceTemplates.input>;
2691
+ output: z.infer<typeof deviceManagerCapability.methods.checkDeviceTemplates.output>;
2692
+ meta: object;
2693
+ }>;
2680
2694
  setLocation: TRPCMutationProcedure<{
2681
2695
  input: {
2682
2696
  [x: string]: unknown;