@camstack/addon-export-alexa 1.2.180 → 1.2.182
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/export-alexa.addon.js +541 -246
- package/dist/export-alexa.addon.mjs +541 -246
- package/package.json +2 -2
|
@@ -6016,7 +6016,7 @@ var ZodIssueCode = {
|
|
|
6016
6016
|
var ZodFirstPartyTypeKind;
|
|
6017
6017
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
6018
6018
|
//#endregion
|
|
6019
|
-
//#region ../types/dist/sleep-
|
|
6019
|
+
//#region ../types/dist/sleep-BkzQdpzF.mjs
|
|
6020
6020
|
/**
|
|
6021
6021
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
6022
6022
|
* window to float samples (D455).
|
|
@@ -8153,6 +8153,10 @@ var BaseAddon = class {
|
|
|
8153
8153
|
const stored = keychain ? await this.readAddonStoreWithRetry() : {};
|
|
8154
8154
|
const patch = {};
|
|
8155
8155
|
for (const key of keys) {
|
|
8156
|
+
if (tree.get(key)?.kind === "array") {
|
|
8157
|
+
patch[key] = [];
|
|
8158
|
+
continue;
|
|
8159
|
+
}
|
|
8156
8160
|
const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
|
|
8157
8161
|
patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
|
|
8158
8162
|
}
|
|
@@ -9214,7 +9218,7 @@ function defineRecordKinds(specs) {
|
|
|
9214
9218
|
retention: spec.retention,
|
|
9215
9219
|
deviceRemoval: spec.deviceRemoval,
|
|
9216
9220
|
maxDataBytes: spec.maxDataBytes,
|
|
9217
|
-
secretPaths: [...secretPaths],
|
|
9221
|
+
secretPaths: [...new Set([...secretPaths, ...spec.retiredSecretPaths ?? []])],
|
|
9218
9222
|
secretArrayKeys: spec.secretArrayKeys === void 0 ? void 0 : { ...spec.secretArrayKeys },
|
|
9219
9223
|
transactFamily: spec.transactFamily,
|
|
9220
9224
|
entry: spec.entry === void 0 ? void 0 : {
|
|
@@ -9245,6 +9249,7 @@ function defineEntryKind(name, spec) {
|
|
|
9245
9249
|
...spec.database === void 0 ? {} : { database: spec.database },
|
|
9246
9250
|
...spec.indexes === void 0 ? {} : { indexes: spec.indexes },
|
|
9247
9251
|
...spec.secretArrayKeys === void 0 ? {} : { secretArrayKeys: spec.secretArrayKeys },
|
|
9252
|
+
...spec.retiredSecretPaths === void 0 ? {} : { retiredSecretPaths: spec.retiredSecretPaths },
|
|
9248
9253
|
entry: {
|
|
9249
9254
|
title: spec.title,
|
|
9250
9255
|
...spec.nameField === void 0 ? {} : { nameField: spec.nameField }
|
|
@@ -11928,7 +11933,7 @@ object({
|
|
|
11928
11933
|
params: record(string(), union([string(), number()])).optional()
|
|
11929
11934
|
});
|
|
11930
11935
|
//#endregion
|
|
11931
|
-
//#region ../types/dist/composition-
|
|
11936
|
+
//#region ../types/dist/composition-CRNwcFYY.mjs
|
|
11932
11937
|
/**
|
|
11933
11938
|
* The ffmpeg build every CamStack node downloads, per platform and arch.
|
|
11934
11939
|
*
|
|
@@ -12691,38 +12696,6 @@ function validateExpressionSource(src) {
|
|
|
12691
12696
|
return null;
|
|
12692
12697
|
}
|
|
12693
12698
|
/**
|
|
12694
|
-
* One power reading becomes a washer, dryer or dishwasher (D944 helper).
|
|
12695
|
-
*
|
|
12696
|
-
* Standby of the control board is under 5 W; a motor or a heater is far
|
|
12697
|
-
* above that, so 5 W is the line. A door lock or a short pump spike is not
|
|
12698
|
-
* a cycle, so running starts only after 30 s above the line.
|
|
12699
|
-
*
|
|
12700
|
-
* A wash, dry or dishwasher pause (soak, heat-wait, heater off between
|
|
12701
|
-
* bursts) lasts several minutes. Ending the cycle on the first dip would
|
|
12702
|
-
* report "finished" in the middle of the program, so the stop dwell is
|
|
12703
|
-
* 10 minutes on every type. The number is stored per type so one machine
|
|
12704
|
-
* can move later without moving the others.
|
|
12705
|
-
*/
|
|
12706
|
-
var APPLIANCE_TEMPLATE_ID = "appliance";
|
|
12707
|
-
var APPLIANCE_KINDS = [
|
|
12708
|
-
"washer",
|
|
12709
|
-
"dryer",
|
|
12710
|
-
"dishwasher"
|
|
12711
|
-
];
|
|
12712
|
-
DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher;
|
|
12713
|
-
/**
|
|
12714
|
-
* A dumb plug-in stove or heater, built from a smart plug (a `Heater`).
|
|
12715
|
-
*
|
|
12716
|
-
* The plug is the actuator: `switch.setState` is a FORWARD to the plug's own
|
|
12717
|
-
* (D967), so the heater switches exactly as the plug does. Running is the
|
|
12718
|
-
* plug being on; when a power reading is also named, running is the draw
|
|
12719
|
-
* staying above the line instead (a plug left on with the stove's own
|
|
12720
|
-
* thermostat open is not heating). 50 W is far above any standby and below
|
|
12721
|
-
* the smallest radiator.
|
|
12722
|
-
*/
|
|
12723
|
-
var HEATER_TEMPLATE_ID = "heater";
|
|
12724
|
-
DeviceType.Heater;
|
|
12725
|
-
/**
|
|
12726
12699
|
* Statistics and integrals over a history read (D944).
|
|
12727
12700
|
*
|
|
12728
12701
|
* Pure: the same points always give the same answer, so a restart recomputes
|
|
@@ -12866,34 +12839,6 @@ var HelperSpecSchema = discriminatedUnion("kind", [
|
|
|
12866
12839
|
/** Actuator groups only. Readings leave this unset. */
|
|
12867
12840
|
active: ActiveCriterionSchema.optional()
|
|
12868
12841
|
}),
|
|
12869
|
-
object({
|
|
12870
|
-
kind: literal("appliance"),
|
|
12871
|
-
templateId: literal(APPLIANCE_TEMPLATE_ID),
|
|
12872
|
-
appliance: _enum(APPLIANCE_KINDS),
|
|
12873
|
-
thresholdWatts: number().positive(),
|
|
12874
|
-
startDwellMs: number().int().nonnegative(),
|
|
12875
|
-
stopDwellMs: number().int().nonnegative(),
|
|
12876
|
-
member: HelperMemberSchema,
|
|
12877
|
-
/**
|
|
12878
|
-
* The plug that powers the appliance (`switch.on`). Optional: when set, the
|
|
12879
|
-
* composition carries a `power-source` feature, so the hub can cut and restore
|
|
12880
|
-
* that plug (power-source link of a NEW-target composition).
|
|
12881
|
-
*/
|
|
12882
|
-
powerSwitch: HelperMemberSchema.optional(),
|
|
12883
|
-
/** How long a forced restart keeps the plug off; the cap's default when unset. */
|
|
12884
|
-
offSeconds: number().optional()
|
|
12885
|
-
}),
|
|
12886
|
-
object({
|
|
12887
|
-
kind: literal("heater"),
|
|
12888
|
-
templateId: literal(HEATER_TEMPLATE_ID),
|
|
12889
|
-
/** The plug, read and commanded at `switch.on`. */
|
|
12890
|
-
plug: HelperMemberSchema,
|
|
12891
|
-
/** The plug's power reading, when it has one: running is then the draw, not the switch. */
|
|
12892
|
-
meter: HelperMemberSchema.optional(),
|
|
12893
|
-
thresholdWatts: number().positive(),
|
|
12894
|
-
startDwellMs: number().int().nonnegative(),
|
|
12895
|
-
stopDwellMs: number().int().nonnegative()
|
|
12896
|
-
}),
|
|
12897
12842
|
object({
|
|
12898
12843
|
kind: literal("statistic"),
|
|
12899
12844
|
stat: _enum(STATISTIC_STATS),
|
|
@@ -13117,7 +13062,7 @@ var CompositionSchema = object({
|
|
|
13117
13062
|
kind: literal("existing"),
|
|
13118
13063
|
device: CompositionSourceRefSchema
|
|
13119
13064
|
})]),
|
|
13120
|
-
features: array(CompositionFeatureSchema).min(
|
|
13065
|
+
features: array(CompositionFeatureSchema).min(0).max(16),
|
|
13121
13066
|
/**
|
|
13122
13067
|
* Present when the block is a helper template. Absent on a free
|
|
13123
13068
|
* composition (the room example, device 4603). The editor reads this,
|
|
@@ -13516,15 +13461,23 @@ var RecordIntegrationInstances = class {
|
|
|
13516
13461
|
viewOf(record) {
|
|
13517
13462
|
const shown = secretViewsOf(this.records.owner, this.kind.name, record.id, this.kind.declaration, record.data);
|
|
13518
13463
|
const rawName = record.data[this.nameField];
|
|
13464
|
+
const kind = this.hooks.kindOf?.(record.data);
|
|
13465
|
+
const health = this.hooks.health?.(record.data, record.id);
|
|
13519
13466
|
return {
|
|
13520
13467
|
id: record.id,
|
|
13521
13468
|
name: typeof rawName === "string" ? rawName : record.id,
|
|
13522
13469
|
configured: this.hooks.configured(record.data),
|
|
13523
13470
|
enabled: record.data.enabled !== false,
|
|
13524
|
-
formValues: shown
|
|
13471
|
+
formValues: shown,
|
|
13472
|
+
...kind !== void 0 ? { kind } : {},
|
|
13473
|
+
...health?.status !== void 0 ? { status: health.status } : {},
|
|
13474
|
+
...health?.lastCheckedAt !== void 0 ? { lastCheckedAt: health.lastCheckedAt } : {}
|
|
13525
13475
|
};
|
|
13526
13476
|
}
|
|
13527
|
-
describe = async () => this.hooks.description
|
|
13477
|
+
describe = async () => this.hooks.mintId === void 0 ? this.hooks.description : {
|
|
13478
|
+
...this.hooks.description,
|
|
13479
|
+
mintsId: true
|
|
13480
|
+
};
|
|
13528
13481
|
instanceFormSchema = async ({ id }) => this.hooks.formSchema(id);
|
|
13529
13482
|
listInstances = async () => {
|
|
13530
13483
|
return (await this.handle.query({ limit: INSTANCES_LIST_MAX })).records.map((record) => this.viewOf(record));
|
|
@@ -13534,13 +13487,18 @@ var RecordIntegrationInstances = class {
|
|
|
13534
13487
|
return record === null ? null : this.viewOf(record);
|
|
13535
13488
|
};
|
|
13536
13489
|
/** Insert ONE row (`ifRev: 0`: an existing id is refused, never overwritten). */
|
|
13537
|
-
createInstance = async ({ id, name }) => {
|
|
13490
|
+
createInstance = async ({ id, name, kind }) => {
|
|
13491
|
+
const minted = id ?? this.hooks.mintId?.({
|
|
13492
|
+
name,
|
|
13493
|
+
...kind !== void 0 ? { kind } : {}
|
|
13494
|
+
});
|
|
13495
|
+
if (minted === void 0) throw new Error("createInstance needs an id: this provider does not mint one");
|
|
13538
13496
|
await this.handle.put({
|
|
13539
|
-
id,
|
|
13540
|
-
data: this.hooks.initialBody(name)
|
|
13497
|
+
id: minted,
|
|
13498
|
+
data: this.hooks.initialBody(name, kind)
|
|
13541
13499
|
}, { ifRev: 0 });
|
|
13542
|
-
await this.hooks.onChanged?.(
|
|
13543
|
-
return { id };
|
|
13500
|
+
await this.hooks.onChanged?.(minted);
|
|
13501
|
+
return { id: minted };
|
|
13544
13502
|
};
|
|
13545
13503
|
updateInstance = async ({ id, name, values }) => {
|
|
13546
13504
|
const patch = {};
|
|
@@ -49261,49 +49219,6 @@ function actuator(input) {
|
|
|
49261
49219
|
};
|
|
49262
49220
|
}
|
|
49263
49221
|
new Map(GROUP_TEMPLATES.map((template) => [template.id, template]));
|
|
49264
|
-
var PowerSourceRefusalReasonSchema = _enum([
|
|
49265
|
-
"no-power-source",
|
|
49266
|
-
"switch-missing",
|
|
49267
|
-
"switch-offline",
|
|
49268
|
-
"switch-unknown",
|
|
49269
|
-
"restart-in-progress",
|
|
49270
|
-
"switch-call-failed"
|
|
49271
|
-
]);
|
|
49272
|
-
var PowerSourceActionResultSchema = discriminatedUnion("accepted", [object({ accepted: literal(true) }), object({
|
|
49273
|
-
accepted: literal(false),
|
|
49274
|
-
reason: PowerSourceRefusalReasonSchema,
|
|
49275
|
-
/** One line for the operator, naming the switch. */
|
|
49276
|
-
message: string()
|
|
49277
|
-
})]);
|
|
49278
|
-
var PowerSourceInfoSchema = object({
|
|
49279
|
-
/** False when the device has no power source linked; the rest is then empty. */
|
|
49280
|
-
linked: boolean(),
|
|
49281
|
-
switchDeviceId: number().nullable(),
|
|
49282
|
-
switchName: string().nullable(),
|
|
49283
|
-
/** The switch's on/off state, or null when it is unknown. Never false for unknown (D393). */
|
|
49284
|
-
switchOn: boolean().nullable(),
|
|
49285
|
-
switchOnline: boolean().nullable(),
|
|
49286
|
-
restartInProgress: boolean(),
|
|
49287
|
-
offSeconds: number().int()
|
|
49288
|
-
});
|
|
49289
|
-
object({
|
|
49290
|
-
/** Null while the switch has not reported: unknown is never `false` (D393). */
|
|
49291
|
-
switchOn: boolean().nullable(),
|
|
49292
|
-
offSeconds: number().int(),
|
|
49293
|
-
lastFetchedAt: number()
|
|
49294
|
-
});
|
|
49295
|
-
DeviceType.Gateway, DeviceType.Hub, DeviceType.Camera, DeviceType.Sensor, DeviceType.MediaPlayer, DeviceType.Vacuum, DeviceType.Generic, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.PetFountain, DeviceType.Fan, DeviceType.Humidifier, DeviceType.Climate, DeviceType.WaterHeater;
|
|
49296
|
-
var deviceInput$2 = object({ deviceId: number().int().nonnegative() });
|
|
49297
|
-
systemMethod(deviceInput$2, PowerSourceInfoSchema, { auth: "admin" }), systemMethod(deviceInput$2, PowerSourceActionResultSchema, {
|
|
49298
|
-
kind: "mutation",
|
|
49299
|
-
auth: "admin"
|
|
49300
|
-
}), systemMethod(deviceInput$2, PowerSourceActionResultSchema, {
|
|
49301
|
-
kind: "mutation",
|
|
49302
|
-
auth: "admin"
|
|
49303
|
-
}), systemMethod(deviceInput$2, PowerSourceActionResultSchema, {
|
|
49304
|
-
kind: "mutation",
|
|
49305
|
-
auth: "admin"
|
|
49306
|
-
});
|
|
49307
49222
|
DeviceFeature.LightColorRgb, DeviceFeature.LightColorHsv, DeviceFeature.LightColorMired;
|
|
49308
49223
|
DeviceType.Camera;
|
|
49309
49224
|
`${COMPOSED_DEVICE_STABLE_ID_PREFIX}`;
|
|
@@ -49331,6 +49246,165 @@ var ComposableCapabilitiesSchema = object({ caps: array(object({
|
|
|
49331
49246
|
}).optional()
|
|
49332
49247
|
})) });
|
|
49333
49248
|
/**
|
|
49249
|
+
* A saved Customize assignment (D936). The schema is the type: callers use
|
|
49250
|
+
* `z.infer`, they do not restate the shape.
|
|
49251
|
+
*/
|
|
49252
|
+
var OverrideSourceSchema = object({
|
|
49253
|
+
addonId: string().min(1),
|
|
49254
|
+
stableId: string().min(1),
|
|
49255
|
+
cap: string().min(1),
|
|
49256
|
+
fieldPath: string().min(1)
|
|
49257
|
+
});
|
|
49258
|
+
var IdentityTransformDraftSchema = object({ kind: literal("identity") });
|
|
49259
|
+
var InvertTransformDraftSchema = object({ kind: literal("invert") });
|
|
49260
|
+
var ThresholdTransformDraftSchema = object({
|
|
49261
|
+
kind: literal("threshold"),
|
|
49262
|
+
comparison: _enum(["gte", "lte"]),
|
|
49263
|
+
threshold: number(),
|
|
49264
|
+
startDwellMs: number().nonnegative(),
|
|
49265
|
+
stopDwellMs: number().nonnegative()
|
|
49266
|
+
});
|
|
49267
|
+
var CustomizeTransformDraftSchema = discriminatedUnion("kind", [
|
|
49268
|
+
IdentityTransformDraftSchema,
|
|
49269
|
+
InvertTransformDraftSchema,
|
|
49270
|
+
ThresholdTransformDraftSchema,
|
|
49271
|
+
object({
|
|
49272
|
+
kind: literal("linear"),
|
|
49273
|
+
scale: number(),
|
|
49274
|
+
offset: number(),
|
|
49275
|
+
clampMin: number().optional(),
|
|
49276
|
+
clampMax: number().optional()
|
|
49277
|
+
}),
|
|
49278
|
+
object({
|
|
49279
|
+
kind: literal("enum-map"),
|
|
49280
|
+
mapping: record(string(), string().nullable())
|
|
49281
|
+
}),
|
|
49282
|
+
object({ kind: literal("number") })
|
|
49283
|
+
]);
|
|
49284
|
+
var ScalarOverrideDraftSchema = object({
|
|
49285
|
+
kind: literal("scalar"),
|
|
49286
|
+
cap: string().min(1),
|
|
49287
|
+
targetId: string().min(1),
|
|
49288
|
+
source: OverrideSourceSchema,
|
|
49289
|
+
transform: CustomizeTransformDraftSchema
|
|
49290
|
+
});
|
|
49291
|
+
var KeyedArrayOverrideDraftSchema = object({
|
|
49292
|
+
kind: literal("keyedArray"),
|
|
49293
|
+
cap: string().min(1),
|
|
49294
|
+
targetId: string().min(1),
|
|
49295
|
+
key: string().min(1),
|
|
49296
|
+
label: string().min(1),
|
|
49297
|
+
fieldPath: string().min(1),
|
|
49298
|
+
source: OverrideSourceSchema,
|
|
49299
|
+
transform: CustomizeTransformDraftSchema
|
|
49300
|
+
});
|
|
49301
|
+
var PulseOverrideDraftSchema = object({
|
|
49302
|
+
kind: literal("pulse"),
|
|
49303
|
+
cap: string().min(1),
|
|
49304
|
+
targetId: string().min(1),
|
|
49305
|
+
enabled: boolean(),
|
|
49306
|
+
debounceMs: number().nonnegative(),
|
|
49307
|
+
edges: array(_enum([
|
|
49308
|
+
"rising",
|
|
49309
|
+
"button",
|
|
49310
|
+
"native-event"
|
|
49311
|
+
])).min(1).optional(),
|
|
49312
|
+
sources: array(OverrideSourceSchema).min(1)
|
|
49313
|
+
});
|
|
49314
|
+
var SpanSourceDraftSchema = OverrideSourceSchema.extend({ mode: _enum([
|
|
49315
|
+
"in-addition",
|
|
49316
|
+
"confirm",
|
|
49317
|
+
"replace"
|
|
49318
|
+
]).optional() });
|
|
49319
|
+
discriminatedUnion("kind", [
|
|
49320
|
+
ScalarOverrideDraftSchema,
|
|
49321
|
+
KeyedArrayOverrideDraftSchema,
|
|
49322
|
+
PulseOverrideDraftSchema,
|
|
49323
|
+
object({
|
|
49324
|
+
kind: literal("span"),
|
|
49325
|
+
cap: string().min(1),
|
|
49326
|
+
targetId: string().min(1),
|
|
49327
|
+
timeoutMs: number().nonnegative(),
|
|
49328
|
+
cooldownMs: number().nonnegative().optional(),
|
|
49329
|
+
sources: array(SpanSourceDraftSchema)
|
|
49330
|
+
})
|
|
49331
|
+
]);
|
|
49332
|
+
object({
|
|
49333
|
+
targetId: string().min(1),
|
|
49334
|
+
configured: boolean(),
|
|
49335
|
+
source: _enum(["native", "assigned"]),
|
|
49336
|
+
state: _enum([
|
|
49337
|
+
"active",
|
|
49338
|
+
"stale",
|
|
49339
|
+
"released",
|
|
49340
|
+
"unavailable"
|
|
49341
|
+
]),
|
|
49342
|
+
reason: string().nullable()
|
|
49343
|
+
});
|
|
49344
|
+
/**
|
|
49345
|
+
* What a running-threshold proposal says (planning#405). The schema is the
|
|
49346
|
+
* type: the algorithm, the capability method and the UI all read `z.infer`.
|
|
49347
|
+
*
|
|
49348
|
+
* A proposal is read-only advice: it carries the numbers it was derived from
|
|
49349
|
+
* (`evidence`) so the operator can judge it, and an `insufficient` answer names
|
|
49350
|
+
* WHY with a typed reason and the catalog defaults, never an invented number.
|
|
49351
|
+
*/
|
|
49352
|
+
var RunningProposalTierSchema = _enum(["raw", "5m"]);
|
|
49353
|
+
var RunningProposalConfidenceSchema = _enum([
|
|
49354
|
+
"high",
|
|
49355
|
+
"medium",
|
|
49356
|
+
"low"
|
|
49357
|
+
]);
|
|
49358
|
+
var RunningProposalInsufficientReasonSchema = _enum([
|
|
49359
|
+
"no-history",
|
|
49360
|
+
"span-too-short",
|
|
49361
|
+
"truncated",
|
|
49362
|
+
"no-idle-floor",
|
|
49363
|
+
"no-runs",
|
|
49364
|
+
"no-separation"
|
|
49365
|
+
]);
|
|
49366
|
+
var RunningProposalReplaySchema = object({
|
|
49367
|
+
/** Intervals the real dwell expression held true over the window. */
|
|
49368
|
+
intervals: number().int().nonnegative(),
|
|
49369
|
+
/** Intervals outside every run, or a second interval inside one. */
|
|
49370
|
+
extra: number().int().nonnegative(),
|
|
49371
|
+
/** Runs without an interval of their own (none, or merged into a neighbour). */
|
|
49372
|
+
missed: number().int().nonnegative()
|
|
49373
|
+
});
|
|
49374
|
+
var RunningProposalEvidenceSchema = object({
|
|
49375
|
+
tier: RunningProposalTierSchema,
|
|
49376
|
+
spanMs: number().nonnegative(),
|
|
49377
|
+
from: number(),
|
|
49378
|
+
to: number(),
|
|
49379
|
+
points: number().int().nonnegative(),
|
|
49380
|
+
runsFound: number().int().nonnegative(),
|
|
49381
|
+
pausesFound: number().int().nonnegative(),
|
|
49382
|
+
longestPauseMs: number().nonnegative(),
|
|
49383
|
+
idleFloorW: number(),
|
|
49384
|
+
noiseCeilingW: number(),
|
|
49385
|
+
plateauW: number(),
|
|
49386
|
+
replay: RunningProposalReplaySchema
|
|
49387
|
+
});
|
|
49388
|
+
var RunningProposalInsufficientEvidenceSchema = object({
|
|
49389
|
+
spanMs: number().nonnegative(),
|
|
49390
|
+
points: number().int().nonnegative(),
|
|
49391
|
+
runsFound: number().int().nonnegative()
|
|
49392
|
+
});
|
|
49393
|
+
var RunningThresholdProposalSchema = discriminatedUnion("state", [object({
|
|
49394
|
+
state: literal("proposal"),
|
|
49395
|
+
transform: ThresholdTransformDraftSchema,
|
|
49396
|
+
evidence: RunningProposalEvidenceSchema,
|
|
49397
|
+
confidence: RunningProposalConfidenceSchema,
|
|
49398
|
+
/** Why the confidence is not higher; empty when nothing held it back. */
|
|
49399
|
+
notes: array(string())
|
|
49400
|
+
}), object({
|
|
49401
|
+
state: literal("insufficient"),
|
|
49402
|
+
reason: RunningProposalInsufficientReasonSchema,
|
|
49403
|
+
evidence: RunningProposalInsufficientEvidenceSchema,
|
|
49404
|
+
/** The catalog defaults, offered as what stands when nothing better is known. */
|
|
49405
|
+
fallback: ThresholdTransformDraftSchema
|
|
49406
|
+
})]);
|
|
49407
|
+
/**
|
|
49334
49408
|
* The report of a one-shot "move this owner's plaintext secrets into the
|
|
49335
49409
|
* keychain" run (D878). COUNTS only - never a value, never a ref.
|
|
49336
49410
|
*
|
|
@@ -49620,6 +49694,14 @@ method(object({}), object({ blocks: array(CoreBlockSchema) }), { auth: "admin" }
|
|
|
49620
49694
|
kind: "mutation",
|
|
49621
49695
|
auth: "admin",
|
|
49622
49696
|
access: "view"
|
|
49697
|
+
}), method(object({
|
|
49698
|
+
deviceId: number().int(),
|
|
49699
|
+
cap: string().min(1),
|
|
49700
|
+
fieldPath: string().min(1),
|
|
49701
|
+
deviceType: _enum(DeviceType).optional()
|
|
49702
|
+
}), RunningThresholdProposalSchema, {
|
|
49703
|
+
auth: "admin",
|
|
49704
|
+
access: "view"
|
|
49623
49705
|
}), method(object({
|
|
49624
49706
|
blockId: string().min(1),
|
|
49625
49707
|
trace: AutomationRunTraceSchema.optional(),
|
|
@@ -50428,7 +50510,53 @@ method(object({
|
|
|
50428
50510
|
* exposes only the COMMON surface: link state, supported device
|
|
50429
50511
|
* kinds (so the UI can filter the device picker), and per-device
|
|
50430
50512
|
* expose/unexpose.
|
|
50513
|
+
*
|
|
50514
|
+
* INSTANCES. One export addon can serve several independent targets (a
|
|
50515
|
+
* HomeKit bridge, a Home Assistant broker). `listInstances` names them.
|
|
50516
|
+
* `instanceId` on a READ is optional: absent = the whole addon (linked if any
|
|
50517
|
+
* enabled instance is, `exposedDeviceCount` = distinct devices, `setup` = the
|
|
50518
|
+
* default instance's); present = that instance; an id the provider does not
|
|
50519
|
+
* serve is refused with `ExportInstanceUnknownError` (`export-instance-unknown`),
|
|
50520
|
+
* never answered empty. `instanceId` on a WRITE is REQUIRED: a membership
|
|
50521
|
+
* change always names the target it changes. A single-instance provider
|
|
50522
|
+
* accepts an absent id on a read or its own id, and refuses any other.
|
|
50523
|
+
*/
|
|
50524
|
+
/** Which instance of an export addon a call addresses. Absent on a read = the whole addon. */
|
|
50525
|
+
var InstanceIdSchema$1 = string().min(1);
|
|
50526
|
+
var InstancePinSchema = object({ instanceId: InstanceIdSchema$1.optional() });
|
|
50527
|
+
/** One independent export target of an addon. */
|
|
50528
|
+
var ExportInstanceSchema = object({
|
|
50529
|
+
instanceId: InstanceIdSchema$1,
|
|
50530
|
+
name: string(),
|
|
50531
|
+
enabled: boolean(),
|
|
50532
|
+
kind: string().optional()
|
|
50533
|
+
});
|
|
50534
|
+
var EXPORT_INSTANCE_UNKNOWN = "export-instance-unknown";
|
|
50535
|
+
/** The named failure of an `instanceId` the provider does not serve. The message starts with the code. */
|
|
50536
|
+
var ExportInstanceUnknownError = class extends Error {
|
|
50537
|
+
code = EXPORT_INSTANCE_UNKNOWN;
|
|
50538
|
+
instanceId;
|
|
50539
|
+
constructor(addon, instanceId) {
|
|
50540
|
+
super(`${EXPORT_INSTANCE_UNKNOWN}: ${addon} serves no instance "${instanceId}"`);
|
|
50541
|
+
this.name = "ExportInstanceUnknownError";
|
|
50542
|
+
this.instanceId = instanceId;
|
|
50543
|
+
}
|
|
50544
|
+
};
|
|
50545
|
+
/**
|
|
50546
|
+
* The instance a `getStatus` call names. The cap's `status` block injects a per-device
|
|
50547
|
+
* `getStatus({ deviceId })` beside the method's own `{ instanceId? }`, so the provider sees
|
|
50548
|
+
* both shapes; only the second names an instance (a per-device status read is addon-wide).
|
|
50549
|
+
*/
|
|
50550
|
+
function statusInstanceOf(input) {
|
|
50551
|
+
return "instanceId" in input ? input.instanceId : void 0;
|
|
50552
|
+
}
|
|
50553
|
+
/**
|
|
50554
|
+
* A single-instance provider's check: an absent id or its own passes, any other throws
|
|
50555
|
+
* `ExportInstanceUnknownError`.
|
|
50431
50556
|
*/
|
|
50557
|
+
function assertOwnExportInstance(addon, own, instanceId) {
|
|
50558
|
+
if (instanceId !== void 0 && instanceId !== own) throw new ExportInstanceUnknownError(addon, instanceId);
|
|
50559
|
+
}
|
|
50432
50560
|
var LinkStateSchema = _enum([
|
|
50433
50561
|
"unlinked",
|
|
50434
50562
|
"linked",
|
|
@@ -50479,10 +50607,14 @@ var ExposedDeviceSchema = object({
|
|
|
50479
50607
|
capabilities: array(string()).optional()
|
|
50480
50608
|
});
|
|
50481
50609
|
var ExposeInputSchema = object({
|
|
50610
|
+
instanceId: InstanceIdSchema$1,
|
|
50482
50611
|
deviceId: string(),
|
|
50483
50612
|
capabilities: array(string()).optional()
|
|
50484
50613
|
});
|
|
50485
|
-
var UnexposeInputSchema = object({
|
|
50614
|
+
var UnexposeInputSchema = object({
|
|
50615
|
+
instanceId: InstanceIdSchema$1,
|
|
50616
|
+
deviceId: string()
|
|
50617
|
+
});
|
|
50486
50618
|
/**
|
|
50487
50619
|
* What an exporter may expose besides devices (D968). An action and a
|
|
50488
50620
|
* notification target are LIST ENTRIES, never devices (D954): they enter an
|
|
@@ -50511,8 +50643,14 @@ var ExposedEntitySchema = object({
|
|
|
50511
50643
|
entity: ExportEntityRefSchema,
|
|
50512
50644
|
exposedAs: string().optional()
|
|
50513
50645
|
});
|
|
50514
|
-
var ExposeEntityInputSchema = object({
|
|
50515
|
-
|
|
50646
|
+
var ExposeEntityInputSchema = object({
|
|
50647
|
+
instanceId: InstanceIdSchema$1,
|
|
50648
|
+
entity: ExportEntityRefSchema
|
|
50649
|
+
});
|
|
50650
|
+
var UnexposeEntityInputSchema = object({
|
|
50651
|
+
instanceId: InstanceIdSchema$1,
|
|
50652
|
+
entity: ExportEntityRefSchema
|
|
50653
|
+
});
|
|
50516
50654
|
var deviceExportCapability = {
|
|
50517
50655
|
name: "device-export",
|
|
50518
50656
|
scope: "system",
|
|
@@ -50532,9 +50670,10 @@ var deviceExportCapability = {
|
|
|
50532
50670
|
*/
|
|
50533
50671
|
exposesDeviceSettings: true,
|
|
50534
50672
|
methods: {
|
|
50535
|
-
getStatus: method(
|
|
50536
|
-
|
|
50537
|
-
|
|
50673
|
+
getStatus: method(InstancePinSchema, DeviceExportStatusSchema),
|
|
50674
|
+
listInstances: method(_void(), array(ExportInstanceSchema)),
|
|
50675
|
+
listSupportedDeviceKinds: method(InstancePinSchema, array(DeviceKindSchema)),
|
|
50676
|
+
listExposedDevices: method(InstancePinSchema, array(ExposedDeviceSchema)),
|
|
50538
50677
|
exposeDevice: method(ExposeInputSchema, _void(), {
|
|
50539
50678
|
kind: "mutation",
|
|
50540
50679
|
auth: "admin"
|
|
@@ -50544,7 +50683,7 @@ var deviceExportCapability = {
|
|
|
50544
50683
|
auth: "admin"
|
|
50545
50684
|
}),
|
|
50546
50685
|
listSupportedEntityKinds: optionalMethod(_void(), array(ExportEntityKindSchema)),
|
|
50547
|
-
listExposedEntities: optionalMethod(
|
|
50686
|
+
listExposedEntities: optionalMethod(InstancePinSchema, array(ExposedEntitySchema)),
|
|
50548
50687
|
exposeEntity: optionalMethod(ExposeEntityInputSchema, _void(), {
|
|
50549
50688
|
kind: "mutation",
|
|
50550
50689
|
auth: "admin"
|
|
@@ -53749,15 +53888,15 @@ var FanPresetCaptureResultSchema = object({
|
|
|
53749
53888
|
items: array(FanCaptureItemSchema),
|
|
53750
53889
|
omitted: array(FanCaptureOmissionSchema)
|
|
53751
53890
|
});
|
|
53752
|
-
var deviceInput$
|
|
53891
|
+
var deviceInput$2 = object({ deviceId: number().int().nonnegative() });
|
|
53753
53892
|
DeviceType.Fan;
|
|
53754
|
-
method(deviceInput$
|
|
53893
|
+
method(deviceInput$2, array(FanPresetSchema), { auth: "protected" }), method(deviceInput$2.extend({ presets: array(FanPresetSchema).max(12) }), FanPresetsSetResultSchema, {
|
|
53755
53894
|
kind: "mutation",
|
|
53756
53895
|
auth: "admin"
|
|
53757
|
-
}), method(deviceInput$
|
|
53896
|
+
}), method(deviceInput$2.extend({ presetId: string().min(1) }), FanPresetApplyResultSchema, {
|
|
53758
53897
|
kind: "mutation",
|
|
53759
53898
|
auth: "protected"
|
|
53760
|
-
}), method(deviceInput$
|
|
53899
|
+
}), method(deviceInput$2.extend({
|
|
53761
53900
|
fields: array(FanCaptureFieldSchema).optional(),
|
|
53762
53901
|
steps: array(ActionStepSchema).max(20).default([])
|
|
53763
53902
|
}), FanPresetCaptureResultSchema, { auth: "protected" });
|
|
@@ -54289,13 +54428,50 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
|
|
|
54289
54428
|
*/
|
|
54290
54429
|
var ConfigSchemaPassthrough$3 = custom();
|
|
54291
54430
|
var IntegrationInstanceIdSchema = string().min(1);
|
|
54431
|
+
var IntegrationInstanceModeSchema = _enum(["single", "multiple"]);
|
|
54432
|
+
/**
|
|
54433
|
+
* One kind of instance a provider can create (an adapter, an account type). The sign-in and
|
|
54434
|
+
* connect fields follow the `broker` contract (`broker.cap.ts`): `signIn.basePath` is a
|
|
54435
|
+
* hub-relative route set speaking the sign-in contract, `connectPath` / `disconnectPath` open an
|
|
54436
|
+
* interactive account link (popup) and may carry `{{brokerId}}`, which the UI replaces with the
|
|
54437
|
+
* instance id.
|
|
54438
|
+
*/
|
|
54439
|
+
var IntegrationInstanceKindSchema = object({
|
|
54440
|
+
/** Stable id of the kind, sent back as `createInstance.kind`. */
|
|
54441
|
+
id: string().min(1),
|
|
54442
|
+
label: string().min(1),
|
|
54443
|
+
/** The kind signs in through a server-held interactive session. */
|
|
54444
|
+
signIn: object({
|
|
54445
|
+
basePath: string().min(1),
|
|
54446
|
+
methods: array(_enum(["device-code", "proxy"])).optional()
|
|
54447
|
+
}).optional(),
|
|
54448
|
+
/** Relative hub path to start an interactive account link of an instance of this kind. */
|
|
54449
|
+
connectPath: string().min(1).optional(),
|
|
54450
|
+
/** Relative hub path to disconnect that account. */
|
|
54451
|
+
disconnectPath: string().min(1).optional()
|
|
54452
|
+
});
|
|
54292
54453
|
var IntegrationInstanceDescriptionSchema = object({
|
|
54293
54454
|
/** `single`: at most one instance can exist (Loki). `multiple`: an account each. */
|
|
54294
|
-
instanceMode:
|
|
54455
|
+
instanceMode: IntegrationInstanceModeSchema,
|
|
54295
54456
|
/** What the instance is, for the UI (`destination`, `relay`, `account`). */
|
|
54296
54457
|
kind: string(),
|
|
54297
54458
|
/** True when `testInstance` really probes the remote. */
|
|
54298
|
-
canTest: boolean()
|
|
54459
|
+
canTest: boolean(),
|
|
54460
|
+
/**
|
|
54461
|
+
* The kinds an instance can be of. Absent or one entry: nothing to choose; more than one: the
|
|
54462
|
+
* Add flow asks which first and sends it as `createInstance.kind`.
|
|
54463
|
+
*/
|
|
54464
|
+
kinds: array(IntegrationInstanceKindSchema).optional(),
|
|
54465
|
+
/**
|
|
54466
|
+
* The provider accepts `createInstance.id` for an id that once existed (an adopted id, because
|
|
54467
|
+
* devices carry it). The UI then offers "restore under its old id" on Add. Absent means no.
|
|
54468
|
+
*/
|
|
54469
|
+
allowRestoreId: boolean().optional(),
|
|
54470
|
+
/**
|
|
54471
|
+
* `createInstance` without an `id` works: the provider mints it. Absent means the caller must
|
|
54472
|
+
* send an id (the UI then mints an opaque one).
|
|
54473
|
+
*/
|
|
54474
|
+
mintsId: boolean().optional()
|
|
54299
54475
|
});
|
|
54300
54476
|
var IntegrationInstanceStatusSchema = object({
|
|
54301
54477
|
state: _enum([
|
|
@@ -54304,7 +54480,9 @@ var IntegrationInstanceStatusSchema = object({
|
|
|
54304
54480
|
"error",
|
|
54305
54481
|
"unknown"
|
|
54306
54482
|
]),
|
|
54307
|
-
detail: string().optional()
|
|
54483
|
+
detail: string().optional(),
|
|
54484
|
+
/** A short human word for the state ("Signed in", "Token expired"); shown instead of `state`. */
|
|
54485
|
+
label: string().optional()
|
|
54308
54486
|
});
|
|
54309
54487
|
var IntegrationInstanceSchema = object({
|
|
54310
54488
|
id: IntegrationInstanceIdSchema,
|
|
@@ -54316,9 +54494,13 @@ var IntegrationInstanceSchema = object({
|
|
|
54316
54494
|
* (`enabled !== false`, so a row written before the field existed is on).
|
|
54317
54495
|
*/
|
|
54318
54496
|
enabled: boolean(),
|
|
54497
|
+
/** The kind of this instance (one of `describe().kinds[].id`), when the provider has kinds. */
|
|
54498
|
+
kind: string().optional(),
|
|
54319
54499
|
/** Values for the instance form; a secret is a `SecretFieldView`, never text. */
|
|
54320
54500
|
formValues: record(string(), unknown()),
|
|
54321
|
-
status: IntegrationInstanceStatusSchema.optional()
|
|
54501
|
+
status: IntegrationInstanceStatusSchema.optional(),
|
|
54502
|
+
/** Epoch ms of the last probe of the remote that produced `status`; absent when never checked. */
|
|
54503
|
+
lastCheckedAt: number().optional()
|
|
54322
54504
|
});
|
|
54323
54505
|
var IntegrationInstancePatchSchema = object({
|
|
54324
54506
|
id: IntegrationInstanceIdSchema,
|
|
@@ -54336,10 +54518,14 @@ var integrationInstancesCapability = {
|
|
|
54336
54518
|
instanceFormSchema: method(object({ id: IntegrationInstanceIdSchema.nullable() }), ConfigSchemaPassthrough$3, { auth: "admin" }),
|
|
54337
54519
|
listInstances: method(_void(), array(IntegrationInstanceSchema).readonly(), { auth: "admin" }),
|
|
54338
54520
|
getInstance: method(object({ id: IntegrationInstanceIdSchema }), IntegrationInstanceSchema.nullable(), { auth: "admin" }),
|
|
54339
|
-
/**
|
|
54521
|
+
/**
|
|
54522
|
+
* Insert the typed record. With `id` it is stored under that id (a duplicate id is refused);
|
|
54523
|
+
* without one the PROVIDER mints it and answers it. `kind` picks one of `describe().kinds`.
|
|
54524
|
+
*/
|
|
54340
54525
|
createInstance: method(object({
|
|
54341
|
-
id: IntegrationInstanceIdSchema,
|
|
54342
|
-
name: string().min(1)
|
|
54526
|
+
id: IntegrationInstanceIdSchema.optional(),
|
|
54527
|
+
name: string().min(1),
|
|
54528
|
+
kind: string().min(1).optional()
|
|
54343
54529
|
}), object({ id: string() }), {
|
|
54344
54530
|
kind: "mutation",
|
|
54345
54531
|
auth: "admin"
|
|
@@ -56171,6 +56357,11 @@ var LogEntrySchema = object({
|
|
|
56171
56357
|
* flight, and not asking for the next slice ends the scan.
|
|
56172
56358
|
*/
|
|
56173
56359
|
var LogReadQuerySchema = object({
|
|
56360
|
+
/**
|
|
56361
|
+
* Which destination INSTANCE answers (a destination addon may hold several records). Absent ⇒
|
|
56362
|
+
* the provider's first readable one, so a caller written before instances existed is unchanged.
|
|
56363
|
+
*/
|
|
56364
|
+
instanceId: string().min(1).max(200).optional(),
|
|
56174
56365
|
/** Correlates `cancelRead`. Caller-chosen, unique per in-flight read. */
|
|
56175
56366
|
requestId: string().min(1).max(64).optional(),
|
|
56176
56367
|
/** The device the line is about (`tags.deviceId`, numeric). */
|
|
@@ -56233,6 +56424,8 @@ var LogReadResultSchema = object({
|
|
|
56233
56424
|
/** True when `cancelRead` ended this slice early. */
|
|
56234
56425
|
cancelled: boolean().optional()
|
|
56235
56426
|
});
|
|
56427
|
+
/** Names one destination instance; absent ⇒ the provider's first readable one. */
|
|
56428
|
+
var LogInstanceSelectorSchema = object({ instanceId: string().min(1).max(200).optional() });
|
|
56236
56429
|
var LogReadCapabilitiesSchema = object({
|
|
56237
56430
|
/** False ⇒ this destination only ships lines (console, forwarder, an unconfigured Loki). */
|
|
56238
56431
|
readable: boolean(),
|
|
@@ -56251,7 +56444,7 @@ var LogReadCapabilitiesSchema = object({
|
|
|
56251
56444
|
/** How far back the store reaches, when the provider knows (days). */
|
|
56252
56445
|
retentionDays: number().nullable()
|
|
56253
56446
|
});
|
|
56254
|
-
method(LogEntrySchema, _void(), { kind: "mutation" }), optionalMethod(
|
|
56447
|
+
method(LogEntrySchema, _void(), { kind: "mutation" }), optionalMethod(LogInstanceSelectorSchema, LogReadCapabilitiesSchema, { auth: "admin" }), optionalMethod(LogReadQuerySchema, LogReadResultSchema, { auth: "admin" }), optionalMethod(object({ requestId: string().min(1).max(64) }), object({ cancelled: boolean() }), {
|
|
56255
56448
|
kind: "mutation",
|
|
56256
56449
|
auth: "admin"
|
|
56257
56450
|
});
|
|
@@ -67839,6 +68032,49 @@ object({
|
|
|
67839
68032
|
DeviceType.PetFeeder,
|
|
67840
68033
|
DeviceType.Heater
|
|
67841
68034
|
].filter((type) => type !== DeviceType.Sensor);
|
|
68035
|
+
var PowerSourceRefusalReasonSchema = _enum([
|
|
68036
|
+
"no-power-source",
|
|
68037
|
+
"switch-missing",
|
|
68038
|
+
"switch-offline",
|
|
68039
|
+
"switch-unknown",
|
|
68040
|
+
"restart-in-progress",
|
|
68041
|
+
"switch-call-failed"
|
|
68042
|
+
]);
|
|
68043
|
+
var PowerSourceActionResultSchema = discriminatedUnion("accepted", [object({ accepted: literal(true) }), object({
|
|
68044
|
+
accepted: literal(false),
|
|
68045
|
+
reason: PowerSourceRefusalReasonSchema,
|
|
68046
|
+
/** One line for the operator, naming the switch. */
|
|
68047
|
+
message: string()
|
|
68048
|
+
})]);
|
|
68049
|
+
var PowerSourceInfoSchema = object({
|
|
68050
|
+
/** False when the device has no power source linked; the rest is then empty. */
|
|
68051
|
+
linked: boolean(),
|
|
68052
|
+
switchDeviceId: number().nullable(),
|
|
68053
|
+
switchName: string().nullable(),
|
|
68054
|
+
/** The switch's on/off state, or null when it is unknown. Never false for unknown (D393). */
|
|
68055
|
+
switchOn: boolean().nullable(),
|
|
68056
|
+
switchOnline: boolean().nullable(),
|
|
68057
|
+
restartInProgress: boolean(),
|
|
68058
|
+
offSeconds: number().int()
|
|
68059
|
+
});
|
|
68060
|
+
object({
|
|
68061
|
+
/** Null while the switch has not reported: unknown is never `false` (D393). */
|
|
68062
|
+
switchOn: boolean().nullable(),
|
|
68063
|
+
offSeconds: number().int(),
|
|
68064
|
+
lastFetchedAt: number()
|
|
68065
|
+
});
|
|
68066
|
+
DeviceType.Gateway, DeviceType.Hub, DeviceType.Camera, DeviceType.Sensor, DeviceType.MediaPlayer, DeviceType.Vacuum, DeviceType.Generic, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.PetFountain, DeviceType.Fan, DeviceType.Humidifier, DeviceType.Climate, DeviceType.WaterHeater;
|
|
68067
|
+
var deviceInput$1 = object({ deviceId: number().int().nonnegative() });
|
|
68068
|
+
systemMethod(deviceInput$1, PowerSourceInfoSchema, { auth: "admin" }), systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
|
|
68069
|
+
kind: "mutation",
|
|
68070
|
+
auth: "admin"
|
|
68071
|
+
}), systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
|
|
68072
|
+
kind: "mutation",
|
|
68073
|
+
auth: "admin"
|
|
68074
|
+
}), systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
|
|
68075
|
+
kind: "mutation",
|
|
68076
|
+
auth: "admin"
|
|
68077
|
+
});
|
|
67842
68078
|
/**
|
|
67843
68079
|
* Presence cap. Models HA `person.*` and `device_tracker.*` entities
|
|
67844
68080
|
* on `DeviceType.Presence`. Read-only — no setters: presence is
|
|
@@ -75911,6 +76147,25 @@ function buildDescriptor(capName, kind) {
|
|
|
75911
76147
|
* contributes one entry per bound cap present in this map.
|
|
75912
76148
|
*/
|
|
75913
76149
|
var EVENT_KIND_BY_CAP = Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
|
|
76150
|
+
/**
|
|
76151
|
+
* What a remote key is CALLED and what it LOOKS like, for every role (D963),
|
|
76152
|
+
* shared by the admin UI and the viewer. A role is data on the wire; each
|
|
76153
|
+
* client resolves its name from `label` (English and Italian side by side) and
|
|
76154
|
+
* its glyph from `icon`, a lucide id from the shared icon catalogue — the
|
|
76155
|
+
* server sends an id, a client maps it to its own icon set.
|
|
76156
|
+
*
|
|
76157
|
+
* `legend` is text printed on the key INSTEAD of a glyph (a digit has no
|
|
76158
|
+
* pictogram): a client that can draw text shows it, one that cannot falls back
|
|
76159
|
+
* to `icon`.
|
|
76160
|
+
*/
|
|
76161
|
+
function digit(n) {
|
|
76162
|
+
return {
|
|
76163
|
+
label: t(n, n),
|
|
76164
|
+
icon: "hash",
|
|
76165
|
+
legend: n
|
|
76166
|
+
};
|
|
76167
|
+
}
|
|
76168
|
+
digit("0"), digit("1"), digit("2"), digit("3"), digit("4"), digit("5"), digit("6"), digit("7"), digit("8"), digit("9");
|
|
75914
76169
|
DeviceFeature.MediaPlayerPower, DeviceFeature.MediaPlayerVolumeStep, DeviceFeature.MediaPlayerChannelStep, DeviceFeature.MediaPlayerMute, DeviceFeature.MediaPlayerStop, DeviceFeature.MediaPlayerNext, DeviceFeature.MediaPlayerPrevious;
|
|
75915
76170
|
var btn = (idSuffix, row, col, init) => ({
|
|
75916
76171
|
idSuffix,
|
|
@@ -76038,6 +76293,34 @@ discriminatedUnion("kind", [object({
|
|
|
76038
76293
|
kind: literal("pronto"),
|
|
76039
76294
|
code: string()
|
|
76040
76295
|
})]);
|
|
76296
|
+
/**
|
|
76297
|
+
* Propose a running threshold from a device's own power history (planning#405).
|
|
76298
|
+
*
|
|
76299
|
+
* Pure and deterministic: the same series gives the same answer. The series is
|
|
76300
|
+
* a HELD-VALUE step series — a point's value stands until the next point — which
|
|
76301
|
+
* is how device-history stores a gauge, so "time at a level" is exact, not a
|
|
76302
|
+
* count of samples.
|
|
76303
|
+
*
|
|
76304
|
+
* 1. idle floor F = time-weighted median; noise ceiling N = highest value seen
|
|
76305
|
+
* near F. A device that is not near one level most of the time has no floor.
|
|
76306
|
+
* 2. coarse activity = above max(2N, N + 5 W); consecutive stretches are episodes.
|
|
76307
|
+
* 3. gaps between episodes split in two by the largest log-scale jump (>= 3x):
|
|
76308
|
+
* the short ones are pauses INSIDE a run (a soak), the long ones separate runs.
|
|
76309
|
+
* 4. T = geometric mean of N and the plateau's 10th percentile, snapped to a
|
|
76310
|
+
* grid a person would type; stop dwell covers the longest pause; start dwell
|
|
76311
|
+
* covers the longest standby blip above T.
|
|
76312
|
+
* 5. the numbers are proved by REPLAY through the real `dwell` evaluation: each
|
|
76313
|
+
* run must hold exactly one true interval and nothing may flap outside.
|
|
76314
|
+
*/
|
|
76315
|
+
var SECOND_MS = 1e3;
|
|
76316
|
+
var MINUTE_MS$1 = 60 * SECOND_MS;
|
|
76317
|
+
24 * (60 * MINUTE_MS$1);
|
|
76318
|
+
10 * MINUTE_MS$1;
|
|
76319
|
+
30 * SECOND_MS;
|
|
76320
|
+
60 * SECOND_MS;
|
|
76321
|
+
20 * MINUTE_MS$1;
|
|
76322
|
+
10 * SECOND_MS;
|
|
76323
|
+
10 * SECOND_MS;
|
|
76041
76324
|
DeviceFeature.FanSpeed, DeviceFeature.FanPreset, DeviceFeature.FanDirection, DeviceFeature.FanOscillating, DeviceFeature.CoverStoppable, DeviceFeature.CoverPositionable, DeviceFeature.CoverTilt, DeviceFeature.ValvePositionable, DeviceFeature.MediaPlayerVolume, DeviceFeature.ClimateFanMode;
|
|
76042
76325
|
SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
|
|
76043
76326
|
String.raw`rose\(active(\d+), changed(\d+), (\d+(?:\.\d+)?)\)`;
|
|
@@ -77579,6 +77862,13 @@ Object.freeze({
|
|
|
77579
77862
|
access: "create",
|
|
77580
77863
|
role: "admin"
|
|
77581
77864
|
},
|
|
77865
|
+
"coreBlocks.proposeRunningThreshold": {
|
|
77866
|
+
capName: "core-blocks",
|
|
77867
|
+
capScope: "system",
|
|
77868
|
+
addonId: null,
|
|
77869
|
+
access: "view",
|
|
77870
|
+
role: "admin"
|
|
77871
|
+
},
|
|
77582
77872
|
"coreBlocks.reportAutomationRun": {
|
|
77583
77873
|
capName: "core-blocks",
|
|
77584
77874
|
capScope: "system",
|
|
@@ -78090,6 +78380,13 @@ Object.freeze({
|
|
|
78090
78380
|
access: "view",
|
|
78091
78381
|
role: "admin"
|
|
78092
78382
|
},
|
|
78383
|
+
"deviceExport.listInstances": {
|
|
78384
|
+
capName: "device-export",
|
|
78385
|
+
capScope: "system",
|
|
78386
|
+
addonId: null,
|
|
78387
|
+
access: "view",
|
|
78388
|
+
role: "admin"
|
|
78389
|
+
},
|
|
78093
78390
|
"deviceExport.listSupportedDeviceKinds": {
|
|
78094
78391
|
capName: "device-export",
|
|
78095
78392
|
capScope: "system",
|
|
@@ -87062,6 +87359,11 @@ Object.freeze({
|
|
|
87062
87359
|
form: "single",
|
|
87063
87360
|
optional: false
|
|
87064
87361
|
}],
|
|
87362
|
+
"coreBlocks.proposeRunningThreshold": [{
|
|
87363
|
+
name: "deviceId",
|
|
87364
|
+
form: "single",
|
|
87365
|
+
optional: false
|
|
87366
|
+
}],
|
|
87065
87367
|
"cover.close": [{
|
|
87066
87368
|
name: "deviceId",
|
|
87067
87369
|
form: "single",
|
|
@@ -89725,99 +90027,6 @@ Object.freeze({
|
|
|
89725
90027
|
"network-access": "ingress",
|
|
89726
90028
|
"smtp-provider": "email"
|
|
89727
90029
|
});
|
|
89728
|
-
/**
|
|
89729
|
-
* A saved Customize assignment (D936). The schema is the type: callers use
|
|
89730
|
-
* `z.infer`, they do not restate the shape.
|
|
89731
|
-
*/
|
|
89732
|
-
var OverrideSourceSchema = object({
|
|
89733
|
-
addonId: string().min(1),
|
|
89734
|
-
stableId: string().min(1),
|
|
89735
|
-
cap: string().min(1),
|
|
89736
|
-
fieldPath: string().min(1)
|
|
89737
|
-
});
|
|
89738
|
-
var CustomizeTransformDraftSchema = discriminatedUnion("kind", [
|
|
89739
|
-
object({ kind: literal("identity") }),
|
|
89740
|
-
object({ kind: literal("invert") }),
|
|
89741
|
-
object({
|
|
89742
|
-
kind: literal("threshold"),
|
|
89743
|
-
comparison: _enum(["gte", "lte"]),
|
|
89744
|
-
threshold: number(),
|
|
89745
|
-
startDwellMs: number().nonnegative(),
|
|
89746
|
-
stopDwellMs: number().nonnegative()
|
|
89747
|
-
}),
|
|
89748
|
-
object({
|
|
89749
|
-
kind: literal("linear"),
|
|
89750
|
-
scale: number(),
|
|
89751
|
-
offset: number(),
|
|
89752
|
-
clampMin: number().optional(),
|
|
89753
|
-
clampMax: number().optional()
|
|
89754
|
-
}),
|
|
89755
|
-
object({
|
|
89756
|
-
kind: literal("enum-map"),
|
|
89757
|
-
mapping: record(string(), string().nullable())
|
|
89758
|
-
}),
|
|
89759
|
-
object({ kind: literal("number") })
|
|
89760
|
-
]);
|
|
89761
|
-
var ScalarOverrideDraftSchema = object({
|
|
89762
|
-
kind: literal("scalar"),
|
|
89763
|
-
cap: string().min(1),
|
|
89764
|
-
targetId: string().min(1),
|
|
89765
|
-
source: OverrideSourceSchema,
|
|
89766
|
-
transform: CustomizeTransformDraftSchema
|
|
89767
|
-
});
|
|
89768
|
-
var KeyedArrayOverrideDraftSchema = object({
|
|
89769
|
-
kind: literal("keyedArray"),
|
|
89770
|
-
cap: string().min(1),
|
|
89771
|
-
targetId: string().min(1),
|
|
89772
|
-
key: string().min(1),
|
|
89773
|
-
label: string().min(1),
|
|
89774
|
-
fieldPath: string().min(1),
|
|
89775
|
-
source: OverrideSourceSchema,
|
|
89776
|
-
transform: CustomizeTransformDraftSchema
|
|
89777
|
-
});
|
|
89778
|
-
var PulseOverrideDraftSchema = object({
|
|
89779
|
-
kind: literal("pulse"),
|
|
89780
|
-
cap: string().min(1),
|
|
89781
|
-
targetId: string().min(1),
|
|
89782
|
-
enabled: boolean(),
|
|
89783
|
-
debounceMs: number().nonnegative(),
|
|
89784
|
-
edges: array(_enum([
|
|
89785
|
-
"rising",
|
|
89786
|
-
"button",
|
|
89787
|
-
"native-event"
|
|
89788
|
-
])).min(1).optional(),
|
|
89789
|
-
sources: array(OverrideSourceSchema).min(1)
|
|
89790
|
-
});
|
|
89791
|
-
var SpanSourceDraftSchema = OverrideSourceSchema.extend({ mode: _enum([
|
|
89792
|
-
"in-addition",
|
|
89793
|
-
"confirm",
|
|
89794
|
-
"replace"
|
|
89795
|
-
]).optional() });
|
|
89796
|
-
discriminatedUnion("kind", [
|
|
89797
|
-
ScalarOverrideDraftSchema,
|
|
89798
|
-
KeyedArrayOverrideDraftSchema,
|
|
89799
|
-
PulseOverrideDraftSchema,
|
|
89800
|
-
object({
|
|
89801
|
-
kind: literal("span"),
|
|
89802
|
-
cap: string().min(1),
|
|
89803
|
-
targetId: string().min(1),
|
|
89804
|
-
timeoutMs: number().nonnegative(),
|
|
89805
|
-
cooldownMs: number().nonnegative().optional(),
|
|
89806
|
-
sources: array(SpanSourceDraftSchema)
|
|
89807
|
-
})
|
|
89808
|
-
]);
|
|
89809
|
-
object({
|
|
89810
|
-
targetId: string().min(1),
|
|
89811
|
-
configured: boolean(),
|
|
89812
|
-
source: _enum(["native", "assigned"]),
|
|
89813
|
-
state: _enum([
|
|
89814
|
-
"active",
|
|
89815
|
-
"stale",
|
|
89816
|
-
"released",
|
|
89817
|
-
"unavailable"
|
|
89818
|
-
]),
|
|
89819
|
-
reason: string().nullable()
|
|
89820
|
-
});
|
|
89821
90030
|
var G711_SCALE_CORRECTION_DB = {
|
|
89822
90031
|
PCMU: 20 * Math.log10(4),
|
|
89823
90032
|
PCMA: 20 * Math.log10(8)
|
|
@@ -101965,8 +102174,17 @@ async function moveLedgersToLinks(ports) {
|
|
|
101965
102174
|
linkedAccounts,
|
|
101966
102175
|
tokens
|
|
101967
102176
|
});
|
|
101968
|
-
|
|
101969
|
-
|
|
102177
|
+
let held = await ports.readLinks();
|
|
102178
|
+
const matches = (record) => record !== null && canonical(record.linkedAccounts) === canonical(linkedAccounts) && canonical(record.tokens) === canonical(tokens);
|
|
102179
|
+
if (put === "exists" && !matches(held) && isCoveredBy(held, linkedAccounts, tokens)) {
|
|
102180
|
+
await ports.replaceLinks({
|
|
102181
|
+
name: LINKS_NAME,
|
|
102182
|
+
linkedAccounts,
|
|
102183
|
+
tokens
|
|
102184
|
+
});
|
|
102185
|
+
held = await ports.readLinks();
|
|
102186
|
+
}
|
|
102187
|
+
if (!matches(held)) {
|
|
101970
102188
|
ports.warn("Alexa migration: the skill-links record does not hold what the settings carried; the legacy ledgers are kept");
|
|
101971
102189
|
if (put === "created") throw new Error("the Alexa link record does not match the legacy settings; nothing was cleared");
|
|
101972
102190
|
return {
|
|
@@ -101982,10 +102200,32 @@ async function moveLedgersToLinks(ports) {
|
|
|
101982
102200
|
accounts: linkedAccounts.length
|
|
101983
102201
|
}
|
|
101984
102202
|
} : {
|
|
101985
|
-
outcome: "
|
|
101986
|
-
summary: {
|
|
102203
|
+
outcome: "done",
|
|
102204
|
+
summary: {
|
|
102205
|
+
moved: true,
|
|
102206
|
+
repaired: true,
|
|
102207
|
+
accounts: linkedAccounts.length
|
|
102208
|
+
}
|
|
101987
102209
|
};
|
|
101988
102210
|
}
|
|
102211
|
+
/**
|
|
102212
|
+
* The record carries this migration's own name and every account and grant it holds is also in
|
|
102213
|
+
* the settings: rewriting it loses nothing and touches nothing an operator named.
|
|
102214
|
+
*/
|
|
102215
|
+
function isCoveredBy(held, linkedAccounts, tokens) {
|
|
102216
|
+
if (held === null || held.name !== LINKS_NAME) return false;
|
|
102217
|
+
const accounts = new Set(linkedAccounts.map((a) => a.userId));
|
|
102218
|
+
const grants = new Set(tokens.map((t) => t.userId));
|
|
102219
|
+
return held.linkedAccounts.every((a) => accounts.has(a.userId)) && held.tokens.every((t) => grants.has(t.userId));
|
|
102220
|
+
}
|
|
102221
|
+
/**
|
|
102222
|
+
* A ledger key the drop may judge: absent, a list, or the leftover of a credential clear
|
|
102223
|
+
* (`{ $secretClear: true }`, stored where a list belongs by an older build). Anything else is
|
|
102224
|
+
* not understood, so nothing is deleted on its account.
|
|
102225
|
+
*/
|
|
102226
|
+
function isLedgerShape(value) {
|
|
102227
|
+
return value === void 0 || Array.isArray(value) || isSecretClear(value);
|
|
102228
|
+
}
|
|
101989
102229
|
/** Whether a stored token entry still carries a credential: text, or a keychain marker. */
|
|
101990
102230
|
function carriesCredential(entry) {
|
|
101991
102231
|
if (typeof entry !== "object" || entry === null) return false;
|
|
@@ -102013,11 +102253,17 @@ async function planDropMovedSettings(ports) {
|
|
|
102013
102253
|
if (ledgerKeys.length > 0) {
|
|
102014
102254
|
const links = await ports.readLinks();
|
|
102015
102255
|
if (links === null) return refuse("no Alexa link record exists");
|
|
102016
|
-
|
|
102017
|
-
|
|
102256
|
+
if (!isLedgerShape(stored["linkedAccounts"])) return refuse("the old linkedAccounts setting is not a list the migration understands");
|
|
102257
|
+
if (!isLedgerShape(stored["tokens"])) return refuse("the old tokens setting is not a list the migration understands");
|
|
102018
102258
|
const legacyTokens = stored["tokens"];
|
|
102019
102259
|
if (Array.isArray(legacyTokens) && legacyTokens.some(carriesCredential)) return refuse("the old settings still carry Amazon push credentials");
|
|
102020
|
-
|
|
102260
|
+
const heldAccounts = new Map(links.linkedAccounts.map((a) => [a.userId, a]));
|
|
102261
|
+
const heldTokens = new Set(links.tokens.map((t) => t.userId));
|
|
102262
|
+
for (const account of accountsOf(stored["linkedAccounts"])) {
|
|
102263
|
+
const held = heldAccounts.get(account.userId);
|
|
102264
|
+
if (held === void 0) return refuse(`the record lacks the account ${account.userId}`);
|
|
102265
|
+
if (canonical(held) !== canonical(account)) return refuse(`the record holds the account ${account.userId} differently`);
|
|
102266
|
+
}
|
|
102021
102267
|
for (const token of tokensOf(stored["tokens"])) if (!heldTokens.has(token.userId)) return refuse(`the record lacks the grant ${token.userId}`);
|
|
102022
102268
|
}
|
|
102023
102269
|
const present = [...skillKeys, ...ledgerKeys];
|
|
@@ -103456,6 +103702,8 @@ function hasUnresolvedCredential(entry) {
|
|
|
103456
103702
|
if (typeof entry !== "object" || entry === null) return false;
|
|
103457
103703
|
return "accessToken" in entry && isSecretMarker(entry.accessToken) || "refreshToken" in entry && isSecretMarker(entry.refreshToken) || "brokerCredential" in entry && isSecretMarker(entry.brokerCredential);
|
|
103458
103704
|
}
|
|
103705
|
+
/** The one export instance this addon serves. */
|
|
103706
|
+
var EXPORT_ALEXA_ADDON_ID = "export-alexa";
|
|
103459
103707
|
var ExportAlexaAddon = class extends BaseAddon {
|
|
103460
103708
|
/** Hidden state that is a credential — kept in the keychain, never the blob (D787). */
|
|
103461
103709
|
secretStatePaths = [
|
|
@@ -103499,15 +103747,31 @@ var ExportAlexaAddon = class extends BaseAddon {
|
|
|
103499
103747
|
/** The keychain refused the link credentials: the ledger is read-only until it answers (D49). */
|
|
103500
103748
|
linksLocked = false;
|
|
103501
103749
|
/**
|
|
103750
|
+
* The legacy ledger keys as lists. A store written by an older build may hold something that
|
|
103751
|
+
* is not a list there (a clear instruction stored as the value); the page and the gateway read
|
|
103752
|
+
* a list or nothing.
|
|
103753
|
+
*/
|
|
103754
|
+
legacyLedgers() {
|
|
103755
|
+
return {
|
|
103756
|
+
linkedAccounts: Array.isArray(this.config.linkedAccounts) ? this.config.linkedAccounts : [],
|
|
103757
|
+
tokens: Array.isArray(this.config.tokens) ? this.config.tokens : []
|
|
103758
|
+
};
|
|
103759
|
+
}
|
|
103760
|
+
/**
|
|
103502
103761
|
* The settings as the addon reads them: the records where they exist, the legacy keys until
|
|
103503
103762
|
* the migrations have moved them.
|
|
103504
103763
|
*/
|
|
103505
103764
|
get view() {
|
|
103506
103765
|
const skill = this.skillRow;
|
|
103507
103766
|
const links = this.linksRow;
|
|
103508
|
-
|
|
103767
|
+
const legacy = this.legacyLedgers();
|
|
103768
|
+
if (skill === null && links === null) return {
|
|
103769
|
+
...this.config,
|
|
103770
|
+
...legacy
|
|
103771
|
+
};
|
|
103509
103772
|
return {
|
|
103510
103773
|
...this.config,
|
|
103774
|
+
...legacy,
|
|
103511
103775
|
...skill === null ? {} : {
|
|
103512
103776
|
skillMode: skill.skillMode,
|
|
103513
103777
|
region: skill.region,
|
|
@@ -103606,30 +103870,55 @@ var ExportAlexaAddon = class extends BaseAddon {
|
|
|
103606
103870
|
actionScenes.reconcile().catch((err) => {
|
|
103607
103871
|
this.ctx.logger.warn("export-alexa: action scene reconcile at boot failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
103608
103872
|
});
|
|
103873
|
+
const ownInstance = (instanceId) => assertOwnExportInstance("export-alexa", EXPORT_ALEXA_ADDON_ID, instanceId);
|
|
103609
103874
|
const deviceExportProvider = {
|
|
103610
|
-
getStatus: async () =>
|
|
103611
|
-
|
|
103612
|
-
|
|
103613
|
-
|
|
103614
|
-
|
|
103615
|
-
|
|
103616
|
-
|
|
103617
|
-
|
|
103618
|
-
|
|
103875
|
+
getStatus: async (input) => {
|
|
103876
|
+
ownInstance(statusInstanceOf(input));
|
|
103877
|
+
return {
|
|
103878
|
+
linkState: this.view.linkedAccounts.length > 0 ? "linked" : "unlinked",
|
|
103879
|
+
exposedDeviceCount: this.config.exposed.length,
|
|
103880
|
+
setup: await this.buildSetupBlock()
|
|
103881
|
+
};
|
|
103882
|
+
},
|
|
103883
|
+
listInstances: async () => [{
|
|
103884
|
+
instanceId: EXPORT_ALEXA_ADDON_ID,
|
|
103885
|
+
name: "Alexa",
|
|
103886
|
+
enabled: true,
|
|
103887
|
+
kind: "alexa-skill"
|
|
103888
|
+
}],
|
|
103889
|
+
listSupportedDeviceKinds: async ({ instanceId }) => {
|
|
103890
|
+
ownInstance(instanceId);
|
|
103891
|
+
return [...SUPPORTED_KINDS];
|
|
103892
|
+
},
|
|
103893
|
+
listExposedDevices: async ({ instanceId }) => {
|
|
103894
|
+
ownInstance(instanceId);
|
|
103895
|
+
return this.config.exposed.map((e) => ({ deviceId: String(e.deviceId) }));
|
|
103896
|
+
},
|
|
103897
|
+
exposeDevice: async ({ instanceId, deviceId }) => {
|
|
103898
|
+
ownInstance(instanceId);
|
|
103899
|
+
return this.exposeDevice(deviceId);
|
|
103900
|
+
},
|
|
103901
|
+
unexposeDevice: async ({ instanceId, deviceId }) => {
|
|
103902
|
+
ownInstance(instanceId);
|
|
103903
|
+
return this.unexposeDevice(deviceId);
|
|
103904
|
+
},
|
|
103619
103905
|
listSupportedEntityKinds: async () => ["device", "action"],
|
|
103620
|
-
listExposedEntities: async () => {
|
|
103906
|
+
listExposedEntities: async ({ instanceId }) => {
|
|
103907
|
+
ownInstance(instanceId);
|
|
103621
103908
|
await actionScenes.reconcile();
|
|
103622
103909
|
return [...this.config.exposed.map((e) => ({ entity: {
|
|
103623
103910
|
kind: "device",
|
|
103624
103911
|
deviceId: String(e.deviceId)
|
|
103625
103912
|
} })), ...actionScenes.list()];
|
|
103626
103913
|
},
|
|
103627
|
-
exposeEntity: async ({ entity }) => {
|
|
103914
|
+
exposeEntity: async ({ instanceId, entity }) => {
|
|
103915
|
+
ownInstance(instanceId);
|
|
103628
103916
|
if (entity.kind === "device") return this.exposeDevice(entity.deviceId);
|
|
103629
103917
|
if (entity.kind === "action") return actionScenes.expose(entity.actionId);
|
|
103630
103918
|
throw new Error("export-alexa: a notification target cannot be exported to Alexa");
|
|
103631
103919
|
},
|
|
103632
|
-
unexposeEntity: async ({ entity }) => {
|
|
103920
|
+
unexposeEntity: async ({ instanceId, entity }) => {
|
|
103921
|
+
ownInstance(instanceId);
|
|
103633
103922
|
if (entity.kind === "device") return this.unexposeDevice(entity.deviceId);
|
|
103634
103923
|
if (entity.kind === "action") return actionScenes.unexpose(entity.actionId);
|
|
103635
103924
|
throw new Error("export-alexa: a notification target cannot be exported to Alexa");
|
|
@@ -104471,6 +104760,12 @@ var ExportAlexaAddon = class extends BaseAddon {
|
|
|
104471
104760
|
},
|
|
104472
104761
|
putSkill: (body) => putOnce(skills, body),
|
|
104473
104762
|
putLinks: (body) => putOnce(links, body),
|
|
104763
|
+
replaceLinks: async (body) => {
|
|
104764
|
+
await links.put({
|
|
104765
|
+
id: ALEXA_INSTANCE_ID,
|
|
104766
|
+
data: body
|
|
104767
|
+
});
|
|
104768
|
+
},
|
|
104474
104769
|
readLinks: async () => (await links.getResolved("export-alexa"))?.data ?? null,
|
|
104475
104770
|
hasSkill: async () => await skills.get(ALEXA_INSTANCE_ID) !== null,
|
|
104476
104771
|
clearOldTokenSecrets: async () => {
|