@camstack/server 1.2.723 → 1.2.725
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 +12 -0
- package/package.json +7 -14
- package/system/dist/addon-runner.js +69 -57
- package/system/dist/addon-runner.mjs +69 -57
- package/system/dist/{agent-https-DslXCDRW.js → agent-https-CzkxjkB5.js} +1 -1
- package/system/dist/{agent-https-BMbnmX5u.mjs → agent-https-DuZMpe3P.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/core-blocks.addon.js +3 -3
- package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +3 -3
- package/system/dist/builtins/core-blocks/power-source-service.d.ts +1 -1
- 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 +3 -3
- package/system/dist/builtins/keychain/index.mjs +3 -3
- 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 +2 -2
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +2 -2
- 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/{composition-sources-C14epb_m.js → composition-sources-B5uJfQqd.js} +1 -1
- package/system/dist/{composition-sources-EXNuxmGQ.mjs → composition-sources-DKx0-ndC.mjs} +1 -1
- package/system/dist/{constants-DIGWBiNC.mjs → constants-HoyXps3n.mjs} +1 -1
- package/system/dist/{constants-M7NtSiRo.js → constants-n9Ip2uKi.js} +1 -1
- package/system/dist/{device-ca-DZlvNBWU.mjs → device-ca-BiQeJXfU.mjs} +1 -1
- package/system/dist/{device-ca-3vmBP1i0.js → device-ca-Cw3JZPXq.js} +1 -1
- package/system/dist/{dist-DcMqHB_N.mjs → dist-D35rKdpn.mjs} +220 -176
- package/system/dist/{dist-M9yHiIY7.js → dist-DngPUHs2.js} +220 -176
- package/system/dist/file-host-worker.js +1 -1
- package/system/dist/file-host-worker.mjs +1 -1
- package/system/dist/{hub-mdns-ciao-Czz2ssit.mjs → hub-mdns-ciao-C4upkgCX.mjs} +2 -2
- package/system/dist/{hub-mdns-ciao-CpCKuQnK.js → hub-mdns-ciao-CChO-G09.js} +2 -2
- package/system/dist/index.js +76 -64
- package/system/dist/index.mjs +76 -64
- package/system/dist/{restore-archive-B-SaKSVW.mjs → restore-archive-Dr_FY9P0.mjs} +82 -82
- package/system/dist/{restore-archive-Cy7jGqiD.js → restore-archive-Lb1DCZll.js} +1 -1
- package/system/dist/{retention-Dqm_EiVq.mjs → retention-CwKSqRi5.mjs} +1 -1
- package/system/dist/{retention-Ufa2fci-.js → retention-IAzprg-c.js} +1 -1
- package/system/dist/{wal-maintenance-Bnb2QzYG.mjs → wal-maintenance-D49HVxcB.mjs} +0 -0
- package/system/dist/{wal-maintenance-BmugbgS7.js → wal-maintenance-DMP7fhqn.js} +0 -0
- package/system/package.json +1 -1
|
@@ -7942,7 +7942,7 @@ function sleep(ms) {
|
|
|
7942
7942
|
return new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)));
|
|
7943
7943
|
}
|
|
7944
7944
|
//#endregion
|
|
7945
|
-
//#region ../types/dist/composition-
|
|
7945
|
+
//#region ../types/dist/composition-BiKWlUCc.mjs
|
|
7946
7946
|
var AUDIO_ENCODER_BY_CODEC = {
|
|
7947
7947
|
opus: "libopus",
|
|
7948
7948
|
aac: "aac",
|
|
@@ -10184,7 +10184,15 @@ var ApplianceHelperSpecSchema = zod.z.object({
|
|
|
10184
10184
|
thresholdWatts: zod.z.number().positive(),
|
|
10185
10185
|
startDwellMs: zod.z.number().int().nonnegative(),
|
|
10186
10186
|
stopDwellMs: zod.z.number().int().nonnegative(),
|
|
10187
|
-
member: HelperMemberSchema
|
|
10187
|
+
member: HelperMemberSchema,
|
|
10188
|
+
/**
|
|
10189
|
+
* The plug that powers the appliance (`switch.on`). Optional: when set, the
|
|
10190
|
+
* composition carries a `power-source` feature, so the hub can cut and restore
|
|
10191
|
+
* that plug (power-source link of a NEW-target composition).
|
|
10192
|
+
*/
|
|
10193
|
+
powerSwitch: HelperMemberSchema.optional(),
|
|
10194
|
+
/** How long a forced restart keeps the plug off; the cap's default when unset. */
|
|
10195
|
+
offSeconds: zod.z.number().optional()
|
|
10188
10196
|
});
|
|
10189
10197
|
var statisticHelperObject = zod.z.object({
|
|
10190
10198
|
kind: zod.z.literal("statistic"),
|
|
@@ -48876,6 +48884,165 @@ var BY_ID = new Map(GROUP_TEMPLATES.map((template) => [template.id, template]));
|
|
|
48876
48884
|
function groupTemplate(id) {
|
|
48877
48885
|
return BY_ID.get(id) ?? null;
|
|
48878
48886
|
}
|
|
48887
|
+
var PowerSourceRefusalReasonSchema = zod.z.enum([
|
|
48888
|
+
"no-power-source",
|
|
48889
|
+
"switch-missing",
|
|
48890
|
+
"switch-offline",
|
|
48891
|
+
"switch-unknown",
|
|
48892
|
+
"restart-in-progress",
|
|
48893
|
+
"switch-call-failed"
|
|
48894
|
+
]);
|
|
48895
|
+
var PowerSourceActionResultSchema = zod.z.discriminatedUnion("accepted", [zod.z.object({ accepted: zod.z.literal(true) }), zod.z.object({
|
|
48896
|
+
accepted: zod.z.literal(false),
|
|
48897
|
+
reason: PowerSourceRefusalReasonSchema,
|
|
48898
|
+
/** One line for the operator, naming the switch. */
|
|
48899
|
+
message: zod.z.string()
|
|
48900
|
+
})]);
|
|
48901
|
+
var PowerSourceInfoSchema = zod.z.object({
|
|
48902
|
+
/** False when the device has no power source linked; the rest is then empty. */
|
|
48903
|
+
linked: zod.z.boolean(),
|
|
48904
|
+
switchDeviceId: zod.z.number().nullable(),
|
|
48905
|
+
switchName: zod.z.string().nullable(),
|
|
48906
|
+
/** The switch's on/off state, or null when it is unknown. Never false for unknown (D393). */
|
|
48907
|
+
switchOn: zod.z.boolean().nullable(),
|
|
48908
|
+
switchOnline: zod.z.boolean().nullable(),
|
|
48909
|
+
restartInProgress: zod.z.boolean(),
|
|
48910
|
+
offSeconds: zod.z.number().int()
|
|
48911
|
+
});
|
|
48912
|
+
/** The composed slice: the switch state the link mirrors, plus the stored off time. */
|
|
48913
|
+
var PowerSourceStateSchema = zod.z.object({
|
|
48914
|
+
/** Null while the switch has not reported: unknown is never `false` (D393). */
|
|
48915
|
+
switchOn: zod.z.boolean().nullable(),
|
|
48916
|
+
offSeconds: zod.z.number().int(),
|
|
48917
|
+
lastFetchedAt: zod.z.number()
|
|
48918
|
+
});
|
|
48919
|
+
var POWER_SOURCE_DEVICE_TYPES = [
|
|
48920
|
+
DeviceType.Gateway,
|
|
48921
|
+
DeviceType.Hub,
|
|
48922
|
+
DeviceType.Camera,
|
|
48923
|
+
DeviceType.Sensor,
|
|
48924
|
+
DeviceType.MediaPlayer,
|
|
48925
|
+
DeviceType.Vacuum,
|
|
48926
|
+
DeviceType.Generic,
|
|
48927
|
+
DeviceType.Washer,
|
|
48928
|
+
DeviceType.Dryer,
|
|
48929
|
+
DeviceType.Dishwasher,
|
|
48930
|
+
DeviceType.PetFountain,
|
|
48931
|
+
DeviceType.Fan,
|
|
48932
|
+
DeviceType.Humidifier,
|
|
48933
|
+
DeviceType.Climate,
|
|
48934
|
+
DeviceType.WaterHeater
|
|
48935
|
+
];
|
|
48936
|
+
var powerSourceCustomize = {
|
|
48937
|
+
version: 1,
|
|
48938
|
+
targets: [{
|
|
48939
|
+
id: "switch",
|
|
48940
|
+
cardinality: "scalar",
|
|
48941
|
+
vocabulary: {
|
|
48942
|
+
cap: "power-source",
|
|
48943
|
+
stateField: "switchOn"
|
|
48944
|
+
},
|
|
48945
|
+
deviceTypes: POWER_SOURCE_DEVICE_TYPES,
|
|
48946
|
+
apply: "add",
|
|
48947
|
+
path: "switchOn",
|
|
48948
|
+
sources: [{
|
|
48949
|
+
kind: "switch",
|
|
48950
|
+
transforms: [{ kind: "identity" }]
|
|
48951
|
+
}],
|
|
48952
|
+
companions: [{
|
|
48953
|
+
kind: "constant",
|
|
48954
|
+
path: "offSeconds",
|
|
48955
|
+
value: 10,
|
|
48956
|
+
when: "add"
|
|
48957
|
+
}, {
|
|
48958
|
+
kind: "clock",
|
|
48959
|
+
path: "lastFetchedAt",
|
|
48960
|
+
when: "always"
|
|
48961
|
+
}],
|
|
48962
|
+
sourceReport: { status: "assignment-status" }
|
|
48963
|
+
}]
|
|
48964
|
+
};
|
|
48965
|
+
var deviceInput$1 = zod.z.object({ deviceId: zod.z.number().int().nonnegative() });
|
|
48966
|
+
var powerSourceCapability = {
|
|
48967
|
+
name: "power-source",
|
|
48968
|
+
scope: "device",
|
|
48969
|
+
mode: "singleton",
|
|
48970
|
+
deviceTypes: POWER_SOURCE_DEVICE_TYPES,
|
|
48971
|
+
methods: {
|
|
48972
|
+
getStatus: systemMethod(deviceInput$1, PowerSourceInfoSchema, { auth: "admin" }),
|
|
48973
|
+
powerOn: systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
|
|
48974
|
+
kind: "mutation",
|
|
48975
|
+
auth: "admin"
|
|
48976
|
+
}),
|
|
48977
|
+
powerOff: systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
|
|
48978
|
+
kind: "mutation",
|
|
48979
|
+
auth: "admin"
|
|
48980
|
+
}),
|
|
48981
|
+
forceRestart: systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
|
|
48982
|
+
kind: "mutation",
|
|
48983
|
+
auth: "admin"
|
|
48984
|
+
})
|
|
48985
|
+
},
|
|
48986
|
+
runtimeState: PowerSourceStateSchema,
|
|
48987
|
+
customize: powerSourceCustomize,
|
|
48988
|
+
/**
|
|
48989
|
+
* Runtime-state durability: **session** — mirrored from the linked switch on
|
|
48990
|
+
* its next report; a restored value would outlive the reading it names.
|
|
48991
|
+
*
|
|
48992
|
+
* See `RuntimeStateDurability`. Enforced by
|
|
48993
|
+
* `scripts/check-runtime-state-durability.ts`.
|
|
48994
|
+
*/
|
|
48995
|
+
durability: "session",
|
|
48996
|
+
history: "none"
|
|
48997
|
+
};
|
|
48998
|
+
/**
|
|
48999
|
+
* Which smart switch powers a device (the `power-source` Customize extension):
|
|
49000
|
+
* the source its stored `power-source.switchOn` field reads, and the off time of
|
|
49001
|
+
* a forced restart stored beside it. Read from the STORED composition, never kept
|
|
49002
|
+
* as a second copy (D676). Shared by the hub (which acts on the switch) and the
|
|
49003
|
+
* admin UI (which shows it).
|
|
49004
|
+
*/
|
|
49005
|
+
/**
|
|
49006
|
+
* The stored off time, or the default when none is stored. A stored number out
|
|
49007
|
+
* of range is CLAMPED to the bounds (a hand-written value never refuses the
|
|
49008
|
+
* link, it just cannot cut power for an absurd time); a non-integer is rounded.
|
|
49009
|
+
*/
|
|
49010
|
+
function normalizeOffSeconds(value) {
|
|
49011
|
+
if (typeof value !== "number" || !Number.isFinite(value)) return 10;
|
|
49012
|
+
return Math.min(120, Math.max(3, Math.round(value)));
|
|
49013
|
+
}
|
|
49014
|
+
/** The constant a stored `offSeconds` field carries, or undefined when it is not a literal number. */
|
|
49015
|
+
function storedOffSeconds(composition) {
|
|
49016
|
+
const feature = composition.features.find((f) => f.cap === "power-source");
|
|
49017
|
+
if (feature === void 0 || feature.kind !== "fields") return void 0;
|
|
49018
|
+
const field = feature.fields["offSeconds"];
|
|
49019
|
+
if (field === void 0 || field.kind !== "expression") return void 0;
|
|
49020
|
+
const n = Number(field.expr);
|
|
49021
|
+
return field.expr.trim() === "" || !Number.isFinite(n) ? void 0 : n;
|
|
49022
|
+
}
|
|
49023
|
+
/**
|
|
49024
|
+
* The link a composition stores. An `existing` target names its own device; a
|
|
49025
|
+
* `new` target (an appliance helper) is the composer's own device, so the caller
|
|
49026
|
+
* passes the block id and a new-target composition without one has no link.
|
|
49027
|
+
*/
|
|
49028
|
+
function powerSourceLinkOfComposition(composition, blockId) {
|
|
49029
|
+
if (composition === null) return null;
|
|
49030
|
+
let device;
|
|
49031
|
+
if (composition.target.kind === "existing") device = composition.target.device;
|
|
49032
|
+
else if (blockId !== void 0) device = composedDeviceRef(blockId);
|
|
49033
|
+
else return null;
|
|
49034
|
+
const feature = composition.features.find((f) => f.cap === "power-source");
|
|
49035
|
+
if (feature === void 0 || feature.kind !== "fields" || feature.enabled === false) return null;
|
|
49036
|
+
const field = feature.fields["switchOn"];
|
|
49037
|
+
if (field === void 0) return null;
|
|
49038
|
+
const read = fieldReads(field).find((r) => r.cap === "switch");
|
|
49039
|
+
if (read === void 0) return null;
|
|
49040
|
+
return {
|
|
49041
|
+
device,
|
|
49042
|
+
switch: read.source,
|
|
49043
|
+
offSeconds: normalizeOffSeconds(storedOffSeconds(composition))
|
|
49044
|
+
};
|
|
49045
|
+
}
|
|
48879
49046
|
var UNSIGNED = /^\d+(?:\.\d+)?$/;
|
|
48880
49047
|
var SIGNED = /^-?\d+(?:\.\d+)?$/;
|
|
48881
49048
|
var IDENT = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
@@ -49652,6 +49819,10 @@ function expressionDraft(spec) {
|
|
|
49652
49819
|
draft: spec.output === "boolean" ? binarySensor(spec, source) : numericSensor(spec, source)
|
|
49653
49820
|
};
|
|
49654
49821
|
}
|
|
49822
|
+
/**
|
|
49823
|
+
* Project a helper spec onto the composition the composer already runs (D944).
|
|
49824
|
+
* Pure: it stores nothing. A group does not compile to `avg(...)` / `any(...)`.
|
|
49825
|
+
*/
|
|
49655
49826
|
function sameSource(a, b) {
|
|
49656
49827
|
return a.addonId === b.addonId && a.stableId === b.stableId;
|
|
49657
49828
|
}
|
|
@@ -49749,6 +49920,11 @@ function compileAppliance(spec) {
|
|
|
49749
49920
|
ok: false,
|
|
49750
49921
|
problems: [problem("member-constraint", "helper.member", "an appliance helper reads power-meter.power")]
|
|
49751
49922
|
};
|
|
49923
|
+
const powerSwitch = spec.powerSwitch;
|
|
49924
|
+
if (powerSwitch !== void 0 && (powerSwitch.cap !== "switch" || powerSwitch.fieldPath !== "on")) return {
|
|
49925
|
+
ok: false,
|
|
49926
|
+
problems: [problem("member-constraint", "helper.powerSwitch", "the power plug of an appliance helper is a switch, read at switch.on")]
|
|
49927
|
+
};
|
|
49752
49928
|
const threshold = unsignedToken(spec.thresholdWatts);
|
|
49753
49929
|
const start = unsignedToken(spec.startDwellMs);
|
|
49754
49930
|
const stop = unsignedToken(spec.stopDwellMs);
|
|
@@ -49768,30 +49944,48 @@ function compileAppliance(spec) {
|
|
|
49768
49944
|
};
|
|
49769
49945
|
const dwell = dwellExpr("gte", threshold, start, stop);
|
|
49770
49946
|
const clock = expressionSource("now");
|
|
49947
|
+
const powerSourceFeatures = powerSwitch === void 0 ? [] : [{
|
|
49948
|
+
kind: "fields",
|
|
49949
|
+
cap: "power-source",
|
|
49950
|
+
fields: {
|
|
49951
|
+
switchOn: {
|
|
49952
|
+
kind: "from",
|
|
49953
|
+
source: powerSwitch.source,
|
|
49954
|
+
cap: powerSwitch.cap,
|
|
49955
|
+
fieldPath: powerSwitch.fieldPath
|
|
49956
|
+
},
|
|
49957
|
+
offSeconds: expressionSource(String(normalizeOffSeconds(spec.offSeconds))),
|
|
49958
|
+
lastFetchedAt: clock
|
|
49959
|
+
}
|
|
49960
|
+
}];
|
|
49771
49961
|
return parseDraft({
|
|
49772
49962
|
target: {
|
|
49773
49963
|
kind: "new",
|
|
49774
49964
|
type: applianceDeviceType(spec.appliance)
|
|
49775
49965
|
},
|
|
49776
49966
|
helper: spec,
|
|
49777
|
-
features: [
|
|
49778
|
-
|
|
49779
|
-
|
|
49780
|
-
|
|
49781
|
-
|
|
49782
|
-
|
|
49783
|
-
|
|
49784
|
-
|
|
49785
|
-
|
|
49786
|
-
|
|
49787
|
-
|
|
49788
|
-
|
|
49789
|
-
|
|
49790
|
-
|
|
49791
|
-
|
|
49792
|
-
|
|
49793
|
-
|
|
49794
|
-
|
|
49967
|
+
features: [
|
|
49968
|
+
{
|
|
49969
|
+
kind: "fields",
|
|
49970
|
+
cap: "running-state",
|
|
49971
|
+
fields: {
|
|
49972
|
+
running: expressionSource(dwell, { x: read }),
|
|
49973
|
+
source: expressionSource("\"assigned\""),
|
|
49974
|
+
phase: expressionSource("null"),
|
|
49975
|
+
lastFetchedAt: clock,
|
|
49976
|
+
since: expressionSource(`latchedAt(${dwell})`, { x: read })
|
|
49977
|
+
}
|
|
49978
|
+
},
|
|
49979
|
+
{
|
|
49980
|
+
kind: "fields",
|
|
49981
|
+
cap: "power-meter",
|
|
49982
|
+
fields: {
|
|
49983
|
+
power: read,
|
|
49984
|
+
lastFetchedAt: clock
|
|
49985
|
+
}
|
|
49986
|
+
},
|
|
49987
|
+
...powerSourceFeatures
|
|
49988
|
+
]
|
|
49795
49989
|
});
|
|
49796
49990
|
}
|
|
49797
49991
|
/** Compile a helper template to a new-device composition. Refusals are named. */
|
|
@@ -75559,7 +75753,7 @@ var RemoteSetConfigResultSchema = zod.z.discriminatedUnion("status", [zod.z.obje
|
|
|
75559
75753
|
reason: zod.z.enum(["unknown-template", "not-a-media-player"]),
|
|
75560
75754
|
detail: zod.z.string()
|
|
75561
75755
|
})]);
|
|
75562
|
-
var deviceInput
|
|
75756
|
+
var deviceInput = zod.z.object({ deviceId: zod.z.number().int().nonnegative() });
|
|
75563
75757
|
var remoteCustomize = {
|
|
75564
75758
|
version: 1,
|
|
75565
75759
|
targets: [{
|
|
@@ -75577,13 +75771,13 @@ var remoteCapability = {
|
|
|
75577
75771
|
scope: "system",
|
|
75578
75772
|
mode: "singleton",
|
|
75579
75773
|
methods: {
|
|
75580
|
-
getConfig: method(deviceInput
|
|
75581
|
-
setConfig: method(deviceInput
|
|
75774
|
+
getConfig: method(deviceInput, RemoteConfigSchema, { auth: "admin" }),
|
|
75775
|
+
setConfig: method(deviceInput.extend({ config: RemoteConfigSchema }), RemoteSetConfigResultSchema, {
|
|
75582
75776
|
kind: "mutation",
|
|
75583
75777
|
auth: "admin"
|
|
75584
75778
|
}),
|
|
75585
|
-
listCommands: method(deviceInput
|
|
75586
|
-
sendCommand: method(deviceInput
|
|
75779
|
+
listCommands: method(deviceInput, RemoteCommandListSchema, { auth: "protected" }),
|
|
75780
|
+
sendCommand: method(deviceInput.extend({
|
|
75587
75781
|
role: RemoteRoleSchema,
|
|
75588
75782
|
/** Sends in a row (volume steps). */
|
|
75589
75783
|
repeat: zod.z.number().int().min(1).max(50).default(1)
|
|
@@ -75597,7 +75791,7 @@ var remoteCapability = {
|
|
|
75597
75791
|
* The dispatch redirect calls this for every caller (UI, automation,
|
|
75598
75792
|
* exporter); `repeat` is the caller's count where it has one.
|
|
75599
75793
|
*/
|
|
75600
|
-
sendMediaCommand: method(deviceInput
|
|
75794
|
+
sendMediaCommand: method(deviceInput.extend({
|
|
75601
75795
|
command: RemoteMediaCommandSchema,
|
|
75602
75796
|
muted: zod.z.boolean().optional(),
|
|
75603
75797
|
source: zod.z.string().optional(),
|
|
@@ -80420,117 +80614,6 @@ var lockControlCapability = {
|
|
|
80420
80614
|
* whether persisting is worth a SQLite commit. */
|
|
80421
80615
|
volatileStateFields: ["lastChangedAt"]
|
|
80422
80616
|
};
|
|
80423
|
-
var PowerSourceRefusalReasonSchema = zod.z.enum([
|
|
80424
|
-
"no-power-source",
|
|
80425
|
-
"switch-missing",
|
|
80426
|
-
"switch-offline",
|
|
80427
|
-
"switch-unknown",
|
|
80428
|
-
"restart-in-progress",
|
|
80429
|
-
"switch-call-failed"
|
|
80430
|
-
]);
|
|
80431
|
-
var PowerSourceActionResultSchema = zod.z.discriminatedUnion("accepted", [zod.z.object({ accepted: zod.z.literal(true) }), zod.z.object({
|
|
80432
|
-
accepted: zod.z.literal(false),
|
|
80433
|
-
reason: PowerSourceRefusalReasonSchema,
|
|
80434
|
-
/** One line for the operator, naming the switch. */
|
|
80435
|
-
message: zod.z.string()
|
|
80436
|
-
})]);
|
|
80437
|
-
var PowerSourceInfoSchema = zod.z.object({
|
|
80438
|
-
/** False when the device has no power source linked; the rest is then empty. */
|
|
80439
|
-
linked: zod.z.boolean(),
|
|
80440
|
-
switchDeviceId: zod.z.number().nullable(),
|
|
80441
|
-
switchName: zod.z.string().nullable(),
|
|
80442
|
-
/** The switch's on/off state, or null when it is unknown. Never false for unknown (D393). */
|
|
80443
|
-
switchOn: zod.z.boolean().nullable(),
|
|
80444
|
-
switchOnline: zod.z.boolean().nullable(),
|
|
80445
|
-
restartInProgress: zod.z.boolean(),
|
|
80446
|
-
offSeconds: zod.z.number().int()
|
|
80447
|
-
});
|
|
80448
|
-
/** The composed slice: the switch state the link mirrors, plus the stored off time. */
|
|
80449
|
-
var PowerSourceStateSchema = zod.z.object({
|
|
80450
|
-
/** Null while the switch has not reported: unknown is never `false` (D393). */
|
|
80451
|
-
switchOn: zod.z.boolean().nullable(),
|
|
80452
|
-
offSeconds: zod.z.number().int(),
|
|
80453
|
-
lastFetchedAt: zod.z.number()
|
|
80454
|
-
});
|
|
80455
|
-
var POWER_SOURCE_DEVICE_TYPES = [
|
|
80456
|
-
DeviceType.Gateway,
|
|
80457
|
-
DeviceType.Hub,
|
|
80458
|
-
DeviceType.Camera,
|
|
80459
|
-
DeviceType.Sensor,
|
|
80460
|
-
DeviceType.MediaPlayer,
|
|
80461
|
-
DeviceType.Vacuum,
|
|
80462
|
-
DeviceType.Generic,
|
|
80463
|
-
DeviceType.Washer,
|
|
80464
|
-
DeviceType.Dryer,
|
|
80465
|
-
DeviceType.Dishwasher,
|
|
80466
|
-
DeviceType.PetFountain,
|
|
80467
|
-
DeviceType.Fan,
|
|
80468
|
-
DeviceType.Humidifier,
|
|
80469
|
-
DeviceType.Climate,
|
|
80470
|
-
DeviceType.WaterHeater
|
|
80471
|
-
];
|
|
80472
|
-
var powerSourceCustomize = {
|
|
80473
|
-
version: 1,
|
|
80474
|
-
targets: [{
|
|
80475
|
-
id: "switch",
|
|
80476
|
-
cardinality: "scalar",
|
|
80477
|
-
vocabulary: {
|
|
80478
|
-
cap: "power-source",
|
|
80479
|
-
stateField: "switchOn"
|
|
80480
|
-
},
|
|
80481
|
-
deviceTypes: POWER_SOURCE_DEVICE_TYPES,
|
|
80482
|
-
apply: "add",
|
|
80483
|
-
path: "switchOn",
|
|
80484
|
-
sources: [{
|
|
80485
|
-
kind: "switch",
|
|
80486
|
-
transforms: [{ kind: "identity" }]
|
|
80487
|
-
}],
|
|
80488
|
-
companions: [{
|
|
80489
|
-
kind: "constant",
|
|
80490
|
-
path: "offSeconds",
|
|
80491
|
-
value: 10,
|
|
80492
|
-
when: "add"
|
|
80493
|
-
}, {
|
|
80494
|
-
kind: "clock",
|
|
80495
|
-
path: "lastFetchedAt",
|
|
80496
|
-
when: "always"
|
|
80497
|
-
}],
|
|
80498
|
-
sourceReport: { status: "assignment-status" }
|
|
80499
|
-
}]
|
|
80500
|
-
};
|
|
80501
|
-
var deviceInput = zod.z.object({ deviceId: zod.z.number().int().nonnegative() });
|
|
80502
|
-
var powerSourceCapability = {
|
|
80503
|
-
name: "power-source",
|
|
80504
|
-
scope: "device",
|
|
80505
|
-
mode: "singleton",
|
|
80506
|
-
deviceTypes: POWER_SOURCE_DEVICE_TYPES,
|
|
80507
|
-
methods: {
|
|
80508
|
-
getStatus: systemMethod(deviceInput, PowerSourceInfoSchema, { auth: "admin" }),
|
|
80509
|
-
powerOn: systemMethod(deviceInput, PowerSourceActionResultSchema, {
|
|
80510
|
-
kind: "mutation",
|
|
80511
|
-
auth: "admin"
|
|
80512
|
-
}),
|
|
80513
|
-
powerOff: systemMethod(deviceInput, PowerSourceActionResultSchema, {
|
|
80514
|
-
kind: "mutation",
|
|
80515
|
-
auth: "admin"
|
|
80516
|
-
}),
|
|
80517
|
-
forceRestart: systemMethod(deviceInput, PowerSourceActionResultSchema, {
|
|
80518
|
-
kind: "mutation",
|
|
80519
|
-
auth: "admin"
|
|
80520
|
-
})
|
|
80521
|
-
},
|
|
80522
|
-
runtimeState: PowerSourceStateSchema,
|
|
80523
|
-
customize: powerSourceCustomize,
|
|
80524
|
-
/**
|
|
80525
|
-
* Runtime-state durability: **session** — mirrored from the linked switch on
|
|
80526
|
-
* its next report; a restored value would outlive the reading it names.
|
|
80527
|
-
*
|
|
80528
|
-
* See `RuntimeStateDurability`. Enforced by
|
|
80529
|
-
* `scripts/check-runtime-state-durability.ts`.
|
|
80530
|
-
*/
|
|
80531
|
-
durability: "session",
|
|
80532
|
-
history: "none"
|
|
80533
|
-
};
|
|
80534
80617
|
/**
|
|
80535
80618
|
* A monotonic total between resets (D944). Energy uses `power-meter.energy`
|
|
80536
80619
|
* so dashboards keep one series; every other instantaneous reading lands here.
|
|
@@ -90999,45 +91082,6 @@ function lockDoorLinkOfComposition(composition) {
|
|
|
90999
91082
|
sensor: x.source
|
|
91000
91083
|
};
|
|
91001
91084
|
}
|
|
91002
|
-
/**
|
|
91003
|
-
* Which smart switch powers a device (the `power-source` Customize extension):
|
|
91004
|
-
* the source its stored `power-source.switchOn` field reads, and the off time of
|
|
91005
|
-
* a forced restart stored beside it. Read from the STORED composition, never kept
|
|
91006
|
-
* as a second copy (D676). Shared by the hub (which acts on the switch) and the
|
|
91007
|
-
* admin UI (which shows it).
|
|
91008
|
-
*/
|
|
91009
|
-
/**
|
|
91010
|
-
* The stored off time, or the default when none is stored. A stored number out
|
|
91011
|
-
* of range is CLAMPED to the bounds (a hand-written value never refuses the
|
|
91012
|
-
* link, it just cannot cut power for an absurd time); a non-integer is rounded.
|
|
91013
|
-
*/
|
|
91014
|
-
function normalizeOffSeconds(value) {
|
|
91015
|
-
if (typeof value !== "number" || !Number.isFinite(value)) return 10;
|
|
91016
|
-
return Math.min(120, Math.max(3, Math.round(value)));
|
|
91017
|
-
}
|
|
91018
|
-
/** The constant a stored `offSeconds` field carries, or undefined when it is not a literal number. */
|
|
91019
|
-
function storedOffSeconds(composition) {
|
|
91020
|
-
const feature = composition.features.find((f) => f.cap === "power-source");
|
|
91021
|
-
if (feature === void 0 || feature.kind !== "fields") return void 0;
|
|
91022
|
-
const field = feature.fields["offSeconds"];
|
|
91023
|
-
if (field === void 0 || field.kind !== "expression") return void 0;
|
|
91024
|
-
const n = Number(field.expr);
|
|
91025
|
-
return field.expr.trim() === "" || !Number.isFinite(n) ? void 0 : n;
|
|
91026
|
-
}
|
|
91027
|
-
function powerSourceLinkOfComposition(composition) {
|
|
91028
|
-
if (composition === null || composition.target.kind !== "existing") return null;
|
|
91029
|
-
const feature = composition.features.find((f) => f.cap === "power-source");
|
|
91030
|
-
if (feature === void 0 || feature.kind !== "fields" || feature.enabled === false) return null;
|
|
91031
|
-
const field = feature.fields["switchOn"];
|
|
91032
|
-
if (field === void 0) return null;
|
|
91033
|
-
const read = fieldReads(field).find((r) => r.cap === "switch");
|
|
91034
|
-
if (read === void 0) return null;
|
|
91035
|
-
return {
|
|
91036
|
-
device: composition.target.device,
|
|
91037
|
-
switch: read.source,
|
|
91038
|
-
offSeconds: normalizeOffSeconds(storedOffSeconds(composition))
|
|
91039
|
-
};
|
|
91040
|
-
}
|
|
91041
91085
|
SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
|
|
91042
91086
|
String.raw`rose\(active(\d+), changed(\d+), (\d+(?:\.\d+)?)\)`;
|
|
91043
91087
|
DeviceRole.BinarySensor, DeviceRole.MotionSensor;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
require("./chunk-Cek0wNdY.js");
|
|
2
|
-
const require_wal_maintenance = require("./wal-maintenance-
|
|
2
|
+
const require_wal_maintenance = require("./wal-maintenance-DMP7fhqn.js");
|
|
3
3
|
let node_worker_threads = require("node:worker_threads");
|
|
4
4
|
//#region src/builtins/sqlite-storage/file-host-worker.ts
|
|
5
5
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as callRecords, C as isFileHostWorkerData, D as RecordsEngine, M as controlTargetOf, O as callControl, S as isFileHostRequest, a as WalMaintenance, b as collectTransferables, d as callMigrate, f as migrateTargetOf, j as callVector, k as callData, l as SqliteSettingsBackend, o as createVectorIndex, s as vectorProviderOf, u as HUB_MIGRATIONS, v as serializeError, w as trustInput } from "./wal-maintenance-
|
|
1
|
+
import { A as callRecords, C as isFileHostWorkerData, D as RecordsEngine, M as controlTargetOf, O as callControl, S as isFileHostRequest, a as WalMaintenance, b as collectTransferables, d as callMigrate, f as migrateTargetOf, j as callVector, k as callData, l as SqliteSettingsBackend, o as createVectorIndex, s as vectorProviderOf, u as HUB_MIGRATIONS, v as serializeError, w as trustInput } from "./wal-maintenance-D49HVxcB.mjs";
|
|
2
2
|
import { parentPort, threadId, workerData } from "node:worker_threads";
|
|
3
3
|
//#region src/builtins/sqlite-storage/file-host-worker.ts
|
|
4
4
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { o as __toESM } from "./chunk-CNf5ZN-e.mjs";
|
|
2
|
-
import { Es as userError } from "./dist-
|
|
2
|
+
import { Es as userError } from "./dist-D35rKdpn.mjs";
|
|
3
3
|
import { f as X509Certificate$1 } from "./x509.es-BRiJgOvu.mjs";
|
|
4
|
-
import { D as reasonRequiresNewCa, E as evaluateExistingCert, F as readNameConstraints, N as permitsIdentity, _ as issueLeaf, b as collectCertIdentity, g as generateCa, j as isConstrainedCa, v as loadCa, y as localCaCommonName } from "./agent-https-
|
|
4
|
+
import { D as reasonRequiresNewCa, E as evaluateExistingCert, F as readNameConstraints, N as permitsIdentity, _ as issueLeaf, b as collectCertIdentity, g as generateCa, j as isConstrainedCa, v as loadCa, y as localCaCommonName } from "./agent-https-DuZMpe3P.mjs";
|
|
5
5
|
import { X509Certificate, createPrivateKey } from "node:crypto";
|
|
6
6
|
import { writeOwnerOnlyFileSync } from "@camstack/types/node";
|
|
7
7
|
import { mkdir, writeFile } from "node:fs/promises";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-Cek0wNdY.js");
|
|
2
|
-
const require_dist = require("./dist-
|
|
2
|
+
const require_dist = require("./dist-DngPUHs2.js");
|
|
3
3
|
const require_x509_es = require("./x509.es-WtnRNyYS.js");
|
|
4
|
-
const require_agent_https = require("./agent-https-
|
|
4
|
+
const require_agent_https = require("./agent-https-CzkxjkB5.js");
|
|
5
5
|
let node_crypto = require("node:crypto");
|
|
6
6
|
let _camstack_types_node = require("@camstack/types/node");
|
|
7
7
|
let node_fs_promises = require("node:fs/promises");
|