@camstack/server 1.2.812 → 1.2.814
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.
- package/CHANGELOG.md +14 -0
- package/dist/api/core/cap-providers.js +50 -343
- package/dist/api/trpc/generated-cap-routers.js +9 -0
- package/dist/core/addon/addon-registry.service.js +31 -1
- package/dist/core/addon/addon-settings-provider.js +7 -1
- package/dist/core/addon/instance-lifecycle.js +454 -0
- package/dist/core/addon/instance-links.service.js +22 -14
- package/dist/core/moleculer/moleculer.service.js +15 -1
- package/package.json +10 -10
- package/system/dist/{agent-https-a3mE4PW4.js → agent-https-Dwbpz4K6.js} +1 -1
- package/system/dist/{agent-https-CyEBY3RB.mjs → agent-https-eMihTWJ4.mjs} +1 -1
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
- package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
- package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
- package/system/dist/builtins/alerts/alerts.addon.js +1 -1
- package/system/dist/builtins/alerts/alerts.addon.mjs +1 -1
- package/system/dist/builtins/autotrack/index.js +1 -1
- package/system/dist/builtins/autotrack/index.mjs +1 -1
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +2 -2
- package/system/dist/builtins/calendars/calendars.addon.js +1 -1
- package/system/dist/builtins/calendars/calendars.addon.mjs +1 -1
- package/system/dist/builtins/camera-grid/index.js +1 -1
- package/system/dist/builtins/camera-grid/index.mjs +1 -1
- package/system/dist/builtins/composer/composer.addon.js +3 -3
- package/system/dist/builtins/composer/composer.addon.mjs +3 -3
- package/system/dist/builtins/console-logging/index.js +1 -1
- package/system/dist/builtins/console-logging/index.mjs +1 -1
- package/system/dist/builtins/core-blocks/blocks-instances.d.ts +22 -0
- package/system/dist/builtins/core-blocks/core-blocks.addon.d.ts +2 -0
- package/system/dist/builtins/core-blocks/core-blocks.addon.js +210 -10
- package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +200 -10
- package/system/dist/builtins/core-blocks/hero-layout-service.d.ts +7 -0
- package/system/dist/builtins/core-blocks/remote-service.d.ts +3 -0
- package/system/dist/builtins/core-blocks/timed-run/timed-run-service.d.ts +7 -0
- package/system/dist/builtins/device-history/device-history.addon.js +2 -2
- package/system/dist/builtins/device-history/device-history.addon.mjs +2 -2
- package/system/dist/builtins/device-manager/device-manager.addon.js +1 -1
- package/system/dist/builtins/device-manager/device-manager.addon.mjs +1 -1
- package/system/dist/builtins/hub-forwarder/index.js +1 -1
- package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
- package/system/dist/builtins/keychain/index.js +4 -4
- package/system/dist/builtins/keychain/index.mjs +4 -4
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
- package/system/dist/builtins/local-auth/local-auth.addon.js +2 -2
- package/system/dist/builtins/local-auth/local-auth.addon.mjs +2 -2
- package/system/dist/builtins/local-network/local-network.addon.js +2 -2
- package/system/dist/builtins/local-network/local-network.addon.mjs +2 -2
- package/system/dist/builtins/loki-logging/index.js +1 -1
- package/system/dist/builtins/loki-logging/index.mjs +1 -1
- package/system/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
- package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
- package/system/dist/builtins/platform-probe/index.js +1 -1
- package/system/dist/builtins/platform-probe/index.mjs +1 -1
- package/system/dist/builtins/record-entries/index.js +1 -1
- package/system/dist/builtins/record-entries/index.mjs +1 -1
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
- package/system/dist/builtins/snapshot/index.js +1 -1
- package/system/dist/builtins/snapshot/index.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/index.js +1 -1
- package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +3 -3
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +3 -3
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
- package/system/dist/builtins/system-config/system-config.addon.js +3 -3
- package/system/dist/builtins/system-config/system-config.addon.mjs +284 -284
- package/system/dist/builtins/winston-logging/index.js +1 -1
- package/system/dist/builtins/winston-logging/index.mjs +1 -1
- package/system/dist/{capture-engine-ByF-6AFH.mjs → capture-engine-CYPDOIF6.mjs} +1 -1
- package/system/dist/{capture-engine-BO9mSlY-.js → capture-engine-uxR5sOQN.js} +1 -1
- package/system/dist/{composition-sources-AziMFo7T.mjs → composition-sources-CU3p3INI.mjs} +1 -1
- package/system/dist/{composition-sources-BMJUPUh2.js → composition-sources-DkvntZci.js} +1 -1
- package/system/dist/{constants-CjRlgRlu.js → constants-BP-Txn_J.js} +1 -1
- package/system/dist/{constants-CTikgsC_.mjs → constants-DMFJ6Fky.mjs} +1 -1
- package/system/dist/{device-ca-Dxl6kVcJ.js → device-ca-D-0zxmFi.js} +1 -1
- package/system/dist/{device-ca-CNRlFqFC.mjs → device-ca-tmcd_VBC.mjs} +1 -1
- package/system/dist/{dist-CkJnelZr.js → dist-CznnwtQ8.js} +756 -73
- package/system/dist/{dist-BPq13Y8j.mjs → dist-DmCVWvtK.mjs} +727 -68
- package/system/dist/file-host-worker.js +1 -1
- package/system/dist/file-host-worker.mjs +1 -1
- package/system/dist/{hub-mdns-ciao-CrjItezp.mjs → hub-mdns-ciao-DbwyiHD5.mjs} +2 -2
- package/system/dist/{hub-mdns-ciao-Cx6yJBl9.js → hub-mdns-ciao-FTf16-JR.js} +2 -2
- package/system/dist/index.js +8 -8
- package/system/dist/index.mjs +8 -8
- package/system/dist/{legacy-integration-rows-door-Dxcqwc-w.mjs → legacy-integration-rows-door-CASQgifG.mjs} +1 -1
- package/system/dist/{legacy-integration-rows-door-CKM-LxvL.js → legacy-integration-rows-door-gW0xpMJI.js} +1 -1
- package/system/dist/{restore-archive-BQWOdGAB.js → restore-archive-B9TEFWRE.js} +1 -1
- package/system/dist/{restore-archive-r3zTdLKr.mjs → restore-archive-DlaC_gyl.mjs} +82 -82
- package/system/dist/{wal-maintenance-zJ4-ORo6.mjs → wal-maintenance-Cn164tp0.mjs} +0 -0
- package/system/dist/{wal-maintenance-CiCgL4Hp.js → wal-maintenance-Da2Rozz6.js} +0 -0
- package/system/package.json +5 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $o as BaseAddon, Jr as isAlertEpisodeSeverity, Yc as errMsg, Ys as createEvent, Zc as EventCategory, _n as alertEpisodePayload, ec as defineRecordKinds, f as AlertSchema, gn as alertEpisodeId, qr as isAlertEpisodeOpen, vn as alertsCapability, w as CORE_BLOCK_ADDON_PREFIX } from "../../dist-DmCVWvtK.mjs";
|
|
2
2
|
import { t as require_read_all_rows } from "../../read-all-rows-TaPqdWNF.mjs";
|
|
3
3
|
import { a as redactLogText } from "../../log-redactor-XLDrPzOi.mjs";
|
|
4
4
|
import * as fs$1 from "node:fs";
|
|
@@ -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-
|
|
6
|
+
const require_dist = require("../../dist-CznnwtQ8.js");
|
|
7
7
|
let zod = require("zod");
|
|
8
8
|
//#region src/builtins/autotrack/autotrack-config.ts
|
|
9
9
|
var DEFAULT_AUTOTRACK_LOOP_CONFIG = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $o as BaseAddon, Cn as bareAddonId, Yc as errMsg, Zc as EventCategory, na as ptzAutotrackCapability, pc as isEvent, rt as FIRST_LEVEL_MACRO_CLASSES } from "../../dist-DmCVWvtK.mjs";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
//#region src/builtins/autotrack/autotrack-config.ts
|
|
4
4
|
var DEFAULT_AUTOTRACK_LOOP_CONFIG = {
|
|
@@ -3,9 +3,9 @@ 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-
|
|
6
|
+
const require_dist = require("../../dist-CznnwtQ8.js");
|
|
7
7
|
const require_read_all_rows$1 = require("../../read-all-rows-CVoO1ONM.js");
|
|
8
|
-
const require_restore_archive = require("../../restore-archive-
|
|
8
|
+
const require_restore_archive = require("../../restore-archive-B9TEFWRE.js");
|
|
9
9
|
let node_crypto = require("node:crypto");
|
|
10
10
|
let node_fs = require("node:fs");
|
|
11
11
|
node_fs = require_chunk.__toESM(node_fs);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $o as BaseAddon, Bc as toNodeId, Ka as storageOccupancyCapability, Sn as backupCapability, Tc as nodePin, Zc as EventCategory, bi as mayWriteToLocation } from "../../dist-DmCVWvtK.mjs";
|
|
2
2
|
import { t as require_read_all_rows } from "../../read-all-rows-TaPqdWNF.mjs";
|
|
3
|
-
import { _ as backupRecordStoresOf, a as BackupSnapshotRefusedError, d as ENCRYPTED_BACKUP_SUFFIX, f as generateBackupKeyPair, g as backupOrchestratorRecordKinds, i as BackupCancelledError, l as BackupKeyFormatError, m as parseBackupSecretKey, n as precheckRestoreKey, o as DEFAULT_BACKUP_DATABASES, p as parseBackupPublicKey, r as prepareRestoreArchive, s as SystemBackupService } from "../../restore-archive-
|
|
3
|
+
import { _ as backupRecordStoresOf, a as BackupSnapshotRefusedError, d as ENCRYPTED_BACKUP_SUFFIX, f as generateBackupKeyPair, g as backupOrchestratorRecordKinds, i as BackupCancelledError, l as BackupKeyFormatError, m as parseBackupSecretKey, n as precheckRestoreKey, o as DEFAULT_BACKUP_DATABASES, p as parseBackupPublicKey, r as prepareRestoreArchive, s as SystemBackupService } from "../../restore-archive-DlaC_gyl.mjs";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
5
5
|
import * as fs$1 from "node:fs";
|
|
6
6
|
import * as path$1 from "node:path";
|
|
@@ -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-
|
|
6
|
+
const require_dist = require("../../dist-CznnwtQ8.js");
|
|
7
7
|
const require_settle_sources = require("../../settle-sources-Bhsy57y-.js");
|
|
8
8
|
let zod = require("zod");
|
|
9
9
|
//#region src/builtins/calendars/calendar-color.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $o as BaseAddon, E as CalendarPreferencesSchema, Mn as calendarsCapability, ec as defineRecordKinds } from "../../dist-DmCVWvtK.mjs";
|
|
2
2
|
import { t as settleSourcesWithTimeout } from "../../settle-sources-CDtNC8ub.mjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
//#region src/builtins/calendars/calendar-color.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-
|
|
6
|
+
const require_dist = require("../../dist-CznnwtQ8.js");
|
|
7
7
|
let zod = require("zod");
|
|
8
8
|
let node_crypto = require("node:crypto");
|
|
9
9
|
let _camstack_types_node = require("@camstack/types/node");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $o as BaseAddon, $s as defineEntryKind, Ba as snapshotCapability, Ci as memoizePinnedFfmpeg, Cn as bareAddonId, Cs as RecordIntegrationInstances, J as DeclaredDevices, Ja as streamCatalogCapability, Jc as DeviceType, Kc as DeviceFeature, Nn as cameraGridLayoutCapability, Oo as buildFfmpegArgs, Tt as MOTION_CLOSE_AFTER_MS, Wr as integrationInstancesCapability, Yc as errMsg, Ys as createEvent, Zc as EventCategory, ar as declarationOwnerNodeId, h as BaseDevice, ki as motionCapability, lc as hydrateSchema, mc as isInstanceEnabled, z as DERIVED_CAMERA_SILENCED_CAP_NAMES } from "../../dist-DmCVWvtK.mjs";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { createHash } from "node:crypto";
|
|
4
4
|
import { FfmpegProcess } from "@camstack/types/node";
|
|
@@ -3,9 +3,9 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
7
|
-
const require_composition_sources = require("../../composition-sources-
|
|
8
|
-
const require_capture_engine = require("../../capture-engine-
|
|
6
|
+
const require_dist = require("../../dist-CznnwtQ8.js");
|
|
7
|
+
const require_composition_sources = require("../../composition-sources-DkvntZci.js");
|
|
8
|
+
const require_capture_engine = require("../../capture-engine-uxR5sOQN.js");
|
|
9
9
|
const require_retention = require("../../retention-BcOSL6b9.js");
|
|
10
10
|
let zod = require("zod");
|
|
11
11
|
//#region src/builtins/composer/actuator-invoke.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as parseDeviceStateChanged, n as normalizedNativeOwner, r as isRecord$4 } from "../../composition-sources-
|
|
3
|
-
import { i as capSeriesKey } from "../../capture-engine-
|
|
1
|
+
import { $i as processTimeZoneOr, $o as BaseAddon, Ao as composedDeviceRef, Ar as fanControlCapability, Bn as climateControlCapability, Co as HISTORY_FAST_MS, Dn as buildCapabilityLookup, Do as MINUTE_MS, Fa as sharedActuatorMethods, Fo as compositionSourceKey, Gn as composerCapability, Go as nextLocalMidnight, Hn as colorCapability, Ho as integrateReading, Hr as groupTemplate, Ia as sharedColorModes, Io as createStatefulExpressionMemory, J as DeclaredDevices, Jc as DeviceType, Jn as consumablesCapability, Jo as planResetTier, Ki as planComposition, Kn as compositionFieldKey, Ko as openReset, Lo as disarmRoseMemory, Mo as compositionFeatureEnabled, No as compositionItemFieldPath, Nr as featureForwards, Or as expressionContainsBuiltinCall, Pa as sharedActuatorFeatures, Po as compositionSliceKey, Pt as PetFountainStatusSchema, Ro as evaluateDerivative, Si as mediaPlayerFeaturesOfRoles, So as DEFAULT_HISTORY_RETENTION, Ta as runFanOut, Tn as brightnessCapability, To as HOUR_MS, Ui as petFountainCapability, Uo as isForwardInputRef, Vi as parseColorInput, Vo as historyRetentionFromSettings, Vr as groupCommandsCapability, Wi as petFountainWaterItem, Wo as isHistoryHelper, Xc as featuresOfBoundCaps, Xo as statisticCadenceMs, Yc as errMsg, Yo as planStatisticTier, Ys as createEvent, Za as switchCapability, Zc as EventCategory, Zo as toExpressionValue, ai as kebabToCamel, at as FanDirectionSchema, ba as resolveMutate, do as valveCapability, er as coverCapability, gc as isReadingQuantity, go as withDefaultRunning, h as BaseDevice, i as ACTUATOR_TEMPLATE_IDS, jo as composedDeviceStableId, jr as fanOutTargets, k as ConsumableItemSchema, ki as motionCapability, ko as cloneStatefulExpressionMemory, lt as GroupCommandResultSchema, mi as lockControlCapability, mt as HvacModeSchema, or as declaredSeriesKind, qo as openStatistic, r as ACTUATOR_METHODS, s as ALL_CAPABILITY_DEFINITIONS, wi as methodRefusal, wo as HISTORY_SLOW_MS, wr as evaluateCompositionField, x as COMPOSED_ITEM_FIXED_FIELDS, xi as mediaPlayerCapability, yo as COMPOSER_ADDON_ID, zo as evaluateStatistic } from "../../dist-DmCVWvtK.mjs";
|
|
2
|
+
import { i as parseDeviceStateChanged, n as normalizedNativeOwner, r as isRecord$4 } from "../../composition-sources-CU3p3INI.mjs";
|
|
3
|
+
import { i as capSeriesKey } from "../../capture-engine-CYPDOIF6.mjs";
|
|
4
4
|
import { i as DAY_MS, t as DEFAULT_RETENTION } from "../../retention-CUOVI1p7.mjs";
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
//#region src/builtins/composer/actuator-invoke.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-
|
|
6
|
+
const require_dist = require("../../dist-CznnwtQ8.js");
|
|
7
7
|
const require_formatter = require("../../formatter-xbxeV4GD.js");
|
|
8
8
|
//#region src/builtins/console-logging/console-destination.ts
|
|
9
9
|
var LEVEL_RANK = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $o as BaseAddon, gi as logDestinationCapability } from "../../dist-DmCVWvtK.mjs";
|
|
2
2
|
import { t as formatLogLine } from "../../formatter-DkYZ4LXp.mjs";
|
|
3
3
|
//#region src/builtins/console-logging/console-destination.ts
|
|
4
4
|
var LEVEL_RANK = {
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Blocks integration as an `integration-instances` provider (epic #440): the fixed builtin
|
|
3
|
+
* `DeclaredDevices` mints for `core-blocks` (`blocks-integration.ts`) has an instance record under
|
|
4
|
+
* its registry id, holding only its name. It is name-only on purpose: the integration's `enabled`
|
|
5
|
+
* switch stays in the registry (a fixed builtin is switched through `integrations.update`, and
|
|
6
|
+
* `integrations.list` never projects it from a record), and there is nothing to configure.
|
|
7
|
+
*/
|
|
8
|
+
import { type DefinedRecordKind, type RecordsAccess, RecordIntegrationInstances } from "@camstack/types";
|
|
9
|
+
import type { z } from "zod";
|
|
10
|
+
/** Checked against the schema by its annotation: a drifted field fails the typecheck. */
|
|
11
|
+
export type BlocksConnectionBody = {
|
|
12
|
+
readonly name: string;
|
|
13
|
+
readonly enabled?: boolean | undefined;
|
|
14
|
+
};
|
|
15
|
+
export type BlocksConnectionsEntryKind = DefinedRecordKind<z.ZodType<BlocksConnectionBody>>;
|
|
16
|
+
export declare const blocksConnectionsEntryKind: BlocksConnectionsEntryKind;
|
|
17
|
+
/** Every kind of the Blocks integration record, keyed by its name. */
|
|
18
|
+
export type BlocksInstanceRecordKinds = {
|
|
19
|
+
readonly connections: BlocksConnectionsEntryKind;
|
|
20
|
+
};
|
|
21
|
+
export declare const blocksInstanceRecordKinds: BlocksInstanceRecordKinds;
|
|
22
|
+
export declare function buildBlocksInstances(records: Pick<RecordsAccess, "kind" | "owner">): RecordIntegrationInstances<BlocksConnectionBody>;
|
|
@@ -30,6 +30,8 @@ export declare class CoreBlocksAddon extends BaseAddon {
|
|
|
30
30
|
private readonly seedFailed;
|
|
31
31
|
/** The shared integration, or null when this node does not own it. */
|
|
32
32
|
private blocksIntegrationId;
|
|
33
|
+
/** The instance record the shared integration keeps (name only); built with the records. */
|
|
34
|
+
private blocksInstances;
|
|
33
35
|
protected onInitialize(): Promise<ProviderRegistration[]>;
|
|
34
36
|
/** Read-only: the fixed layouts and the model built from the device's bindings and slices. */
|
|
35
37
|
private buildHeroLayout;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
3
|
-
const require_dist = require("../../dist-
|
|
3
|
+
const require_dist = require("../../dist-CznnwtQ8.js");
|
|
4
4
|
const require_read_all_rows$1 = require("../../read-all-rows-CVoO1ONM.js");
|
|
5
|
-
const require_composition_sources = require("../../composition-sources-
|
|
6
|
-
const require_capture_engine = require("../../capture-engine-
|
|
5
|
+
const require_composition_sources = require("../../composition-sources-DkvntZci.js");
|
|
6
|
+
const require_capture_engine = require("../../capture-engine-uxR5sOQN.js");
|
|
7
7
|
const require_prefix_range = require("../../prefix-range-D_KueXbQ.js");
|
|
8
8
|
const require_prefix_walk = require("../../prefix-walk-Dv6MLZlM.js");
|
|
9
9
|
let zod = require("zod");
|
|
@@ -3778,7 +3778,27 @@ var TimedRunService = class {
|
|
|
3778
3778
|
activeUntil: body.activeUntil
|
|
3779
3779
|
};
|
|
3780
3780
|
};
|
|
3781
|
+
/**
|
|
3782
|
+
* Stop a run: the device this run switched on is switched OFF, once, and the
|
|
3783
|
+
* deadline is forgotten. Nothing armed means nothing to stop - no command is sent.
|
|
3784
|
+
* D49: the off is a one-shot; a failure is logged with the device tag, not retried,
|
|
3785
|
+
* and the row is dropped either way.
|
|
3786
|
+
*/
|
|
3781
3787
|
cancel = async ({ deviceId }) => {
|
|
3788
|
+
const armed = this.pending.get(deviceId);
|
|
3789
|
+
if (armed === void 0) {
|
|
3790
|
+
await this.forget(deviceId);
|
|
3791
|
+
return;
|
|
3792
|
+
}
|
|
3793
|
+
this.deps.logger.info("timed-run: stopped by request, switching the device off", { tags: { deviceId } });
|
|
3794
|
+
try {
|
|
3795
|
+
await this.deps.actuation.set(deviceId, armed.actuator, false);
|
|
3796
|
+
} catch (error) {
|
|
3797
|
+
this.deps.logger.warn("timed-run: the stop did not reach the device; not retrying", {
|
|
3798
|
+
tags: { deviceId },
|
|
3799
|
+
meta: { error: String(error) }
|
|
3800
|
+
});
|
|
3801
|
+
}
|
|
3782
3802
|
await this.forget(deviceId);
|
|
3783
3803
|
};
|
|
3784
3804
|
/** Feed one `DeviceStateChanged`: a manual off cancels the pending deadline. */
|
|
@@ -5461,6 +5481,8 @@ var RemoteComponentsService = class {
|
|
|
5461
5481
|
* count comes from the remote cap and is `null` when it cannot be asked.
|
|
5462
5482
|
*/
|
|
5463
5483
|
var REMOTE_CAP = "remote";
|
|
5484
|
+
/** Models built at once for a list; the cap bounds the list, this bounds the fan-out on the registry. */
|
|
5485
|
+
var ROW_MODELS_CONCURRENCY = 16;
|
|
5464
5486
|
var HeroLayoutService = class {
|
|
5465
5487
|
deps;
|
|
5466
5488
|
constructor(deps) {
|
|
@@ -5509,6 +5531,36 @@ var HeroLayoutService = class {
|
|
|
5509
5531
|
access: { canActuate: canActuate ?? true }
|
|
5510
5532
|
});
|
|
5511
5533
|
};
|
|
5534
|
+
/**
|
|
5535
|
+
* One row per requested id, in order. `null` means "no row": either the registry
|
|
5536
|
+
* does not know the device, or reading it failed (logged, tagged). Both read as
|
|
5537
|
+
* "unknown", never as an empty row. A repeated id is read once.
|
|
5538
|
+
*/
|
|
5539
|
+
getRowModels = async ({ deviceIds, canActuate }) => {
|
|
5540
|
+
const unique = [...new Set(deviceIds)];
|
|
5541
|
+
const byId = /* @__PURE__ */ new Map();
|
|
5542
|
+
for (let from = 0; from < unique.length; from += ROW_MODELS_CONCURRENCY) {
|
|
5543
|
+
const chunk = unique.slice(from, from + ROW_MODELS_CONCURRENCY);
|
|
5544
|
+
const rows = await Promise.all(chunk.map((id) => this.rowOf(id, canActuate)));
|
|
5545
|
+
chunk.forEach((id, i) => byId.set(id, rows[i] ?? null));
|
|
5546
|
+
}
|
|
5547
|
+
return deviceIds.map((id) => byId.get(id) ?? null);
|
|
5548
|
+
};
|
|
5549
|
+
async rowOf(deviceId, canActuate) {
|
|
5550
|
+
try {
|
|
5551
|
+
const model = await this.getHeroModel({
|
|
5552
|
+
deviceId,
|
|
5553
|
+
canActuate
|
|
5554
|
+
});
|
|
5555
|
+
return model === null ? null : require_dist.projectDeviceRow(model);
|
|
5556
|
+
} catch (error) {
|
|
5557
|
+
this.deps.logger.warn("hero row: the device could not be read; its row is absent", {
|
|
5558
|
+
tags: { deviceId },
|
|
5559
|
+
meta: { error: error instanceof Error ? error.message : String(error) }
|
|
5560
|
+
});
|
|
5561
|
+
return null;
|
|
5562
|
+
}
|
|
5563
|
+
}
|
|
5512
5564
|
async remoteCommands(deviceId) {
|
|
5513
5565
|
try {
|
|
5514
5566
|
return await this.deps.reader.remoteCommands(deviceId);
|
|
@@ -5715,6 +5767,46 @@ function remoteCallRedirect(deps) {
|
|
|
5715
5767
|
}
|
|
5716
5768
|
};
|
|
5717
5769
|
}
|
|
5770
|
+
//#endregion
|
|
5771
|
+
//#region src/builtins/core-blocks/remote-service.ts
|
|
5772
|
+
/**
|
|
5773
|
+
* The `remote` cap (D963, D964): a button panel over a media-player device. It
|
|
5774
|
+
* keeps the per-device configuration (layout template, role bindings, custom
|
|
5775
|
+
* buttons, power mode) in the device's settings store and runs a bound ROLE by
|
|
5776
|
+
* calling the action it is bound to — the shape an Action step has, so an
|
|
5777
|
+
* infrared code and a smart-TV call are the same thing here.
|
|
5778
|
+
*
|
|
5779
|
+
* Decisions that shape this file:
|
|
5780
|
+
* - **What a button does is the action's business.** This service never
|
|
5781
|
+
* knows what an infrared code is; it invokes a cap method on a device.
|
|
5782
|
+
* - **`repeat` is the caller's** (volume ×5), never stored. It is N FULL
|
|
5783
|
+
* sends, `REMOTE_REPEAT_GAP_MS` apart (the SmartIR / Home Assistant model: no
|
|
5784
|
+
* protocol repeat frame, the caller re-sends). A failing send stops the row
|
|
5785
|
+
* and reports the cause; it is never swallowed.
|
|
5786
|
+
* - **Power truth** (`assumedStatus`): a `running-state` reading wins; else the
|
|
5787
|
+
* linked plug — off is `off` (a reading), on is `standby` (assumed) until a
|
|
5788
|
+
* power command is sent, then what the remote sent.
|
|
5789
|
+
* - **State is read from the running-state cap if the device has one, else
|
|
5790
|
+
* from a native media-player reading, else assumed.** An assumption moves
|
|
5791
|
+
* only AFTER a send succeeded, is persisted per device and never recorded
|
|
5792
|
+
* in history. A toggle power code is sent only when the current state
|
|
5793
|
+
* differs from the requested one; a discrete pair is always sent. A mute on
|
|
5794
|
+
* a device that does not report it is sent and marked assumed.
|
|
5795
|
+
* - **Sources are declared** (planning#460). `availableSources` is the
|
|
5796
|
+
* operator's declared sources, never the custom buttons. A source runs its
|
|
5797
|
+
* steps in order under the device's lock (no other press interleaves),
|
|
5798
|
+
* `stepDelayMs` apart; a refusal is typed (`unknown-source`,
|
|
5799
|
+
* `unbound-step`, `undeclared-channel`) and a failed step stops the
|
|
5800
|
+
* sequence and names itself. The source last sent is ASSUMED, and forgotten
|
|
5801
|
+
* when the device is switched off, when the plug reads off and when a
|
|
5802
|
+
* channel step moves the channel.
|
|
5803
|
+
* - **Precedence** (`sendMediaCommand`): a media-player command takes the
|
|
5804
|
+
* remote when its role is bound, else answers `not-routed` so the native
|
|
5805
|
+
* cap runs. The dispatch redirect asks this for every caller.
|
|
5806
|
+
*/
|
|
5807
|
+
/** The cap and method an infrared source's code goes out through. */
|
|
5808
|
+
var IR_TRANSMITTER_CAP = "ir-transmitter";
|
|
5809
|
+
var IR_SEND_METHOD = "send";
|
|
5718
5810
|
var realSleep = (ms) => new Promise((resolve) => {
|
|
5719
5811
|
setTimeout(resolve, ms);
|
|
5720
5812
|
});
|
|
@@ -6122,8 +6214,10 @@ var RemoteService = class {
|
|
|
6122
6214
|
* Presses a source's steps in order, one lock for the whole sequence,
|
|
6123
6215
|
* `stepDelayMs` apart. Every step is checked bound BEFORE the first press, so
|
|
6124
6216
|
* a half-bound source sends nothing. A step that fails stops the sequence.
|
|
6217
|
+
* An `ir` source presses nothing: its own code goes out once (planning#464).
|
|
6125
6218
|
*/
|
|
6126
6219
|
async runSource(deviceId, config, source) {
|
|
6220
|
+
if (source.kind === "ir") return this.runIrSource(deviceId, source);
|
|
6127
6221
|
const steps = require_dist.remoteSourceSteps(source);
|
|
6128
6222
|
const missing = steps.findIndex((role) => !this.isBound(config, role));
|
|
6129
6223
|
if (missing >= 0) {
|
|
@@ -6206,6 +6300,50 @@ var RemoteService = class {
|
|
|
6206
6300
|
};
|
|
6207
6301
|
});
|
|
6208
6302
|
}
|
|
6303
|
+
/** One train through the source's own transmitter; the source is remembered only after it landed. */
|
|
6304
|
+
async runIrSource(deviceId, source) {
|
|
6305
|
+
return this.withLock(deviceId, async () => {
|
|
6306
|
+
const { timings, settings } = require_dist.toTimings(source.payload);
|
|
6307
|
+
try {
|
|
6308
|
+
await this.deps.invoke({
|
|
6309
|
+
deviceId: source.transmitterId,
|
|
6310
|
+
cap: IR_TRANSMITTER_CAP,
|
|
6311
|
+
method: IR_SEND_METHOD,
|
|
6312
|
+
args: {
|
|
6313
|
+
timings,
|
|
6314
|
+
settings
|
|
6315
|
+
}
|
|
6316
|
+
});
|
|
6317
|
+
} catch (err) {
|
|
6318
|
+
this.deps.logger.warn("remote: the infrared source failed to send, nothing was assumed", {
|
|
6319
|
+
tags: { deviceId },
|
|
6320
|
+
meta: {
|
|
6321
|
+
source: source.name,
|
|
6322
|
+
transmitterId: source.transmitterId,
|
|
6323
|
+
error: errorText(err)
|
|
6324
|
+
}
|
|
6325
|
+
});
|
|
6326
|
+
return {
|
|
6327
|
+
status: "refused",
|
|
6328
|
+
reason: "action-failed",
|
|
6329
|
+
detail: errorText(err)
|
|
6330
|
+
};
|
|
6331
|
+
}
|
|
6332
|
+
const kept = await this.readAssumed(deviceId);
|
|
6333
|
+
await this.deps.assumptions.write(deviceId, {
|
|
6334
|
+
...kept,
|
|
6335
|
+
source: {
|
|
6336
|
+
name: source.name,
|
|
6337
|
+
at: this.now()
|
|
6338
|
+
}
|
|
6339
|
+
});
|
|
6340
|
+
await this.refreshSlice(deviceId);
|
|
6341
|
+
return {
|
|
6342
|
+
status: "sent",
|
|
6343
|
+
sends: 1
|
|
6344
|
+
};
|
|
6345
|
+
});
|
|
6346
|
+
}
|
|
6209
6347
|
async forgetSource(deviceId) {
|
|
6210
6348
|
const kept = await this.readAssumed(deviceId);
|
|
6211
6349
|
if (kept.source !== null) await this.deps.assumptions.write(deviceId, {
|
|
@@ -6479,16 +6617,27 @@ function remoteConfigStoreOver(settings, logger) {
|
|
|
6479
6617
|
read: async (deviceId) => {
|
|
6480
6618
|
const raw = (await settings.readDeviceStore(deviceId))[REMOTE_STORE_KEY];
|
|
6481
6619
|
if (raw === void 0) return require_dist.EMPTY_REMOTE_CONFIG;
|
|
6482
|
-
const parsed = require_dist.
|
|
6483
|
-
if (parsed.success)
|
|
6620
|
+
const parsed = require_dist.readStoredRemoteConfig(raw);
|
|
6621
|
+
if (parsed.success) {
|
|
6622
|
+
for (const refused of parsed.data.refusedSources ?? []) logger.warn("remote: a stored source no longer parses, it is left out of the remote", {
|
|
6623
|
+
tags: { deviceId },
|
|
6624
|
+
meta: {
|
|
6625
|
+
index: refused.index,
|
|
6626
|
+
sourceId: refused.id,
|
|
6627
|
+
reason: refused.reason
|
|
6628
|
+
}
|
|
6629
|
+
});
|
|
6630
|
+
return parsed.data;
|
|
6631
|
+
}
|
|
6484
6632
|
logger.warn("remote: a stored configuration no longer parses, the device reads as having none", {
|
|
6485
6633
|
tags: { deviceId },
|
|
6486
|
-
meta: { issues: parsed.
|
|
6634
|
+
meta: { issues: parsed.issues }
|
|
6487
6635
|
});
|
|
6488
6636
|
return require_dist.EMPTY_REMOTE_CONFIG;
|
|
6489
6637
|
},
|
|
6490
6638
|
write: async (deviceId, config) => {
|
|
6491
|
-
|
|
6639
|
+
const { refusedSources: _report, ...stored } = config;
|
|
6640
|
+
await settings.writeDeviceStore(deviceId, { [REMOTE_STORE_KEY]: stored });
|
|
6492
6641
|
}
|
|
6493
6642
|
};
|
|
6494
6643
|
}
|
|
@@ -6557,7 +6706,7 @@ function templateUsageOver(settings, api) {
|
|
|
6557
6706
|
const rows = await settings.readDeviceStoreBatch(ids);
|
|
6558
6707
|
const users = [];
|
|
6559
6708
|
for (const [deviceId, row] of rows) {
|
|
6560
|
-
const parsed = require_dist.
|
|
6709
|
+
const parsed = require_dist.readStoredRemoteConfig(row[REMOTE_STORE_KEY]);
|
|
6561
6710
|
if (!parsed.success || parsed.data.layoutTemplateId !== templateId) continue;
|
|
6562
6711
|
const found = await api()?.deviceManager.getDevice.query({ deviceId });
|
|
6563
6712
|
users.push({
|
|
@@ -6613,7 +6762,7 @@ function remoteSliceWriterOver(settings, api) {
|
|
|
6613
6762
|
if (ids.length === 0) return [];
|
|
6614
6763
|
const rows = await settings.readDeviceStoreBatch(ids);
|
|
6615
6764
|
const carrying = [];
|
|
6616
|
-
for (const [deviceId, row] of rows) if (require_dist.
|
|
6765
|
+
for (const [deviceId, row] of rows) if (require_dist.readStoredRemoteConfig(row["remote"]).success) carrying.push(deviceId);
|
|
6617
6766
|
return carrying;
|
|
6618
6767
|
},
|
|
6619
6768
|
publish: async (deviceId, status) => {
|
|
@@ -7385,6 +7534,46 @@ function armBlocksIntegration(options) {
|
|
|
7385
7534
|
})() };
|
|
7386
7535
|
}
|
|
7387
7536
|
//#endregion
|
|
7537
|
+
//#region src/builtins/core-blocks/blocks-instances.ts
|
|
7538
|
+
/**
|
|
7539
|
+
* The Blocks integration as an `integration-instances` provider (epic #440): the fixed builtin
|
|
7540
|
+
* `DeclaredDevices` mints for `core-blocks` (`blocks-integration.ts`) has an instance record under
|
|
7541
|
+
* its registry id, holding only its name. It is name-only on purpose: the integration's `enabled`
|
|
7542
|
+
* switch stays in the registry (a fixed builtin is switched through `integrations.update`, and
|
|
7543
|
+
* `integrations.list` never projects it from a record), and there is nothing to configure.
|
|
7544
|
+
*/
|
|
7545
|
+
var BlocksConnectionBodySchema = require_dist.entryBody({});
|
|
7546
|
+
var blocksConnectionsEntryKind = require_dist.defineEntryKind("connections", {
|
|
7547
|
+
title: "Blocks integration",
|
|
7548
|
+
schema: BlocksConnectionBodySchema,
|
|
7549
|
+
writeTrigger: "the hub declares the Blocks integration on boot"
|
|
7550
|
+
});
|
|
7551
|
+
var blocksInstanceRecordKinds = { connections: blocksConnectionsEntryKind };
|
|
7552
|
+
function buildBlocksInstances(records) {
|
|
7553
|
+
return new require_dist.RecordIntegrationInstances(records, blocksConnectionsEntryKind, {
|
|
7554
|
+
description: {
|
|
7555
|
+
role: "devices",
|
|
7556
|
+
discovery: {
|
|
7557
|
+
mode: "none",
|
|
7558
|
+
scopedToInstance: false
|
|
7559
|
+
},
|
|
7560
|
+
instanceMode: "single",
|
|
7561
|
+
kind: "blocks",
|
|
7562
|
+
canTest: false,
|
|
7563
|
+
kinds: [{
|
|
7564
|
+
id: "blocks",
|
|
7565
|
+
label: "Blocks",
|
|
7566
|
+
functionCap: "core-blocks",
|
|
7567
|
+
role: "devices"
|
|
7568
|
+
}]
|
|
7569
|
+
},
|
|
7570
|
+
formSchema: () => ({ sections: [] }),
|
|
7571
|
+
initialBody: (name) => ({ name }),
|
|
7572
|
+
configured: () => true,
|
|
7573
|
+
onChanged: () => void 0
|
|
7574
|
+
});
|
|
7575
|
+
}
|
|
7576
|
+
//#endregion
|
|
7388
7577
|
//#region src/builtins/core-blocks/composition-peers.ts
|
|
7389
7578
|
/**
|
|
7390
7579
|
* The stored compositions a save is judged against, as graph peers (D663,
|
|
@@ -8078,12 +8267,16 @@ var CoreBlocksAddon = class extends require_dist.BaseAddon {
|
|
|
8078
8267
|
seedFailed = /* @__PURE__ */ new Set();
|
|
8079
8268
|
/** The shared integration, or null when this node does not own it. */
|
|
8080
8269
|
blocksIntegrationId = null;
|
|
8270
|
+
/** The instance record the shared integration keeps (name only); built with the records. */
|
|
8271
|
+
blocksInstances = null;
|
|
8081
8272
|
async onInitialize() {
|
|
8082
8273
|
const settingsStore = this.ctx.api?.settingsStore;
|
|
8083
8274
|
if (!settingsStore) throw new Error("core-blocks: settings-store API not available — refusing to register the cap");
|
|
8084
8275
|
const records = this.ctx.records;
|
|
8085
8276
|
if (records === void 0) throw new Error("core-blocks needs ctx.records on the hub");
|
|
8086
8277
|
await records.declare(coreBlocksRecordKinds);
|
|
8278
|
+
await records.declare(blocksInstanceRecordKinds);
|
|
8279
|
+
this.blocksInstances = buildBlocksInstances(records);
|
|
8087
8280
|
await this.runMigrations(require_dist.defineAddonMigrations(ADDON_MIGRATIONS, coreBlocksMigrationPorts(records.kind(coreBlocksRecordKinds.blocks), this.ctx.logger.child("migrations"), () => Date.now())));
|
|
8088
8281
|
this.store = CoreBlockStore.of(records, this.ctx.logger.child("store"));
|
|
8089
8282
|
this.prefs = new BlockSettingsStore({
|
|
@@ -8150,6 +8343,10 @@ var CoreBlocksAddon = class extends require_dist.BaseAddon {
|
|
|
8150
8343
|
capability: require_dist.coreBlocksCapability,
|
|
8151
8344
|
provider: this.buildProvider()
|
|
8152
8345
|
},
|
|
8346
|
+
...this.blocksInstances === null ? [] : [{
|
|
8347
|
+
capability: require_dist.integrationInstancesCapability,
|
|
8348
|
+
provider: this.blocksInstances.toProvider()
|
|
8349
|
+
}],
|
|
8153
8350
|
{
|
|
8154
8351
|
capability: require_dist.actionsCapability,
|
|
8155
8352
|
provider: this.requireActions().service
|
|
@@ -8489,7 +8686,10 @@ var CoreBlocksAddon = class extends require_dist.BaseAddon {
|
|
|
8489
8686
|
skipRestart: true
|
|
8490
8687
|
});
|
|
8491
8688
|
},
|
|
8492
|
-
listOwnDevices: async () => api.deviceManager.listAll.query({ addonId: require_dist.CORE_BLOCKS_ADDON_ID })
|
|
8689
|
+
listOwnDevices: async () => api.deviceManager.listAll.query({ addonId: require_dist.CORE_BLOCKS_ADDON_ID }),
|
|
8690
|
+
seedInstance: async (seed) => {
|
|
8691
|
+
if (this.blocksInstances !== null) await require_dist.seedInstanceOnce(this.blocksInstances.toProvider(), seed);
|
|
8692
|
+
}
|
|
8493
8693
|
});
|
|
8494
8694
|
}
|
|
8495
8695
|
/**
|