@camstack/server 1.2.816 → 1.2.818

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 (97) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/api/core/cap-providers.js +2 -43
  3. package/dist/api/trpc/generated-cap-routers.js +14 -17
  4. package/dist/core/addon/addon-registry.service.js +3 -3
  5. package/dist/core/addon/instance-lifecycle.js +79 -4
  6. package/package.json +13 -9
  7. package/system/dist/{agent-https-pirjJaDw.js → agent-https-ChriyNA8.js} +1 -1
  8. package/system/dist/{agent-https-CK_B6QXQ.mjs → agent-https-rhOY61af.mjs} +1 -1
  9. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  10. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  11. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  12. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  13. package/system/dist/builtins/alerts/alerts.addon.js +1 -1
  14. package/system/dist/builtins/alerts/alerts.addon.mjs +1 -1
  15. package/system/dist/builtins/autotrack/index.js +1 -1
  16. package/system/dist/builtins/autotrack/index.mjs +1 -1
  17. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
  18. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +2 -2
  19. package/system/dist/builtins/calendars/calendars.addon.js +1 -1
  20. package/system/dist/builtins/calendars/calendars.addon.mjs +1 -1
  21. package/system/dist/builtins/camera-grid/index.js +8 -4
  22. package/system/dist/builtins/camera-grid/index.mjs +8 -4
  23. package/system/dist/builtins/composer/composer.addon.js +3 -3
  24. package/system/dist/builtins/composer/composer.addon.mjs +3 -3
  25. package/system/dist/builtins/console-logging/index.js +1 -1
  26. package/system/dist/builtins/console-logging/index.mjs +1 -1
  27. package/system/dist/builtins/core-blocks/core-blocks.addon.d.ts +1 -0
  28. package/system/dist/builtins/core-blocks/core-blocks.addon.js +357 -19
  29. package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +357 -19
  30. package/system/dist/builtins/core-blocks/migrations/index.d.ts +5 -1
  31. package/system/dist/builtins/core-blocks/migrations/remote-config-migrations.d.ts +62 -0
  32. package/system/dist/builtins/core-blocks/remote-service.d.ts +2 -2
  33. package/system/dist/builtins/device-history/device-history.addon.js +2 -2
  34. package/system/dist/builtins/device-history/device-history.addon.mjs +2 -2
  35. package/system/dist/builtins/device-manager/device-manager.addon.js +1 -1
  36. package/system/dist/builtins/device-manager/device-manager.addon.mjs +1 -1
  37. package/system/dist/builtins/hub-forwarder/index.js +1 -1
  38. package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
  39. package/system/dist/builtins/keychain/index.js +4 -4
  40. package/system/dist/builtins/keychain/index.mjs +4 -4
  41. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  42. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  43. package/system/dist/builtins/local-auth/local-auth.addon.js +2 -2
  44. package/system/dist/builtins/local-auth/local-auth.addon.mjs +2 -2
  45. package/system/dist/builtins/local-network/local-network.addon.js +2 -2
  46. package/system/dist/builtins/local-network/local-network.addon.mjs +2 -2
  47. package/system/dist/builtins/loki-logging/index.js +3 -3
  48. package/system/dist/builtins/loki-logging/index.mjs +3 -3
  49. package/system/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  50. package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  51. package/system/dist/builtins/platform-probe/index.js +1 -1
  52. package/system/dist/builtins/platform-probe/index.mjs +1 -1
  53. package/system/dist/builtins/record-entries/index.js +1 -1
  54. package/system/dist/builtins/record-entries/index.mjs +1 -1
  55. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  56. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  57. package/system/dist/builtins/snapshot/index.js +1 -1
  58. package/system/dist/builtins/snapshot/index.mjs +1 -1
  59. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  60. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  61. package/system/dist/builtins/sqlite-storage/index.js +1 -1
  62. package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
  63. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +3 -3
  64. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +3 -3
  65. package/system/dist/builtins/storage-orchestrator/location-store.d.ts +5 -14
  66. package/system/dist/builtins/storage-orchestrator/record-kinds.d.ts +0 -1
  67. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +35 -75
  68. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +35 -75
  69. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.service.d.ts +9 -32
  70. package/system/dist/builtins/system-config/system-config.addon.js +3 -3
  71. package/system/dist/builtins/system-config/system-config.addon.mjs +284 -284
  72. package/system/dist/builtins/winston-logging/index.js +1 -1
  73. package/system/dist/builtins/winston-logging/index.mjs +1 -1
  74. package/system/dist/{capture-engine-9qCs6J2S.js → capture-engine-Cgt1r0h5.js} +1 -1
  75. package/system/dist/{capture-engine-MPu8CRiM.mjs → capture-engine-CoK1n1F1.mjs} +1 -1
  76. package/system/dist/{composition-sources-CAPpmqL0.mjs → composition-sources-DSU28FFP.mjs} +1 -1
  77. package/system/dist/{composition-sources-N-9OE7DA.js → composition-sources-TkHq8DdF.js} +1 -1
  78. package/system/dist/{constants-D75PEb9b.mjs → constants-CCezBXPq.mjs} +1 -1
  79. package/system/dist/{constants-o31-vUsL.js → constants-D3mNibfv.js} +1 -1
  80. package/system/dist/{device-ca-C3wqsnBw.js → device-ca-CEzeY_zI.js} +1 -1
  81. package/system/dist/{device-ca-D9C75-ee.mjs → device-ca-CjX1tQP7.mjs} +1 -1
  82. package/system/dist/{dist-DBoCrtvm.mjs → dist-BNBgsEk0.mjs} +39 -49
  83. package/system/dist/{dist-BmEptO1d.js → dist-DX1gyM8o.js} +44 -54
  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-ho8U9Zs6.mjs → hub-mdns-ciao-BCfG7mv3.mjs} +2 -2
  87. package/system/dist/{hub-mdns-ciao-B8Lh4Gx1.js → hub-mdns-ciao-DBHvpWvv.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-v-8WFbCS.js → legacy-integration-rows-door-7K4_MoAP.js} +1 -1
  91. package/system/dist/{legacy-integration-rows-door-Cc47aOOP.mjs → legacy-integration-rows-door-C0X4Ijcr.mjs} +1 -1
  92. package/system/dist/migrations/hub/2026-11-08-storage-locations-write-set.d.ts +3 -0
  93. package/system/dist/{restore-archive-BYOda1Dl.js → restore-archive-DXlN0NYx.js} +1 -1
  94. package/system/dist/{restore-archive-DS-Hgq3V.mjs → restore-archive-WBDJlios.mjs} +82 -82
  95. package/system/dist/{wal-maintenance-DtqrYJN3.mjs → wal-maintenance-BJ0vDek1.mjs} +0 -0
  96. package/system/dist/{wal-maintenance-D5CHoEtS.js → wal-maintenance-BPmo2JzY.js} +0 -0
  97. package/system/package.json +1 -1
@@ -1,7 +1,7 @@
1
- import { $ as EMPTY_AUTOMATION_STATE, $a as templateCapability, $n as coreBlocksCapability, $o as BaseAddon, $s as defineEntryKind, A as ControlStatusSchema, Ai as nextOccurrence, An as buildHeroModel, Ao as composedDeviceRef, Bo as helperMembers, C as CORE_BLOCKS_ADDON_ID, Cs as RecordIntegrationInstances, Dn as buildCapabilityLookup, Ea as runSteps, En as buildActionSteps, Eo as HelperMemberSchema, Et as MediaPlayerStatusSchema, Fn as capUnitResolver, Fo as compositionSourceKey, Fr as findChannelSource, Fs as actionEffect, Ft as PowerSourceInfoSchema, Gr as internalActionId, Gs as collectSecretMarkerRefs, Gt as RunningStateStatusSchema, Ha as stableIdMapOf, Hc as transformSecretWrite, J as DeclaredDevices, Jc as DeviceType$1, Ji as powerSourceCapability, Js as commandOrigin, Ki as planComposition, Lc as secretTreeFromSchema, Ma as seedInstanceOnce, Mi as normalizeCapStep, Mr as fanPresetsCapability, Ni as normalizeCoreBlockWrite, O as ConditionMirror, Oa as schedulersCapability, Pc as resolveSecretMarkers, Pi as normalizeStepTargets, Qn as coreBlockSourceKind, R as DEFAULT_HOLD_OVERRIDE, Ra as siteFor, Ri as occurrenceOn, S as COMPOSER_RUNNER_ID, Sa as resolveRemoteSource, Tr as evaluateWhenTree, Ur as heroLayoutCapability, Vn as collectWhenMirrorSources, Vo as historyRetentionFromSettings, Vt as REMOTE_MEDIA_COMMANDS, Wc as vocabActionIdFor, Wn as compileScalarOverride, Wr as integrationInstancesCapability, Wt as RemoteAssumedStateSchema, Xn as coreBlockComposition, Xt as SchedulerSchema, Yc as errMsg$1, Yi as powerSourceLinkOfComposition, Yn as coreBlockAddonId, Yt as SchedulerError, Zc as EventCategory$1, Zi as problemsBlockSave, Zn as coreBlockIdFromAddonId, Zs as defineAddonMigrations, ai as kebabToCamel, an as TemplateKindSchema, ao as toTimings, bo as CompositionSchema, c as ActionError, ca as remoteLayoutComponentsCapability, co as validateComposition, d as ActionVariableSchema, da as resolveActionVariables, di as localDateOf, dn as actionsCapability, ea as projectDeviceRow, ec as defineRecordKinds, ei as isInternalActionId, eo as timedRunCapability, et as EMPTY_REMOTE_ASSUMED_STATE, fn as addonIdOfActionId, ga as resolveHeroLayout, gt as INTERNAL_ACTION_PREFIX, ha as resolveCoreBlockFiles, hi as lockDoorLinkOfComposition, ho as weekdayOfLocalDate, ht as IDLE_ACTION_STATUS, in as SwitchStatusSchema, io as timedRunSeconds, it as FanControlStatusSchema, j as CoreBlockSchema, ji as normalizeActionUnits, l as ActionStepSchema, la as remoteSourceSteps, lc as hydrateSchema, ln as actionSourceCapability, m as BUILTIN_REMOTE_COMPONENTS, ma as resolveCoreBlockEntry, n as ACTION_TARGET_INVALIDATION_EVENTS, no as timedRunMaxIn, nr as customKeyOfRole, nt as FAN_CAPTURE_FIELDS, ot as FanPresetSchema, p as AutomationStateDocSchema, qn as compositionSourceRefs, ra as readStoredRemoteConfig, rc as entryBody, ro as timedRunQuickRun, s as ALL_CAPABILITY_DEFINITIONS, sa as remoteCapability, ta as proposeRunningThreshold, to as timedRunLimitOf, tt as EMPTY_REMOTE_CONFIG, u as ActionTargetResolver, ua as replacedFieldKeys, un as actionWaitTotalMs, uo as validateSchedulerInput, ur as describeComposableCaps, vo as zoneOnlySite, w as CORE_BLOCK_ADDON_PREFIX, wa as resolveStepArgs, xc as isSecretRefOwnedBy, xo as DAY_MS, yc as isSecretMarker, yn as appendTrace, zn as checkTemplatePayload, zt as QuantityUnitError } from "../../dist-DBoCrtvm.mjs";
1
+ import { $ as EMPTY_AUTOMATION_STATE, $a as templateCapability, $n as coreBlocksCapability, $o as BaseAddon, $s as defineEntryKind, A as ControlStatusSchema, Ai as nextOccurrence, An as buildHeroModel, Ao as composedDeviceRef, Bo as helperMembers, Bt as REMOTE_MEDIA_COMMANDS, C as CORE_BLOCKS_ADDON_ID, Cs as RecordIntegrationInstances, Dn as buildCapabilityLookup, Ea as runSteps, En as buildActionSteps, Eo as HelperMemberSchema, Fn as capUnitResolver, Fo as compositionSourceKey, Fr as findChannelSource, Fs as actionEffect, Gr as internalActionId, Gs as collectSecretMarkerRefs, Gt as RunningStateStatusSchema, Ha as stableIdMapOf, Hc as transformSecretWrite, J as DeclaredDevices, Jc as DeviceType$1, Ji as powerSourceCapability, Js as commandOrigin, Ki as planComposition, Lc as secretTreeFromSchema, Ma as seedInstanceOnce, Mi as normalizeCapStep, Mr as fanPresetsCapability, Ni as normalizeCoreBlockWrite, O as ConditionMirror, Oa as schedulersCapability, Pc as resolveSecretMarkers, Pi as normalizeStepTargets, Pt as PowerSourceInfoSchema, Qn as coreBlockSourceKind, R as DEFAULT_HOLD_OVERRIDE, Ra as siteFor, Ri as occurrenceOn, Rt as QuantityUnitError, S as COMPOSER_RUNNER_ID, Sa as resolveRemoteSource, Tr as evaluateWhenTree, Tt as MediaPlayerStatusSchema, Ur as heroLayoutCapability, Ut as RemoteAssumedStateSchema, Vn as collectWhenMirrorSources, Vo as historyRetentionFromSettings, Wc as vocabActionIdFor, Wn as compileScalarOverride, Wr as integrationInstancesCapability, Wt as RemoteLayoutPayloadSchema, Xn as coreBlockComposition, Xt as SchedulerSchema, Yc as errMsg$1, Yi as powerSourceLinkOfComposition, Yn as coreBlockAddonId, Yt as SchedulerError, Zc as EventCategory$1, Zi as problemsBlockSave, Zn as coreBlockIdFromAddonId, Zs as defineAddonMigrations, ai as kebabToCamel, an as TemplateKindSchema, ao as toTimings, bo as CompositionSchema, c as ActionError, ca as remoteLayoutComponentsCapability, co as validateComposition, d as ActionVariableSchema, da as resolveActionVariables, di as localDateOf, dn as actionsCapability, ea as projectDeviceRow, ec as defineRecordKinds, ei as isInternalActionId, eo as timedRunCapability, et as EMPTY_REMOTE_ASSUMED_STATE, fn as addonIdOfActionId, ga as resolveHeroLayout, gt as INTERNAL_ACTION_PREFIX, ha as resolveCoreBlockFiles, hi as lockDoorLinkOfComposition, ho as weekdayOfLocalDate, ht as IDLE_ACTION_STATUS, in as SwitchStatusSchema, io as timedRunSeconds, it as FanControlStatusSchema, j as CoreBlockSchema, ji as normalizeActionUnits, l as ActionStepSchema, la as remoteSourceSteps, lc as hydrateSchema, ln as actionSourceCapability, m as BUILTIN_REMOTE_COMPONENTS, ma as resolveCoreBlockEntry, n as ACTION_TARGET_INVALIDATION_EVENTS, no as timedRunMaxIn, nr as customKeyOfRole, nt as FAN_CAPTURE_FIELDS, ot as FanPresetSchema, p as AutomationStateDocSchema, qn as compositionSourceRefs, ra as readStoredRemoteConfig, rc as entryBody, ro as timedRunQuickRun, s as ALL_CAPABILITY_DEFINITIONS, sa as remoteCapability, ta as proposeRunningThreshold, to as timedRunLimitOf, tt as EMPTY_REMOTE_CONFIG, u as ActionTargetResolver, ua as replacedFieldKeys, un as actionWaitTotalMs, uo as validateSchedulerInput, ur as describeComposableCaps, vo as zoneOnlySite, w as CORE_BLOCK_ADDON_PREFIX, wa as resolveStepArgs, xc as isSecretRefOwnedBy, xo as DAY_MS, yc as isSecretMarker, yn as appendTrace, zn as checkTemplatePayload } from "../../dist-BNBgsEk0.mjs";
2
2
  import { t as require_read_all_rows } from "../../read-all-rows-TaPqdWNF.mjs";
3
- import { i as parseDeviceStateChanged, r as isRecord$1, t as describeCompositionSources } from "../../composition-sources-CAPpmqL0.mjs";
4
- import { i as capSeriesKey } from "../../capture-engine-MPu8CRiM.mjs";
3
+ import { i as parseDeviceStateChanged, r as isRecord$1, t as describeCompositionSources } from "../../composition-sources-DSU28FFP.mjs";
4
+ import { i as capSeriesKey } from "../../capture-engine-CoK1n1F1.mjs";
5
5
  import { t as prefixRange } from "../../prefix-range-Dl0znowN.mjs";
6
6
  import { n as unwrapStoredValue, t as loadPrefixed } from "../../prefix-walk-DAOBSyH1.mjs";
7
7
  import { createRequire } from "node:module";
@@ -2422,6 +2422,279 @@ async function splitPumpCycleFromFountain(ports) {
2422
2422
  };
2423
2423
  }
2424
2424
  //#endregion
2425
+ //#region src/builtins/core-blocks/migrations/remote-config-migrations.ts
2426
+ /**
2427
+ * Two shape changes of a stored remote, both owned by core-blocks (it owns the
2428
+ * `remote` key of the per-device store and the `templates` kind).
2429
+ *
2430
+ * 1. `power: { mode }` leaves the configuration. What a Power key and an
2431
+ * explicit on / off do is derived from the bindings now; the stored field is
2432
+ * dropped and nothing else in the config is touched.
2433
+ * 2. The four colour keys have ONE set of roles. A remote that bound
2434
+ * `custom:color_a..d` (Samsung's lettering) is renamed to
2435
+ * `custom:color_red|green|yellow|blue` in its bindings, its custom buttons and
2436
+ * the steps of its sequence sources; a stored layout's button with such a role
2437
+ * takes the matching tone and keeps its letter on the key (`showLegend`).
2438
+ *
2439
+ * The stored value is read as loosely typed JSON on purpose: it is the OLD shape,
2440
+ * which `RemoteConfigSchema` no longer describes. Every key this migration does
2441
+ * not name is written back exactly as it was, and a rerun finds nothing to do.
2442
+ */
2443
+ var REMOTE_POWER_DROP_ID = "core-blocks/2026-11-09-remote-power-mode-drop";
2444
+ var REMOTE_COLOUR_ROLES_ID = "core-blocks/2026-11-09-remote-colour-roles";
2445
+ /** The key of the per-device store that holds the remote (`REMOTE_STORE_KEY` of remote-wiring). */
2446
+ var STORE_KEY = "remote";
2447
+ function remoteMigrationPortsOver(stores, templates, logger) {
2448
+ return {
2449
+ listStoredRemotes: async () => {
2450
+ const ids = await stores.listDeviceStoreIds();
2451
+ if (ids.length === 0) return [];
2452
+ const batch = await stores.readDeviceStoreBatch(ids);
2453
+ return ids.flatMap((deviceId) => {
2454
+ const raw = batch.get(deviceId)?.[STORE_KEY];
2455
+ return raw === void 0 ? [] : [{
2456
+ deviceId,
2457
+ raw
2458
+ }];
2459
+ });
2460
+ },
2461
+ replaceStoredRemote: async (deviceId, raw) => {
2462
+ await stores.writeDeviceStore(deviceId, { [STORE_KEY]: raw });
2463
+ logger.info("remote migration: a stored remote was rewritten", { tags: { deviceId } });
2464
+ },
2465
+ listTemplateRows: async () => {
2466
+ return (await (0, import_read_all_rows.readAllRows)(templates)).map((row) => ({
2467
+ id: row.id,
2468
+ rev: row.rev,
2469
+ data: row.data
2470
+ }));
2471
+ },
2472
+ replaceTemplateRow: async (id, data, ifRev) => {
2473
+ await templates.put({
2474
+ id,
2475
+ data
2476
+ }, { ifRev });
2477
+ },
2478
+ warnCollision: (deviceId, keys) => {
2479
+ logger.warn(`remote migration: ${keys.join(", ")} had a code and so did its colour role; the lettered one is kept as <key>_kept`, { tags: { deviceId } });
2480
+ }
2481
+ };
2482
+ }
2483
+ var StoredRemoteSchema = z.looseObject({
2484
+ bindings: z.record(z.string(), z.unknown()).optional(),
2485
+ customButtons: z.array(z.looseObject({ key: z.string() })).optional(),
2486
+ sources: z.array(z.unknown()).optional()
2487
+ });
2488
+ var StoredSequenceSchema = z.looseObject({
2489
+ kind: z.literal("sequence"),
2490
+ steps: z.array(z.string())
2491
+ });
2492
+ /** Samsung's lettered keys and the colour each one always was. */
2493
+ var LETTER_TO_COLOUR = {
2494
+ color_a: "red",
2495
+ color_b: "green",
2496
+ color_c: "yellow",
2497
+ color_d: "blue"
2498
+ };
2499
+ var LETTER_OF_KEY = {
2500
+ color_a: "A",
2501
+ color_b: "B",
2502
+ color_c: "C",
2503
+ color_d: "D"
2504
+ };
2505
+ var CUSTOM = "custom:";
2506
+ function newKeyOf(key) {
2507
+ const colour = LETTER_TO_COLOUR[key];
2508
+ return colour === void 0 ? null : `color_${colour}`;
2509
+ }
2510
+ function withoutKeys(record, drop) {
2511
+ return Object.fromEntries(Object.entries(record).filter(([key]) => !drop.has(key)));
2512
+ }
2513
+ /** The remote without `power`, or null when it never had it. */
2514
+ function withoutPowerMode(raw) {
2515
+ const parsed = StoredRemoteSchema.safeParse(raw);
2516
+ if (!parsed.success || !("power" in parsed.data)) return null;
2517
+ return withoutKeys(parsed.data, new Set(["power"]));
2518
+ }
2519
+ /**
2520
+ * The lettered keys of a remote that already has the colour role of the same colour:
2521
+ * both carry a code, so the lettered one is kept under a fresh key instead of
2522
+ * being dropped.
2523
+ */
2524
+ function collidingKeys(remote) {
2525
+ const bound = new Set(Object.keys(remote.bindings ?? {}));
2526
+ const buttons = new Set((remote.customButtons ?? []).map((b) => b.key));
2527
+ const out = /* @__PURE__ */ new Set();
2528
+ for (const key of Object.keys(LETTER_TO_COLOUR)) {
2529
+ const target = newKeyOf(key);
2530
+ if (target === null) continue;
2531
+ const hasOld = bound.has(`${CUSTOM}${key}`) || buttons.has(key);
2532
+ const hasNew = bound.has(`${CUSTOM}${target}`) || buttons.has(target);
2533
+ if (hasOld && hasNew) out.add(key);
2534
+ }
2535
+ return out;
2536
+ }
2537
+ /** Where a lettered key goes: its colour key, or `<key>_kept` when the colour key is taken. */
2538
+ function keyAfter(key, kept) {
2539
+ if (kept.has(key)) return `${key}_kept`;
2540
+ return newKeyOf(key);
2541
+ }
2542
+ function roleAfter(role, kept) {
2543
+ if (!role.startsWith(CUSTOM)) return null;
2544
+ const key = keyAfter(role.slice(7), kept);
2545
+ return key === null ? null : `${CUSTOM}${key}`;
2546
+ }
2547
+ function renameBindings(bindings, kept) {
2548
+ let changed = false;
2549
+ const out = {};
2550
+ for (const [role, binding] of Object.entries(bindings)) {
2551
+ const next = roleAfter(role, kept);
2552
+ if (next === null) {
2553
+ out[role] = binding;
2554
+ continue;
2555
+ }
2556
+ changed = true;
2557
+ out[next] = binding;
2558
+ }
2559
+ return changed ? out : null;
2560
+ }
2561
+ function renameCustomButtons(buttons, kept) {
2562
+ const keys = new Set(buttons.map((b) => b.key));
2563
+ let changed = false;
2564
+ const out = [];
2565
+ for (const button of buttons) {
2566
+ const next = keyAfter(button.key, kept);
2567
+ if (next === null) {
2568
+ out.push(button);
2569
+ continue;
2570
+ }
2571
+ changed = true;
2572
+ if (!keys.has(next) || kept.has(button.key)) out.push({
2573
+ ...button,
2574
+ key: next
2575
+ });
2576
+ }
2577
+ return changed ? out : null;
2578
+ }
2579
+ function renameSourceSteps(sources, kept) {
2580
+ let changed = false;
2581
+ const out = sources.map((source) => {
2582
+ const sequence = StoredSequenceSchema.safeParse(source);
2583
+ if (!sequence.success) return source;
2584
+ const steps = sequence.data.steps.map((step) => roleAfter(step, kept) ?? step);
2585
+ if (steps.every((step, i) => step === sequence.data.steps[i])) return source;
2586
+ changed = true;
2587
+ return {
2588
+ ...sequence.data,
2589
+ steps
2590
+ };
2591
+ });
2592
+ return changed ? out : null;
2593
+ }
2594
+ /** The remote with the colour roles renamed, or null when it binds none of the lettered ones. */
2595
+ function withColourRoles(raw) {
2596
+ const parsed = StoredRemoteSchema.safeParse(raw);
2597
+ if (!parsed.success) return null;
2598
+ const kept = collidingKeys(parsed.data);
2599
+ const bindings = parsed.data.bindings === void 0 ? null : renameBindings(parsed.data.bindings, kept);
2600
+ const customButtons = parsed.data.customButtons === void 0 ? null : renameCustomButtons(parsed.data.customButtons, kept);
2601
+ const sources = parsed.data.sources === void 0 ? null : renameSourceSteps(parsed.data.sources, kept);
2602
+ if (bindings === null && customButtons === null && sources === null) return null;
2603
+ return {
2604
+ remote: {
2605
+ ...parsed.data,
2606
+ ...bindings === null ? {} : { bindings },
2607
+ ...customButtons === null ? {} : { customButtons },
2608
+ ...sources === null ? {} : { sources }
2609
+ },
2610
+ collisions: [...kept]
2611
+ };
2612
+ }
2613
+ function recolouredButton(button) {
2614
+ if (!button.role.startsWith(CUSTOM)) return null;
2615
+ const oldKey = button.role.slice(7);
2616
+ const colour = LETTER_TO_COLOUR[oldKey];
2617
+ const role = roleAfter(button.role, /* @__PURE__ */ new Set());
2618
+ if (colour === void 0 || role === null) return null;
2619
+ return {
2620
+ ...button,
2621
+ role,
2622
+ tone: colour,
2623
+ label: button.label ?? LETTER_OF_KEY[oldKey] ?? colour,
2624
+ showLegend: true
2625
+ };
2626
+ }
2627
+ /** The layout with its lettered colour keys on the colour roles, or null when it has none. */
2628
+ function withColourButtons(payload) {
2629
+ const parsed = RemoteLayoutPayloadSchema.safeParse(payload);
2630
+ if (!parsed.success) return null;
2631
+ let changed = false;
2632
+ const buttons = parsed.data.buttons.map((button) => {
2633
+ const next = recolouredButton(button);
2634
+ if (next === null) return button;
2635
+ changed = true;
2636
+ return next;
2637
+ });
2638
+ return changed ? {
2639
+ ...parsed.data,
2640
+ buttons
2641
+ } : null;
2642
+ }
2643
+ async function dropRemotePowerMode(ports) {
2644
+ const remotes = await ports.listStoredRemotes();
2645
+ let devices = 0;
2646
+ for (const { deviceId, raw } of remotes) {
2647
+ const next = withoutPowerMode(raw);
2648
+ if (next === null) continue;
2649
+ await ports.replaceStoredRemote(deviceId, next);
2650
+ devices += 1;
2651
+ }
2652
+ return devices === 0 ? {
2653
+ outcome: "already-done",
2654
+ summary: { devices: 0 }
2655
+ } : {
2656
+ outcome: "done",
2657
+ summary: { devices }
2658
+ };
2659
+ }
2660
+ async function renameRemoteColourRoles(ports) {
2661
+ const remotes = await ports.listStoredRemotes();
2662
+ let devices = 0;
2663
+ for (const { deviceId, raw } of remotes) {
2664
+ const next = withColourRoles(raw);
2665
+ if (next === null) continue;
2666
+ if (next.collisions.length > 0) ports.warnCollision(deviceId, next.collisions);
2667
+ await ports.replaceStoredRemote(deviceId, next.remote);
2668
+ devices += 1;
2669
+ }
2670
+ let templates = 0;
2671
+ for (const row of await ports.listTemplateRows()) {
2672
+ if (row.data.kind !== "remote") continue;
2673
+ const payload = withColourButtons(row.data.payload);
2674
+ if (payload === null) continue;
2675
+ const updatedAt = Math.max(row.data.updatedAt + 1, ports.now());
2676
+ await ports.replaceTemplateRow(row.id, {
2677
+ ...row.data,
2678
+ payload,
2679
+ updatedAt
2680
+ }, row.rev);
2681
+ templates += 1;
2682
+ }
2683
+ return devices === 0 && templates === 0 ? {
2684
+ outcome: "already-done",
2685
+ summary: {
2686
+ devices: 0,
2687
+ templates: 0
2688
+ }
2689
+ } : {
2690
+ outcome: "done",
2691
+ summary: {
2692
+ devices,
2693
+ templates
2694
+ }
2695
+ };
2696
+ }
2697
+ //#endregion
2425
2698
  //#region src/builtins/core-blocks/migrations/index.ts
2426
2699
  /** The `core-blocks` catalogue (D987): offered to the engine when the hub-resident addon initialises. */
2427
2700
  var ADDON_MIGRATIONS = [
@@ -2472,6 +2745,38 @@ var ADDON_MIGRATIONS = [
2472
2745
  fixtureMark: "the block createdBy and name, which the migration does not know"
2473
2746
  },
2474
2747
  procedure: dropFountainDrinkCounters
2748
+ },
2749
+ {
2750
+ meta: {
2751
+ id: REMOTE_POWER_DROP_ID,
2752
+ owner: "core-blocks",
2753
+ level: "addon-state",
2754
+ seq: 4,
2755
+ dependsOn: [],
2756
+ store: "settings",
2757
+ scope: "cluster",
2758
+ onFailure: "tolerate",
2759
+ bodyKind: "procedure",
2760
+ description: "Drop the stored power mode (toggle or discrete) from each remote configuration: the Power key and an explicit on / off now follow the bindings",
2761
+ fixtureMark: "the default transmitter and a source name of each remote, which the migration does not know"
2762
+ },
2763
+ procedure: dropRemotePowerMode
2764
+ },
2765
+ {
2766
+ meta: {
2767
+ id: REMOTE_COLOUR_ROLES_ID,
2768
+ owner: "core-blocks",
2769
+ level: "addon-state",
2770
+ seq: 5,
2771
+ dependsOn: [],
2772
+ store: "settings",
2773
+ scope: "cluster",
2774
+ onFailure: "tolerate",
2775
+ bodyKind: "procedure",
2776
+ description: "Rename the lettered colour keys custom:color_a..d to the colour roles custom:color_red..blue in each remote (bindings, custom buttons, sequence sources) and in each stored layout, which keeps the letter on a coloured key",
2777
+ fixtureMark: "the binding action of each lettered key and the label of each layout button"
2778
+ },
2779
+ procedure: renameRemoteColourRoles
2475
2780
  }
2476
2781
  ];
2477
2782
  //#endregion
@@ -5766,7 +6071,7 @@ function remoteCallRedirect(deps) {
5766
6071
  /**
5767
6072
  * The `remote` cap (D963, D964): a button panel over a media-player device. It
5768
6073
  * keeps the per-device configuration (layout template, role bindings, custom
5769
- * buttons, power mode) in the device's settings store and runs a bound ROLE by
6074
+ * buttons) in the device's settings store and runs a bound ROLE by
5770
6075
  * calling the action it is bound to — the shape an Action step has, so an
5771
6076
  * infrared code and a smart-TV call are the same thing here.
5772
6077
  *
@@ -5873,7 +6178,6 @@ var RemoteService = class {
5873
6178
  });
5874
6179
  return {
5875
6180
  layoutTemplateId: config.layoutTemplateId,
5876
- power: config.power,
5877
6181
  commands,
5878
6182
  sources: config.sources
5879
6183
  };
@@ -6029,10 +6333,10 @@ var RemoteService = class {
6029
6333
  for (const role of rolesFor(input.command)) if (this.isBound(config, role)) return role;
6030
6334
  return null;
6031
6335
  }
6032
- /** A role is reachable when bound, or when a toggle `power` stands for `power_on` / `power_off`. */
6336
+ /** A role is reachable when bound, or when a bound `power` stands for `power_on` / `power_off`. */
6033
6337
  isBound(config, role) {
6034
6338
  if (config.bindings[role] !== void 0) return true;
6035
- return (role === "power_on" || role === "power_off") && config.power.mode === "toggle" && config.bindings["power"] !== void 0;
6339
+ return (role === "power_on" || role === "power_off") && config.bindings["power"] !== void 0;
6036
6340
  }
6037
6341
  async currentState(deviceId) {
6038
6342
  const running = await this.deps.runningState(deviceId);
@@ -6211,7 +6515,7 @@ var RemoteService = class {
6211
6515
  * An `ir` source presses nothing: its own code goes out once (planning#464).
6212
6516
  */
6213
6517
  async runSource(deviceId, config, source) {
6214
- if (source.kind === "ir") return this.runIrSource(deviceId, source);
6518
+ if (source.kind === "ir") return this.runIrSource(deviceId, config, source);
6215
6519
  const steps = remoteSourceSteps(source);
6216
6520
  const missing = steps.findIndex((role) => !this.isBound(config, role));
6217
6521
  if (missing >= 0) {
@@ -6295,12 +6599,24 @@ var RemoteService = class {
6295
6599
  });
6296
6600
  }
6297
6601
  /** One train through the source's own transmitter; the source is remembered only after it landed. */
6298
- async runIrSource(deviceId, source) {
6602
+ async runIrSource(deviceId, config, source) {
6603
+ const transmitterId = source.transmitterId ?? config.defaultTransmitterId;
6604
+ if (transmitterId === null) {
6605
+ this.deps.logger.warn("remote: an infrared source has no emitter, nothing was sent", {
6606
+ tags: { deviceId },
6607
+ meta: { source: source.name }
6608
+ });
6609
+ return {
6610
+ status: "refused",
6611
+ reason: "no-transmitter",
6612
+ detail: `"${source.name}" names no emitter and the remote has no default one`
6613
+ };
6614
+ }
6299
6615
  return this.withLock(deviceId, async () => {
6300
6616
  const { timings, settings } = toTimings(source.payload);
6301
6617
  try {
6302
6618
  await this.deps.invoke({
6303
- deviceId: source.transmitterId,
6619
+ deviceId: transmitterId,
6304
6620
  cap: IR_TRANSMITTER_CAP,
6305
6621
  method: IR_SEND_METHOD,
6306
6622
  args: {
@@ -6313,7 +6629,7 @@ var RemoteService = class {
6313
6629
  tags: { deviceId },
6314
6630
  meta: {
6315
6631
  source: source.name,
6316
- transmitterId: source.transmitterId,
6632
+ transmitterId,
6317
6633
  error: errorText(err)
6318
6634
  }
6319
6635
  });
@@ -6346,10 +6662,15 @@ var RemoteService = class {
6346
6662
  });
6347
6663
  }
6348
6664
  async runRole(deviceId, config, role, repeat) {
6665
+ const explicit = config.bindings["power_on"] !== void 0 && config.bindings["power_off"] !== void 0;
6666
+ if (role === "power" && config.bindings["power"] === void 0 && explicit) {
6667
+ const now = await this.currentState(deviceId);
6668
+ return this.runRole(deviceId, config, now === "on" ? "power_off" : "power_on", repeat);
6669
+ }
6349
6670
  const wantsState = role === "power_on" ? "on" : role === "power_off" ? "off" : null;
6350
- const viaToggle = wantsState !== null && config.bindings[role] === void 0;
6671
+ const viaToggle = wantsState !== null && !explicit && config.bindings["power"] !== void 0;
6351
6672
  const bound = viaToggle ? config.bindings["power"] : config.bindings[role];
6352
- if (bound === void 0 || viaToggle && config.power.mode !== "toggle") return {
6673
+ if (bound === void 0) return {
6353
6674
  status: "refused",
6354
6675
  reason: "unbound-role",
6355
6676
  detail: `${role} is not bound`
@@ -8218,6 +8539,12 @@ async function extractSettingsSchema(js) {
8218
8539
  var CONVERGE_INTERVAL_MS = 15e3;
8219
8540
  /** Where block packages are materialised, under this node's data root. */
8220
8541
  var BLOCK_PACKAGE_DIRNAME = "core-blocks";
8542
+ /** A node without the per-device settings store cannot read a stored remote: the migration fails loudly rather than record itself as done. */
8543
+ var NO_DEVICE_STORES = {
8544
+ listDeviceStoreIds: () => Promise.reject(/* @__PURE__ */ new Error("core-blocks: no per-device settings store")),
8545
+ readDeviceStoreBatch: () => Promise.reject(/* @__PURE__ */ new Error("core-blocks: no per-device settings store")),
8546
+ writeDeviceStore: () => Promise.reject(/* @__PURE__ */ new Error("core-blocks: no per-device settings store"))
8547
+ };
8221
8548
  var CoreBlocksAddon = class extends BaseAddon {
8222
8549
  /**
8223
8550
  * `super({})` is NOT optional, and its absence is invisible until runtime:
@@ -8261,7 +8588,10 @@ var CoreBlocksAddon = class extends BaseAddon {
8261
8588
  await records.declare(coreBlocksRecordKinds);
8262
8589
  await records.declare(blocksInstanceRecordKinds);
8263
8590
  this.blocksInstances = buildBlocksInstances(records);
8264
- await this.runMigrations(defineAddonMigrations(ADDON_MIGRATIONS, coreBlocksMigrationPorts(records.kind(coreBlocksRecordKinds.blocks), this.ctx.logger.child("migrations"), () => Date.now())));
8591
+ await this.runMigrations(defineAddonMigrations(ADDON_MIGRATIONS, {
8592
+ ...coreBlocksMigrationPorts(records.kind(coreBlocksRecordKinds.blocks), this.ctx.logger.child("migrations"), () => Date.now()),
8593
+ ...remoteMigrationPortsOver(this.ctx.settings ?? NO_DEVICE_STORES, records.kind(coreBlocksRecordKinds.templates), this.ctx.logger.child("migrations"))
8594
+ }));
8265
8595
  this.store = CoreBlockStore.of(records, this.ctx.logger.child("store"));
8266
8596
  this.prefs = new BlockSettingsStore({
8267
8597
  store: settingsStore,
@@ -8327,10 +8657,10 @@ var CoreBlocksAddon = class extends BaseAddon {
8327
8657
  capability: coreBlocksCapability,
8328
8658
  provider: this.buildProvider()
8329
8659
  },
8330
- ...this.blocksInstances === null ? [] : [{
8660
+ {
8331
8661
  capability: integrationInstancesCapability,
8332
- provider: this.blocksInstances.toProvider()
8333
- }],
8662
+ provider: this.requireBlocksInstances().toProvider()
8663
+ },
8334
8664
  {
8335
8665
  capability: actionsCapability,
8336
8666
  provider: this.requireActions().service
@@ -8662,7 +8992,11 @@ var CoreBlocksAddon = class extends BaseAddon {
8662
8992
  devices: this.ctx.kernel.devices,
8663
8993
  localNodeId: this.ctx.kernel.localNodeId,
8664
8994
  getIntegration: async (addonId) => api.integrations.getByAddonId.query({ addonId }),
8665
- createIntegration: async (input) => api.integrations.create.mutate(input),
8995
+ createIntegration: async (input) => api.integrationInstances.createInstance.mutate({
8996
+ addonId: input.addonId,
8997
+ name: input.name,
8998
+ seed: { info: input.info }
8999
+ }),
8666
9000
  updateIntegration: async ({ id, info }) => {
8667
9001
  await api.integrations.update.mutate({
8668
9002
  id,
@@ -8672,7 +9006,7 @@ var CoreBlocksAddon = class extends BaseAddon {
8672
9006
  },
8673
9007
  listOwnDevices: async () => api.deviceManager.listAll.query({ addonId: CORE_BLOCKS_ADDON_ID }),
8674
9008
  seedInstance: async (seed) => {
8675
- if (this.blocksInstances !== null) await seedInstanceOnce(this.blocksInstances.toProvider(), seed);
9009
+ await seedInstanceOnce(this.requireBlocksInstances().toProvider(), seed);
8676
9010
  }
8677
9011
  });
8678
9012
  }
@@ -8687,6 +9021,10 @@ var CoreBlocksAddon = class extends BaseAddon {
8687
9021
  convergeSoon() {
8688
9022
  this.supervisor?.converge();
8689
9023
  }
9024
+ requireBlocksInstances() {
9025
+ if (this.blocksInstances === null) throw new Error("core-blocks: not initialized");
9026
+ return this.blocksInstances;
9027
+ }
8690
9028
  requireActions() {
8691
9029
  if (this.actions === null) throw new Error("core-blocks: not initialized");
8692
9030
  return this.actions;
@@ -1,7 +1,11 @@
1
1
  import type { AddonMigration } from "@camstack/types";
2
2
  import { type CoreBlocksMigrationPorts } from "./pump-cycle-split.js";
3
+ import { type RemoteMigrationPorts } from "./remote-config-migrations.js";
3
4
  export { FOUNTAIN_DRINK_DROP_ID } from "./fountain-drink-drop.js";
5
+ export { REMOTE_COLOUR_ROLES_ID, REMOTE_POWER_DROP_ID, remoteMigrationPortsOver, type RemoteMigrationPorts } from "./remote-config-migrations.js";
6
+ /** Everything the core-blocks catalogue touches: the block rows, and the stored remotes and templates. */
7
+ export type CoreBlocksCatalogPorts = CoreBlocksMigrationPorts & RemoteMigrationPorts;
4
8
  export { HELPER_TO_CUSTOMIZE_ID } from "./helper-to-customize.js";
5
9
  export { coreBlocksMigrationPorts, PUMP_CYCLE_SPLIT_ID, type CoreBlocksMigrationPorts, type StoredBlockRow } from "./pump-cycle-split.js";
6
10
  /** The `core-blocks` catalogue (D987): offered to the engine when the hub-resident addon initialises. */
7
- export declare const ADDON_MIGRATIONS: readonly AddonMigration<CoreBlocksMigrationPorts>[];
11
+ export declare const ADDON_MIGRATIONS: readonly AddonMigration<CoreBlocksCatalogPorts>[];
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Two shape changes of a stored remote, both owned by core-blocks (it owns the
3
+ * `remote` key of the per-device store and the `templates` kind).
4
+ *
5
+ * 1. `power: { mode }` leaves the configuration. What a Power key and an
6
+ * explicit on / off do is derived from the bindings now; the stored field is
7
+ * dropped and nothing else in the config is touched.
8
+ * 2. The four colour keys have ONE set of roles. A remote that bound
9
+ * `custom:color_a..d` (Samsung's lettering) is renamed to
10
+ * `custom:color_red|green|yellow|blue` in its bindings, its custom buttons and
11
+ * the steps of its sequence sources; a stored layout's button with such a role
12
+ * takes the matching tone and keeps its letter on the key (`showLegend`).
13
+ *
14
+ * The stored value is read as loosely typed JSON on purpose: it is the OLD shape,
15
+ * which `RemoteConfigSchema` no longer describes. Every key this migration does
16
+ * not name is written back exactly as it was, and a rerun finds nothing to do.
17
+ */
18
+ import { type IScopedLogger, type MigrationProcedureResult, type RecordKindHandle } from "@camstack/types";
19
+ import type { TemplateRowBody } from "../record-kinds.js";
20
+ export declare const REMOTE_POWER_DROP_ID = "core-blocks/2026-11-09-remote-power-mode-drop";
21
+ export declare const REMOTE_COLOUR_ROLES_ID = "core-blocks/2026-11-09-remote-colour-roles";
22
+ /** A stored `template` row as the migration reads it. */
23
+ export interface StoredTemplateRow {
24
+ readonly id: string;
25
+ readonly rev: number;
26
+ readonly data: TemplateRowBody;
27
+ }
28
+ export interface RemoteMigrationPorts {
29
+ /** Every device that has a stored remote, with the raw value. Throws when it cannot be read in full. */
30
+ listStoredRemotes(): Promise<readonly {
31
+ readonly deviceId: number;
32
+ readonly raw: unknown;
33
+ }[]>;
34
+ /** Replace the stored remote of a device. */
35
+ replaceStoredRemote(deviceId: number, raw: Record<string, unknown>): Promise<void>;
36
+ listTemplateRows(): Promise<readonly StoredTemplateRow[]>;
37
+ replaceTemplateRow(id: string, data: TemplateRowBody, ifRev: number): Promise<void>;
38
+ /** A device had both a lettered colour key and its colour role: the lettered one was kept under a new key. */
39
+ warnCollision(deviceId: number, keys: readonly string[]): void;
40
+ }
41
+ /** The device settings view the real ports need. */
42
+ export interface RemoteDeviceStores {
43
+ listDeviceStoreIds(): Promise<readonly number[]>;
44
+ readDeviceStoreBatch(deviceIds: readonly number[]): Promise<ReadonlyMap<number, Record<string, unknown>>>;
45
+ writeDeviceStore(deviceId: number, patch: Record<string, unknown>): Promise<void>;
46
+ }
47
+ export declare function remoteMigrationPortsOver(stores: RemoteDeviceStores, templates: RecordKindHandle<TemplateRowBody>, logger: IScopedLogger): RemoteMigrationPorts;
48
+ /** The remote without `power`, or null when it never had it. */
49
+ export declare function withoutPowerMode(raw: unknown): Record<string, unknown> | null;
50
+ export interface RenamedRemote {
51
+ readonly remote: Record<string, unknown>;
52
+ /** The lettered keys kept under a `_kept` key because their colour role was already in use. */
53
+ readonly collisions: readonly string[];
54
+ }
55
+ /** The remote with the colour roles renamed, or null when it binds none of the lettered ones. */
56
+ export declare function withColourRoles(raw: unknown): RenamedRemote | null;
57
+ /** The layout with its lettered colour keys on the colour roles, or null when it has none. */
58
+ export declare function withColourButtons(payload: unknown): unknown;
59
+ export declare function dropRemotePowerMode(ports: RemoteMigrationPorts): Promise<MigrationProcedureResult>;
60
+ export declare function renameRemoteColourRoles(ports: RemoteMigrationPorts & {
61
+ now(): number;
62
+ }): Promise<MigrationProcedureResult>;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * The `remote` cap (D963, D964): a button panel over a media-player device. It
3
3
  * keeps the per-device configuration (layout template, role bindings, custom
4
- * buttons, power mode) in the device's settings store and runs a bound ROLE by
4
+ * buttons) in the device's settings store and runs a bound ROLE by
5
5
  * calling the action it is bound to — the shape an Action step has, so an
6
6
  * infrared code and a smart-TV call are the same thing here.
7
7
  *
@@ -139,7 +139,7 @@ export declare class RemoteService implements IRemoteProvider {
139
139
  private statusOf;
140
140
  private buildStatus;
141
141
  private mediaRole;
142
- /** A role is reachable when bound, or when a toggle `power` stands for `power_on` / `power_off`. */
142
+ /** A role is reachable when bound, or when a bound `power` stands for `power_on` / `power_off`. */
143
143
  private isBound;
144
144
  private currentState;
145
145
  /**
@@ -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-BmEptO1d.js");
7
- const require_capture_engine = require("../../capture-engine-9qCs6J2S.js");
6
+ const require_dist = require("../../dist-DX1gyM8o.js");
7
+ const require_capture_engine = require("../../capture-engine-Cgt1r0h5.js");
8
8
  const require_retention = require("../../retention-BcOSL6b9.js");
9
9
  let node_crypto = require("node:crypto");
10
10
  //#region src/builtins/device-history/capture/point-writer.ts
@@ -1,5 +1,5 @@
1
- import { $o as BaseAddon, Es as RecordTooLargeError, Jc as DeviceType, Qo as wattMillisecondsToKwh, V as DEVICE_HISTORY_ENERGY_KEY, Y as DeviceRunSchema, Zc as EventCategory, _r as deviceRunsCapability, bn as armRemovalReconcile, br as deviceTransitionsCapability, cc as historyUnitFor, dt as HISTORY_ITEM_CATALOG, ec as defineRecordKinds, gc as isReadingQuantity, gr as deviceRemovalHookCapability, mr as deviceHistoryCapability, nc as emitReadiness, os as DeviceTransitionSchema, us as InvalidRecordError, ut as HISTORY_CATALOG } from "../../dist-DBoCrtvm.mjs";
2
- import { a as catalogMetrics, c as DeviceDirectory, d as identityOf, f as subjectIdOf, i as capSeriesKey, l as isRealDeviceType, n as CaptureEngine, o as readPath, r as capItemSeriesKey, s as readUnit, t as CAP_KEY_PREFIX, u as SeriesRegistry } from "../../capture-engine-MPu8CRiM.mjs";
1
+ import { $o as BaseAddon, Es as RecordTooLargeError, Jc as DeviceType, Qo as wattMillisecondsToKwh, V as DEVICE_HISTORY_ENERGY_KEY, Y as DeviceRunSchema, Zc as EventCategory, _r as deviceRunsCapability, bn as armRemovalReconcile, br as deviceTransitionsCapability, cc as historyUnitFor, dt as HISTORY_ITEM_CATALOG, ec as defineRecordKinds, gc as isReadingQuantity, gr as deviceRemovalHookCapability, mr as deviceHistoryCapability, nc as emitReadiness, os as DeviceTransitionSchema, us as InvalidRecordError, ut as HISTORY_CATALOG } from "../../dist-BNBgsEk0.mjs";
2
+ import { a as catalogMetrics, c as DeviceDirectory, d as identityOf, f as subjectIdOf, i as capSeriesKey, l as isRealDeviceType, n as CaptureEngine, o as readPath, r as capItemSeriesKey, s as readUnit, t as CAP_KEY_PREFIX, u as SeriesRegistry } from "../../capture-engine-CoK1n1F1.mjs";
3
3
  import { a as FIVE_MINUTES_MS, c as bucketEndOf, i as DAY_MS, l as bucketStartOf, n as RetentionJob, o as HOUR_MS, r as DepartureTracker, s as ROLLUP_GRACE_MS, t as DEFAULT_RETENTION, u as floorTo } from "../../retention-CUOVI1p7.mjs";
4
4
  import { randomUUID } from "node:crypto";
5
5
  //#region src/builtins/device-history/capture/point-writer.ts
@@ -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-BmEptO1d.js");
6
+ const require_dist = require("../../dist-DX1gyM8o.js");
7
7
  const require_read_all_rows$1 = require("../../read-all-rows-CVoO1ONM.js");
8
8
  const require_log_redactor = require("../../log-redactor-BhIEMaG9.js");
9
9
  const require_prefix_range = require("../../prefix-range-D_KueXbQ.js");
@@ -1,4 +1,4 @@
1
- import { $o as BaseAddon, Br as generateDeviceAlias, Cr as enumerateSchemaFields, Da as runtimeStatePolicyFor, Dr as expandContainer, Fi as normalizeUnit, Hc as transformSecretWrite, Hi as parseStreamParamsFormPatch, Ic as secretTreeFromPaths, Jc as DeviceType$1, Jt as STREAM_PROFILE_META, Kc as DeviceFeature, Ks as collectZodSecretPaths$1, L as DAY_NAMES, Ln as checkDeviceAlias, Pc as resolveSecretMarkers, Pn as canonicalIconKey, Ps as WELL_KNOWN_TAB_MAP, Q as DiscoveryProposalBodySchema, Rr as formatMinutes, Sr as enumerateItemArrayFields, Uc as userError, Vc as toSecretFieldView, Vs as auditedFields, X as DeviceStatusSchema, Yc as errMsg$1, Z as DeviceTombstoneSchema, Zc as EventCategory$1, _ as CAMERA_SWITCH_ORDER, _c as isSecretClear, bc as isSecretMarkerLike, ci as legacyAutoLinkIds, cr as defineExtensionSlotProvider, ct as FieldClaimSchema, ec as defineRecordKinds, fc as isDeviceConfigCap, hc as isKeychainStoredField, hr as deviceManagerCapability, ic as expandCapMethods$1, jn as buildStreamParamsConfigSchema, ks as SECRET_CLEAR, pi as locationIconKey, pr as deviceExtensionCapability, qc as DeviceRole, qs as commandEffect, s as ALL_CAPABILITY_DEFINITIONS, st as FieldClaimModeSchema, tr as createDeviceExtensionProvider, uc as isCommand$1, vr as deviceStateCapability, wt as MINUTES_PER_DAY, y as CAP_NAMES_WITH_STATUS, yc as isSecretMarker, yr as deviceStatusCapability, za as siteZoneKey, zc as sleep$2 } from "../../dist-DBoCrtvm.mjs";
1
+ import { $o as BaseAddon, Br as generateDeviceAlias, Cr as enumerateSchemaFields, Ct as MINUTES_PER_DAY, Da as runtimeStatePolicyFor, Dr as expandContainer, Fi as normalizeUnit, Hc as transformSecretWrite, Hi as parseStreamParamsFormPatch, Ic as secretTreeFromPaths, Jc as DeviceType$1, Jt as STREAM_PROFILE_META, Kc as DeviceFeature, Ks as collectZodSecretPaths$1, L as DAY_NAMES, Ln as checkDeviceAlias, Pc as resolveSecretMarkers, Pn as canonicalIconKey, Ps as WELL_KNOWN_TAB_MAP, Q as DiscoveryProposalBodySchema, Rr as formatMinutes, Sr as enumerateItemArrayFields, Uc as userError, Vc as toSecretFieldView, Vs as auditedFields, X as DeviceStatusSchema, Yc as errMsg$1, Z as DeviceTombstoneSchema, Zc as EventCategory$1, _ as CAMERA_SWITCH_ORDER, _c as isSecretClear, bc as isSecretMarkerLike, ci as legacyAutoLinkIds, cr as defineExtensionSlotProvider, ct as FieldClaimSchema, ec as defineRecordKinds, fc as isDeviceConfigCap, hc as isKeychainStoredField, hr as deviceManagerCapability, ic as expandCapMethods$1, jn as buildStreamParamsConfigSchema, ks as SECRET_CLEAR, pi as locationIconKey, pr as deviceExtensionCapability, qc as DeviceRole, qs as commandEffect, s as ALL_CAPABILITY_DEFINITIONS, st as FieldClaimModeSchema, tr as createDeviceExtensionProvider, uc as isCommand$1, vr as deviceStateCapability, y as CAP_NAMES_WITH_STATUS, yc as isSecretMarker, yr as deviceStatusCapability, za as siteZoneKey, zc as sleep$2 } from "../../dist-BNBgsEk0.mjs";
2
2
  import { t as require_read_all_rows } from "../../read-all-rows-TaPqdWNF.mjs";
3
3
  import { a as redactLogText, i as redactLogMeta, n as isSecretArgumentKey } from "../../log-redactor-XLDrPzOi.mjs";
4
4
  import { t as prefixRange } from "../../prefix-range-Dl0znowN.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-BmEptO1d.js");
6
+ const require_dist = require("../../dist-DX1gyM8o.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 { $o as BaseAddon, gi as logDestinationCapability } from "../../dist-DBoCrtvm.mjs";
1
+ import { $o as BaseAddon, gi as logDestinationCapability } from "../../dist-BNBgsEk0.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;