@camstack/server 1.2.746 → 1.2.747

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 (92) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/api/trpc/generated-cap-routers.js +63 -0
  3. package/package.json +22 -10
  4. package/system/dist/{agent-https-p__QCKx2.mjs → agent-https-BfUY5VmU.mjs} +1 -1
  5. package/system/dist/{agent-https-CeiGBOLL.js → agent-https-CAt94pY2.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 +75 -11
  21. package/system/dist/builtins/composer/composer.addon.mjs +75 -11
  22. package/system/dist/builtins/composer/composer.d.ts +13 -1
  23. package/system/dist/builtins/composer/forward-commands.d.ts +11 -0
  24. package/system/dist/builtins/console-logging/index.js +1 -1
  25. package/system/dist/builtins/console-logging/index.mjs +1 -1
  26. package/system/dist/builtins/core-blocks/core-blocks.addon.js +161 -85
  27. package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +161 -85
  28. package/system/dist/builtins/core-blocks/remote-call-redirect.d.ts +9 -3
  29. package/system/dist/builtins/core-blocks/remote-service.d.ts +32 -6
  30. package/system/dist/builtins/core-blocks/remote-wiring.d.ts +8 -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.js +1 -1
  34. package/system/dist/builtins/device-manager/device-manager.addon.mjs +1 -1
  35. package/system/dist/builtins/hub-forwarder/index.js +1 -1
  36. package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
  37. package/system/dist/builtins/keychain/index.js +3 -3
  38. package/system/dist/builtins/keychain/index.mjs +3 -3
  39. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  40. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  41. package/system/dist/builtins/local-auth/local-auth.addon.js +2 -2
  42. package/system/dist/builtins/local-auth/local-auth.addon.mjs +2 -2
  43. package/system/dist/builtins/local-network/local-network.addon.d.ts +8 -0
  44. package/system/dist/builtins/local-network/local-network.addon.js +99 -2
  45. package/system/dist/builtins/local-network/local-network.addon.mjs +99 -2
  46. package/system/dist/builtins/local-network/migrations/hub-node-fields.d.ts +30 -0
  47. package/system/dist/builtins/local-network/migrations/index.d.ts +8 -0
  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 +2 -2
  65. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +2 -2
  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 +3 -3
  69. package/system/dist/builtins/system-config/system-config.addon.mjs +284 -284
  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/{composition-sources-C9lrcs0U.js → composition-sources-BY81UoJk.js} +1 -1
  73. package/system/dist/{composition-sources-MLdAmm_H.mjs → composition-sources-DsufFrcN.mjs} +1 -1
  74. package/system/dist/{constants-DCW5J_Df.mjs → constants-BoiK7ZwD.mjs} +1 -1
  75. package/system/dist/{constants-DNhyMkdx.js → constants-C7y03EtR.js} +1 -1
  76. package/system/dist/{device-ca-AYCsUsY8.js → device-ca-DN_6Q65t.js} +1 -1
  77. package/system/dist/{device-ca-Cp0tBm4M.mjs → device-ca-FC5a_gAu.mjs} +1 -1
  78. package/system/dist/{dist-B1ZljzFe.js → dist-5gi6RCY-.js} +465 -220
  79. package/system/dist/{dist-CMxM4-FW.mjs → dist-KFDdjTXv.mjs} +448 -221
  80. package/system/dist/file-host-worker.js +1 -1
  81. package/system/dist/file-host-worker.mjs +1 -1
  82. package/system/dist/{hub-mdns-ciao-Xf67S6hV.js → hub-mdns-ciao-B2_CA_s6.js} +2 -2
  83. package/system/dist/{hub-mdns-ciao-CbnDQ6lH.mjs → hub-mdns-ciao-dArIz3_4.mjs} +2 -2
  84. package/system/dist/index.js +7 -7
  85. package/system/dist/index.mjs +7 -7
  86. package/system/dist/{restore-archive-CMJvv4hx.mjs → restore-archive-BpSFO8p5.mjs} +82 -82
  87. package/system/dist/{restore-archive-DLTNZsfo.js → restore-archive-CPvKHlE8.js} +1 -1
  88. package/system/dist/{retention-DggVaaFh.mjs → retention-C2ZNWzrF.mjs} +1 -1
  89. package/system/dist/{retention-tfu-EBh4.js → retention-v4AG_OmX.js} +1 -1
  90. package/system/dist/{wal-maintenance-B5qz1TlP.js → wal-maintenance-D60-hpsh.js} +0 -0
  91. package/system/dist/{wal-maintenance-Ch9XhjjA.mjs → wal-maintenance-VpFJg7Z1.mjs} +0 -0
  92. package/system/package.json +1 -1
@@ -1,6 +1,6 @@
1
- import { $ as EMPTY_REMOTE_CONFIG, Ai as problemsBlockSave, Bn as coreBlocksCapability, C as CORE_BLOCK_ADDON_PREFIX, Ca as timedRunCapability, Ct as MediaPlayerStatusSchema, D as ConditionMirror, Da as validateComposition, Di as powerSourceCapability, En as capUnitResolver, Es as isSecretMarker, Fa as weekdayOfLocalDate, Fn as compositionSourceRefs, Hi as resolveCoreBlockEntry, Hr as kebabToCamel, Ht as SchedulerSchema, I as DEFAULT_HOLD_OVERRIDE, Ii as remoteCapability, In as coreBlockAddonId, It as RemoteAssumedStateSchema, Jr as localDateOf, K as DeclaredDevices, La as zoneOnlySite, Li as remoteLayoutComponentsCapability, Ln as coreBlockComposition, Lr as isInternalActionId, Lt as RemoteConfigSchema, O as ControlStatusSchema, Oi as powerSourceLinkOfComposition, Or as internalActionId, Os as isSecretRefOwnedBy, Pa as vocabActionIdFor, Q as EMPTY_REMOTE_ASSUMED_STATE, Qa as compositionSourceKey, Qi as runSteps, Qn as describeComposableCaps, Qr as lockDoorLinkOfComposition, Ri as replacedFieldKeys, Rn as coreBlockIdFromAddonId, Rt as RunningStateStatusSchema, S as CORE_BLOCKS_ADDON_ID, Sa as templateCapability, Ta as timedRunSeconds, Ti as planComposition, Ui as resolveCoreBlockFiles, Un as customKeyOfRole, Vs as resolveSecretMarkers, Vt as SchedulerError, Wn as customRole, Ws as secretTreeFromSchema, Xi as resolveStepArgs, Xt as SwitchStatusSchema, Ys as transformSecretWrite, Z as EMPTY_AUTOMATION_STATE, Zt as TemplateKindSchema, c as ActionStepSchema, di as nextOccurrence, dn as appendTrace, dr as evaluateWhenTree, ea as schedulersCapability, ec as DeviceType$1, et as FAN_CAPTURE_FIELDS, f as AutomationStateDocSchema, fi as normalizeActionUnits, hi as normalizeStepTargets, ho as BaseAddon, in as addonIdOfActionId, it as FanPresetSchema, jn as collectWhenMirrorSources, jt as QuantityUnitError, k as CoreBlockSchema, ka as validateSchedulerInput, kn as checkTemplatePayload, l as ActionTargetResolver, la as siteFor, mi as normalizeCoreBlockWrite, mt as INTERNAL_ACTION_PREFIX, nc as EventCategory$1, nn as actionSourceCapability, nt as FanControlStatusSchema, o as ALL_CAPABILITY_DEFINITIONS, p as BUILTIN_REMOTE_COMPONENTS, pi as normalizeCapStep, pt as IDLE_ACTION_STATUS, qa as composedDeviceRef, rn as actionsCapability, ro as helperMembers, rs as collectSecretMarkerRefs, s as ActionError, ss as defineAddonMigrations, t as ACTION_TARGET_INVALIDATION_EVENTS, tc as errMsg$1, tn as actionEffect, u as ActionVariableSchema, us as defineRecordKinds, vn as buildActionSteps, vr as fanPresetsCapability, vs as hydrateSchema, wa as timedRunLimitOf, x as COMPOSER_RUNNER_ID, yi as occurrenceOn, yn as buildCapabilityLookup, zi as resolveActionVariables, zn as coreBlockSourceKind } from "../../dist-CMxM4-FW.mjs";
1
+ import { $ as EMPTY_REMOTE_CONFIG, $i as resolveStepArgs, $t as TemplateKindSchema, Aa as validateComposition, Ai as powerSourceCapability, Ar as internalActionId, Ba as zoneOnlySite, Bi as remoteLayoutComponentsCapability, Bn as coreBlockIdFromAddonId, Bt as RunningStateStatusSchema, C as CORE_BLOCK_ADDON_PREFIX, Ct as MediaPlayerStatusSchema, D as ConditionMirror, Da as timedRunLimitOf, Ea as timedRunCapability, Gi as resolveCoreBlockEntry, Gn as customKeyOfRole, Hi as resolveActionVariables, Hn as coreBlocksCapability, I as DEFAULT_HOLD_OVERRIDE, K as DeclaredDevices, Ki as resolveCoreBlockFiles, Kn as customRole, La as vocabActionIdFor, Ln as compositionSourceRefs, Ma as validateSchedulerInput, Mt as QuantityUnitError, Ni as problemsBlockSave, Nn as collectWhenMirrorSources, O as ControlStatusSchema, Oa as timedRunSeconds, Oi as planComposition, On as capUnitResolver, Ot as PowerSourceInfoSchema, Pt as REMOTE_MEDIA_COMMANDS, Q as EMPTY_REMOTE_ASSUMED_STATE, Qs as transformSecretWrite, Qt as SwitchStatusSchema, Ra as weekdayOfLocalDate, Rn as coreBlockAddonId, Rt as RemoteAssumedStateSchema, S as CORE_BLOCKS_ADDON_ID, Si as occurrenceOn, Ta as templateCapability, Ut as SchedulerError, Vi as replacedFieldKeys, Vn as coreBlockSourceKind, Wr as kebabToCamel, Ws as resolveSecretMarkers, Wt as SchedulerSchema, Xa as composedDeviceRef, Xr as localDateOf, Z as EMPTY_AUTOMATION_STATE, _i as normalizeCoreBlockWrite, ac as EventCategory$1, an as actionsCapability, bn as buildActionSteps, br as fanPresetsCapability, c as ActionStepSchema, ei as lockDoorLinkOfComposition, er as describeComposableCaps, et as FAN_CAPTURE_FIELDS, f as AutomationStateDocSchema, fa as siteFor, gi as normalizeCapStep, hi as normalizeActionUnits, ic as errMsg$1, in as actionSourceCapability, it as FanPresetSchema, ji as powerSourceLinkOfComposition, jn as checkTemplatePayload, js as isSecretRefOwnedBy, k as CoreBlockSchema, ks as isSecretMarker, l as ActionTargetResolver, mi as nextOccurrence, mt as INTERNAL_ACTION_PREFIX, nt as FanControlStatusSchema, o as ALL_CAPABILITY_DEFINITIONS, on as addonIdOfActionId, oo as helperMembers, os as collectSecretMarkerRefs, p as BUILTIN_REMOTE_COMPONENTS, pn as appendTrace, pr as evaluateWhenTree, ps as defineRecordKinds, pt as IDLE_ACTION_STATUS, qs as secretTreeFromSchema, ra as schedulersCapability, rc as DeviceType$1, rn as actionEffect, s as ActionError, t as ACTION_TARGET_INVALIDATION_EVENTS, ta as runSteps, to as compositionSourceKey, u as ActionVariableSchema, us as defineAddonMigrations, vi as normalizeStepTargets, vo as BaseAddon, x as COMPOSER_RUNNER_ID, xn as buildCapabilityLookup, xs as hydrateSchema, zi as remoteCapability, zn as coreBlockComposition, zr as isInternalActionId, zt as RemoteConfigSchema } from "../../dist-KFDdjTXv.mjs";
2
2
  import { t as require_read_all_rows } from "../../read-all-rows-TaPqdWNF.mjs";
3
- import { i as parseDeviceStateChanged, t as describeCompositionSources } from "../../composition-sources-MLdAmm_H.mjs";
3
+ import { i as parseDeviceStateChanged, t as describeCompositionSources } from "../../composition-sources-DsufFrcN.mjs";
4
4
  import { t as prefixRange } from "../../prefix-range-Dl0znowN.mjs";
5
5
  import { n as unwrapStoredValue, t as loadPrefixed } from "../../prefix-walk-DAOBSyH1.mjs";
6
6
  import { createRequire } from "node:module";
@@ -4995,27 +4995,23 @@ async function seedLockDoors(deps) {
4995
4995
  * A binding that FAILS fails the call: the native cap never silently runs in
4996
4996
  * its place. `repeat`, where the caller supplies one, is passed through.
4997
4997
  * - `getStatus` is answered from the remote's own bookkeeping — marked
4998
- * `assumed` — only when NO running source exists for the device. A device
4999
- * with a native media-player cap is reported by it, as before.
4998
+ * `assumed` — only when NO reading source exists for the device. A device
4999
+ * with a driver's native media-player cap is reported by it, as before; a
5000
+ * composed IR television (D967 `extension`) has none, so the remote answers.
5001
+ * - A step command (`volumeUp`, `channelDown`, …) takes `steps` as its repeat:
5002
+ * N full sends (D964).
5000
5003
  */
5001
5004
  var MEDIA_PLAYER = "media-player";
5002
- var COMMANDS = new Set([
5003
- "play",
5004
- "pause",
5005
- "stop",
5006
- "next",
5007
- "previous",
5008
- "setMute",
5009
- "selectSource"
5010
- ]);
5005
+ var COMMANDS = new Set(REMOTE_MEDIA_COMMANDS);
5011
5006
  function isCommand(method) {
5012
5007
  return COMMANDS.has(method);
5013
5008
  }
5014
5009
  function field(args, key) {
5015
5010
  return args !== null && typeof args === "object" ? Reflect.get(args, key) : void 0;
5016
5011
  }
5012
+ /** The caller's count: `steps` (a step method) or `repeat` (D964), at most `REMOTE_MAX_REPEAT`. */
5017
5013
  function repeatOf(args) {
5018
- const raw = field(args, "repeat");
5014
+ const raw = field(args, "steps") ?? field(args, "repeat");
5019
5015
  if (typeof raw !== "number" || !Number.isInteger(raw) || raw < 1) return 1;
5020
5016
  return Math.min(raw, 50);
5021
5017
  }
@@ -5065,30 +5061,9 @@ function remoteCallRedirect(deps) {
5065
5061
  }
5066
5062
  };
5067
5063
  }
5068
- //#endregion
5069
- //#region src/builtins/core-blocks/remote-service.ts
5070
- /**
5071
- * The `remote` cap (D963, D964): a button panel over a media-player device. It
5072
- * keeps the per-device configuration (layout template, role bindings, custom
5073
- * buttons, power mode) in the device's settings store and runs a bound ROLE by
5074
- * calling the action it is bound to — the shape an Action step has, so an
5075
- * infrared code and a smart-TV call are the same thing here.
5076
- *
5077
- * Decisions that shape this file:
5078
- * - **What a button does is the action's business.** This service never
5079
- * knows what an infrared code is; it invokes a cap method on a device.
5080
- * - **`repeat` is the caller's** (volume ×5), never stored. A failing send
5081
- * stops the row and reports the cause; it is never swallowed.
5082
- * - **State is read from the running-state cap if the device has one, else
5083
- * from a native media-player reading, else assumed.** An assumption moves
5084
- * only AFTER a send succeeded, is persisted per device and never recorded
5085
- * in history. A toggle power code is sent only when the current state
5086
- * differs from the requested one; a discrete pair is always sent. A mute on
5087
- * a device that does not report it is sent and marked assumed.
5088
- * - **Precedence** (`sendMediaCommand`): a media-player command takes the
5089
- * remote when its role is bound, else answers `not-routed` so the native
5090
- * cap runs. The dispatch redirect asks this for every caller.
5091
- */
5064
+ var realSleep = (ms) => new Promise((resolve) => {
5065
+ setTimeout(resolve, ms);
5066
+ });
5092
5067
  var POWER_OFF_STATES = new Set(["off", "standby"]);
5093
5068
  /** Roles a media-player command tries, in order. The first BOUND one wins. */
5094
5069
  function rolesFor(command) {
@@ -5099,6 +5074,12 @@ function rolesFor(command) {
5099
5074
  case "next": return ["next"];
5100
5075
  case "previous": return ["previous"];
5101
5076
  case "setMute": return ["mute"];
5077
+ case "turnOn": return ["power_on"];
5078
+ case "turnOff": return ["power_off"];
5079
+ case "volumeUp": return ["volume_up"];
5080
+ case "volumeDown": return ["volume_down"];
5081
+ case "channelUp": return ["channel_up"];
5082
+ case "channelDown": return ["channel_down"];
5102
5083
  case "selectSource": return [];
5103
5084
  }
5104
5085
  }
@@ -5108,9 +5089,11 @@ function errorText(err) {
5108
5089
  var RemoteService = class {
5109
5090
  deps;
5110
5091
  now;
5092
+ sleep;
5111
5093
  constructor(deps) {
5112
5094
  this.deps = deps;
5113
5095
  this.now = deps.now ?? Date.now;
5096
+ this.sleep = deps.sleep ?? realSleep;
5114
5097
  }
5115
5098
  getConfig = async ({ deviceId }) => this.deps.store.read(deviceId);
5116
5099
  setConfig = async ({ deviceId, config }) => {
@@ -5157,42 +5140,64 @@ var RemoteService = class {
5157
5140
  return this.run(deviceId, config, role, repeat);
5158
5141
  };
5159
5142
  /**
5160
- * The device's state as the remote knows it, or null when it knows no power
5161
- * state (nothing reads one and nothing was sent). The media-player
5162
- * `getStatus` hook asks the native source FIRST and serves this only when
5163
- * none answers. Power comes from the running-state cap when there is one,
5164
- * else from the assumption; mute comes from the assumption.
5143
+ * What the remote ASSUMES (the last power and mute it sent), or null when it
5144
+ * knows neither. No plug, no running-state: that is `assumedStatus`.
5165
5145
  */
5166
- async assumedStatus(deviceId) {
5167
- const kept = await this.deps.assumptions.read(deviceId) ?? EMPTY_REMOTE_ASSUMED_STATE;
5168
- const running = await this.deps.runningState(deviceId);
5146
+ getAssumedStatus = async ({ deviceId }) => {
5147
+ const kept = await this.readAssumed(deviceId);
5148
+ if (kept.power === null && kept.muted === null) return null;
5149
+ const config = await this.deps.store.read(deviceId);
5169
5150
  const assumedFields = [];
5170
- let state;
5171
- let changedAt;
5172
- if (running !== null) {
5173
- state = running ? "on" : "off";
5174
- changedAt = this.now();
5175
- } else if (kept.power !== null) {
5176
- state = kept.power.state;
5177
- changedAt = kept.power.at;
5178
- assumedFields.push("state");
5179
- } else return null;
5151
+ if (kept.power !== null) assumedFields.push("state");
5180
5152
  if (kept.muted !== null) assumedFields.push("isMuted");
5153
+ return this.statusOf({
5154
+ state: kept.power?.state ?? "standby",
5155
+ assumedFields,
5156
+ muted: kept.muted?.value ?? null,
5157
+ changedAt: Math.max(kept.power?.at ?? 0, kept.muted?.at ?? 0),
5158
+ sources: config.customButtons.map((b) => b.name)
5159
+ });
5160
+ };
5161
+ /**
5162
+ * The device's state as the remote knows it, or null when it knows no power
5163
+ * state. Power truth, in order: a `running-state` reading; the linked plug
5164
+ * (off is `off`, a reading; on is `standby` until a power command was sent,
5165
+ * then what the remote sent); the remote's own assumption. Mute comes from
5166
+ * the assumption, and only while the device may be on.
5167
+ */
5168
+ async assumedStatus(deviceId) {
5169
+ const kept = await this.readAssumed(deviceId);
5170
+ const truth = await this.powerTruth(deviceId);
5171
+ if (truth === null) return null;
5172
+ const assumedFields = truth.assumed ? ["state"] : [];
5173
+ const state = truth.state;
5174
+ const changedAt = truth.at;
5175
+ const mute = state === "off" ? null : kept.muted ?? null;
5176
+ if (mute !== null) assumedFields.push("isMuted");
5181
5177
  const config = await this.deps.store.read(deviceId);
5182
- return {
5178
+ return this.statusOf({
5183
5179
  state,
5184
- stateSource: assumedFields.length > 0 ? "assumed" : "reported",
5185
5180
  assumedFields,
5181
+ muted: mute?.value ?? null,
5182
+ changedAt: Math.max(changedAt, mute?.at ?? 0),
5183
+ sources: config.customButtons.map((b) => b.name)
5184
+ });
5185
+ }
5186
+ statusOf(input) {
5187
+ return {
5188
+ state: input.state,
5189
+ stateSource: input.assumedFields.length > 0 ? "assumed" : "reported",
5190
+ assumedFields: [...input.assumedFields],
5186
5191
  volumeLevel: null,
5187
- isMuted: kept.muted?.value ?? null,
5192
+ isMuted: input.muted,
5188
5193
  source: "",
5189
- availableSources: config.customButtons.map((b) => b.name),
5194
+ availableSources: [...input.sources],
5190
5195
  currentMedia: null,
5191
5196
  position: null,
5192
5197
  duration: null,
5193
5198
  shuffle: null,
5194
5199
  repeat: null,
5195
- lastChangedAt: Math.max(changedAt, kept.muted?.at ?? 0)
5200
+ lastChangedAt: input.changedAt
5196
5201
  };
5197
5202
  }
5198
5203
  mediaRole(config, input) {
@@ -5216,7 +5221,49 @@ var RemoteService = class {
5216
5221
  if (running !== null) return running ? "on" : "off";
5217
5222
  const reported = await this.deps.reportedStatus(deviceId);
5218
5223
  if (reported !== null) return POWER_OFF_STATES.has(reported.state) ? "off" : "on";
5219
- return (await this.readAssumed(deviceId)).power?.state ?? null;
5224
+ const truth = await this.powerTruth(deviceId);
5225
+ if (truth === null || truth.state === "standby") return null;
5226
+ return truth.state === "off" ? "off" : "on";
5227
+ }
5228
+ /**
5229
+ * THE ordered power truth, read by the status and by the toggle guard alike:
5230
+ * a `running-state` reading; the linked plug (off is `off`, a reading, and
5231
+ * it forgets what the remote assumed, so the next plug-on starts from
5232
+ * standby; on contradicts an assumed `off`, which is dropped); then the
5233
+ * remote's own assumption; a plug on with nothing sent is `standby`.
5234
+ */
5235
+ async powerTruth(deviceId) {
5236
+ const running = await this.deps.runningState(deviceId);
5237
+ if (running !== null) return {
5238
+ state: running ? "on" : "off",
5239
+ assumed: false,
5240
+ at: this.now()
5241
+ };
5242
+ const plug = await this.deps.plugOn(deviceId);
5243
+ const kept = await this.readAssumed(deviceId);
5244
+ if (plug === false) {
5245
+ if (kept.power !== null) await this.deps.assumptions.write(deviceId, {
5246
+ ...kept,
5247
+ power: null
5248
+ });
5249
+ return {
5250
+ state: "off",
5251
+ assumed: false,
5252
+ at: this.now()
5253
+ };
5254
+ }
5255
+ const keptPower = plug === true && kept.power?.state === "off" ? null : kept.power;
5256
+ if (keptPower !== null) return {
5257
+ state: keptPower.state,
5258
+ assumed: true,
5259
+ at: keptPower.at
5260
+ };
5261
+ if (plug === true) return {
5262
+ state: "standby",
5263
+ assumed: true,
5264
+ at: this.now()
5265
+ };
5266
+ return null;
5220
5267
  }
5221
5268
  /** The mute as a native source reads it, else as last assumed, else unknown. */
5222
5269
  async currentMute(deviceId) {
@@ -5279,27 +5326,30 @@ var RemoteService = class {
5279
5326
  };
5280
5327
  }
5281
5328
  const times = wantsState === null && role !== "power" ? repeat : 1;
5282
- for (let sent = 0; sent < times; sent += 1) try {
5283
- await this.deps.invoke({
5284
- deviceId: bound.action.deviceId,
5285
- cap: bound.action.cap,
5286
- method: bound.action.method,
5287
- args: bound.action.args ?? {}
5288
- });
5289
- } catch (err) {
5290
- this.deps.logger.warn("remote: the bound action failed, nothing further was sent", {
5291
- tags: { deviceId },
5292
- meta: {
5293
- role,
5294
- sent,
5295
- error: errorText(err)
5296
- }
5297
- });
5298
- return {
5299
- status: "refused",
5300
- reason: "action-failed",
5301
- detail: errorText(err)
5302
- };
5329
+ for (let sent = 0; sent < times; sent += 1) {
5330
+ if (sent > 0) await this.sleep(150);
5331
+ try {
5332
+ await this.deps.invoke({
5333
+ deviceId: bound.action.deviceId,
5334
+ cap: bound.action.cap,
5335
+ method: bound.action.method,
5336
+ args: bound.action.args ?? {}
5337
+ });
5338
+ } catch (err) {
5339
+ this.deps.logger.warn("remote: the bound action failed, nothing further was sent", {
5340
+ tags: { deviceId },
5341
+ meta: {
5342
+ role,
5343
+ sent,
5344
+ error: errorText(err)
5345
+ }
5346
+ });
5347
+ return {
5348
+ status: "refused",
5349
+ reason: "action-failed",
5350
+ detail: errorText(err)
5351
+ };
5352
+ }
5303
5353
  }
5304
5354
  await this.moveAssumption(deviceId, role, wantsState);
5305
5355
  return {
@@ -5558,6 +5608,26 @@ function runningStateOver(api, logger) {
5558
5608
  }
5559
5609
  };
5560
5610
  }
5611
+ /**
5612
+ * The linked plug of a device (`power-source`): its switch state, null when no
5613
+ * plug is linked, it errors, or the state is unknown (D393) — never "off".
5614
+ */
5615
+ function plugOnOver(api, logger) {
5616
+ return async (deviceId) => {
5617
+ const current = api();
5618
+ if (current === void 0) return null;
5619
+ try {
5620
+ const parsed = PowerSourceInfoSchema.safeParse(await current.powerSource.getStatus.query({ deviceId }));
5621
+ return parsed.success && parsed.data.linked ? parsed.data.switchOn : null;
5622
+ } catch (err) {
5623
+ logger.debug("remote: no power-source reading for the device", {
5624
+ tags: { deviceId },
5625
+ meta: { error: err instanceof Error ? err.message : String(err) }
5626
+ });
5627
+ return null;
5628
+ }
5629
+ };
5630
+ }
5561
5631
  /** The devices whose remote configuration points at a template. */
5562
5632
  function templateUsageOver(settings, api) {
5563
5633
  return { devicesUsing: async (templateId) => {
@@ -5615,8 +5685,11 @@ function buildRemoteRuntime(deps) {
5615
5685
  },
5616
5686
  reportedStatus: reportedStatusOver(deps.api, deps.logger.child("remote")),
5617
5687
  runningState: runningStateOver(deps.api, deps.logger.child("remote")),
5688
+ plugOn: plugOnOver(deps.api, deps.logger.child("remote")),
5618
5689
  assumptions: remoteAssumptionStoreOver(deps.settings, deps.logger.child("remote")),
5619
- logger: deps.logger.child("remote")
5690
+ logger: deps.logger.child("remote"),
5691
+ ...deps.sleep === void 0 ? {} : { sleep: deps.sleep },
5692
+ ...deps.now === void 0 ? {} : { now: deps.now }
5620
5693
  })
5621
5694
  };
5622
5695
  }
@@ -7018,7 +7091,10 @@ var CoreBlocksAddon = class extends BaseAddon {
7018
7091
  const runtime = this.remoteRuntime;
7019
7092
  registry.setDeviceCallRedirect(composeRedirects([...runtime === null ? [] : [remoteCallRedirect({
7020
7093
  remote: runtime.remote,
7021
- hasNative: (deviceId) => registry.getProviderForDevice("media-player", deviceId) !== null,
7094
+ hasNative: (deviceId) => {
7095
+ const owner = registry.getNativeAddonId("media-player", deviceId);
7096
+ return owner !== null && owner !== "composer";
7097
+ },
7022
7098
  logger: this.ctx.logger.child("remote")
7023
7099
  })], gate.redirect()]));
7024
7100
  }
@@ -9,14 +9,20 @@
9
9
  * A binding that FAILS fails the call: the native cap never silently runs in
10
10
  * its place. `repeat`, where the caller supplies one, is passed through.
11
11
  * - `getStatus` is answered from the remote's own bookkeeping — marked
12
- * `assumed` — only when NO running source exists for the device. A device
13
- * with a native media-player cap is reported by it, as before.
12
+ * `assumed` — only when NO reading source exists for the device. A device
13
+ * with a driver's native media-player cap is reported by it, as before; a
14
+ * composed IR television (D967 `extension`) has none, so the remote answers.
15
+ * - A step command (`volumeUp`, `channelDown`, …) takes `steps` as its repeat:
16
+ * N full sends (D964).
14
17
  */
15
18
  import { type DeviceCallRedirect, type IScopedLogger } from "@camstack/types";
16
19
  import type { RemoteService } from "./remote-service.js";
17
20
  export interface RemoteCallRedirectDeps {
18
21
  readonly remote: Pick<RemoteService, "sendMediaCommand" | "assumedStatus">;
19
- /** Whether a running source (the native media-player cap) exists for the device. */
22
+ /**
23
+ * Whether a source that READS the device answers `getStatus` (a driver's native
24
+ * media-player cap). The composer's own native, which holds no reading, is not one.
25
+ */
20
26
  readonly hasNative: (deviceId: number) => boolean;
21
27
  readonly logger: IScopedLogger;
22
28
  }
@@ -8,8 +8,13 @@
8
8
  * Decisions that shape this file:
9
9
  * - **What a button does is the action's business.** This service never
10
10
  * knows what an infrared code is; it invokes a cap method on a device.
11
- * - **`repeat` is the caller's** (volume ×5), never stored. A failing send
12
- * stops the row and reports the cause; it is never swallowed.
11
+ * - **`repeat` is the caller's** (volume ×5), never stored. It is N FULL
12
+ * sends, `REMOTE_REPEAT_GAP_MS` apart (the SmartIR / Home Assistant model: no
13
+ * protocol repeat frame, the caller re-sends). A failing send stops the row
14
+ * and reports the cause; it is never swallowed.
15
+ * - **Power truth** (`assumedStatus`): a `running-state` reading wins; else the
16
+ * linked plug — off is `off` (a reading), on is `standby` (assumed) until a
17
+ * power command is sent, then what the remote sent.
13
18
  * - **State is read from the running-state cap if the device has one, else
14
19
  * from a native media-player reading, else assumed.** An assumption moves
15
20
  * only AFTER a send succeeded, is persisted per device and never recorded
@@ -42,12 +47,19 @@ export interface RemoteServiceDeps {
42
47
  reportedStatus(deviceId: number): Promise<MediaPlayerStatus | null>;
43
48
  /** The `running-state` reading, or null when the device has none or it is unknown (D393). */
44
49
  runningState(deviceId: number): Promise<boolean | null>;
50
+ /** The linked `power-source` switch: true on, false off, null when none is linked or it is unknown (D393). */
51
+ plugOn(deviceId: number): Promise<boolean | null>;
45
52
  readonly logger: IScopedLogger;
46
53
  readonly now?: () => number;
54
+ /** Waits between two sends of a repeat; a spec drives it. */
55
+ readonly sleep?: (ms: number) => Promise<void>;
47
56
  }
57
+ /** The pause between two full sends of a repeat — never stored, never a setting. */
58
+ export declare const REMOTE_REPEAT_GAP_MS = 150;
48
59
  export declare class RemoteService implements IRemoteProvider {
49
60
  private readonly deps;
50
61
  private readonly now;
62
+ private readonly sleep;
51
63
  constructor(deps: RemoteServiceDeps);
52
64
  readonly getConfig: IRemoteProvider["getConfig"];
53
65
  readonly setConfig: IRemoteProvider["setConfig"];
@@ -55,17 +67,31 @@ export declare class RemoteService implements IRemoteProvider {
55
67
  readonly sendCommand: IRemoteProvider["sendCommand"];
56
68
  readonly sendMediaCommand: IRemoteProvider["sendMediaCommand"];
57
69
  /**
70
+ * What the remote ASSUMES (the last power and mute it sent), or null when it
71
+ * knows neither. No plug, no running-state: that is `assumedStatus`.
72
+ */
73
+ readonly getAssumedStatus: IRemoteProvider["getAssumedStatus"];
74
+ /**
58
75
  * The device's state as the remote knows it, or null when it knows no power
59
- * state (nothing reads one and nothing was sent). The media-player
60
- * `getStatus` hook asks the native source FIRST and serves this only when
61
- * none answers. Power comes from the running-state cap when there is one,
62
- * else from the assumption; mute comes from the assumption.
76
+ * state. Power truth, in order: a `running-state` reading; the linked plug
77
+ * (off is `off`, a reading; on is `standby` until a power command was sent,
78
+ * then what the remote sent); the remote's own assumption. Mute comes from
79
+ * the assumption, and only while the device may be on.
63
80
  */
64
81
  assumedStatus(deviceId: number): Promise<MediaPlayerStatus | null>;
82
+ private statusOf;
65
83
  private mediaRole;
66
84
  /** A role is reachable when bound, or when a toggle `power` stands for `power_on` / `power_off`. */
67
85
  private isBound;
68
86
  private currentState;
87
+ /**
88
+ * THE ordered power truth, read by the status and by the toggle guard alike:
89
+ * a `running-state` reading; the linked plug (off is `off`, a reading, and
90
+ * it forgets what the remote assumed, so the next plug-on starts from
91
+ * standby; on contradicts an assumed `off`, which is dropped); then the
92
+ * remote's own assumption; a plug on with nothing sent is `standby`.
93
+ */
94
+ private powerTruth;
69
95
  /** The mute as a native source reads it, else as last assumed, else unknown. */
70
96
  private currentMute;
71
97
  private readAssumed;
@@ -22,6 +22,9 @@ export interface RemoteRuntimeDeps {
22
22
  readonly settings: DeviceSettings;
23
23
  readonly api: () => AddonApi | undefined;
24
24
  readonly logger: IScopedLogger;
25
+ /** The wait between two sends of a repeat; a spec drives it. */
26
+ readonly sleep?: (ms: number) => Promise<void>;
27
+ readonly now?: () => number;
25
28
  }
26
29
  export interface RemoteRuntime {
27
30
  readonly templates: TemplatesService;
@@ -37,6 +40,11 @@ export declare function remoteAssumptionStoreOver(settings: Pick<DeviceSettings,
37
40
  * unknown is never coerced to "off".
38
41
  */
39
42
  export declare function runningStateOver(api: () => AddonApi | undefined, logger: IScopedLogger): (deviceId: number) => Promise<boolean | null>;
43
+ /**
44
+ * The linked plug of a device (`power-source`): its switch state, null when no
45
+ * plug is linked, it errors, or the state is unknown (D393) — never "off".
46
+ */
47
+ export declare function plugOnOver(api: () => AddonApi | undefined, logger: IScopedLogger): (deviceId: number) => Promise<boolean | null>;
40
48
  /** The devices whose remote configuration points at a template. */
41
49
  export declare function templateUsageOver(settings: Pick<DeviceSettings, "listDeviceStoreIds" | "readDeviceStoreBatch">, api: () => AddonApi | undefined): TemplateUsage;
42
50
  /**
@@ -3,8 +3,8 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-B1ZljzFe.js");
7
- const require_retention = require("../../retention-tfu-EBh4.js");
6
+ const require_dist = require("../../dist-5gi6RCY-.js");
7
+ const require_retention = require("../../retention-v4AG_OmX.js");
8
8
  let node_crypto = require("node:crypto");
9
9
  //#region src/builtins/device-history/capture/point-writer.ts
10
10
  var FLUSH_INTERVAL_MS = 1e4;
@@ -1,5 +1,5 @@
1
- import { Cs as isReadingQuantity, _s as historyUnitFor, ct as HISTORY_CATALOG, ec as DeviceType, fn as armRemovalReconcile, fs as emitReadiness, ho as BaseAddon, ir as deviceRunsCapability, lt as HISTORY_ITEM_CATALOG, mo as wattMillisecondsToKwh, nc as EventCategory, q as DeviceRunSchema, rr as deviceRemovalHookCapability, tr as deviceHistoryCapability, us as defineRecordKinds, z as DEVICE_HISTORY_ENERGY_KEY } from "../../dist-CMxM4-FW.mjs";
2
- import { S as subjectIdOf, _ as readUnit, a as FIVE_MINUTES_MS, b as SeriesRegistry, c as bucketEndOf, d as CAP_KEY_PREFIX, f as CaptureEngine, g as readPath, h as catalogMetrics, i as DAY_MS, l as bucketStartOf, m as capSeriesKey, n as RetentionJob, o as HOUR_MS, p as capItemSeriesKey, r as DepartureTracker, s as ROLLUP_GRACE_MS, t as DEFAULT_RETENTION, u as floorTo, v as DeviceDirectory, x as identityOf, y as isRealDeviceType } from "../../retention-DggVaaFh.mjs";
1
+ import { Es as isReadingQuantity, _o as wattMillisecondsToKwh, ac as EventCategory, ar as deviceRemovalHookCapability, bs as historyUnitFor, ct as HISTORY_CATALOG, hs as emitReadiness, lt as HISTORY_ITEM_CATALOG, mn as armRemovalReconcile, or as deviceRunsCapability, ps as defineRecordKinds, q as DeviceRunSchema, rc as DeviceType, rr as deviceHistoryCapability, vo as BaseAddon, z as DEVICE_HISTORY_ENERGY_KEY } from "../../dist-KFDdjTXv.mjs";
2
+ import { S as subjectIdOf, _ as readUnit, a as FIVE_MINUTES_MS, b as SeriesRegistry, c as bucketEndOf, d as CAP_KEY_PREFIX, f as CaptureEngine, g as readPath, h as catalogMetrics, i as DAY_MS, l as bucketStartOf, m as capSeriesKey, n as RetentionJob, o as HOUR_MS, p as capItemSeriesKey, r as DepartureTracker, s as ROLLUP_GRACE_MS, t as DEFAULT_RETENTION, u as floorTo, v as DeviceDirectory, x as identityOf, y as isRealDeviceType } from "../../retention-C2ZNWzrF.mjs";
3
3
  import { randomUUID } from "node:crypto";
4
4
  //#region src/builtins/device-history/capture/point-writer.ts
5
5
  var FLUSH_INTERVAL_MS = 1e4;
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-B1ZljzFe.js");
6
+ const require_dist = require("../../dist-5gi6RCY-.js");
7
7
  const require_read_all_rows$1 = require("../../read-all-rows-CVoO1ONM.js");
8
8
  const require_prefix_range = require("../../prefix-range-D_KueXbQ.js");
9
9
  const require_prefix_walk = require("../../prefix-walk-Dv6MLZlM.js");
@@ -1,4 +1,4 @@
1
- import { $i as runtimeStatePolicyFor, $s as DeviceRole, Bt as STREAM_PROFILE_META, Ci as parseStreamParamsFormPatch, Cr as formatMinutes, Ds as isSecretMarkerLike, Es as isSecretMarker, F as DAY_NAMES, Gr as legacyAutoLinkIds, Hn as createDeviceExtensionProvider, J as DeviceStatusSchema, Jo as WELL_KNOWN_TAB_MAP, Js as toSecretFieldView, Ks as sleep$1, Qs as DeviceFeature, Sn as buildStreamParamsConfigSchema, Ss as isKeychainStoredField, Tn as canonicalIconKey, Uo as SECRET_CLEAR, Us as secretTreeFromPaths, Vs as resolveSecretMarkers, X as DiscoveryProposalBodySchema, Xn as defineExtensionSlotProvider, Xr as locationIconKey, Xs as userError, Y as DeviceTombstoneSchema, Ys as transformSecretWrite, ar as deviceStateCapability, at as FieldClaimModeSchema, bs as isDeviceConfigCap, cr as enumerateItemArrayFields, ec as DeviceType, er as deviceExtensionCapability, g as CAMERA_SWITCH_ORDER, gi as normalizeUnit, ho as BaseAddon, is as collectZodSecretPaths, lr as enumerateSchemaFields, nc as EventCategory, nr as deviceManagerCapability, o as ALL_CAPABILITY_DEFINITIONS, or as deviceStatusCapability, ot as FieldClaimSchema, pr as expandContainer, tc as errMsg, ua as siteZoneKey, us as defineRecordKinds, v as CAP_NAMES_WITH_STATUS, ws as isSecretClear, xt as MINUTES_PER_DAY } from "../../dist-CMxM4-FW.mjs";
1
+ import { $s as userError, As as isSecretMarkerLike, Cs as isDeviceConfigCap, Dn as canonicalIconKey, Ds as isSecretClear, Ei as parseStreamParamsFormPatch, F as DAY_NAMES, Ht as STREAM_PROFILE_META, J as DeviceStatusSchema, Ko as SECRET_CLEAR, Ks as secretTreeFromPaths, Qn as defineExtensionSlotProvider, Qr as locationIconKey, Qs as transformSecretWrite, Tr as formatMinutes, Ts as isKeychainStoredField, Wn as createDeviceExtensionProvider, Ws as resolveSecretMarkers, X as DiscoveryProposalBodySchema, Y as DeviceTombstoneSchema, Ys as sleep$1, Zo as WELL_KNOWN_TAB_MAP, Zs as toSecretFieldView, ac as EventCategory, at as FieldClaimModeSchema, cr as deviceStatusCapability, dr as enumerateSchemaFields, g as CAMERA_SWITCH_ORDER, hr as expandContainer, ic as errMsg, ir as deviceManagerCapability, ks as isSecretMarker, na as runtimeStatePolicyFor, nc as DeviceRole, nr as deviceExtensionCapability, o as ALL_CAPABILITY_DEFINITIONS, ot as FieldClaimSchema, pa as siteZoneKey, ps as defineRecordKinds, qr as legacyAutoLinkIds, rc as DeviceType, sr as deviceStateCapability, ss as collectZodSecretPaths, tc as DeviceFeature, ur as enumerateItemArrayFields, v as CAP_NAMES_WITH_STATUS, vo as BaseAddon, wn as buildStreamParamsConfigSchema, xt as MINUTES_PER_DAY, yi as normalizeUnit } from "../../dist-KFDdjTXv.mjs";
2
2
  import { t as require_read_all_rows } from "../../read-all-rows-TaPqdWNF.mjs";
3
3
  import { t as prefixRange } from "../../prefix-range-Dl0znowN.mjs";
4
4
  import { t as loadPrefixed } from "../../prefix-walk-DAOBSyH1.mjs";
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-B1ZljzFe.js");
6
+ const require_dist = require("../../dist-5gi6RCY-.js");
7
7
  const require_formatter = require("../../formatter-xbxeV4GD.js");
8
8
  //#region src/builtins/hub-forwarder/hub-forwarder-destination.ts
9
9
  var DEFAULT_OUTBOUND_BUFFER_SIZE = 500;
@@ -1,4 +1,4 @@
1
- import { $r as logDestinationCapability, ho as BaseAddon } from "../../dist-CMxM4-FW.mjs";
1
+ import { ti as logDestinationCapability, vo as BaseAddon } from "../../dist-KFDdjTXv.mjs";
2
2
  import { t as formatLogLine } from "../../formatter-DkYZ4LXp.mjs";
3
3
  //#region src/builtins/hub-forwarder/hub-forwarder-destination.ts
4
4
  var DEFAULT_OUTBOUND_BUFFER_SIZE = 500;
@@ -3,10 +3,10 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-B1ZljzFe.js");
7
- const require_device_ca = require("../../device-ca-AYCsUsY8.js");
6
+ const require_dist = require("../../dist-5gi6RCY-.js");
7
+ const require_device_ca = require("../../device-ca-DN_6Q65t.js");
8
8
  const require_read_all_rows$1 = require("../../read-all-rows-CVoO1ONM.js");
9
- const require_constants = require("../../constants-DNhyMkdx.js");
9
+ const require_constants = require("../../constants-C7y03EtR.js");
10
10
  const require_platform_key_source = require("../../platform-key-source-Di7HrlGR.js");
11
11
  let node_crypto = require("node:crypto");
12
12
  let _camstack_types_node = require("@camstack/types/node");
@@ -1,7 +1,7 @@
1
- import { Ls as parseSecretRef, Ps as normalizeSecretOwner, Ur as keychainAdminCapability, Wr as keychainCapability, _t as KeychainResetRecordSchema, gt as KeychainAuditEntrySchema, ho as BaseAddon, ht as KEYCHAIN_RESET_TRIGGER_ACTOR, ms as formatSecretScope, nc as EventCategory, us as defineRecordKinds } from "../../dist-CMxM4-FW.mjs";
2
- import { d as JWT_SIGNING_KEY_REF, n as DEVICE_CA_KEY_REF, p as SYSTEM_SECRET_OWNER } from "../../device-ca-Cp0tBm4M.mjs";
1
+ import { Bs as parseSecretRef, Gr as keychainAdminCapability, Kr as keychainCapability, Ls as normalizeSecretOwner, _s as formatSecretScope, _t as KeychainResetRecordSchema, ac as EventCategory, gt as KeychainAuditEntrySchema, ht as KEYCHAIN_RESET_TRIGGER_ACTOR, ps as defineRecordKinds, vo as BaseAddon } from "../../dist-KFDdjTXv.mjs";
2
+ import { d as JWT_SIGNING_KEY_REF, n as DEVICE_CA_KEY_REF, p as SYSTEM_SECRET_OWNER } from "../../device-ca-FC5a_gAu.mjs";
3
3
  import { t as require_read_all_rows } from "../../read-all-rows-TaPqdWNF.mjs";
4
- import { a as MESH_CA_KEY_REF } from "../../constants-DCW5J_Df.mjs";
4
+ import { a as MESH_CA_KEY_REF } from "../../constants-BoiK7ZwD.mjs";
5
5
  import { n as getPlatformKeychainKey } from "../../platform-key-source-BWlq0jjn.mjs";
6
6
  import { createCipheriv, createDecipheriv, createHmac, randomBytes, randomUUID, timingSafeEqual } from "node:crypto";
7
7
  import { restrictDirToOwnerSync, restrictFileToOwnerSync, writeOwnerOnlyFileSync } from "@camstack/types/node";
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_chunk = require("../../chunk-Cek0wNdY.js");
3
- const require_dist = require("../../dist-B1ZljzFe.js");
3
+ const require_dist = require("../../dist-5gi6RCY-.js");
4
4
  let node_fs_promises = require("node:fs/promises");
5
5
  node_fs_promises = require_chunk.__toESM(node_fs_promises);
6
6
  let node_path = require("node:path");
@@ -1,4 +1,4 @@
1
- import { Ft as RecordingStatusSchema, Mt as RECORDING_SOURCE_CAMSTACK_ADDON, as as createEvent, ho as BaseAddon, nc as EventCategory, ri as mayWriteToLocation, tc as errMsg } from "../../dist-CMxM4-FW.mjs";
1
+ import { Lt as RecordingStatusSchema, Nt as RECORDING_SOURCE_CAMSTACK_ADDON, ac as EventCategory, ai as mayWriteToLocation, cs as createEvent, ic as errMsg, vo as BaseAddon } from "../../dist-KFDdjTXv.mjs";
2
2
  import * as fsp from "node:fs/promises";
3
3
  import path from "node:path";
4
4
  import { constants } from "node:fs";
@@ -3,10 +3,10 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-B1ZljzFe.js");
6
+ const require_dist = require("../../dist-5gi6RCY-.js");
7
7
  const require_safe_buffer$1 = require("../../safe-buffer-D3aoa-7X.js");
8
8
  const require_ms$1 = require("../../ms-LB3giGoU.js");
9
- const require_device_ca = require("../../device-ca-AYCsUsY8.js");
9
+ const require_device_ca = require("../../device-ca-DN_6Q65t.js");
10
10
  const require_read_all_rows$1 = require("../../read-all-rows-CVoO1ONM.js");
11
11
  let zod = require("zod");
12
12
  let node_crypto = require("node:crypto");
@@ -1,8 +1,8 @@
1
1
  import { i as __require, o as __toESM, t as __commonJSMin } from "../../chunk-CNf5ZN-e.mjs";
2
- import { $n as deviceCredentialsCapability, A as CredentialTokenClaimsSchema, At as PreferenceValueSchema, Dt as PREFERENCES_MAX_VALUE_BYTES, Ea as userManagementCapability, Es as isSecretMarker, Fr as isCredentialTokenPayload, Gt as SsoBridgeClaimsSchema, Ot as PreferenceDeviceIdSchema, Qt as TokenScopeSchema, R as DEVICE_ENROLLMENT_TTL_MS, Sr as formatDeviceRevoker, Ut as ScopedTokenSchema, V as DEVICE_NONCE_TTL_MS, Xs as userError, bn as buildDeviceEnrollmentLink, en as UserRecordSchema, ho as BaseAddon, ks as makeSecretMarker, kt as PreferenceNamespaceSchema, pn as authProviderCapability, us as defineRecordKinds, w as CREDENTIAL_TOKEN_AUDIENCE, xn as buildDeviceSignatureMessage } from "../../dist-CMxM4-FW.mjs";
2
+ import { $s as userError, A as CredentialTokenClaimsSchema, At as PreferenceNamespaceSchema, Cn as buildDeviceSignatureMessage, Dt as PREFERENCES_MAX_VALUE_BYTES, Gt as ScopedTokenSchema, Lr as isCredentialTokenPayload, Ms as makeSecretMarker, R as DEVICE_ENROLLMENT_TTL_MS, Sn as buildDeviceEnrollmentLink, V as DEVICE_NONCE_TTL_MS, en as TokenScopeSchema, hn as authProviderCapability, jt as PreferenceValueSchema, ka as userManagementCapability, ks as isSecretMarker, kt as PreferenceDeviceIdSchema, nn as UserRecordSchema, ps as defineRecordKinds, qt as SsoBridgeClaimsSchema, tr as deviceCredentialsCapability, vo as BaseAddon, w as CREDENTIAL_TOKEN_AUDIENCE, wr as formatDeviceRevoker } from "../../dist-KFDdjTXv.mjs";
3
3
  import { t as require_safe_buffer } from "../../safe-buffer-B1OjL1I9.mjs";
4
4
  import { t as require_ms } from "../../ms-CgH2OFlD.mjs";
5
- import { _ as setProcessJwtSigningKey, a as importDevicePublicKey, c as rebuildDeviceCaCertificate, d as JWT_SIGNING_KEY_REF, g as processJwtSigningKey, h as loadJwtSigningKey, i as generateDeviceCa, l as verifyDeviceLeaf, m as getProcessJwtSigningKeyState, n as DEVICE_CA_KEY_REF, o as issueDeviceLeaf, r as DEVICE_CA_SETTINGS_SECTION, s as loadDeviceCa, t as DEVICE_CA_FIELD, u as verifyDeviceSignature } from "../../device-ca-Cp0tBm4M.mjs";
5
+ import { _ as setProcessJwtSigningKey, a as importDevicePublicKey, c as rebuildDeviceCaCertificate, d as JWT_SIGNING_KEY_REF, g as processJwtSigningKey, h as loadJwtSigningKey, i as generateDeviceCa, l as verifyDeviceLeaf, m as getProcessJwtSigningKeyState, n as DEVICE_CA_KEY_REF, o as issueDeviceLeaf, r as DEVICE_CA_SETTINGS_SECTION, s as loadDeviceCa, t as DEVICE_CA_FIELD, u as verifyDeviceSignature } from "../../device-ca-FC5a_gAu.mjs";
6
6
  import { t as require_read_all_rows } from "../../read-all-rows-TaPqdWNF.mjs";
7
7
  import { z } from "zod";
8
8
  import * as crypto$1 from "node:crypto";