@camstack/server 1.2.821 → 1.2.822

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 (98) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/api/trpc/generated-cap-routers.js +20 -0
  3. package/package.json +10 -10
  4. package/system/dist/{agent-https-N6Or6UAu.mjs → agent-https-C4yxMErF.mjs} +1 -1
  5. package/system/dist/{agent-https-Bp5yzi8b.js → agent-https-SGBI0xP8.js} +1 -1
  6. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  7. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  8. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  9. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  10. package/system/dist/builtins/alerts/alerts.addon.js +1 -1
  11. package/system/dist/builtins/alerts/alerts.addon.mjs +1 -1
  12. package/system/dist/builtins/autotrack/index.js +1 -1
  13. package/system/dist/builtins/autotrack/index.mjs +1 -1
  14. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
  15. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +2 -2
  16. package/system/dist/builtins/calendars/calendars.addon.js +1 -1
  17. package/system/dist/builtins/calendars/calendars.addon.mjs +1 -1
  18. package/system/dist/builtins/camera-grid/index.js +1 -1
  19. package/system/dist/builtins/camera-grid/index.mjs +1 -1
  20. package/system/dist/builtins/composer/composer.addon.js +3 -3
  21. package/system/dist/builtins/composer/composer.addon.mjs +3 -3
  22. package/system/dist/builtins/console-logging/index.js +1 -1
  23. package/system/dist/builtins/console-logging/index.mjs +1 -1
  24. package/system/dist/builtins/core-blocks/actions-service.d.ts +16 -0
  25. package/system/dist/builtins/core-blocks/core-blocks.addon.js +149 -7
  26. package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +149 -7
  27. package/system/dist/builtins/core-blocks/device-template-door.d.ts +25 -0
  28. package/system/dist/builtins/core-blocks/fan-presets-service.d.ts +5 -0
  29. package/system/dist/builtins/core-blocks/scheduler/scheduler-engine.d.ts +5 -0
  30. package/system/dist/builtins/core-blocks/step-condition-door.d.ts +19 -0
  31. package/system/dist/builtins/device-history/device-history.addon.js +2 -2
  32. package/system/dist/builtins/device-history/device-history.addon.mjs +2 -2
  33. package/system/dist/builtins/device-manager/device-manager.addon.d.ts +7 -0
  34. package/system/dist/builtins/device-manager/device-manager.addon.js +655 -2
  35. package/system/dist/builtins/device-manager/device-manager.addon.mjs +653 -1
  36. package/system/dist/builtins/device-manager/device-template/template-host.d.ts +60 -0
  37. package/system/dist/builtins/device-manager/device-template-actions.d.ts +33 -0
  38. package/system/dist/builtins/hub-forwarder/index.js +1 -1
  39. package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
  40. package/system/dist/builtins/keychain/index.js +4 -4
  41. package/system/dist/builtins/keychain/index.mjs +4 -4
  42. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  43. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  44. package/system/dist/builtins/local-auth/local-auth.addon.js +2 -2
  45. package/system/dist/builtins/local-auth/local-auth.addon.mjs +2 -2
  46. package/system/dist/builtins/local-network/local-network.addon.js +2 -2
  47. package/system/dist/builtins/local-network/local-network.addon.mjs +2 -2
  48. package/system/dist/builtins/loki-logging/index.js +1 -1
  49. package/system/dist/builtins/loki-logging/index.mjs +1 -1
  50. package/system/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  51. package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  52. package/system/dist/builtins/platform-probe/index.js +1 -1
  53. package/system/dist/builtins/platform-probe/index.mjs +1 -1
  54. package/system/dist/builtins/record-entries/index.js +1 -1
  55. package/system/dist/builtins/record-entries/index.mjs +1 -1
  56. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  57. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  58. package/system/dist/builtins/snapshot/index.js +1 -1
  59. package/system/dist/builtins/snapshot/index.mjs +1 -1
  60. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  61. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  62. package/system/dist/builtins/sqlite-storage/index.js +1 -1
  63. package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
  64. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +3 -3
  65. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +3 -3
  66. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  67. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  68. package/system/dist/builtins/system-config/system-config.addon.js +9 -9
  69. package/system/dist/builtins/system-config/system-config.addon.mjs +286 -286
  70. package/system/dist/builtins/winston-logging/index.js +1 -1
  71. package/system/dist/builtins/winston-logging/index.mjs +1 -1
  72. package/system/dist/{capture-engine-4lB0sLCf.js → capture-engine-6MVUyUry.js} +1 -1
  73. package/system/dist/{capture-engine-Cz7z5d36.mjs → capture-engine-BSjE-CQA.mjs} +1 -1
  74. package/system/dist/{composition-sources-C9gEj25e.js → composition-sources-BBAOXZdC.js} +1 -1
  75. package/system/dist/{composition-sources-C0e2g_VP.mjs → composition-sources-C8T9DRbZ.mjs} +1 -1
  76. package/system/dist/{constants-CZMy7dor.mjs → constants-CReG6K4k.mjs} +1 -1
  77. package/system/dist/{constants-Cq3B9yzj.js → constants-v0g9--wN.js} +1 -1
  78. package/system/dist/{device-ca-BenyQXJV.js → device-ca-BFcBTfff.js} +1 -1
  79. package/system/dist/{device-ca-BmQ6N-A-.mjs → device-ca-cX8qUs2s.mjs} +1 -1
  80. package/system/dist/device-template-worker.js +5 -7032
  81. package/system/dist/device-template-worker.mjs +1 -7026
  82. package/system/dist/{dist-M5VX8Hqf.js → dist-C2czR9xK.js} +633 -24
  83. package/system/dist/{dist-DuKMbGBM.mjs → dist-DjBZ1HhF.mjs} +592 -25
  84. package/system/dist/file-host-worker.js +1 -1
  85. package/system/dist/file-host-worker.mjs +1 -1
  86. package/system/dist/{hub-mdns-ciao-CXBfBwAy.mjs → hub-mdns-ciao-Cnr8xiSd.mjs} +2 -2
  87. package/system/dist/{hub-mdns-ciao-k3pOKWyZ.js → hub-mdns-ciao-CpCleue0.js} +2 -2
  88. package/system/dist/index.js +8 -8
  89. package/system/dist/index.mjs +8 -8
  90. package/system/dist/{legacy-integration-rows-door-C13OeuW9.mjs → legacy-integration-rows-door-CGajkVPh.mjs} +1 -1
  91. package/system/dist/{legacy-integration-rows-door-mIpR3e6X.js → legacy-integration-rows-door-DhW6mPZj.js} +1 -1
  92. package/system/dist/{restore-archive-CCgt7SZ8.js → restore-archive-BLab80kx.js} +7 -7
  93. package/system/dist/{restore-archive-DDeQFJN5.mjs → restore-archive-eA7L58KT.mjs} +86 -86
  94. package/system/dist/template-protocol-BmMM5VBf.mjs +7033 -0
  95. package/system/dist/template-protocol-CTP4eAo_.js +7059 -0
  96. package/system/dist/{wal-maintenance-Cj7xe4wN.mjs → wal-maintenance-DeBxoOFh.mjs} +0 -0
  97. package/system/dist/{wal-maintenance-D5M6hl53.js → wal-maintenance-DhnSF7K-.js} +0 -0
  98. package/system/package.json +1 -1
@@ -3342,7 +3342,7 @@ var SecretOverwriteRefusedError = class extends Error {
3342
3342
  this.name = "SecretOverwriteRefusedError";
3343
3343
  }
3344
3344
  };
3345
- function isRecord$3(value) {
3345
+ function isRecord$3$1(value) {
3346
3346
  return typeof value === "object" && value !== null && !Array.isArray(value);
3347
3347
  }
3348
3348
  function resolvedValue(pass, marker) {
@@ -3371,7 +3371,7 @@ function inArray(pass, incoming, stored) {
3371
3371
  return incoming.map((item, index) => {
3372
3372
  const twin = stored[index];
3373
3373
  if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
3374
- if (isRecord$3(item) && isRecord$3(twin)) return inArrayRow(pass, item, twin);
3374
+ if (isRecord$3$1(item) && isRecord$3$1(twin)) return inArrayRow(pass, item, twin);
3375
3375
  if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
3376
3376
  return item;
3377
3377
  });
@@ -3382,7 +3382,7 @@ function inArrayRow(pass, incoming, stored) {
3382
3382
  const twin = stored[key];
3383
3383
  if (isSecretMarker(twin)) {
3384
3384
  if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
3385
- } else if (isRecord$3(value) && isRecord$3(twin)) out[key] = inArrayRow(pass, value, twin);
3385
+ } else if (isRecord$3$1(value) && isRecord$3$1(twin)) out[key] = inArrayRow(pass, value, twin);
3386
3386
  else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
3387
3387
  }
3388
3388
  return out;
@@ -3390,7 +3390,7 @@ function inArrayRow(pass, incoming, stored) {
3390
3390
  async function walk(pass, incoming, stored) {
3391
3391
  if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
3392
3392
  if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
3393
- if (!isRecord$3(incoming) || !isRecord$3(stored)) return incoming;
3393
+ if (!isRecord$3$1(incoming) || !isRecord$3$1(stored)) return incoming;
3394
3394
  const out = { ...incoming };
3395
3395
  for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
3396
3396
  return out;
@@ -3421,7 +3421,7 @@ async function restoreUnchangedSecrets(input) {
3421
3421
  function isJsonEqual(a, b) {
3422
3422
  if (Object.is(a, b)) return true;
3423
3423
  if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
3424
- if (isRecord$3(a) && isRecord$3(b)) {
3424
+ if (isRecord$3$1(a) && isRecord$3$1(b)) {
3425
3425
  const keys = Object.keys(a);
3426
3426
  if (keys.length !== Object.keys(b).length) return false;
3427
3427
  return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
@@ -3445,7 +3445,7 @@ function markerKeysOf(blob, owner) {
3445
3445
  }
3446
3446
  function nodeFromStored(value, owner) {
3447
3447
  if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
3448
- if (!isRecord$3(value)) return null;
3448
+ if (!isRecord$3$1(value)) return null;
3449
3449
  const children = /* @__PURE__ */ new Map();
3450
3450
  for (const [key, child] of Object.entries(value)) {
3451
3451
  const node = nodeFromStored(child, owner);
@@ -43881,11 +43881,35 @@ function normalizeStepTargets(steps) {
43881
43881
  /**
43882
43882
  * The steps an internal Action may contain: cap and wait, and nothing that can
43883
43883
  * call back into an Action — so an Action can never reach itself (no cycles).
43884
+ * This is the LEAF shape: no condition of its own.
43885
+ */
43886
+ var LeafActionStepSchema = z.discriminatedUnion("kind", [AutomationWaitStepSchema, AutomationCapStepSchema]);
43887
+ /**
43888
+ * The optional guard of a step (#472): `if` is the ONE `when` tree (D980), read
43889
+ * on the state mirror when the step is reached; `else` runs when it is false.
43890
+ * An `else` holds leaf steps only — the nesting is bounded at ONE level, so a
43891
+ * branch can never grow a tree the trace has to draw.
43884
43892
  */
43885
- var ActionStepSchema = z.discriminatedUnion("kind", [AutomationWaitStepSchema, AutomationCapStepSchema]);
43893
+ var stepGuardShape = {
43894
+ if: AutomationWhenSchema.optional(),
43895
+ else: z.array(LeafActionStepSchema).max(10).optional()
43896
+ };
43897
+ var elseNeedsIf = {
43898
+ message: "an else list needs the condition it is the other side of (if)",
43899
+ path: ["else"]
43900
+ };
43901
+ var GuardedWaitStepSchema = AutomationWaitStepSchema.extend(stepGuardShape).refine((step) => step.else === void 0 || step.if !== void 0, elseNeedsIf);
43902
+ var GuardedCapStepSchema = AutomationCapStepBaseSchema.extend(stepGuardShape).refine((step) => step.target !== void 0 || step.deviceId !== void 0, {
43903
+ message: "a cap step needs a target",
43904
+ path: ["target"]
43905
+ }).refine((step) => step.target?.kind !== "domain" || step.actionId !== void 0, {
43906
+ message: "a domain target needs the vocabulary action it applies to (actionId)",
43907
+ path: ["actionId"]
43908
+ }).refine((step) => step.else === void 0 || step.if !== void 0, elseNeedsIf);
43909
+ var ActionStepSchema = z.discriminatedUnion("kind", [GuardedWaitStepSchema, GuardedCapStepSchema]);
43886
43910
  var AutomationActionSchema = z.discriminatedUnion("kind", [
43887
- AutomationWaitStepSchema,
43888
- AutomationCapStepSchema,
43911
+ GuardedWaitStepSchema,
43912
+ GuardedCapStepSchema,
43889
43913
  z.object({
43890
43914
  kind: z.literal("action"),
43891
43915
  /** An entry of the `actions` surface (`internal:<uuid>` or `<addonId>:<localId>`). */
@@ -44804,7 +44828,7 @@ var StepDeviceTraceSchema = z.object({
44804
44828
  outcome: z.enum(["ok", "error"]),
44805
44829
  message: z.string().optional()
44806
44830
  });
44807
- var AutomationStepTraceSchema = z.object({
44831
+ var StepTraceBaseSchema = z.object({
44808
44832
  /** `actions.<i>` */
44809
44833
  path: z.string().min(1),
44810
44834
  kind: z.string().min(1),
@@ -44823,15 +44847,35 @@ var AutomationStepTraceSchema = z.object({
44823
44847
  * is shown as {@link REDACTED_ARG}. Absent on traces written before it existed.
44824
44848
  */
44825
44849
  args: z.record(z.string(), TraceValueSchema).optional(),
44826
- /** `empty`: the target resolved to no device, so nothing was done — never silently `ok`. */
44850
+ /**
44851
+ * The device values a templated arg printed as `—`, one `ref: reason` each
44852
+ * (D1021): why a sentence says "—" where a number was expected. Bounded.
44853
+ */
44854
+ templates: z.array(z.string()).max(20).optional(),
44855
+ /**
44856
+ * What the step's own `if` read when the step was reached (#472): `true` the
44857
+ * step ran, `false` its `else` ran (or nothing did), `unknown` a state leaf
44858
+ * could not be read, so NEITHER side ran. Absent on an unguarded step.
44859
+ */
44860
+ condition: z.enum([
44861
+ "true",
44862
+ "false",
44863
+ "unknown"
44864
+ ]).optional(),
44865
+ /** Why the condition read what it read, in the evaluator's own words. */
44866
+ conditionReason: z.string().optional(),
44867
+ /** `empty`: the target resolved to no device, so nothing was done — never silently `ok`. `skipped`: its `if` was false (or unknown) and nothing ran in its place. */
44827
44868
  outcome: z.enum([
44828
44869
  "ok",
44829
44870
  "error",
44830
44871
  "not-run",
44831
- "empty"
44872
+ "empty",
44873
+ "skipped"
44832
44874
  ]),
44833
44875
  message: z.string().optional()
44834
44876
  });
44877
+ /** A step trace; the `else` steps that ran are one level of the same shape (the nesting is bounded at one). */
44878
+ var AutomationStepTraceSchema = StepTraceBaseSchema.extend({ else: z.array(StepTraceBaseSchema).optional() });
44835
44879
  var AutomationRunTraceSchema = z.object({
44836
44880
  runId: z.string().min(1),
44837
44881
  startedAt: z.number(),
@@ -45139,6 +45183,7 @@ z.enum([
45139
45183
  "invalid-variables",
45140
45184
  "invalid-steps",
45141
45185
  "not-linked",
45186
+ "template-scope",
45142
45187
  "busy"
45143
45188
  ]);
45144
45189
  /**
@@ -45163,9 +45208,50 @@ var ActionRunChangedSchema = z.object({
45163
45208
  lastRunAt: z.number().nullable(),
45164
45209
  lastError: z.string().nullable()
45165
45210
  });
45211
+ /**
45212
+ * The guard of a conditional step (#472): the step's `if` is the ONE `when`
45213
+ * tree (D980), read on a {@link ConditionMirror} filled for exactly the leaves
45214
+ * the tree names, at the moment the step is reached. A state that cannot be
45215
+ * read is UNKNOWN, and unknown runs neither side (D49: a failed read changes
45216
+ * nothing, and never decides a branch).
45217
+ */
45218
+ /** Fill a mirror for the tree's leaves from `fetchers` and judge it NOW. */
45219
+ async function evaluateStepCondition(when, fetchers, now = Date.now) {
45220
+ const mirror = new ConditionMirror(collectWhenMirrorSources(when));
45221
+ await mirror.refresh(fetchers);
45222
+ const evaluation = evaluateWhenTree(when, mirror, now());
45223
+ const first = evaluation.nodes.filter((n) => n.outcome !== "pass").map((n) => n.reason)[0];
45224
+ if (evaluation.unknown) return {
45225
+ result: "unknown",
45226
+ reason: `a state the condition reads is not known${first === void 0 ? "" : ` (${first})`}`
45227
+ };
45228
+ return evaluation.pass ? {
45229
+ result: "true",
45230
+ reason: "the condition holds"
45231
+ } : {
45232
+ result: "false",
45233
+ reason: first ?? "the condition does not hold"
45234
+ };
45235
+ }
45166
45236
  function errorMessage(err) {
45167
45237
  return err instanceof Error ? err.message : String(err);
45168
45238
  }
45239
+ /** A guard that throws is an unknown, never a crash of the run. */
45240
+ async function readGuard(guard) {
45241
+ try {
45242
+ return await guard();
45243
+ } catch (err) {
45244
+ return {
45245
+ result: "unknown",
45246
+ reason: `the condition could not be read: ${errorMessage(err)}`
45247
+ };
45248
+ }
45249
+ }
45250
+ /** The else level of a trace is one level deep: a nested trace carries no `else` of its own. */
45251
+ function withoutElse(trace) {
45252
+ const { else: _else, ...rest } = trace;
45253
+ return rest;
45254
+ }
45169
45255
  async function runSteps(steps, options) {
45170
45256
  const traces = [];
45171
45257
  let failed = false;
@@ -45183,10 +45269,57 @@ async function runSteps(steps, options) {
45183
45269
  continue;
45184
45270
  }
45185
45271
  const startedAt = options.now();
45272
+ let guardTrace = {};
45273
+ if (step.guard !== void 0) {
45274
+ const verdict = await readGuard(step.guard);
45275
+ guardTrace = {
45276
+ condition: verdict.result,
45277
+ conditionReason: verdict.reason
45278
+ };
45279
+ if (verdict.result === "unknown") options.onGuardUnknown?.({
45280
+ index,
45281
+ path,
45282
+ reason: verdict.reason,
45283
+ deviceId: step.meta.deviceId
45284
+ });
45285
+ if (verdict.result !== "true") {
45286
+ const branch = verdict.result === "false" ? step.otherwise ?? [] : [];
45287
+ if (branch.length === 0) {
45288
+ traces.push({
45289
+ ...step.meta,
45290
+ ...guardTrace,
45291
+ path,
45292
+ startedAt,
45293
+ endedAt: options.now(),
45294
+ outcome: "skipped",
45295
+ message: verdict.result === "unknown" ? `not run: ${verdict.reason}` : `not run: the condition is false (${verdict.reason})`
45296
+ });
45297
+ continue;
45298
+ }
45299
+ const sub = await runSteps(branch, {
45300
+ ...options,
45301
+ pathPrefix: `${path}.else`
45302
+ });
45303
+ if (sub.failed) failed = true;
45304
+ else if (sub.aborted) aborted = true;
45305
+ traces.push({
45306
+ ...step.meta,
45307
+ ...guardTrace,
45308
+ path,
45309
+ startedAt,
45310
+ endedAt: options.now(),
45311
+ outcome: sub.failed ? "error" : "ok",
45312
+ ...sub.failed ? { message: "an else step failed" } : {},
45313
+ else: sub.steps.map(withoutElse)
45314
+ });
45315
+ continue;
45316
+ }
45317
+ }
45186
45318
  let deviceId = step.meta.deviceId;
45187
45319
  let sent;
45188
45320
  const perDevice = [];
45189
45321
  let emptyReason;
45322
+ let templateNotes = [];
45190
45323
  const scope = {
45191
45324
  setDeviceId: (id) => {
45192
45325
  deviceId = id;
@@ -45199,8 +45332,12 @@ async function runSteps(steps, options) {
45199
45332
  },
45200
45333
  setArgs: (args) => {
45201
45334
  sent = args;
45335
+ },
45336
+ setTemplateNotes: (notes) => {
45337
+ templateNotes = notes.slice(0, 20);
45202
45338
  }
45203
45339
  };
45340
+ const templatesTrace = () => templateNotes.length === 0 ? {} : { templates: [...templateNotes] };
45204
45341
  const argsTrace = () => sent === void 0 ? {} : { args: buildStepArgsTrace(sent) };
45205
45342
  const devicesTrace = () => perDevice.length === 0 ? {} : { devices: perDevice.slice(0, 200) };
45206
45343
  try {
@@ -45209,7 +45346,9 @@ async function runSteps(steps, options) {
45209
45346
  ...step.meta,
45210
45347
  ...deviceId === void 0 || perDevice.length > 1 ? {} : { deviceId },
45211
45348
  ...argsTrace(),
45349
+ ...templatesTrace(),
45212
45350
  ...devicesTrace(),
45351
+ ...guardTrace,
45213
45352
  path,
45214
45353
  startedAt,
45215
45354
  endedAt: options.now(),
@@ -45229,7 +45368,9 @@ async function runSteps(steps, options) {
45229
45368
  ...step.meta,
45230
45369
  ...deviceId === void 0 || perDevice.length > 1 ? {} : { deviceId },
45231
45370
  ...argsTrace(),
45371
+ ...templatesTrace(),
45232
45372
  ...devicesTrace(),
45373
+ ...guardTrace,
45233
45374
  path,
45234
45375
  startedAt,
45235
45376
  endedAt: options.now(),
@@ -45278,6 +45419,125 @@ function resolveStepArgs(value, vars, onMissing) {
45278
45419
  if (value !== null && typeof value === "object") return Object.fromEntries(Object.entries(value).map(([k, v]) => [k, resolveStepArgs(v, vars, onMissing)]));
45279
45420
  return value;
45280
45421
  }
45422
+ /** A device template that did not render: the step fails with this, never throws past `runSteps`. */
45423
+ var StepTemplateError = class extends Error {
45424
+ reason;
45425
+ constructor(reason, message) {
45426
+ super(`device template [${reason}]: ${message}`);
45427
+ this.reason = reason;
45428
+ this.name = "StepTemplateError";
45429
+ }
45430
+ };
45431
+ /**
45432
+ * A `{{vars.x}}` slot, set aside while a template renders. The slot carries a
45433
+ * nonce drawn per call, so a device value that happens to contain the sentinel
45434
+ * characters can never name a held variable.
45435
+ */
45436
+ var VAR_SLOT_OPEN = "";
45437
+ var VAR_SLOT_CLOSE = "";
45438
+ var TEMPLATE_MARKUP_RE = /\{\{|\{%/;
45439
+ function newSlotNonce() {
45440
+ return Math.random().toString(36).slice(2, 12);
45441
+ }
45442
+ function slotPattern(nonce) {
45443
+ return new RegExp(`${VAR_SLOT_OPEN}${nonce}:([A-Za-z_][A-Za-z0-9_]*)${VAR_SLOT_CLOSE}`, "g");
45444
+ }
45445
+ /** True when a string, once its `{{vars.x}}` slots are set aside, still carries template markup. */
45446
+ function carriesDeviceTemplate(text) {
45447
+ return TEMPLATE_MARKUP_RE.test(text.replace(TEMPLATE_RE, ""));
45448
+ }
45449
+ /** Every string in `value` that is a device template (D1021), de-duplicated, in walk order. */
45450
+ function collectDeviceTemplates(value) {
45451
+ const found = /* @__PURE__ */ new Set();
45452
+ const walk = (node) => {
45453
+ if (typeof node === "string") {
45454
+ if (carriesDeviceTemplate(node)) found.add(node);
45455
+ } else if (Array.isArray(node)) for (const item of node) walk(item);
45456
+ else if (node !== null && typeof node === "object") for (const item of Object.values(node)) walk(item);
45457
+ };
45458
+ walk(value);
45459
+ return [...found];
45460
+ }
45461
+ function protectVarSlots(text, nonce) {
45462
+ return text.replace(TEMPLATE_RE, (_m, key) => `${VAR_SLOT_OPEN}${nonce}:${key}${VAR_SLOT_CLOSE}`);
45463
+ }
45464
+ function restoreVarSlots(text, nonce, vars, onMissing) {
45465
+ return text.replace(slotPattern(nonce), (_m, key) => {
45466
+ const v = vars[key];
45467
+ if (v === void 0) {
45468
+ onMissing(key);
45469
+ return "";
45470
+ }
45471
+ return String(v);
45472
+ });
45473
+ }
45474
+ /**
45475
+ * {@link resolveStepArgs} plus the device templates of a step (D1021). A string
45476
+ * that carries `{{ … }}` / `{% … %}` beyond a `{{vars.x}}` slot is rendered by
45477
+ * `render` BEFORE the variables are put in, so a variable's value is data and
45478
+ * never template source (an action variable can come from a non-admin caller).
45479
+ * A refused render, or no renderer, throws {@link StepTemplateError}: the step
45480
+ * fails with the typed reason and nothing is dispatched.
45481
+ */
45482
+ async function resolveStepArgsWithTemplates(value, vars, onMissing, render) {
45483
+ const nonce = newSlotNonce();
45484
+ const sources = [];
45485
+ const indexOf = /* @__PURE__ */ new Map();
45486
+ const hold = (text) => {
45487
+ const known = indexOf.get(text);
45488
+ if (known !== void 0) return known;
45489
+ sources.push(text);
45490
+ indexOf.set(text, sources.length - 1);
45491
+ return sources.length - 1;
45492
+ };
45493
+ class Pending {
45494
+ index;
45495
+ constructor(index) {
45496
+ this.index = index;
45497
+ }
45498
+ }
45499
+ const collect = (node) => {
45500
+ if (isVarRef(node)) return resolveStepArgs(node, vars, onMissing);
45501
+ if (typeof node === "string") return carriesDeviceTemplate(node) ? new Pending(hold(protectVarSlots(node, nonce))) : resolveStepArgs(node, vars, onMissing);
45502
+ if (Array.isArray(node)) return node.map(collect);
45503
+ if (node !== null && typeof node === "object") return Object.fromEntries(Object.entries(node).map(([k, v]) => [k, collect(v)]));
45504
+ return node;
45505
+ };
45506
+ const skeleton = collect(value);
45507
+ if (sources.length === 0) return {
45508
+ value: skeleton,
45509
+ notes: []
45510
+ };
45511
+ if (render === void 0) throw new StepTemplateError("unavailable", "this node has no device template renderer");
45512
+ let answers;
45513
+ try {
45514
+ answers = await render(sources);
45515
+ } catch (err) {
45516
+ throw new StepTemplateError("unavailable", errorMessage(err));
45517
+ }
45518
+ const texts = [];
45519
+ const notes = [];
45520
+ for (const index of sources.keys()) {
45521
+ const answer = answers[index];
45522
+ if (answer === void 0) throw new StepTemplateError("unavailable", `no answer for template ${index + 1}`);
45523
+ if (!answer.ok) throw new StepTemplateError(answer.refusal.reason, answer.refusal.message);
45524
+ texts.push(restoreVarSlots(answer.text, nonce, vars, onMissing));
45525
+ for (const entry of answer.trace) {
45526
+ const note = `${entry.ref}: ${entry.reason}`;
45527
+ if (!notes.includes(note)) notes.push(note);
45528
+ }
45529
+ }
45530
+ const fill = (node) => {
45531
+ if (node instanceof Pending) return texts[node.index] ?? "";
45532
+ if (Array.isArray(node)) return node.map(fill);
45533
+ if (node !== null && typeof node === "object") return Object.fromEntries(Object.entries(node).map(([k, v]) => [k, fill(v)]));
45534
+ return node;
45535
+ };
45536
+ return {
45537
+ value: fill(skeleton),
45538
+ notes
45539
+ };
45540
+ }
45281
45541
  function stepMetaOfAction(step) {
45282
45542
  if (step.kind === "wait") return { kind: "wait" };
45283
45543
  const { target, actionId } = normalizeCapStep(step);
@@ -45331,19 +45591,36 @@ async function runForDevices(deviceIds, scope, work, concurrency = 4) {
45331
45591
  * variables. Variables are substituted per step, at the moment it runs, so a
45332
45592
  * missing one fails THAT step (traced) and leaves the later ones not-run.
45333
45593
  */
45594
+ /** The guard and the else list of a step, bound to the run (#472); `{}` for an unguarded step. */
45595
+ function guardOf(step, vars, deps) {
45596
+ const when = step.if;
45597
+ if (when === void 0) return {};
45598
+ const evaluate = deps.evaluateCondition;
45599
+ return {
45600
+ guard: async () => evaluate === void 0 ? {
45601
+ result: "unknown",
45602
+ reason: "this consumer has no condition evaluator"
45603
+ } : evaluate(when),
45604
+ ...step.else === void 0 ? {} : { otherwise: buildActionSteps(step.else, vars, deps) }
45605
+ };
45606
+ }
45334
45607
  function buildActionSteps(steps, vars, deps) {
45335
45608
  return steps.map((step) => {
45609
+ const guarded = guardOf(step, vars, deps);
45336
45610
  const meta = stepMetaOfAction(step);
45337
45611
  if (step.kind === "wait") return {
45338
45612
  meta,
45613
+ ...guarded,
45339
45614
  run: () => deps.sleep(step.seconds * 1e3)
45340
45615
  };
45341
45616
  const normalized = normalizeCapStep(step);
45342
45617
  return {
45343
45618
  meta,
45619
+ ...guarded,
45344
45620
  run: async (scope) => {
45345
- const resolved = resolveStepArgs(step.args ?? {}, vars, deps.onMissingVar);
45346
- const args = isPlainRecord(resolved) ? resolved : {};
45621
+ const templated = await resolveStepArgsWithTemplates(step.args ?? {}, vars, deps.onMissingVar, deps.renderTemplates);
45622
+ if (templated.notes.length > 0) scope.setTemplateNotes(templated.notes);
45623
+ const args = isPlainRecord(templated.value) ? templated.value : {};
45347
45624
  const target = await deps.resolveTarget(normalized.target, normalized.actionId, vars, {
45348
45625
  actionId: normalized.actionId,
45349
45626
  owner: deps.owner
@@ -53106,6 +53383,25 @@ var CAP_CUSTOMIZE_CATALOG = {
53106
53383
  }]
53107
53384
  }
53108
53385
  };
53386
+ /**
53387
+ * Unit meta on runtime-state fields. The composed-device row reads this;
53388
+ * it is not an override list (D944).
53389
+ */
53390
+ var CAP_RUNTIME_FIELD_UNITS = {
53391
+ "ambient-light-sensor": { illuminance: "lx" },
53392
+ "battery": {
53393
+ level: "%",
53394
+ voltage: "V"
53395
+ },
53396
+ "humidity-sensor": { humidity: "%" },
53397
+ "power-meter": {
53398
+ power: "W",
53399
+ energy: "kWh",
53400
+ voltage: "V",
53401
+ current: "A"
53402
+ },
53403
+ "temperature-sensor": { temperature: "°C" }
53404
+ };
53109
53405
  function problem(code, path, message) {
53110
53406
  return {
53111
53407
  code,
@@ -57947,6 +58243,161 @@ function checkDeviceAlias(alias, isTaken) {
57947
58243
  };
57948
58244
  }
57949
58245
  /**
58246
+ * Device value templates, the parts that need no template engine (D1021).
58247
+ *
58248
+ * A template is plain text with Jinja-style `{{ … }}` / `{% … %}` blocks:
58249
+ * `{{ stufa_veranda.temperature | unit('°F') | round(1) }}`. Devices are named
58250
+ * by their alias (`device-alias.ts`); a field is `alias.field` when the field
58251
+ * name is unique across the device's capabilities, else `alias.<cap>.field`,
58252
+ * and an ambiguous `alias.field` is refused by name.
58253
+ *
58254
+ * The engine itself (nunjucks) lives ONLY in the hub's renderer
58255
+ * (`packages/system/src/builtins/device-manager/device-template/`, guard
58256
+ * `check-device-template-grammar`): it does not sandbox, so it renders only in
58257
+ * a worker thread under a wall-time budget, over frozen plain data. This file
58258
+ * is the shared vocabulary — limits, refusal reasons, the trace, and how a
58259
+ * `(alias, path)` reference resolves against a device's slices.
58260
+ */
58261
+ var DEVICE_TEMPLATE_MAX_LENGTH = 4096;
58262
+ var DEVICE_TEMPLATE_MAX_OUTPUT = 4096;
58263
+ var DeviceTemplateSchema = z.string().min(1).max(DEVICE_TEMPLATE_MAX_LENGTH);
58264
+ /** The filters a template may use. Anything else is refused at parse time. */
58265
+ var DEVICE_TEMPLATE_FILTERS = [
58266
+ "unit",
58267
+ "round",
58268
+ "default",
58269
+ "since",
58270
+ "ago",
58271
+ "format",
58272
+ "upper",
58273
+ "lower",
58274
+ "title",
58275
+ "capitalize",
58276
+ "trim",
58277
+ "abs",
58278
+ "int",
58279
+ "float",
58280
+ "length",
58281
+ "d",
58282
+ "join",
58283
+ "replace",
58284
+ "first",
58285
+ "last",
58286
+ "sort",
58287
+ "reverse",
58288
+ "sum",
58289
+ "string",
58290
+ "list",
58291
+ "truncate"
58292
+ ];
58293
+ var DeviceTemplateRefusalSchema = z.object({
58294
+ reason: z.enum([
58295
+ "too-long",
58296
+ "syntax",
58297
+ "forbidden-syntax",
58298
+ "forbidden-member",
58299
+ "unknown-filter",
58300
+ "ambiguous-field",
58301
+ "busy",
58302
+ "budget-exceeded",
58303
+ "timeout",
58304
+ "output-too-large",
58305
+ "render-failed",
58306
+ "out-of-scope",
58307
+ "unavailable"
58308
+ ]),
58309
+ message: z.string()
58310
+ });
58311
+ var DeviceTemplateTraceEntrySchema = z.object({
58312
+ ref: z.string(),
58313
+ reason: z.enum([
58314
+ "unknown-alias",
58315
+ "unknown-field",
58316
+ "no-field",
58317
+ "unavailable"
58318
+ ])
58319
+ });
58320
+ var DeviceTemplateRenderSchema = z.discriminatedUnion("ok", [z.object({
58321
+ ok: z.literal(true),
58322
+ text: z.string(),
58323
+ trace: z.array(DeviceTemplateTraceEntrySchema)
58324
+ }), z.object({
58325
+ ok: z.literal(false),
58326
+ refusal: DeviceTemplateRefusalSchema,
58327
+ trace: z.array(DeviceTemplateTraceEntrySchema)
58328
+ })]);
58329
+ /** A capability name as a template spells it: `temperature-sensor` → `temperature_sensor`. */
58330
+ function templateCapKey(cap) {
58331
+ return cap.replace(/-/g, "_");
58332
+ }
58333
+ function isRecord$3(value) {
58334
+ return typeof value === "object" && value !== null && !Array.isArray(value);
58335
+ }
58336
+ function pickPath(root, path) {
58337
+ let cursor = root;
58338
+ for (const part of path) if (Array.isArray(cursor) && typeof part === "number") cursor = cursor[part];
58339
+ else if (isRecord$3(cursor) && Object.hasOwn(cursor, String(part))) cursor = cursor[String(part)];
58340
+ else return;
58341
+ return cursor;
58342
+ }
58343
+ /**
58344
+ * Resolve the path after an alias. `<cap>.field…` when the first segment names
58345
+ * one of the device's caps; otherwise `field…` when exactly one cap carries a
58346
+ * field of that name; several caps carrying it is `ambiguous`, naming them.
58347
+ */
58348
+ function resolveTemplateRef(view, path) {
58349
+ const head = path[0];
58350
+ if (head === void 0) return {
58351
+ kind: "missing",
58352
+ reason: "no-field"
58353
+ };
58354
+ const caps = Object.keys(view.slices);
58355
+ const named = caps.find((cap) => cap === head || templateCapKey(cap) === head);
58356
+ if (named !== void 0) {
58357
+ const rest = path.slice(1);
58358
+ if (rest.length === 0) return {
58359
+ kind: "missing",
58360
+ reason: "no-field"
58361
+ };
58362
+ const value = pickPath(view.slices[named], rest);
58363
+ if (value === void 0) return {
58364
+ kind: "missing",
58365
+ reason: "unknown-field"
58366
+ };
58367
+ return {
58368
+ kind: "value",
58369
+ cap: named,
58370
+ fieldPath: rest,
58371
+ value
58372
+ };
58373
+ }
58374
+ const owners = caps.filter((cap) => {
58375
+ const slice = view.slices[cap];
58376
+ return isRecord$3(slice) && Object.hasOwn(slice, String(head));
58377
+ });
58378
+ if (owners.length === 0) return {
58379
+ kind: "missing",
58380
+ reason: "unknown-field"
58381
+ };
58382
+ const [only] = owners;
58383
+ if (owners.length > 1 || only === void 0) return {
58384
+ kind: "ambiguous",
58385
+ field: String(head),
58386
+ caps: owners
58387
+ };
58388
+ const value = pickPath(view.slices[only], path);
58389
+ if (value === void 0) return {
58390
+ kind: "missing",
58391
+ reason: "unknown-field"
58392
+ };
58393
+ return {
58394
+ kind: "value",
58395
+ cap: only,
58396
+ fieldPath: path,
58397
+ value
58398
+ };
58399
+ }
58400
+ /**
57950
58401
  * A SITE ZONE — a named part of the property that several locations belong to.
57951
58402
  *
57952
58403
  * "Night zone" holds every bedroom; "Zona giorno" the living room and the
@@ -58868,6 +59319,38 @@ var deviceManagerCapability = {
58868
59319
  kind: "mutation",
58869
59320
  auth: "admin"
58870
59321
  }),
59322
+ /**
59323
+ * Render device value templates (D1021). The ONE door every consumer uses:
59324
+ * an action step, a scheduler point, a notification rule, a generated
59325
+ * automation block. Admin-only (an in-process block carries the mesh
59326
+ * principal): it reads device state by alias, so a non-admin never calls it
59327
+ * directly. `allowedDeviceIds` is the set the END caller was proven to see;
59328
+ * a template naming another device answers `out-of-scope`. Answers are
59329
+ * index-aligned with `templates`.
59330
+ */
59331
+ renderDeviceTemplates: method(z.object({
59332
+ templates: z.array(DeviceTemplateSchema).max(64),
59333
+ allowedDeviceIds: z.array(z.number().int()).optional()
59334
+ }), z.object({ results: z.array(DeviceTemplateRenderSchema) }), { auth: "admin" }),
59335
+ /**
59336
+ * Vet templates without rendering them: the syntax refusal, or the devices
59337
+ * each names and whether `allowedDeviceIds` covers them. The save door and
59338
+ * the run-time scope check both ask this.
59339
+ */
59340
+ checkDeviceTemplates: method(z.object({
59341
+ templates: z.array(z.string()).max(64),
59342
+ allowedDeviceIds: z.array(z.number().int()).optional()
59343
+ }), z.object({ results: z.array(z.discriminatedUnion("ok", [z.object({
59344
+ ok: z.literal(true),
59345
+ aliases: z.array(z.object({
59346
+ alias: z.string(),
59347
+ deviceId: z.number().int().nullable(),
59348
+ allowed: z.boolean()
59349
+ }))
59350
+ }), z.object({
59351
+ ok: z.literal(false),
59352
+ refusal: DeviceTemplateRefusalSchema
59353
+ })])) }), { auth: "admin" }),
58871
59354
  /** Update the operator-organisational location label. `null`
58872
59355
  * clears it. */
58873
59356
  setLocation: method(z.object({
@@ -63479,6 +63962,17 @@ var TIMED_RUN_DEVICE_TYPES = [DeviceType.Heater, DeviceType.PetFountain];
63479
63962
  function timedRunLimitOf(deviceType) {
63480
63963
  return TIMED_RUN_LIMITS[deviceType] ?? null;
63481
63964
  }
63965
+ var MS_PER_SECOND = 1e3;
63966
+ var MS_PER_MINUTE = 6e4;
63967
+ /**
63968
+ * Whole units left on an armed run. Minutes and seconds both ceil, and a run
63969
+ * that has not expired yet never reads as zero.
63970
+ */
63971
+ function timedRunRemaining(activeUntil, now, unit) {
63972
+ const left = activeUntil - now;
63973
+ if (left <= 0) return 0;
63974
+ return Math.max(1, Math.ceil(left / (unit === "min" ? MS_PER_MINUTE : MS_PER_SECOND)));
63975
+ }
63482
63976
  /** Seconds in a duration of `duration` `unit`. */
63483
63977
  function timedRunSeconds(duration, unit) {
63484
63978
  return unit === "min" ? duration * 60 : duration;
@@ -64018,7 +64512,13 @@ var HeroTimedRunSlotSchema = z.object({
64018
64512
  activeUntil: z.number().nullable(),
64019
64513
  quickRun: TimedRunQuickRunSchema,
64020
64514
  run: HeroActionSchema,
64021
- cancel: HeroActionSchema
64515
+ cancel: HeroActionSchema,
64516
+ /**
64517
+ * Whole units left (the limit's unit, ceil). `null` while nothing is armed.
64518
+ * A number, not words: the row formats it, and a text here would not fit the
64519
+ * hero-layout declaration.
64520
+ */
64521
+ remaining: z.number().nullable()
64022
64522
  });
64023
64523
  var HeroPowerSupplySlotSchema = z.object({
64024
64524
  /** The plug's state; `null` = unknown, never off. */
@@ -64137,18 +64637,31 @@ var HeroModelSchema = z.object({
64137
64637
  * 4. a trailing fact (power, else battery, else consumables).
64138
64638
  *
64139
64639
  * Selection rules, all taken from the model:
64140
- * - ONE control is ever shown: the device's own power; else the FIRST control of
64640
+ * - the primary control is the device's own power; else the FIRST control of
64141
64641
  * the FIRST row that has any (a later row's control is never promoted). When
64142
64642
  * the model lists that part in `gated`, the row has no inline control: the
64143
64643
  * projection never falls through to another control the caller could use.
64644
+ * - a timed run, when the model carries the slot, sits beside that primary:
64645
+ * Run while idle, Stop while armed. Gating the slot hides the control.
64144
64646
  * - the status line is the head (what plays, else the state) plus at most
64145
- * {@link ROW_STATUS_FACTS_MAX} facts, the trailing fact excluded;
64647
+ * {@link ROW_STATUS_FACTS_MAX} facts, the trailing fact excluded, then the
64648
+ * time left on an armed timed run;
64146
64649
  * - the trailing fact is the first of power, battery, consumables.
64147
64650
  *
64148
64651
  * `projectDeviceRow` is pure and computes nothing: it selects from a
64149
64652
  * {@link HeroModel}. A row that needed a value the hero lacks would mean the
64150
64653
  * model is missing it, so the fix goes in the model.
64151
64654
  */
64655
+ /**
64656
+ * The row's timed-run control. `id` is `timed-run.run` while idle and
64657
+ * `timed-run.cancel` while armed; `duration` and `unit` are the one-tap run
64658
+ * a Run press starts.
64659
+ */
64660
+ var HeroRowTimedRunSchema = z.object({
64661
+ id: z.enum(["timed-run.run", "timed-run.cancel"]),
64662
+ duration: z.number(),
64663
+ unit: z.enum(["min", "s"])
64664
+ });
64152
64665
  var HeroRowModelSchema = z.object({
64153
64666
  deviceId: z.number().int(),
64154
64667
  name: z.string(),
@@ -64161,6 +64674,11 @@ var HeroRowModelSchema = z.object({
64161
64674
  statusLine: z.array(HeroTextSchema),
64162
64675
  /** `null` = the type has no inline control, or the caller may not act on it. */
64163
64676
  primary: HeroControlSchema.nullable(),
64677
+ /**
64678
+ * Beside `primary` when the device offers a timed run: Run while idle, Stop
64679
+ * while armed. `null` when there is no slot, or the caller may not act.
64680
+ */
64681
+ timedRun: HeroRowTimedRunSchema.nullable(),
64164
64682
  trailing: HeroFactSchema.nullable()
64165
64683
  });
64166
64684
  /** The trailing fact, in order of preference. */
@@ -64197,7 +64715,30 @@ function primaryOf(model) {
64197
64715
  return null;
64198
64716
  }
64199
64717
  function statusLineOf(model, trailing) {
64200
- return [model.rows.find((r) => r.id === "now-playing")?.status ?? null ?? model.title, ...model.facts.filter((f) => f !== trailing).map((f) => f.text).slice(0, 3)];
64718
+ const head = model.rows.find((r) => r.id === "now-playing")?.status ?? null ?? model.title;
64719
+ const rest = model.facts.filter((f) => f !== trailing).map((f) => f.text).slice(0, 3);
64720
+ const slot = model.timedRun;
64721
+ if (slot === null || slot.remaining === null) return [head, ...rest];
64722
+ const word = slot.quickRun.unit === "min" ? "min" : "s";
64723
+ const left = {
64724
+ en: `${slot.remaining} ${word}`,
64725
+ it: `${slot.remaining} ${word}`
64726
+ };
64727
+ return [
64728
+ head,
64729
+ ...rest,
64730
+ left
64731
+ ];
64732
+ }
64733
+ /** Run while the slot is idle, Stop while it is armed. Hidden when the caller may not act. */
64734
+ function timedRunOf(model) {
64735
+ const slot = model.timedRun;
64736
+ if (slot === null || model.gated.includes("timed-run")) return null;
64737
+ return {
64738
+ id: slot.activeUntil === null ? "timed-run.run" : "timed-run.cancel",
64739
+ duration: slot.quickRun.duration,
64740
+ unit: slot.quickRun.unit
64741
+ };
64201
64742
  }
64202
64743
  function projectDeviceRow(model) {
64203
64744
  const trailing = trailingOf(model.facts);
@@ -64211,6 +64752,7 @@ function projectDeviceRow(model) {
64211
64752
  scene: model.scene,
64212
64753
  statusLine: statusLineOf(model, trailing),
64213
64754
  primary: primaryOf(model),
64755
+ timedRun: timedRunOf(model),
64214
64756
  trailing
64215
64757
  };
64216
64758
  }
@@ -100524,10 +101066,14 @@ function timerTile(quickRun) {
100524
101066
  value: t(text, text)
100525
101067
  };
100526
101068
  }
101069
+ function remainingWords(amount, unit) {
101070
+ const word = unit === "min" ? "min" : "s";
101071
+ return t(`${amount} ${word}`, `${amount} ${word}`);
101072
+ }
100527
101073
  var timedRunContribution = contribution("timed-run", TimedRunStatusSchema, (slice, ctx) => {
100528
101074
  const type = deviceTypeOf(ctx.type);
100529
- const limit = type === void 0 ? void 0 : TIMED_RUN_LIMITS[type];
100530
- if (limit === void 0) return {};
101075
+ const limit = type === void 0 ? null : timedRunLimitOf(type);
101076
+ if (limit === null) return {};
100531
101077
  const quickRun = slice?.quickRun ?? timedRunQuickRun(limit, null);
100532
101078
  const activeUntil = slice?.activeUntil != null && slice.activeUntil > ctx.now ? slice.activeUntil : null;
100533
101079
  const runArgs = {
@@ -100537,11 +101083,12 @@ var timedRunContribution = contribution("timed-run", TimedRunStatusSchema, (slic
100537
101083
  const run = action("timed-run.run", t(`Run ${quickRun.duration} ${quickRun.unit}`, `Avvia ${quickRun.duration} ${quickRun.unit}`), "timer", "timed-run", "runFor", runArgs, "primary");
100538
101084
  const cancel = action("timed-run.cancel", t("Stop", "Ferma"), "timer-off", "timed-run", "cancel");
100539
101085
  const restart = action("timed-run.restart", t("Restart", "Riavvia"), "rotate-cw", "timed-run", "runFor", runArgs);
100540
- const left = activeUntil === null ? 0 : Math.max(1, Math.ceil((activeUntil - ctx.now) / 6e4));
101086
+ const remaining = activeUntil === null ? null : timedRunRemaining(activeUntil, ctx.now, quickRun.unit);
101087
+ const words = remaining === null ? null : remainingWords(remaining, quickRun.unit);
100541
101088
  const row = {
100542
101089
  id: "run-for",
100543
101090
  icon: "timer",
100544
- status: activeUntil === null ? t(`Run for ${quickRun.duration} ${quickRun.unit}`, `Avvia per ${quickRun.duration} ${quickRun.unit}`) : t(`Stops in ${left} min`, `Si ferma tra ${left} min`),
101091
+ status: words === null ? t(`Run for ${quickRun.duration} ${quickRun.unit}`, `Avvia per ${quickRun.duration} ${quickRun.unit}`) : t(`Stops in ${words.en}`, `Si ferma tra ${words.it}`),
100545
101092
  controls: activeUntil === null ? [asAction(run)] : [asAction(cancel), asAction(restart)]
100546
101093
  };
100547
101094
  const armed = activeUntil === null ? {} : { right: [timerTile(quickRun)] };
@@ -100550,7 +101097,8 @@ var timedRunContribution = contribution("timed-run", TimedRunStatusSchema, (slic
100550
101097
  activeUntil,
100551
101098
  quickRun,
100552
101099
  run,
100553
- cancel
101100
+ cancel,
101101
+ remaining
100554
101102
  },
100555
101103
  rows: [row],
100556
101104
  tilesFallback: true,
@@ -104214,6 +104762,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
104214
104762
  access: "create",
104215
104763
  role: "admin"
104216
104764
  },
104765
+ "deviceManager.checkDeviceTemplates": {
104766
+ capName: "device-manager",
104767
+ capScope: "system",
104768
+ addonId: null,
104769
+ access: "view",
104770
+ role: "admin"
104771
+ },
104217
104772
  "deviceManager.cleanupDeletedDevicesData": {
104218
104773
  capName: "device-manager",
104219
104774
  capScope: "system",
@@ -104613,6 +105168,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
104613
105168
  access: "create",
104614
105169
  role: "admin"
104615
105170
  },
105171
+ "deviceManager.renderDeviceTemplates": {
105172
+ capName: "device-manager",
105173
+ capScope: "system",
105174
+ addonId: null,
105175
+ access: "view",
105176
+ role: "admin"
105177
+ },
104616
105178
  "deviceManager.reportDiscoveryObservations": {
104617
105179
  capName: "device-manager",
104618
105180
  capScope: "system",
@@ -112529,7 +113091,6 @@ function offered(received) {
112529
113091
  };
112530
113092
  }
112531
113093
  offered(HA_AS), withheld(HOMEKIT_REASON), withheld(ALEXA_REASON), withheld(GOOGLE_REASON), withheld(MATTER_REASON);
112532
- z.string().min(1).max(4096);
112533
113094
  /**
112534
113095
  * Runtime list of cap names with status. Used by the settings
112535
113096
  * aggregator to enumerate caps whose `status` should be polled +
@@ -116099,6 +116660,12 @@ var SESSION_ONLY_POLICY = {
116099
116660
  durability: "session",
116100
116661
  volatileFields: []
116101
116662
  };
116663
+ /**
116664
+ * The unit a composed-device field row offers convert-unit from (D941, D944).
116665
+ */
116666
+ function runtimeFieldUnit(cap, path) {
116667
+ return CAP_RUNTIME_FIELD_UNITS[cap]?.[path];
116668
+ }
116102
116669
  var G711_SCALE_CORRECTION_DB = {
116103
116670
  PCMU: 20 * Math.log10(4),
116104
116671
  PCMA: 20 * Math.log10(8)
@@ -117902,4 +118469,4 @@ z.object({
117902
118469
  commands: z.record(z.string(), z.unknown())
117903
118470
  });
117904
118471
  //#endregion
117905
- export { EMPTY_AUTOMATION_STATE as $, templateCapability as $a, processTimeZoneOr as $i, coreBlocksCapability as $n, BaseAddon as $o, isDefaultAppConnectionEndpoint as $r, defineEntryKind as $s, SsoBridgeClaimsSchema as $t, ControlStatusSchema as A, scopesAllowDeviceCap as Aa, parseSecretRef as Ac, nextOccurrence as Ai, buildHeroModel as An, composedDeviceRef as Ao, fanControlCapability as Ar, StoredRecordKindDeclarationSchema as As, PREFERENCES_MAX_VALUE_BYTES as At, DEVICE_ENROLLMENT_TTL_MS as B, snapshotCapability as Ba, toNodeId as Bc, parseAcceleratorFactsJson as Bi, climateControlCapability as Bn, helperMembers as Bo, generateDeviceAlias as Br, assertValidDeclaration as Bs, REMOTE_MEDIA_COMMANDS as Bt, CORE_BLOCKS_ADDON_ID as C, resolveRunnerId as Ca, mapSecretLeaves as Cc, memoizePinnedFfmpeg as Ci, bareAddonId as Cn, HISTORY_FAST_MS as Co, enumerateSchemaFields as Cr, RecordIntegrationInstances as Cs, MINUTES_PER_DAY as Ct, CatalogFileSchema as D, runtimeStatePolicyFor as Da, normalizeSecretOwner as Dc, modeForSwitch as Di, buildCapabilityLookup as Dn, MINUTE_MS as Do, expandContainer as Dr, RecordUniqueViolationError as Ds, MigrationMetaSchema as Dt, CalendarPreferencesSchema as E, runSteps as Ea, normalizeNodeId as Ec, migrationsCapability as Ei, buildActionSteps as En, HelperMemberSchema as Eo, evictionPolicyOfLocation as Er, RecordTooLargeError as Es, MigrationLedgerEntrySchema as Et, DATABASE_SNAPSHOT_TIMEOUT_MS as F, sharedActuatorMethods as Fa, scopeKey as Fc, normalizeUnit as Fi, capUnitResolver as Fn, compositionSourceKey as Fo, findChannelSource as Fr, actionEffect as Fs, PreferenceDeviceIdSchema as Ft, DEVICE_SAN_USER_PREFIX as G, storageMigrationCapability as Ga, withoutCallerStamp as Gc, pickAppLinkHub as Gi, composerCapability as Gn, nextLocalMidnight as Go, internalActionId as Gr, collectSecretMarkerRefs as Gs, RunningStateStatusSchema as Gt, DEVICE_ID_FIELD as H, stableIdMapOf as Ha, transformSecretWrite as Hc, parseStreamParamsFormPatch as Hi, colorCapability as Hn, integrateReading as Ho, groupTemplate as Hr, buildSecretRef as Hs, RecordingStatusSchema as Ht, DATA_STORE_DATABASES as I, sharedColorModes as Ia, secretTreeFromPaths as Ic, objectInputDeclaresAddonId as Ii, catalogueIssues as In, createStatefulExpressionMemory as Io, foldSnapshotByFunction as Ir, asJsonObject as Is, PreferenceNamespaceSchema as It, DeclaredDevices as J, streamCatalogCapability as Ja, DeviceType as Jc, powerSourceCapability as Ji, consumablesCapability as Jn, planResetTier as Jo, isAlertEpisodeSeverity as Jr, commandOrigin as Js, STREAM_PROFILE_META as Jt, DEVICE_TOMBSTONE_RETENTION_MS as K, storageOccupancyCapability as Ka, DeviceFeature as Kc, planComposition as Ki, compositionFieldKey as Kn, openReset as Ko, interpolate as Kr, collectZodSecretPaths as Ks, STORAGE_ACCESS_FALLBACK as Kt, DAY_NAMES as L, shortHostname as La, secretTreeFromSchema as Lc, objectInputDeclaresRequiredDeviceId as Li, checkDeviceAlias as Ln, disarmRoseMemory as Lo, formatDeviceRevoker as Lr, asNumber as Ls, PreferenceValueSchema as Lt, CredentialTokenClaimsSchema as M, seedInstanceOnce as Ma, recordSecretRef as Mc, normalizeCapStep as Mi, calendarsCapability as Mn, compositionFeatureEnabled as Mo, fanPresetsCapability as Mr, UnindexedFilterError as Ms, PackageRequiresSchema as Mt, DATABASE_SNAPSHOT_PARTIAL_SUFFIX as N, settingsStoreCapability as Na, resolveCapMount as Nc, normalizeCoreBlockWrite as Ni, cameraGridLayoutCapability as Nn, compositionItemFieldPath as No, featureForwards as Nr, UnknownRecordKindError as Ns, PetFountainStatusSchema as Nt, ConditionMirror as O, schedulersCapability as Oa, parseJsonObject as Oc, modeMayWrite as Oi, buildDeviceEnrollmentLink as On, buildFfmpegArgs as Oo, expressionContainsBuiltinCall as Or, RevConflictError as Os, NetworkTunnelStartedDataSchema as Ot, DATABASE_SNAPSHOT_SUFFIX as P, sharedActuatorFeatures as Pa, resolveSecretMarkers as Pc, normalizeStepTargets as Pi, canonicalIconKey as Pn, compositionSliceKey as Po, filesystemBrowseCapability as Pr, WELL_KNOWN_TAB_MAP as Ps, PowerSourceInfoSchema as Pt, DiscoveryProposalBodySchema as Q, switchStateOfMode as Qa, procedureAuthKey as Qi, coreBlockSourceKind as Qn, wattMillisecondsToKwh as Qo, isCredentialTokenPayload as Qr, defineCustomActions as Qs, ServerNameSchema as Qt, DEFAULT_HOLD_OVERRIDE as R, siteFor as Ra, secretViewsOf as Rc, occurrenceOn as Ri, checkRoleAddress as Rn, evaluateDerivative as Ro, formatMinutes as Rr, asString$1 as Rs, QuantityUnitError as Rt, COMPOSER_RUNNER_ID as S, resolveRemoteSource as Sa, makeSecretMarker as Sc, mediaPlayerFeaturesOfRoles as Si, backupCapability as Sn, DEFAULT_HISTORY_RETENTION as So, enumerateItemArrayFields as Sr, ReadinessTimeoutError as Ss, MIGRATION_API_V1_METHODS as St, CREDENTIAL_TOKEN_AUDIENCE as T, runFanOut as Ta, nodePin as Tc, metricsProviderCapability as Ti, brightnessCapability as Tn, HOUR_MS as To, evaluateWhenTree as Tr, RecordNotFoundError as Ts, MediaPlayerStatusSchema as Tt, DEVICE_NONCE_TTL_MS as U, storageAdminCapability as Ua, userError as Uc, petFountainCapability as Ui, compareVersions as Un, isForwardInputRef as Uo, heroLayoutCapability as Ur, collectSecretConfigKeys as Us, RemoteAssumedStateSchema as Ut, DEVICE_HISTORY_ENERGY_KEY as V, splitTranslationRef as Va, toSecretFieldView as Vc, parseColorInput as Vi, collectWhenMirrorSources as Vn, historyRetentionFromSettings as Vo, groupCommandsCapability as Vr, auditedFields as Vs, ROOT_BUCKET_KEY as Vt, DEVICE_SAN_CREDENTIAL_PREFIX as W, storageCapability as Wa, vocabActionIdFor as Wc, petFountainWaterItem as Wi, compileScalarOverride as Wn, isHistoryHelper as Wo, integrationInstancesCapability as Wr, collectSecretLeaves as Ws, RemoteLayoutPayloadSchema as Wt, DeviceStatusSchema as X, supportedRuntimes as Xa, featuresOfBoundCaps as Xc, preconditionOf as Xi, coreBlockComposition as Xn, statisticCadenceMs as Xo, isArrayOutputSchema as Xr, customAction as Xs, SchedulerSchema as Xt, DeviceRunSchema as Y, streamQualityLabel as Ya, errMsg as Yc, powerSourceLinkOfComposition as Yi, coreBlockAddonId as Yn, planStatisticTier as Yo, isAppLinkBase as Yr, createEvent as Ys, SchedulerError as Yt, DeviceTombstoneSchema as Z, switchCapability as Za, EventCategory as Zc, problemsBlockSave as Zi, coreBlockIdFromAddonId as Zn, toExpressionValue as Zo, isCollectionArrayMethod as Zr, defineAddonMigrations as Zs, ScopedTokenSchema as Zt, CAMERA_SWITCH_ORDER as _, resolveHubAddressRoles as _a, isSecretClear as _c, logLevelAtMost as _i, alertEpisodePayload as _n, withLocationMode as _o, deviceRunsCapability as _r, RECORD_SWEEP_INTERVAL_MS as _s, KEYCHAIN_RESET_TRIGGER_ACTOR as _t, AGENT_MDNS_SERVICE_TYPE as a, recordsCapability as aa, formatSecretScope as ac, kebabToCamel as ai, TemplateKindSchema as an, toTimings as ao, declarationOwnerNodeId as ar, DeclarationRefusedError as as, FanDirectionSchema as at, CATALOG_LANGS as b, resolveMutate as ba, isSecretMarkerLike as bc, mayWriteToLocation as bi, armRemovalReconcile as bn, CompositionSchema as bo, deviceTransitionsCapability as br, RUNTIME_DEFAULTS as bs, LOG_LEVEL_RANK as bt, ActionError as c, remoteLayoutComponentsCapability as ca, historyUnitFor as cc, legacyAutoLinkIds as ci, UserRecordSchema as cn, validateComposition as co, defineExtensionSlotProvider as cr, ForeignSecretMarkerError as cs, FieldClaimSchema as ct, ActionVariableSchema as d, resolveActionVariables as da, isDebugChannelName as dc, localDateOf as di, actionsCapability as dn, valveCapability as do, describeUnmet as dr, NoCallerError as ds, HISTORY_ITEM_CATALOG as dt, projectDeviceRow as ea, defineRecordKinds as ec, isInternalActionId as ei, StorageCleanupJobSchema as en, timedRunCapability as eo, coverCapability as er, BatchTooLargeError as es, EMPTY_REMOTE_ASSUMED_STATE as et, AlertSchema as f, resolveAppConnections as fa, isDeviceConfigCap as fc, localNetworkCapability as fi, addonIdOfActionId as fn, vectorDimFromBase64 as fo, deviceCredentialsCapability as fr, PlaintextSecretError as fs, HUB_MDNS_SERVICE_TYPE as ft, BatteryStatusSchema as g, resolveHeroLayout as ga, isReadingQuantity as gc, logDestinationCapability as gi, alertEpisodeId as gn, withDefaultRunning as go, deviceRemovalHookCapability as gr, RECORD_SECRET_COLLECTION_PREFIX as gs, INTERNAL_ACTION_PREFIX as gt, BaseDevice as h, resolveCoreBlockFiles as ha, isKeychainStoredField as hc, lockDoorLinkOfComposition as hi, addonWidgetsCapability as hn, weekdayOfLocalDate as ho, deviceManagerCapability as hr, RECORD_DELETE_BATCH as hs, IDLE_ACTION_STATUS as ht, ACTUATOR_TEMPLATE_IDS as i, recordEntriesCapability as ia, expandCapMethods as ic, isVoidInput as ii, SwitchStatusSchema as in, timedRunSeconds as io, databaseSnapshotCapability as ir, DEVICE_STATUS_METHOD as is, FanControlStatusSchema as it, CoreBlockSchema as j, scoreRuntimes as ja, readinessKey as jc, normalizeActionUnits as ji, buildStreamParamsConfigSchema as jn, composedDeviceStableId as jo, fanOutTargets as jr, TransactRefusedError as js, PROPOSAL_MIN_SPAN_MS as jt, ConsumableItemSchema as k, scopesAllowAddon as ka, parseJsonUnknown as kc, motionCapability as ki, buildDeviceSignatureMessage as kn, cloneStatefulExpressionMemory as ko, extractNestedAddonId as kr, SECRET_CLEAR as ks, PET_FOUNTAIN_WATER_KEY as kt, ActionStepSchema as l, remoteSourceSteps as la, hydrateSchema as lc, legacyModeOf as li, actionSourceCapability as ln, validateCustomAddress as lo, deriveBatteryPresence as lr, HISTORY_DEFAULT_MIN_INTERVAL_MS as ls, GroupCommandResultSchema as lt, BUILTIN_REMOTE_COMPONENTS as m, resolveCoreBlockEntry as ma, isInstanceEnabled as mc, lockControlCapability as mi, addonSettingsCapability as mn, vectorStoreCapability as mo, deviceHistoryCapability as mr, RECORD_BATCH_MAX_BYTES as ms, HvacModeSchema as mt, ACTION_TARGET_INVALIDATION_EVENTS as n, ptzAutotrackCapability as na, emitReadiness as nc, isObjectInput as ni, StorageLocationTypeSchema as nn, timedRunMaxIn as no, customKeyOfRole as nr, DATAPLANE_SECRET_HEADER as ns, FAN_CAPTURE_FIELDS as nt, AGENT_MDNS_TXT_KEYS as o, reducePoints as oa, getDebugInterest as oc, keychainAdminCapability as oi, TokenScopeSchema as on, unmetRequirements as oo, declaredSeriesKind as or, DeviceTransitionSchema as os, FanPresetSchema as ot, AutomationStateDocSchema as p, resolveBucketMs as pa, isEvent as pc, locationIconKey as pi, addonPagesCapability as pn, vectorIndexDimConflictError as po, deviceExtensionCapability as pr, RECORD_BATCH_MAX as ps, HUB_MDNS_TXT_KEYS as pt, DataStoreDatabaseSchema as q, storageProviderCapability as qa, DeviceRole as qc, platformProbeCapability as qi, compositionSourceRefs as qn, openStatistic as qo, isAlertEpisodeOpen as qr, commandEffect as qs, STORAGE_LOCATION_MODES as qt, ACTUATOR_METHODS as r, readStoredRemoteConfig as ra, entryBody as rc, isSameAddonId as ri, StorageMigrationJobSchema as rn, timedRunQuickRun as ro, dataStoreProviderCapability as rr, DEVICE_SETTINGS_CONTRIBUTION_METHODS as rs, FIRST_LEVEL_MACRO_CLASSES as rt, ALL_CAPABILITY_DEFINITIONS as s, remoteCapability as sa, historyItemFieldPath as sc, keychainCapability as si, UNATTRIBUTED_BUCKET_KEY as sn, userManagementCapability as so, decodeVectorBase64 as sr, FilterRequiredError as ss, FieldClaimModeSchema as st, ACTION_RUN_MAX_MS as t, proposeRunningThreshold as ta, emitDownForOwnedCaps as tc, isLocationEnabled as ti, StorageLocationModeSchema as tn, timedRunLimitOf as to, createDeviceExtensionProvider as tr, CALLER_STAMPED_CAPABILITIES as ts, EMPTY_REMOTE_CONFIG as tt, ActionTargetResolver as u, replacedFieldKeys as ua, isCommand as uc, lifecycleJobSchema as ui, actionWaitTotalMs as un, validateSchedulerInput as uo, describeComposableCaps as ur, InvalidRecordError as us, HISTORY_CATALOG as ut, CAMSTACK_APP_LINK_ORIGIN as v, resolveLocationMode as va, isSecretFieldView as vc, looseSchema as vi, alertsCapability as vn, zoneOnlySite as vo, deviceStateCapability as vr, REDACTED_SECRET as vs, KeychainAuditEntrySchema as vt, CORE_BLOCK_ADDON_PREFIX as w, resolveStepArgs as wa, nodeIdOfScopedKey as wc, methodRefusal as wi, batteryCapability as wn, HISTORY_SLOW_MS as wo, evaluateCompositionField as wr, RecordKindDeclarationSchema as ws, MOTION_CLOSE_AFTER_MS as wt, COMPOSED_ITEM_FIXED_FIELDS as x, resolveNotificationTapAddress as xa, isSecretRefOwnedBy as xc, mediaPlayerCapability as xi, authProviderCapability as xn, DAY_MS as xo, enumerateInferenceDevices as xr, ReadinessRegistry as xs, METHOD_ACCESS_MAP as xt, CAP_NAMES_WITH_STATUS as y, resolveMethodAuth as ya, isSecretMarker as yc, mayReadLocation as yi, appendTrace as yn, COMPOSER_ADDON_ID as yo, deviceStatusCapability as yr, REMOVE_LEAF as ys, KeychainResetRecordSchema as yt, DERIVED_CAMERA_SILENCED_CAP_NAMES as z, siteZoneKey as za, sleep as zc, orderMigrations as zi, checkTemplatePayload as zn, evaluateStatistic as zo, gbToBytes as zr, assertTransactScope as zs, RECORDING_SOURCE_CAMSTACK_ADDON as zt };
118472
+ export { DeviceStatusSchema as $, storageOccupancyCapability as $a, DeviceFeature as $c, powerSourceCapability as $i, coreBlockAddonId as $n, openReset as $o, isAlertEpisodeSeverity as $r, collectZodSecretPaths as $s, SchedulerSchema as $t, ControlStatusSchema as A, resolveTemplateRef as Aa, mapSecretLeaves as Ac, metricsProviderCapability as Ai, buildCapabilityLookup as An, HISTORY_FAST_MS as Ao, evaluateWhenTree as Ar, RecordIntegrationInstances as As, MigrationMetaSchema as At, DEVICE_ENROLLMENT_TTL_MS as B, settingsStoreCapability as Ba, resolveCapMount as Bc, normalizeUnit as Bi, checkDeviceAlias as Bn, compositionItemFieldPath as Bo, findChannelSource as Br, UnknownRecordKindError as Bs, PreferenceValueSchema as Bt, CORE_BLOCKS_ADDON_ID as C, resolveLocationMode as Ca, isReadingQuantity as Cc, looseSchema as Ci, armRemovalReconcile as Cn, withDefaultRunning as Co, deviceStatusCapability as Cr, RECORD_SECRET_COLLECTION_PREFIX as Cs, LOG_LEVEL_RANK as Ct, CatalogFileSchema as D, resolveRemoteSource as Da, isSecretMarkerLike as Dc, mediaPlayerFeaturesOfRoles as Di, batteryCapability as Dn, CompositionSchema as Do, enumerateSchemaFields as Dr, RUNTIME_DEFAULTS as Ds, MOTION_CLOSE_AFTER_MS as Dt, CalendarPreferencesSchema as E, resolveNotificationTapAddress as Ea, isSecretMarker as Ec, mediaPlayerCapability as Ei, bareAddonId as En, COMPOSER_ADDON_ID as Eo, enumerateItemArrayFields as Er, REMOVE_LEAF as Es, MINUTES_PER_DAY as Et, DATABASE_SNAPSHOT_TIMEOUT_MS as F, schedulersCapability as Fa, parseJsonObject as Fc, nextOccurrence as Fi, calendarsCapability as Fn, buildFfmpegArgs as Fo, fanControlCapability as Fr, RevConflictError as Fs, PackageRequiresSchema as Ft, DEVICE_SAN_USER_PREFIX as G, siteFor as Ga, secretViewsOf as Gc, parseAcceleratorFactsJson as Gi, collectWhenMirrorSources as Gn, evaluateDerivative as Go, generateDeviceAlias as Gr, asString$1 as Gs, RecordingStatusSchema as Gt, DEVICE_ID_FIELD as H, sharedActuatorMethods as Ha, scopeKey as Hc, objectInputDeclaresRequiredDeviceId as Hi, checkTemplatePayload as Hn, compositionSourceKey as Ho, formatDeviceRevoker as Hr, actionEffect as Hs, RECORDING_SOURCE_CAMSTACK_ADDON as Ht, DATA_STORE_DATABASES as I, scopesAllowAddon as Ia, parseJsonUnknown as Ic, normalizeActionUnits as Ii, cameraGridLayoutCapability as In, cloneStatefulExpressionMemory as Io, fanOutTargets as Ir, SECRET_CLEAR as Is, PetFountainStatusSchema as It, DEVICE_TEMPLATE_MAX_OUTPUT as J, splitTranslationRef as Ja, toSecretFieldView as Jc, petFountainCapability as Ji, compileScalarOverride as Jn, historyRetentionFromSettings as Jo, heroLayoutCapability as Jr, auditedFields as Js, RunningStateStatusSchema as Jt, DEVICE_TEMPLATE_FILTERS as K, siteZoneKey as Ka, sleep as Kc, parseColorInput as Ki, colorCapability as Kn, evaluateStatistic as Ko, groupCommandsCapability as Kr, assertTransactScope as Ks, RemoteAssumedStateSchema as Kt, DAY_NAMES as L, scopesAllowDeviceCap as La, parseSecretRef as Lc, normalizeCapStep as Li, canonicalIconKey as Ln, composedDeviceRef as Lo, fanPresetsCapability as Lr, StoredRecordKindDeclarationSchema as Ls, PowerSourceInfoSchema as Lt, CredentialTokenClaimsSchema as M, runSteps as Ma, nodePin as Mc, modeForSwitch as Mi, buildDeviceSignatureMessage as Mn, HOUR_MS as Mo, expandContainer as Mr, RecordNotFoundError as Ms, PET_FOUNTAIN_WATER_KEY as Mt, DATABASE_SNAPSHOT_PARTIAL_SUFFIX as N, runtimeFieldUnit as Na, normalizeNodeId as Nc, modeMayWrite as Ni, buildHeroModel as Nn, HelperMemberSchema as No, expressionContainsBuiltinCall as Nr, RecordTooLargeError as Ns, PREFERENCES_MAX_VALUE_BYTES as Nt, ConditionMirror as O, resolveRunnerId as Oa, isSecretRefOwnedBy as Oc, memoizePinnedFfmpeg as Oi, brightnessCapability as On, DAY_MS as Oo, evaluateCompositionField as Or, ReadinessRegistry as Os, MediaPlayerStatusSchema as Ot, DATABASE_SNAPSHOT_SUFFIX as P, runtimeStatePolicyFor as Pa, normalizeSecretOwner as Pc, motionCapability as Pi, buildStreamParamsConfigSchema as Pn, MINUTE_MS as Po, extractNestedAddonId as Pr, RecordUniqueViolationError as Ps, PROPOSAL_MIN_SPAN_MS as Pt, DeviceRunSchema as Q, storageMigrationCapability as Qa, withoutCallerStamp as Qc, platformProbeCapability as Qi, consumablesCapability as Qn, nextLocalMidnight as Qo, isAlertEpisodeOpen as Qr, collectSecretMarkerRefs as Qs, SchedulerError as Qt, DEFAULT_HOLD_OVERRIDE as R, scoreRuntimes as Ra, readinessKey as Rc, normalizeCoreBlockWrite as Ri, capUnitResolver as Rn, composedDeviceStableId as Ro, featureForwards as Rr, TransactRefusedError as Rs, PreferenceDeviceIdSchema as Rt, COMPOSER_RUNNER_ID as S, resolveHubAddressRoles as Sa, isKeychainStoredField as Sc, logLevelAtMost as Si, appendTrace as Sn, weekdayOfLocalDate as So, deviceStateCapability as Sr, RECORD_DELETE_BATCH as Ss, KeychainResetRecordSchema as St, CREDENTIAL_TOKEN_AUDIENCE as T, resolveMutate as Ta, isSecretFieldView as Tc, mayWriteToLocation as Ti, backupCapability as Tn, zoneOnlySite as To, enumerateInferenceDevices as Tr, REDACTED_SECRET as Ts, MIGRATION_API_V1_METHODS as Tt, DEVICE_NONCE_TTL_MS as U, sharedColorModes as Ua, secretTreeFromPaths as Uc, occurrenceOn as Ui, climateControlCapability as Un, createStatefulExpressionMemory as Uo, formatMinutes as Ur, asJsonObject as Us, REMOTE_MEDIA_COMMANDS as Ut, DEVICE_HISTORY_ENERGY_KEY as V, sharedActuatorFeatures as Va, resolveSecretMarkers as Vc, objectInputDeclaresAddonId as Vi, checkRoleAddress as Vn, compositionSliceKey as Vo, foldSnapshotByFunction as Vr, WELL_KNOWN_TAB_MAP as Vs, QuantityUnitError as Vt, DEVICE_SAN_CREDENTIAL_PREFIX as W, shortHostname as Wa, secretTreeFromSchema as Wc, orderMigrations as Wi, collectDeviceTemplates as Wn, disarmRoseMemory as Wo, gbToBytes as Wr, asNumber as Ws, ROOT_BUCKET_KEY as Wt, DataStoreDatabaseSchema as X, storageAdminCapability as Xa, userError as Xc, pickAppLinkHub as Xi, compositionFieldKey as Xn, isForwardInputRef as Xo, internalActionId as Xr, collectSecretConfigKeys as Xs, STORAGE_LOCATION_MODES as Xt, DEVICE_TOMBSTONE_RETENTION_MS as Y, stableIdMapOf as Ya, transformSecretWrite as Yc, petFountainWaterItem as Yi, composerCapability as Yn, integrateReading as Yo, integrationInstancesCapability as Yr, buildSecretRef as Ys, STORAGE_ACCESS_FALLBACK as Yt, DeclaredDevices as Z, storageCapability as Za, vocabActionIdFor as Zc, planComposition as Zi, compositionSourceRefs as Zn, isHistoryHelper as Zo, interpolate as Zr, collectSecretLeaves as Zs, STREAM_PROFILE_META as Zt, CAMERA_SWITCH_ORDER as _, resolveAppConnections as _a, isCommand as _c, localNetworkCapability as _i, addonSettingsCapability as _n, validateSchedulerInput as _o, deviceExtensionCapability as _r, InvalidRecordError as _s, HvacModeSchema as _t, AGENT_MDNS_SERVICE_TYPE as a, projectDeviceRow as aa, defineCustomActions as ac, isInternalActionId as ai, StorageLocationTypeSchema as an, switchStateOfMode as ao, createDeviceExtensionProvider as ar, wattMillisecondsToKwh as as, FAN_CAPTURE_FIELDS as at, CATALOG_LANGS as b, resolveCoreBlockFiles as ba, isEvent as bc, lockDoorLinkOfComposition as bi, alertEpisodePayload as bn, vectorIndexDimConflictError as bo, deviceRemovalHookCapability as br, RECORD_BATCH_MAX as bs, KEYCHAIN_RESET_TRIGGER_ACTOR as bt, ActionError as c, readStoredRemoteConfig as ca, emitDownForOwnedCaps as cc, isSameAddonId as ci, TemplateKindSchema as cn, timedRunLimitOf as co, databaseSnapshotCapability as cr, CALLER_STAMPED_CAPABILITIES as cs, FanDirectionSchema as ct, ActionVariableSchema as d, reducePoints as da, expandCapMethods as dc, keychainAdminCapability as di, UserRecordSchema as dn, timedRunSeconds as do, decodeVectorBase64 as dr, DEVICE_STATUS_METHOD as ds, FieldClaimSchema as dt, powerSourceLinkOfComposition as ea, commandEffect as ec, isAppLinkBase as ei, DeviceRole as el, ScopedTokenSchema as en, storageProviderCapability as eo, coreBlockComposition as er, openStatistic as es, DeviceTombstoneSchema as et, AlertSchema as f, remoteCapability as fa, formatSecretScope as fc, keychainCapability as fi, actionSourceCapability as fn, toTimings as fo, defineExtensionSlotProvider as fr, DeclarationRefusedError as fs, GroupCommandResultSchema as ft, BatteryStatusSchema as g, resolveActionVariables as ga, hydrateSchema as gc, localDateOf as gi, addonPagesCapability as gn, validateCustomAddress as go, deviceCredentialsCapability as gr, HISTORY_DEFAULT_MIN_INTERVAL_MS as gs, HUB_MDNS_TXT_KEYS as gt, BaseDevice as h, replacedFieldKeys as ha, historyUnitFor as hc, lifecycleJobSchema as hi, addonIdOfActionId as hn, validateComposition as ho, describeUnmet as hr, ForeignSecretMarkerError as hs, HUB_MDNS_SERVICE_TYPE as ht, ACTUATOR_TEMPLATE_IDS as i, processTimeZoneOr as ia, defineAddonMigrations as ic, isDefaultAppConnectionEndpoint as ii, EventCategory as il, StorageLocationModeSchema as in, switchCapability as io, coverCapability as ir, toExpressionValue as is, EMPTY_REMOTE_CONFIG as it, CoreBlockSchema as j, runFanOut as ja, nodeIdOfScopedKey as jc, migrationsCapability as ji, buildDeviceEnrollmentLink as jn, HISTORY_SLOW_MS as jo, evictionPolicyOfLocation as jr, RecordKindDeclarationSchema as js, NetworkTunnelStartedDataSchema as jt, ConsumableItemSchema as k, resolveStepArgs as ka, makeSecretMarker as kc, methodRefusal as ki, buildActionSteps as kn, DEFAULT_HISTORY_RETENTION as ko, evaluateStepCondition as kr, ReadinessTimeoutError as ks, MigrationLedgerEntrySchema as kt, ActionStepSchema as l, recordEntriesCapability as la, emitReadiness as lc, isVoidInput as li, TokenScopeSchema as ln, timedRunMaxIn as lo, declarationOwnerNodeId as lr, DATAPLANE_SECRET_HEADER as ls, FanPresetSchema as lt, BUILTIN_REMOTE_COMPONENTS as m, remoteSourceSteps as ma, historyItemFieldPath as mc, legacyModeOf as mi, actionsCapability as mn, userManagementCapability as mo, describeComposableCaps as mr, FilterRequiredError as ms, HISTORY_ITEM_CATALOG as mt, ACTION_TARGET_INVALIDATION_EVENTS as n, problemsBlockSave as na, createEvent as nc, isCollectionArrayMethod as ni, errMsg as nl, SsoBridgeClaimsSchema as nn, streamQualityLabel as no, coreBlockSourceKind as nr, planStatisticTier as ns, EMPTY_AUTOMATION_STATE as nt, AGENT_MDNS_TXT_KEYS as o, proposeRunningThreshold as oa, defineEntryKind as oc, isLocationEnabled as oi, StorageMigrationJobSchema as on, templateCapability as oo, customKeyOfRole as or, BaseAddon as os, FIRST_LEVEL_MACRO_CLASSES as ot, AutomationStateDocSchema as p, remoteLayoutComponentsCapability as pa, getDebugInterest as pc, legacyAutoLinkIds as pi, actionWaitTotalMs as pn, unmetRequirements as po, deriveBatteryPresence as pr, DeviceTransitionSchema as ps, HISTORY_CATALOG as pt, DEVICE_TEMPLATE_MAX_LENGTH as q, snapshotCapability as qa, toNodeId as qc, parseStreamParamsFormPatch as qi, compareVersions as qn, helperMembers as qo, groupTemplate as qr, assertValidDeclaration as qs, RemoteLayoutPayloadSchema as qt, ACTUATOR_METHODS as r, procedureAuthKey as ra, customAction as rc, isCredentialTokenPayload as ri, featuresOfBoundCaps as rl, StorageCleanupJobSchema as rn, supportedRuntimes as ro, coreBlocksCapability as rr, statisticCadenceMs as rs, EMPTY_REMOTE_ASSUMED_STATE as rt, ALL_CAPABILITY_DEFINITIONS as s, ptzAutotrackCapability as sa, defineRecordKinds as sc, isObjectInput as si, SwitchStatusSchema as sn, timedRunCapability as so, dataStoreProviderCapability as sr, BatchTooLargeError as ss, FanControlStatusSchema as st, ACTION_RUN_MAX_MS as t, preconditionOf as ta, commandOrigin as tc, isArrayOutputSchema as ti, DeviceType as tl, ServerNameSchema as tn, streamCatalogCapability as to, coreBlockIdFromAddonId as tr, planResetTier as ts, DiscoveryProposalBodySchema as tt, ActionTargetResolver as u, recordsCapability as ua, entryBody as uc, kebabToCamel as ui, UNATTRIBUTED_BUCKET_KEY as un, timedRunQuickRun as uo, declaredSeriesKind as ur, DEVICE_SETTINGS_CONTRIBUTION_METHODS as us, FieldClaimModeSchema as ut, CAMSTACK_APP_LINK_ORIGIN as v, resolveBucketMs as va, isDebugChannelName as vc, locationIconKey as vi, addonWidgetsCapability as vn, valveCapability as vo, deviceHistoryCapability as vr, NoCallerError as vs, IDLE_ACTION_STATUS as vt, CORE_BLOCK_ADDON_PREFIX as w, resolveMethodAuth as wa, isSecretClear as wc, mayReadLocation as wi, authProviderCapability as wn, withLocationMode as wo, deviceTransitionsCapability as wr, RECORD_SWEEP_INTERVAL_MS as ws, METHOD_ACCESS_MAP as wt, COMPOSED_ITEM_FIXED_FIELDS as x, resolveHeroLayout as xa, isInstanceEnabled as xc, logDestinationCapability as xi, alertsCapability as xn, vectorStoreCapability as xo, deviceRunsCapability as xr, RECORD_BATCH_MAX_BYTES as xs, KeychainAuditEntrySchema as xt, CAP_NAMES_WITH_STATUS as y, resolveCoreBlockEntry as ya, isDeviceConfigCap as yc, lockControlCapability as yi, alertEpisodeId as yn, vectorDimFromBase64 as yo, deviceManagerCapability as yr, PlaintextSecretError as ys, INTERNAL_ACTION_PREFIX as yt, DERIVED_CAMERA_SILENCED_CAP_NAMES as z, seedInstanceOnce as za, recordSecretRef as zc, normalizeStepTargets as zi, catalogueIssues as zn, compositionFeatureEnabled as zo, filesystemBrowseCapability as zr, UnindexedFilterError as zs, PreferenceNamespaceSchema as zt };