@camstack/types 1.2.555 → 1.2.557

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 (57) hide show
  1. package/CHANGELOG.md +21 -0
  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/audit/device-transition.d.ts +53 -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 +3 -3
  20. package/dist/capabilities/notification-rules.cap.d.ts +237 -0
  21. package/dist/capabilities/osd-manager.cap.d.ts +96 -0
  22. package/dist/capabilities/remote.cap.d.ts +2 -2
  23. package/dist/capabilities/scene-monitor.cap.d.ts +1 -1
  24. package/dist/capabilities/schedulers.cap.d.ts +96 -216
  25. package/dist/client.d.ts +1 -1
  26. package/dist/client.js +96 -11
  27. package/dist/client.mjs +95 -12
  28. package/dist/device/cap-vocabulary/action-index.d.ts +32 -0
  29. package/dist/device/cap-vocabulary/index.d.ts +2 -2
  30. package/dist/device/device-do-actions.d.ts +3 -105
  31. package/dist/device/export-name.d.ts +65 -0
  32. package/dist/device/hero/hero-contribution-kit.d.ts +3 -0
  33. package/dist/device/hero/hero-fragment.d.ts +3 -0
  34. package/dist/device/hero/hero-measurement.d.ts +76 -0
  35. package/dist/device/hero/hero-model.d.ts +91 -0
  36. package/dist/device/hero/hero-row.d.ts +67 -1
  37. package/dist/device/hero/index.d.ts +1 -0
  38. package/dist/enums/event-category.d.ts +9 -0
  39. package/dist/enums.js +1 -1
  40. package/dist/enums.mjs +1 -1
  41. package/dist/{event-category-78tcBemo.mjs → event-category-Dv-Gcv1f.mjs} +9 -0
  42. package/dist/{event-category-BC4RRerT.js → event-category-Ps2LC8dN.js} +9 -0
  43. package/dist/generated/addon-api.d.ts +7 -0
  44. package/dist/generated/method-access-map.d.ts +1 -1
  45. package/dist/generated/system-proxy.d.ts +1 -1
  46. package/dist/index.d.ts +8 -7
  47. package/dist/index.js +2412 -2143
  48. package/dist/index.mjs +2374 -2127
  49. package/dist/notification/alarm-steps.d.ts +18 -0
  50. package/dist/notification/system-event-families.d.ts +5 -0
  51. package/dist/notification/system-event-filters.d.ts +1 -1
  52. package/dist/remote/remote-config.d.ts +5 -5
  53. package/dist/{sleep-4qch9WKa.js → sleep-1RkA30Y1.js} +102 -1
  54. package/dist/{sleep-Ba1dJYDo.mjs → sleep-DyIxjZZt.mjs} +79 -2
  55. package/dist/testing.js +3 -3
  56. package/dist/testing.mjs +3 -3
  57. package/package.json +1 -1
package/dist/client.d.ts CHANGED
@@ -14,7 +14,7 @@
14
14
  * value this entry does not export — a missing name here is `undefined` at
15
15
  * runtime, not a build error.
16
16
  */
17
- export { APPLE_SA_TO_MACRO, AUDIO_MACRO_LABELS, AlarmArmModeSchema, CLIP_BROKER_PACED_RATES, COCO_TO_MACRO, CamProfileSchema, ICON_CATEGORIES, ICON_ENTRIES, ICON_KEYS, ICON_VIEWER_MODULES, IconKeySchema, LOCATION_ICON_FALLBACK, REMOTE_CUSTOM_ROLE_ICON, REMOTE_ROLE_VOCABULARY, DEFINITIVE_DEVICE_REFUSALS, DEVICE_CERT_RENEW_WINDOW_DAYS, DEVICE_DEFINITIVE_REFUSALS_BEFORE_DELETE, DEVICE_REFRESH_REFUSAL_PREFIX, DEVICE_CERT_SIGNATURE, DEVICE_SIGNATURE_MESSAGE_VERSION, DEFAULT_TIMELAPSE_PREVIEW_TEXT, DeviceType, EVENTFUL_CAP_NAMES, EVENT_KIND_BY_CAP, EVENT_TAXONOMY, 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_FAMILY_FILTERS, NC_SYSTEM_EVENT_CLASS_SPECS, 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, 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, canonicalIconKey, buildDeviceEnrollmentLink, buildDeviceSignatureMessage, deviceRefusalFromMessage, isDefinitiveDeviceRefusal, classifyRetrainReview, conditionVisibleForKind, createSystemProxy, droppedConditionsForKind, iconCategoryLabel, iconEntry, iconsInCategory, isIconKey, isHeldBackTemplateVar, isSystemRuleKind, kindsForDiscriminator, locationIconKey, knownValues, nodePickerItems, parseDeviceEnrollmentLink, packagePickerItems, pickerForCondition, pickerForRuleClasses, parseRetrainRevisionConflict, remoteRoleIcon, remoteRoleLabel, remoteRoleLegend, resolveIconKey, resolveModeDelays, retrainBoxIou, retrainRevisionConflictMessage, ruleDeviceCompatCapNames, ruleEditorSectionsForKind, ruleGroupingApplies, ruleKindOf, ruleKindSpec, ruleSeedForSection, searchIcons, sensorTransitionNeverFires, sensorTransitionOffered, stateLabel, summarizeReview, systemEventClassesFor, systemEventClassKinds, systemEventDeliveryProblems, systemEventFilterAppliesToAnyKind, systemEventKindsOfFamily, systemFamilyOfKind, templateCarriesSummary, templateVarDeliveryApplies, templateVarKindApplies, templateVarSystemEventApplies, buildSubjectPath, isDrawableSubjectPath, projectSubjectPath, subjectPathSampleFromBox, subjectPathSvgPoints, expandSystemEventClasses, withSystemEventClasses, bundledCamstack, paintHex, paletteResultSchema, CONTAINER_PRIMARY_CHILD_RULES, primaryChildPreferenceOf, resolveContainerPrimaryChild, } from './index.js';
17
+ export { APPLE_SA_TO_MACRO, AUDIO_MACRO_LABELS, AlarmArmModeSchema, CLIP_BROKER_PACED_RATES, COCO_TO_MACRO, CamProfileSchema, ICON_CATEGORIES, ICON_ENTRIES, ICON_KEYS, ICON_VIEWER_MODULES, IconKeySchema, LOCATION_ICON_FALLBACK, REMOTE_CUSTOM_ROLE_ICON, REMOTE_ROLE_VOCABULARY, DEFINITIVE_DEVICE_REFUSALS, DEVICE_CERT_RENEW_WINDOW_DAYS, DEVICE_DEFINITIVE_REFUSALS_BEFORE_DELETE, DEVICE_REFRESH_REFUSAL_PREFIX, DEVICE_CERT_SIGNATURE, DEVICE_SIGNATURE_MESSAGE_VERSION, DEFAULT_TIMELAPSE_PREVIEW_TEXT, DeviceType, EVENTFUL_CAP_NAMES, EVENT_KIND_BY_CAP, EVENT_TAXONOMY, 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_FAMILY_FILTERS, NC_SYSTEM_EVENT_CLASS_SPECS, 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, 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, canonicalIconKey, buildDeviceEnrollmentLink, buildDeviceSignatureMessage, deviceRefusalFromMessage, isDefinitiveDeviceRefusal, classifyRetrainReview, conditionVisibleForKind, createSystemProxy, droppedConditionsForKind, iconCategoryLabel, iconEntry, iconsInCategory, isIconKey, isHeldBackTemplateVar, isSystemRuleKind, kindsForDiscriminator, locationIconKey, knownValues, nodePickerItems, parseDeviceEnrollmentLink, packagePickerItems, pickerForCondition, pickerForRuleClasses, parseRetrainRevisionConflict, remoteRoleIcon, remoteRoleLabel, remoteRoleLegend, resolveIconKey, resolveModeDelays, retrainBoxIou, retrainRevisionConflictMessage, ruleDeviceCompatCapNames, ruleEditorSectionsForKind, ruleGroupingApplies, ruleKindOf, ruleKindSpec, ruleSeedForSection, searchIcons, sensorTransitionNeverFires, sensorTransitionOffered, stepActuatesAlarmPanel, stepPullsAlarmTrigger, stateLabel, summarizeReview, systemEventClassesFor, systemEventClassKinds, systemEventDeliveryProblems, systemEventFilterAppliesToAnyKind, systemEventKindsOfFamily, systemFamilyOfKind, templateCarriesSummary, templateVarDeliveryApplies, templateVarKindApplies, templateVarSystemEventApplies, buildSubjectPath, isDrawableSubjectPath, projectSubjectPath, subjectPathSampleFromBox, subjectPathSvgPoints, expandSystemEventClasses, withSystemEventClasses, bundledCamstack, paintHex, paletteResultSchema, CONTAINER_PRIMARY_CHILD_RULES, primaryChildPreferenceOf, resolveContainerPrimaryChild, } from './index.js';
18
18
  export type { ContainerPrimaryChildPreference } from './index.js';
19
19
  export type { PaletteReady, PaletteResult, PaletteEntryId, PalettePresetId } from './index.js';
20
20
  export type { RemoteRoleVocabEntry, VocabLocale } from './index.js';
package/dist/client.js CHANGED
@@ -23041,6 +23041,7 @@ var NcSystemEventKindSchema = zod.z.enum([
23041
23041
  "recording-degraded",
23042
23042
  "device-attention-required",
23043
23043
  "device-attention-resolved",
23044
+ "device-command",
23044
23045
  "storage-location-low",
23045
23046
  "storage-location-critical",
23046
23047
  "storage-location-ok",
@@ -23137,11 +23138,6 @@ var NC_CONSUMABLE_LOW_PERCENT_DEFAULT = 15;
23137
23138
  * part just replaced. A spec in the notification centre pins the sum.
23138
23139
  */
23139
23140
  var NC_CONSUMABLE_LOW_PERCENT_MAX = 95;
23140
- /**
23141
- * One coherent system-event condition. `kinds` is the required opt-in safety
23142
- * gate; the remaining lists are optional narrowing filters relevant to the
23143
- * selected kinds.
23144
- */
23145
23141
  var NcSystemEventConditionSchema = zod.z.object({
23146
23142
  kinds: zod.z.array(NcSystemEventKindSchema).min(1),
23147
23143
  deviceIds: zod.z.array(zod.z.number().int()).min(1).optional(),
@@ -23173,6 +23169,28 @@ var NcSystemEventConditionSchema = zod.z.object({
23173
23169
  nodeIds: zod.z.array(zod.z.string().min(1)).min(1).optional(),
23174
23170
  packageNames: zod.z.array(zod.z.string().min(1)).min(1).optional(),
23175
23171
  /**
23172
+ * `device-command` only: the vocabulary ACTION IDS (D983, `powerSource.forceRestart`)
23173
+ * this rule speaks about - the same dictionary the automation action blocks
23174
+ * pick from. The hub refuses an id the action index does not know.
23175
+ */
23176
+ commandActions: zod.z.array(zod.z.string().min(1)).min(1).optional(),
23177
+ /** `device-command` only: how the command settled. A device's own change is not a command. */
23178
+ commandOutcomes: zod.z.array(zod.z.enum([
23179
+ "confirmed",
23180
+ "already",
23181
+ "unconfirmed",
23182
+ "failed"
23183
+ ])).min(1).optional(),
23184
+ /** `device-command` only: who asked (`user`, `addon`, `action`, `scheduler`, `composition`, `node`). */
23185
+ commandActorKinds: zod.z.array(zod.z.enum([
23186
+ "user",
23187
+ "addon",
23188
+ "action",
23189
+ "scheduler",
23190
+ "composition",
23191
+ "node"
23192
+ ])).min(1).optional(),
23193
+ /**
23176
23194
  * At or below this remaining-life %, a consumable is LOW for THIS rule
23177
23195
  * (D642). Absent = {@link NC_CONSUMABLE_LOW_PERCENT_DEFAULT}; at most
23178
23196
  * {@link NC_CONSUMABLE_LOW_PERCENT_MAX}, so every episode can recover. Scoped to the
@@ -28896,6 +28914,7 @@ function createSystemProxy(api) {
28896
28914
  listExposedDevices: (input) => dispatch("deviceExport", "listExposedDevices", "query", input),
28897
28915
  exposeDevice: (input) => dispatch("deviceExport", "exposeDevice", "mutation", input),
28898
28916
  unexposeDevice: (input) => dispatch("deviceExport", "unexposeDevice", "mutation", input),
28917
+ setExposedName: (input) => dispatch("deviceExport", "setExposedName", "mutation", input),
28899
28918
  listSupportedEntityKinds: (input) => dispatch("deviceExport", "listSupportedEntityKinds", "query", input),
28900
28919
  listExposedEntities: (input) => dispatch("deviceExport", "listExposedEntities", "query", input),
28901
28920
  exposeEntity: (input) => dispatch("deviceExport", "exposeEntity", "mutation", input),
@@ -29861,7 +29880,10 @@ var NC_SYSTEM_EVENT_FILTER_KEYS = [
29861
29880
  "deviceTypes",
29862
29881
  "nodeIds",
29863
29882
  "packageNames",
29864
- "consumableLowPercent"
29883
+ "consumableLowPercent",
29884
+ "commandActions",
29885
+ "commandOutcomes",
29886
+ "commandActorKinds"
29865
29887
  ];
29866
29888
  /**
29867
29889
  * Does `filter` say anything about `kind`?
@@ -29877,6 +29899,9 @@ function systemEventFilterApplies(kind, filter) {
29877
29899
  case "nodeIds": return kind.startsWith("node-") || kind === "addon-crash-loop" || kind === "addon-update-available" || kind === "addon-updated" || kind === "server-update-available" || kind === "wrapper-update-available" || kind === "server-updated" || kind.startsWith("storage-location-") || kind.startsWith("alert-");
29878
29900
  case "packageNames": return kind.endsWith("update-available") || kind === "addon-updated" || kind === "node-updating" || kind === "server-updated";
29879
29901
  case "consumableLowPercent": return NC_CONSUMABLE_SYSTEM_EVENT_KINDS.includes(kind);
29902
+ case "commandActions":
29903
+ case "commandOutcomes":
29904
+ case "commandActorKinds": return kind === "device-command";
29880
29905
  }
29881
29906
  }
29882
29907
  /**
@@ -29937,6 +29962,7 @@ var NC_SYSTEM_EVENT_FAMILY = {
29937
29962
  "recording-degraded": "device-events",
29938
29963
  "device-attention-required": "device-events",
29939
29964
  "device-attention-resolved": "device-events",
29965
+ "device-command": "device-events",
29940
29966
  "node-online": "system",
29941
29967
  "node-offline": "system",
29942
29968
  "node-restarting": "system",
@@ -29986,7 +30012,10 @@ var NC_SYSTEM_EVENT_FAMILY_FILTERS = {
29986
30012
  "deviceIds",
29987
30013
  "excludeDeviceIds",
29988
30014
  "deviceTypes",
29989
- "consumableLowPercent"
30015
+ "consumableLowPercent",
30016
+ "commandActions",
30017
+ "commandOutcomes",
30018
+ "commandActorKinds"
29990
30019
  ],
29991
30020
  system: ["nodeIds", "packageNames"],
29992
30021
  alarm: ["deviceIds"]
@@ -30055,6 +30084,12 @@ var NC_SYSTEM_EVENT_KIND_GROUP_SPECS = [
30055
30084
  label: "Needs attention",
30056
30085
  kinds: ["device-attention-required", "device-attention-resolved"]
30057
30086
  },
30087
+ {
30088
+ id: "device-command",
30089
+ family: "device-events",
30090
+ label: "Commands given to devices",
30091
+ kinds: ["device-command"]
30092
+ },
30058
30093
  {
30059
30094
  id: "nodes",
30060
30095
  family: "system",
@@ -30713,11 +30748,26 @@ function subjectPathSvgPoints(run, width, height) {
30713
30748
  const fmt = (v) => String(Math.round(v * 100) / 100);
30714
30749
  return run.map((p) => `${fmt(p.x * width)},${fmt(p.y * height)}`).join(" ");
30715
30750
  }
30751
+ var ALARM_PANEL_ACTIONS = new Set([
30752
+ "alarm.trigger",
30753
+ "alarm.disarm",
30754
+ "alarm.arm.home",
30755
+ "alarm.arm.away",
30756
+ "alarm.arm.night",
30757
+ "alarm.arm.vacation",
30758
+ "alarm.arm.custom_bypass"
30759
+ ]);
30760
+ /** A command step on the alarm panel (arm, disarm or trigger). */
30761
+ function stepActuatesAlarmPanel(step) {
30762
+ return step.kind === "command" && ALARM_PANEL_ACTIONS.has(step.actionId);
30763
+ }
30764
+ /** A command step that pulls the alarm panel's trigger. */
30765
+ function stepPullsAlarmTrigger(step) {
30766
+ return step.kind === "command" && step.actionId === "alarm.trigger";
30767
+ }
30716
30768
  //#endregion
30717
30769
  //#region src/notification/alarm-membership.ts
30718
30770
  var ARMED_WORD_PREFIX = "armed_";
30719
- var ALARM_PANEL_CAP = "alarm-panel";
30720
- var ALARM_PANEL_TRIGGER_METHOD = "trigger";
30721
30771
  /**
30722
30772
  * The sensor-event kinds that are OPENINGS to the alarm — the keys of the
30723
30773
  * engine's opening table (`alarm-openings.ts`, which is checked against this
@@ -30732,7 +30782,7 @@ var NC_ALARM_OPENING_EVENT_KINDS = [
30732
30782
  function actionPullsAlarmTrigger(actionId, actionStepsOf) {
30733
30783
  const steps = actionStepsOf?.(actionId);
30734
30784
  if (steps === void 0) return false;
30735
- return steps.some((step) => step.kind === "cap" && step.cap === ALARM_PANEL_CAP && step.method === ALARM_PANEL_TRIGGER_METHOD);
30785
+ return steps.some(stepPullsAlarmTrigger);
30736
30786
  }
30737
30787
  /** True when the rule's deviceState gate names any `armed_*` word. */
30738
30788
  function ruleGatedOnArmedState(rule) {
@@ -31048,6 +31098,7 @@ var DEVICE_EVENTS = [
31048
31098
  "recording-healthy",
31049
31099
  "recording-degraded",
31050
31100
  ...DEVICE_ATTENTION,
31101
+ "device-command",
31051
31102
  ...ALARM
31052
31103
  ];
31053
31104
  /** Every kind a summary may speak about — the two summarisable families. */
@@ -31504,6 +31555,37 @@ var NC_TEMPLATE_VARS = [
31504
31555
  kinds: ["system"],
31505
31556
  systemEventKinds: [...DEVICE_EVENTS]
31506
31557
  },
31558
+ {
31559
+ name: "actionLabel",
31560
+ label: "Command",
31561
+ example: "Force restart",
31562
+ group: "system",
31563
+ families: ["rule"],
31564
+ fields: [...RULE_TEXT],
31565
+ kinds: ["system"],
31566
+ systemEventKinds: ["device-command"]
31567
+ },
31568
+ {
31569
+ name: "actorLabel",
31570
+ label: "Who asked",
31571
+ example: "velux",
31572
+ group: "system",
31573
+ families: ["rule"],
31574
+ fields: [...RULE_TEXT],
31575
+ kinds: ["system"],
31576
+ systemEventKinds: ["device-command"]
31577
+ },
31578
+ {
31579
+ name: "deviceLabel",
31580
+ label: "Device with type",
31581
+ description: "The device name with its type in parentheses. {{deviceName}} stays the bare name.",
31582
+ example: "Front door (Camera)",
31583
+ group: "system",
31584
+ families: ["rule"],
31585
+ fields: [...RULE_TEXT],
31586
+ kinds: ["system"],
31587
+ systemEventKinds: [...DEVICE_EVENTS]
31588
+ },
31507
31589
  {
31508
31590
  name: "locations",
31509
31591
  label: "Intrusion locations",
@@ -32224,7 +32306,8 @@ var NC_TEMPLATE_HELD_BACK_SYSTEM_EVENT_KINDS = [
32224
32306
  "rule-broken",
32225
32307
  "rule-repaired",
32226
32308
  "package-llm-silent",
32227
- "package-llm-answered"
32309
+ "package-llm-answered",
32310
+ "device-command"
32228
32311
  ];
32229
32312
  /**
32230
32313
  * Is this descriptor held back from the SERVED catalog as a whole (D647)?
@@ -33191,6 +33274,8 @@ exports.searchIcons = searchIcons;
33191
33274
  exports.sensorTransitionNeverFires = sensorTransitionNeverFires;
33192
33275
  exports.sensorTransitionOffered = sensorTransitionOffered;
33193
33276
  exports.stateLabel = stateLabel;
33277
+ exports.stepActuatesAlarmPanel = stepActuatesAlarmPanel;
33278
+ exports.stepPullsAlarmTrigger = stepPullsAlarmTrigger;
33194
33279
  exports.subjectPathSampleFromBox = subjectPathSampleFromBox;
33195
33280
  exports.subjectPathSvgPoints = subjectPathSvgPoints;
33196
33281
  exports.summarizeReview = summarizeReview;
package/dist/client.mjs CHANGED
@@ -23040,6 +23040,7 @@ var NcSystemEventKindSchema = z.enum([
23040
23040
  "recording-degraded",
23041
23041
  "device-attention-required",
23042
23042
  "device-attention-resolved",
23043
+ "device-command",
23043
23044
  "storage-location-low",
23044
23045
  "storage-location-critical",
23045
23046
  "storage-location-ok",
@@ -23136,11 +23137,6 @@ var NC_CONSUMABLE_LOW_PERCENT_DEFAULT = 15;
23136
23137
  * part just replaced. A spec in the notification centre pins the sum.
23137
23138
  */
23138
23139
  var NC_CONSUMABLE_LOW_PERCENT_MAX = 95;
23139
- /**
23140
- * One coherent system-event condition. `kinds` is the required opt-in safety
23141
- * gate; the remaining lists are optional narrowing filters relevant to the
23142
- * selected kinds.
23143
- */
23144
23140
  var NcSystemEventConditionSchema = z.object({
23145
23141
  kinds: z.array(NcSystemEventKindSchema).min(1),
23146
23142
  deviceIds: z.array(z.number().int()).min(1).optional(),
@@ -23172,6 +23168,28 @@ var NcSystemEventConditionSchema = z.object({
23172
23168
  nodeIds: z.array(z.string().min(1)).min(1).optional(),
23173
23169
  packageNames: z.array(z.string().min(1)).min(1).optional(),
23174
23170
  /**
23171
+ * `device-command` only: the vocabulary ACTION IDS (D983, `powerSource.forceRestart`)
23172
+ * this rule speaks about - the same dictionary the automation action blocks
23173
+ * pick from. The hub refuses an id the action index does not know.
23174
+ */
23175
+ commandActions: z.array(z.string().min(1)).min(1).optional(),
23176
+ /** `device-command` only: how the command settled. A device's own change is not a command. */
23177
+ commandOutcomes: z.array(z.enum([
23178
+ "confirmed",
23179
+ "already",
23180
+ "unconfirmed",
23181
+ "failed"
23182
+ ])).min(1).optional(),
23183
+ /** `device-command` only: who asked (`user`, `addon`, `action`, `scheduler`, `composition`, `node`). */
23184
+ commandActorKinds: z.array(z.enum([
23185
+ "user",
23186
+ "addon",
23187
+ "action",
23188
+ "scheduler",
23189
+ "composition",
23190
+ "node"
23191
+ ])).min(1).optional(),
23192
+ /**
23175
23193
  * At or below this remaining-life %, a consumable is LOW for THIS rule
23176
23194
  * (D642). Absent = {@link NC_CONSUMABLE_LOW_PERCENT_DEFAULT}; at most
23177
23195
  * {@link NC_CONSUMABLE_LOW_PERCENT_MAX}, so every episode can recover. Scoped to the
@@ -28895,6 +28913,7 @@ function createSystemProxy(api) {
28895
28913
  listExposedDevices: (input) => dispatch("deviceExport", "listExposedDevices", "query", input),
28896
28914
  exposeDevice: (input) => dispatch("deviceExport", "exposeDevice", "mutation", input),
28897
28915
  unexposeDevice: (input) => dispatch("deviceExport", "unexposeDevice", "mutation", input),
28916
+ setExposedName: (input) => dispatch("deviceExport", "setExposedName", "mutation", input),
28898
28917
  listSupportedEntityKinds: (input) => dispatch("deviceExport", "listSupportedEntityKinds", "query", input),
28899
28918
  listExposedEntities: (input) => dispatch("deviceExport", "listExposedEntities", "query", input),
28900
28919
  exposeEntity: (input) => dispatch("deviceExport", "exposeEntity", "mutation", input),
@@ -29860,7 +29879,10 @@ var NC_SYSTEM_EVENT_FILTER_KEYS = [
29860
29879
  "deviceTypes",
29861
29880
  "nodeIds",
29862
29881
  "packageNames",
29863
- "consumableLowPercent"
29882
+ "consumableLowPercent",
29883
+ "commandActions",
29884
+ "commandOutcomes",
29885
+ "commandActorKinds"
29864
29886
  ];
29865
29887
  /**
29866
29888
  * Does `filter` say anything about `kind`?
@@ -29876,6 +29898,9 @@ function systemEventFilterApplies(kind, filter) {
29876
29898
  case "nodeIds": return kind.startsWith("node-") || kind === "addon-crash-loop" || kind === "addon-update-available" || kind === "addon-updated" || kind === "server-update-available" || kind === "wrapper-update-available" || kind === "server-updated" || kind.startsWith("storage-location-") || kind.startsWith("alert-");
29877
29899
  case "packageNames": return kind.endsWith("update-available") || kind === "addon-updated" || kind === "node-updating" || kind === "server-updated";
29878
29900
  case "consumableLowPercent": return NC_CONSUMABLE_SYSTEM_EVENT_KINDS.includes(kind);
29901
+ case "commandActions":
29902
+ case "commandOutcomes":
29903
+ case "commandActorKinds": return kind === "device-command";
29879
29904
  }
29880
29905
  }
29881
29906
  /**
@@ -29936,6 +29961,7 @@ var NC_SYSTEM_EVENT_FAMILY = {
29936
29961
  "recording-degraded": "device-events",
29937
29962
  "device-attention-required": "device-events",
29938
29963
  "device-attention-resolved": "device-events",
29964
+ "device-command": "device-events",
29939
29965
  "node-online": "system",
29940
29966
  "node-offline": "system",
29941
29967
  "node-restarting": "system",
@@ -29985,7 +30011,10 @@ var NC_SYSTEM_EVENT_FAMILY_FILTERS = {
29985
30011
  "deviceIds",
29986
30012
  "excludeDeviceIds",
29987
30013
  "deviceTypes",
29988
- "consumableLowPercent"
30014
+ "consumableLowPercent",
30015
+ "commandActions",
30016
+ "commandOutcomes",
30017
+ "commandActorKinds"
29989
30018
  ],
29990
30019
  system: ["nodeIds", "packageNames"],
29991
30020
  alarm: ["deviceIds"]
@@ -30054,6 +30083,12 @@ var NC_SYSTEM_EVENT_KIND_GROUP_SPECS = [
30054
30083
  label: "Needs attention",
30055
30084
  kinds: ["device-attention-required", "device-attention-resolved"]
30056
30085
  },
30086
+ {
30087
+ id: "device-command",
30088
+ family: "device-events",
30089
+ label: "Commands given to devices",
30090
+ kinds: ["device-command"]
30091
+ },
30057
30092
  {
30058
30093
  id: "nodes",
30059
30094
  family: "system",
@@ -30712,11 +30747,26 @@ function subjectPathSvgPoints(run, width, height) {
30712
30747
  const fmt = (v) => String(Math.round(v * 100) / 100);
30713
30748
  return run.map((p) => `${fmt(p.x * width)},${fmt(p.y * height)}`).join(" ");
30714
30749
  }
30750
+ var ALARM_PANEL_ACTIONS = new Set([
30751
+ "alarm.trigger",
30752
+ "alarm.disarm",
30753
+ "alarm.arm.home",
30754
+ "alarm.arm.away",
30755
+ "alarm.arm.night",
30756
+ "alarm.arm.vacation",
30757
+ "alarm.arm.custom_bypass"
30758
+ ]);
30759
+ /** A command step on the alarm panel (arm, disarm or trigger). */
30760
+ function stepActuatesAlarmPanel(step) {
30761
+ return step.kind === "command" && ALARM_PANEL_ACTIONS.has(step.actionId);
30762
+ }
30763
+ /** A command step that pulls the alarm panel's trigger. */
30764
+ function stepPullsAlarmTrigger(step) {
30765
+ return step.kind === "command" && step.actionId === "alarm.trigger";
30766
+ }
30715
30767
  //#endregion
30716
30768
  //#region src/notification/alarm-membership.ts
30717
30769
  var ARMED_WORD_PREFIX = "armed_";
30718
- var ALARM_PANEL_CAP = "alarm-panel";
30719
- var ALARM_PANEL_TRIGGER_METHOD = "trigger";
30720
30770
  /**
30721
30771
  * The sensor-event kinds that are OPENINGS to the alarm — the keys of the
30722
30772
  * engine's opening table (`alarm-openings.ts`, which is checked against this
@@ -30731,7 +30781,7 @@ var NC_ALARM_OPENING_EVENT_KINDS = [
30731
30781
  function actionPullsAlarmTrigger(actionId, actionStepsOf) {
30732
30782
  const steps = actionStepsOf?.(actionId);
30733
30783
  if (steps === void 0) return false;
30734
- return steps.some((step) => step.kind === "cap" && step.cap === ALARM_PANEL_CAP && step.method === ALARM_PANEL_TRIGGER_METHOD);
30784
+ return steps.some(stepPullsAlarmTrigger);
30735
30785
  }
30736
30786
  /** True when the rule's deviceState gate names any `armed_*` word. */
30737
30787
  function ruleGatedOnArmedState(rule) {
@@ -31047,6 +31097,7 @@ var DEVICE_EVENTS = [
31047
31097
  "recording-healthy",
31048
31098
  "recording-degraded",
31049
31099
  ...DEVICE_ATTENTION,
31100
+ "device-command",
31050
31101
  ...ALARM
31051
31102
  ];
31052
31103
  /** Every kind a summary may speak about — the two summarisable families. */
@@ -31503,6 +31554,37 @@ var NC_TEMPLATE_VARS = [
31503
31554
  kinds: ["system"],
31504
31555
  systemEventKinds: [...DEVICE_EVENTS]
31505
31556
  },
31557
+ {
31558
+ name: "actionLabel",
31559
+ label: "Command",
31560
+ example: "Force restart",
31561
+ group: "system",
31562
+ families: ["rule"],
31563
+ fields: [...RULE_TEXT],
31564
+ kinds: ["system"],
31565
+ systemEventKinds: ["device-command"]
31566
+ },
31567
+ {
31568
+ name: "actorLabel",
31569
+ label: "Who asked",
31570
+ example: "velux",
31571
+ group: "system",
31572
+ families: ["rule"],
31573
+ fields: [...RULE_TEXT],
31574
+ kinds: ["system"],
31575
+ systemEventKinds: ["device-command"]
31576
+ },
31577
+ {
31578
+ name: "deviceLabel",
31579
+ label: "Device with type",
31580
+ description: "The device name with its type in parentheses. {{deviceName}} stays the bare name.",
31581
+ example: "Front door (Camera)",
31582
+ group: "system",
31583
+ families: ["rule"],
31584
+ fields: [...RULE_TEXT],
31585
+ kinds: ["system"],
31586
+ systemEventKinds: [...DEVICE_EVENTS]
31587
+ },
31506
31588
  {
31507
31589
  name: "locations",
31508
31590
  label: "Intrusion locations",
@@ -32223,7 +32305,8 @@ var NC_TEMPLATE_HELD_BACK_SYSTEM_EVENT_KINDS = [
32223
32305
  "rule-broken",
32224
32306
  "rule-repaired",
32225
32307
  "package-llm-silent",
32226
- "package-llm-answered"
32308
+ "package-llm-answered",
32309
+ "device-command"
32227
32310
  ];
32228
32311
  /**
32229
32312
  * Is this descriptor held back from the SERVED catalog as a whole (D647)?
@@ -33075,4 +33158,4 @@ var TimelapseRuleSchema = TimelapseRuleInputSchema.extend({
33075
33158
  updatedAt: z.number()
33076
33159
  });
33077
33160
  //#endregion
33078
- 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, primaryChildPreferenceOf, 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 };
33161
+ 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, primaryChildPreferenceOf, projectSubjectPath, remoteRoleIcon, remoteRoleLabel, remoteRoleLegend, resolveContainerPrimaryChild, resolveIconKey, resolveModeDelays, retrainBoxIou, retrainRevisionConflictMessage, ruleDeviceCompatCapNames, ruleEditorSectionsForKind, ruleGroupingApplies, ruleKindOf, ruleKindSpec, ruleSeedForSection, searchIcons, sensorTransitionNeverFires, sensorTransitionOffered, stateLabel, stepActuatesAlarmPanel, stepPullsAlarmTrigger, subjectPathSampleFromBox, subjectPathSvgPoints, summarizeReview, systemEventClassKinds, systemEventClassesFor, systemEventDeliveryProblems, systemEventFilterAppliesToAnyKind, systemEventKindsOfFamily, systemFamilyOfKind, templateCarriesSummary, templateVarDeliveryApplies, templateVarKindApplies, templateVarSystemEventApplies, withSystemEventClasses };
@@ -29,3 +29,35 @@ export declare function vocabActionIdFor(cap: string, method: string, args: Read
29
29
  * value is missing.
30
30
  */
31
31
  export declare function actionEffect(actionId: string, args: Readonly<Record<string, unknown>> | undefined): ActionEffect | null;
32
+ /** Why a step's vocabulary action cannot be performed. */
33
+ export type VocabActionRefusal = 'unknown-action' | 'not-offered';
34
+ /**
35
+ * A command step names an action that does not exist, or a device that does
36
+ * not offer it. Typed so a save boundary names the reason, not a string.
37
+ */
38
+ export declare class VocabActionError extends Error {
39
+ readonly reason: VocabActionRefusal;
40
+ readonly actionId: string;
41
+ readonly deviceId?: number | undefined;
42
+ constructor(reason: VocabActionRefusal, actionId: string, message: string, deviceId?: number | undefined);
43
+ }
44
+ /** The cap method call a vocabulary action makes. */
45
+ export interface VocabCall {
46
+ readonly cap: string;
47
+ readonly method: string;
48
+ /** The step's args with the args the action bakes in (those win). */
49
+ readonly args: Readonly<Record<string, unknown>>;
50
+ }
51
+ /**
52
+ * The cap + method + args `actionId` calls with the step's (open) `args`.
53
+ * THE one place a command step's action id becomes a cap method: the step
54
+ * runner and a generated automation block call it when the step runs.
55
+ * Throws {@link VocabActionError} (`unknown-action`).
56
+ */
57
+ export declare function vocabCall(actionId: string, args: Readonly<Record<string, unknown>> | undefined): VocabCall;
58
+ /**
59
+ * Refuse a device that does not offer `actionId`: its bound caps (the
60
+ * per-binding walk, D12) do not include the action's cap. Throws
61
+ * {@link VocabActionError} (`unknown-action` or `not-offered`).
62
+ */
63
+ export declare function assertDeviceOffers(actionId: string, deviceId: number, deviceCaps: readonly string[]): void;
@@ -4,8 +4,8 @@
4
4
  */
5
5
  export type { ResolvedBooleanTrigger, ResolvedEnumTrigger, ResolvedEnumValue, ResolvedEventTrigger, ResolvedNumericTrigger, ResolvedValueTrigger, ResolvedVocabAction, ResolvedVocabTrigger, VocabBindingsInput, } from './resolve.js';
6
6
  export { actionsForDevice, renderVocabPhrase, triggersForDevice, } from './resolve.js';
7
- export type { ActionEffect, IndexedVocabAction } from './action-index.js';
8
- export { actionEffect, allVocabActions, findVocabAction, vocabActionIdFor, } from './action-index.js';
7
+ export type { ActionEffect, IndexedVocabAction, VocabActionRefusal, VocabCall, } from './action-index.js';
8
+ export { actionEffect, allVocabActions, assertDeviceOffers, findVocabAction, VocabActionError, vocabActionIdFor, vocabCall, } from './action-index.js';
9
9
  export type { CommandEffect } from './command-catalog.js';
10
10
  export { auditedFields, commandEffect, isCommand } from './command-catalog.js';
11
11
  export { VOCAB_TEMPLATES } from './templates.js';
@@ -1,108 +1,6 @@
1
- import type { LooseVocabOffer } from './cap-vocabulary/types.js';
2
- import { DeviceType } from './device-type.js';
3
- /** An arg the authoring UI collects (not baked into the catalogue entry). */
4
- export interface DeviceDoOpenArg {
5
- readonly key: string;
6
- readonly label: string;
7
- readonly kind: 'string' | 'number';
8
- /** How the vocabulary says to offer values (enum, range, the device's own list). */
9
- readonly offer?: LooseVocabOffer;
10
- /** The method accepts the call without it. */
11
- readonly optional?: boolean;
12
- }
13
- /** One operator-facing action that becomes a cap method call. */
14
- export interface DeviceDoAction {
15
- /** Stable id for the select value, e.g. `switch.on`. */
16
- readonly id: string;
17
- /** Human label shown in the picker. */
18
- readonly label: string;
19
- readonly cap: string;
20
- readonly method: string;
21
- readonly args?: Readonly<Record<string, unknown>>;
22
- /**
23
- * Keys the operator fills after picking the action (e.g. `presetId` for
24
- * `ptz.goToPreset`). Matching ignores these — only baked {@link args} must
25
- * agree — so a saved step with a filled preset still selects this entry.
26
- */
27
- readonly openArgs?: readonly DeviceDoOpenArg[];
28
- }
29
1
  /**
30
- * The catalogue: every device-cap action of the vocabulary, in the
31
- * vocabulary's order (the order the select draws). Args are baked in so the
32
- * authoring UI never asks for JSON for these.
33
- */
34
- export declare const DEVICE_DO_ACTIONS: readonly DeviceDoAction[];
35
- /** True when METHOD_ACCESS_MAP still exposes this cap.method as actuatable. */
36
- export declare function isDoActionActuatable(action: DeviceDoAction): boolean;
37
- /**
38
- * Catalogue caps a `DeviceType` is expected to offer in the Do picker.
39
- *
40
- * Exhaustive over {@link DeviceType}: adding a new enum member without an
41
- * entry fails the TypeScript build here (same pattern as
42
- * {@link DEVICE_TYPE_CONTROL_KIND}). An empty list is a deliberate choice
43
- * for read-only / non-actuatable types — never "forgotten".
44
- *
45
- * Camera accessories (ptz, privacy-mask, …) are listed on Camera even though
46
- * a given camera may bind only a subset; {@link actionsForBoundCaps} still
47
- * filters to what the device actually binds.
48
- */
49
- export declare const DEVICE_TYPE_DO_CAPS: Record<DeviceType, readonly string[]>;
50
- /**
51
- * Whether a device type belongs in a Do / automation action device picker.
52
- *
53
- * Containers stay in {@link DEVICE_TYPE_DO_CAPS} (empty, for exhaustiveness)
54
- * but must never appear as selectable targets — actuate the children instead.
2
+ * Whether a device type belongs in a command / automation action device picker.
3
+ * A container is a parent grouping node, never an actuation target: its
4
+ * children are.
55
5
  */
56
6
  export declare function isDoPickerDeviceType(type: string): boolean;
57
- /**
58
- * Do-picker family id — devices that share one may be multi-selected for
59
- * the same action (several locks, the climate family, cover+valve, …).
60
- *
61
- * Distinct from {@link DeviceControlKind}: humidifier / water-heater keep
62
- * their own control widgets but author with climate siblings.
63
- */
64
- export declare function deviceDoFamily(type: string): string;
65
- /** True when two device types may share one multi-target Do step. */
66
- export declare function sameDoFamily(leftType: string, rightType: string): boolean;
67
- /**
68
- * Actions offered for a device that binds the given caps.
69
- *
70
- * Only catalogue entries whose cap is bound AND still actuatable in
71
- * METHOD_ACCESS_MAP. Empty bindings → empty list (pick a device first).
72
- */
73
- export declare function actionsForBoundCaps(boundCaps: readonly string[]): readonly DeviceDoAction[];
74
- /**
75
- * Catalogue actions for a wire `DeviceType` string — the fallback when
76
- * bindings have not answered yet (or answered empty for a typed actuator).
77
- * Unknown type strings → empty.
78
- */
79
- export declare function actionsForDeviceType(type: string): readonly DeviceDoAction[];
80
- /**
81
- * Union of bound-cap actions with the type's expected catalogue caps.
82
- *
83
- * Bindings win for filtering (a lock without `lock-control` bound still
84
- * offers nothing from bindings alone); the type map fills gaps when the
85
- * binding read is empty so a Lock / Valve / Climate never shows
86
- * "No actions for this device" solely because getBindings lagged.
87
- */
88
- export declare function actionsForDevice(input: {
89
- readonly boundCaps: readonly string[] | undefined;
90
- readonly deviceType: string | undefined;
91
- }): readonly DeviceDoAction[];
92
- /**
93
- * Intersection of {@link actionsForDevice} across several targets — what a
94
- * multi-select same-family Do step may offer.
95
- */
96
- export declare function actionsForDevices(targets: readonly {
97
- readonly boundCaps?: readonly string[];
98
- readonly deviceType?: string;
99
- }[]): readonly DeviceDoAction[];
100
- /** The whole catalogue (still actuatable) — for a `{$var}` automation target. */
101
- export declare function allDoActions(): readonly DeviceDoAction[];
102
- /**
103
- * Match a saved wire step to a catalogue entry, or null when it is outside
104
- * the catalogue (legacy / custom). Args must agree when the entry bakes them.
105
- */
106
- export declare function matchDoAction(cap: string, method: string, args: Readonly<Record<string, unknown>> | undefined): DeviceDoAction | null;
107
- /** Select value for a saved step: catalogue id, or a synthetic custom key. */
108
- export declare function doActionSelectValue(cap: string, method: string, args: Readonly<Record<string, unknown>> | undefined): string;