@camstack/types 1.2.585 → 1.2.587
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 +38 -1
- package/dist/addon.d.ts +2 -0
- package/dist/addon.js +21 -5
- package/dist/addon.mjs +18 -6
- package/dist/capabilities/camera-grid-layout.cap.d.ts +3 -5
- package/dist/capabilities/cap-method-absent.d.ts +19 -0
- package/dist/capabilities/device-manager.cap.d.ts +422 -0
- package/dist/capabilities/hero-layout.cap.d.ts +2 -2
- package/dist/capabilities/index.d.ts +11 -7
- package/dist/capabilities/network-link.cap.d.ts +10 -0
- package/dist/capabilities/notification-rules.cap.d.ts +70 -0
- package/dist/capabilities/power-source.cap.d.ts +20 -0
- package/dist/capabilities/recording-export.cap.d.ts +1 -0
- package/dist/capabilities/siren-duration.d.ts +45 -7
- package/dist/capabilities/siren.cap.d.ts +45 -2
- package/dist/capabilities/switch-settable.d.ts +15 -0
- package/dist/capabilities/switch.cap.d.ts +71 -0
- package/dist/capabilities/tags.cap.d.ts +42 -16
- package/dist/capabilities/terminal-session.cap.d.ts +9 -60
- package/dist/capabilities/videoclips.cap.d.ts +3 -0
- package/dist/capabilities/workload.cap.d.ts +655 -0
- package/dist/client.js +119 -6
- package/dist/client.mjs +119 -6
- package/dist/{composed-stable-id-RvQIEpqg.mjs → composed-stable-id-BBL71oUQ.mjs} +20 -0
- package/dist/{composed-stable-id-C3NfRTj8.js → composed-stable-id-CVbyajE5.js} +20 -0
- package/dist/composition/engine-hosted-blocks.d.ts +131 -0
- package/dist/composition/helpers/index.d.ts +1 -1
- package/dist/composition/helpers/spec.d.ts +56 -2
- package/dist/composition/index.d.ts +1 -0
- package/dist/device/base-device.d.ts +29 -0
- package/dist/device/cap-vocabulary/declaration.d.ts +12 -1
- package/dist/device/cap-vocabulary/index.d.ts +4 -4
- package/dist/device/cap-vocabulary/resolve.d.ts +47 -1
- package/dist/device/cap-vocabulary/types.d.ts +26 -1
- package/dist/device/declare-identifiers.d.ts +58 -0
- package/dist/device/device-control-resolution.d.ts +1 -1
- package/dist/device/device-icon.d.ts +7 -0
- package/dist/device/device-identifiers.d.ts +190 -0
- package/dist/device/device-management.d.ts +10 -0
- package/dist/device/device-type.d.ts +22 -2
- package/dist/device/hero/build-hero-model.d.ts +15 -0
- package/dist/device/hero/hero-fragment.d.ts +11 -0
- package/dist/device/hero/hero-layout.d.ts +1 -0
- package/dist/device/hero/hero-look.d.ts +12 -0
- package/dist/device/hero/hero-model.d.ts +4 -4
- package/dist/device/hero/hero-scene.d.ts +7 -0
- package/dist/device/index.d.ts +5 -1
- package/dist/enums/event-category.d.ts +8 -0
- package/dist/enums.js +1 -1
- package/dist/enums.mjs +1 -1
- package/dist/{event-category-d9kiqCqC.js → event-category-CE_VCE2G.js} +8 -0
- package/dist/{event-category-Dhcd0TRH.mjs → event-category-Hwx_JSCU.mjs} +8 -0
- package/dist/generated/addon-api.d.ts +106 -14
- package/dist/generated/addon-cap-facts.d.ts +1 -1
- package/dist/generated/cap-status-types.d.ts +3 -1
- package/dist/generated/cap-vocabulary.d.ts +1 -1
- package/dist/generated/capability-router-map.d.ts +5 -2
- package/dist/generated/collection-array-methods.d.ts +1 -1
- package/dist/generated/customize-catalog.d.ts +1 -1
- package/dist/generated/device-local-state.d.ts +3 -0
- package/dist/generated/device-proxy.d.ts +4 -1
- package/dist/generated/device-scoped-caps.d.ts +1 -1
- package/dist/generated/history-catalog.d.ts +2 -2
- package/dist/generated/method-access-map.d.ts +1 -1
- package/dist/generated/method-device-selectors.d.ts +2 -2
- package/dist/generated/runtime-state-durability.d.ts +1 -1
- package/dist/generated/system-proxy.d.ts +2 -2
- package/dist/{implemented-methods-C7ScGvEz.js → implemented-methods-ChtdIofW.js} +128 -1
- package/dist/{implemented-methods-C5FMXLGP.mjs → implemented-methods-u7ddjc-_.mjs} +57 -2
- package/dist/index.d.ts +7 -3
- package/dist/index.js +2086 -439
- package/dist/index.mjs +2027 -438
- package/dist/node.js +2 -2
- package/dist/node.mjs +2 -2
- package/dist/notification/timelapse-rule.d.ts +3 -0
- package/dist/{sleep-DwRtgB2i.js → sleep-CsZJsb8n.js} +692 -35
- package/dist/{sleep-Ch7Q7UtE.mjs → sleep-D6Pih0Qt.mjs} +669 -36
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_sleep = require("./sleep-
|
|
3
|
-
const require_event_category = require("./event-category-
|
|
4
|
-
const require_composed_stable_id = require("./composed-stable-id-
|
|
5
|
-
const require_implemented_methods = require("./implemented-methods-
|
|
2
|
+
const require_sleep = require("./sleep-CsZJsb8n.js");
|
|
3
|
+
const require_event_category = require("./event-category-CE_VCE2G.js");
|
|
4
|
+
const require_composed_stable_id = require("./composed-stable-id-CVbyajE5.js");
|
|
5
|
+
const require_implemented_methods = require("./implemented-methods-ChtdIofW.js");
|
|
6
6
|
const require_node_color = require("./node-color.js");
|
|
7
7
|
const require_convert = require("./convert-BI8iTXn6.js");
|
|
8
8
|
const require_device_template_catalogue = require("./device-template-catalogue.js");
|
|
@@ -44503,9 +44503,10 @@ var GridProfileOfferSchema = zod.z.object({
|
|
|
44503
44503
|
published: zod.z.boolean()
|
|
44504
44504
|
});
|
|
44505
44505
|
var GridLayoutViewSchema = zod.z.object({
|
|
44506
|
-
/** The
|
|
44507
|
-
|
|
44506
|
+
/** The grid block (planning#580) whose camera this is. */
|
|
44507
|
+
blockId: zod.z.string(),
|
|
44508
44508
|
deviceId: zod.z.number().int().nonnegative(),
|
|
44509
|
+
/** The device row's name — the only name a grid has; it is renamed on the block or the device. */
|
|
44509
44510
|
name: zod.z.string(),
|
|
44510
44511
|
/**
|
|
44511
44512
|
* NO canvas size. A grid's resolution is not authored: each profile derives
|
|
@@ -44521,7 +44522,6 @@ var GridLayoutViewSchema = zod.z.object({
|
|
|
44521
44522
|
});
|
|
44522
44523
|
var GridLayoutPatchSchema = zod.z.object({
|
|
44523
44524
|
deviceId: zod.z.number().int().nonnegative(),
|
|
44524
|
-
name: zod.z.string().min(1).max(160).optional(),
|
|
44525
44525
|
fps: zod.z.number().int().min(1).max(60).optional(),
|
|
44526
44526
|
/** Which profiles to publish. See `GridProfileOffer.published`. */
|
|
44527
44527
|
publishedProfiles: zod.z.array(zod.z.enum([
|
|
@@ -49057,7 +49057,8 @@ var CAP_CUSTOMIZE_CATALOG = {
|
|
|
49057
49057
|
require_composed_stable_id.DeviceType.Dryer,
|
|
49058
49058
|
require_composed_stable_id.DeviceType.Gateway,
|
|
49059
49059
|
require_composed_stable_id.DeviceType.HeatPump,
|
|
49060
|
-
require_composed_stable_id.DeviceType.EnergySystem
|
|
49060
|
+
require_composed_stable_id.DeviceType.EnergySystem,
|
|
49061
|
+
require_composed_stable_id.DeviceType.Workload
|
|
49061
49062
|
],
|
|
49062
49063
|
apply: "add",
|
|
49063
49064
|
vocabularyCap: "consumables",
|
|
@@ -51454,7 +51455,7 @@ function groupTemplate(id) {
|
|
|
51454
51455
|
//#region src/generated/history-catalog.ts
|
|
51455
51456
|
/**
|
|
51456
51457
|
* Cap history catalog, projected from every `*.cap.ts` `history` block.
|
|
51457
|
-
*
|
|
51458
|
+
* 47 caps with series (130 series), 39 caps answered `'none'`.
|
|
51458
51459
|
* Field keys are `runtimeState` paths (`a.b` into fixed objects only).
|
|
51459
51460
|
*/
|
|
51460
51461
|
var HISTORY_CATALOG = {
|
|
@@ -52087,6 +52088,48 @@ var HISTORY_CATALOG = {
|
|
|
52087
52088
|
unit: "mm",
|
|
52088
52089
|
deadband: .1
|
|
52089
52090
|
}
|
|
52091
|
+
},
|
|
52092
|
+
"workload": {
|
|
52093
|
+
"state": {
|
|
52094
|
+
kind: "enum",
|
|
52095
|
+
values: [
|
|
52096
|
+
"running",
|
|
52097
|
+
"paused",
|
|
52098
|
+
"stopped",
|
|
52099
|
+
"starting",
|
|
52100
|
+
"stopping",
|
|
52101
|
+
"crashed"
|
|
52102
|
+
]
|
|
52103
|
+
},
|
|
52104
|
+
"resources.cpuPercent": {
|
|
52105
|
+
kind: "gauge",
|
|
52106
|
+
unit: "%",
|
|
52107
|
+
deadband: 2,
|
|
52108
|
+
displayName: "CPU"
|
|
52109
|
+
},
|
|
52110
|
+
"resources.memoryUsedBytes": {
|
|
52111
|
+
kind: "gauge",
|
|
52112
|
+
unit: "bytes",
|
|
52113
|
+
displayName: "Memory used"
|
|
52114
|
+
},
|
|
52115
|
+
"resources.memoryPercent": {
|
|
52116
|
+
kind: "gauge",
|
|
52117
|
+
unit: "%",
|
|
52118
|
+
deadband: 2,
|
|
52119
|
+
displayName: "Memory"
|
|
52120
|
+
},
|
|
52121
|
+
"resources.netRxKbps": {
|
|
52122
|
+
group: "network",
|
|
52123
|
+
kind: "gauge",
|
|
52124
|
+
unit: "kbps",
|
|
52125
|
+
displayName: "Network received"
|
|
52126
|
+
},
|
|
52127
|
+
"resources.netTxKbps": {
|
|
52128
|
+
group: "network",
|
|
52129
|
+
kind: "gauge",
|
|
52130
|
+
unit: "kbps",
|
|
52131
|
+
displayName: "Network sent"
|
|
52132
|
+
}
|
|
52090
52133
|
}
|
|
52091
52134
|
};
|
|
52092
52135
|
/**
|
|
@@ -52150,7 +52193,7 @@ var HISTORY_ITEM_CATALOG = {
|
|
|
52150
52193
|
};
|
|
52151
52194
|
/**
|
|
52152
52195
|
* The series a device card trends, per cap (`history.primary` + `history.priority`):
|
|
52153
|
-
*
|
|
52196
|
+
* 7 caps. The card shows the primary of the enabled cap with the highest priority.
|
|
52154
52197
|
*/
|
|
52155
52198
|
var HISTORY_PRIMARY = {
|
|
52156
52199
|
"climate-control": {
|
|
@@ -52176,6 +52219,10 @@ var HISTORY_PRIMARY = {
|
|
|
52176
52219
|
"weather-station": {
|
|
52177
52220
|
field: "temperature",
|
|
52178
52221
|
priority: 60
|
|
52222
|
+
},
|
|
52223
|
+
"workload": {
|
|
52224
|
+
field: "resources.cpuPercent",
|
|
52225
|
+
priority: 40
|
|
52179
52226
|
}
|
|
52180
52227
|
};
|
|
52181
52228
|
/** Caps that declared `history: 'none'`, sorted. */
|
|
@@ -52827,6 +52874,10 @@ function expressionDraft(spec) {
|
|
|
52827
52874
|
}
|
|
52828
52875
|
//#endregion
|
|
52829
52876
|
//#region src/composition/helpers/compile.ts
|
|
52877
|
+
/**
|
|
52878
|
+
* Project a helper spec onto the composition the composer already runs (D944).
|
|
52879
|
+
* Pure: it stores nothing. A group does not compile to `avg(...)` / `any(...)`.
|
|
52880
|
+
*/
|
|
52830
52881
|
function sameSource(a, b) {
|
|
52831
52882
|
return a.addonId === b.addonId && a.stableId === b.stableId;
|
|
52832
52883
|
}
|
|
@@ -52949,8 +53000,25 @@ function compileHelper(spec, retention = require_implemented_methods.DEFAULT_HIS
|
|
|
52949
53000
|
case "threshold": return compileMath(thresholdDraft(spec));
|
|
52950
53001
|
case "arithmetic": return compileMath(arithmeticDraft(spec));
|
|
52951
53002
|
case "expression": return compileMath(expressionDraft(spec));
|
|
53003
|
+
case "grid":
|
|
53004
|
+
case "terminal": return parseDraft(engineHostedDraft(spec));
|
|
52952
53005
|
}
|
|
52953
53006
|
}
|
|
53007
|
+
/**
|
|
53008
|
+
* A grid or a Terminal camera (planning#580): a bare `new` Camera. The composer
|
|
53009
|
+
* declares the row; the engine serves every cap on it, so there is nothing to
|
|
53010
|
+
* compose.
|
|
53011
|
+
*/
|
|
53012
|
+
function engineHostedDraft(spec) {
|
|
53013
|
+
return {
|
|
53014
|
+
target: {
|
|
53015
|
+
kind: "new",
|
|
53016
|
+
type: require_composed_stable_id.DeviceType.Camera
|
|
53017
|
+
},
|
|
53018
|
+
helper: spec,
|
|
53019
|
+
features: []
|
|
53020
|
+
};
|
|
53021
|
+
}
|
|
52954
53022
|
function compileMath(built) {
|
|
52955
53023
|
if (built.problems.length > 0) return {
|
|
52956
53024
|
ok: false,
|
|
@@ -53246,6 +53314,9 @@ function findCandidateCycles(candidate, stored) {
|
|
|
53246
53314
|
* `core-blocks` system provider, so they are `systemMethod`s and carry a
|
|
53247
53315
|
* top-level `deviceId`.
|
|
53248
53316
|
*
|
|
53317
|
+
* Power on / off are withdrawn — and refused as `not-settable` — when the linked
|
|
53318
|
+
* switch ANSWERED it only reports (D1058); the forced restart stays.
|
|
53319
|
+
*
|
|
53249
53320
|
* Every action answers a typed result and never throws for an expected
|
|
53250
53321
|
* refusal, so a caller tells "the switch is offline" from "a restart is
|
|
53251
53322
|
* already running" without parsing text.
|
|
@@ -53261,6 +53332,8 @@ var PowerSourceRefusalReasonSchema = zod.z.enum([
|
|
|
53261
53332
|
"switch-unknown",
|
|
53262
53333
|
"restart-in-progress",
|
|
53263
53334
|
"switch-call-failed",
|
|
53335
|
+
"switch-options-unreadable",
|
|
53336
|
+
"not-settable",
|
|
53264
53337
|
"switch-is-actuator"
|
|
53265
53338
|
]);
|
|
53266
53339
|
var PowerSourceActionResultSchema = zod.z.discriminatedUnion("accepted", [zod.z.object({ accepted: zod.z.literal(true) }), zod.z.object({
|
|
@@ -53277,6 +53350,14 @@ var PowerSourceInfoSchema = zod.z.object({
|
|
|
53277
53350
|
/** The switch's on/off state, or null when it is unknown. Never false for unknown (D393). */
|
|
53278
53351
|
switchOn: zod.z.boolean().nullable(),
|
|
53279
53352
|
switchOnline: zod.z.boolean().nullable(),
|
|
53353
|
+
/**
|
|
53354
|
+
* Whether the linked switch can be set (`switch.getOptions().supportsSetState`; a provider
|
|
53355
|
+
* without the method is a plain switch, `true`). `null` = not known: no link, the switch is
|
|
53356
|
+
* missing, or the read FAILED. Absent = a provider that predates the field. Only `false`
|
|
53357
|
+
* withdraws power on / off (`offeredWhen` of `powerSource.on` / `.off`, the device hero) —
|
|
53358
|
+
* unknown keeps them (D315, D1058).
|
|
53359
|
+
*/
|
|
53360
|
+
switchSettable: zod.z.boolean().nullable().optional(),
|
|
53280
53361
|
restartInProgress: zod.z.boolean(),
|
|
53281
53362
|
offSeconds: zod.z.number().int()
|
|
53282
53363
|
});
|
|
@@ -53334,6 +53415,11 @@ var powerSourceCustomize = {
|
|
|
53334
53415
|
}]
|
|
53335
53416
|
};
|
|
53336
53417
|
var deviceInput$2 = zod.z.object({ deviceId: zod.z.number().int().nonnegative() });
|
|
53418
|
+
/** The read that decides whether power on / off are offered (`offeredWhen`, D1058). */
|
|
53419
|
+
var POWER_SOURCE_SETTABLE_GATE = {
|
|
53420
|
+
method: "getStatus",
|
|
53421
|
+
field: "switchSettable"
|
|
53422
|
+
};
|
|
53337
53423
|
var powerSourceCapability = {
|
|
53338
53424
|
name: "power-source",
|
|
53339
53425
|
scope: "device",
|
|
@@ -53348,7 +53434,8 @@ var powerSourceCapability = {
|
|
|
53348
53434
|
id: "powerSource.on",
|
|
53349
53435
|
label: require_sleep.t("Power on", "Dai corrente"),
|
|
53350
53436
|
phrase: require_sleep.t("Power on {device}", "Dai corrente a {device}"),
|
|
53351
|
-
icon: "power"
|
|
53437
|
+
icon: "power",
|
|
53438
|
+
offeredWhen: POWER_SOURCE_SETTABLE_GATE
|
|
53352
53439
|
}]
|
|
53353
53440
|
}),
|
|
53354
53441
|
powerOff: require_sleep.systemMethod(deviceInput$2, PowerSourceActionResultSchema, {
|
|
@@ -53358,7 +53445,8 @@ var powerSourceCapability = {
|
|
|
53358
53445
|
id: "powerSource.off",
|
|
53359
53446
|
label: require_sleep.t("Power off", "Togli corrente"),
|
|
53360
53447
|
phrase: require_sleep.t("Cut the power of {device}", "Togli la corrente a {device}"),
|
|
53361
|
-
icon: "power-off"
|
|
53448
|
+
icon: "power-off",
|
|
53449
|
+
offeredWhen: POWER_SOURCE_SETTABLE_GATE
|
|
53362
53450
|
}]
|
|
53363
53451
|
}),
|
|
53364
53452
|
forceRestart: require_sleep.systemMethod(deviceInput$2, PowerSourceActionResultSchema, {
|
|
@@ -56466,6 +56554,274 @@ function siteZoneKey(label) {
|
|
|
56466
56554
|
return label.trim().toLowerCase();
|
|
56467
56555
|
}
|
|
56468
56556
|
//#endregion
|
|
56557
|
+
//#region src/device/device-identifiers.ts
|
|
56558
|
+
/**
|
|
56559
|
+
* Provider-declared device identifiers (D1059, planning#590).
|
|
56560
|
+
*
|
|
56561
|
+
* What a device IS, as its owning provider read it from the hardware: the keys a
|
|
56562
|
+
* later step matches across integrations to tell that two devices are the same
|
|
56563
|
+
* physical object. Separate from `DeviceMetadata` on purpose — metadata is a
|
|
56564
|
+
* free-form blob the operator can edit, identifiers are typed, normalised and
|
|
56565
|
+
* written ONLY by the provider that owns the device (`device-manager.
|
|
56566
|
+
* setIdentifiers`, owner-checked on the transport's caller stamp).
|
|
56567
|
+
*
|
|
56568
|
+
* | Key | Stored form | Strength |
|
|
56569
|
+
* | -------------- | ----------------------------------- | -------- |
|
|
56570
|
+
* | `mac` | `aa:bb:cc:dd:ee:ff`, several | strong |
|
|
56571
|
+
* | `serial` | `<manufacturer>:<serial>` | strong |
|
|
56572
|
+
* | `machine-uuid` | SMBIOS / VM / container uuid | strong |
|
|
56573
|
+
* | `vendor-uid` | `<vendor>:<id>` | strong |
|
|
56574
|
+
* | `hostname` | lower-case, no domain | weak |
|
|
56575
|
+
* | `ip` | IPv4 / IPv6 | weak |
|
|
56576
|
+
*
|
|
56577
|
+
* Strength is a property of the KEY, derived by {@link identifierStrength} —
|
|
56578
|
+
* never stored, so it cannot drift from the table above. A weak key never links
|
|
56579
|
+
* two devices on its own.
|
|
56580
|
+
*
|
|
56581
|
+
* The schema refuses a value that is not in its stored form, so whatever is
|
|
56582
|
+
* persisted is already normalised. Build a declaration with
|
|
56583
|
+
* {@link normaliseIdentifiers}, which turns the raw values a driver read into
|
|
56584
|
+
* that form and names every value it refused.
|
|
56585
|
+
*/
|
|
56586
|
+
var DEVICE_IDENTIFIER_KEYS = [
|
|
56587
|
+
"mac",
|
|
56588
|
+
"serial",
|
|
56589
|
+
"machine-uuid",
|
|
56590
|
+
"vendor-uid",
|
|
56591
|
+
"hostname",
|
|
56592
|
+
"ip"
|
|
56593
|
+
];
|
|
56594
|
+
var DeviceIdentifierKeySchema = zod.z.enum(DEVICE_IDENTIFIER_KEYS);
|
|
56595
|
+
/** `read` — the provider read it from the device; `derived` — computed from something else it read. */
|
|
56596
|
+
var DeviceIdentifierOriginSchema = zod.z.enum(["read", "derived"]);
|
|
56597
|
+
var MAC_PATTERN = /^[0-9a-f]{2}(?::[0-9a-f]{2}){5}$/;
|
|
56598
|
+
/** `<prefix>:<value>` — prefix a lower-case slug, value lower-case and non-blank. */
|
|
56599
|
+
var PREFIXED_PATTERN = /^[a-z0-9][a-z0-9._-]*:[^\sA-Z]+$/;
|
|
56600
|
+
var MACHINE_UUID_PATTERN = /^[0-9a-f][0-9a-f-]{7,}$/;
|
|
56601
|
+
var HOSTNAME_PATTERN = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/;
|
|
56602
|
+
function entrySchema(value) {
|
|
56603
|
+
return zod.z.object({
|
|
56604
|
+
value,
|
|
56605
|
+
origin: DeviceIdentifierOriginSchema,
|
|
56606
|
+
/** Epoch ms of the FIRST read that produced this value (and origin). A later
|
|
56607
|
+
* read of the same value does not move it — see {@link mergeIdentifiers}. */
|
|
56608
|
+
readAt: zod.z.number().int().nonnegative()
|
|
56609
|
+
}).strict();
|
|
56610
|
+
}
|
|
56611
|
+
var MacEntrySchema = entrySchema(zod.z.string().regex(MAC_PATTERN));
|
|
56612
|
+
var SerialEntrySchema = entrySchema(zod.z.string().regex(PREFIXED_PATTERN));
|
|
56613
|
+
var MachineUuidEntrySchema = entrySchema(zod.z.string().regex(MACHINE_UUID_PATTERN));
|
|
56614
|
+
var VendorUidEntrySchema = entrySchema(zod.z.string().regex(PREFIXED_PATTERN));
|
|
56615
|
+
var HostnameEntrySchema = entrySchema(zod.z.string().regex(HOSTNAME_PATTERN));
|
|
56616
|
+
var IpEntrySchema = entrySchema(zod.z.union([zod.z.ipv4(), zod.z.ipv6()]));
|
|
56617
|
+
var DeviceIdentifierEntrySchema = zod.z.object({
|
|
56618
|
+
value: zod.z.string().min(1),
|
|
56619
|
+
origin: DeviceIdentifierOriginSchema,
|
|
56620
|
+
readAt: zod.z.number().int().nonnegative()
|
|
56621
|
+
}).strict();
|
|
56622
|
+
/** The typed declaration. Every key optional; `mac` the only one that holds several. */
|
|
56623
|
+
var DeviceIdentifiersSchema = zod.z.object({
|
|
56624
|
+
mac: zod.z.array(MacEntrySchema).min(1).readonly().optional(),
|
|
56625
|
+
serial: SerialEntrySchema.optional(),
|
|
56626
|
+
"machine-uuid": MachineUuidEntrySchema.optional(),
|
|
56627
|
+
"vendor-uid": VendorUidEntrySchema.optional(),
|
|
56628
|
+
hostname: HostnameEntrySchema.optional(),
|
|
56629
|
+
ip: IpEntrySchema.optional()
|
|
56630
|
+
}).strict();
|
|
56631
|
+
var STRENGTH = {
|
|
56632
|
+
mac: "strong",
|
|
56633
|
+
serial: "strong",
|
|
56634
|
+
"machine-uuid": "strong",
|
|
56635
|
+
"vendor-uid": "strong",
|
|
56636
|
+
hostname: "weak",
|
|
56637
|
+
ip: "weak"
|
|
56638
|
+
};
|
|
56639
|
+
/** How much a match on this key says about two devices being the same object. */
|
|
56640
|
+
function identifierStrength(key) {
|
|
56641
|
+
return STRENGTH[key];
|
|
56642
|
+
}
|
|
56643
|
+
/** True when the declaration carries no key at all. */
|
|
56644
|
+
function isEmptyIdentifiers(identifiers) {
|
|
56645
|
+
return DEVICE_IDENTIFIER_KEYS.every((key) => identifiers[key] === void 0);
|
|
56646
|
+
}
|
|
56647
|
+
/** Values devices report when they do not know: never an identity. */
|
|
56648
|
+
var PLACEHOLDER_PATTERN = /^(?:unknown|none|n\/?a|null|undefined|default|0+|-+)$/i;
|
|
56649
|
+
var NULL_MACS = new Set(["00:00:00:00:00:00", "ff:ff:ff:ff:ff:ff"]);
|
|
56650
|
+
function rejected(reason) {
|
|
56651
|
+
return {
|
|
56652
|
+
ok: false,
|
|
56653
|
+
reason
|
|
56654
|
+
};
|
|
56655
|
+
}
|
|
56656
|
+
/** `AA-BB-CC-DD-EE-FF`, `aabb.ccdd.eeff`, `AABBCCDDEEFF` → `aa:bb:cc:dd:ee:ff`. */
|
|
56657
|
+
function normaliseMac(raw) {
|
|
56658
|
+
const hex = raw.trim().toLowerCase().replace(/[\s:.-]/g, "");
|
|
56659
|
+
if (!/^[0-9a-f]{12}$/.test(hex)) return rejected("not a 48-bit MAC");
|
|
56660
|
+
const mac = (hex.match(/../g) ?? []).join(":");
|
|
56661
|
+
if (NULL_MACS.has(mac)) return rejected("placeholder MAC");
|
|
56662
|
+
return {
|
|
56663
|
+
ok: true,
|
|
56664
|
+
value: mac
|
|
56665
|
+
};
|
|
56666
|
+
}
|
|
56667
|
+
function slug$2(raw) {
|
|
56668
|
+
return raw.trim().toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^[-._]+|[-._]+$/g, "");
|
|
56669
|
+
}
|
|
56670
|
+
function normalisePrefixed(prefixRaw, valueRaw, what) {
|
|
56671
|
+
const prefix = slug$2(prefixRaw);
|
|
56672
|
+
if (prefix.length === 0) return rejected(`no ${what}`);
|
|
56673
|
+
const value = valueRaw.trim().toLowerCase().replace(/\s+/g, "");
|
|
56674
|
+
if (value.length === 0) return rejected("blank value");
|
|
56675
|
+
if (PLACEHOLDER_PATTERN.test(value)) return rejected("placeholder value");
|
|
56676
|
+
return {
|
|
56677
|
+
ok: true,
|
|
56678
|
+
value: `${prefix}:${value}`
|
|
56679
|
+
};
|
|
56680
|
+
}
|
|
56681
|
+
function normaliseMachineUuid(raw) {
|
|
56682
|
+
const value = raw.trim().toLowerCase().replace(/^\{|\}$/g, "");
|
|
56683
|
+
if (!MACHINE_UUID_PATTERN.test(value)) return rejected("not a uuid");
|
|
56684
|
+
if (/^[0-]+$/.test(value) || /^[f-]+$/.test(value)) return rejected("placeholder uuid");
|
|
56685
|
+
return {
|
|
56686
|
+
ok: true,
|
|
56687
|
+
value
|
|
56688
|
+
};
|
|
56689
|
+
}
|
|
56690
|
+
function isIp(value) {
|
|
56691
|
+
return zod.z.union([zod.z.ipv4(), zod.z.ipv6()]).safeParse(value).success;
|
|
56692
|
+
}
|
|
56693
|
+
function normaliseHostname(raw) {
|
|
56694
|
+
const full = raw.trim().toLowerCase().replace(/\.$/, "");
|
|
56695
|
+
if (full.length === 0) return rejected("blank hostname");
|
|
56696
|
+
if (isIp(full)) return rejected("an address, not a hostname");
|
|
56697
|
+
const label = full.split(".")[0] ?? "";
|
|
56698
|
+
if (!HOSTNAME_PATTERN.test(label)) return rejected("not a hostname");
|
|
56699
|
+
if (label === "localhost") return rejected("placeholder hostname");
|
|
56700
|
+
return {
|
|
56701
|
+
ok: true,
|
|
56702
|
+
value: label
|
|
56703
|
+
};
|
|
56704
|
+
}
|
|
56705
|
+
function normaliseIp(raw) {
|
|
56706
|
+
const value = raw.trim().toLowerCase().replace(/^\[|\]$/g, "");
|
|
56707
|
+
if (!isIp(value)) return rejected("not an IP address");
|
|
56708
|
+
if (value === "0.0.0.0" || value === "::" || value === "::1" || value.startsWith("127.")) return rejected("loopback or unspecified address");
|
|
56709
|
+
return {
|
|
56710
|
+
ok: true,
|
|
56711
|
+
value
|
|
56712
|
+
};
|
|
56713
|
+
}
|
|
56714
|
+
function isBlank(value) {
|
|
56715
|
+
return value === null || value === void 0 || value.trim().length === 0;
|
|
56716
|
+
}
|
|
56717
|
+
/**
|
|
56718
|
+
* Turn what a driver read into a valid {@link DeviceIdentifiers}: MACs lower-case
|
|
56719
|
+
* with colons and de-duplicated, a hostname without its domain, an IP validated,
|
|
56720
|
+
* a serial prefixed by its manufacturer, a vendor uid by its vendor. A value that
|
|
56721
|
+
* cannot be normalised is left out and listed in `rejected` — the caller logs it
|
|
56722
|
+
* (with `tags: { deviceId }`), it is never dropped in silence.
|
|
56723
|
+
*/
|
|
56724
|
+
function normaliseIdentifiers(raw, options = {}) {
|
|
56725
|
+
const readAt = options.readAt ?? Date.now();
|
|
56726
|
+
const originOf = (key) => options.originByKey?.[key] ?? options.origin ?? "read";
|
|
56727
|
+
const entry = (key, value) => ({
|
|
56728
|
+
value,
|
|
56729
|
+
origin: originOf(key),
|
|
56730
|
+
readAt
|
|
56731
|
+
});
|
|
56732
|
+
const refused = [];
|
|
56733
|
+
const take = (key, input, result) => {
|
|
56734
|
+
if (result.ok) return entry(key, result.value);
|
|
56735
|
+
refused.push({
|
|
56736
|
+
key,
|
|
56737
|
+
value: input,
|
|
56738
|
+
reason: result.reason
|
|
56739
|
+
});
|
|
56740
|
+
};
|
|
56741
|
+
const macInputs = raw.mac === null || raw.mac === void 0 ? [] : [raw.mac].flat();
|
|
56742
|
+
const macs = [];
|
|
56743
|
+
for (const input of macInputs) {
|
|
56744
|
+
if (isBlank(input)) continue;
|
|
56745
|
+
const taken = take("mac", input, normaliseMac(input));
|
|
56746
|
+
if (taken !== void 0 && !macs.some((m) => m.value === taken.value)) macs.push(taken);
|
|
56747
|
+
}
|
|
56748
|
+
const serial = raw.serial === null || raw.serial === void 0 || isBlank(raw.serial.serial) ? void 0 : take("serial", `${raw.serial.manufacturer}:${raw.serial.serial}`, normalisePrefixed(raw.serial.manufacturer, raw.serial.serial, "manufacturer"));
|
|
56749
|
+
const vendorUid = raw.vendorUid === null || raw.vendorUid === void 0 || isBlank(raw.vendorUid.id) ? void 0 : take("vendor-uid", `${raw.vendorUid.vendor}:${raw.vendorUid.id}`, normalisePrefixed(raw.vendorUid.vendor, raw.vendorUid.id, "vendor"));
|
|
56750
|
+
const machineUuid = isBlank(raw.machineUuid) ? void 0 : take("machine-uuid", raw.machineUuid, normaliseMachineUuid(raw.machineUuid));
|
|
56751
|
+
const host = isBlank(raw.host) ? null : raw.host.trim();
|
|
56752
|
+
const hostIsIp = host !== null && isIp(host.toLowerCase().replace(/^\[|\]$/g, ""));
|
|
56753
|
+
const hostnameInput = isBlank(raw.hostname) ? hostIsIp ? null : host : raw.hostname;
|
|
56754
|
+
const ipInput = isBlank(raw.ip) ? hostIsIp ? host : null : raw.ip;
|
|
56755
|
+
const hostname = hostnameInput === null ? void 0 : take("hostname", hostnameInput, normaliseHostname(hostnameInput));
|
|
56756
|
+
const ip = ipInput === null ? void 0 : take("ip", ipInput, normaliseIp(ipInput));
|
|
56757
|
+
return {
|
|
56758
|
+
identifiers: {
|
|
56759
|
+
...macs.length > 0 ? { mac: macs } : {},
|
|
56760
|
+
...serial !== void 0 ? { serial } : {},
|
|
56761
|
+
...machineUuid !== void 0 ? { "machine-uuid": machineUuid } : {},
|
|
56762
|
+
...vendorUid !== void 0 ? { "vendor-uid": vendorUid } : {},
|
|
56763
|
+
...hostname !== void 0 ? { hostname } : {},
|
|
56764
|
+
...ip !== void 0 ? { ip } : {}
|
|
56765
|
+
},
|
|
56766
|
+
rejected: refused
|
|
56767
|
+
};
|
|
56768
|
+
}
|
|
56769
|
+
function sameEntry(a, b) {
|
|
56770
|
+
return a.value === b.value && a.origin === b.origin;
|
|
56771
|
+
}
|
|
56772
|
+
/** `next`, but with the stored entry wherever value and origin are unchanged. */
|
|
56773
|
+
function keepStoredEntry(next, stored) {
|
|
56774
|
+
return stored !== void 0 && sameEntry(next, stored) ? stored : next;
|
|
56775
|
+
}
|
|
56776
|
+
/**
|
|
56777
|
+
* The declaration to store when the owning provider declares `next` over
|
|
56778
|
+
* `stored` (D1059).
|
|
56779
|
+
*
|
|
56780
|
+
* - A kind in `unread` — the provider TRIED to read it and the read failed —
|
|
56781
|
+
* keeps its stored entry: a failed read changes nothing (D49).
|
|
56782
|
+
* - Every other kind is what `next` says: a kind absent from `next` was read and
|
|
56783
|
+
* found absent, so it is removed.
|
|
56784
|
+
* - An entry whose value and origin are unchanged keeps its stored `readAt`:
|
|
56785
|
+
* `readAt` is when that value was FIRST read, so a provider re-declaring on every
|
|
56786
|
+
* boot writes nothing and emits nothing.
|
|
56787
|
+
*
|
|
56788
|
+
* Returns `null` when nothing is left.
|
|
56789
|
+
*/
|
|
56790
|
+
function mergeIdentifiers(stored, next, unread = []) {
|
|
56791
|
+
const before = stored ?? {};
|
|
56792
|
+
const after = next ?? {};
|
|
56793
|
+
const failed = new Set(unread);
|
|
56794
|
+
const macs = failed.has("mac") ? before.mac : after.mac?.map((m) => keepStoredEntry(m, before.mac?.find((s) => sameEntry(s, m))));
|
|
56795
|
+
const single = (key) => {
|
|
56796
|
+
if (failed.has(key)) return before[key];
|
|
56797
|
+
const entry = after[key];
|
|
56798
|
+
return entry === void 0 ? void 0 : keepStoredEntry(entry, before[key]);
|
|
56799
|
+
};
|
|
56800
|
+
const serial = single("serial");
|
|
56801
|
+
const machineUuid = single("machine-uuid");
|
|
56802
|
+
const vendorUid = single("vendor-uid");
|
|
56803
|
+
const hostname = single("hostname");
|
|
56804
|
+
const ip = single("ip");
|
|
56805
|
+
const merged = {
|
|
56806
|
+
...macs !== void 0 && macs.length > 0 ? { mac: macs } : {},
|
|
56807
|
+
...serial !== void 0 ? { serial } : {},
|
|
56808
|
+
...machineUuid !== void 0 ? { "machine-uuid": machineUuid } : {},
|
|
56809
|
+
...vendorUid !== void 0 ? { "vendor-uid": vendorUid } : {},
|
|
56810
|
+
...hostname !== void 0 ? { hostname } : {},
|
|
56811
|
+
...ip !== void 0 ? { ip } : {}
|
|
56812
|
+
};
|
|
56813
|
+
return isEmptyIdentifiers(merged) ? null : merged;
|
|
56814
|
+
}
|
|
56815
|
+
/** True when two declarations hold the same entries, `readAt` included (key order ignored). */
|
|
56816
|
+
function sameIdentifiers(a, b) {
|
|
56817
|
+
const canonical = (v) => v === null || v === void 0 || isEmptyIdentifiers(v) ? "" : JSON.stringify(DEVICE_IDENTIFIER_KEYS.map((key) => [key, v[key] ?? null]).map(([key, e]) => [key, e === null ? null : [e].flat().map((x) => [
|
|
56818
|
+
x.value,
|
|
56819
|
+
x.origin,
|
|
56820
|
+
x.readAt
|
|
56821
|
+
])]));
|
|
56822
|
+
return canonical(a) === canonical(b);
|
|
56823
|
+
}
|
|
56824
|
+
//#endregion
|
|
56469
56825
|
//#region src/capabilities/device-search.ts
|
|
56470
56826
|
/**
|
|
56471
56827
|
* `deviceManager.search` — the query behind the device → value picker.
|
|
@@ -57048,6 +57404,10 @@ var DeviceInfoSchema = zod.z.object({
|
|
|
57048
57404
|
/** Hardware + identity blob (manufacturer / model / firmware / sn /
|
|
57049
57405
|
* uid / mac / …). Populated by drivers; editable via setMetadata. */
|
|
57050
57406
|
metadata: zod.z.record(zod.z.string(), zod.z.unknown()).nullable().optional(),
|
|
57407
|
+
/** Provider-declared identifiers (D1059): typed, normalised, written only by
|
|
57408
|
+
* the owning provider via `setIdentifiers`; read-only for the operator.
|
|
57409
|
+
* Absent ⇒ the provider declared none. */
|
|
57410
|
+
identifiers: DeviceIdentifiersSchema.optional(),
|
|
57051
57411
|
/** Optional upstream-system identity + rendering envelope. See
|
|
57052
57412
|
* `SourceInfo` in `packages/types/src/device/source-info.ts`. */
|
|
57053
57413
|
sourceInfo: SourceInfoSchema.optional(),
|
|
@@ -57214,6 +57574,8 @@ var DeviceMetaSchema = zod.z.object({
|
|
|
57214
57574
|
disabled: zod.z.boolean(),
|
|
57215
57575
|
parentDeviceId: zod.z.number().nullable(),
|
|
57216
57576
|
metadata: zod.z.record(zod.z.string(), zod.z.unknown()).nullable().optional(),
|
|
57577
|
+
/** Provider-declared identifiers (D1059). See `DeviceMeta.identifiers`. */
|
|
57578
|
+
identifiers: DeviceIdentifiersSchema.optional(),
|
|
57217
57579
|
/** Optional upstream-system identity + rendering envelope. See
|
|
57218
57580
|
* `SourceInfo`. Present when the device has been persisted with a
|
|
57219
57581
|
* non-synthetic source identifier (HA entities, vendor MAC, …);
|
|
@@ -57695,6 +58057,26 @@ var deviceManagerCapability = {
|
|
|
57695
58057
|
kind: "mutation",
|
|
57696
58058
|
auth: "admin"
|
|
57697
58059
|
}),
|
|
58060
|
+
/** Declare the device's identifiers (D1059) — the typed, normalised keys
|
|
58061
|
+
* (`mac`, `serial`, `machine-uuid`, `vendor-uid`, `hostname`, `ip`) a later
|
|
58062
|
+
* step matches across integrations. Each kind is REPLACED by what this call
|
|
58063
|
+
* says (absent = read and found absent, removed) EXCEPT the kinds listed in
|
|
58064
|
+
* `unread` — the reads that FAILED this time — which keep their stored value.
|
|
58065
|
+
* An unchanged value keeps its first `readAt`; a call that changes nothing
|
|
58066
|
+
* writes and emits nothing. `null` clears every read kind. Accepted only from the provider that OWNS the device: the
|
|
58067
|
+
* caller stamp the transport sets (`callerAddonId`) must equal the row's
|
|
58068
|
+
* `addonId`, so an operator session — which carries no stamp — is refused.
|
|
58069
|
+
* Build the value with `normaliseIdentifiers` (`@camstack/types`); a device
|
|
58070
|
+
* calls it through `BaseDevice.declareIdentifiers`. */
|
|
58071
|
+
setIdentifiers: require_sleep.method(zod.z.object({
|
|
58072
|
+
deviceId: zod.z.number(),
|
|
58073
|
+
identifiers: DeviceIdentifiersSchema.nullable(),
|
|
58074
|
+
/** Kinds the provider tried to read and could not: their stored value is kept. */
|
|
58075
|
+
unread: zod.z.array(DeviceIdentifierKeySchema).optional()
|
|
58076
|
+
}), zod.z.void(), {
|
|
58077
|
+
kind: "mutation",
|
|
58078
|
+
auth: "admin"
|
|
58079
|
+
}),
|
|
57698
58080
|
/** Operator-curated location registry. Returns the union of:
|
|
57699
58081
|
* (1) labels persisted in the registry via `addLocation`, and
|
|
57700
58082
|
* (2) labels currently in use on at least one device's
|
|
@@ -64623,6 +65005,7 @@ var HERO_SCENE_BY_TYPE = {
|
|
|
64623
65005
|
[require_composed_stable_id.DeviceType.WaterHeater]: "heater",
|
|
64624
65006
|
[require_composed_stable_id.DeviceType.HeatPump]: "heat-pump",
|
|
64625
65007
|
[require_composed_stable_id.DeviceType.EnergySystem]: "generic",
|
|
65008
|
+
[require_composed_stable_id.DeviceType.Workload]: "generic",
|
|
64626
65009
|
[require_composed_stable_id.DeviceType.Fan]: "fan",
|
|
64627
65010
|
[require_composed_stable_id.DeviceType.MediaPlayer]: "tv",
|
|
64628
65011
|
[require_composed_stable_id.DeviceType.AlarmPanel]: "alarm",
|
|
@@ -64665,6 +65048,7 @@ var HERO_SCENE_BY_ROLE = {
|
|
|
64665
65048
|
[require_composed_stable_id.DeviceRole.SwitchHeater]: "heater",
|
|
64666
65049
|
[require_composed_stable_id.DeviceRole.SwitchFan]: "fan",
|
|
64667
65050
|
[require_composed_stable_id.DeviceRole.SwitchLight]: "light",
|
|
65051
|
+
[require_composed_stable_id.DeviceRole.PoePort]: "plug",
|
|
64668
65052
|
[require_composed_stable_id.DeviceRole.ClimateAc]: "ac",
|
|
64669
65053
|
[require_composed_stable_id.DeviceRole.ClimateThermostat]: "inherit",
|
|
64670
65054
|
[require_composed_stable_id.DeviceRole.ClimateFloor]: "inherit",
|
|
@@ -64709,7 +65093,12 @@ var HERO_SCENE_BY_ROLE = {
|
|
|
64709
65093
|
[require_composed_stable_id.DeviceRole.MessagingNotifier]: "inherit",
|
|
64710
65094
|
[require_composed_stable_id.DeviceRole.EmailNotifier]: "inherit",
|
|
64711
65095
|
[require_composed_stable_id.DeviceRole.GenericNotifier]: "inherit",
|
|
64712
|
-
[require_composed_stable_id.DeviceRole.IrTransmitter]: "inherit"
|
|
65096
|
+
[require_composed_stable_id.DeviceRole.IrTransmitter]: "inherit",
|
|
65097
|
+
[require_composed_stable_id.DeviceRole.Vm]: "inherit",
|
|
65098
|
+
[require_composed_stable_id.DeviceRole.AppContainer]: "inherit",
|
|
65099
|
+
[require_composed_stable_id.DeviceRole.Lxc]: "inherit",
|
|
65100
|
+
[require_composed_stable_id.DeviceRole.App]: "inherit",
|
|
65101
|
+
[require_composed_stable_id.DeviceRole.Host]: "inherit"
|
|
64713
65102
|
};
|
|
64714
65103
|
function isDeviceType$3(type) {
|
|
64715
65104
|
return Object.values(require_composed_stable_id.DeviceType).includes(type);
|
|
@@ -65057,8 +65446,12 @@ var HeroPowerSupplySlotSchema = zod.z.object({
|
|
|
65057
65446
|
/** Off asks for a confirmation while the device runs. */
|
|
65058
65447
|
confirmOffWhileRunning: zod.z.boolean(),
|
|
65059
65448
|
running: zod.z.boolean().nullable(),
|
|
65060
|
-
|
|
65061
|
-
|
|
65449
|
+
/**
|
|
65450
|
+
* `null` when the linked switch ANSWERED it only reports (a PoE port seen through an
|
|
65451
|
+
* API key): power on / off would always be refused. The restart stays (D1058).
|
|
65452
|
+
*/
|
|
65453
|
+
powerOn: HeroActionSchema.nullable(),
|
|
65454
|
+
powerOff: HeroActionSchema.nullable(),
|
|
65062
65455
|
restart: HeroActionSchema
|
|
65063
65456
|
});
|
|
65064
65457
|
var HeroStateBackdropSchema = zod.z.object({
|
|
@@ -79536,6 +79929,19 @@ var NetworkLinkStatusSchema = zod.z.object({
|
|
|
79536
79929
|
rssi: zod.z.number().optional().meta(require_sleep.readingMeta("signal-level")),
|
|
79537
79930
|
/** Network name of a wireless link, when the firmware reports it. */
|
|
79538
79931
|
ssid: zod.z.string().optional(),
|
|
79932
|
+
/**
|
|
79933
|
+
* Negotiated link speed of a wired port, the `bitrate` quantity in its base
|
|
79934
|
+
* unit, kbit/s (a gigabit port is 1 000 000); the display picks the unit.
|
|
79935
|
+
* `null` = the port is down or the speed is not known; absent = the provider
|
|
79936
|
+
* never reports one.
|
|
79937
|
+
*/
|
|
79938
|
+
speedKbps: zod.z.number().nonnegative().nullable().optional().meta(require_sleep.readingMeta("bitrate")),
|
|
79939
|
+
/**
|
|
79940
|
+
* Whether the link is up. `type` names the medium, not its state, so a wired
|
|
79941
|
+
* port that lost its link is `ethernet` + `linkUp: false`. `null` = not known;
|
|
79942
|
+
* absent = the provider never reports it.
|
|
79943
|
+
*/
|
|
79944
|
+
linkUp: zod.z.boolean().nullable().optional(),
|
|
79539
79945
|
/** Ms epoch of the last observation. Lets consumers reason about freshness. */
|
|
79540
79946
|
lastUpdated: zod.z.number().meta(require_sleep.readingMeta("none"))
|
|
79541
79947
|
});
|
|
@@ -82101,7 +82507,32 @@ var NcRuleInputSchema = zod.z.object({
|
|
|
82101
82507
|
* authored before this field meant. An editor turns it off by writing
|
|
82102
82508
|
* `false`, so it needs no `clear` key.
|
|
82103
82509
|
*/
|
|
82104
|
-
askVerdict: zod.z.boolean().optional()
|
|
82510
|
+
askVerdict: zod.z.boolean().optional(),
|
|
82511
|
+
/**
|
|
82512
|
+
* Operator tags (D1054), kept on the rule like a core block's. Absent = no
|
|
82513
|
+
* tags. `.optional()`, never `.default()`: a partial `updateRule` patch that
|
|
82514
|
+
* does not name `tags` keeps the stored ones (the store merges), and an
|
|
82515
|
+
* editor empties them by sending `[]` (the store drops an empty list).
|
|
82516
|
+
* Renamed or removed fleet-wide only through the `tags` cap, which writes
|
|
82517
|
+
* here with `setRuleTags`.
|
|
82518
|
+
*/
|
|
82519
|
+
tags: TagsFieldSchema.optional()
|
|
82520
|
+
});
|
|
82521
|
+
/**
|
|
82522
|
+
* The rule kinds that carry tags (D1054) — each one its own store. Every kind
|
|
82523
|
+
* labels its rules the same way; this names which store a tag write goes to.
|
|
82524
|
+
*/
|
|
82525
|
+
var NcTaggedRuleKindSchema = zod.z.enum([
|
|
82526
|
+
"event",
|
|
82527
|
+
"summary",
|
|
82528
|
+
"timelapse",
|
|
82529
|
+
"calendar-events"
|
|
82530
|
+
]);
|
|
82531
|
+
/** One rule's tags, as the `tags` cap reads them across every kind. */
|
|
82532
|
+
var NcRuleTagsEntrySchema = zod.z.object({
|
|
82533
|
+
kind: NcTaggedRuleKindSchema,
|
|
82534
|
+
ruleId: zod.z.string(),
|
|
82535
|
+
tags: zod.z.array(zod.z.string())
|
|
82105
82536
|
});
|
|
82106
82537
|
/**
|
|
82107
82538
|
* Partial patch for `updateRule` — any subset of the input fields, plus the
|
|
@@ -83824,6 +84255,29 @@ var notificationRulesCapability = {
|
|
|
83824
84255
|
auth: "admin"
|
|
83825
84256
|
}),
|
|
83826
84257
|
/**
|
|
84258
|
+
* Every rule of every kind with its tags (D1054) — event rules, summaries,
|
|
84259
|
+
* timelapses and calendar-events rules. The `tags` cap counts and rewrites
|
|
84260
|
+
* from this one read; a rule without tags is listed with `[]`.
|
|
84261
|
+
*/
|
|
84262
|
+
listRuleTags: require_sleep.method(zod.z.object({}), zod.z.object({ rules: zod.z.array(NcRuleTagsEntrySchema) }), {
|
|
84263
|
+
kind: "query",
|
|
84264
|
+
auth: "admin"
|
|
84265
|
+
}),
|
|
84266
|
+
/**
|
|
84267
|
+
* Replace ONE rule's tags (D1054) and nothing else — the `tags` cap's rename
|
|
84268
|
+
* and remove write through this. `kind` names the store the rule lives in.
|
|
84269
|
+
* Normalised on write (trimmed, deduplicated case-insensitively); `[]`
|
|
84270
|
+
* clears them.
|
|
84271
|
+
*/
|
|
84272
|
+
setRuleTags: require_sleep.method(zod.z.object({
|
|
84273
|
+
kind: NcTaggedRuleKindSchema,
|
|
84274
|
+
ruleId: zod.z.string(),
|
|
84275
|
+
tags: TagsFieldSchema
|
|
84276
|
+
}), zod.z.object({ success: zod.z.literal(true) }), {
|
|
84277
|
+
kind: "mutation",
|
|
84278
|
+
auth: "admin"
|
|
84279
|
+
}),
|
|
84280
|
+
/**
|
|
83827
84281
|
* WHAT THE RULES ACTUALLY ASK the stream broker to retain, per camera.
|
|
83828
84282
|
*
|
|
83829
84283
|
* The notification centre owns the rules, so it is the only thing that can
|
|
@@ -92000,7 +92454,18 @@ var videoclipsCapability = {
|
|
|
92000
92454
|
* older than this field keeps working unchanged (D382 — an unstated
|
|
92001
92455
|
* ask is zero).
|
|
92002
92456
|
*/
|
|
92003
|
-
audio: ClipStreamAudioSchema.optional()
|
|
92457
|
+
audio: ClipStreamAudioSchema.optional(),
|
|
92458
|
+
/**
|
|
92459
|
+
* The operator's authorisation to wake a sleeping camera for this
|
|
92460
|
+
* dial — the same {@link ClipWakeSchema} the byte reads carry. Absent
|
|
92461
|
+
* — the default — means a sleeping standalone battery camera is
|
|
92462
|
+
* REFUSED by name before any URL is minted. A caller sets it only
|
|
92463
|
+
* when a viewer itself asked for the clip (the broker's `playClip`);
|
|
92464
|
+
* a prefetch, a reconcile or a retry never does. With it, the
|
|
92465
|
+
* provider wakes the camera and waits under a bound; a camera that
|
|
92466
|
+
* does not come up is refused `wake-timeout`, naming the wait.
|
|
92467
|
+
*/
|
|
92468
|
+
wake: ClipWakeSchema.optional()
|
|
92004
92469
|
}), ClipStreamDialSchema, {
|
|
92005
92470
|
kind: "query",
|
|
92006
92471
|
auth: "protected"
|
|
@@ -92366,7 +92831,8 @@ var ClipExportFailureSchema = zod.z.enum([
|
|
|
92366
92831
|
"camera-refused",
|
|
92367
92832
|
"fetch-failed",
|
|
92368
92833
|
"too-large-to-transfer",
|
|
92369
|
-
"wake-expired"
|
|
92834
|
+
"wake-expired",
|
|
92835
|
+
"wake-timeout"
|
|
92370
92836
|
]);
|
|
92371
92837
|
/** `<token>: <prose>` — the ONE composition of a clip export's failure string. */
|
|
92372
92838
|
function clipExportFailure(code, detail) {
|
|
@@ -95224,6 +95690,16 @@ var SirenOptionsSchema = zod.z.object({
|
|
|
95224
95690
|
rangeSeconds: SirenDurationRangeSchema.nullable(),
|
|
95225
95691
|
/** The camera's default duration, seconds. */
|
|
95226
95692
|
defaultSeconds: zod.z.number().positive(),
|
|
95693
|
+
/**
|
|
95694
|
+
* Discrete play counts the operator may pick; `null` when the camera gives a
|
|
95695
|
+
* range or does not count plays. Defaults to `null` so a provider that
|
|
95696
|
+
* predates plays (#589) reads as declaring none.
|
|
95697
|
+
*/
|
|
95698
|
+
allowedPlays: zod.z.array(zod.z.number().int().positive()).nullable().default(null),
|
|
95699
|
+
/** Continuous range of play counts; `null` when listed or not counted. */
|
|
95700
|
+
rangePlays: SirenDurationRangeSchema.nullable().default(null),
|
|
95701
|
+
/** The camera's default play count; `null` when the camera does not count plays. */
|
|
95702
|
+
defaultPlays: zod.z.number().int().positive().nullable().default(null),
|
|
95227
95703
|
/** What the camera counts natively. */
|
|
95228
95704
|
unit: zod.z.enum([SirenDurationUnit.Seconds, SirenDurationUnit.Plays]),
|
|
95229
95705
|
/** Seconds one play lasts, when `unit` is `plays`; `null` for a seconds camera. */
|
|
@@ -95240,9 +95716,28 @@ var SirenStatusSchema = zod.z.object({
|
|
|
95240
95716
|
activeUntil: zod.z.number().nullable(),
|
|
95241
95717
|
/** Duration of the current / last activation, seconds; `null` when none yet. */
|
|
95242
95718
|
durationSeconds: zod.z.number().nullable(),
|
|
95719
|
+
/**
|
|
95720
|
+
* The play count of the current / last activation when it was asked in plays;
|
|
95721
|
+
* `null` when it was asked in seconds (or none yet). The unit that was asked.
|
|
95722
|
+
*/
|
|
95723
|
+
plays: zod.z.number().int().positive().nullable().default(null),
|
|
95724
|
+
/**
|
|
95725
|
+
* True when `activeUntil` comes from a seconds-per-play factor the camera did
|
|
95726
|
+
* not report — the siren may fall silent somewhat earlier or later.
|
|
95727
|
+
*/
|
|
95728
|
+
activeUntilEstimated: zod.z.boolean().default(false),
|
|
95243
95729
|
/** Ms epoch of the last trigger (0 = never). */
|
|
95244
95730
|
lastTriggeredAt: zod.z.number()
|
|
95245
95731
|
});
|
|
95732
|
+
/** A trigger asks seconds OR plays (#589); neither means the camera default. */
|
|
95733
|
+
var SirenTriggerInputSchema = zod.z.object({
|
|
95734
|
+
deviceId: zod.z.number().int().nonnegative(),
|
|
95735
|
+
durationSeconds: zod.z.number().positive().optional(),
|
|
95736
|
+
plays: zod.z.number().int().positive().optional()
|
|
95737
|
+
}).refine((input) => input.durationSeconds === void 0 || input.plays === void 0, {
|
|
95738
|
+
message: "a siren trigger takes durationSeconds or plays, not both",
|
|
95739
|
+
path: ["plays"]
|
|
95740
|
+
});
|
|
95246
95741
|
var SirenRuntimeStateSchema = SirenStatusSchema.extend({
|
|
95247
95742
|
/** Ms epoch of the last successful camera read of the options (0 = never). */
|
|
95248
95743
|
lastFetchedAt: zod.z.number() });
|
|
@@ -95259,13 +95754,20 @@ var sirenCapability = {
|
|
|
95259
95754
|
auth: "protected"
|
|
95260
95755
|
}),
|
|
95261
95756
|
/**
|
|
95262
|
-
*
|
|
95263
|
-
*
|
|
95757
|
+
* The play counts a rule may pick: what `getOptions` declares as a list, or
|
|
95758
|
+
* its range spelled out. Empty for a siren that counts seconds.
|
|
95264
95759
|
*/
|
|
95265
|
-
|
|
95266
|
-
|
|
95267
|
-
|
|
95268
|
-
}),
|
|
95760
|
+
getPlayChoices: require_sleep.method(zod.z.object({ deviceId: zod.z.number().int().nonnegative() }), zod.z.array(zod.z.number().int().positive()), {
|
|
95761
|
+
kind: "query",
|
|
95762
|
+
auth: "protected"
|
|
95763
|
+
}),
|
|
95764
|
+
/**
|
|
95765
|
+
* Sound the siren for `durationSeconds` OR `plays` — never both. With
|
|
95766
|
+
* neither the camera default applies. A count on a siren that declares no
|
|
95767
|
+
* plays is refused. Answers the state at the moment of the trigger
|
|
95768
|
+
* (`activeUntil` included).
|
|
95769
|
+
*/
|
|
95770
|
+
trigger: require_sleep.method(SirenTriggerInputSchema, SirenStatusSchema, {
|
|
95269
95771
|
kind: "mutation",
|
|
95270
95772
|
auth: "protected",
|
|
95271
95773
|
actions: [{
|
|
@@ -95274,6 +95776,21 @@ var sirenCapability = {
|
|
|
95274
95776
|
phrase: require_sleep.t("Sound {device}", "Fai suonare {device}"),
|
|
95275
95777
|
icon: "siren",
|
|
95276
95778
|
args: {}
|
|
95779
|
+
}, {
|
|
95780
|
+
id: "siren.triggerPlays",
|
|
95781
|
+
label: require_sleep.t("Sound the siren N times", "Fai suonare la sirena N volte"),
|
|
95782
|
+
phrase: require_sleep.t("Sound {device} {plays} times", "Fai suonare {device} {plays} volte"),
|
|
95783
|
+
icon: "siren",
|
|
95784
|
+
openArgs: [{
|
|
95785
|
+
key: "plays",
|
|
95786
|
+
label: require_sleep.t("Plays", "Riproduzioni"),
|
|
95787
|
+
offer: {
|
|
95788
|
+
kind: "dynamic",
|
|
95789
|
+
from: "method",
|
|
95790
|
+
method: "getPlayChoices",
|
|
95791
|
+
valueKind: "number"
|
|
95792
|
+
}
|
|
95793
|
+
}]
|
|
95277
95794
|
}]
|
|
95278
95795
|
}),
|
|
95279
95796
|
/** Silence the siren now. */
|
|
@@ -97034,6 +97551,27 @@ var SwitchStatusSchema = zod.z.object({
|
|
|
97034
97551
|
/** Ms epoch of the last state change. Useful for UI "X minutes ago". */
|
|
97035
97552
|
lastChangedAt: zod.z.number()
|
|
97036
97553
|
});
|
|
97554
|
+
/**
|
|
97555
|
+
* What a switch can do, from its provider (`getOptions`). A provider that writes no
|
|
97556
|
+
* `getOptions` is a plain on/off switch: the defaults are the old contract.
|
|
97557
|
+
*
|
|
97558
|
+
* - `supportsSetState: false` — the switch reports its state but cannot be set (a PoE port seen only
|
|
97559
|
+
* through an API key). Its provider refuses `setState`; these surfaces withdraw on/off once the
|
|
97560
|
+
* device ANSWERED this (`switchRefusesSetState`): the device hero, the automation action picker
|
|
97561
|
+
* (`offeredWhen` on `switch.on` / `switch.off` / `switch.toggle`), the default `toggle`, the
|
|
97562
|
+
* HomeKit, Alexa and Google exporters, and `power-source` on a device the switch powers
|
|
97563
|
+
* (`getStatus().switchSettable`, `offeredWhen` on `powerSource.on` / `.off`, `not-settable`). A
|
|
97564
|
+
* read that failed or is pending changes nothing (D315).
|
|
97565
|
+
* - `supportsPowerCycle: true` — the device behind the switch can cut and restore its own output in
|
|
97566
|
+
* one native call (a PoE port's power cycle). It has no control of its own: a linked
|
|
97567
|
+
* `power-source.forceRestart` uses it instead of off / wait / on.
|
|
97568
|
+
*/
|
|
97569
|
+
var SwitchOptionsSchema = zod.z.object({
|
|
97570
|
+
supportsSetState: zod.z.boolean().default(true),
|
|
97571
|
+
supportsPowerCycle: zod.z.boolean().default(false)
|
|
97572
|
+
});
|
|
97573
|
+
/** The options of a provider that did not answer `getOptions`: a plain on/off switch. */
|
|
97574
|
+
var SWITCH_DEFAULT_OPTIONS = SwitchOptionsSchema.parse({});
|
|
97037
97575
|
var switchCapability = {
|
|
97038
97576
|
name: "switch",
|
|
97039
97577
|
scope: "device",
|
|
@@ -97061,7 +97599,8 @@ var switchCapability = {
|
|
|
97061
97599
|
field: "on",
|
|
97062
97600
|
value: true
|
|
97063
97601
|
},
|
|
97064
|
-
args: { on: true }
|
|
97602
|
+
args: { on: true },
|
|
97603
|
+
offeredWhen: require_sleep.SWITCH_SETTABLE_GATE
|
|
97065
97604
|
}, {
|
|
97066
97605
|
id: "switch.off",
|
|
97067
97606
|
label: require_sleep.t("Turn off", "Spegni"),
|
|
@@ -97071,9 +97610,16 @@ var switchCapability = {
|
|
|
97071
97610
|
field: "on",
|
|
97072
97611
|
value: false
|
|
97073
97612
|
},
|
|
97074
|
-
args: { on: false }
|
|
97613
|
+
args: { on: false },
|
|
97614
|
+
offeredWhen: require_sleep.SWITCH_SETTABLE_GATE
|
|
97075
97615
|
}]
|
|
97076
97616
|
}),
|
|
97617
|
+
getOptions: require_sleep.optionalMethod(zod.z.object({ deviceId: zod.z.number() }), SwitchOptionsSchema, { auth: "protected" }),
|
|
97618
|
+
powerCycle: require_sleep.optionalMethod(zod.z.object({ deviceId: zod.z.number() }), zod.z.void(), {
|
|
97619
|
+
kind: "mutation",
|
|
97620
|
+
auth: "protected",
|
|
97621
|
+
notOperatorFacing: "a power cycle is the forced restart of the device the switch powers (power-source), never a step of its own"
|
|
97622
|
+
}),
|
|
97077
97623
|
toggle: require_sleep.optionalMethod(zod.z.object({ deviceId: zod.z.number() }), zod.z.void(), {
|
|
97078
97624
|
kind: "mutation",
|
|
97079
97625
|
auth: "protected",
|
|
@@ -97081,7 +97627,8 @@ var switchCapability = {
|
|
|
97081
97627
|
id: "switch.toggle",
|
|
97082
97628
|
label: require_sleep.t("Toggle", "Commuta"),
|
|
97083
97629
|
phrase: require_sleep.t("Toggle {device}", "Commuta {device}"),
|
|
97084
|
-
icon: "toggle-right"
|
|
97630
|
+
icon: "toggle-right",
|
|
97631
|
+
offeredWhen: require_sleep.SWITCH_SETTABLE_GATE
|
|
97085
97632
|
}]
|
|
97086
97633
|
})
|
|
97087
97634
|
},
|
|
@@ -97103,6 +97650,16 @@ var switchCapability = {
|
|
|
97103
97650
|
* not need to re-query the provider after a setState mutation.
|
|
97104
97651
|
*/
|
|
97105
97652
|
runtimeState: SwitchStatusSchema,
|
|
97653
|
+
composedMethods: {
|
|
97654
|
+
getOptions: {
|
|
97655
|
+
kind: "answer",
|
|
97656
|
+
value: SWITCH_DEFAULT_OPTIONS
|
|
97657
|
+
},
|
|
97658
|
+
powerCycle: {
|
|
97659
|
+
kind: "refuse",
|
|
97660
|
+
reason: "a composed switch has no native power cycle"
|
|
97661
|
+
}
|
|
97662
|
+
},
|
|
97106
97663
|
/**
|
|
97107
97664
|
* Runtime-state durability: **restored** — device state an operator reads as authoritative; 55 devices, transition-driven.
|
|
97108
97665
|
*
|
|
@@ -97276,6 +97833,26 @@ var switchCapability = {
|
|
|
97276
97833
|
"switch.off": { icon: "plug" }
|
|
97277
97834
|
},
|
|
97278
97835
|
state: { on: { icon: "plug-zap" } }
|
|
97836
|
+
},
|
|
97837
|
+
[require_composed_stable_id.DeviceRole.PoePort]: {
|
|
97838
|
+
actions: {
|
|
97839
|
+
"switch.on": {
|
|
97840
|
+
label: require_sleep.t("Power on", "Alimenta"),
|
|
97841
|
+
phrase: require_sleep.t("Power on {device}", "Alimenta {device}"),
|
|
97842
|
+
icon: "plug-zap"
|
|
97843
|
+
},
|
|
97844
|
+
"switch.off": {
|
|
97845
|
+
label: require_sleep.t("Power off", "Togli alimentazione"),
|
|
97846
|
+
phrase: require_sleep.t("Power off {device}", "Togli alimentazione a {device}"),
|
|
97847
|
+
icon: "unplug"
|
|
97848
|
+
}
|
|
97849
|
+
},
|
|
97850
|
+
state: { on: {
|
|
97851
|
+
label: require_sleep.t("Powered", "Alimentata"),
|
|
97852
|
+
whenTrue: require_sleep.t("When {device} is powered", "Quando {device} viene alimentata"),
|
|
97853
|
+
whenFalse: require_sleep.t("When {device} loses power", "Quando {device} perde l’alimentazione"),
|
|
97854
|
+
icon: "plug-zap"
|
|
97855
|
+
} }
|
|
97279
97856
|
}
|
|
97280
97857
|
}
|
|
97281
97858
|
}
|
|
@@ -98034,10 +98611,11 @@ var systemCapability = {
|
|
|
98034
98611
|
/**
|
|
98035
98612
|
* tags — the registry of tag STYLES and the one place that renames or removes a
|
|
98036
98613
|
* tag everywhere (D1054). A tag itself lives in the `tags` array of the record it
|
|
98037
|
-
* labels (a core block, a scheduler, a template, an action, a device
|
|
98614
|
+
* labels (a core block, a scheduler, a template, an action, a device, a
|
|
98615
|
+
* notification rule); only its
|
|
98038
98616
|
* colour token and icon are registered here. Provided by the core-blocks builtin,
|
|
98039
|
-
* the one place that knows every owner kind; devices
|
|
98040
|
-
* `deviceManager` over `ctx.api`.
|
|
98617
|
+
* the one place that knows every owner kind; devices and notification rules
|
|
98618
|
+
* are reached through `deviceManager` / `notificationRules` over `ctx.api`.
|
|
98041
98619
|
*
|
|
98042
98620
|
* Tags compare trimmed and case-insensitively. `list` is the union of styled tags
|
|
98043
98621
|
* and tags in use; a tag with no style answers a colour derived from its name and
|
|
@@ -98048,7 +98626,21 @@ var TagUsageCountsSchema = zod.z.object({
|
|
|
98048
98626
|
schedulers: zod.z.number().int().nonnegative(),
|
|
98049
98627
|
templates: zod.z.number().int().nonnegative(),
|
|
98050
98628
|
actions: zod.z.number().int().nonnegative(),
|
|
98051
|
-
devices: zod.z.number().int().nonnegative()
|
|
98629
|
+
devices: zod.z.number().int().nonnegative(),
|
|
98630
|
+
notificationRules: zod.z.number().int().nonnegative()
|
|
98631
|
+
});
|
|
98632
|
+
/**
|
|
98633
|
+
* The counts `list` answers. An owner that could not be read (a forked addon
|
|
98634
|
+
* that is down, redeploying or not installed) is `null` — unknown, never `0`
|
|
98635
|
+
* (D393) — and `list` still answers with the other owners' tags.
|
|
98636
|
+
*/
|
|
98637
|
+
var TagListCountsSchema = zod.z.object({
|
|
98638
|
+
coreBlocks: zod.z.number().int().nonnegative().nullable(),
|
|
98639
|
+
schedulers: zod.z.number().int().nonnegative().nullable(),
|
|
98640
|
+
templates: zod.z.number().int().nonnegative().nullable(),
|
|
98641
|
+
actions: zod.z.number().int().nonnegative().nullable(),
|
|
98642
|
+
devices: zod.z.number().int().nonnegative().nullable(),
|
|
98643
|
+
notificationRules: zod.z.number().int().nonnegative().nullable()
|
|
98052
98644
|
});
|
|
98053
98645
|
var TagEntrySchema = zod.z.object({
|
|
98054
98646
|
name: TagNameSchema,
|
|
@@ -98056,14 +98648,19 @@ var TagEntrySchema = zod.z.object({
|
|
|
98056
98648
|
icon: IconKeySchema,
|
|
98057
98649
|
/** `false` when the operator never chose a style: colour and icon are the derived defaults. */
|
|
98058
98650
|
styled: zod.z.boolean(),
|
|
98059
|
-
|
|
98651
|
+
/** Per owner kind; `null` = that owner could not be read on this call. */
|
|
98652
|
+
counts: TagListCountsSchema
|
|
98060
98653
|
});
|
|
98061
98654
|
var tagsCapability = {
|
|
98062
98655
|
name: "tags",
|
|
98063
98656
|
scope: "system",
|
|
98064
98657
|
mode: "singleton",
|
|
98065
98658
|
methods: {
|
|
98066
|
-
/**
|
|
98659
|
+
/**
|
|
98660
|
+
* Every tag: styled or in use, with how many records of each kind carry it.
|
|
98661
|
+
* An unreachable owner degrades that kind's count to `null`; the call still
|
|
98662
|
+
* answers.
|
|
98663
|
+
*/
|
|
98067
98664
|
list: require_sleep.method(zod.z.object({}), zod.z.array(TagEntrySchema), { auth: "protected" }),
|
|
98068
98665
|
/** Choose the colour and icon of a tag. The tag need not be in use. */
|
|
98069
98666
|
setStyle: require_sleep.method(zod.z.object({
|
|
@@ -98077,7 +98674,9 @@ var tagsCapability = {
|
|
|
98077
98674
|
/**
|
|
98078
98675
|
* Rename a tag on EVERY owner in one call. When `to` already exists the two
|
|
98079
98676
|
* merge and the TARGET's style wins (like `renameLocation`). An empty `to`
|
|
98080
|
-
* is refused before anything is written
|
|
98677
|
+
* is refused before anything is written, and so is any call while an owner
|
|
98678
|
+
* cannot be read (the error names the owner): a rename applied to
|
|
98679
|
+
* only some owners would split the fleet across two spellings.
|
|
98081
98680
|
*/
|
|
98082
98681
|
rename: require_sleep.method(zod.z.object({
|
|
98083
98682
|
from: zod.z.string(),
|
|
@@ -98086,7 +98685,7 @@ var tagsCapability = {
|
|
|
98086
98685
|
kind: "mutation",
|
|
98087
98686
|
auth: "admin"
|
|
98088
98687
|
}),
|
|
98089
|
-
/** Drop a tag from every owner and delete its style. */
|
|
98688
|
+
/** Drop a tag from every owner and delete its style. Refused like `rename` while an owner cannot be read. */
|
|
98090
98689
|
remove: require_sleep.method(zod.z.object({ name: zod.z.string() }), zod.z.object({ updated: TagUsageCountsSchema }), {
|
|
98091
98690
|
kind: "mutation",
|
|
98092
98691
|
auth: "admin"
|
|
@@ -99142,7 +99741,6 @@ var templateCapability = {
|
|
|
99142
99741
|
//#region src/capabilities/terminal-session.cap.ts
|
|
99143
99742
|
/** Profile-exported FormBuilder schema. Shape is ConfigUISchema at the UI. */
|
|
99144
99743
|
var ProfileSettingsSchemaBridge = zod.z.unknown().nullable();
|
|
99145
|
-
var ProfileSettingsBagSchema = zod.z.record(zod.z.string(), zod.z.unknown());
|
|
99146
99744
|
/**
|
|
99147
99745
|
* A live terminal session hosted by the provider addon. Output and input do
|
|
99148
99746
|
* NOT flow through the capability — they use the addon data plane
|
|
@@ -99161,7 +99759,11 @@ var TerminalSessionInfoSchema = zod.z.object({
|
|
|
99161
99759
|
cols: zod.z.number().int().positive(),
|
|
99162
99760
|
rows: zod.z.number().int().positive(),
|
|
99163
99761
|
/** ms-epoch the session's pty was spawned. */
|
|
99164
|
-
startedAt: zod.z.number()
|
|
99762
|
+
startedAt: zod.z.number(),
|
|
99763
|
+
/** User id of the admin who opened it; `unattributed` when the caller was not passed. */
|
|
99764
|
+
openedBy: zod.z.string().optional(),
|
|
99765
|
+
/** ms-epoch of the last pty input or output — what the idle timeout measures. */
|
|
99766
|
+
lastActivityAt: zod.z.number().optional()
|
|
99165
99767
|
});
|
|
99166
99768
|
/**
|
|
99167
99769
|
* A profile the operator may open — a pre-declared, allowlisted program
|
|
@@ -99181,39 +99783,6 @@ var TerminalProfileInfoSchema = zod.z.object({
|
|
|
99181
99783
|
/** ConfigUISchema for instance knobs, or null when the profile has none. */
|
|
99182
99784
|
settingsSchema: ProfileSettingsSchemaBridge.optional()
|
|
99183
99785
|
});
|
|
99184
|
-
/**
|
|
99185
|
-
* A durable operator-created Terminal instance. Profiles are templates; only
|
|
99186
|
-
* an instance declares a camera.
|
|
99187
|
-
*/
|
|
99188
|
-
var TerminalInstanceInfoSchema = zod.z.object({
|
|
99189
|
-
instanceId: zod.z.string(),
|
|
99190
|
-
cameraStableId: zod.z.string(),
|
|
99191
|
-
nodeId: zod.z.string(),
|
|
99192
|
-
/**
|
|
99193
|
-
* False while the node the instance is bound to is not in the cluster
|
|
99194
|
-
* topology (forgotten, renamed, re-paired). The instance is kept; the
|
|
99195
|
-
* operator re-points it on the Terminal page.
|
|
99196
|
-
*/
|
|
99197
|
-
nodeInCluster: zod.z.boolean(),
|
|
99198
|
-
profileId: zod.z.string(),
|
|
99199
|
-
profileLabel: zod.z.string(),
|
|
99200
|
-
name: zod.z.string(),
|
|
99201
|
-
enabled: zod.z.boolean(),
|
|
99202
|
-
executable: zod.z.string(),
|
|
99203
|
-
args: zod.z.array(zod.z.string()).readonly(),
|
|
99204
|
-
cwd: zod.z.string(),
|
|
99205
|
-
environment: zod.z.array(zod.z.string()).readonly(),
|
|
99206
|
-
profileSettings: ProfileSettingsBagSchema
|
|
99207
|
-
});
|
|
99208
|
-
var TerminalLegacyCameraSchema = zod.z.object({
|
|
99209
|
-
stableId: zod.z.string(),
|
|
99210
|
-
nodeId: zod.z.string(),
|
|
99211
|
-
profileId: zod.z.string(),
|
|
99212
|
-
profileLabel: zod.z.string(),
|
|
99213
|
-
name: zod.z.string(),
|
|
99214
|
-
/** Only legacy monitor cameras can retain their historic stable identity. */
|
|
99215
|
-
adoptable: zod.z.boolean()
|
|
99216
|
-
});
|
|
99217
99786
|
var TerminalOutputEventSchema = zod.z.discriminatedUnion("kind", [zod.z.object({
|
|
99218
99787
|
seq: zod.z.number().int().positive(),
|
|
99219
99788
|
kind: zod.z.literal("data"),
|
|
@@ -99245,8 +99814,8 @@ var TerminalOutputBatchSchema = zod.z.object({
|
|
|
99245
99814
|
* terminal-session — singleton system capability for interactive TTY sessions.
|
|
99246
99815
|
*
|
|
99247
99816
|
* Owns both live PTY lifecycle and durable Terminal instance management.
|
|
99248
|
-
* Profiles are allowlisted templates;
|
|
99249
|
-
*
|
|
99817
|
+
* Profiles are allowlisted templates; a Terminal camera is a core block naming
|
|
99818
|
+
* one Terminal (planning#580).
|
|
99250
99819
|
*/
|
|
99251
99820
|
var terminalSessionCapability = {
|
|
99252
99821
|
name: "terminal-session",
|
|
@@ -99255,16 +99824,6 @@ var terminalSessionCapability = {
|
|
|
99255
99824
|
methods: {
|
|
99256
99825
|
/** Pre-declared profiles the operator may open. */
|
|
99257
99826
|
listProfiles: require_sleep.method(zod.z.void(), zod.z.array(TerminalProfileInfoSchema).readonly(), { auth: "admin" }),
|
|
99258
|
-
/** Existing automatic cameras are shown for explicit migration only. */
|
|
99259
|
-
listLegacyCameras: require_sleep.method(zod.z.void(), zod.z.array(TerminalLegacyCameraSchema).readonly(), { auth: "admin" }),
|
|
99260
|
-
/** Explicitly adopt one legacy monitor camera, retaining its stable id. */
|
|
99261
|
-
adoptLegacyMonitor: require_sleep.method(zod.z.object({
|
|
99262
|
-
stableId: zod.z.string().min(1),
|
|
99263
|
-
name: zod.z.string().trim().min(1).max(160).optional()
|
|
99264
|
-
}), TerminalInstanceInfoSchema, {
|
|
99265
|
-
kind: "mutation",
|
|
99266
|
-
auth: "admin"
|
|
99267
|
-
}),
|
|
99268
99827
|
/** Live sessions currently hosted by the provider. */
|
|
99269
99828
|
listSessions: require_sleep.method(zod.z.void(), zod.z.array(TerminalSessionInfoSchema).readonly(), { auth: "admin" }),
|
|
99270
99829
|
/**
|
|
@@ -102477,6 +103036,534 @@ var webrtcSessionCapability = {
|
|
|
102477
103036
|
}
|
|
102478
103037
|
};
|
|
102479
103038
|
//#endregion
|
|
103039
|
+
//#region src/capabilities/workload.cap.ts
|
|
103040
|
+
/**
|
|
103041
|
+
* Workload (#585, D1056): ONE capability for everything that runs on a machine
|
|
103042
|
+
* and for the machine itself — a VM, an app container, an LXC, an app, a host.
|
|
103043
|
+
*
|
|
103044
|
+
* There is no `kind` field: the device ROLE is the only discriminator. It picks
|
|
103045
|
+
* the wording and icons (`vocabulary.overrides.byRole`) and `deviceRoles` keeps
|
|
103046
|
+
* the cap on `workload` devices that carry one of the five roles.
|
|
103047
|
+
*
|
|
103048
|
+
* What a device can do is declared by its provider through `getOptions`, probed,
|
|
103049
|
+
* never assumed: a Docker container has no force stop, a host may offer only a
|
|
103050
|
+
* restart. The derived UI shows only what is declared ({@link deriveWorkloadControls}).
|
|
103051
|
+
*
|
|
103052
|
+
* A value the provider did not report is `null`, never `0` / `false` (D393);
|
|
103053
|
+
* `state: null` is unknown, never stopped.
|
|
103054
|
+
*/
|
|
103055
|
+
/** The lifecycle of a workload. `crashed` = stopped without a request. */
|
|
103056
|
+
var WORKLOAD_STATES = [
|
|
103057
|
+
"running",
|
|
103058
|
+
"paused",
|
|
103059
|
+
"stopped",
|
|
103060
|
+
"starting",
|
|
103061
|
+
"stopping",
|
|
103062
|
+
"crashed"
|
|
103063
|
+
];
|
|
103064
|
+
var WorkloadStateSchema = zod.z.enum(WORKLOAD_STATES);
|
|
103065
|
+
/** The five kinds of workload, as roles of the `workload` device type (D1033). */
|
|
103066
|
+
var WORKLOAD_ROLES = [
|
|
103067
|
+
require_composed_stable_id.DeviceRole.Vm,
|
|
103068
|
+
require_composed_stable_id.DeviceRole.AppContainer,
|
|
103069
|
+
require_composed_stable_id.DeviceRole.Lxc,
|
|
103070
|
+
require_composed_stable_id.DeviceRole.App,
|
|
103071
|
+
require_composed_stable_id.DeviceRole.Host
|
|
103072
|
+
];
|
|
103073
|
+
/**
|
|
103074
|
+
* What the workload uses. Every value is `null` when not reported (D393). A host
|
|
103075
|
+
* fills `load1` and `temperature`; its uptime is `since` while it runs.
|
|
103076
|
+
*/
|
|
103077
|
+
var WorkloadResourcesSchema = zod.z.object({
|
|
103078
|
+
/** CPU use, percent of the CPUs it may use (0–100). */
|
|
103079
|
+
cpuPercent: zod.z.number().nullable().meta(require_sleep.readingMeta("percentage", { precision: 1 })),
|
|
103080
|
+
memoryUsedBytes: zod.z.number().nullable().meta(require_sleep.readingMeta("information")),
|
|
103081
|
+
/**
|
|
103082
|
+
* Memory use, percent of `memoryLimitBytes`, for a source that reports a share
|
|
103083
|
+
* and not bytes (a Docker container's stats). Absent or `null` = not reported.
|
|
103084
|
+
*/
|
|
103085
|
+
memoryPercent: zod.z.number().nullable().optional().meta(require_sleep.readingMeta("percentage", { precision: 1 })),
|
|
103086
|
+
/** The memory it may use: the limit of a container, the RAM of a VM or host. */
|
|
103087
|
+
memoryLimitBytes: zod.z.number().nullable().meta(require_sleep.readingMeta("information")),
|
|
103088
|
+
vcpus: zod.z.number().nullable().meta(require_sleep.readingMeta("count")),
|
|
103089
|
+
diskUsedBytes: zod.z.number().nullable().meta(require_sleep.readingMeta("information")),
|
|
103090
|
+
diskTotalBytes: zod.z.number().nullable().meta(require_sleep.readingMeta("information")),
|
|
103091
|
+
/** Network received, kbit/s. */
|
|
103092
|
+
netRxKbps: zod.z.number().nullable().meta(require_sleep.readingMeta("bitrate")),
|
|
103093
|
+
/** Network sent, kbit/s. */
|
|
103094
|
+
netTxKbps: zod.z.number().nullable().meta(require_sleep.readingMeta("bitrate")),
|
|
103095
|
+
/** One-minute load average (a host). */
|
|
103096
|
+
load1: zod.z.number().nullable().meta(require_sleep.readingMeta("index", { precision: 2 })),
|
|
103097
|
+
/** CPU / board temperature (a host). */
|
|
103098
|
+
temperature: zod.z.number().nullable().meta(require_sleep.readingMeta("temperature", { precision: 1 }))
|
|
103099
|
+
});
|
|
103100
|
+
var WorkloadPortProtocolSchema = zod.z.enum(["tcp", "udp"]);
|
|
103101
|
+
/** One published port: the workload's own port and where the host exposes it. */
|
|
103102
|
+
var WorkloadPortSchema = zod.z.object({
|
|
103103
|
+
port: zod.z.number().int().meta(require_sleep.readingMeta("none")),
|
|
103104
|
+
/** The host port it is published on; null = not published. */
|
|
103105
|
+
hostPort: zod.z.number().int().nullable().meta(require_sleep.readingMeta("none")),
|
|
103106
|
+
/** The host address it is bound to; null = every address. */
|
|
103107
|
+
hostIp: zod.z.string().nullable(),
|
|
103108
|
+
protocol: WorkloadPortProtocolSchema
|
|
103109
|
+
});
|
|
103110
|
+
var WorkloadStatusSchema = zod.z.object({
|
|
103111
|
+
/** null = unknown, never stopped (D393). */
|
|
103112
|
+
state: WorkloadStateSchema.nullable().meta({ label: "State" }),
|
|
103113
|
+
/** Epoch ms the current state began (uptime while running); null when unknown. */
|
|
103114
|
+
since: zod.z.number().nullable().meta(require_sleep.readingMeta("none")),
|
|
103115
|
+
/** The `host` device this runs on, when the provider has adopted it. */
|
|
103116
|
+
hostDeviceId: zod.z.number().int().nullable().meta(require_sleep.readingMeta("device")),
|
|
103117
|
+
/** The image a container runs (`nginx:1.27`). */
|
|
103118
|
+
image: zod.z.string().nullable(),
|
|
103119
|
+
/** The operating system (a VM, an LXC, a host). */
|
|
103120
|
+
os: zod.z.string().nullable(),
|
|
103121
|
+
/** The version or firmware it runs. */
|
|
103122
|
+
version: zod.z.string().nullable(),
|
|
103123
|
+
/** Starts with its host; null when the platform does not say. */
|
|
103124
|
+
autostart: zod.z.boolean().nullable(),
|
|
103125
|
+
resources: WorkloadResourcesSchema,
|
|
103126
|
+
ports: zod.z.array(WorkloadPortSchema),
|
|
103127
|
+
/** The addresses it is reachable on (IPs or host names). */
|
|
103128
|
+
addresses: zod.z.array(zod.z.string()),
|
|
103129
|
+
/** A newer image / version exists. Installing it stays the `update` cap. */
|
|
103130
|
+
updateAvailable: zod.z.boolean().nullable(),
|
|
103131
|
+
lastFetchedAt: zod.z.number()
|
|
103132
|
+
});
|
|
103133
|
+
/**
|
|
103134
|
+
* What this device can do, probed by its provider (D14 honesty): a flag is
|
|
103135
|
+
* `true` only when the platform really serves it for THIS device.
|
|
103136
|
+
*/
|
|
103137
|
+
var WorkloadOptionsSchema = zod.z.object({
|
|
103138
|
+
supportsStart: zod.z.boolean(),
|
|
103139
|
+
supportsStop: zod.z.boolean(),
|
|
103140
|
+
supportsRestart: zod.z.boolean(),
|
|
103141
|
+
/** Pause AND resume. */
|
|
103142
|
+
supportsPause: zod.z.boolean(),
|
|
103143
|
+
supportsForceStop: zod.z.boolean(),
|
|
103144
|
+
hasResources: zod.z.boolean(),
|
|
103145
|
+
hasPorts: zod.z.boolean(),
|
|
103146
|
+
hasAddresses: zod.z.boolean(),
|
|
103147
|
+
hasAutostart: zod.z.boolean(),
|
|
103148
|
+
hasUpdateCheck: zod.z.boolean()
|
|
103149
|
+
});
|
|
103150
|
+
var WorkloadDeviceInputSchema = zod.z.object({ deviceId: zod.z.number().int().nonnegative() });
|
|
103151
|
+
var WorkloadTransitionEventDataSchema = zod.z.object({
|
|
103152
|
+
deviceId: zod.z.number(),
|
|
103153
|
+
state: WorkloadStateSchema,
|
|
103154
|
+
previous: WorkloadStateSchema,
|
|
103155
|
+
since: zod.z.number().nullable()
|
|
103156
|
+
});
|
|
103157
|
+
var WORKLOAD_ACTIONS = [
|
|
103158
|
+
"start",
|
|
103159
|
+
"stop",
|
|
103160
|
+
"restart",
|
|
103161
|
+
"pause",
|
|
103162
|
+
"resume",
|
|
103163
|
+
"forceStop"
|
|
103164
|
+
];
|
|
103165
|
+
function actionDeclared(options, action) {
|
|
103166
|
+
switch (action) {
|
|
103167
|
+
case "start": return options.supportsStart;
|
|
103168
|
+
case "stop": return options.supportsStop;
|
|
103169
|
+
case "restart": return options.supportsRestart;
|
|
103170
|
+
case "pause":
|
|
103171
|
+
case "resume": return options.supportsPause;
|
|
103172
|
+
case "forceStop": return options.supportsForceStop;
|
|
103173
|
+
}
|
|
103174
|
+
}
|
|
103175
|
+
/** The states an action makes sense in. Unknown (`null`) allows what is not
|
|
103176
|
+
* state-bound, never pause / resume. */
|
|
103177
|
+
var ACTION_STATES = {
|
|
103178
|
+
start: ["stopped", "crashed"],
|
|
103179
|
+
stop: [
|
|
103180
|
+
"running",
|
|
103181
|
+
"paused",
|
|
103182
|
+
"starting"
|
|
103183
|
+
],
|
|
103184
|
+
restart: ["running", "paused"],
|
|
103185
|
+
pause: ["running"],
|
|
103186
|
+
resume: ["paused"],
|
|
103187
|
+
forceStop: [
|
|
103188
|
+
"running",
|
|
103189
|
+
"paused",
|
|
103190
|
+
"starting",
|
|
103191
|
+
"stopping"
|
|
103192
|
+
]
|
|
103193
|
+
};
|
|
103194
|
+
function actionEnabled(action, state) {
|
|
103195
|
+
if (state === null) return action !== "pause" && action !== "resume";
|
|
103196
|
+
return ACTION_STATES[action].includes(state);
|
|
103197
|
+
}
|
|
103198
|
+
/**
|
|
103199
|
+
* The controls and sections of a workload, derived from what its provider
|
|
103200
|
+
* declared and the state it is in. An undeclared feature is absent — never a
|
|
103201
|
+
* disabled button that could never work.
|
|
103202
|
+
*/
|
|
103203
|
+
function deriveWorkloadControls(options, state) {
|
|
103204
|
+
return {
|
|
103205
|
+
controls: WORKLOAD_ACTIONS.filter((action) => actionDeclared(options, action)).map((action) => ({
|
|
103206
|
+
action,
|
|
103207
|
+
enabled: actionEnabled(action, state)
|
|
103208
|
+
})),
|
|
103209
|
+
sections: {
|
|
103210
|
+
resources: options.hasResources,
|
|
103211
|
+
ports: options.hasPorts,
|
|
103212
|
+
addresses: options.hasAddresses,
|
|
103213
|
+
autostart: options.hasAutostart,
|
|
103214
|
+
update: options.hasUpdateCheck
|
|
103215
|
+
}
|
|
103216
|
+
};
|
|
103217
|
+
}
|
|
103218
|
+
function isWorkloadSettled(state) {
|
|
103219
|
+
return state !== "starting" && state !== "stopping";
|
|
103220
|
+
}
|
|
103221
|
+
/**
|
|
103222
|
+
* The event a move from the last SETTLED state to `next` raises, or null.
|
|
103223
|
+
* A first sight (`previous` undefined) raises nothing: it is not a change.
|
|
103224
|
+
* Unknown (`next` null) raises nothing and is not remembered.
|
|
103225
|
+
*/
|
|
103226
|
+
function workloadTransition(previous, next) {
|
|
103227
|
+
if (previous === void 0 || next === null || next === previous) return null;
|
|
103228
|
+
switch (next) {
|
|
103229
|
+
case "running":
|
|
103230
|
+
if (previous === "crashed") return "recovered";
|
|
103231
|
+
return previous === "stopped" ? "started" : null;
|
|
103232
|
+
case "stopped": return previous === "running" || previous === "paused" ? "stopped" : null;
|
|
103233
|
+
case "crashed": return "crashed";
|
|
103234
|
+
case "paused":
|
|
103235
|
+
case "starting":
|
|
103236
|
+
case "stopping": return null;
|
|
103237
|
+
}
|
|
103238
|
+
}
|
|
103239
|
+
/** The bus category of each transition. */
|
|
103240
|
+
var WORKLOAD_TRANSITION_CATEGORY = {
|
|
103241
|
+
started: require_event_category.EventCategory.WorkloadStarted,
|
|
103242
|
+
stopped: require_event_category.EventCategory.WorkloadStopped,
|
|
103243
|
+
crashed: require_event_category.EventCategory.WorkloadCrashed,
|
|
103244
|
+
recovered: require_event_category.EventCategory.WorkloadRecovered
|
|
103245
|
+
};
|
|
103246
|
+
var workloadCapability = {
|
|
103247
|
+
name: "workload",
|
|
103248
|
+
scope: "device",
|
|
103249
|
+
deviceNative: true,
|
|
103250
|
+
mode: "singleton",
|
|
103251
|
+
deviceTypes: [require_composed_stable_id.DeviceType.Workload],
|
|
103252
|
+
deviceRoles: { [require_composed_stable_id.DeviceType.Workload]: WORKLOAD_ROLES },
|
|
103253
|
+
/**
|
|
103254
|
+
* On / off is the state (#462): stopped or crashed is off, anything else on.
|
|
103255
|
+
* The owner registers `switch` through `registerPowerSwitch`; there is no
|
|
103256
|
+
* second on/off state. A device whose provider serves no start / stop gets no
|
|
103257
|
+
* switch.
|
|
103258
|
+
*/
|
|
103259
|
+
power: {
|
|
103260
|
+
kind: "methods",
|
|
103261
|
+
field: "state",
|
|
103262
|
+
offValues: ["stopped", "crashed"],
|
|
103263
|
+
on: "start",
|
|
103264
|
+
off: "stop"
|
|
103265
|
+
},
|
|
103266
|
+
methods: {
|
|
103267
|
+
start: require_sleep.optionalMethod(WorkloadDeviceInputSchema, zod.z.void(), {
|
|
103268
|
+
kind: "mutation",
|
|
103269
|
+
auth: "protected",
|
|
103270
|
+
actions: [{
|
|
103271
|
+
id: "workload.start",
|
|
103272
|
+
label: require_sleep.t("Start", "Avvia"),
|
|
103273
|
+
phrase: require_sleep.t("Start {device}", "Avvia {device}"),
|
|
103274
|
+
icon: "play",
|
|
103275
|
+
effect: {
|
|
103276
|
+
field: "state",
|
|
103277
|
+
value: "running"
|
|
103278
|
+
}
|
|
103279
|
+
}]
|
|
103280
|
+
}),
|
|
103281
|
+
stop: require_sleep.optionalMethod(WorkloadDeviceInputSchema, zod.z.void(), {
|
|
103282
|
+
kind: "mutation",
|
|
103283
|
+
auth: "protected",
|
|
103284
|
+
actions: [{
|
|
103285
|
+
id: "workload.stop",
|
|
103286
|
+
label: require_sleep.t("Stop", "Arresta"),
|
|
103287
|
+
phrase: require_sleep.t("Stop {device}", "Arresta {device}"),
|
|
103288
|
+
icon: "square",
|
|
103289
|
+
effect: {
|
|
103290
|
+
field: "state",
|
|
103291
|
+
value: "stopped"
|
|
103292
|
+
}
|
|
103293
|
+
}]
|
|
103294
|
+
}),
|
|
103295
|
+
restart: require_sleep.optionalMethod(WorkloadDeviceInputSchema, zod.z.void(), {
|
|
103296
|
+
kind: "mutation",
|
|
103297
|
+
auth: "protected",
|
|
103298
|
+
actions: [{
|
|
103299
|
+
id: "workload.restart",
|
|
103300
|
+
label: require_sleep.t("Restart", "Riavvia"),
|
|
103301
|
+
phrase: require_sleep.t("Restart {device}", "Riavvia {device}"),
|
|
103302
|
+
icon: "rotate-ccw"
|
|
103303
|
+
}]
|
|
103304
|
+
}),
|
|
103305
|
+
pause: require_sleep.optionalMethod(WorkloadDeviceInputSchema, zod.z.void(), {
|
|
103306
|
+
kind: "mutation",
|
|
103307
|
+
auth: "protected",
|
|
103308
|
+
actions: [{
|
|
103309
|
+
id: "workload.pause",
|
|
103310
|
+
label: require_sleep.t("Pause", "Metti in pausa"),
|
|
103311
|
+
phrase: require_sleep.t("Pause {device}", "Metti in pausa {device}"),
|
|
103312
|
+
icon: "pause",
|
|
103313
|
+
effect: {
|
|
103314
|
+
field: "state",
|
|
103315
|
+
value: "paused"
|
|
103316
|
+
}
|
|
103317
|
+
}]
|
|
103318
|
+
}),
|
|
103319
|
+
resume: require_sleep.optionalMethod(WorkloadDeviceInputSchema, zod.z.void(), {
|
|
103320
|
+
kind: "mutation",
|
|
103321
|
+
auth: "protected",
|
|
103322
|
+
actions: [{
|
|
103323
|
+
id: "workload.resume",
|
|
103324
|
+
label: require_sleep.t("Resume", "Riprendi"),
|
|
103325
|
+
phrase: require_sleep.t("Resume {device}", "Riprendi {device}"),
|
|
103326
|
+
icon: "circle-play",
|
|
103327
|
+
effect: {
|
|
103328
|
+
field: "state",
|
|
103329
|
+
value: "running"
|
|
103330
|
+
}
|
|
103331
|
+
}]
|
|
103332
|
+
}),
|
|
103333
|
+
forceStop: require_sleep.optionalMethod(WorkloadDeviceInputSchema, zod.z.void(), {
|
|
103334
|
+
kind: "mutation",
|
|
103335
|
+
auth: "admin",
|
|
103336
|
+
actions: [{
|
|
103337
|
+
id: "workload.forceStop",
|
|
103338
|
+
label: require_sleep.t("Force stop", "Arresto forzato"),
|
|
103339
|
+
phrase: require_sleep.t("Force {device} to stop", "Forza l’arresto di {device}"),
|
|
103340
|
+
icon: "octagon-x",
|
|
103341
|
+
effect: {
|
|
103342
|
+
field: "state",
|
|
103343
|
+
value: "stopped"
|
|
103344
|
+
}
|
|
103345
|
+
}]
|
|
103346
|
+
}),
|
|
103347
|
+
/** What THIS device can do, probed — the UI is derived from it. */
|
|
103348
|
+
getOptions: require_sleep.method(WorkloadDeviceInputSchema, WorkloadOptionsSchema, { auth: "protected" })
|
|
103349
|
+
},
|
|
103350
|
+
events: {
|
|
103351
|
+
onStarted: {
|
|
103352
|
+
data: WorkloadTransitionEventDataSchema,
|
|
103353
|
+
trigger: {
|
|
103354
|
+
category: require_event_category.EventCategory.WorkloadStarted,
|
|
103355
|
+
label: require_sleep.t("Started", "Avviato"),
|
|
103356
|
+
phrase: require_sleep.t("When {device} starts", "Quando {device} si avvia"),
|
|
103357
|
+
icon: "play"
|
|
103358
|
+
}
|
|
103359
|
+
},
|
|
103360
|
+
onStopped: {
|
|
103361
|
+
data: WorkloadTransitionEventDataSchema,
|
|
103362
|
+
trigger: {
|
|
103363
|
+
category: require_event_category.EventCategory.WorkloadStopped,
|
|
103364
|
+
label: require_sleep.t("Stopped", "Arrestato"),
|
|
103365
|
+
phrase: require_sleep.t("When {device} stops", "Quando {device} si arresta"),
|
|
103366
|
+
icon: "square"
|
|
103367
|
+
}
|
|
103368
|
+
},
|
|
103369
|
+
onCrashed: {
|
|
103370
|
+
data: WorkloadTransitionEventDataSchema,
|
|
103371
|
+
trigger: {
|
|
103372
|
+
category: require_event_category.EventCategory.WorkloadCrashed,
|
|
103373
|
+
label: require_sleep.t("Crashed", "Arrestato in modo anomalo"),
|
|
103374
|
+
phrase: require_sleep.t("When {device} stops without being asked", "Quando {device} si arresta senza che sia stato richiesto"),
|
|
103375
|
+
icon: "triangle-alert"
|
|
103376
|
+
}
|
|
103377
|
+
},
|
|
103378
|
+
onRecovered: {
|
|
103379
|
+
data: WorkloadTransitionEventDataSchema,
|
|
103380
|
+
trigger: {
|
|
103381
|
+
category: require_event_category.EventCategory.WorkloadRecovered,
|
|
103382
|
+
label: require_sleep.t("Recovered", "Ripristinato"),
|
|
103383
|
+
phrase: require_sleep.t("When {device} runs again after a crash", "Quando {device} riparte dopo un arresto anomalo"),
|
|
103384
|
+
icon: "heart-pulse"
|
|
103385
|
+
}
|
|
103386
|
+
}
|
|
103387
|
+
},
|
|
103388
|
+
status: {
|
|
103389
|
+
schema: WorkloadStatusSchema,
|
|
103390
|
+
kind: "poll"
|
|
103391
|
+
},
|
|
103392
|
+
runtimeState: WorkloadStatusSchema,
|
|
103393
|
+
/**
|
|
103394
|
+
* Runtime-state durability: **session** — the provider answers on its next
|
|
103395
|
+
* poll; the series are recorded, so a restart that clears the slice loses
|
|
103396
|
+
* nothing a reader needs. The events are judged from the first state seen.
|
|
103397
|
+
*/
|
|
103398
|
+
durability: "session",
|
|
103399
|
+
/**
|
|
103400
|
+
* History (D850): the state as an enum, CPU / memory / network as gauges, so
|
|
103401
|
+
* the charts need no per-metric child device.
|
|
103402
|
+
*/
|
|
103403
|
+
history: {
|
|
103404
|
+
primary: "resources.cpuPercent",
|
|
103405
|
+
priority: 40,
|
|
103406
|
+
fields: {
|
|
103407
|
+
state: { kind: "enum" },
|
|
103408
|
+
"resources.cpuPercent": {
|
|
103409
|
+
kind: "gauge",
|
|
103410
|
+
unit: "%",
|
|
103411
|
+
deadband: 2,
|
|
103412
|
+
displayName: "CPU"
|
|
103413
|
+
},
|
|
103414
|
+
"resources.memoryUsedBytes": {
|
|
103415
|
+
kind: "gauge",
|
|
103416
|
+
unit: "bytes",
|
|
103417
|
+
displayName: "Memory used"
|
|
103418
|
+
},
|
|
103419
|
+
"resources.memoryPercent": {
|
|
103420
|
+
kind: "gauge",
|
|
103421
|
+
unit: "%",
|
|
103422
|
+
deadband: 2,
|
|
103423
|
+
displayName: "Memory"
|
|
103424
|
+
},
|
|
103425
|
+
"resources.netRxKbps": {
|
|
103426
|
+
group: "network",
|
|
103427
|
+
kind: "gauge",
|
|
103428
|
+
unit: "kbps",
|
|
103429
|
+
displayName: "Network received"
|
|
103430
|
+
},
|
|
103431
|
+
"resources.netTxKbps": {
|
|
103432
|
+
group: "network",
|
|
103433
|
+
kind: "gauge",
|
|
103434
|
+
unit: "kbps",
|
|
103435
|
+
displayName: "Network sent"
|
|
103436
|
+
}
|
|
103437
|
+
}
|
|
103438
|
+
},
|
|
103439
|
+
volatileStateFields: ["lastFetchedAt"],
|
|
103440
|
+
vocabulary: {
|
|
103441
|
+
noun: require_sleep.t("Workload", "Carico di lavoro"),
|
|
103442
|
+
order: 2400,
|
|
103443
|
+
state: [
|
|
103444
|
+
{
|
|
103445
|
+
kind: "enum",
|
|
103446
|
+
field: "state",
|
|
103447
|
+
label: require_sleep.t("State", "Stato"),
|
|
103448
|
+
values: [
|
|
103449
|
+
{
|
|
103450
|
+
value: "running",
|
|
103451
|
+
label: require_sleep.t("Running", "In esecuzione"),
|
|
103452
|
+
phrase: require_sleep.t("When {device} is running", "Quando {device} è in esecuzione")
|
|
103453
|
+
},
|
|
103454
|
+
{
|
|
103455
|
+
value: "paused",
|
|
103456
|
+
label: require_sleep.t("Paused", "In pausa")
|
|
103457
|
+
},
|
|
103458
|
+
{
|
|
103459
|
+
value: "stopped",
|
|
103460
|
+
label: require_sleep.t("Stopped", "Arrestato"),
|
|
103461
|
+
phrase: require_sleep.t("When {device} is stopped", "Quando {device} è arrestato")
|
|
103462
|
+
},
|
|
103463
|
+
{
|
|
103464
|
+
value: "starting",
|
|
103465
|
+
label: require_sleep.t("Starting", "In avvio")
|
|
103466
|
+
},
|
|
103467
|
+
{
|
|
103468
|
+
value: "stopping",
|
|
103469
|
+
label: require_sleep.t("Stopping", "In arresto")
|
|
103470
|
+
},
|
|
103471
|
+
{
|
|
103472
|
+
value: "crashed",
|
|
103473
|
+
label: require_sleep.t("Crashed", "Arrestato in modo anomalo"),
|
|
103474
|
+
phrase: require_sleep.t("When {device} has crashed", "Quando {device} è arrestato in modo anomalo")
|
|
103475
|
+
}
|
|
103476
|
+
],
|
|
103477
|
+
icon: "activity"
|
|
103478
|
+
},
|
|
103479
|
+
{
|
|
103480
|
+
kind: "numeric",
|
|
103481
|
+
field: "resources.cpuPercent",
|
|
103482
|
+
quantity: require_sleep.t("the CPU use", "l'uso della CPU"),
|
|
103483
|
+
label: require_sleep.t("CPU", "CPU"),
|
|
103484
|
+
unit: "%",
|
|
103485
|
+
icon: "cpu"
|
|
103486
|
+
},
|
|
103487
|
+
{
|
|
103488
|
+
kind: "numeric",
|
|
103489
|
+
field: "resources.memoryPercent",
|
|
103490
|
+
quantity: require_sleep.t("the memory use", "l'uso della memoria"),
|
|
103491
|
+
label: require_sleep.t("Memory", "Memoria"),
|
|
103492
|
+
unit: "%",
|
|
103493
|
+
icon: "memory-stick"
|
|
103494
|
+
},
|
|
103495
|
+
{
|
|
103496
|
+
kind: "numeric",
|
|
103497
|
+
field: "resources.temperature",
|
|
103498
|
+
quantity: require_sleep.t("the temperature", "la temperatura"),
|
|
103499
|
+
label: require_sleep.t("Temperature", "Temperatura"),
|
|
103500
|
+
unit: "°C",
|
|
103501
|
+
icon: "thermometer"
|
|
103502
|
+
}
|
|
103503
|
+
],
|
|
103504
|
+
overrides: { byRole: {
|
|
103505
|
+
[require_composed_stable_id.DeviceRole.Vm]: {
|
|
103506
|
+
actions: { "workload.start": { icon: "monitor" } },
|
|
103507
|
+
state: { state: { icon: "monitor" } }
|
|
103508
|
+
},
|
|
103509
|
+
[require_composed_stable_id.DeviceRole.AppContainer]: {
|
|
103510
|
+
actions: { "workload.start": { icon: "container" } },
|
|
103511
|
+
state: { state: { icon: "container" } }
|
|
103512
|
+
},
|
|
103513
|
+
[require_composed_stable_id.DeviceRole.Lxc]: {
|
|
103514
|
+
actions: { "workload.start": { icon: "box" } },
|
|
103515
|
+
state: { state: { icon: "box" } }
|
|
103516
|
+
},
|
|
103517
|
+
[require_composed_stable_id.DeviceRole.App]: {
|
|
103518
|
+
actions: { "workload.start": { icon: "app-window" } },
|
|
103519
|
+
state: { state: { icon: "app-window" } }
|
|
103520
|
+
},
|
|
103521
|
+
[require_composed_stable_id.DeviceRole.Host]: {
|
|
103522
|
+
actions: {
|
|
103523
|
+
"workload.start": {
|
|
103524
|
+
label: require_sleep.t("Power on", "Accendi"),
|
|
103525
|
+
phrase: require_sleep.t("Power on {device}", "Accendi {device}"),
|
|
103526
|
+
icon: "power"
|
|
103527
|
+
},
|
|
103528
|
+
"workload.stop": {
|
|
103529
|
+
label: require_sleep.t("Shut down", "Spegni"),
|
|
103530
|
+
phrase: require_sleep.t("Shut down {device}", "Spegni {device}"),
|
|
103531
|
+
icon: "power-off"
|
|
103532
|
+
},
|
|
103533
|
+
"workload.restart": {
|
|
103534
|
+
label: require_sleep.t("Reboot", "Riavvia"),
|
|
103535
|
+
phrase: require_sleep.t("Reboot {device}", "Riavvia {device}"),
|
|
103536
|
+
icon: "refresh-cw"
|
|
103537
|
+
}
|
|
103538
|
+
},
|
|
103539
|
+
state: { state: { icon: "server" } },
|
|
103540
|
+
events: {
|
|
103541
|
+
onStarted: {
|
|
103542
|
+
label: require_sleep.t("Came online", "Tornato in linea"),
|
|
103543
|
+
phrase: require_sleep.t("When {device} comes online", "Quando {device} torna in linea"),
|
|
103544
|
+
icon: "server"
|
|
103545
|
+
},
|
|
103546
|
+
onStopped: {
|
|
103547
|
+
label: require_sleep.t("Shut down", "Spento"),
|
|
103548
|
+
phrase: require_sleep.t("When {device} shuts down", "Quando {device} si spegne"),
|
|
103549
|
+
icon: "server-off"
|
|
103550
|
+
},
|
|
103551
|
+
onCrashed: {
|
|
103552
|
+
label: require_sleep.t("Went down", "Caduto"),
|
|
103553
|
+
phrase: require_sleep.t("When {device} goes down unexpectedly", "Quando {device} cade inaspettatamente"),
|
|
103554
|
+
icon: "server-crash"
|
|
103555
|
+
},
|
|
103556
|
+
onRecovered: {
|
|
103557
|
+
label: require_sleep.t("Came online", "Tornato in linea"),
|
|
103558
|
+
phrase: require_sleep.t("When {device} comes back online after going down", "Quando {device} torna in linea dopo essere caduto"),
|
|
103559
|
+
icon: "server"
|
|
103560
|
+
}
|
|
103561
|
+
}
|
|
103562
|
+
}
|
|
103563
|
+
} }
|
|
103564
|
+
}
|
|
103565
|
+
};
|
|
103566
|
+
//#endregion
|
|
102480
103567
|
//#region src/capabilities/zone-analytics.cap.ts
|
|
102481
103568
|
/**
|
|
102482
103569
|
* Per-zone occupancy aggregation produced by the analytics frame
|
|
@@ -103144,6 +104231,7 @@ var CAPABILITY_NAMES = {
|
|
|
103144
104231
|
weather: "weather",
|
|
103145
104232
|
weatherStation: "weather-station",
|
|
103146
104233
|
webrtcSession: "webrtc-session",
|
|
104234
|
+
workload: "workload",
|
|
103147
104235
|
zoneAnalytics: "zone-analytics",
|
|
103148
104236
|
zoneRules: "zone-rules",
|
|
103149
104237
|
zones: "zones"
|
|
@@ -103978,6 +105066,10 @@ var CAPABILITY_ROUTER_KEYS = [
|
|
|
103978
105066
|
key: "webrtcSession",
|
|
103979
105067
|
name: "webrtc-session"
|
|
103980
105068
|
},
|
|
105069
|
+
{
|
|
105070
|
+
key: "workload",
|
|
105071
|
+
name: "workload"
|
|
105072
|
+
},
|
|
103981
105073
|
{
|
|
103982
105074
|
key: "zoneAnalytics",
|
|
103983
105075
|
name: "zone-analytics"
|
|
@@ -104208,6 +105300,7 @@ var ALL_CAPABILITY_DEFINITIONS = [
|
|
|
104208
105300
|
weatherCapability,
|
|
104209
105301
|
weatherStationCapability,
|
|
104210
105302
|
webrtcSessionCapability,
|
|
105303
|
+
workloadCapability,
|
|
104211
105304
|
zoneAnalyticsCapability,
|
|
104212
105305
|
zoneRulesCapability,
|
|
104213
105306
|
zonesCapability
|
|
@@ -105977,34 +107070,36 @@ function selectNavigationMethods(getStatus, setValue) {
|
|
|
105977
107070
|
* Pure duration maths for the `siren` cap, shared by every provider so a
|
|
105978
107071
|
* trigger and the countdown it publishes mean the same thing everywhere.
|
|
105979
107072
|
*/
|
|
107073
|
+
/** The longest range `sirenPlayChoices` spells out; a picker of more entries is not a picker. */
|
|
107074
|
+
var MAX_PLAY_CHOICES = 200;
|
|
105980
107075
|
/** The state of a siren that is not sounding. Keeps the last activation's facts. */
|
|
105981
107076
|
function sirenIdleStatus(previous) {
|
|
105982
107077
|
return {
|
|
105983
107078
|
active: false,
|
|
105984
107079
|
activeUntil: null,
|
|
105985
107080
|
durationSeconds: previous?.durationSeconds ?? null,
|
|
107081
|
+
plays: previous?.plays ?? null,
|
|
107082
|
+
activeUntilEstimated: false,
|
|
105986
107083
|
lastTriggeredAt: previous?.lastTriggeredAt ?? 0
|
|
105987
107084
|
};
|
|
105988
107085
|
}
|
|
105989
|
-
/**
|
|
105990
|
-
|
|
107086
|
+
/**
|
|
107087
|
+
* The state right after a timed trigger: sounding until `now + seconds`. A
|
|
107088
|
+
* trigger asked in plays passes its count, and whether that end is an estimate.
|
|
107089
|
+
*/
|
|
107090
|
+
function sirenTriggeredStatus(nowMs, seconds, activation) {
|
|
105991
107091
|
return {
|
|
105992
107092
|
active: true,
|
|
105993
107093
|
activeUntil: nowMs + Math.round(seconds * 1e3),
|
|
105994
107094
|
durationSeconds: seconds,
|
|
107095
|
+
plays: activation?.plays ?? null,
|
|
107096
|
+
activeUntilEstimated: activation?.estimated ?? false,
|
|
105995
107097
|
lastTriggeredAt: nowMs
|
|
105996
107098
|
};
|
|
105997
107099
|
}
|
|
105998
|
-
/**
|
|
105999
|
-
|
|
106000
|
-
* snapped to what the camera allows — the nearest listed value, or clamped and
|
|
106001
|
-
* stepped inside the range. Never longer or shorter than the camera can play.
|
|
106002
|
-
*/
|
|
106003
|
-
function resolveSirenSeconds(options, requested) {
|
|
106004
|
-
const wanted = requested ?? options.defaultSeconds;
|
|
106005
|
-
const list = options.allowedSeconds;
|
|
107100
|
+
/** The nearest listed value, or the value clamped and stepped inside the range. */
|
|
107101
|
+
function snap(list, range, wanted) {
|
|
106006
107102
|
if (list !== null && list.length > 0) return list.reduce((best, candidate) => Math.abs(candidate - wanted) < Math.abs(best - wanted) ? candidate : best);
|
|
106007
|
-
const range = options.rangeSeconds;
|
|
106008
107103
|
if (range !== null) {
|
|
106009
107104
|
const clamped = Math.min(range.max, Math.max(range.min, wanted));
|
|
106010
107105
|
const steps = Math.min(Math.round((clamped - range.min) / range.step), Math.floor((range.max - range.min) / range.step));
|
|
@@ -106012,6 +107107,60 @@ function resolveSirenSeconds(options, requested) {
|
|
|
106012
107107
|
}
|
|
106013
107108
|
return wanted;
|
|
106014
107109
|
}
|
|
107110
|
+
/**
|
|
107111
|
+
* The duration a trigger will really use: the request (or the camera default)
|
|
107112
|
+
* snapped to what the camera allows — the nearest listed value, or clamped and
|
|
107113
|
+
* stepped inside the range. Never longer or shorter than the camera can play.
|
|
107114
|
+
*/
|
|
107115
|
+
function resolveSirenSeconds(options, requested) {
|
|
107116
|
+
return snap(options.allowedSeconds, options.rangeSeconds, requested ?? options.defaultSeconds);
|
|
107117
|
+
}
|
|
107118
|
+
/**
|
|
107119
|
+
* The play count a trigger will really use, snapped like the seconds; `null`
|
|
107120
|
+
* when the camera declares no plays (it counts seconds).
|
|
107121
|
+
*/
|
|
107122
|
+
function resolveSirenPlays(options, requested) {
|
|
107123
|
+
if (options.defaultPlays === null) return null;
|
|
107124
|
+
return snap(options.allowedPlays, options.rangePlays, requested ?? options.defaultPlays);
|
|
107125
|
+
}
|
|
107126
|
+
/** The counts a rule may pick: the list, or the range spelled out; empty without plays. */
|
|
107127
|
+
function sirenPlayChoices(options) {
|
|
107128
|
+
if (options.allowedPlays !== null) return [...options.allowedPlays];
|
|
107129
|
+
const range = options.rangePlays;
|
|
107130
|
+
if (range === null) return [];
|
|
107131
|
+
const count = Math.min(MAX_PLAY_CHOICES, Math.floor((range.max - range.min) / range.step) + 1);
|
|
107132
|
+
return Array.from({ length: count }, (_, i) => range.min + i * range.step);
|
|
107133
|
+
}
|
|
107134
|
+
/** Whether an end computed through `secondsPerPlay` is an estimate. */
|
|
107135
|
+
function playsEndIsEstimate(options) {
|
|
107136
|
+
return options.source !== SirenOptionsSource.Camera;
|
|
107137
|
+
}
|
|
107138
|
+
/**
|
|
107139
|
+
* Decides a trigger: a count on a siren that declares no plays is refused; a
|
|
107140
|
+
* count is snapped and timed through `secondsPerPlay`; seconds keep the old
|
|
107141
|
+
* snapping. Never both — the input schema refuses that before it gets here.
|
|
107142
|
+
*/
|
|
107143
|
+
function planSirenTrigger(options, request) {
|
|
107144
|
+
if (request.plays !== void 0) {
|
|
107145
|
+
const plays = resolveSirenPlays(options, request.plays);
|
|
107146
|
+
if (plays === null) return {
|
|
107147
|
+
asked: "refused",
|
|
107148
|
+
reason: "this siren counts seconds, not plays"
|
|
107149
|
+
};
|
|
107150
|
+
const factor = options.secondsPerPlay;
|
|
107151
|
+
return {
|
|
107152
|
+
asked: "plays",
|
|
107153
|
+
plays,
|
|
107154
|
+
seconds: factor === null ? null : plays * factor,
|
|
107155
|
+
estimated: factor === null || playsEndIsEstimate(options)
|
|
107156
|
+
};
|
|
107157
|
+
}
|
|
107158
|
+
return {
|
|
107159
|
+
asked: "seconds",
|
|
107160
|
+
seconds: resolveSirenSeconds(options, request.durationSeconds),
|
|
107161
|
+
estimated: options.unit === "plays" && playsEndIsEstimate(options)
|
|
107162
|
+
};
|
|
107163
|
+
}
|
|
106015
107164
|
//#endregion
|
|
106016
107165
|
//#region src/capabilities/recording-onboard-rules.ts
|
|
106017
107166
|
/** Minutes in a day. `endMinute === 1440` means "to end of day". */
|
|
@@ -109048,6 +110197,444 @@ function runningFollowsSwitch(composition) {
|
|
|
109048
110197
|
return read !== null && stored.kind === "from" && stored.cap === read.cap && stored.fieldPath === read.fieldPath && stored.source.addonId === read.source.addonId && stored.source.stableId === read.source.stableId;
|
|
109049
110198
|
}
|
|
109050
110199
|
//#endregion
|
|
110200
|
+
//#region src/device/declared-device.ts
|
|
110201
|
+
/** Marker written to a declared integration's `info`. */
|
|
110202
|
+
var DECLARED_INTEGRATION_FIXED_KEY = "fixed";
|
|
110203
|
+
/**
|
|
110204
|
+
* Give a declared integration its instance record, ONCE. The record is read first and left
|
|
110205
|
+
* exactly as it is when it exists (an operator's rename, a field the addon later adds): a seed
|
|
110206
|
+
* never overwrites. A read that fails throws and writes nothing (D49) — the next pass retries.
|
|
110207
|
+
* True when the record was written by this call.
|
|
110208
|
+
*/
|
|
110209
|
+
async function seedInstanceOnce(instances, seed) {
|
|
110210
|
+
const existing = await instances.getInstance({ id: seed.id });
|
|
110211
|
+
if (existing !== null && existing !== void 0) return false;
|
|
110212
|
+
await instances.createInstance({
|
|
110213
|
+
id: seed.id,
|
|
110214
|
+
name: seed.name
|
|
110215
|
+
});
|
|
110216
|
+
return true;
|
|
110217
|
+
}
|
|
110218
|
+
/**
|
|
110219
|
+
* Strip the `<node>/<addon>` suffix a forked child carries.
|
|
110220
|
+
*
|
|
110221
|
+
* Comparing `ctx.kernel.localNodeId` raw skipped EVERY node — including the one
|
|
110222
|
+
* that was supposed to act — because on the hub it reads `hub/<addon>`.
|
|
110223
|
+
*/
|
|
110224
|
+
function declarationOwnerNodeId(localNodeId) {
|
|
110225
|
+
const raw = localNodeId ?? "hub";
|
|
110226
|
+
if (!raw.includes("/")) return raw;
|
|
110227
|
+
return raw.split("/")[0] ?? "hub";
|
|
110228
|
+
}
|
|
110229
|
+
/** Cap on how many rows one withdrawal pass may delete. */
|
|
110230
|
+
var DECLARED_DEVICE_SWEEP_LIMIT = 32;
|
|
110231
|
+
/**
|
|
110232
|
+
* The one way an addon owns a device it declares.
|
|
110233
|
+
*
|
|
110234
|
+
* Construct once with the addon's ports, then call {@link reconcile} on boot and
|
|
110235
|
+
* on every convergence tick. There is no second get-or-create helper — a guard
|
|
110236
|
+
* in `scripts/` enforces that.
|
|
110237
|
+
*/
|
|
110238
|
+
var DeclaredDevices = class {
|
|
110239
|
+
ports;
|
|
110240
|
+
constructor(ports) {
|
|
110241
|
+
const addonId = ports.addonId;
|
|
110242
|
+
if (typeof addonId !== "string" || addonId.length === 0) throw new Error(`DeclaredDevices: addonId must be the declaring addon's id, got ${JSON.stringify(addonId)}. On an addon context it is \`ctx.id\` — there is no \`ctx.addonId\`.`);
|
|
110243
|
+
this.ports = ports;
|
|
110244
|
+
}
|
|
110245
|
+
/**
|
|
110246
|
+
* Converge the declared set. Idempotent, and safe to call repeatedly.
|
|
110247
|
+
*
|
|
110248
|
+
* Throws only what the ports throw on the FIRST index read; every other
|
|
110249
|
+
* failure is per-device and logged, so one bad declaration never takes the
|
|
110250
|
+
* others down.
|
|
110251
|
+
*/
|
|
110252
|
+
async reconcile(spec) {
|
|
110253
|
+
if ((spec.placement ?? "hub") === "hub") {
|
|
110254
|
+
const nodeId = declarationOwnerNodeId(this.ports.localNodeId);
|
|
110255
|
+
if (nodeId !== "hub") {
|
|
110256
|
+
this.ports.logger.info("declared devices are hub-owned — skipping on this node", { meta: {
|
|
110257
|
+
nodeId,
|
|
110258
|
+
rawNodeId: this.ports.localNodeId ?? null
|
|
110259
|
+
} });
|
|
110260
|
+
return {
|
|
110261
|
+
integrationId: null,
|
|
110262
|
+
devices: [],
|
|
110263
|
+
removed: [],
|
|
110264
|
+
owned: false
|
|
110265
|
+
};
|
|
110266
|
+
}
|
|
110267
|
+
}
|
|
110268
|
+
let integrationId;
|
|
110269
|
+
if (spec.integrationId !== void 0) integrationId = spec.integrationId;
|
|
110270
|
+
else {
|
|
110271
|
+
const own = await this.ensureIntegration(spec.integrationName);
|
|
110272
|
+
integrationId = own.id;
|
|
110273
|
+
await this.seedInstance(own);
|
|
110274
|
+
}
|
|
110275
|
+
const index = await this.readIndex();
|
|
110276
|
+
const live = await this.readLiveByStableId();
|
|
110277
|
+
const outcomes = [];
|
|
110278
|
+
for (const declaration of spec.devices) {
|
|
110279
|
+
const outcome = await this.applyDeclaration(declaration, integrationId, index, live);
|
|
110280
|
+
if (outcome !== null) outcomes.push(outcome);
|
|
110281
|
+
}
|
|
110282
|
+
const removed = await this.sweepWithdrawn(spec.devices, integrationId, index);
|
|
110283
|
+
return {
|
|
110284
|
+
integrationId,
|
|
110285
|
+
devices: outcomes,
|
|
110286
|
+
removed,
|
|
110287
|
+
owned: true
|
|
110288
|
+
};
|
|
110289
|
+
}
|
|
110290
|
+
/**
|
|
110291
|
+
* Get-or-create the FIXED integration, and RE-ASSERT the flag every pass.
|
|
110292
|
+
*
|
|
110293
|
+
* The re-assertion is the fix for the defect the hand-rolled version shipped
|
|
110294
|
+
* with: writing `info.fixed` only on the create path left every pre-existing
|
|
110295
|
+
* install without it, and the kernel kept offering to delete an integration
|
|
110296
|
+
* the addon owns.
|
|
110297
|
+
*/
|
|
110298
|
+
async ensureIntegration(integrationName) {
|
|
110299
|
+
const existing = await this.ports.getIntegration(this.ports.addonId);
|
|
110300
|
+
if (existing === null) {
|
|
110301
|
+
const created = await this.ports.createIntegration({
|
|
110302
|
+
addonId: this.ports.addonId,
|
|
110303
|
+
name: integrationName,
|
|
110304
|
+
info: { [DECLARED_INTEGRATION_FIXED_KEY]: true }
|
|
110305
|
+
});
|
|
110306
|
+
this.ports.logger.info("declared a fixed integration", { meta: {
|
|
110307
|
+
integrationId: created.id,
|
|
110308
|
+
name: integrationName
|
|
110309
|
+
} });
|
|
110310
|
+
return {
|
|
110311
|
+
id: created.id,
|
|
110312
|
+
name: integrationName
|
|
110313
|
+
};
|
|
110314
|
+
}
|
|
110315
|
+
if (existing.info?.["fixed"] !== true) {
|
|
110316
|
+
await this.ports.updateIntegration({
|
|
110317
|
+
id: existing.id,
|
|
110318
|
+
info: { [DECLARED_INTEGRATION_FIXED_KEY]: true }
|
|
110319
|
+
});
|
|
110320
|
+
this.ports.logger.info("re-asserted `fixed` on a declared integration", { meta: { integrationId: existing.id } });
|
|
110321
|
+
}
|
|
110322
|
+
return {
|
|
110323
|
+
id: existing.id,
|
|
110324
|
+
name: existing.name ?? integrationName
|
|
110325
|
+
};
|
|
110326
|
+
}
|
|
110327
|
+
/** Seed the instance record of an integration this declarer owns; best-effort, retried next pass. */
|
|
110328
|
+
async seedInstance(integration) {
|
|
110329
|
+
const { seedInstance } = this.ports;
|
|
110330
|
+
if (seedInstance === void 0) return;
|
|
110331
|
+
try {
|
|
110332
|
+
await seedInstance({
|
|
110333
|
+
id: integration.id,
|
|
110334
|
+
name: integration.name
|
|
110335
|
+
});
|
|
110336
|
+
} catch (err) {
|
|
110337
|
+
this.ports.logger.warn("could not seed the instance record of a declared integration", {
|
|
110338
|
+
tags: { integrationId: integration.id },
|
|
110339
|
+
meta: { error: require_composed_stable_id.errMsg(err) }
|
|
110340
|
+
});
|
|
110341
|
+
}
|
|
110342
|
+
}
|
|
110343
|
+
async readIndex() {
|
|
110344
|
+
const rows = await this.ports.listOwnDevices();
|
|
110345
|
+
return new Map(rows.map((row) => [row.stableId, row]));
|
|
110346
|
+
}
|
|
110347
|
+
/**
|
|
110348
|
+
* Devices this kernel already has CONSTRUCTED, by stableId.
|
|
110349
|
+
*
|
|
110350
|
+
* Distinct from {@link readIndex}, and the distinction is the bug: the index
|
|
110351
|
+
* is persisted rows, this is live objects. A row without an object must be
|
|
110352
|
+
* adopted; an object must be left exactly as it is.
|
|
110353
|
+
*
|
|
110354
|
+
* Failure is non-fatal and deliberately so — an empty map degrades to the
|
|
110355
|
+
* previous behaviour (attempt the adopt) rather than skipping a device that
|
|
110356
|
+
* genuinely needs bringing up.
|
|
110357
|
+
*/
|
|
110358
|
+
async readLiveByStableId() {
|
|
110359
|
+
try {
|
|
110360
|
+
const devices = await this.ports.devices.getAll();
|
|
110361
|
+
return new Map(devices.map((device) => [device.stableId, device]));
|
|
110362
|
+
} catch (err) {
|
|
110363
|
+
this.ports.logger.warn("could not read live devices — falling back to adopt-by-row", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
110364
|
+
return /* @__PURE__ */ new Map();
|
|
110365
|
+
}
|
|
110366
|
+
}
|
|
110367
|
+
/**
|
|
110368
|
+
* One declaration: adopt what exists, create what does not.
|
|
110369
|
+
*
|
|
110370
|
+
* The create branch is the destructive one — it seeds `initialMeta`, and
|
|
110371
|
+
* `initialMeta.name` lands as an unconditional `setName`. A transiently empty
|
|
110372
|
+
* index therefore looks exactly like a first boot and would silently re-stamp
|
|
110373
|
+
* the declared name over the operator's rename. D49: that branch needs a
|
|
110374
|
+
* second read to agree.
|
|
110375
|
+
*/
|
|
110376
|
+
async applyDeclaration(declaration, integrationId, index, live) {
|
|
110377
|
+
try {
|
|
110378
|
+
const alreadyLive = live.get(declaration.stableId);
|
|
110379
|
+
if (alreadyLive !== void 0) return {
|
|
110380
|
+
stableId: declaration.stableId,
|
|
110381
|
+
deviceId: alreadyLive.id,
|
|
110382
|
+
device: alreadyLive,
|
|
110383
|
+
created: false
|
|
110384
|
+
};
|
|
110385
|
+
let existing = index.get(declaration.stableId);
|
|
110386
|
+
if (existing === void 0) {
|
|
110387
|
+
existing = (await this.readIndex()).get(declaration.stableId);
|
|
110388
|
+
if (existing !== void 0) this.ports.logger.warn("device index disagreed with itself — adopting instead of re-creating", {
|
|
110389
|
+
tags: { deviceId: existing.id },
|
|
110390
|
+
meta: {
|
|
110391
|
+
stableId: declaration.stableId,
|
|
110392
|
+
addonId: this.ports.addonId
|
|
110393
|
+
}
|
|
110394
|
+
});
|
|
110395
|
+
}
|
|
110396
|
+
if (existing !== void 0) {
|
|
110397
|
+
const device = await this.ports.devices.create(declaration.stableId, declaration.DeviceClass, {}, null, void 0);
|
|
110398
|
+
this.ports.logger.info("declared device adopted", {
|
|
110399
|
+
tags: { deviceId: device.id },
|
|
110400
|
+
meta: {
|
|
110401
|
+
stableId: declaration.stableId,
|
|
110402
|
+
integrationId
|
|
110403
|
+
}
|
|
110404
|
+
});
|
|
110405
|
+
return {
|
|
110406
|
+
stableId: declaration.stableId,
|
|
110407
|
+
deviceId: device.id,
|
|
110408
|
+
device,
|
|
110409
|
+
created: false
|
|
110410
|
+
};
|
|
110411
|
+
}
|
|
110412
|
+
const device = await this.ports.devices.create(declaration.stableId, declaration.DeviceClass, declaration.config ?? {}, null, {
|
|
110413
|
+
type: declaration.type,
|
|
110414
|
+
name: declaration.name,
|
|
110415
|
+
integrationId,
|
|
110416
|
+
...declaration.role === void 0 ? {} : { role: declaration.role }
|
|
110417
|
+
});
|
|
110418
|
+
this.ports.logger.info("declared device created", {
|
|
110419
|
+
tags: { deviceId: device.id },
|
|
110420
|
+
meta: {
|
|
110421
|
+
stableId: declaration.stableId,
|
|
110422
|
+
integrationId
|
|
110423
|
+
}
|
|
110424
|
+
});
|
|
110425
|
+
return {
|
|
110426
|
+
stableId: declaration.stableId,
|
|
110427
|
+
deviceId: device.id,
|
|
110428
|
+
device,
|
|
110429
|
+
created: true
|
|
110430
|
+
};
|
|
110431
|
+
} catch (err) {
|
|
110432
|
+
this.ports.logger.warn("a declared device could not be brought up", { meta: {
|
|
110433
|
+
stableId: declaration.stableId,
|
|
110434
|
+
error: err instanceof Error ? err.message : String(err)
|
|
110435
|
+
} });
|
|
110436
|
+
return null;
|
|
110437
|
+
}
|
|
110438
|
+
}
|
|
110439
|
+
/**
|
|
110440
|
+
* Remove rows under the addon's FIXED integration whose declaration is gone.
|
|
110441
|
+
*
|
|
110442
|
+
* Bounded to that integration: a declared integration has no operator
|
|
110443
|
+
* add-flow, so every row under it got there by declaration. Devices this
|
|
110444
|
+
* addon owns OUTSIDE it (a provider's adopted devices) are never candidates.
|
|
110445
|
+
*
|
|
110446
|
+
* Bounded in count, and every deletion is logged with its `deviceId` — a
|
|
110447
|
+
* withdrawal that removes an operator-visible row silently is the failure
|
|
110448
|
+
* mode, not the removal itself.
|
|
110449
|
+
*/
|
|
110450
|
+
async sweepWithdrawn(declarations, integrationId, index) {
|
|
110451
|
+
const declared = new Set(declarations.map((d) => d.stableId));
|
|
110452
|
+
const candidates = [...index.values()].filter((row) => row.integrationId === integrationId && !declared.has(row.stableId));
|
|
110453
|
+
if (candidates.length === 0) return [];
|
|
110454
|
+
if (candidates.length > 32) {
|
|
110455
|
+
this.ports.logger.warn("withdrawal sweep exceeded its bound — removing nothing", { meta: {
|
|
110456
|
+
integrationId,
|
|
110457
|
+
candidates: candidates.length,
|
|
110458
|
+
bound: 32
|
|
110459
|
+
} });
|
|
110460
|
+
return [];
|
|
110461
|
+
}
|
|
110462
|
+
const removed = [];
|
|
110463
|
+
for (const row of candidates) try {
|
|
110464
|
+
await this.ports.devices.remove(row.id);
|
|
110465
|
+
removed.push(row.id);
|
|
110466
|
+
this.ports.logger.info("declared device removed — its declaration was withdrawn", {
|
|
110467
|
+
tags: { deviceId: row.id },
|
|
110468
|
+
meta: {
|
|
110469
|
+
stableId: row.stableId,
|
|
110470
|
+
integrationId
|
|
110471
|
+
}
|
|
110472
|
+
});
|
|
110473
|
+
} catch (err) {
|
|
110474
|
+
this.ports.logger.warn("a withdrawn declared device could not be removed", {
|
|
110475
|
+
tags: { deviceId: row.id },
|
|
110476
|
+
meta: {
|
|
110477
|
+
stableId: row.stableId,
|
|
110478
|
+
error: err instanceof Error ? err.message : String(err)
|
|
110479
|
+
}
|
|
110480
|
+
});
|
|
110481
|
+
}
|
|
110482
|
+
return removed;
|
|
110483
|
+
}
|
|
110484
|
+
};
|
|
110485
|
+
//#endregion
|
|
110486
|
+
//#region src/composition/engine-hosted-blocks.ts
|
|
110487
|
+
function isSpecOfKind(spec, kind) {
|
|
110488
|
+
return spec !== void 0 && spec.kind === kind;
|
|
110489
|
+
}
|
|
110490
|
+
/**
|
|
110491
|
+
* The blocks of `kind` whose composer row exists. A block whose row the
|
|
110492
|
+
* composer has not declared yet is left out: nothing can be hosted on it until
|
|
110493
|
+
* its next apply, and the next pass picks it up.
|
|
110494
|
+
*/
|
|
110495
|
+
function selectEngineHostedBlocks(kind, compositions, composerRows) {
|
|
110496
|
+
if (compositions.state === "not-loaded") return {
|
|
110497
|
+
kind: "untrusted",
|
|
110498
|
+
reason: compositions.reason
|
|
110499
|
+
};
|
|
110500
|
+
const rowByStableId = new Map(composerRows.map((row) => [row.stableId, row]));
|
|
110501
|
+
const blocks = [];
|
|
110502
|
+
for (const view of compositions.views) {
|
|
110503
|
+
const block = view.block;
|
|
110504
|
+
const composition = block.source?.kind === "composition" ? block.source.composition : null;
|
|
110505
|
+
if (composition === null) continue;
|
|
110506
|
+
const spec = composition.helper;
|
|
110507
|
+
if (!isSpecOfKind(spec, kind)) continue;
|
|
110508
|
+
const stableId = `${require_composed_stable_id.COMPOSED_DEVICE_STABLE_ID_PREFIX}${block.id}`;
|
|
110509
|
+
const row = rowByStableId.get(stableId);
|
|
110510
|
+
if (row === void 0) continue;
|
|
110511
|
+
blocks.push({
|
|
110512
|
+
blockId: block.id,
|
|
110513
|
+
deviceId: row.id,
|
|
110514
|
+
stableId,
|
|
110515
|
+
name: block.name,
|
|
110516
|
+
enabled: block.enabled,
|
|
110517
|
+
updatedAt: block.updatedAt,
|
|
110518
|
+
composition,
|
|
110519
|
+
spec
|
|
110520
|
+
});
|
|
110521
|
+
}
|
|
110522
|
+
return {
|
|
110523
|
+
kind: "trusted",
|
|
110524
|
+
blocks
|
|
110525
|
+
};
|
|
110526
|
+
}
|
|
110527
|
+
var WITHDRAWAL_CONFIRMATIONS = 2;
|
|
110528
|
+
/**
|
|
110529
|
+
* D49 for an engine's hosted set: a block missing from ONE trusted read is
|
|
110530
|
+
* kept; a second consecutive trusted read that agrees withdraws it. An
|
|
110531
|
+
* untrusted read is never fed here, so it neither counts nor resets.
|
|
110532
|
+
*/
|
|
110533
|
+
var HostedWithdrawalGate = class {
|
|
110534
|
+
misses = /* @__PURE__ */ new Map();
|
|
110535
|
+
/**
|
|
110536
|
+
* `hosted`: what the engine serves now; `present`: what this trusted read
|
|
110537
|
+
* names. Returns the ids to withdraw now, and the ids kept on a first miss.
|
|
110538
|
+
*/
|
|
110539
|
+
judge(hosted, present) {
|
|
110540
|
+
const withdraw = [];
|
|
110541
|
+
const held = [];
|
|
110542
|
+
const misses = /* @__PURE__ */ new Map();
|
|
110543
|
+
for (const id of hosted) {
|
|
110544
|
+
if (present.has(id)) continue;
|
|
110545
|
+
const count = (this.misses.get(id) ?? 0) + 1;
|
|
110546
|
+
if (count < WITHDRAWAL_CONFIRMATIONS) {
|
|
110547
|
+
held.push(id);
|
|
110548
|
+
misses.set(id, count);
|
|
110549
|
+
} else withdraw.push(id);
|
|
110550
|
+
}
|
|
110551
|
+
this.misses = misses;
|
|
110552
|
+
return {
|
|
110553
|
+
withdraw,
|
|
110554
|
+
held
|
|
110555
|
+
};
|
|
110556
|
+
}
|
|
110557
|
+
};
|
|
110558
|
+
/**
|
|
110559
|
+
* Build `DeviceClass` on the composer's row `(stableId, id)`. The context is
|
|
110560
|
+
* `loadContext` (D677: a caller that BUILDS a device hydrates its stored
|
|
110561
|
+
* runtime state first); a kernel without it is refused by name rather than
|
|
110562
|
+
* building on an empty state. The device is never `register`ed and its config
|
|
110563
|
+
* never persisted: the row, its name and its lifetime are the composer's.
|
|
110564
|
+
*/
|
|
110565
|
+
async function hostEngineDevice(devices, row, config, DeviceClass) {
|
|
110566
|
+
if (devices.loadContext === void 0) throw new Error(`this kernel cannot build a device on a row it does not own (no loadContext) — device ${String(row.id)} is not hosted`);
|
|
110567
|
+
const base = await devices.loadContext(row.stableId, row.id, null, config);
|
|
110568
|
+
const registered = [];
|
|
110569
|
+
const device = new DeviceClass({
|
|
110570
|
+
...base,
|
|
110571
|
+
registerNativeCap: (cap, provider) => {
|
|
110572
|
+
base.registerNativeCap(cap, provider);
|
|
110573
|
+
registered.push(cap.name);
|
|
110574
|
+
}
|
|
110575
|
+
});
|
|
110576
|
+
return {
|
|
110577
|
+
device,
|
|
110578
|
+
withdraw: async () => {
|
|
110579
|
+
await device.removeDevice();
|
|
110580
|
+
for (const capName of registered) base.unregisterNativeCap?.(capName);
|
|
110581
|
+
}
|
|
110582
|
+
};
|
|
110583
|
+
}
|
|
110584
|
+
/**
|
|
110585
|
+
* Whether an engine may stop sweeping: only once a pass found no old row left.
|
|
110586
|
+
* `none` is not done — a registry that has not answered the integration yet
|
|
110587
|
+
* reads as null too, and the sweep is one indexed read per pass.
|
|
110588
|
+
*/
|
|
110589
|
+
function legacySweepDone(sweep) {
|
|
110590
|
+
return sweep.kind === "swept" && sweep.drained;
|
|
110591
|
+
}
|
|
110592
|
+
/**
|
|
110593
|
+
* The legacy rows, one bounded batch at a time: only the rows under the old
|
|
110594
|
+
* integration, ordered by id, at most `DECLARED_DEVICE_SWEEP_LIMIT` — a large
|
|
110595
|
+
* leftover set drains over passes instead of being refused whole by the
|
|
110596
|
+
* sweep's own bound.
|
|
110597
|
+
*/
|
|
110598
|
+
function legacyEngineRowsIndex(rows, integrationId) {
|
|
110599
|
+
return rows.filter((row) => row.integrationId === integrationId).toSorted((left, right) => left.id - right.id).slice(0, 32);
|
|
110600
|
+
}
|
|
110601
|
+
/**
|
|
110602
|
+
* Remove every camera row an engine declared itself before its cameras were
|
|
110603
|
+
* blocks, unconditionally, through the declared sweep (`removeDevice` →
|
|
110604
|
+
* tombstone, D865). No integration means nothing was ever declared, and
|
|
110605
|
+
* nothing is minted to find out. A failed read throws: the caller retries.
|
|
110606
|
+
*/
|
|
110607
|
+
async function sweepLegacyEngineRows(ports, integrationName) {
|
|
110608
|
+
const integration = await ports.getIntegration(ports.addonId);
|
|
110609
|
+
if (integration === null) return { kind: "none" };
|
|
110610
|
+
let found = 0;
|
|
110611
|
+
return {
|
|
110612
|
+
kind: "swept",
|
|
110613
|
+
removed: (await new DeclaredDevices({
|
|
110614
|
+
logger: ports.logger,
|
|
110615
|
+
addonId: ports.addonId,
|
|
110616
|
+
devices: ports.devices,
|
|
110617
|
+
localNodeId: ports.localNodeId,
|
|
110618
|
+
getIntegration: async () => integration,
|
|
110619
|
+
createIntegration: async () => {
|
|
110620
|
+
throw new Error(`${ports.addonId}: the legacy sweep never mints an integration`);
|
|
110621
|
+
},
|
|
110622
|
+
updateIntegration: async () => void 0,
|
|
110623
|
+
listOwnDevices: async () => {
|
|
110624
|
+
const index = legacyEngineRowsIndex(await ports.listAddonRows(ports.addonId), integration.id);
|
|
110625
|
+
found = index.length;
|
|
110626
|
+
return index;
|
|
110627
|
+
}
|
|
110628
|
+
}).reconcile({
|
|
110629
|
+
integrationName,
|
|
110630
|
+
integrationId: integration.id,
|
|
110631
|
+
placement: "hub",
|
|
110632
|
+
devices: []
|
|
110633
|
+
})).removed,
|
|
110634
|
+
drained: found === 0
|
|
110635
|
+
};
|
|
110636
|
+
}
|
|
110637
|
+
//#endregion
|
|
109051
110638
|
//#region src/composition/composition-link-kinds.ts
|
|
109052
110639
|
/**
|
|
109053
110640
|
* Every link a device keeps in its STORED composition that a surface must
|
|
@@ -111846,11 +113433,67 @@ var DEVICE_LOCAL_STATE_CAPS = {
|
|
|
111846
113433
|
waterHeater: waterHeaterCapability,
|
|
111847
113434
|
weather: weatherCapability,
|
|
111848
113435
|
weatherStation: weatherStationCapability,
|
|
113436
|
+
workload: workloadCapability,
|
|
111849
113437
|
zoneAnalytics: zoneAnalyticsCapability,
|
|
111850
113438
|
zoneRules: zoneRulesCapability,
|
|
111851
113439
|
zones: zonesCapability
|
|
111852
113440
|
};
|
|
111853
113441
|
//#endregion
|
|
113442
|
+
//#region src/device/declare-identifiers.ts
|
|
113443
|
+
/**
|
|
113444
|
+
* Normalise `raw` and declare it: every kind it carries replaces the stored one,
|
|
113445
|
+
* every kind it lacks is removed, except the kinds in `options.unread` (a failed
|
|
113446
|
+
* read keeps what was stored) — pass everything the provider read in one call.
|
|
113447
|
+
*/
|
|
113448
|
+
async function declareDeviceIdentifiers(deps, raw, options = {}) {
|
|
113449
|
+
const { deviceId, logger, writer } = deps;
|
|
113450
|
+
const { unread, ...normaliseOptions } = options;
|
|
113451
|
+
const { identifiers, rejected } = normaliseIdentifiers(raw, normaliseOptions);
|
|
113452
|
+
for (const r of rejected) logger.warn("identifier refused — not declared", {
|
|
113453
|
+
tags: { deviceId },
|
|
113454
|
+
meta: {
|
|
113455
|
+
key: r.key,
|
|
113456
|
+
value: r.value,
|
|
113457
|
+
reason: r.reason
|
|
113458
|
+
}
|
|
113459
|
+
});
|
|
113460
|
+
const unreadKinds = new Set(unread ?? []);
|
|
113461
|
+
if (isEmptyIdentifiers(identifiers) && DEVICE_IDENTIFIER_KEYS.every((key) => unreadKinds.has(key))) {
|
|
113462
|
+
logger.debug("no identifier read — nothing declared", { tags: { deviceId } });
|
|
113463
|
+
return {
|
|
113464
|
+
outcome: "nothing-to-declare",
|
|
113465
|
+
identifiers
|
|
113466
|
+
};
|
|
113467
|
+
}
|
|
113468
|
+
if (writer === void 0) {
|
|
113469
|
+
logger.warn("identifiers not declared — device-manager unreachable", { tags: { deviceId } });
|
|
113470
|
+
return {
|
|
113471
|
+
outcome: "unavailable",
|
|
113472
|
+
identifiers
|
|
113473
|
+
};
|
|
113474
|
+
}
|
|
113475
|
+
try {
|
|
113476
|
+
await writer.mutate({
|
|
113477
|
+
deviceId,
|
|
113478
|
+
identifiers,
|
|
113479
|
+
...unread !== void 0 && unread.length > 0 ? { unread } : {}
|
|
113480
|
+
});
|
|
113481
|
+
return {
|
|
113482
|
+
outcome: "declared",
|
|
113483
|
+
identifiers
|
|
113484
|
+
};
|
|
113485
|
+
} catch (err) {
|
|
113486
|
+
logger.warn("identifiers not declared — setIdentifiers failed", {
|
|
113487
|
+
tags: { deviceId },
|
|
113488
|
+
meta: { error: require_composed_stable_id.errMsg(err) }
|
|
113489
|
+
});
|
|
113490
|
+
return {
|
|
113491
|
+
outcome: "failed",
|
|
113492
|
+
identifiers
|
|
113493
|
+
};
|
|
113494
|
+
}
|
|
113495
|
+
}
|
|
113496
|
+
//#endregion
|
|
111854
113497
|
//#region src/device/device-error-episode.ts
|
|
111855
113498
|
/**
|
|
111856
113499
|
* The edge between two readings, or `null` for no edge.
|
|
@@ -111906,6 +113549,8 @@ var BaseDevice = class {
|
|
|
111906
113549
|
id;
|
|
111907
113550
|
stableId;
|
|
111908
113551
|
type;
|
|
113552
|
+
/** True when another process owns the base slices (`options.deviceStatus: 'external'`). */
|
|
113553
|
+
statusIsExternal;
|
|
111909
113554
|
name;
|
|
111910
113555
|
parentDeviceId;
|
|
111911
113556
|
role;
|
|
@@ -112054,21 +113699,26 @@ var BaseDevice = class {
|
|
|
112054
113699
|
};
|
|
112055
113700
|
this.runtimeState = DeviceRuntimeState.fromInitial(initial, writer, onWriteFailed);
|
|
112056
113701
|
ctx.bindRuntimeState?.(this.runtimeState);
|
|
112057
|
-
|
|
112058
|
-
|
|
112059
|
-
|
|
112060
|
-
|
|
112061
|
-
|
|
112062
|
-
|
|
112063
|
-
|
|
112064
|
-
|
|
112065
|
-
|
|
112066
|
-
|
|
112067
|
-
|
|
112068
|
-
|
|
112069
|
-
|
|
112070
|
-
|
|
112071
|
-
|
|
113702
|
+
this.statusIsExternal = options.deviceStatus === "external";
|
|
113703
|
+
if (!this.statusIsExternal) ctx.registerNativeCap?.(deviceStatusCapability, {});
|
|
113704
|
+
if (!this.statusIsExternal) {
|
|
113705
|
+
const seed = {
|
|
113706
|
+
online: true,
|
|
113707
|
+
lastChangedAt: Date.now()
|
|
113708
|
+
};
|
|
113709
|
+
this.runtimeState.setCapState("device-status", seed);
|
|
113710
|
+
}
|
|
113711
|
+
if (!this.statusIsExternal) {
|
|
113712
|
+
ctx.registerNativeCap?.(featureProbeCapability, {});
|
|
113713
|
+
this.runtimeState.setCapState("feature-probe", {
|
|
113714
|
+
flags: {},
|
|
113715
|
+
deviceType: null,
|
|
113716
|
+
model: null,
|
|
113717
|
+
channelCount: null,
|
|
113718
|
+
lastProbedAt: 0,
|
|
113719
|
+
lastFetchedAt: 0
|
|
113720
|
+
});
|
|
113721
|
+
}
|
|
112072
113722
|
}
|
|
112073
113723
|
deviceActions = /* @__PURE__ */ new Map();
|
|
112074
113724
|
/** Declare a device custom action + its typed handler. Idempotent per name. */
|
|
@@ -112096,7 +113746,7 @@ var BaseDevice = class {
|
|
|
112096
113746
|
* override to gate side effects on the transition.
|
|
112097
113747
|
*/
|
|
112098
113748
|
markOnline(online) {
|
|
112099
|
-
if (this.online === online) return;
|
|
113749
|
+
if (this.statusIsExternal || this.online === online) return;
|
|
112100
113750
|
const next = {
|
|
112101
113751
|
online,
|
|
112102
113752
|
lastChangedAt: Date.now()
|
|
@@ -112166,6 +113816,24 @@ var BaseDevice = class {
|
|
|
112166
113816
|
}));
|
|
112167
113817
|
}
|
|
112168
113818
|
/**
|
|
113819
|
+
* Declare this device's identifiers (D1059): MAC(s), serial, vendor uid,
|
|
113820
|
+
* machine uuid, hostname, IP — what a later step matches across integrations.
|
|
113821
|
+
* Normalises `raw` (`normaliseIdentifiers`), logs every refused value, and
|
|
113822
|
+
* writes the result through `device-manager.setIdentifiers`, which accepts it
|
|
113823
|
+
* only from the provider that owns this device. Each kind it carries replaces
|
|
113824
|
+
* the stored one and each kind it lacks is removed — except the kinds listed in
|
|
113825
|
+
* `options.unread` (reads that FAILED), which keep their stored value. Pass
|
|
113826
|
+
* everything read in one call; a call where every kind is unread writes
|
|
113827
|
+
* nothing. Best-effort: never throws.
|
|
113828
|
+
*/
|
|
113829
|
+
async declareIdentifiers(raw, options) {
|
|
113830
|
+
return declareDeviceIdentifiers({
|
|
113831
|
+
deviceId: this.id,
|
|
113832
|
+
logger: this.ctx.logger,
|
|
113833
|
+
writer: this.ctx.api.deviceManager?.setIdentifiers
|
|
113834
|
+
}, raw, options);
|
|
113835
|
+
}
|
|
113836
|
+
/**
|
|
112169
113837
|
* Re-publish the device's current `features` array to the persisted
|
|
112170
113838
|
* meta blob. Drivers call this after a probe finishes when the live
|
|
112171
113839
|
* `features` getter has gained new flags (e.g. `hasIntercom` flips
|
|
@@ -112370,6 +114038,7 @@ var BaseDevice = class {
|
|
|
112370
114038
|
* `lastProbedAt`) once their probe actually succeeds.
|
|
112371
114039
|
*/
|
|
112372
114040
|
async onProbe() {
|
|
114041
|
+
if (this.statusIsExternal) return;
|
|
112373
114042
|
const base = this.runtimeState.getCapState("feature-probe") ?? {
|
|
112374
114043
|
flags: {},
|
|
112375
114044
|
deviceType: null,
|
|
@@ -113580,292 +115249,6 @@ function legacyAutoLinkIds(params) {
|
|
|
113580
115249
|
return [...ids];
|
|
113581
115250
|
}
|
|
113582
115251
|
//#endregion
|
|
113583
|
-
//#region src/device/declared-device.ts
|
|
113584
|
-
/** Marker written to a declared integration's `info`. */
|
|
113585
|
-
var DECLARED_INTEGRATION_FIXED_KEY = "fixed";
|
|
113586
|
-
/**
|
|
113587
|
-
* Give a declared integration its instance record, ONCE. The record is read first and left
|
|
113588
|
-
* exactly as it is when it exists (an operator's rename, a field the addon later adds): a seed
|
|
113589
|
-
* never overwrites. A read that fails throws and writes nothing (D49) — the next pass retries.
|
|
113590
|
-
* True when the record was written by this call.
|
|
113591
|
-
*/
|
|
113592
|
-
async function seedInstanceOnce(instances, seed) {
|
|
113593
|
-
const existing = await instances.getInstance({ id: seed.id });
|
|
113594
|
-
if (existing !== null && existing !== void 0) return false;
|
|
113595
|
-
await instances.createInstance({
|
|
113596
|
-
id: seed.id,
|
|
113597
|
-
name: seed.name
|
|
113598
|
-
});
|
|
113599
|
-
return true;
|
|
113600
|
-
}
|
|
113601
|
-
/**
|
|
113602
|
-
* Strip the `<node>/<addon>` suffix a forked child carries.
|
|
113603
|
-
*
|
|
113604
|
-
* Comparing `ctx.kernel.localNodeId` raw skipped EVERY node — including the one
|
|
113605
|
-
* that was supposed to act — because on the hub it reads `hub/<addon>`.
|
|
113606
|
-
*/
|
|
113607
|
-
function declarationOwnerNodeId(localNodeId) {
|
|
113608
|
-
const raw = localNodeId ?? "hub";
|
|
113609
|
-
if (!raw.includes("/")) return raw;
|
|
113610
|
-
return raw.split("/")[0] ?? "hub";
|
|
113611
|
-
}
|
|
113612
|
-
/** Cap on how many rows one withdrawal pass may delete. */
|
|
113613
|
-
var DECLARED_DEVICE_SWEEP_LIMIT = 32;
|
|
113614
|
-
/**
|
|
113615
|
-
* The one way an addon owns a device it declares.
|
|
113616
|
-
*
|
|
113617
|
-
* Construct once with the addon's ports, then call {@link reconcile} on boot and
|
|
113618
|
-
* on every convergence tick. There is no second get-or-create helper — a guard
|
|
113619
|
-
* in `scripts/` enforces that.
|
|
113620
|
-
*/
|
|
113621
|
-
var DeclaredDevices = class {
|
|
113622
|
-
ports;
|
|
113623
|
-
constructor(ports) {
|
|
113624
|
-
const addonId = ports.addonId;
|
|
113625
|
-
if (typeof addonId !== "string" || addonId.length === 0) throw new Error(`DeclaredDevices: addonId must be the declaring addon's id, got ${JSON.stringify(addonId)}. On an addon context it is \`ctx.id\` — there is no \`ctx.addonId\`.`);
|
|
113626
|
-
this.ports = ports;
|
|
113627
|
-
}
|
|
113628
|
-
/**
|
|
113629
|
-
* Converge the declared set. Idempotent, and safe to call repeatedly.
|
|
113630
|
-
*
|
|
113631
|
-
* Throws only what the ports throw on the FIRST index read; every other
|
|
113632
|
-
* failure is per-device and logged, so one bad declaration never takes the
|
|
113633
|
-
* others down.
|
|
113634
|
-
*/
|
|
113635
|
-
async reconcile(spec) {
|
|
113636
|
-
if ((spec.placement ?? "hub") === "hub") {
|
|
113637
|
-
const nodeId = declarationOwnerNodeId(this.ports.localNodeId);
|
|
113638
|
-
if (nodeId !== "hub") {
|
|
113639
|
-
this.ports.logger.info("declared devices are hub-owned — skipping on this node", { meta: {
|
|
113640
|
-
nodeId,
|
|
113641
|
-
rawNodeId: this.ports.localNodeId ?? null
|
|
113642
|
-
} });
|
|
113643
|
-
return {
|
|
113644
|
-
integrationId: null,
|
|
113645
|
-
devices: [],
|
|
113646
|
-
removed: [],
|
|
113647
|
-
owned: false
|
|
113648
|
-
};
|
|
113649
|
-
}
|
|
113650
|
-
}
|
|
113651
|
-
let integrationId;
|
|
113652
|
-
if (spec.integrationId !== void 0) integrationId = spec.integrationId;
|
|
113653
|
-
else {
|
|
113654
|
-
const own = await this.ensureIntegration(spec.integrationName);
|
|
113655
|
-
integrationId = own.id;
|
|
113656
|
-
await this.seedInstance(own);
|
|
113657
|
-
}
|
|
113658
|
-
const index = await this.readIndex();
|
|
113659
|
-
const live = await this.readLiveByStableId();
|
|
113660
|
-
const outcomes = [];
|
|
113661
|
-
for (const declaration of spec.devices) {
|
|
113662
|
-
const outcome = await this.applyDeclaration(declaration, integrationId, index, live);
|
|
113663
|
-
if (outcome !== null) outcomes.push(outcome);
|
|
113664
|
-
}
|
|
113665
|
-
const removed = await this.sweepWithdrawn(spec.devices, integrationId, index);
|
|
113666
|
-
return {
|
|
113667
|
-
integrationId,
|
|
113668
|
-
devices: outcomes,
|
|
113669
|
-
removed,
|
|
113670
|
-
owned: true
|
|
113671
|
-
};
|
|
113672
|
-
}
|
|
113673
|
-
/**
|
|
113674
|
-
* Get-or-create the FIXED integration, and RE-ASSERT the flag every pass.
|
|
113675
|
-
*
|
|
113676
|
-
* The re-assertion is the fix for the defect the hand-rolled version shipped
|
|
113677
|
-
* with: writing `info.fixed` only on the create path left every pre-existing
|
|
113678
|
-
* install without it, and the kernel kept offering to delete an integration
|
|
113679
|
-
* the addon owns.
|
|
113680
|
-
*/
|
|
113681
|
-
async ensureIntegration(integrationName) {
|
|
113682
|
-
const existing = await this.ports.getIntegration(this.ports.addonId);
|
|
113683
|
-
if (existing === null) {
|
|
113684
|
-
const created = await this.ports.createIntegration({
|
|
113685
|
-
addonId: this.ports.addonId,
|
|
113686
|
-
name: integrationName,
|
|
113687
|
-
info: { [DECLARED_INTEGRATION_FIXED_KEY]: true }
|
|
113688
|
-
});
|
|
113689
|
-
this.ports.logger.info("declared a fixed integration", { meta: {
|
|
113690
|
-
integrationId: created.id,
|
|
113691
|
-
name: integrationName
|
|
113692
|
-
} });
|
|
113693
|
-
return {
|
|
113694
|
-
id: created.id,
|
|
113695
|
-
name: integrationName
|
|
113696
|
-
};
|
|
113697
|
-
}
|
|
113698
|
-
if (existing.info?.["fixed"] !== true) {
|
|
113699
|
-
await this.ports.updateIntegration({
|
|
113700
|
-
id: existing.id,
|
|
113701
|
-
info: { [DECLARED_INTEGRATION_FIXED_KEY]: true }
|
|
113702
|
-
});
|
|
113703
|
-
this.ports.logger.info("re-asserted `fixed` on a declared integration", { meta: { integrationId: existing.id } });
|
|
113704
|
-
}
|
|
113705
|
-
return {
|
|
113706
|
-
id: existing.id,
|
|
113707
|
-
name: existing.name ?? integrationName
|
|
113708
|
-
};
|
|
113709
|
-
}
|
|
113710
|
-
/** Seed the instance record of an integration this declarer owns; best-effort, retried next pass. */
|
|
113711
|
-
async seedInstance(integration) {
|
|
113712
|
-
const { seedInstance } = this.ports;
|
|
113713
|
-
if (seedInstance === void 0) return;
|
|
113714
|
-
try {
|
|
113715
|
-
await seedInstance({
|
|
113716
|
-
id: integration.id,
|
|
113717
|
-
name: integration.name
|
|
113718
|
-
});
|
|
113719
|
-
} catch (err) {
|
|
113720
|
-
this.ports.logger.warn("could not seed the instance record of a declared integration", {
|
|
113721
|
-
tags: { integrationId: integration.id },
|
|
113722
|
-
meta: { error: require_composed_stable_id.errMsg(err) }
|
|
113723
|
-
});
|
|
113724
|
-
}
|
|
113725
|
-
}
|
|
113726
|
-
async readIndex() {
|
|
113727
|
-
const rows = await this.ports.listOwnDevices();
|
|
113728
|
-
return new Map(rows.map((row) => [row.stableId, row]));
|
|
113729
|
-
}
|
|
113730
|
-
/**
|
|
113731
|
-
* Devices this kernel already has CONSTRUCTED, by stableId.
|
|
113732
|
-
*
|
|
113733
|
-
* Distinct from {@link readIndex}, and the distinction is the bug: the index
|
|
113734
|
-
* is persisted rows, this is live objects. A row without an object must be
|
|
113735
|
-
* adopted; an object must be left exactly as it is.
|
|
113736
|
-
*
|
|
113737
|
-
* Failure is non-fatal and deliberately so — an empty map degrades to the
|
|
113738
|
-
* previous behaviour (attempt the adopt) rather than skipping a device that
|
|
113739
|
-
* genuinely needs bringing up.
|
|
113740
|
-
*/
|
|
113741
|
-
async readLiveByStableId() {
|
|
113742
|
-
try {
|
|
113743
|
-
const devices = await this.ports.devices.getAll();
|
|
113744
|
-
return new Map(devices.map((device) => [device.stableId, device]));
|
|
113745
|
-
} catch (err) {
|
|
113746
|
-
this.ports.logger.warn("could not read live devices — falling back to adopt-by-row", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
113747
|
-
return /* @__PURE__ */ new Map();
|
|
113748
|
-
}
|
|
113749
|
-
}
|
|
113750
|
-
/**
|
|
113751
|
-
* One declaration: adopt what exists, create what does not.
|
|
113752
|
-
*
|
|
113753
|
-
* The create branch is the destructive one — it seeds `initialMeta`, and
|
|
113754
|
-
* `initialMeta.name` lands as an unconditional `setName`. A transiently empty
|
|
113755
|
-
* index therefore looks exactly like a first boot and would silently re-stamp
|
|
113756
|
-
* the declared name over the operator's rename. D49: that branch needs a
|
|
113757
|
-
* second read to agree.
|
|
113758
|
-
*/
|
|
113759
|
-
async applyDeclaration(declaration, integrationId, index, live) {
|
|
113760
|
-
try {
|
|
113761
|
-
const alreadyLive = live.get(declaration.stableId);
|
|
113762
|
-
if (alreadyLive !== void 0) return {
|
|
113763
|
-
stableId: declaration.stableId,
|
|
113764
|
-
deviceId: alreadyLive.id,
|
|
113765
|
-
device: alreadyLive,
|
|
113766
|
-
created: false
|
|
113767
|
-
};
|
|
113768
|
-
let existing = index.get(declaration.stableId);
|
|
113769
|
-
if (existing === void 0) {
|
|
113770
|
-
existing = (await this.readIndex()).get(declaration.stableId);
|
|
113771
|
-
if (existing !== void 0) this.ports.logger.warn("device index disagreed with itself — adopting instead of re-creating", {
|
|
113772
|
-
tags: { deviceId: existing.id },
|
|
113773
|
-
meta: {
|
|
113774
|
-
stableId: declaration.stableId,
|
|
113775
|
-
addonId: this.ports.addonId
|
|
113776
|
-
}
|
|
113777
|
-
});
|
|
113778
|
-
}
|
|
113779
|
-
if (existing !== void 0) {
|
|
113780
|
-
const device = await this.ports.devices.create(declaration.stableId, declaration.DeviceClass, {}, null, void 0);
|
|
113781
|
-
this.ports.logger.info("declared device adopted", {
|
|
113782
|
-
tags: { deviceId: device.id },
|
|
113783
|
-
meta: {
|
|
113784
|
-
stableId: declaration.stableId,
|
|
113785
|
-
integrationId
|
|
113786
|
-
}
|
|
113787
|
-
});
|
|
113788
|
-
return {
|
|
113789
|
-
stableId: declaration.stableId,
|
|
113790
|
-
deviceId: device.id,
|
|
113791
|
-
device,
|
|
113792
|
-
created: false
|
|
113793
|
-
};
|
|
113794
|
-
}
|
|
113795
|
-
const device = await this.ports.devices.create(declaration.stableId, declaration.DeviceClass, declaration.config ?? {}, null, {
|
|
113796
|
-
type: declaration.type,
|
|
113797
|
-
name: declaration.name,
|
|
113798
|
-
integrationId,
|
|
113799
|
-
...declaration.role === void 0 ? {} : { role: declaration.role }
|
|
113800
|
-
});
|
|
113801
|
-
this.ports.logger.info("declared device created", {
|
|
113802
|
-
tags: { deviceId: device.id },
|
|
113803
|
-
meta: {
|
|
113804
|
-
stableId: declaration.stableId,
|
|
113805
|
-
integrationId
|
|
113806
|
-
}
|
|
113807
|
-
});
|
|
113808
|
-
return {
|
|
113809
|
-
stableId: declaration.stableId,
|
|
113810
|
-
deviceId: device.id,
|
|
113811
|
-
device,
|
|
113812
|
-
created: true
|
|
113813
|
-
};
|
|
113814
|
-
} catch (err) {
|
|
113815
|
-
this.ports.logger.warn("a declared device could not be brought up", { meta: {
|
|
113816
|
-
stableId: declaration.stableId,
|
|
113817
|
-
error: err instanceof Error ? err.message : String(err)
|
|
113818
|
-
} });
|
|
113819
|
-
return null;
|
|
113820
|
-
}
|
|
113821
|
-
}
|
|
113822
|
-
/**
|
|
113823
|
-
* Remove rows under the addon's FIXED integration whose declaration is gone.
|
|
113824
|
-
*
|
|
113825
|
-
* Bounded to that integration: a declared integration has no operator
|
|
113826
|
-
* add-flow, so every row under it got there by declaration. Devices this
|
|
113827
|
-
* addon owns OUTSIDE it (a provider's adopted devices) are never candidates.
|
|
113828
|
-
*
|
|
113829
|
-
* Bounded in count, and every deletion is logged with its `deviceId` — a
|
|
113830
|
-
* withdrawal that removes an operator-visible row silently is the failure
|
|
113831
|
-
* mode, not the removal itself.
|
|
113832
|
-
*/
|
|
113833
|
-
async sweepWithdrawn(declarations, integrationId, index) {
|
|
113834
|
-
const declared = new Set(declarations.map((d) => d.stableId));
|
|
113835
|
-
const candidates = [...index.values()].filter((row) => row.integrationId === integrationId && !declared.has(row.stableId));
|
|
113836
|
-
if (candidates.length === 0) return [];
|
|
113837
|
-
if (candidates.length > 32) {
|
|
113838
|
-
this.ports.logger.warn("withdrawal sweep exceeded its bound — removing nothing", { meta: {
|
|
113839
|
-
integrationId,
|
|
113840
|
-
candidates: candidates.length,
|
|
113841
|
-
bound: 32
|
|
113842
|
-
} });
|
|
113843
|
-
return [];
|
|
113844
|
-
}
|
|
113845
|
-
const removed = [];
|
|
113846
|
-
for (const row of candidates) try {
|
|
113847
|
-
await this.ports.devices.remove(row.id);
|
|
113848
|
-
removed.push(row.id);
|
|
113849
|
-
this.ports.logger.info("declared device removed — its declaration was withdrawn", {
|
|
113850
|
-
tags: { deviceId: row.id },
|
|
113851
|
-
meta: {
|
|
113852
|
-
stableId: row.stableId,
|
|
113853
|
-
integrationId
|
|
113854
|
-
}
|
|
113855
|
-
});
|
|
113856
|
-
} catch (err) {
|
|
113857
|
-
this.ports.logger.warn("a withdrawn declared device could not be removed", {
|
|
113858
|
-
tags: { deviceId: row.id },
|
|
113859
|
-
meta: {
|
|
113860
|
-
stableId: row.stableId,
|
|
113861
|
-
error: err instanceof Error ? err.message : String(err)
|
|
113862
|
-
}
|
|
113863
|
-
});
|
|
113864
|
-
}
|
|
113865
|
-
return removed;
|
|
113866
|
-
}
|
|
113867
|
-
};
|
|
113868
|
-
//#endregion
|
|
113869
115252
|
//#region src/device/block-declared-devices.ts
|
|
113870
115253
|
/**
|
|
113871
115254
|
* Helper for core-block scripts that declare devices on the shared Blocks
|
|
@@ -114035,6 +115418,7 @@ var DEVICE_TYPE_CONTROL_KIND = {
|
|
|
114035
115418
|
[require_composed_stable_id.DeviceType.WaterHeater]: "water-heater",
|
|
114036
115419
|
[require_composed_stable_id.DeviceType.HeatPump]: "dummy",
|
|
114037
115420
|
[require_composed_stable_id.DeviceType.EnergySystem]: "energy-system",
|
|
115421
|
+
[require_composed_stable_id.DeviceType.Workload]: "workload",
|
|
114038
115422
|
[require_composed_stable_id.DeviceType.Camera]: "dummy",
|
|
114039
115423
|
[require_composed_stable_id.DeviceType.Switch]: "switch",
|
|
114040
115424
|
[require_composed_stable_id.DeviceType.Siren]: "switch",
|
|
@@ -116451,10 +117835,12 @@ function durationText(seconds) {
|
|
|
116451
117835
|
const text = `${Math.floor(m / 60)} h ${String(m % 60).padStart(2, "0")}`;
|
|
116452
117836
|
return require_sleep.t(text, text);
|
|
116453
117837
|
}
|
|
116454
|
-
var switchContribution = contribution("switch", SwitchStatusSchema, (slice) => {
|
|
117838
|
+
var switchContribution = contribution("switch", SwitchStatusSchema, (slice, ctx) => {
|
|
116455
117839
|
const on = slice?.on ?? null;
|
|
117840
|
+
const state = reading("switch", on === null ? "unknown" : on ? "on" : "off");
|
|
117841
|
+
if (ctx.switchOptions?.supportsSetState === false) return { reading: state };
|
|
116456
117842
|
return {
|
|
116457
|
-
reading:
|
|
117843
|
+
reading: state,
|
|
116458
117844
|
ownPower: {
|
|
116459
117845
|
source: "switch",
|
|
116460
117846
|
on,
|
|
@@ -116664,14 +118050,17 @@ var timedRunContribution = contribution("timed-run", TimedRunStatusSchema, (slic
|
|
|
116664
118050
|
tiles: armed
|
|
116665
118051
|
};
|
|
116666
118052
|
});
|
|
116667
|
-
var powerSourceContribution = contribution("power-source", PowerSourceStateSchema, (slice, ctx) =>
|
|
116668
|
-
|
|
116669
|
-
|
|
116670
|
-
|
|
116671
|
-
|
|
116672
|
-
|
|
116673
|
-
|
|
116674
|
-
}
|
|
118053
|
+
var powerSourceContribution = contribution("power-source", PowerSourceStateSchema, (slice, ctx) => {
|
|
118054
|
+
const settable = ctx.powerSupplySettable !== false;
|
|
118055
|
+
return { powerSupply: {
|
|
118056
|
+
on: slice?.switchOn ?? null,
|
|
118057
|
+
confirmOffWhileRunning: ctx.running === true,
|
|
118058
|
+
running: ctx.running ?? null,
|
|
118059
|
+
powerOn: settable ? action("power-supply.on", require_sleep.t("Power on", "Alimenta"), "plug", "power-source", "powerOn") : null,
|
|
118060
|
+
powerOff: settable ? action("power-supply.off", require_sleep.t("Power off", "Togli alimentazione"), "plug-zap", "power-source", "powerOff", {}, "normal", "off-while-running") : null,
|
|
118061
|
+
restart: action("power-supply.restart", require_sleep.t("Restart", "Riavvia"), "rotate-cw", "power-source", "forceRestart")
|
|
118062
|
+
} };
|
|
118063
|
+
});
|
|
116675
118064
|
/** The remote cap has no status: the model's input carries how many commands it holds. */
|
|
116676
118065
|
var remoteContribution = {
|
|
116677
118066
|
cap: "remote",
|
|
@@ -117090,6 +118479,7 @@ var HERO_LAYOUT_BY_TYPE = {
|
|
|
117090
118479
|
[require_composed_stable_id.DeviceType.WaterHeater]: CLIMATE_LAYOUT,
|
|
117091
118480
|
[require_composed_stable_id.DeviceType.HeatPump]: HEAT_PUMP_LAYOUT,
|
|
117092
118481
|
[require_composed_stable_id.DeviceType.EnergySystem]: HERO_LAYOUT_DEFAULT,
|
|
118482
|
+
[require_composed_stable_id.DeviceType.Workload]: HERO_LAYOUT_DEFAULT,
|
|
117093
118483
|
[require_composed_stable_id.DeviceType.Fan]: FAN_LAYOUT,
|
|
117094
118484
|
[require_composed_stable_id.DeviceType.MediaPlayer]: MEDIA_PLAYER_LAYOUT,
|
|
117095
118485
|
[require_composed_stable_id.DeviceType.AlarmPanel]: ALARM_LAYOUT,
|
|
@@ -117816,6 +119206,7 @@ var HERO_LOOK_BY_TYPE = {
|
|
|
117816
119206
|
[require_composed_stable_id.DeviceType.WaterHeater]: WATER_HEATER_LOOK,
|
|
117817
119207
|
[require_composed_stable_id.DeviceType.HeatPump]: HEAT_PUMP_LOOK,
|
|
117818
119208
|
[require_composed_stable_id.DeviceType.EnergySystem]: HERO_LOOK_DEFAULT,
|
|
119209
|
+
[require_composed_stable_id.DeviceType.Workload]: HERO_LOOK_DEFAULT,
|
|
117819
119210
|
[require_composed_stable_id.DeviceType.Fan]: FAN_LOOK,
|
|
117820
119211
|
[require_composed_stable_id.DeviceType.MediaPlayer]: MEDIA_PLAYER_LOOK,
|
|
117821
119212
|
[require_composed_stable_id.DeviceType.AlarmPanel]: ALARM_LOOK,
|
|
@@ -117858,6 +119249,7 @@ var HERO_LOOK_BY_ROLE = {
|
|
|
117858
119249
|
[require_composed_stable_id.DeviceRole.SwitchHeater]: HEATER_LOOK,
|
|
117859
119250
|
[require_composed_stable_id.DeviceRole.SwitchFan]: FAN_LOOK,
|
|
117860
119251
|
[require_composed_stable_id.DeviceRole.SwitchLight]: LIGHT_LOOK,
|
|
119252
|
+
[require_composed_stable_id.DeviceRole.PoePort]: "inherit",
|
|
117861
119253
|
[require_composed_stable_id.DeviceRole.ClimateAc]: "inherit",
|
|
117862
119254
|
[require_composed_stable_id.DeviceRole.ClimateThermostat]: "inherit",
|
|
117863
119255
|
[require_composed_stable_id.DeviceRole.ClimateFloor]: "inherit",
|
|
@@ -117902,7 +119294,12 @@ var HERO_LOOK_BY_ROLE = {
|
|
|
117902
119294
|
[require_composed_stable_id.DeviceRole.MessagingNotifier]: "inherit",
|
|
117903
119295
|
[require_composed_stable_id.DeviceRole.EmailNotifier]: "inherit",
|
|
117904
119296
|
[require_composed_stable_id.DeviceRole.GenericNotifier]: "inherit",
|
|
117905
|
-
[require_composed_stable_id.DeviceRole.IrTransmitter]: "inherit"
|
|
119297
|
+
[require_composed_stable_id.DeviceRole.IrTransmitter]: "inherit",
|
|
119298
|
+
[require_composed_stable_id.DeviceRole.Vm]: "inherit",
|
|
119299
|
+
[require_composed_stable_id.DeviceRole.AppContainer]: "inherit",
|
|
119300
|
+
[require_composed_stable_id.DeviceRole.Lxc]: "inherit",
|
|
119301
|
+
[require_composed_stable_id.DeviceRole.App]: "inherit",
|
|
119302
|
+
[require_composed_stable_id.DeviceRole.Host]: "inherit"
|
|
117906
119303
|
};
|
|
117907
119304
|
function isDeviceType$1(type) {
|
|
117908
119305
|
return Object.values(require_composed_stable_id.DeviceType).includes(type);
|
|
@@ -117949,16 +119346,6 @@ function resolveOwnPower(offers) {
|
|
|
117949
119346
|
}
|
|
117950
119347
|
//#endregion
|
|
117951
119348
|
//#region src/device/hero/build-hero-model.ts
|
|
117952
|
-
/**
|
|
117953
|
-
* `buildHeroModel` — the ONE pure function behind every device hero (D1023).
|
|
117954
|
-
* The admin device page, the admin quick-detail dialog and the viewer's device
|
|
117955
|
-
* screen all draw what it returns; none of them decides anything.
|
|
117956
|
-
*
|
|
117957
|
-
* Inputs are the device, the caps it is bound to (`getBindings`, per device —
|
|
117958
|
-
* never the global cap list, D12), its features and one raw slice per cap. A
|
|
117959
|
-
* slice that is missing or does not parse is "not answered": unknown is never
|
|
117960
|
-
* off (D315/D393), a heater whose switch has not reported renders `unknown`.
|
|
117961
|
-
*/
|
|
117962
119349
|
/** The first source with a known answer wins. */
|
|
117963
119350
|
var STATE_SOURCE_ORDER = [
|
|
117964
119351
|
"media-player",
|
|
@@ -118124,7 +119511,9 @@ function buildHeroModel(input) {
|
|
|
118124
119511
|
running: runningOf(input),
|
|
118125
119512
|
remoteCommands: input.remoteCommands,
|
|
118126
119513
|
caps: input.caps,
|
|
118127
|
-
quantity: device.quantity ?? null
|
|
119514
|
+
quantity: device.quantity ?? null,
|
|
119515
|
+
...input.switchOptions !== void 0 ? { switchOptions: input.switchOptions } : {},
|
|
119516
|
+
...input.powerSupplySettable !== void 0 ? { powerSupplySettable: input.powerSupplySettable } : {}
|
|
118128
119517
|
};
|
|
118129
119518
|
const contributed = HERO_CAP_CONTRIBUTIONS.filter((c) => input.caps.includes(c.cap)).map((c) => ({
|
|
118130
119519
|
cap: c.cap,
|
|
@@ -118329,6 +119718,7 @@ var HERO_CAP_COVERAGE = {
|
|
|
118329
119718
|
weather: "contributes",
|
|
118330
119719
|
"weather-station": "contributes",
|
|
118331
119720
|
"webrtc-session": { none: NOT_A_HERO_FACT },
|
|
119721
|
+
workload: { none: "drawn by the workload device card (state, the controls getOptions declares, resources), which replaces the hero on the device page; its on / off is the switch its power hint registers" },
|
|
118332
119722
|
"zone-analytics": { none: NOT_A_HERO_FACT },
|
|
118333
119723
|
"zone-rules": { none: NOT_A_HERO_FACT },
|
|
118334
119724
|
zones: { none: NOT_A_HERO_FACT }
|
|
@@ -121011,6 +122401,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
121011
122401
|
access: "create",
|
|
121012
122402
|
role: "admin"
|
|
121013
122403
|
},
|
|
122404
|
+
"deviceManager.setIdentifiers": {
|
|
122405
|
+
capName: "device-manager",
|
|
122406
|
+
capScope: "system",
|
|
122407
|
+
addonId: null,
|
|
122408
|
+
access: "create",
|
|
122409
|
+
role: "admin"
|
|
122410
|
+
},
|
|
121014
122411
|
"deviceManager.setIntegrationId": {
|
|
121015
122412
|
capName: "device-manager",
|
|
121016
122413
|
capScope: "system",
|
|
@@ -123895,6 +125292,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
123895
125292
|
access: "view",
|
|
123896
125293
|
role: "admin"
|
|
123897
125294
|
},
|
|
125295
|
+
"notificationRules.listRuleTags": {
|
|
125296
|
+
capName: "notification-rules",
|
|
125297
|
+
capScope: "system",
|
|
125298
|
+
addonId: null,
|
|
125299
|
+
access: "view",
|
|
125300
|
+
role: "admin"
|
|
125301
|
+
},
|
|
123898
125302
|
"notificationRules.listSnoozes": {
|
|
123899
125303
|
capName: "notification-rules",
|
|
123900
125304
|
capScope: "system",
|
|
@@ -123951,6 +125355,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
123951
125355
|
access: "create",
|
|
123952
125356
|
role: "admin"
|
|
123953
125357
|
},
|
|
125358
|
+
"notificationRules.setRuleTags": {
|
|
125359
|
+
capName: "notification-rules",
|
|
125360
|
+
capScope: "system",
|
|
125361
|
+
addonId: null,
|
|
125362
|
+
access: "create",
|
|
125363
|
+
role: "admin"
|
|
125364
|
+
},
|
|
123954
125365
|
"notificationRules.testRule": {
|
|
123955
125366
|
capName: "notification-rules",
|
|
123956
125367
|
capScope: "system",
|
|
@@ -126919,6 +128330,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
126919
128330
|
access: "view",
|
|
126920
128331
|
role: "viewer"
|
|
126921
128332
|
},
|
|
128333
|
+
"siren.getPlayChoices": {
|
|
128334
|
+
capName: "siren",
|
|
128335
|
+
capScope: "device",
|
|
128336
|
+
addonId: null,
|
|
128337
|
+
access: "view",
|
|
128338
|
+
role: "viewer"
|
|
128339
|
+
},
|
|
126922
128340
|
"siren.getStatus": {
|
|
126923
128341
|
capName: "siren",
|
|
126924
128342
|
capScope: "device",
|
|
@@ -127731,6 +129149,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
127731
129149
|
access: "view",
|
|
127732
129150
|
role: "viewer"
|
|
127733
129151
|
},
|
|
129152
|
+
"switch.getOptions": {
|
|
129153
|
+
capName: "switch",
|
|
129154
|
+
capScope: "device",
|
|
129155
|
+
addonId: null,
|
|
129156
|
+
access: "view",
|
|
129157
|
+
role: "viewer"
|
|
129158
|
+
},
|
|
127734
129159
|
"switch.getStatus": {
|
|
127735
129160
|
capName: "switch",
|
|
127736
129161
|
capScope: "device",
|
|
@@ -127738,6 +129163,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
127738
129163
|
access: "view",
|
|
127739
129164
|
role: "viewer"
|
|
127740
129165
|
},
|
|
129166
|
+
"switch.powerCycle": {
|
|
129167
|
+
capName: "switch",
|
|
129168
|
+
capScope: "device",
|
|
129169
|
+
addonId: null,
|
|
129170
|
+
access: "create",
|
|
129171
|
+
role: "viewer"
|
|
129172
|
+
},
|
|
127741
129173
|
"switch.setState": {
|
|
127742
129174
|
capName: "switch",
|
|
127743
129175
|
capScope: "device",
|
|
@@ -127941,13 +129373,6 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
127941
129373
|
access: "create",
|
|
127942
129374
|
role: "admin"
|
|
127943
129375
|
},
|
|
127944
|
-
"terminalSession.adoptLegacyMonitor": {
|
|
127945
|
-
capName: "terminal-session",
|
|
127946
|
-
capScope: "system",
|
|
127947
|
-
addonId: null,
|
|
127948
|
-
access: "create",
|
|
127949
|
-
role: "admin"
|
|
127950
|
-
},
|
|
127951
129376
|
"terminalSession.close": {
|
|
127952
129377
|
capName: "terminal-session",
|
|
127953
129378
|
capScope: "system",
|
|
@@ -127955,13 +129380,6 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
127955
129380
|
access: "create",
|
|
127956
129381
|
role: "admin"
|
|
127957
129382
|
},
|
|
127958
|
-
"terminalSession.listLegacyCameras": {
|
|
127959
|
-
capName: "terminal-session",
|
|
127960
|
-
capScope: "system",
|
|
127961
|
-
addonId: null,
|
|
127962
|
-
access: "view",
|
|
127963
|
-
role: "admin"
|
|
127964
|
-
},
|
|
127965
129383
|
"terminalSession.listProfiles": {
|
|
127966
129384
|
capName: "terminal-session",
|
|
127967
129385
|
capScope: "system",
|
|
@@ -128823,6 +130241,62 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
128823
130241
|
access: "view",
|
|
128824
130242
|
role: "viewer"
|
|
128825
130243
|
},
|
|
130244
|
+
"workload.forceStop": {
|
|
130245
|
+
capName: "workload",
|
|
130246
|
+
capScope: "device",
|
|
130247
|
+
addonId: null,
|
|
130248
|
+
access: "create",
|
|
130249
|
+
role: "admin"
|
|
130250
|
+
},
|
|
130251
|
+
"workload.getOptions": {
|
|
130252
|
+
capName: "workload",
|
|
130253
|
+
capScope: "device",
|
|
130254
|
+
addonId: null,
|
|
130255
|
+
access: "view",
|
|
130256
|
+
role: "viewer"
|
|
130257
|
+
},
|
|
130258
|
+
"workload.getStatus": {
|
|
130259
|
+
capName: "workload",
|
|
130260
|
+
capScope: "device",
|
|
130261
|
+
addonId: null,
|
|
130262
|
+
access: "view",
|
|
130263
|
+
role: "viewer"
|
|
130264
|
+
},
|
|
130265
|
+
"workload.pause": {
|
|
130266
|
+
capName: "workload",
|
|
130267
|
+
capScope: "device",
|
|
130268
|
+
addonId: null,
|
|
130269
|
+
access: "create",
|
|
130270
|
+
role: "viewer"
|
|
130271
|
+
},
|
|
130272
|
+
"workload.restart": {
|
|
130273
|
+
capName: "workload",
|
|
130274
|
+
capScope: "device",
|
|
130275
|
+
addonId: null,
|
|
130276
|
+
access: "create",
|
|
130277
|
+
role: "viewer"
|
|
130278
|
+
},
|
|
130279
|
+
"workload.resume": {
|
|
130280
|
+
capName: "workload",
|
|
130281
|
+
capScope: "device",
|
|
130282
|
+
addonId: null,
|
|
130283
|
+
access: "create",
|
|
130284
|
+
role: "viewer"
|
|
130285
|
+
},
|
|
130286
|
+
"workload.start": {
|
|
130287
|
+
capName: "workload",
|
|
130288
|
+
capScope: "device",
|
|
130289
|
+
addonId: null,
|
|
130290
|
+
access: "create",
|
|
130291
|
+
role: "viewer"
|
|
130292
|
+
},
|
|
130293
|
+
"workload.stop": {
|
|
130294
|
+
capName: "workload",
|
|
130295
|
+
capScope: "device",
|
|
130296
|
+
addonId: null,
|
|
130297
|
+
access: "create",
|
|
130298
|
+
role: "viewer"
|
|
130299
|
+
},
|
|
128826
130300
|
"zoneAnalytics.getCameraHistory": {
|
|
128827
130301
|
capName: "zone-analytics",
|
|
128828
130302
|
capScope: "device",
|
|
@@ -129110,6 +130584,7 @@ var KNOWN_CAP_NAMES = [
|
|
|
129110
130584
|
"weather",
|
|
129111
130585
|
"weather-station",
|
|
129112
130586
|
"webrtc-session",
|
|
130587
|
+
"workload",
|
|
129113
130588
|
"zone-analytics",
|
|
129114
130589
|
"zone-rules",
|
|
129115
130590
|
"zones"
|
|
@@ -129221,6 +130696,7 @@ var DEVICE_CAP_NAMES = [
|
|
|
129221
130696
|
"weather",
|
|
129222
130697
|
"weather-station",
|
|
129223
130698
|
"webrtc-session",
|
|
130699
|
+
"workload",
|
|
129224
130700
|
"zone-analytics",
|
|
129225
130701
|
"zone-rules",
|
|
129226
130702
|
"zones"
|
|
@@ -129434,7 +130910,8 @@ function resolveAction(cap, action, wordings) {
|
|
|
129434
130910
|
icon: w.icon ?? action.icon,
|
|
129435
130911
|
args: action.args ?? {},
|
|
129436
130912
|
openArgs: action.openArgs ?? [],
|
|
129437
|
-
access
|
|
130913
|
+
access,
|
|
130914
|
+
offeredWhen: action.offeredWhen ?? null
|
|
129438
130915
|
};
|
|
129439
130916
|
}
|
|
129440
130917
|
/**
|
|
@@ -129463,6 +130940,41 @@ function deviceOffersActions(bindings, actionIds, mode = "any", deviceType) {
|
|
|
129463
130940
|
const offered = new Set(actionsForDevice(bindings, deviceType).map((action) => action.id));
|
|
129464
130941
|
return mode === "all" ? actionIds.every((id) => offered.has(id)) : actionIds.some((id) => offered.has(id));
|
|
129465
130942
|
}
|
|
130943
|
+
var GATE_PENDING = { kind: "pending" };
|
|
130944
|
+
/**
|
|
130945
|
+
* A gate's answer from what its read returned: closed only when the answer is
|
|
130946
|
+
* an object whose `field` is `false`. A shape that is not an object is not an
|
|
130947
|
+
* answer — it reads as `failed` and keeps the action offered.
|
|
130948
|
+
*/
|
|
130949
|
+
function actionGateAnswerFrom(raw, gate) {
|
|
130950
|
+
if (typeof raw !== "object" || raw === null || Array.isArray(raw)) return { kind: "failed" };
|
|
130951
|
+
return {
|
|
130952
|
+
kind: "answered",
|
|
130953
|
+
open: Reflect.get(raw, gate.field) !== false
|
|
130954
|
+
};
|
|
130955
|
+
}
|
|
130956
|
+
/**
|
|
130957
|
+
* Whether one device is offered an action, given what it answered: withdrawn
|
|
130958
|
+
* when its `offeredWhen` read ANSWERED `false` (a switch that only reports has
|
|
130959
|
+
* no on/off), or when a dynamic list its arguments read ANSWERED empty (a
|
|
130960
|
+
* siren that counts no plays has nothing to sound N times). A read that failed
|
|
130961
|
+
* or is pending keeps it offered.
|
|
130962
|
+
*/
|
|
130963
|
+
function actionOfferedWith(action, answerOf, gateOf = () => GATE_PENDING) {
|
|
130964
|
+
if (action.offeredWhen !== null) {
|
|
130965
|
+
const gate = gateOf(action.cap, action.offeredWhen);
|
|
130966
|
+
if (gate.kind === "answered" && !gate.open) return false;
|
|
130967
|
+
}
|
|
130968
|
+
return action.openArgs.every((arg) => {
|
|
130969
|
+
if (arg.offer.kind !== "dynamic") return true;
|
|
130970
|
+
const answer = answerOf(action.cap, arg.offer);
|
|
130971
|
+
return answer.kind !== "answered" || answer.choiceCount > 0;
|
|
130972
|
+
});
|
|
130973
|
+
}
|
|
130974
|
+
/** One device's actions, minus those {@link actionOfferedWith} withdraws. */
|
|
130975
|
+
function offeredActionsWith(actions, answerOf, gateOf) {
|
|
130976
|
+
return actions.filter((action) => actionOfferedWith(action, answerOf, gateOf));
|
|
130977
|
+
}
|
|
129466
130978
|
function resolveEnumValue(v) {
|
|
129467
130979
|
const phrase = v.phrase ?? fill(BECOMES, {
|
|
129468
130980
|
en: { value: v.label.en },
|
|
@@ -129895,6 +131407,7 @@ var DEVICE_TYPE_ICON = {
|
|
|
129895
131407
|
[require_composed_stable_id.DeviceType.Climate]: "thermometer",
|
|
129896
131408
|
[require_composed_stable_id.DeviceType.HeatPump]: "flame",
|
|
129897
131409
|
[require_composed_stable_id.DeviceType.EnergySystem]: "solar-panel",
|
|
131410
|
+
[require_composed_stable_id.DeviceType.Workload]: "server",
|
|
129898
131411
|
[require_composed_stable_id.DeviceType.Button]: "circle-dot",
|
|
129899
131412
|
[require_composed_stable_id.DeviceType.EventEmitter]: "zap",
|
|
129900
131413
|
[require_composed_stable_id.DeviceType.Update]: "refresh-cw",
|
|
@@ -129949,6 +131462,7 @@ var DEVICE_ROLE_ICON = {
|
|
|
129949
131462
|
[require_composed_stable_id.DeviceRole.SwitchHeater]: "flame",
|
|
129950
131463
|
[require_composed_stable_id.DeviceRole.SwitchFan]: "fan",
|
|
129951
131464
|
[require_composed_stable_id.DeviceRole.SwitchLight]: "lightbulb",
|
|
131465
|
+
[require_composed_stable_id.DeviceRole.PoePort]: "ethernet-port",
|
|
129952
131466
|
[require_composed_stable_id.DeviceRole.ClimateAc]: "air-vent",
|
|
129953
131467
|
[require_composed_stable_id.DeviceRole.ClimateThermostat]: "thermometer",
|
|
129954
131468
|
[require_composed_stable_id.DeviceRole.ClimateFloor]: "waves",
|
|
@@ -129993,7 +131507,12 @@ var DEVICE_ROLE_ICON = {
|
|
|
129993
131507
|
[require_composed_stable_id.DeviceRole.MessagingNotifier]: "message-square",
|
|
129994
131508
|
[require_composed_stable_id.DeviceRole.EmailNotifier]: "mail",
|
|
129995
131509
|
[require_composed_stable_id.DeviceRole.GenericNotifier]: "bell",
|
|
129996
|
-
[require_composed_stable_id.DeviceRole.IrTransmitter]: "radio-tower"
|
|
131510
|
+
[require_composed_stable_id.DeviceRole.IrTransmitter]: "radio-tower",
|
|
131511
|
+
[require_composed_stable_id.DeviceRole.Vm]: "monitor",
|
|
131512
|
+
[require_composed_stable_id.DeviceRole.AppContainer]: "container",
|
|
131513
|
+
[require_composed_stable_id.DeviceRole.Lxc]: "box",
|
|
131514
|
+
[require_composed_stable_id.DeviceRole.App]: "app-window",
|
|
131515
|
+
[require_composed_stable_id.DeviceRole.Host]: "server"
|
|
129997
131516
|
};
|
|
129998
131517
|
var TYPE_VALUES = new Set(Object.values(require_composed_stable_id.DeviceType));
|
|
129999
131518
|
var ROLE_VALUES = new Set(Object.values(require_composed_stable_id.DeviceRole));
|
|
@@ -131343,7 +132862,8 @@ var CAP_NAMES_WITH_STATUS = [
|
|
|
131343
132862
|
"vibration",
|
|
131344
132863
|
"water-heater",
|
|
131345
132864
|
"weather",
|
|
131346
|
-
"weather-station"
|
|
132865
|
+
"weather-station",
|
|
132866
|
+
"workload"
|
|
131347
132867
|
];
|
|
131348
132868
|
//#endregion
|
|
131349
132869
|
//#region src/generated/method-device-selectors.ts
|
|
@@ -132046,6 +133566,11 @@ var METHOD_DEVICE_SELECTORS = Object.freeze({
|
|
|
132046
133566
|
form: "single",
|
|
132047
133567
|
optional: false
|
|
132048
133568
|
}],
|
|
133569
|
+
"deviceManager.setIdentifiers": [{
|
|
133570
|
+
name: "deviceId",
|
|
133571
|
+
form: "single",
|
|
133572
|
+
optional: false
|
|
133573
|
+
}],
|
|
132049
133574
|
"deviceManager.setIntegrationId": [{
|
|
132050
133575
|
name: "deviceId",
|
|
132051
133576
|
form: "single",
|
|
@@ -134040,6 +135565,11 @@ var METHOD_DEVICE_SELECTORS = Object.freeze({
|
|
|
134040
135565
|
form: "single",
|
|
134041
135566
|
optional: false
|
|
134042
135567
|
}],
|
|
135568
|
+
"siren.getPlayChoices": [{
|
|
135569
|
+
name: "deviceId",
|
|
135570
|
+
form: "single",
|
|
135571
|
+
optional: false
|
|
135572
|
+
}],
|
|
134043
135573
|
"siren.getStatus": [{
|
|
134044
135574
|
name: "deviceId",
|
|
134045
135575
|
form: "single",
|
|
@@ -134222,11 +135752,21 @@ var METHOD_DEVICE_SELECTORS = Object.freeze({
|
|
|
134222
135752
|
form: "single",
|
|
134223
135753
|
optional: false
|
|
134224
135754
|
}],
|
|
135755
|
+
"switch.getOptions": [{
|
|
135756
|
+
name: "deviceId",
|
|
135757
|
+
form: "single",
|
|
135758
|
+
optional: false
|
|
135759
|
+
}],
|
|
134225
135760
|
"switch.getStatus": [{
|
|
134226
135761
|
name: "deviceId",
|
|
134227
135762
|
form: "single",
|
|
134228
135763
|
optional: false
|
|
134229
135764
|
}],
|
|
135765
|
+
"switch.powerCycle": [{
|
|
135766
|
+
name: "deviceId",
|
|
135767
|
+
form: "single",
|
|
135768
|
+
optional: false
|
|
135769
|
+
}],
|
|
134230
135770
|
"switch.setState": [{
|
|
134231
135771
|
name: "deviceId",
|
|
134232
135772
|
form: "single",
|
|
@@ -134467,6 +136007,46 @@ var METHOD_DEVICE_SELECTORS = Object.freeze({
|
|
|
134467
136007
|
form: "single",
|
|
134468
136008
|
optional: false
|
|
134469
136009
|
}],
|
|
136010
|
+
"workload.forceStop": [{
|
|
136011
|
+
name: "deviceId",
|
|
136012
|
+
form: "single",
|
|
136013
|
+
optional: false
|
|
136014
|
+
}],
|
|
136015
|
+
"workload.getOptions": [{
|
|
136016
|
+
name: "deviceId",
|
|
136017
|
+
form: "single",
|
|
136018
|
+
optional: false
|
|
136019
|
+
}],
|
|
136020
|
+
"workload.getStatus": [{
|
|
136021
|
+
name: "deviceId",
|
|
136022
|
+
form: "single",
|
|
136023
|
+
optional: false
|
|
136024
|
+
}],
|
|
136025
|
+
"workload.pause": [{
|
|
136026
|
+
name: "deviceId",
|
|
136027
|
+
form: "single",
|
|
136028
|
+
optional: false
|
|
136029
|
+
}],
|
|
136030
|
+
"workload.restart": [{
|
|
136031
|
+
name: "deviceId",
|
|
136032
|
+
form: "single",
|
|
136033
|
+
optional: false
|
|
136034
|
+
}],
|
|
136035
|
+
"workload.resume": [{
|
|
136036
|
+
name: "deviceId",
|
|
136037
|
+
form: "single",
|
|
136038
|
+
optional: false
|
|
136039
|
+
}],
|
|
136040
|
+
"workload.start": [{
|
|
136041
|
+
name: "deviceId",
|
|
136042
|
+
form: "single",
|
|
136043
|
+
optional: false
|
|
136044
|
+
}],
|
|
136045
|
+
"workload.stop": [{
|
|
136046
|
+
name: "deviceId",
|
|
136047
|
+
form: "single",
|
|
136048
|
+
optional: false
|
|
136049
|
+
}],
|
|
134470
136050
|
"zoneAnalytics.getCameraHistory": [{
|
|
134471
136051
|
name: "deviceId",
|
|
134472
136052
|
form: "single",
|
|
@@ -134585,6 +136165,7 @@ var SYSTEM_SCOPE_DEVICE_METHODS = [
|
|
|
134585
136165
|
"deviceManager.setChildLayout",
|
|
134586
136166
|
"deviceManager.setDisabled",
|
|
134587
136167
|
"deviceManager.setDisplay",
|
|
136168
|
+
"deviceManager.setIdentifiers",
|
|
134588
136169
|
"deviceManager.setIntegrationId",
|
|
134589
136170
|
"deviceManager.setLinkDeviceId",
|
|
134590
136171
|
"deviceManager.setLocation",
|
|
@@ -134761,7 +136342,7 @@ function getCapsByProviderKind(kind) {
|
|
|
134761
136342
|
//#region src/generated/runtime-state-durability.ts
|
|
134762
136343
|
/**
|
|
134763
136344
|
* Per-cap runtime-state policy, projected from every `*.cap.ts` that declares
|
|
134764
|
-
* `runtimeState`.
|
|
136345
|
+
* `runtimeState`. 87 caps: 43 `restored`, 44 `session`.
|
|
134765
136346
|
*
|
|
134766
136347
|
* A cap absent from this map has no runtime-state slice at all. A cap PRESENT
|
|
134767
136348
|
* with `durability: 'session'` has one and has decided not to keep it.
|
|
@@ -135101,6 +136682,10 @@ var RUNTIME_STATE_POLICY = {
|
|
|
135101
136682
|
durability: "session",
|
|
135102
136683
|
volatileFields: ["lastFetchedAt"]
|
|
135103
136684
|
},
|
|
136685
|
+
"workload": {
|
|
136686
|
+
durability: "session",
|
|
136687
|
+
volatileFields: ["lastFetchedAt"]
|
|
136688
|
+
},
|
|
135104
136689
|
"zone-analytics": {
|
|
135105
136690
|
durability: "session",
|
|
135106
136691
|
volatileFields: []
|
|
@@ -136207,6 +137792,8 @@ function createSystemProxy(api) {
|
|
|
136207
137792
|
updateRule: (input) => dispatch("notificationRules", "updateRule", "mutation", input),
|
|
136208
137793
|
deleteRule: (input) => dispatch("notificationRules", "deleteRule", "mutation", input),
|
|
136209
137794
|
setRuleEnabled: (input) => dispatch("notificationRules", "setRuleEnabled", "mutation", input),
|
|
137795
|
+
listRuleTags: (input) => dispatch("notificationRules", "listRuleTags", "query", input),
|
|
137796
|
+
setRuleTags: (input) => dispatch("notificationRules", "setRuleTags", "mutation", input),
|
|
136210
137797
|
getClipRetentionAsks: (input) => dispatch("notificationRules", "getClipRetentionAsks", "query", input),
|
|
136211
137798
|
listDeviceMutes: (input) => dispatch("notificationRules", "listDeviceMutes", "query", input),
|
|
136212
137799
|
testRule: (input) => dispatch("notificationRules", "testRule", "mutation", input),
|
|
@@ -136526,8 +138113,6 @@ function createSystemProxy(api) {
|
|
|
136526
138113
|
},
|
|
136527
138114
|
terminalSession: {
|
|
136528
138115
|
listProfiles: (input) => dispatch("terminalSession", "listProfiles", "query", input),
|
|
136529
|
-
listLegacyCameras: (input) => dispatch("terminalSession", "listLegacyCameras", "query", input),
|
|
136530
|
-
adoptLegacyMonitor: (input) => dispatch("terminalSession", "adoptLegacyMonitor", "mutation", input),
|
|
136531
138116
|
listSessions: (input) => dispatch("terminalSession", "listSessions", "query", input),
|
|
136532
138117
|
serverShellStatus: (input) => dispatch("terminalSession", "serverShellStatus", "query", input),
|
|
136533
138118
|
openSession: (input) => dispatch("terminalSession", "openSession", "mutation", input),
|
|
@@ -142781,6 +144366,8 @@ var TimelapseRuleInputSchema = zod.z.object({
|
|
|
142781
144366
|
/** Canonical notification priority ordinal (1..5); per-target overridable. */
|
|
142782
144367
|
priority: PriorityField.default(3),
|
|
142783
144368
|
/** Per-target settings keyed by target id (D1032) — absent = every target follows the rule. */
|
|
144369
|
+
/** Operator labels (D1054) — optional and NEVER defaulted: an absent key leaves the stored tags alone; `[]` clears them. Admin-only. */
|
|
144370
|
+
tags: TagsFieldSchema.optional(),
|
|
142784
144371
|
targetOverrides: NcTargetOverridesSchema.optional()
|
|
142785
144372
|
});
|
|
142786
144373
|
/**
|
|
@@ -142823,6 +144410,8 @@ var TimelapseRulePatchSchema = zod.z.object({
|
|
|
142823
144410
|
reportClasses: ReportClassesField.optional(),
|
|
142824
144411
|
priority: PriorityField.optional(),
|
|
142825
144412
|
/** Per-target settings keyed by target id (D1032) — absent = every target follows the rule. */
|
|
144413
|
+
/** Absent = keep the stored tags; `[]` clears them (D1054). Never defaulted. */
|
|
144414
|
+
tags: TagsFieldSchema.optional(),
|
|
142826
144415
|
targetOverrides: NcTargetOverridesSchema.optional()
|
|
142827
144416
|
});
|
|
142828
144417
|
/** A persisted timelapse rule. */
|
|
@@ -149092,6 +150681,7 @@ exports.CAPABILITY_NAMES = CAPABILITY_NAMES;
|
|
|
149092
150681
|
exports.CAPABILITY_ROUTER_KEYS = CAPABILITY_ROUTER_KEYS;
|
|
149093
150682
|
exports.CAP_COMMAND_ORIGIN_CONTEXT_KEY = require_sleep.CAP_COMMAND_ORIGIN_CONTEXT_KEY;
|
|
149094
150683
|
exports.CAP_CUSTOMIZE_CATALOG = CAP_CUSTOMIZE_CATALOG;
|
|
150684
|
+
exports.CAP_METHOD_NOT_IMPLEMENTED = require_sleep.CAP_METHOD_NOT_IMPLEMENTED;
|
|
149095
150685
|
exports.CAP_NAMES_WITH_STATUS = CAP_NAMES_WITH_STATUS;
|
|
149096
150686
|
exports.CAP_NODE_PIN_CONTEXT_KEY = require_sleep.CAP_NODE_PIN_CONTEXT_KEY;
|
|
149097
150687
|
exports.CAP_PROVIDER_KIND_MAP = CAP_PROVIDER_KIND_MAP;
|
|
@@ -149375,6 +150965,8 @@ exports.DEFAULT_EVENTS_BAND_BUFFER_SEC = DEFAULT_EVENTS_BAND_BUFFER_SEC;
|
|
|
149375
150965
|
exports.DEFAULT_EVENT_COLOR = DEFAULT_EVENT_COLOR;
|
|
149376
150966
|
exports.DEFAULT_FEATURES = DEFAULT_FEATURES;
|
|
149377
150967
|
exports.DEFAULT_FIRST_SIGHTING_FRESHNESS_MS = require_implemented_methods.DEFAULT_FIRST_SIGHTING_FRESHNESS_MS;
|
|
150968
|
+
exports.DEFAULT_GRID_FPS = require_implemented_methods.DEFAULT_GRID_FPS;
|
|
150969
|
+
exports.DEFAULT_GRID_PROFILES = require_implemented_methods.DEFAULT_GRID_PROFILES;
|
|
149378
150970
|
exports.DEFAULT_HEADROOM = DEFAULT_HEADROOM;
|
|
149379
150971
|
exports.DEFAULT_HISTORY_RETENTION = require_implemented_methods.DEFAULT_HISTORY_RETENTION;
|
|
149380
150972
|
exports.DEFAULT_HOLD_OVERRIDE = DEFAULT_HOLD_OVERRIDE;
|
|
@@ -149423,6 +151015,7 @@ exports.DEVICE_HISTORY_ENERGY_KEY = DEVICE_HISTORY_ENERGY_KEY;
|
|
|
149423
151015
|
exports.DEVICE_HISTORY_ORPHAN_DELETE_MAX = DEVICE_HISTORY_ORPHAN_DELETE_MAX;
|
|
149424
151016
|
exports.DEVICE_HISTORY_ORPHAN_LIST_MAX = DEVICE_HISTORY_ORPHAN_LIST_MAX;
|
|
149425
151017
|
exports.DEVICE_HISTORY_QUERY_MANY_MAX_ITEMS = DEVICE_HISTORY_QUERY_MANY_MAX_ITEMS;
|
|
151018
|
+
exports.DEVICE_IDENTIFIER_KEYS = DEVICE_IDENTIFIER_KEYS;
|
|
149426
151019
|
exports.DEVICE_ID_FIELD = DEVICE_ID_FIELD;
|
|
149427
151020
|
exports.DEVICE_NONCE_TTL_MS = DEVICE_NONCE_TTL_MS;
|
|
149428
151021
|
exports.DEVICE_PROFILES = DEVICE_PROFILES;
|
|
@@ -149528,6 +151121,10 @@ exports.DeviceHistoryRefusalReasonSchema = DeviceHistoryRefusalReasonSchema;
|
|
|
149528
151121
|
exports.DeviceHistoryResolutionSchema = DeviceHistoryResolutionSchema;
|
|
149529
151122
|
exports.DeviceHistoryStatusSchema = DeviceHistoryStatusSchema;
|
|
149530
151123
|
exports.DeviceHistorySubjectSchema = DeviceHistorySubjectSchema;
|
|
151124
|
+
exports.DeviceIdentifierEntrySchema = DeviceIdentifierEntrySchema;
|
|
151125
|
+
exports.DeviceIdentifierKeySchema = DeviceIdentifierKeySchema;
|
|
151126
|
+
exports.DeviceIdentifierOriginSchema = DeviceIdentifierOriginSchema;
|
|
151127
|
+
exports.DeviceIdentifiersSchema = DeviceIdentifiersSchema;
|
|
149531
151128
|
exports.DeviceInfoSchema = DeviceInfoSchema;
|
|
149532
151129
|
exports.DeviceModelChoiceSchema = DeviceModelChoiceSchema;
|
|
149533
151130
|
exports.DeviceNetworkStatsSchema = DeviceNetworkStatsSchema;
|
|
@@ -149608,6 +151205,7 @@ exports.EMBEDDING_REQUIREMENTS_UNAVAILABLE = EMBEDDING_REQUIREMENTS_UNAVAILABLE;
|
|
|
149608
151205
|
exports.EMPTY_AUTOMATION_STATE = EMPTY_AUTOMATION_STATE;
|
|
149609
151206
|
exports.EMPTY_REMOTE_ASSUMED_STATE = EMPTY_REMOTE_ASSUMED_STATE;
|
|
149610
151207
|
exports.EMPTY_REMOTE_CONFIG = EMPTY_REMOTE_CONFIG;
|
|
151208
|
+
exports.ENGINE_HOSTED_HELPER_KINDS = require_implemented_methods.ENGINE_HOSTED_HELPER_KINDS;
|
|
149611
151209
|
exports.ERROR_STATUS_COLD = ERROR_STATUS_COLD;
|
|
149612
151210
|
exports.ESTIMATE_COMPUTE_RATIO_MAX = ESTIMATE_COMPUTE_RATIO_MAX;
|
|
149613
151211
|
exports.ESTIMATE_COMPUTE_RATIO_MIN = ESTIMATE_COMPUTE_RATIO_MIN;
|
|
@@ -149792,14 +151390,18 @@ exports.FrameLazyCountersSchema = FrameLazyCountersSchema;
|
|
|
149792
151390
|
exports.FrameLazyMetricsSchema = FrameLazyMetricsSchema;
|
|
149793
151391
|
exports.G711_SCALE_CORRECTION_DB = G711_SCALE_CORRECTION_DB;
|
|
149794
151392
|
exports.GRAMMAR_MAX_LINES = GRAMMAR_MAX_LINES;
|
|
151393
|
+
exports.GRID_PROFILES = require_implemented_methods.GRID_PROFILES;
|
|
149795
151394
|
exports.GROUP_TEMPLATES = GROUP_TEMPLATES;
|
|
149796
151395
|
exports.GROUP_TEMPLATE_IDS = require_implemented_methods.GROUP_TEMPLATE_IDS;
|
|
149797
151396
|
exports.GasStatusSchema = GasStatusSchema;
|
|
149798
151397
|
exports.GetLoggingSettingsInputSchema = GetLoggingSettingsInputSchema;
|
|
149799
151398
|
exports.GetStreamWithCodecInputSchema = GetStreamWithCodecInputSchema;
|
|
149800
151399
|
exports.GlobalMetricsSchema = GlobalMetricsSchema;
|
|
151400
|
+
exports.GridCellSpecSchema = require_implemented_methods.GridCellSpecSchema;
|
|
151401
|
+
exports.GridHelperSpecSchema = require_implemented_methods.GridHelperSpecSchema;
|
|
149801
151402
|
exports.GridLayoutPatchSchema = GridLayoutPatchSchema;
|
|
149802
151403
|
exports.GridLayoutViewSchema = GridLayoutViewSchema;
|
|
151404
|
+
exports.GridRectSchema = require_implemented_methods.GridRectSchema;
|
|
149803
151405
|
exports.GroupActiveSchema = GroupActiveSchema;
|
|
149804
151406
|
exports.GroupCommandResultSchema = GroupCommandResultSchema;
|
|
149805
151407
|
exports.GroupCommandsSchema = GroupCommandsSchema;
|
|
@@ -149892,6 +151494,7 @@ exports.HoldSpecSchema = HoldSpecSchema;
|
|
|
149892
151494
|
exports.HoldTargetStatusSchema = HoldTargetStatusSchema;
|
|
149893
151495
|
exports.HoldTraceSchema = HoldTraceSchema;
|
|
149894
151496
|
exports.HoldTracker = HoldTracker;
|
|
151497
|
+
exports.HostedWithdrawalGate = HostedWithdrawalGate;
|
|
149895
151498
|
exports.HttpsLeafInfoSchema = HttpsLeafInfoSchema;
|
|
149896
151499
|
exports.HubAddressRoleSchema = HubAddressRoleSchema;
|
|
149897
151500
|
exports.HumidifierStatusSchema = HumidifierStatusSchema;
|
|
@@ -150107,6 +151710,7 @@ exports.MAX_EXPRESSION_BINDINGS = require_implemented_methods.MAX_EXPRESSION_BIN
|
|
|
150107
151710
|
exports.MAX_EXPRESSION_CALL_ARGS = require_implemented_methods.MAX_EXPRESSION_CALL_ARGS;
|
|
150108
151711
|
exports.MAX_EXPRESSION_EVAL_STEPS = require_implemented_methods.MAX_EXPRESSION_EVAL_STEPS;
|
|
150109
151712
|
exports.MAX_EXPRESSION_SOURCE_LENGTH = require_implemented_methods.MAX_EXPRESSION_SOURCE_LENGTH;
|
|
151713
|
+
exports.MAX_GRID_CELLS = require_implemented_methods.MAX_GRID_CELLS;
|
|
150110
151714
|
exports.MAX_HELPER_MEMBERS = require_implemented_methods.MAX_HELPER_MEMBERS;
|
|
150111
151715
|
exports.MAX_HOLD_ATTEMPTS_LIMIT = MAX_HOLD_ATTEMPTS_LIMIT;
|
|
150112
151716
|
exports.MAX_KEYS = MAX_KEYS;
|
|
@@ -150441,6 +152045,7 @@ exports.NcRuleLastRunsSchema = NcRuleLastRunsSchema;
|
|
|
150441
152045
|
exports.NcRuleNotificationButtonSchema = NcRuleNotificationButtonSchema;
|
|
150442
152046
|
exports.NcRulePatchSchema = NcRulePatchSchema;
|
|
150443
152047
|
exports.NcRuleSchema = NcRuleSchema;
|
|
152048
|
+
exports.NcRuleTagsEntrySchema = NcRuleTagsEntrySchema;
|
|
150444
152049
|
exports.NcRuleTargetSchema = NcRuleTargetSchema;
|
|
150445
152050
|
exports.NcRuleUpdateInputSchema = NcRuleUpdateInputSchema;
|
|
150446
152051
|
exports.NcSceneConditionSchema = NcSceneConditionSchema;
|
|
@@ -150461,6 +152066,7 @@ exports.NcSystemEventDeliveryModeSchema = NcSystemEventDeliveryModeSchema;
|
|
|
150461
152066
|
exports.NcSystemEventDeliverySchema = NcSystemEventDeliverySchema;
|
|
150462
152067
|
exports.NcSystemEventDeliveryToggleSchema = NcSystemEventDeliveryToggleSchema;
|
|
150463
152068
|
exports.NcSystemEventKindSchema = NcSystemEventKindSchema;
|
|
152069
|
+
exports.NcTaggedRuleKindSchema = NcTaggedRuleKindSchema;
|
|
150464
152070
|
exports.NcTargetAttachmentSchema = NcTargetAttachmentSchema;
|
|
150465
152071
|
exports.NcTargetOverrideSchema = NcTargetOverrideSchema;
|
|
150466
152072
|
exports.NcTargetOverridesSchema = NcTargetOverridesSchema;
|
|
@@ -151066,6 +152672,8 @@ exports.SUBJECT_PATH_FULL_FRAME_COVERAGE = SUBJECT_PATH_FULL_FRAME_COVERAGE;
|
|
|
151066
152672
|
exports.SUBJECT_PATH_MAX_POINTS = SUBJECT_PATH_MAX_POINTS;
|
|
151067
152673
|
exports.SUB_DETECTION_TYPES = SUB_DETECTION_TYPES;
|
|
151068
152674
|
exports.SUNRISE_ALTITUDE_DEG = SUNRISE_ALTITUDE_DEG;
|
|
152675
|
+
exports.SWITCH_DEFAULT_OPTIONS = SWITCH_DEFAULT_OPTIONS;
|
|
152676
|
+
exports.SWITCH_SETTABLE_GATE = require_sleep.SWITCH_SETTABLE_GATE;
|
|
151069
152677
|
exports.SYSTEM_CAP_NAMES = SYSTEM_CAP_NAMES;
|
|
151070
152678
|
exports.SYSTEM_SCOPE_DEVICE_METHODS = SYSTEM_SCOPE_DEVICE_METHODS;
|
|
151071
152679
|
exports.SceneCheckSchema = SceneCheckSchema;
|
|
@@ -151135,6 +152743,7 @@ exports.SirenOptionsSchema = SirenOptionsSchema;
|
|
|
151135
152743
|
exports.SirenOptionsSource = SirenOptionsSource;
|
|
151136
152744
|
exports.SirenRuntimeStateSchema = SirenRuntimeStateSchema;
|
|
151137
152745
|
exports.SirenStatusSchema = SirenStatusSchema;
|
|
152746
|
+
exports.SirenTriggerInputSchema = SirenTriggerInputSchema;
|
|
151138
152747
|
exports.SiteLocationSchema = SiteLocationSchema;
|
|
151139
152748
|
exports.SiteLocationSourceSchema = SiteLocationSourceSchema;
|
|
151140
152749
|
exports.SiteLocationStatusSchema = SiteLocationStatusSchema;
|
|
@@ -151234,6 +152843,7 @@ exports.SuggestedDeviceShareSchema = SuggestedDeviceShareSchema;
|
|
|
151234
152843
|
exports.SuggestedNodeShareSchema = SuggestedNodeShareSchema;
|
|
151235
152844
|
exports.SunEventSchema = SunEventSchema;
|
|
151236
152845
|
exports.SuppliedRootOutputSchema = SuppliedRootOutputSchema;
|
|
152846
|
+
exports.SwitchOptionsSchema = SwitchOptionsSchema;
|
|
151237
152847
|
exports.SwitchStatusSchema = SwitchStatusSchema;
|
|
151238
152848
|
exports.SystemHeldSecretNameSchema = SystemHeldSecretNameSchema;
|
|
151239
152849
|
exports.SystemMetricsSchema = SystemMetricsSchema;
|
|
@@ -151264,6 +152874,7 @@ exports.TRANSCODE_DOWN_MAX_HEIGHT = TRANSCODE_DOWN_MAX_HEIGHT;
|
|
|
151264
152874
|
exports.TRIGGERED_BY_MAX_IDS = TRIGGERED_BY_MAX_IDS;
|
|
151265
152875
|
exports.TagColorIdSchema = TagColorIdSchema;
|
|
151266
152876
|
exports.TagEntrySchema = TagEntrySchema;
|
|
152877
|
+
exports.TagListCountsSchema = TagListCountsSchema;
|
|
151267
152878
|
exports.TagNameSchema = TagNameSchema;
|
|
151268
152879
|
exports.TagStyleSchema = TagStyleSchema;
|
|
151269
152880
|
exports.TagUsageCountsSchema = TagUsageCountsSchema;
|
|
@@ -151309,8 +152920,7 @@ exports.TemplateTimeWindowValueSchema = TemplateTimeWindowValueSchema;
|
|
|
151309
152920
|
exports.TemplateUserSchema = TemplateUserSchema;
|
|
151310
152921
|
exports.TemplateValueBindingSchema = TemplateValueBindingSchema;
|
|
151311
152922
|
exports.TemplateWriteResultSchema = TemplateWriteResultSchema;
|
|
151312
|
-
exports.
|
|
151313
|
-
exports.TerminalLegacyCameraSchema = TerminalLegacyCameraSchema;
|
|
152923
|
+
exports.TerminalHelperSpecSchema = require_implemented_methods.TerminalHelperSpecSchema;
|
|
151314
152924
|
exports.TerminalOutputBatchSchema = TerminalOutputBatchSchema;
|
|
151315
152925
|
exports.TerminalOutputEventSchema = TerminalOutputEventSchema;
|
|
151316
152926
|
exports.TerminalProfileInfoSchema = TerminalProfileInfoSchema;
|
|
@@ -151474,6 +153084,10 @@ exports.WEEKLY_MASK_LENGTH = WEEKLY_MASK_LENGTH;
|
|
|
151474
153084
|
exports.WELL_KNOWN_TABS = require_sleep.WELL_KNOWN_TABS;
|
|
151475
153085
|
exports.WELL_KNOWN_TAB_MAP = require_sleep.WELL_KNOWN_TAB_MAP;
|
|
151476
153086
|
exports.WHEN_UNROLL_DEPTH = WHEN_UNROLL_DEPTH;
|
|
153087
|
+
exports.WORKLOAD_ACTIONS = WORKLOAD_ACTIONS;
|
|
153088
|
+
exports.WORKLOAD_ROLES = WORKLOAD_ROLES;
|
|
153089
|
+
exports.WORKLOAD_STATES = WORKLOAD_STATES;
|
|
153090
|
+
exports.WORKLOAD_TRANSITION_CATEGORY = WORKLOAD_TRANSITION_CATEGORY;
|
|
151477
153091
|
exports.WaterHeaterStatusSchema = WaterHeaterStatusSchema;
|
|
151478
153092
|
exports.WeatherStationStatusSchema = WeatherStationStatusSchema;
|
|
151479
153093
|
exports.WeatherStatusSchema = WeatherStatusSchema;
|
|
@@ -151490,6 +153104,12 @@ exports.WidgetLoginMethodSchema = WidgetLoginMethodSchema;
|
|
|
151490
153104
|
exports.WidgetMetadataSchema = WidgetMetadataSchema;
|
|
151491
153105
|
exports.WidgetRemoteSchema = WidgetRemoteSchema;
|
|
151492
153106
|
exports.WidgetSizeEnum = WidgetSizeEnum;
|
|
153107
|
+
exports.WorkloadOptionsSchema = WorkloadOptionsSchema;
|
|
153108
|
+
exports.WorkloadPortProtocolSchema = WorkloadPortProtocolSchema;
|
|
153109
|
+
exports.WorkloadPortSchema = WorkloadPortSchema;
|
|
153110
|
+
exports.WorkloadResourcesSchema = WorkloadResourcesSchema;
|
|
153111
|
+
exports.WorkloadStateSchema = WorkloadStateSchema;
|
|
153112
|
+
exports.WorkloadStatusSchema = WorkloadStatusSchema;
|
|
151493
153113
|
exports.WrapperActivationReadSchema = WrapperActivationReadSchema;
|
|
151494
153114
|
exports.WrapperEvidenceSchema = WrapperEvidenceSchema;
|
|
151495
153115
|
exports.WrapperIdentitySchema = WrapperIdentitySchema;
|
|
@@ -151512,6 +153132,8 @@ exports.accessoryChildrenComplete = accessoryChildrenComplete;
|
|
|
151512
153132
|
exports.accessoryChildrenUnknown = accessoryChildrenUnknown;
|
|
151513
153133
|
exports.accessoryStableId = accessoryStableId;
|
|
151514
153134
|
exports.actionEffect = require_sleep.actionEffect;
|
|
153135
|
+
exports.actionGateAnswerFrom = actionGateAnswerFrom;
|
|
153136
|
+
exports.actionOfferedWith = actionOfferedWith;
|
|
151515
153137
|
exports.actionSourceCapability = actionSourceCapability;
|
|
151516
153138
|
exports.actionWaitTotalMs = actionWaitTotalMs;
|
|
151517
153139
|
exports.actionsCapability = actionsCapability;
|
|
@@ -151817,6 +153439,7 @@ exports.dayNightCapability = dayNightCapability;
|
|
|
151817
153439
|
exports.dayOfWeekToIndex = dayOfWeekToIndex;
|
|
151818
153440
|
exports.declarationOwnerNodeId = declarationOwnerNodeId;
|
|
151819
153441
|
exports.declarationsOf = require_sleep.declarationsOf;
|
|
153442
|
+
exports.declareDeviceIdentifiers = declareDeviceIdentifiers;
|
|
151820
153443
|
exports.declareLinkKind = declareLinkKind;
|
|
151821
153444
|
exports.declareLogChannel = declareLogChannel;
|
|
151822
153445
|
exports.declaredSeriesKind = declaredSeriesKind;
|
|
@@ -151862,6 +153485,7 @@ exports.derivePostTriggeredAction = derivePostTriggeredAction;
|
|
|
151862
153485
|
exports.deriveRecordingMode = deriveRecordingMode;
|
|
151863
153486
|
exports.deriveRootFaceRefineRect = deriveRootFaceRefineRect;
|
|
151864
153487
|
exports.deriveRootSupplies = deriveRootSupplies;
|
|
153488
|
+
exports.deriveWorkloadControls = deriveWorkloadControls;
|
|
151865
153489
|
exports.describeComposableCaps = describeComposableCaps;
|
|
151866
153490
|
exports.describeCustomActions = require_sleep.describeCustomActions;
|
|
151867
153491
|
exports.describeHold = describeHold;
|
|
@@ -152098,6 +153722,7 @@ exports.heatPumpControlCapability = heatPumpControlCapability;
|
|
|
152098
153722
|
exports.heatPumpInstantCop = heatPumpInstantCop;
|
|
152099
153723
|
exports.heatPumpStatusCapability = heatPumpStatusCapability;
|
|
152100
153724
|
exports.heatingValveCapability = heatingValveCapability;
|
|
153725
|
+
exports.helperDeviceRefs = require_implemented_methods.helperDeviceRefs;
|
|
152101
153726
|
exports.helperMembers = require_implemented_methods.helperMembers;
|
|
152102
153727
|
exports.helperSaveProblems = helperSaveProblems;
|
|
152103
153728
|
exports.heroArgsWithValue = heroArgsWithValue;
|
|
@@ -152111,6 +153736,7 @@ exports.historyUnitFor = require_sleep.historyUnitFor;
|
|
|
152111
153736
|
exports.holdOf = holdOf;
|
|
152112
153737
|
exports.holdRefusalOf = holdRefusalOf;
|
|
152113
153738
|
exports.holdVarSlots = holdVarSlots;
|
|
153739
|
+
exports.hostEngineDevice = hostEngineDevice;
|
|
152114
153740
|
exports.htmlToText = htmlToText;
|
|
152115
153741
|
exports.hubAddressHostname = hubAddressHostname;
|
|
152116
153742
|
exports.hubMotionNativeProvider = hubMotionNativeProvider;
|
|
@@ -152122,6 +153748,7 @@ exports.iconCategoryLabel = iconCategoryLabel;
|
|
|
152122
153748
|
exports.iconEntry = iconEntry;
|
|
152123
153749
|
exports.iconsInCategory = iconsInCategory;
|
|
152124
153750
|
exports.identifiedEventLeaves = identifiedEventLeaves;
|
|
153751
|
+
exports.identifierStrength = identifierStrength;
|
|
152125
153752
|
exports.imageCapability = imageCapability;
|
|
152126
153753
|
exports.imageModesForKind = imageModesForKind;
|
|
152127
153754
|
exports.imageSettingsCapability = imageSettingsCapability;
|
|
@@ -152178,6 +153805,7 @@ exports.isAutomaticShareSource = isAutomaticShareSource;
|
|
|
152178
153805
|
exports.isBaseConditionKey = isBaseConditionKey;
|
|
152179
153806
|
exports.isBatteryPresenceFault = isBatteryPresenceFault;
|
|
152180
153807
|
exports.isBuiltinTemplateId = isBuiltinTemplateId;
|
|
153808
|
+
exports.isCapMethodAbsent = require_sleep.isCapMethodAbsent;
|
|
152181
153809
|
exports.isClusterScopedStep = isClusterScopedStep;
|
|
152182
153810
|
exports.isCollectionArrayMethod = isCollectionArrayMethod;
|
|
152183
153811
|
exports.isCommand = require_sleep.isCommand;
|
|
@@ -152193,6 +153821,8 @@ exports.isDeviceScopedCap = require_sleep.isDeviceScopedCap;
|
|
|
152193
153821
|
exports.isDoPickerDeviceType = isDoPickerDeviceType;
|
|
152194
153822
|
exports.isDrawableSubjectPath = isDrawableSubjectPath;
|
|
152195
153823
|
exports.isEmbeddingModelFailed = isEmbeddingModelFailed;
|
|
153824
|
+
exports.isEmptyIdentifiers = isEmptyIdentifiers;
|
|
153825
|
+
exports.isEngineHostedHelper = require_implemented_methods.isEngineHostedHelper;
|
|
152196
153826
|
exports.isEvent = require_sleep.isEvent;
|
|
152197
153827
|
exports.isEventKindLabelKey = isEventKindLabelKey;
|
|
152198
153828
|
exports.isEventLeaf = isEventLeaf;
|
|
@@ -152267,6 +153897,7 @@ exports.isUnfilledRequiredProblem = isUnfilledRequiredProblem;
|
|
|
152267
153897
|
exports.isUsableTimeZone = isUsableTimeZone;
|
|
152268
153898
|
exports.isVectorIndexDimConflict = isVectorIndexDimConflict;
|
|
152269
153899
|
exports.isVoidInput = isVoidInput;
|
|
153900
|
+
exports.isWorkloadSettled = isWorkloadSettled;
|
|
152270
153901
|
exports.isZodSecret = require_sleep.isZodSecret;
|
|
152271
153902
|
exports.ituDbfsFromPreEpoch = ituDbfsFromPreEpoch;
|
|
152272
153903
|
exports.jobKindSchema = jobKindSchema;
|
|
@@ -152283,8 +153914,10 @@ exports.lawnMowerControlCapability = lawnMowerControlCapability;
|
|
|
152283
153914
|
exports.leafCatalogEntry = leafCatalogEntry;
|
|
152284
153915
|
exports.leafKindsFor = leafKindsFor;
|
|
152285
153916
|
exports.legacyAutoLinkIds = legacyAutoLinkIds;
|
|
153917
|
+
exports.legacyEngineRowsIndex = legacyEngineRowsIndex;
|
|
152286
153918
|
exports.legacyImageMode = legacyImageMode;
|
|
152287
153919
|
exports.legacyModeOf = legacyModeOf;
|
|
153920
|
+
exports.legacySweepDone = legacySweepDone;
|
|
152288
153921
|
exports.legacyTargetsOver = legacyTargetsOver;
|
|
152289
153922
|
exports.lifecycleJobSchema = lifecycleJobSchema;
|
|
152290
153923
|
exports.lifecycleJobScopeSchema = lifecycleJobScopeSchema;
|
|
@@ -152338,6 +153971,7 @@ exports.mediaPlayerExtensionCommands = mediaPlayerExtensionCommands;
|
|
|
152338
153971
|
exports.mediaPlayerFeaturesOfRoles = mediaPlayerFeaturesOfRoles;
|
|
152339
153972
|
exports.memoizePinnedFfmpeg = memoizePinnedFfmpeg;
|
|
152340
153973
|
exports.mergeClipLabels = mergeClipLabels;
|
|
153974
|
+
exports.mergeIdentifiers = mergeIdentifiers;
|
|
152341
153975
|
exports.mergeKeyedArrayItem = mergeKeyedArrayItem;
|
|
152342
153976
|
exports.mergeOverrides = mergeOverrides;
|
|
152343
153977
|
exports.mergeScalarTarget = mergeScalarTarget;
|
|
@@ -152386,6 +154020,7 @@ exports.nestedStepsOf = nestedStepsOf;
|
|
|
152386
154020
|
exports.networkAccessCapability = networkAccessCapability;
|
|
152387
154021
|
exports.networkLinkCapability = networkLinkCapability;
|
|
152388
154022
|
exports.networkQualityCapability = networkQualityCapability;
|
|
154023
|
+
exports.newGridHelperSpec = require_implemented_methods.newGridHelperSpec;
|
|
152389
154024
|
exports.nextLocalMidnight = require_implemented_methods.nextLocalMidnight;
|
|
152390
154025
|
exports.nextOccurrence = nextOccurrence;
|
|
152391
154026
|
exports.nextTimeBoundaryInMs = nextTimeBoundaryInMs;
|
|
@@ -152396,6 +154031,8 @@ exports.nodePickerItems = nodePickerItems;
|
|
|
152396
154031
|
exports.nodePin = require_sleep.nodePin;
|
|
152397
154032
|
exports.nodeRemovalHookCapability = nodeRemovalHookCapability;
|
|
152398
154033
|
exports.nodesCapability = nodesCapability;
|
|
154034
|
+
exports.normaliseIdentifiers = normaliseIdentifiers;
|
|
154035
|
+
exports.normaliseMac = normaliseMac;
|
|
152399
154036
|
exports.normalizeActionUnits = normalizeActionUnits;
|
|
152400
154037
|
exports.normalizeAddonInitResult = require_sleep.normalizeAddonInitResult;
|
|
152401
154038
|
exports.normalizeAudioLabel = normalizeAudioLabel;
|
|
@@ -152429,6 +154066,7 @@ exports.objectInputDeclaresRequiredDeviceId = objectInputDeclaresRequiredDeviceI
|
|
|
152429
154066
|
exports.observeHoldLeaves = observeHoldLeaves;
|
|
152430
154067
|
exports.occupancyScope = occupancyScope;
|
|
152431
154068
|
exports.occurrenceOn = occurrenceOn;
|
|
154069
|
+
exports.offeredActionsWith = offeredActionsWith;
|
|
152432
154070
|
exports.omitTransientConfig = require_sleep.omitTransientConfig;
|
|
152433
154071
|
exports.openReset = require_implemented_methods.openReset;
|
|
152434
154072
|
exports.openStatistic = require_implemented_methods.openStatistic;
|
|
@@ -152514,6 +154152,7 @@ exports.planMotionCropRegions = planMotionCropRegions;
|
|
|
152514
154152
|
exports.planMotionCrops = planMotionCrops;
|
|
152515
154153
|
exports.planRecoveryCrops = planRecoveryCrops;
|
|
152516
154154
|
exports.planResetTier = require_implemented_methods.planResetTier;
|
|
154155
|
+
exports.planSirenTrigger = planSirenTrigger;
|
|
152517
154156
|
exports.planStatisticTier = require_implemented_methods.planStatisticTier;
|
|
152518
154157
|
exports.plateGalleryCapability = plateGalleryCapability;
|
|
152519
154158
|
exports.platformProbeCapability = platformProbeCapability;
|
|
@@ -152690,6 +154329,7 @@ exports.resolveSecretMarkers = require_sleep.resolveSecretMarkers;
|
|
|
152690
154329
|
exports.resolveSecretViewsIn = require_sleep.resolveSecretViewsIn;
|
|
152691
154330
|
exports.resolveSelectStep = resolveSelectStep;
|
|
152692
154331
|
exports.resolveServerName = resolveServerName;
|
|
154332
|
+
exports.resolveSirenPlays = resolveSirenPlays;
|
|
152693
154333
|
exports.resolveSirenSeconds = resolveSirenSeconds;
|
|
152694
154334
|
exports.resolveStepArgs = resolveStepArgs;
|
|
152695
154335
|
exports.resolveStepArgsWithTemplates = resolveStepArgsWithTemplates;
|
|
@@ -152746,6 +154386,7 @@ exports.runtimeDevices = runtimeDevices;
|
|
|
152746
154386
|
exports.runtimeFieldUnit = runtimeFieldUnit;
|
|
152747
154387
|
exports.runtimeStatePolicyFor = runtimeStatePolicyFor;
|
|
152748
154388
|
exports.sameHelperBody = sameHelperBody;
|
|
154389
|
+
exports.sameIdentifiers = sameIdentifiers;
|
|
152749
154390
|
exports.sameRead = sameRead;
|
|
152750
154391
|
exports.sameTag = sameTag;
|
|
152751
154392
|
exports.sanitizeTargetOverride = sanitizeTargetOverride;
|
|
@@ -152780,6 +154421,7 @@ exports.seedLeaf = seedLeaf;
|
|
|
152780
154421
|
exports.seekPatch = seekPatch;
|
|
152781
154422
|
exports.selectAppConnectionEndpoints = selectAppConnectionEndpoints;
|
|
152782
154423
|
exports.selectAssignedProfileSlots = require_sleep.selectAssignedProfileSlots;
|
|
154424
|
+
exports.selectEngineHostedBlocks = selectEngineHostedBlocks;
|
|
152783
154425
|
exports.selectFewShots = selectFewShots;
|
|
152784
154426
|
exports.selectNavigationMethods = selectNavigationMethods;
|
|
152785
154427
|
exports.selectRecoveryStep = selectRecoveryStep;
|
|
@@ -152812,6 +154454,7 @@ exports.signalPercentFromBars = signalPercentFromBars;
|
|
|
152812
154454
|
exports.signalPercentFromRssi = signalPercentFromRssi;
|
|
152813
154455
|
exports.sirenCapability = sirenCapability;
|
|
152814
154456
|
exports.sirenIdleStatus = sirenIdleStatus;
|
|
154457
|
+
exports.sirenPlayChoices = sirenPlayChoices;
|
|
152815
154458
|
exports.sirenTriggeredStatus = sirenTriggeredStatus;
|
|
152816
154459
|
exports.siteFor = siteFor;
|
|
152817
154460
|
exports.siteZoneKey = siteZoneKey;
|
|
@@ -152883,8 +154526,10 @@ exports.sunTimes = sunTimes;
|
|
|
152883
154526
|
exports.supplyFor = supplyFor;
|
|
152884
154527
|
exports.supportedRuntimes = supportedRuntimes;
|
|
152885
154528
|
exports.swatchHex = swatchHex;
|
|
154529
|
+
exports.sweepLegacyEngineRows = sweepLegacyEngineRows;
|
|
152886
154530
|
exports.switchCapability = switchCapability;
|
|
152887
154531
|
exports.switchRecordsOverMigrationApi = require_sleep.switchRecordsOverMigrationApi;
|
|
154532
|
+
exports.switchRefusesSetState = require_sleep.switchRefusesSetState;
|
|
152888
154533
|
exports.switchStateOfMode = switchStateOfMode;
|
|
152889
154534
|
exports.switchedOffIds = switchedOffIds;
|
|
152890
154535
|
exports.syncActiveAlarmProfileSettings = syncActiveAlarmProfileSettings;
|
|
@@ -153031,6 +154676,8 @@ exports.withSystemEventModes = withSystemEventModes;
|
|
|
153031
154676
|
exports.withoutCallerStamp = require_sleep.withoutCallerStamp;
|
|
153032
154677
|
exports.withoutField = withoutField;
|
|
153033
154678
|
exports.withoutKeyedArrayItem = withoutKeyedArrayItem;
|
|
154679
|
+
exports.workloadCapability = workloadCapability;
|
|
154680
|
+
exports.workloadTransition = workloadTransition;
|
|
153034
154681
|
exports.writeModelBoundSetting = writeModelBoundSetting;
|
|
153035
154682
|
exports.zodEntriesToConfigUI = zodEntriesToConfigUI;
|
|
153036
154683
|
exports.zoneAnalyticsCapability = zoneAnalyticsCapability;
|