@camstack/server 1.2.891 → 1.2.893
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 +22 -0
- package/dist/api/trpc/generated-cap-mounts.js +2 -1
- package/dist/api/trpc/generated-cap-routers.js +204 -39
- package/dist/core/addon/addon-registry.service.js +47 -0
- package/dist/core/addon/retire-undeclared-fixed-integrations.js +57 -0
- package/package.json +14 -15
- package/system/dist/addon-runner.js +25 -9
- package/system/dist/addon-runner.mjs +25 -9
- 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/addon.d.ts +65 -41
- package/system/dist/builtins/camera-grid/grid-blocks.d.ts +51 -0
- package/system/dist/builtins/camera-grid/grid-camera-device.d.ts +4 -3
- package/system/dist/builtins/camera-grid/grid-layout-native-provider.d.ts +3 -1
- package/system/dist/builtins/camera-grid/grid-plan.d.ts +3 -3
- package/system/dist/builtins/camera-grid/index.d.ts +2 -6
- package/system/dist/builtins/camera-grid/index.js +431 -727
- package/system/dist/builtins/camera-grid/index.mjs +428 -719
- package/system/dist/builtins/composer/composed-device.d.ts +12 -2
- package/system/dist/builtins/composer/composer.addon.js +28 -10
- package/system/dist/builtins/composer/composer.addon.mjs +28 -10
- package/system/dist/builtins/composer/composition-declarations.d.ts +3 -1
- 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/core-blocks.addon.js +174 -39
- package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +175 -40
- package/system/dist/builtins/core-blocks/hero-layout-service.d.ts +19 -1
- package/system/dist/builtins/core-blocks/power-source-devices.d.ts +9 -0
- package/system/dist/builtins/core-blocks/power-source-service.d.ts +39 -2
- 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-identifiers-action.d.ts +9 -0
- package/system/dist/builtins/device-manager/device-identity-index.d.ts +73 -0
- package/system/dist/builtins/device-manager/device-manager.addon.js +401 -14
- package/system/dist/builtins/device-manager/device-manager.addon.mjs +401 -14
- package/system/dist/builtins/device-manager/device-meta-types.d.ts +5 -1
- package/system/dist/builtins/device-manager/device-row-store.d.ts +7 -3
- package/system/dist/builtins/device-manager/device-state-mirror.d.ts +7 -0
- package/system/dist/builtins/device-manager/workload-transition.d.ts +23 -0
- 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 +3 -3
- package/system/dist/builtins/local-network/local-network.addon.mjs +3 -3
- 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 +3 -3
- 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-nmelnj-Y.mjs → capture-engine-CIVKm_jN.mjs} +1 -1
- package/system/dist/{capture-engine-DXz37Mjg.js → capture-engine-mZ2J-GD6.js} +1 -1
- package/system/dist/{composition-sources-BLn3cU74.js → composition-sources-CGP5ZUYo.js} +1 -1
- package/system/dist/{composition-sources-uphZtYtN.mjs → composition-sources-bJP8_Z2o.mjs} +1 -1
- package/system/dist/{constants-BAaGwvKn.js → constants-BD8oSQro.js} +1 -1
- package/system/dist/{constants-DWU46D02.mjs → constants-w-6vvTPp.mjs} +1 -1
- package/system/dist/{device-ca-jbH_rqZh.js → device-ca-CXxnQaff.js} +1 -1
- package/system/dist/{device-ca-CK6mLB2w.mjs → device-ca-DE_oetBE.mjs} +1 -1
- package/system/dist/{dist-m5beNMze.js → dist-B2-Uflhy.js} +2573 -443
- package/system/dist/{dist-Dgq9nuvh.mjs → dist-Be8yFd71.mjs} +2460 -444
- package/system/dist/file-host-worker.js +1 -1
- package/system/dist/file-host-worker.mjs +1 -1
- package/system/dist/{hub-identity-CKCA89XP.js → hub-identity-BjYvJU_v.js} +1 -1
- package/system/dist/{hub-identity-DlBBoHJC.mjs → hub-identity-C3g7b58L.mjs} +1 -1
- package/system/dist/{hub-mdns-ciao-CqcCGPdi.js → hub-mdns-ciao-BRfv9GfW.js} +2 -2
- package/system/dist/{hub-mdns-ciao-B8uFW-RG.mjs → hub-mdns-ciao-v6X_SbWl.mjs} +2 -2
- package/system/dist/index.js +33 -19
- package/system/dist/index.mjs +33 -19
- package/system/dist/kernel/moleculer/child-cap-dispatch.d.ts +3 -6
- package/system/dist/kernel/moleculer/switch-toggle.d.ts +7 -2
- package/system/dist/{legacy-integration-rows-door-Co0gj1Lm.js → legacy-integration-rows-door-B0q34gh3.js} +1 -1
- package/system/dist/{legacy-integration-rows-door-HI4nmSe_.mjs → legacy-integration-rows-door-DG35DG06.mjs} +1 -1
- package/system/dist/{rename-composition-block-UeVUYCwx.js → rename-composition-block-DNte3Cs9.js} +1 -1
- package/system/dist/{rename-composition-block-BthBMrXA.mjs → rename-composition-block-LEbZ4oZE.mjs} +1 -1
- package/system/dist/{restore-archive-P-ICnU58.mjs → restore-archive--4ENkU5f.mjs} +1 -1
- package/system/dist/{restore-archive-CJLsfBwK.js → restore-archive-DpFPheMK.js} +1 -1
- package/system/dist/{wal-maintenance-CUtwx-2Z.js → wal-maintenance-BWUJktqT.js} +0 -0
- package/system/dist/{wal-maintenance-qWjb7_f2.mjs → wal-maintenance-DQVDhuVJ.mjs} +0 -0
- package/system/package.json +2 -5
- package/system/dist/builtins/camera-grid/grid-camera-declarations.d.ts +0 -59
- package/system/dist/builtins/camera-grid/grid-instances.d.ts +0 -40
- package/system/dist/builtins/camera-grid/grid-record-kinds.d.ts +0 -31
- package/system/dist/builtins/camera-grid/migrations/__fixtures__/seed.d.ts +0 -13
- package/system/dist/builtins/camera-grid/migrations/camera-grids-to-records.d.ts +0 -26
- package/system/dist/builtins/camera-grid/migrations/index.d.ts +0 -6
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseDevice, type CapabilityDefinition, type DeviceConstructor, type DeviceContext, type DeviceFeature, DeviceType, type GroupCommandResult, type IDevice, type ReadingQuantity } from "@camstack/types";
|
|
1
|
+
import { BaseDevice, type CapabilityDefinition, type DeviceConstructor, type DeviceContext, type DeviceStatusOwnership, type DeviceFeature, DeviceType, type GroupCommandResult, type IDevice, type ReadingQuantity } from "@camstack/types";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import type { ComposedWriteTarget, WriteOutcome } from "./composition-runtime.js";
|
|
4
4
|
import type { SlicePatch } from "./slice-assembler.js";
|
|
@@ -25,7 +25,7 @@ export declare class ComposedDevice extends BaseDevice<typeof COMPOSED_DEVICE_CO
|
|
|
25
25
|
get userNamed(): boolean;
|
|
26
26
|
get features(): readonly DeviceFeature[];
|
|
27
27
|
syncBoundFeatures(features: readonly DeviceFeature[]): void;
|
|
28
|
-
constructor(ctx: DeviceContext, type: DeviceType, caps: readonly CapabilityDefinition[]);
|
|
28
|
+
constructor(ctx: DeviceContext, type: DeviceType, caps: readonly CapabilityDefinition[], deviceStatus?: DeviceStatusOwnership);
|
|
29
29
|
/**
|
|
30
30
|
* The methods of a BUILT cap are commands (D967): each one is dispatched under
|
|
31
31
|
* its own name and the composer's forwards decide what it calls. A method the
|
|
@@ -75,6 +75,16 @@ export declare function composedDeviceClass(type: DeviceType, caps: readonly Cap
|
|
|
75
75
|
* ROW's (`deviceMeta.type`) — only ever adopted from an existing row, where the
|
|
76
76
|
* row is canonical — because there is no plan to take one from.
|
|
77
77
|
*/
|
|
78
|
+
/**
|
|
79
|
+
* The composer's device on an ENGINE-HOSTED row (Camera grid, Terminal camera —
|
|
80
|
+
* planning#580). The composer owns the row, its name and its lifetime; the
|
|
81
|
+
* engine serves every camera cap on it as a cross-addon native (D663) and is
|
|
82
|
+
* the only writer of its `device-status`. This device registers no cap and
|
|
83
|
+
* never writes availability.
|
|
84
|
+
*/
|
|
85
|
+
export declare class EngineHostedComposedDevice extends ComposedDevice {
|
|
86
|
+
constructor(ctx: DeviceContext);
|
|
87
|
+
}
|
|
78
88
|
export declare class ComposedPlaceholderDevice extends ComposedDevice {
|
|
79
89
|
constructor(ctx: DeviceContext);
|
|
80
90
|
}
|
|
@@ -3,11 +3,11 @@ 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-B2-Uflhy.js");
|
|
7
|
+
const require_composition_sources = require("../../composition-sources-CGP5ZUYo.js");
|
|
8
|
+
const require_capture_engine = require("../../capture-engine-mZ2J-GD6.js");
|
|
9
9
|
const require_retention = require("../../retention-BcOSL6b9.js");
|
|
10
|
-
const require_rename_composition_block = require("../../rename-composition-block-
|
|
10
|
+
const require_rename_composition_block = require("../../rename-composition-block-DNte3Cs9.js");
|
|
11
11
|
let zod = require("zod");
|
|
12
12
|
//#region src/builtins/composer/actuator-invoke.ts
|
|
13
13
|
/**
|
|
@@ -178,8 +178,11 @@ var ComposedDevice = class extends require_dist.BaseDevice {
|
|
|
178
178
|
this.boundFeatures = [...features];
|
|
179
179
|
this.refreshFeatures();
|
|
180
180
|
}
|
|
181
|
-
constructor(ctx, type, caps) {
|
|
182
|
-
super(ctx, COMPOSED_DEVICE_CONFIG_SCHEMA, {
|
|
181
|
+
constructor(ctx, type, caps, deviceStatus = "own") {
|
|
182
|
+
super(ctx, COMPOSED_DEVICE_CONFIG_SCHEMA, {
|
|
183
|
+
type,
|
|
184
|
+
deviceStatus
|
|
185
|
+
});
|
|
183
186
|
this.derivesWater = type === require_dist.DeviceType.PetFountain;
|
|
184
187
|
for (const cap of caps) {
|
|
185
188
|
if (cap.name === require_dist.motionCapability.name) {
|
|
@@ -443,6 +446,18 @@ function composedDeviceClass(type, caps) {
|
|
|
443
446
|
* ROW's (`deviceMeta.type`) — only ever adopted from an existing row, where the
|
|
444
447
|
* row is canonical — because there is no plan to take one from.
|
|
445
448
|
*/
|
|
449
|
+
/**
|
|
450
|
+
* The composer's device on an ENGINE-HOSTED row (Camera grid, Terminal camera —
|
|
451
|
+
* planning#580). The composer owns the row, its name and its lifetime; the
|
|
452
|
+
* engine serves every camera cap on it as a cross-addon native (D663) and is
|
|
453
|
+
* the only writer of its `device-status`. This device registers no cap and
|
|
454
|
+
* never writes availability.
|
|
455
|
+
*/
|
|
456
|
+
var EngineHostedComposedDevice = class extends ComposedDevice {
|
|
457
|
+
constructor(ctx) {
|
|
458
|
+
super(ctx, require_dist.DeviceType.Camera, [], "external");
|
|
459
|
+
}
|
|
460
|
+
};
|
|
446
461
|
var ComposedPlaceholderDevice = class extends ComposedDevice {
|
|
447
462
|
constructor(ctx) {
|
|
448
463
|
super(ctx, ctx.deviceMeta.type, []);
|
|
@@ -1680,16 +1695,17 @@ function declarationFor(input) {
|
|
|
1680
1695
|
stableId: require_dist.composedDeviceStableId(input.blockId),
|
|
1681
1696
|
name: input.name,
|
|
1682
1697
|
type: input.target.type,
|
|
1683
|
-
DeviceClass: composedDeviceClass(input.target.type, input.caps),
|
|
1698
|
+
DeviceClass: input.hosted ? EngineHostedComposedDevice : composedDeviceClass(input.target.type, input.caps),
|
|
1684
1699
|
...input.target.role === void 0 ? {} : { role: input.target.role }
|
|
1685
1700
|
};
|
|
1686
1701
|
}
|
|
1687
|
-
/** What forces a rebuild of the live device: type, role, cap set. Never the name. */
|
|
1702
|
+
/** What forces a rebuild of the live device: type, role, cap set, who hosts it. Never the name. */
|
|
1688
1703
|
function shapeOf(input) {
|
|
1689
1704
|
return JSON.stringify([
|
|
1690
1705
|
input.target.type,
|
|
1691
1706
|
input.target.role ?? null,
|
|
1692
|
-
input.caps.map((c) => c.name).toSorted()
|
|
1707
|
+
input.caps.map((c) => c.name).toSorted(),
|
|
1708
|
+
...input.hosted ? ["hosted"] : []
|
|
1693
1709
|
]);
|
|
1694
1710
|
}
|
|
1695
1711
|
/**
|
|
@@ -1843,11 +1859,13 @@ function planNew(block, target, lookupCap, rows) {
|
|
|
1843
1859
|
const def = lookupCap(f.cap);
|
|
1844
1860
|
return def === null ? [] : [def];
|
|
1845
1861
|
});
|
|
1862
|
+
const hosted = composition.helper !== void 0 && require_dist.isEngineHostedHelper(composition.helper);
|
|
1846
1863
|
const declarationInput = {
|
|
1847
1864
|
blockId: block.id,
|
|
1848
1865
|
name: block.name,
|
|
1849
1866
|
target,
|
|
1850
|
-
caps
|
|
1867
|
+
caps,
|
|
1868
|
+
hosted
|
|
1851
1869
|
};
|
|
1852
1870
|
return {
|
|
1853
1871
|
block,
|
|
@@ -1,8 +1,8 @@
|
|
|
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 { Aa as parseColorInput, Al as isReadingQuantity, As as DEFAULT_HISTORY_RETENTION, Bs as cloneStatefulExpressionMemory, Co as runFanOut, Ds as COMPOSER_ADDON_ID, Dt as HvacModeSchema, Er as coverCapability, Fa as planComposition, Fs as MINUTE_MS, Gs as compositionSliceKey, Hs as composedDeviceStableId, Jn as buildCapabilityLookup, Js as disarmRoseMemory, Ki as kebabToCamel, Kn as brightnessCapability, Ks as compositionSourceKey, Lo as sharedActuatorFeatures, M as ConsumableItemSchema, Ma as petFountainCapability, Mr as declaredSeriesKind, Ms as HISTORY_SLOW_MS, Na as petFountainWaterItem, Ns as HOUR_MS, Qr as evaluateCompositionField, Qs as historyRetentionFromSettings, Ro as sharedActuatorMethods, Ss as withDefaultRunning, Us as compositionFeatureEnabled, Vs as composedDeviceRef, Wa as processTimeZoneOr, Ws as compositionItemFieldPath, Xs as evaluateStatistic, Ys as evaluateDerivative, _o as resolveMutate, _r as compositionFieldKey, _s as valveCapability, _t as FanDirectionSchema, ac as openReset, bi as groupTemplate, br as consumablesCapability, cc as planStatisticTier, ci as fanOutTargets, du as DeviceType, ec as integrateReading, fc as BaseAddon, fr as colorCapability, fu as errMsg, gr as composerCapability, i as ACTUATOR_TEMPLATE_IDS, ic as nextLocalMidnight, js as HISTORY_FAST_MS, la as mediaPlayerCapability, lc as statisticCadenceMs, ll as createEvent, lr as climateControlCapability, mu as EventCategory, na as lockControlCapability, nc as isForwardInputRef, nt as DeclaredDevices, oc as openStatistic, pa as methodRefusal, pu as featuresOfBoundCaps, qs as createStatefulExpressionMemory, qt as PetFountainStatusSchema, r as ACTUATOR_METHODS, rc as isHistoryHelper, ri as expressionContainsBuiltinCall, s as ALL_CAPABILITY_DEFINITIONS, sc as planResetTier, si as fanControlCapability, tc as isEngineHostedHelper, ts as switchCapability, ua as mediaPlayerFeaturesOfRoles, uc as toExpressionValue, ui as featureForwards, v as BaseDevice, va as motionCapability, w as COMPOSED_ITEM_FIXED_FIELDS, xt as GroupCommandResultSchema, yi as groupCommandsCapability, zo as sharedColorModes } from "../../dist-Be8yFd71.mjs";
|
|
2
|
+
import { i as parseDeviceStateChanged, n as normalizedNativeOwner, r as isRecord$4 } from "../../composition-sources-bJP8_Z2o.mjs";
|
|
3
|
+
import { i as capSeriesKey } from "../../capture-engine-CIVKm_jN.mjs";
|
|
4
4
|
import { i as DAY_MS, t as DEFAULT_RETENTION } from "../../retention-CUOVI1p7.mjs";
|
|
5
|
-
import { n as renameCompositionBlock } from "../../rename-composition-block-
|
|
5
|
+
import { n as renameCompositionBlock } from "../../rename-composition-block-LEbZ4oZE.mjs";
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
//#region src/builtins/composer/actuator-invoke.ts
|
|
8
8
|
/**
|
|
@@ -173,8 +173,11 @@ var ComposedDevice = class extends BaseDevice {
|
|
|
173
173
|
this.boundFeatures = [...features];
|
|
174
174
|
this.refreshFeatures();
|
|
175
175
|
}
|
|
176
|
-
constructor(ctx, type, caps) {
|
|
177
|
-
super(ctx, COMPOSED_DEVICE_CONFIG_SCHEMA, {
|
|
176
|
+
constructor(ctx, type, caps, deviceStatus = "own") {
|
|
177
|
+
super(ctx, COMPOSED_DEVICE_CONFIG_SCHEMA, {
|
|
178
|
+
type,
|
|
179
|
+
deviceStatus
|
|
180
|
+
});
|
|
178
181
|
this.derivesWater = type === DeviceType.PetFountain;
|
|
179
182
|
for (const cap of caps) {
|
|
180
183
|
if (cap.name === motionCapability.name) {
|
|
@@ -438,6 +441,18 @@ function composedDeviceClass(type, caps) {
|
|
|
438
441
|
* ROW's (`deviceMeta.type`) — only ever adopted from an existing row, where the
|
|
439
442
|
* row is canonical — because there is no plan to take one from.
|
|
440
443
|
*/
|
|
444
|
+
/**
|
|
445
|
+
* The composer's device on an ENGINE-HOSTED row (Camera grid, Terminal camera —
|
|
446
|
+
* planning#580). The composer owns the row, its name and its lifetime; the
|
|
447
|
+
* engine serves every camera cap on it as a cross-addon native (D663) and is
|
|
448
|
+
* the only writer of its `device-status`. This device registers no cap and
|
|
449
|
+
* never writes availability.
|
|
450
|
+
*/
|
|
451
|
+
var EngineHostedComposedDevice = class extends ComposedDevice {
|
|
452
|
+
constructor(ctx) {
|
|
453
|
+
super(ctx, DeviceType.Camera, [], "external");
|
|
454
|
+
}
|
|
455
|
+
};
|
|
441
456
|
var ComposedPlaceholderDevice = class extends ComposedDevice {
|
|
442
457
|
constructor(ctx) {
|
|
443
458
|
super(ctx, ctx.deviceMeta.type, []);
|
|
@@ -1675,16 +1690,17 @@ function declarationFor(input) {
|
|
|
1675
1690
|
stableId: composedDeviceStableId(input.blockId),
|
|
1676
1691
|
name: input.name,
|
|
1677
1692
|
type: input.target.type,
|
|
1678
|
-
DeviceClass: composedDeviceClass(input.target.type, input.caps),
|
|
1693
|
+
DeviceClass: input.hosted ? EngineHostedComposedDevice : composedDeviceClass(input.target.type, input.caps),
|
|
1679
1694
|
...input.target.role === void 0 ? {} : { role: input.target.role }
|
|
1680
1695
|
};
|
|
1681
1696
|
}
|
|
1682
|
-
/** What forces a rebuild of the live device: type, role, cap set. Never the name. */
|
|
1697
|
+
/** What forces a rebuild of the live device: type, role, cap set, who hosts it. Never the name. */
|
|
1683
1698
|
function shapeOf(input) {
|
|
1684
1699
|
return JSON.stringify([
|
|
1685
1700
|
input.target.type,
|
|
1686
1701
|
input.target.role ?? null,
|
|
1687
|
-
input.caps.map((c) => c.name).toSorted()
|
|
1702
|
+
input.caps.map((c) => c.name).toSorted(),
|
|
1703
|
+
...input.hosted ? ["hosted"] : []
|
|
1688
1704
|
]);
|
|
1689
1705
|
}
|
|
1690
1706
|
/**
|
|
@@ -1838,11 +1854,13 @@ function planNew(block, target, lookupCap, rows) {
|
|
|
1838
1854
|
const def = lookupCap(f.cap);
|
|
1839
1855
|
return def === null ? [] : [def];
|
|
1840
1856
|
});
|
|
1857
|
+
const hosted = composition.helper !== void 0 && isEngineHostedHelper(composition.helper);
|
|
1841
1858
|
const declarationInput = {
|
|
1842
1859
|
blockId: block.id,
|
|
1843
1860
|
name: block.name,
|
|
1844
1861
|
target,
|
|
1845
|
-
caps
|
|
1862
|
+
caps,
|
|
1863
|
+
hosted
|
|
1846
1864
|
};
|
|
1847
1865
|
return {
|
|
1848
1866
|
block,
|
|
@@ -15,9 +15,11 @@ export interface ComposerDeclarationInput {
|
|
|
15
15
|
readonly name: string;
|
|
16
16
|
readonly target: CompositionNewTarget;
|
|
17
17
|
readonly caps: readonly CapabilityDefinition[];
|
|
18
|
+
/** An engine serves this row's caps and status (a grid or terminal helper, planning#580). */
|
|
19
|
+
readonly hosted: boolean;
|
|
18
20
|
}
|
|
19
21
|
export declare function declarationFor(input: ComposerDeclarationInput): DeviceDeclaration;
|
|
20
|
-
/** What forces a rebuild of the live device: type, role, cap set. Never the name. */
|
|
22
|
+
/** What forces a rebuild of the live device: type, role, cap set, who hosts it. Never the name. */
|
|
21
23
|
export declare function shapeOf(input: ComposerDeclarationInput): string;
|
|
22
24
|
/**
|
|
23
25
|
* The numeric id of the live composed device behind a stableId, or null when
|
|
@@ -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-B2-Uflhy.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 { fc as BaseAddon, ia as logDestinationCapability } from "../../dist-Be8yFd71.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 = {
|
|
@@ -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-B2-Uflhy.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-CGP5ZUYo.js");
|
|
6
|
+
const require_capture_engine = require("../../capture-engine-mZ2J-GD6.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
|
const require_cap_call_scope = require("../../cap-call-scope-8eiugfLl.js");
|
|
@@ -4111,10 +4111,23 @@ function buildActionsRuntime(deps) {
|
|
|
4111
4111
|
* The link and the off time are read from the STORED composition on each call
|
|
4112
4112
|
* (D676), never cached as a second copy. A forced restart is switch off now,
|
|
4113
4113
|
* switch on after `offSeconds`, through an injected scheduler so a spec drives
|
|
4114
|
-
* the clock; the pending switch-on is cancelled on `stop()`.
|
|
4114
|
+
* the clock; the pending switch-on is cancelled on `stop()`. A switch that declares
|
|
4115
|
+
* a native power cycle (a PoE port) is cycled in one call instead, and never
|
|
4116
|
+
* switched off or on. A switch that ANSWERED it only reports (D1058) is never
|
|
4117
|
+
* switched on or off: power on / off are refused as `not-settable`, and `getStatus`
|
|
4118
|
+
* says so (`switchSettable`) for the surfaces that withdraw them.
|
|
4115
4119
|
*
|
|
4116
4120
|
* Every refusal is a typed result with its reason, logged with the device tag.
|
|
4117
4121
|
*/
|
|
4122
|
+
/** `switch.getOptions` FAILED (not absent): what the switch can do is unknown. */
|
|
4123
|
+
var SwitchOptionsUnreadableError = class extends Error {
|
|
4124
|
+
switchDeviceId;
|
|
4125
|
+
constructor(switchDeviceId, cause) {
|
|
4126
|
+
super(`switch ${switchDeviceId}: its options could not be read (${cause instanceof Error ? cause.message : String(cause)}); not power-cycling and not switching it off blind`);
|
|
4127
|
+
this.name = "SwitchOptionsUnreadableError";
|
|
4128
|
+
this.switchDeviceId = switchDeviceId;
|
|
4129
|
+
}
|
|
4130
|
+
};
|
|
4118
4131
|
var timeoutScheduler = { schedule: (delayMs, fire) => {
|
|
4119
4132
|
const handle = setTimeout(fire, delayMs);
|
|
4120
4133
|
return { cancel: () => clearTimeout(handle) };
|
|
@@ -4124,28 +4137,40 @@ var PowerSourceService = class {
|
|
|
4124
4137
|
deps;
|
|
4125
4138
|
/** Restarts whose switch-on has not run yet, by device id. */
|
|
4126
4139
|
restarting = /* @__PURE__ */ new Map();
|
|
4140
|
+
/**
|
|
4141
|
+
* Devices whose switch-options read is failing now: warned once per streak, cleared by a
|
|
4142
|
+
* success or when the device is no longer linked. A removed device leaves at most one bare id
|
|
4143
|
+
* behind (this service has no removal hook); the set dies with the process.
|
|
4144
|
+
*/
|
|
4145
|
+
optionsReadFailing = /* @__PURE__ */ new Set();
|
|
4127
4146
|
constructor(deps) {
|
|
4128
4147
|
this.deps = deps;
|
|
4129
4148
|
}
|
|
4130
4149
|
getStatus = async ({ deviceId }) => {
|
|
4131
4150
|
const link = await this.linkOf(deviceId);
|
|
4132
|
-
if (link === null)
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
|
|
4151
|
+
if (link === null) {
|
|
4152
|
+
this.optionsReadFailing.delete(deviceId);
|
|
4153
|
+
return {
|
|
4154
|
+
linked: false,
|
|
4155
|
+
switchDeviceId: null,
|
|
4156
|
+
switchName: null,
|
|
4157
|
+
switchOn: null,
|
|
4158
|
+
switchOnline: null,
|
|
4159
|
+
switchSettable: null,
|
|
4160
|
+
restartInProgress: false,
|
|
4161
|
+
offSeconds: 0
|
|
4162
|
+
};
|
|
4163
|
+
}
|
|
4141
4164
|
const switchDevice = await this.deps.devices.find(link.switch).catch(() => null);
|
|
4142
4165
|
const switchOn = switchDevice === null ? null : await this.deps.devices.readOn(switchDevice.id).catch(() => null);
|
|
4166
|
+
const switchSettable = switchDevice === null ? null : await this.settableOf(deviceId, switchDevice.id);
|
|
4143
4167
|
return {
|
|
4144
4168
|
linked: true,
|
|
4145
4169
|
switchDeviceId: switchDevice?.id ?? null,
|
|
4146
4170
|
switchName: switchDevice?.name ?? link.switch.stableId,
|
|
4147
4171
|
switchOn,
|
|
4148
4172
|
switchOnline: switchDevice?.online ?? null,
|
|
4173
|
+
switchSettable,
|
|
4149
4174
|
restartInProgress: this.restarting.has(deviceId),
|
|
4150
4175
|
offSeconds: link.offSeconds
|
|
4151
4176
|
};
|
|
@@ -4167,6 +4192,28 @@ var PowerSourceService = class {
|
|
|
4167
4192
|
const { link, switchDevice } = lookup.resolved;
|
|
4168
4193
|
const switchId = switchDevice.id;
|
|
4169
4194
|
pending.switchId = switchId;
|
|
4195
|
+
const cycle = this.deps.devices.cycle;
|
|
4196
|
+
if (cycle !== void 0) {
|
|
4197
|
+
let cycled;
|
|
4198
|
+
try {
|
|
4199
|
+
cycled = await cycle(switchId);
|
|
4200
|
+
} catch (err) {
|
|
4201
|
+
this.restarting.delete(deviceId);
|
|
4202
|
+
const reason = err instanceof SwitchOptionsUnreadableError ? "switch-options-unreadable" : "switch-call-failed";
|
|
4203
|
+
return this.refuse(deviceId, reason, errorText$3(err), switchId);
|
|
4204
|
+
}
|
|
4205
|
+
if (cycled) {
|
|
4206
|
+
this.restarting.delete(deviceId);
|
|
4207
|
+
this.deps.logger.info("power-source: forced restart through the switch’s native power cycle", {
|
|
4208
|
+
tags: { deviceId },
|
|
4209
|
+
meta: {
|
|
4210
|
+
switchId,
|
|
4211
|
+
switchName: switchDevice.name
|
|
4212
|
+
}
|
|
4213
|
+
});
|
|
4214
|
+
return ACCEPTED;
|
|
4215
|
+
}
|
|
4216
|
+
}
|
|
4170
4217
|
try {
|
|
4171
4218
|
await this.deps.devices.setOn(switchId, false);
|
|
4172
4219
|
} catch (err) {
|
|
@@ -4221,6 +4268,7 @@ var PowerSourceService = class {
|
|
|
4221
4268
|
const lookup = await this.lookup(deviceId);
|
|
4222
4269
|
if (lookup.kind === "refused") return this.refuse(deviceId, lookup.reason, lookup.message, null);
|
|
4223
4270
|
const { switchDevice } = lookup.resolved;
|
|
4271
|
+
if (await this.settableOf(deviceId, switchDevice.id) === false) return this.refuse(deviceId, "not-settable", `the switch ${switchDevice.name} only reports its state; it cannot be switched ${on ? "on" : "off"}`, switchDevice.id);
|
|
4224
4272
|
try {
|
|
4225
4273
|
await this.deps.devices.setOn(switchDevice.id, on);
|
|
4226
4274
|
} catch (err) {
|
|
@@ -4235,6 +4283,32 @@ var PowerSourceService = class {
|
|
|
4235
4283
|
});
|
|
4236
4284
|
return ACCEPTED;
|
|
4237
4285
|
}
|
|
4286
|
+
/**
|
|
4287
|
+
* Whether the switch can be set: `true` for a plain switch (no options reader, or a provider
|
|
4288
|
+
* without `getOptions`), `null` when the read FAILED — never `false` for unknown. Every hero
|
|
4289
|
+
* build reads `getStatus`, so a failing read warns once per device per failure streak (tagged);
|
|
4290
|
+
* a successful read ends the streak.
|
|
4291
|
+
*/
|
|
4292
|
+
async settableOf(deviceId, switchId) {
|
|
4293
|
+
const options = this.deps.devices.options;
|
|
4294
|
+
if (options === void 0) return true;
|
|
4295
|
+
try {
|
|
4296
|
+
const settable = (await options(switchId)).supportsSetState;
|
|
4297
|
+
this.optionsReadFailing.delete(deviceId);
|
|
4298
|
+
return settable;
|
|
4299
|
+
} catch (err) {
|
|
4300
|
+
if (this.optionsReadFailing.has(deviceId)) return null;
|
|
4301
|
+
this.optionsReadFailing.add(deviceId);
|
|
4302
|
+
this.deps.logger.warn("power-source: the switch options could not be read; settable unknown", {
|
|
4303
|
+
tags: { deviceId },
|
|
4304
|
+
meta: {
|
|
4305
|
+
switchId,
|
|
4306
|
+
error: errorText$3(err)
|
|
4307
|
+
}
|
|
4308
|
+
});
|
|
4309
|
+
return null;
|
|
4310
|
+
}
|
|
4311
|
+
}
|
|
4238
4312
|
/** The link and the switch, or the reason there is nothing to act on. Reads the switch state: unknown is refused. */
|
|
4239
4313
|
async lookup(deviceId) {
|
|
4240
4314
|
const stored = await this.storedLinkOf(deviceId);
|
|
@@ -6207,6 +6281,8 @@ var RemoteComponentsService = class {
|
|
|
6207
6281
|
* count comes from the remote cap and is `null` when it cannot be asked.
|
|
6208
6282
|
*/
|
|
6209
6283
|
var REMOTE_CAP = "remote";
|
|
6284
|
+
var SWITCH_CAP = "switch";
|
|
6285
|
+
var POWER_SOURCE_CAP = "power-source";
|
|
6210
6286
|
/** Models built at once for a list; the cap bounds the list, this bounds the fan-out on the registry. */
|
|
6211
6287
|
var ROW_MODELS_CONCURRENCY = 16;
|
|
6212
6288
|
var HeroLayoutService = class {
|
|
@@ -6241,6 +6317,8 @@ var HeroLayoutService = class {
|
|
|
6241
6317
|
}
|
|
6242
6318
|
}));
|
|
6243
6319
|
const remoteCommands = await this.remoteCommands(deviceId);
|
|
6320
|
+
const switchOptions = bound.includes(SWITCH_CAP) ? await this.switchOptions(deviceId) : void 0;
|
|
6321
|
+
const powerSupplySettable = bound.includes(POWER_SOURCE_CAP) ? await this.powerSupplySettable(deviceId) : null;
|
|
6244
6322
|
return require_dist.buildHeroModel({
|
|
6245
6323
|
device: {
|
|
6246
6324
|
id: deviceId,
|
|
@@ -6256,7 +6334,9 @@ var HeroLayoutService = class {
|
|
|
6256
6334
|
slices,
|
|
6257
6335
|
now: this.deps.now(),
|
|
6258
6336
|
remoteCommands,
|
|
6259
|
-
access: { canActuate: canActuate ?? true }
|
|
6337
|
+
access: { canActuate: canActuate ?? true },
|
|
6338
|
+
...switchOptions !== void 0 ? { switchOptions } : {},
|
|
6339
|
+
powerSupplySettable
|
|
6260
6340
|
});
|
|
6261
6341
|
};
|
|
6262
6342
|
/**
|
|
@@ -6289,6 +6369,34 @@ var HeroLayoutService = class {
|
|
|
6289
6369
|
return null;
|
|
6290
6370
|
}
|
|
6291
6371
|
}
|
|
6372
|
+
/**
|
|
6373
|
+
* What the switch can do. A provider without `getOptions` answers the defaults through the
|
|
6374
|
+
* reader; a read that FAILED is unknown — the hero draws on/off, as before (D315) — and is
|
|
6375
|
+
* logged with the device.
|
|
6376
|
+
*/
|
|
6377
|
+
async switchOptions(deviceId) {
|
|
6378
|
+
try {
|
|
6379
|
+
return await this.deps.reader.switchOptions(deviceId);
|
|
6380
|
+
} catch (error) {
|
|
6381
|
+
this.deps.logger.warn("hero model: the switch options could not be read; on/off drawn", {
|
|
6382
|
+
tags: { deviceId },
|
|
6383
|
+
meta: { error: error instanceof Error ? error.message : String(error) }
|
|
6384
|
+
});
|
|
6385
|
+
return;
|
|
6386
|
+
}
|
|
6387
|
+
}
|
|
6388
|
+
/** Whether the supply's switch can be set; a failed read is unknown (on/off drawn), logged. */
|
|
6389
|
+
async powerSupplySettable(deviceId) {
|
|
6390
|
+
try {
|
|
6391
|
+
return await this.deps.reader.powerSupplySettable(deviceId);
|
|
6392
|
+
} catch (error) {
|
|
6393
|
+
this.deps.logger.warn("hero model: the power supply status could not be read; power on/off drawn", {
|
|
6394
|
+
tags: { deviceId },
|
|
6395
|
+
meta: { error: error instanceof Error ? error.message : String(error) }
|
|
6396
|
+
});
|
|
6397
|
+
return null;
|
|
6398
|
+
}
|
|
6399
|
+
}
|
|
6292
6400
|
async remoteCommands(deviceId) {
|
|
6293
6401
|
try {
|
|
6294
6402
|
return await this.deps.reader.remoteCommands(deviceId);
|
|
@@ -6413,6 +6521,54 @@ async function seedLockDoors(deps) {
|
|
|
6413
6521
|
}
|
|
6414
6522
|
}
|
|
6415
6523
|
//#endregion
|
|
6524
|
+
//#region src/builtins/core-blocks/power-source-devices.ts
|
|
6525
|
+
/**
|
|
6526
|
+
* The devices `power-source` acts on, reached over `ctx.api`: the linked switch is read,
|
|
6527
|
+
* set, and — when its provider declares a native power cycle — cycled in one call.
|
|
6528
|
+
*/
|
|
6529
|
+
/** The switch's options; the defaults when its provider has no `getOptions`; throws typed when the read failed. */
|
|
6530
|
+
async function switchOptionsOf(api, deviceId) {
|
|
6531
|
+
try {
|
|
6532
|
+
return await api.switch.getOptions.query({ deviceId });
|
|
6533
|
+
} catch (err) {
|
|
6534
|
+
if ((0, _camstack_types_addon.isCapMethodAbsent)(err)) return require_dist.SWITCH_DEFAULT_OPTIONS;
|
|
6535
|
+
throw new SwitchOptionsUnreadableError(deviceId, err);
|
|
6536
|
+
}
|
|
6537
|
+
}
|
|
6538
|
+
function powerSourceDevicesOver(requireApi) {
|
|
6539
|
+
return {
|
|
6540
|
+
find: async (ref) => {
|
|
6541
|
+
const row = (await requireApi().deviceManager.listAll.query({
|
|
6542
|
+
addonId: ref.addonId,
|
|
6543
|
+
projection: "slim"
|
|
6544
|
+
})).find((r) => r.stableId === ref.stableId);
|
|
6545
|
+
return row === void 0 ? null : {
|
|
6546
|
+
id: row.id,
|
|
6547
|
+
name: row.name,
|
|
6548
|
+
online: row.online
|
|
6549
|
+
};
|
|
6550
|
+
},
|
|
6551
|
+
readOn: async (deviceId) => {
|
|
6552
|
+
const status = await requireApi().switch.getStatus.query({ deviceId });
|
|
6553
|
+
const on = status !== null && typeof status === "object" ? Reflect.get(status, "on") : void 0;
|
|
6554
|
+
return typeof on === "boolean" ? on : null;
|
|
6555
|
+
},
|
|
6556
|
+
setOn: async (deviceId, on) => {
|
|
6557
|
+
await requireApi().switch.setState.mutate({
|
|
6558
|
+
deviceId,
|
|
6559
|
+
on
|
|
6560
|
+
});
|
|
6561
|
+
},
|
|
6562
|
+
options: (deviceId) => switchOptionsOf(requireApi(), deviceId),
|
|
6563
|
+
cycle: async (deviceId) => {
|
|
6564
|
+
const api = requireApi();
|
|
6565
|
+
if (!(await switchOptionsOf(api, deviceId)).supportsPowerCycle) return false;
|
|
6566
|
+
await api.switch.powerCycle.mutate({ deviceId });
|
|
6567
|
+
return true;
|
|
6568
|
+
}
|
|
6569
|
+
};
|
|
6570
|
+
}
|
|
6571
|
+
//#endregion
|
|
6416
6572
|
//#region src/builtins/core-blocks/fan-link-forward.ts
|
|
6417
6573
|
/**
|
|
6418
6574
|
* A write to a fan-control field the operator linked in Customize goes to the
|
|
@@ -9906,7 +10062,9 @@ var CoreBlocksAddon = class extends require_dist.BaseAddon {
|
|
|
9906
10062
|
deviceId,
|
|
9907
10063
|
capName
|
|
9908
10064
|
}),
|
|
9909
|
-
remoteCommands: async (deviceId) => (await requireApi().remote.listCommands.query({ deviceId })).commands.length
|
|
10065
|
+
remoteCommands: async (deviceId) => (await requireApi().remote.listCommands.query({ deviceId })).commands.length,
|
|
10066
|
+
switchOptions: (deviceId) => switchOptionsOf(requireApi(), deviceId),
|
|
10067
|
+
powerSupplySettable: async (deviceId) => (await requireApi().powerSource.getStatus.query({ deviceId })).switchSettable ?? null
|
|
9910
10068
|
}
|
|
9911
10069
|
});
|
|
9912
10070
|
}
|
|
@@ -9926,30 +10084,7 @@ var CoreBlocksAddon = class extends require_dist.BaseAddon {
|
|
|
9926
10084
|
if (!api) throw new Error("core-blocks: no ctx.api on this node — power-source cannot reach devices");
|
|
9927
10085
|
return api;
|
|
9928
10086
|
};
|
|
9929
|
-
return
|
|
9930
|
-
find: async (ref) => {
|
|
9931
|
-
const row = (await requireApi().deviceManager.listAll.query({
|
|
9932
|
-
addonId: ref.addonId,
|
|
9933
|
-
projection: "slim"
|
|
9934
|
-
})).find((r) => r.stableId === ref.stableId);
|
|
9935
|
-
return row === void 0 ? null : {
|
|
9936
|
-
id: row.id,
|
|
9937
|
-
name: row.name,
|
|
9938
|
-
online: row.online
|
|
9939
|
-
};
|
|
9940
|
-
},
|
|
9941
|
-
readOn: async (deviceId) => {
|
|
9942
|
-
const status = await requireApi().switch.getStatus.query({ deviceId });
|
|
9943
|
-
const on = status !== null && typeof status === "object" ? Reflect.get(status, "on") : void 0;
|
|
9944
|
-
return typeof on === "boolean" ? on : null;
|
|
9945
|
-
},
|
|
9946
|
-
setOn: async (deviceId, on) => {
|
|
9947
|
-
await requireApi().switch.setState.mutate({
|
|
9948
|
-
deviceId,
|
|
9949
|
-
on
|
|
9950
|
-
});
|
|
9951
|
-
}
|
|
9952
|
-
};
|
|
10087
|
+
return powerSourceDevicesOver(requireApi);
|
|
9953
10088
|
}
|
|
9954
10089
|
buildRemote(records) {
|
|
9955
10090
|
const settings = this.ctx.settings;
|