@camstack/addon-matter-broker 0.2.126 → 0.2.128
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/dist/addon.js +1749 -136
- package/dist/addon.mjs +1749 -136
- package/package.json +1 -1
package/dist/addon.mjs
CHANGED
|
@@ -11,7 +11,7 @@ import { networkInterfaces, tmpdir, uptime } from "node:os";
|
|
|
11
11
|
import { finished } from "node:stream/promises";
|
|
12
12
|
import { createConnection, createServer as createServer$2 } from "node:net";
|
|
13
13
|
import * as dgram from "node:dgram";
|
|
14
|
-
//#region ../types/dist/event-category-
|
|
14
|
+
//#region ../types/dist/event-category-BvOFi6PY.mjs
|
|
15
15
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
16
16
|
EventCategory["SystemBoot"] = "system.boot";
|
|
17
17
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -75,6 +75,24 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
75
75
|
* consumes this category and maps it to the `addon-crash-loop` kind.
|
|
76
76
|
*/
|
|
77
77
|
EventCategory["AddonRunnerFailed"] = "addon.runner-failed";
|
|
78
|
+
/**
|
|
79
|
+
* A runner whose addon refused to start with a typed reason (D877) - parked
|
|
80
|
+
* in `refused`, never counted by the crash breaker, retried on operator
|
|
81
|
+
* action. One event per refusal.
|
|
82
|
+
*/
|
|
83
|
+
EventCategory["AddonRunnerRefused"] = "addon.runner-refused";
|
|
84
|
+
/**
|
|
85
|
+
* A runner settled on a state (D877): `running` (READY), `crashed`, `failed` or
|
|
86
|
+
* `refused`. In-process telemetry for the boot check (re-evaluate while any
|
|
87
|
+
* runner is still pending) and the alert centre (close a recovered runner).
|
|
88
|
+
*/
|
|
89
|
+
EventCategory["ProcessStateChanged"] = "process.state-changed";
|
|
90
|
+
/**
|
|
91
|
+
* The node's one-shot runner boot check (D877): planned runners against the
|
|
92
|
+
* process service, `degraded` when any is failed, refused or missing. The
|
|
93
|
+
* alert centre turns it into one alert and a direct critical push.
|
|
94
|
+
*/
|
|
95
|
+
EventCategory["SystemRunnerCheck"] = "system.runner-check";
|
|
78
96
|
EventCategory["AddonError"] = "addon.error";
|
|
79
97
|
EventCategory["AddonPageReady"] = "addon.page-ready";
|
|
80
98
|
EventCategory["AddonWidgetReady"] = "addon.widget-ready";
|
|
@@ -4117,6 +4135,12 @@ var numberProcessor = (schema, ctx, _json, _params) => {
|
|
|
4117
4135
|
var booleanProcessor = (_schema, _ctx, json, _params) => {
|
|
4118
4136
|
json.type = "boolean";
|
|
4119
4137
|
};
|
|
4138
|
+
var bigintProcessor = (_schema, ctx, _json, _params) => {
|
|
4139
|
+
if (ctx.unrepresentable === "throw") throw new Error("BigInt cannot be represented in JSON Schema");
|
|
4140
|
+
};
|
|
4141
|
+
var symbolProcessor = (_schema, ctx, _json, _params) => {
|
|
4142
|
+
if (ctx.unrepresentable === "throw") throw new Error("Symbols cannot be represented in JSON Schema");
|
|
4143
|
+
};
|
|
4120
4144
|
var nullProcessor = (_schema, ctx, json, _params) => {
|
|
4121
4145
|
if (ctx.target === "openapi-3.0") {
|
|
4122
4146
|
json.type = "string";
|
|
@@ -4124,12 +4148,17 @@ var nullProcessor = (_schema, ctx, json, _params) => {
|
|
|
4124
4148
|
json.enum = [null];
|
|
4125
4149
|
} else json.type = "null";
|
|
4126
4150
|
};
|
|
4151
|
+
var undefinedProcessor = (_schema, ctx, _json, _params) => {
|
|
4152
|
+
if (ctx.unrepresentable === "throw") throw new Error("Undefined cannot be represented in JSON Schema");
|
|
4153
|
+
};
|
|
4127
4154
|
var voidProcessor = (_schema, ctx, _json, _params) => {
|
|
4128
4155
|
if (ctx.unrepresentable === "throw") throw new Error("Void cannot be represented in JSON Schema");
|
|
4129
4156
|
};
|
|
4130
4157
|
var neverProcessor = (_schema, _ctx, json, _params) => {
|
|
4131
4158
|
json.not = {};
|
|
4132
4159
|
};
|
|
4160
|
+
var anyProcessor = (_schema, _ctx, _json, _params) => {};
|
|
4161
|
+
var unknownProcessor = (_schema, _ctx, _json, _params) => {};
|
|
4133
4162
|
var dateProcessor = (_schema, ctx, _json, _params) => {
|
|
4134
4163
|
if (ctx.unrepresentable === "throw") throw new Error("Date cannot be represented in JSON Schema");
|
|
4135
4164
|
};
|
|
@@ -4161,12 +4190,53 @@ var literalProcessor = (schema, ctx, json, _params) => {
|
|
|
4161
4190
|
json.enum = vals;
|
|
4162
4191
|
}
|
|
4163
4192
|
};
|
|
4193
|
+
var nanProcessor = (_schema, ctx, _json, _params) => {
|
|
4194
|
+
if (ctx.unrepresentable === "throw") throw new Error("NaN cannot be represented in JSON Schema");
|
|
4195
|
+
};
|
|
4196
|
+
var templateLiteralProcessor = (schema, _ctx, json, _params) => {
|
|
4197
|
+
const _json = json;
|
|
4198
|
+
const pattern = schema._zod.pattern;
|
|
4199
|
+
if (!pattern) throw new Error("Pattern not found in template literal");
|
|
4200
|
+
_json.type = "string";
|
|
4201
|
+
_json.pattern = pattern.source;
|
|
4202
|
+
};
|
|
4203
|
+
var fileProcessor = (schema, _ctx, json, _params) => {
|
|
4204
|
+
const _json = json;
|
|
4205
|
+
const file = {
|
|
4206
|
+
type: "string",
|
|
4207
|
+
format: "binary",
|
|
4208
|
+
contentEncoding: "binary"
|
|
4209
|
+
};
|
|
4210
|
+
const { minimum, maximum, mime } = schema._zod.bag;
|
|
4211
|
+
if (minimum !== void 0) file.minLength = minimum;
|
|
4212
|
+
if (maximum !== void 0) file.maxLength = maximum;
|
|
4213
|
+
if (mime) if (mime.length === 1) {
|
|
4214
|
+
file.contentMediaType = mime[0];
|
|
4215
|
+
Object.assign(_json, file);
|
|
4216
|
+
} else {
|
|
4217
|
+
Object.assign(_json, file);
|
|
4218
|
+
_json.anyOf = mime.map((m) => ({ contentMediaType: m }));
|
|
4219
|
+
}
|
|
4220
|
+
else Object.assign(_json, file);
|
|
4221
|
+
};
|
|
4222
|
+
var successProcessor = (_schema, _ctx, json, _params) => {
|
|
4223
|
+
json.type = "boolean";
|
|
4224
|
+
};
|
|
4164
4225
|
var customProcessor = (_schema, ctx, _json, _params) => {
|
|
4165
4226
|
if (ctx.unrepresentable === "throw") throw new Error("Custom types cannot be represented in JSON Schema");
|
|
4166
4227
|
};
|
|
4228
|
+
var functionProcessor = (_schema, ctx, _json, _params) => {
|
|
4229
|
+
if (ctx.unrepresentable === "throw") throw new Error("Function types cannot be represented in JSON Schema");
|
|
4230
|
+
};
|
|
4167
4231
|
var transformProcessor = (_schema, ctx, _json, _params) => {
|
|
4168
4232
|
if (ctx.unrepresentable === "throw") throw new Error("Transforms cannot be represented in JSON Schema");
|
|
4169
4233
|
};
|
|
4234
|
+
var mapProcessor = (_schema, ctx, _json, _params) => {
|
|
4235
|
+
if (ctx.unrepresentable === "throw") throw new Error("Map cannot be represented in JSON Schema");
|
|
4236
|
+
};
|
|
4237
|
+
var setProcessor = (_schema, ctx, _json, _params) => {
|
|
4238
|
+
if (ctx.unrepresentable === "throw") throw new Error("Set cannot be represented in JSON Schema");
|
|
4239
|
+
};
|
|
4170
4240
|
var arrayProcessor = (schema, ctx, _json, params) => {
|
|
4171
4241
|
const json = _json;
|
|
4172
4242
|
const def = schema._zod.def;
|
|
@@ -4371,6 +4441,12 @@ var readonlyProcessor = (schema, ctx, json, params) => {
|
|
|
4371
4441
|
seen.ref = def.innerType;
|
|
4372
4442
|
json.readOnly = true;
|
|
4373
4443
|
};
|
|
4444
|
+
var promiseProcessor = (schema, ctx, _json, params) => {
|
|
4445
|
+
const def = schema._zod.def;
|
|
4446
|
+
process$1(def.innerType, ctx, params);
|
|
4447
|
+
const seen = ctx.seen.get(schema);
|
|
4448
|
+
seen.ref = def.innerType;
|
|
4449
|
+
};
|
|
4374
4450
|
var optionalProcessor = (schema, ctx, _json, params) => {
|
|
4375
4451
|
const def = schema._zod.def;
|
|
4376
4452
|
process$1(def.innerType, ctx, params);
|
|
@@ -4383,6 +4459,81 @@ var lazyProcessor = (schema, ctx, _json, params) => {
|
|
|
4383
4459
|
const seen = ctx.seen.get(schema);
|
|
4384
4460
|
seen.ref = innerType;
|
|
4385
4461
|
};
|
|
4462
|
+
var allProcessors = {
|
|
4463
|
+
string: stringProcessor,
|
|
4464
|
+
number: numberProcessor,
|
|
4465
|
+
boolean: booleanProcessor,
|
|
4466
|
+
bigint: bigintProcessor,
|
|
4467
|
+
symbol: symbolProcessor,
|
|
4468
|
+
null: nullProcessor,
|
|
4469
|
+
undefined: undefinedProcessor,
|
|
4470
|
+
void: voidProcessor,
|
|
4471
|
+
never: neverProcessor,
|
|
4472
|
+
any: anyProcessor,
|
|
4473
|
+
unknown: unknownProcessor,
|
|
4474
|
+
date: dateProcessor,
|
|
4475
|
+
enum: enumProcessor,
|
|
4476
|
+
literal: literalProcessor,
|
|
4477
|
+
nan: nanProcessor,
|
|
4478
|
+
template_literal: templateLiteralProcessor,
|
|
4479
|
+
file: fileProcessor,
|
|
4480
|
+
success: successProcessor,
|
|
4481
|
+
custom: customProcessor,
|
|
4482
|
+
function: functionProcessor,
|
|
4483
|
+
transform: transformProcessor,
|
|
4484
|
+
map: mapProcessor,
|
|
4485
|
+
set: setProcessor,
|
|
4486
|
+
array: arrayProcessor,
|
|
4487
|
+
object: objectProcessor,
|
|
4488
|
+
union: unionProcessor,
|
|
4489
|
+
intersection: intersectionProcessor,
|
|
4490
|
+
tuple: tupleProcessor,
|
|
4491
|
+
record: recordProcessor,
|
|
4492
|
+
nullable: nullableProcessor,
|
|
4493
|
+
nonoptional: nonoptionalProcessor,
|
|
4494
|
+
default: defaultProcessor,
|
|
4495
|
+
prefault: prefaultProcessor,
|
|
4496
|
+
catch: catchProcessor,
|
|
4497
|
+
pipe: pipeProcessor,
|
|
4498
|
+
readonly: readonlyProcessor,
|
|
4499
|
+
promise: promiseProcessor,
|
|
4500
|
+
optional: optionalProcessor,
|
|
4501
|
+
lazy: lazyProcessor
|
|
4502
|
+
};
|
|
4503
|
+
function toJSONSchema(input, params) {
|
|
4504
|
+
if ("_idmap" in input) {
|
|
4505
|
+
const registry = input;
|
|
4506
|
+
const ctx = initializeContext({
|
|
4507
|
+
...params,
|
|
4508
|
+
processors: allProcessors
|
|
4509
|
+
});
|
|
4510
|
+
const defs = {};
|
|
4511
|
+
for (const entry of registry._idmap.entries()) {
|
|
4512
|
+
const [_, schema] = entry;
|
|
4513
|
+
process$1(schema, ctx);
|
|
4514
|
+
}
|
|
4515
|
+
const schemas = {};
|
|
4516
|
+
ctx.external = {
|
|
4517
|
+
registry,
|
|
4518
|
+
uri: params?.uri,
|
|
4519
|
+
defs
|
|
4520
|
+
};
|
|
4521
|
+
for (const entry of registry._idmap.entries()) {
|
|
4522
|
+
const [key, schema] = entry;
|
|
4523
|
+
extractDefs(ctx, schema);
|
|
4524
|
+
schemas[key] = finalize(ctx, schema);
|
|
4525
|
+
}
|
|
4526
|
+
if (Object.keys(defs).length > 0) schemas.__shared = { [ctx.target === "draft-2020-12" ? "$defs" : "definitions"]: defs };
|
|
4527
|
+
return { schemas };
|
|
4528
|
+
}
|
|
4529
|
+
const ctx = initializeContext({
|
|
4530
|
+
...params,
|
|
4531
|
+
processors: allProcessors
|
|
4532
|
+
});
|
|
4533
|
+
process$1(input, ctx);
|
|
4534
|
+
extractDefs(ctx, input);
|
|
4535
|
+
return finalize(ctx, input);
|
|
4536
|
+
}
|
|
4386
4537
|
//#endregion
|
|
4387
4538
|
//#region ../../node_modules/zod/v4/classic/iso.js
|
|
4388
4539
|
var ZodISODateTime = /*@__PURE__*/ $constructor("ZodISODateTime", (inst, def) => {
|
|
@@ -5399,7 +5550,7 @@ var ZodIssueCode = {
|
|
|
5399
5550
|
var ZodFirstPartyTypeKind;
|
|
5400
5551
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5401
5552
|
//#endregion
|
|
5402
|
-
//#region ../types/dist/sleep-
|
|
5553
|
+
//#region ../types/dist/sleep-BOjuyoPC.mjs
|
|
5403
5554
|
/**
|
|
5404
5555
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5405
5556
|
* window to float samples (D455).
|
|
@@ -5516,7 +5667,7 @@ function isKeychainStoredField(field) {
|
|
|
5516
5667
|
var SECRET_CLEAR = { $secretClear: true };
|
|
5517
5668
|
/** The `'***'` token D634 redaction writes for non-admins. */
|
|
5518
5669
|
var LEGACY_DEVICE_REDACTION = "***";
|
|
5519
|
-
function isRecord$
|
|
5670
|
+
function isRecord$5(value) {
|
|
5520
5671
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5521
5672
|
}
|
|
5522
5673
|
function makeSecretMarker(ref) {
|
|
@@ -5527,12 +5678,12 @@ function makeSecretMarker(ref) {
|
|
|
5527
5678
|
}
|
|
5528
5679
|
/** A stored marker: an object whose `$secret` is a non-empty string. */
|
|
5529
5680
|
function isSecretMarker(value) {
|
|
5530
|
-
if (!isRecord$
|
|
5681
|
+
if (!isRecord$5(value)) return false;
|
|
5531
5682
|
const ref = value["$secret"];
|
|
5532
5683
|
return typeof ref === "string" && ref.length > 0;
|
|
5533
5684
|
}
|
|
5534
5685
|
function isSecretClear(value) {
|
|
5535
|
-
return isRecord$
|
|
5686
|
+
return isRecord$5(value) && value["$secretClear"] === true;
|
|
5536
5687
|
}
|
|
5537
5688
|
/**
|
|
5538
5689
|
* The UI view of a stored secret field value: a marker becomes "set", inline
|
|
@@ -6142,7 +6293,7 @@ var KeychainWriteRefusedError = class extends Error {
|
|
|
6142
6293
|
}
|
|
6143
6294
|
};
|
|
6144
6295
|
var KEEP = { kind: "keep" };
|
|
6145
|
-
function isRecord$
|
|
6296
|
+
function isRecord$4(value) {
|
|
6146
6297
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6147
6298
|
}
|
|
6148
6299
|
function defaultMintId() {
|
|
@@ -6155,7 +6306,7 @@ function collectSecretMarkerRefs(value, out = []) {
|
|
|
6155
6306
|
return out;
|
|
6156
6307
|
}
|
|
6157
6308
|
if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
|
|
6158
|
-
else if (isRecord$
|
|
6309
|
+
else if (isRecord$4(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
6159
6310
|
return out;
|
|
6160
6311
|
}
|
|
6161
6312
|
async function storedValueEquals(secrets, marker, candidate) {
|
|
@@ -6210,7 +6361,7 @@ function rowId(row, idKey) {
|
|
|
6210
6361
|
return null;
|
|
6211
6362
|
}
|
|
6212
6363
|
async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
6213
|
-
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$
|
|
6364
|
+
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$4) : [];
|
|
6214
6365
|
if (!Array.isArray(incoming)) {
|
|
6215
6366
|
ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
|
|
6216
6367
|
return {
|
|
@@ -6226,7 +6377,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
|
6226
6377
|
const kept = /* @__PURE__ */ new Set();
|
|
6227
6378
|
const rows = [];
|
|
6228
6379
|
for (const row of incoming) {
|
|
6229
|
-
if (!isRecord$
|
|
6380
|
+
if (!isRecord$4(row)) {
|
|
6230
6381
|
rows.push(row);
|
|
6231
6382
|
continue;
|
|
6232
6383
|
}
|
|
@@ -6251,7 +6402,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
6251
6402
|
case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
|
|
6252
6403
|
case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
|
|
6253
6404
|
case "object": {
|
|
6254
|
-
if (!isRecord$
|
|
6405
|
+
if (!isRecord$4(incoming)) {
|
|
6255
6406
|
if (incoming === void 0) return KEEP;
|
|
6256
6407
|
ctx.deletes.push(...collectSecretMarkerRefs(stored));
|
|
6257
6408
|
return {
|
|
@@ -6259,7 +6410,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
6259
6410
|
value: incoming
|
|
6260
6411
|
};
|
|
6261
6412
|
}
|
|
6262
|
-
const storedObj = isRecord$
|
|
6413
|
+
const storedObj = isRecord$4(stored) ? stored : {};
|
|
6263
6414
|
return {
|
|
6264
6415
|
kind: "value",
|
|
6265
6416
|
value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
|
|
@@ -6382,7 +6533,7 @@ async function resolveSecretMarkers(value, secrets, options = {}) {
|
|
|
6382
6533
|
value: items
|
|
6383
6534
|
};
|
|
6384
6535
|
}
|
|
6385
|
-
if (isRecord$
|
|
6536
|
+
if (isRecord$4(v)) {
|
|
6386
6537
|
const out = {};
|
|
6387
6538
|
for (const [k, child] of Object.entries(v)) {
|
|
6388
6539
|
const s = substitute(child);
|
|
@@ -6650,7 +6801,6 @@ function createHandle(raw, opts) {
|
|
|
6650
6801
|
const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
|
|
6651
6802
|
const readAddonStoreResult = raw.readAddonStoreResult;
|
|
6652
6803
|
const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
|
|
6653
|
-
const readDeviceStoreBatch = raw.readDeviceStoreBatch;
|
|
6654
6804
|
const overrides = {
|
|
6655
6805
|
readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
|
|
6656
6806
|
...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
|
|
@@ -6674,12 +6824,12 @@ function createHandle(raw, opts) {
|
|
|
6674
6824
|
};
|
|
6675
6825
|
} } : {},
|
|
6676
6826
|
readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
|
|
6677
|
-
|
|
6678
|
-
const rows = await readDeviceStoreBatch
|
|
6827
|
+
readDeviceStoreBatch: async (deviceIds) => {
|
|
6828
|
+
const rows = await raw.readDeviceStoreBatch(deviceIds);
|
|
6679
6829
|
const out = /* @__PURE__ */ new Map();
|
|
6680
6830
|
for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
|
|
6681
6831
|
return out;
|
|
6682
|
-
}
|
|
6832
|
+
},
|
|
6683
6833
|
writeAddonStore: async (patch) => {
|
|
6684
6834
|
await writeAddon(patch);
|
|
6685
6835
|
},
|
|
@@ -7306,7 +7456,7 @@ var BaseAddon = class {
|
|
|
7306
7456
|
if (!ctx) return;
|
|
7307
7457
|
const addonId = ctx.id;
|
|
7308
7458
|
setImmediate(() => {
|
|
7309
|
-
ctx.api.addons
|
|
7459
|
+
ctx.api.addons.restartAddon.mutate({ addonId }).then(() => {
|
|
7310
7460
|
ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
|
|
7311
7461
|
}).catch((err) => {
|
|
7312
7462
|
ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
@@ -7506,7 +7656,7 @@ var BaseAddon = class {
|
|
|
7506
7656
|
return this._addonSecretTree;
|
|
7507
7657
|
}
|
|
7508
7658
|
deviceSecretTree() {
|
|
7509
|
-
this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
|
|
7659
|
+
this._deviceSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.deviceSettingsSchema()), this.secretStatePaths);
|
|
7510
7660
|
return this._deviceSecretTree;
|
|
7511
7661
|
}
|
|
7512
7662
|
/**
|
|
@@ -7582,42 +7732,135 @@ var BaseAddon = class {
|
|
|
7582
7732
|
this[timerOf] = timer;
|
|
7583
7733
|
}
|
|
7584
7734
|
/**
|
|
7585
|
-
* Wrap `ctx.settings.readAddonStore()` with a
|
|
7586
|
-
*
|
|
7587
|
-
* swap, or any race where the SqliteSettingsBackend is between shutdown and
|
|
7588
|
-
* re-initialize) doesn't propagate up into `initialize()` and leave the
|
|
7735
|
+
* Wrap `ctx.settings.readAddonStore()` with a retry budget so a transient
|
|
7736
|
+
* settings-store outage doesn't propagate up into `initialize()` and leave the
|
|
7589
7737
|
* addon permanently broken.
|
|
7590
7738
|
*
|
|
7591
|
-
*
|
|
7592
|
-
*
|
|
7593
|
-
* `
|
|
7739
|
+
* Two kinds of outage, two budgets:
|
|
7740
|
+
* - the store's own restart fingerprints (`SqliteSettingsBackend not
|
|
7741
|
+
* initialized`, `provider not available`): a short budget, then the addon
|
|
7742
|
+
* falls back to `{}` (defaults) - its first successful patch rehydrates;
|
|
7743
|
+
* - a TRANSPORT failure (the hub is restarting while this runner boots:
|
|
7744
|
+
* `discovery deadline exceeded`, `parent could not route`, a refused or
|
|
7745
|
+
* timed-out connection). Since D870 a runner's settings read THROWS instead
|
|
7746
|
+
* of answering `{}`, so without a budget a hub restart ends in a respawn
|
|
7747
|
+
* loop. A long, bounded budget; only after it the error propagates - the
|
|
7748
|
+
* addon never runs on defaults for a store it could not ask.
|
|
7749
|
+
* Anything else propagates immediately so real bugs surface.
|
|
7594
7750
|
*/
|
|
7595
7751
|
async readAddonStoreWithRetry() {
|
|
7596
7752
|
const settings = this.rawSettings();
|
|
7597
7753
|
if (!settings) return {};
|
|
7598
|
-
const delaysMs = [
|
|
7599
|
-
150,
|
|
7600
|
-
350,
|
|
7601
|
-
600,
|
|
7602
|
-
900
|
|
7603
|
-
];
|
|
7604
7754
|
let lastErr;
|
|
7605
|
-
for (let attempt = 0
|
|
7755
|
+
for (let attempt = 0;; attempt++) try {
|
|
7606
7756
|
const stored = await settings.readAddonStore() ?? {};
|
|
7607
7757
|
this.settingsStoreReady = true;
|
|
7608
7758
|
return stored;
|
|
7609
7759
|
} catch (err) {
|
|
7610
7760
|
lastErr = err;
|
|
7611
|
-
const
|
|
7612
|
-
if (
|
|
7613
|
-
|
|
7614
|
-
|
|
7761
|
+
const kind = classifyStoreError(err);
|
|
7762
|
+
if (kind === "permanent") throw err;
|
|
7763
|
+
const delay = (kind === "transport" ? TRANSPORT_RETRY_DELAYS_MS : RESTART_RETRY_DELAYS_MS)[attempt];
|
|
7764
|
+
if (delay === void 0) {
|
|
7765
|
+
if (kind === "transport") throw err;
|
|
7766
|
+
break;
|
|
7767
|
+
}
|
|
7768
|
+
await new Promise((r) => setTimeout(r, delay));
|
|
7615
7769
|
}
|
|
7616
7770
|
this.settingsStoreReady = false;
|
|
7617
7771
|
this._ctx?.logger?.warn?.("readAddonStore: settings-store unavailable after retries — using defaults", { meta: { error: lastErr instanceof Error ? lastErr.message : String(lastErr) } });
|
|
7618
7772
|
return {};
|
|
7619
7773
|
}
|
|
7620
7774
|
};
|
|
7775
|
+
/** The settings store's own restart fingerprints. */
|
|
7776
|
+
var RESTART_RETRY_DELAYS_MS = [
|
|
7777
|
+
150,
|
|
7778
|
+
350,
|
|
7779
|
+
600,
|
|
7780
|
+
900
|
|
7781
|
+
];
|
|
7782
|
+
/** A hub restarting under a booting runner: ~100 s in total. */
|
|
7783
|
+
var TRANSPORT_RETRY_DELAYS_MS = [
|
|
7784
|
+
150,
|
|
7785
|
+
350,
|
|
7786
|
+
600,
|
|
7787
|
+
900,
|
|
7788
|
+
2e3,
|
|
7789
|
+
5e3,
|
|
7790
|
+
1e4,
|
|
7791
|
+
2e4,
|
|
7792
|
+
3e4,
|
|
7793
|
+
3e4
|
|
7794
|
+
];
|
|
7795
|
+
var RESTART_FINGERPRINTS = ["SqliteSettingsBackend not initialized", "provider not available"];
|
|
7796
|
+
/** Node / socket error codes of a connection that did not happen or broke. */
|
|
7797
|
+
var TRANSPORT_CODES = new Set([
|
|
7798
|
+
"ECONNREFUSED",
|
|
7799
|
+
"ECONNRESET",
|
|
7800
|
+
"ETIMEDOUT",
|
|
7801
|
+
"EPIPE",
|
|
7802
|
+
"EHOSTUNREACH",
|
|
7803
|
+
"ENETUNREACH"
|
|
7804
|
+
]);
|
|
7805
|
+
/** tRPC error codes that mean "the other side is not answering now", not "your call is wrong". */
|
|
7806
|
+
var UNAVAILABLE_TRPC_CODES = new Set([
|
|
7807
|
+
"TIMEOUT",
|
|
7808
|
+
"SERVICE_UNAVAILABLE",
|
|
7809
|
+
"BAD_GATEWAY",
|
|
7810
|
+
"GATEWAY_TIMEOUT"
|
|
7811
|
+
]);
|
|
7812
|
+
/** The exact phrases OUR transport raises when it cannot reach the hub. */
|
|
7813
|
+
var TRANSPORT_PHRASES = [
|
|
7814
|
+
"discovery deadline exceeded",
|
|
7815
|
+
"parent could not route child unowned cap call",
|
|
7816
|
+
"UDS request timed out after",
|
|
7817
|
+
"channel closed"
|
|
7818
|
+
];
|
|
7819
|
+
/** Moleculer error `type`s of a call that could not be served right now. */
|
|
7820
|
+
var MOLECULER_TRANSIENT_TYPES = new Set([
|
|
7821
|
+
"REQUEST_TIMEOUT",
|
|
7822
|
+
"SERVICE_NOT_FOUND",
|
|
7823
|
+
"SERVICE_NOT_AVAILABLE",
|
|
7824
|
+
"REQUEST_REJECTED",
|
|
7825
|
+
"BROKER_DISCONNECTED"
|
|
7826
|
+
]);
|
|
7827
|
+
function stringProp(value, key) {
|
|
7828
|
+
if (typeof value !== "object" || value === null) return void 0;
|
|
7829
|
+
const found = Reflect.get(value, key);
|
|
7830
|
+
return typeof found === "string" ? found : void 0;
|
|
7831
|
+
}
|
|
7832
|
+
/** The code an error carries: its own, its cause's, or a tRPC `data.code`. */
|
|
7833
|
+
function errorCode(err) {
|
|
7834
|
+
const out = {};
|
|
7835
|
+
const cause = typeof err === "object" && err !== null ? Reflect.get(err, "cause") : void 0;
|
|
7836
|
+
const data = typeof err === "object" && err !== null ? Reflect.get(err, "data") : void 0;
|
|
7837
|
+
const node = stringProp(err, "code") ?? stringProp(cause, "code");
|
|
7838
|
+
if (node !== void 0) out.node = node;
|
|
7839
|
+
const trpc = stringProp(data, "code");
|
|
7840
|
+
if (trpc !== void 0) out.trpc = trpc;
|
|
7841
|
+
return out;
|
|
7842
|
+
}
|
|
7843
|
+
/**
|
|
7844
|
+
* Is a settings read failure worth retrying, and with which budget? Only
|
|
7845
|
+
* EXPLICIT signals count: a socket error code, a tRPC "unavailable" code, or
|
|
7846
|
+
* one of the exact phrases our own transport raises. A message that merely
|
|
7847
|
+
* contains "timed out" or "unreachable" is not evidence of anything, and
|
|
7848
|
+
* `settings store not wired` is a wiring bug that retrying cannot fix.
|
|
7849
|
+
*/
|
|
7850
|
+
function classifyStoreError(err) {
|
|
7851
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
7852
|
+
if (RESTART_FINGERPRINTS.some((f) => message.includes(f))) return "restart";
|
|
7853
|
+
const code = errorCode(err);
|
|
7854
|
+
if (code.node !== void 0 && TRANSPORT_CODES.has(code.node)) return "transport";
|
|
7855
|
+
if (code.trpc !== void 0 && UNAVAILABLE_TRPC_CODES.has(code.trpc)) return "transport";
|
|
7856
|
+
if (typeof err === "object" && err !== null) {
|
|
7857
|
+
if (Reflect.get(err, "retryable") === true) return "transport";
|
|
7858
|
+
const type = stringProp(err, "type");
|
|
7859
|
+
if (type !== void 0 && MOLECULER_TRANSIENT_TYPES.has(type)) return "transport";
|
|
7860
|
+
}
|
|
7861
|
+
if (TRANSPORT_PHRASES.some((f) => message.includes(f))) return "transport";
|
|
7862
|
+
return "permanent";
|
|
7863
|
+
}
|
|
7621
7864
|
/**
|
|
7622
7865
|
* Collect the keys of every field marked `perNode: true`, recursing into
|
|
7623
7866
|
* layout containers (`group` fields and `sub-tabs` tabs) the same way
|
|
@@ -7707,6 +7950,356 @@ var PeerBytesTicketSchema = object({
|
|
|
7707
7950
|
*/
|
|
7708
7951
|
declaredBytes: number().int().nonnegative().nullable()
|
|
7709
7952
|
});
|
|
7953
|
+
/** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
|
|
7954
|
+
/** The files a kind may live in. `history` is device-history's (D850), never records. */
|
|
7955
|
+
var RECORD_DATABASES = ["settings", "events"];
|
|
7956
|
+
/** The classes of a kind: the `@durable` vocabulary, one authority (replaces the annotation). */
|
|
7957
|
+
var RECORD_CLASSES = [
|
|
7958
|
+
"config",
|
|
7959
|
+
"ledger",
|
|
7960
|
+
"audit",
|
|
7961
|
+
"mirror",
|
|
7962
|
+
"ephemeral"
|
|
7963
|
+
];
|
|
7964
|
+
var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
|
|
7965
|
+
var RECORD_MAX_DATA_BYTES = 1024 * 1024;
|
|
7966
|
+
var RECORD_BATCH_MAX = 1e3;
|
|
7967
|
+
var RECORD_QUERY_MAX = 1e3;
|
|
7968
|
+
/** A kind in the `settings` file may not bound itself above this (D447: high volume is `events`). */
|
|
7969
|
+
var RECORD_SETTINGS_MAX_ROWS = 5e4;
|
|
7970
|
+
var PREFIX$1 = "records/";
|
|
7971
|
+
/** The base of every records failure. `detail` is the human part of the message. */
|
|
7972
|
+
var RecordsError = class extends Error {
|
|
7973
|
+
code;
|
|
7974
|
+
detail;
|
|
7975
|
+
constructor(code, detail) {
|
|
7976
|
+
super(`${PREFIX$1}${code}: ${detail}`);
|
|
7977
|
+
this.name = "RecordsError";
|
|
7978
|
+
this.code = code;
|
|
7979
|
+
this.detail = detail;
|
|
7980
|
+
}
|
|
7981
|
+
};
|
|
7982
|
+
/** The keychain could not store or serve a value: explicit, never an empty string. */
|
|
7983
|
+
var RecordSecretUnavailableError = class extends RecordsError {
|
|
7984
|
+
constructor(detail) {
|
|
7985
|
+
super("secret-unavailable", detail);
|
|
7986
|
+
this.name = "RecordSecretUnavailableError";
|
|
7987
|
+
}
|
|
7988
|
+
};
|
|
7989
|
+
var InvalidRecordError = class extends RecordsError {
|
|
7990
|
+
constructor(detail) {
|
|
7991
|
+
super("invalid-record", detail);
|
|
7992
|
+
this.name = "InvalidRecordError";
|
|
7993
|
+
}
|
|
7994
|
+
};
|
|
7995
|
+
/** A kind declaration the engine refuses (non-additive change, bad shape, wrong file). */
|
|
7996
|
+
var DeclarationRefusedError = class extends RecordsError {
|
|
7997
|
+
constructor(detail) {
|
|
7998
|
+
super("declaration-refused", detail);
|
|
7999
|
+
this.name = "DeclarationRefusedError";
|
|
8000
|
+
}
|
|
8001
|
+
};
|
|
8002
|
+
function defOf(schema) {
|
|
8003
|
+
const zodBag = Reflect.get(schema, "_zod");
|
|
8004
|
+
if (typeof zodBag !== "object" || zodBag === null) return {};
|
|
8005
|
+
const def = Reflect.get(zodBag, "def");
|
|
8006
|
+
if (typeof def !== "object" || def === null) return {};
|
|
8007
|
+
return def;
|
|
8008
|
+
}
|
|
8009
|
+
function declaredHere(schema) {
|
|
8010
|
+
return globalRegistry.get(schema)?.secret === true;
|
|
8011
|
+
}
|
|
8012
|
+
/** Wrapper kinds whose `innerType` is the field itself. */
|
|
8013
|
+
var WRAPPERS = new Set([
|
|
8014
|
+
"optional",
|
|
8015
|
+
"nullable",
|
|
8016
|
+
"default",
|
|
8017
|
+
"prefault",
|
|
8018
|
+
"catch",
|
|
8019
|
+
"readonly",
|
|
8020
|
+
"nonoptional"
|
|
8021
|
+
]);
|
|
8022
|
+
/**
|
|
8023
|
+
* The schema layers that make up ONE field: the schema itself and every
|
|
8024
|
+
* wrapper below it (optional / default / nullable / readonly / catch), plus
|
|
8025
|
+
* both sides of a pipe (`z.preprocess` puts the real schema on `out`,
|
|
8026
|
+
* `.transform` on `in`).
|
|
8027
|
+
*/
|
|
8028
|
+
function layersOf(schema) {
|
|
8029
|
+
const out = [];
|
|
8030
|
+
const queue = [schema];
|
|
8031
|
+
while (queue.length > 0) {
|
|
8032
|
+
const s = queue.shift();
|
|
8033
|
+
if (!s || out.includes(s)) continue;
|
|
8034
|
+
out.push(s);
|
|
8035
|
+
const def = defOf(s);
|
|
8036
|
+
if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
|
|
8037
|
+
if (def.type === "pipe") {
|
|
8038
|
+
if (def.in) queue.push(def.in);
|
|
8039
|
+
if (def.out) queue.push(def.out);
|
|
8040
|
+
}
|
|
8041
|
+
}
|
|
8042
|
+
return out;
|
|
8043
|
+
}
|
|
8044
|
+
/** True when any layer of this field declares `.meta({ secret: true })`. */
|
|
8045
|
+
function isZodSecret(schema) {
|
|
8046
|
+
return layersOf(schema).some(declaredHere);
|
|
8047
|
+
}
|
|
8048
|
+
/**
|
|
8049
|
+
* Every declared secret path in a config schema: dotted keys, `[]` for "each
|
|
8050
|
+
* element of this array" (`connection.password`, `rows[].token`). A declared
|
|
8051
|
+
* object or array is reported as one path and not descended into — everything
|
|
8052
|
+
* under it is secret.
|
|
8053
|
+
*/
|
|
8054
|
+
function collectZodSecretPaths(schema, prefix = "") {
|
|
8055
|
+
if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
|
|
8056
|
+
const paths = [];
|
|
8057
|
+
for (const layer of layersOf(schema)) {
|
|
8058
|
+
const def = defOf(layer);
|
|
8059
|
+
if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
|
|
8060
|
+
else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
|
|
8061
|
+
else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
|
|
8062
|
+
else if (def.type === "intersection") {
|
|
8063
|
+
if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
|
|
8064
|
+
if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
|
|
8065
|
+
}
|
|
8066
|
+
}
|
|
8067
|
+
return [...new Set(paths)];
|
|
8068
|
+
}
|
|
8069
|
+
/**
|
|
8070
|
+
* Secret fields of a record, addressed the way a Zod schema declares them
|
|
8071
|
+
* (`collectZodSecretPaths`): dotted keys, `[]` for "each element of this array"
|
|
8072
|
+
* (`auth.accessToken`, `headers[].value`).
|
|
8073
|
+
*
|
|
8074
|
+
* Array elements are matched by a DECLARED id key (`secretArrayKeys`:
|
|
8075
|
+
* `{ headers: 'name' }`), never by index, so reordering a list keeps every
|
|
8076
|
+
* keychain ref (the same rule as `arrayItemFieldPath`). The concrete path of a
|
|
8077
|
+
* leaf names its element: `headers[X-Api].value`.
|
|
8078
|
+
*
|
|
8079
|
+
* Pure and browser-safe. Nothing here mutates: every transform returns a new value.
|
|
8080
|
+
*/
|
|
8081
|
+
/** The array prefixes (declared form, e.g. `headers` or `a.headers`) of a path. */
|
|
8082
|
+
function parseSecretPath(path) {
|
|
8083
|
+
if (path.length === 0) throw new InvalidRecordError("an empty secret path");
|
|
8084
|
+
return path.split(".").map((raw) => {
|
|
8085
|
+
const each = raw.endsWith("[]");
|
|
8086
|
+
const key = each ? raw.slice(0, -2) : raw;
|
|
8087
|
+
if (key.length === 0) throw new InvalidRecordError(`secret path "${path}" has an empty segment`);
|
|
8088
|
+
return {
|
|
8089
|
+
key,
|
|
8090
|
+
each
|
|
8091
|
+
};
|
|
8092
|
+
});
|
|
8093
|
+
}
|
|
8094
|
+
/** The declared array prefixes of `path` that need an id key (`headers`, `a.rows`). */
|
|
8095
|
+
function secretArrayPrefixes(path) {
|
|
8096
|
+
const segments = parseSecretPath(path);
|
|
8097
|
+
const prefixes = [];
|
|
8098
|
+
const walked = [];
|
|
8099
|
+
for (const segment of segments) {
|
|
8100
|
+
walked.push(segment.key);
|
|
8101
|
+
if (segment.each) prefixes.push(walked.join("."));
|
|
8102
|
+
}
|
|
8103
|
+
return prefixes;
|
|
8104
|
+
}
|
|
8105
|
+
/**
|
|
8106
|
+
* Record kinds (D881): the declaration an addon makes of one kind of fact, the
|
|
8107
|
+
* Zod row schema that describes it, and the helper that turns the two into the
|
|
8108
|
+
* JSON the engine stores.
|
|
8109
|
+
*
|
|
8110
|
+
* A kind is declared ONCE, next to the code that owns it, and the engine's
|
|
8111
|
+
* reconciler creates its indexes - nothing creates DDL at runtime from a write.
|
|
8112
|
+
* Everything the generic machinery needs (secret fields, the entry descriptor)
|
|
8113
|
+
* is DERIVED from the Zod schema: `.meta({ secret: true })` marks a credential,
|
|
8114
|
+
* never a field name (D879).
|
|
8115
|
+
*/
|
|
8116
|
+
/** A JSON field path: `trackId`, `auth.accessToken`. Charset-restricted: it is rendered into DDL. */
|
|
8117
|
+
var RecordFieldPathSchema = string$2().regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}(\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,3}$/);
|
|
8118
|
+
var RecordIndexSchema = object({
|
|
8119
|
+
name: string$2().regex(/^[a-z][a-z0-9_]{0,31}$/),
|
|
8120
|
+
fields: array(RecordFieldPathSchema).min(1).max(4),
|
|
8121
|
+
unique: boolean().optional()
|
|
8122
|
+
}).strict();
|
|
8123
|
+
var RecordRetentionSchema = union([
|
|
8124
|
+
object({
|
|
8125
|
+
ttlMs: number().int().positive(),
|
|
8126
|
+
from: _enum(["at", "write"])
|
|
8127
|
+
}).strict(),
|
|
8128
|
+
object({
|
|
8129
|
+
maxRows: number().int().positive().optional(),
|
|
8130
|
+
maxRowsPerDevice: number().int().positive().optional()
|
|
8131
|
+
}).strict().refine((r) => r.maxRows !== void 0 || r.maxRowsPerDevice !== void 0, { message: "name maxRows, maxRowsPerDevice or both" }),
|
|
8132
|
+
object({
|
|
8133
|
+
owner: string$2().min(1),
|
|
8134
|
+
reason: string$2().min(1)
|
|
8135
|
+
}).strict(),
|
|
8136
|
+
object({ none: string$2().min(1) }).strict()
|
|
8137
|
+
]);
|
|
8138
|
+
/** The descriptor a generic entries UI reads (D881 "generic entries"). */
|
|
8139
|
+
var EntryDescriptorSchema = object({
|
|
8140
|
+
title: string$2().min(1),
|
|
8141
|
+
/** The record body field shown as the entry's name. */
|
|
8142
|
+
nameField: string$2().min(1),
|
|
8143
|
+
/** JSON Schema of the entry body; `secret: true` marks a password field. */
|
|
8144
|
+
fields: record(string$2(), unknown())
|
|
8145
|
+
}).strict();
|
|
8146
|
+
/** What crosses the wire and sits in the engine's catalog: JSON only, no Zod. */
|
|
8147
|
+
var RecordKindDeclarationSchema = object({
|
|
8148
|
+
database: _enum(RECORD_DATABASES).default("settings"),
|
|
8149
|
+
class: _enum(RECORD_CLASSES),
|
|
8150
|
+
writeTrigger: string$2().min(1),
|
|
8151
|
+
device: _enum([
|
|
8152
|
+
"required",
|
|
8153
|
+
"optional",
|
|
8154
|
+
"none"
|
|
8155
|
+
]).default("none"),
|
|
8156
|
+
at: _enum(["required", "none"]).default("none"),
|
|
8157
|
+
indexes: array(RecordIndexSchema).max(8).default([]),
|
|
8158
|
+
retention: RecordRetentionSchema,
|
|
8159
|
+
deviceRemoval: _enum(["delete", "none"]).default("none"),
|
|
8160
|
+
maxDataBytes: number().int().positive().max(RECORD_MAX_DATA_BYTES).default(RECORD_DEFAULT_MAX_DATA_BYTES),
|
|
8161
|
+
/** Derived from the Zod schema; never written by hand. */
|
|
8162
|
+
secretPaths: array(string$2().min(1)).default([]),
|
|
8163
|
+
/** The id key of each array that carries a secret (`{ headers: 'name' }`). */
|
|
8164
|
+
secretArrayKeys: record(string$2(), string$2()).default({}),
|
|
8165
|
+
/** The legacy table this kind adopts from; the boot guard reads it (D853: no migration code). */
|
|
8166
|
+
adoptsFrom: string$2().min(1).optional(),
|
|
8167
|
+
/** Kinds that must agree through `transact` sit in one file under one family name. */
|
|
8168
|
+
transactFamily: string$2().min(1).optional(),
|
|
8169
|
+
entry: EntryDescriptorSchema.optional()
|
|
8170
|
+
}).strict();
|
|
8171
|
+
/** The kind names: lower-case, dash separated, short enough for an index name. */
|
|
8172
|
+
var RecordKindNameSchema = string$2().regex(/^[a-z][a-z0-9-]{0,47}$/);
|
|
8173
|
+
/** Cross-field rules a declaration must satisfy. Throws {@link DeclarationRefusedError}. */
|
|
8174
|
+
function assertValidDeclaration(name, decl) {
|
|
8175
|
+
const refuse = (why) => {
|
|
8176
|
+
throw new DeclarationRefusedError(`kind "${name}": ${why}`);
|
|
8177
|
+
};
|
|
8178
|
+
if (!RecordKindNameSchema.safeParse(name).success) refuse("the name must be lower-case-dashed");
|
|
8179
|
+
const seen = /* @__PURE__ */ new Set();
|
|
8180
|
+
for (const index of decl.indexes) {
|
|
8181
|
+
if (seen.has(index.name)) refuse(`index name "${index.name}" is declared twice`);
|
|
8182
|
+
seen.add(index.name);
|
|
8183
|
+
}
|
|
8184
|
+
const { retention } = decl;
|
|
8185
|
+
const hasSecrets = decl.secretPaths.length > 0;
|
|
8186
|
+
if ("ttlMs" in retention) {
|
|
8187
|
+
if (retention.from === "at" && decl.at !== "required") refuse("a ttl from \"at\" needs at: \"required\"");
|
|
8188
|
+
if (hasSecrets) refuse("a kind with secret fields cannot use engine TTL (its keychain values would be orphaned)");
|
|
8189
|
+
}
|
|
8190
|
+
if ("maxRows" in retention || "maxRowsPerDevice" in retention) {
|
|
8191
|
+
if (retention.maxRowsPerDevice !== void 0 && decl.device !== "required") refuse("maxRowsPerDevice needs device: \"required\"");
|
|
8192
|
+
if (decl.at !== "required") refuse("a row bound trims the oldest \"at\": it needs at: \"required\"");
|
|
8193
|
+
if (hasSecrets) refuse("a kind with secret fields cannot use an engine row bound");
|
|
8194
|
+
const bound = Math.max(retention.maxRows ?? 0, retention.maxRowsPerDevice ?? 0);
|
|
8195
|
+
if (decl.database === "settings" && bound > 5e4) refuse(`a row bound above ${RECORD_SETTINGS_MAX_ROWS} belongs in database: "events" (a big delete on the settings thread stalls every configuration read)`);
|
|
8196
|
+
}
|
|
8197
|
+
if (decl.deviceRemoval === "delete" && decl.device === "none") refuse("deviceRemoval: \"delete\" needs a device: \"required\" or \"optional\"");
|
|
8198
|
+
for (const path of decl.secretPaths) for (const prefix of secretArrayPrefixes(path)) if (decl.secretArrayKeys[prefix] === void 0) refuse(`secret path "${path}" crosses the array "${prefix}": declare its id key in secretArrayKeys`);
|
|
8199
|
+
}
|
|
8200
|
+
function bodyFieldsOf(schema) {
|
|
8201
|
+
return { ...toJSONSchema(schema, {
|
|
8202
|
+
unrepresentable: "any",
|
|
8203
|
+
io: "input"
|
|
8204
|
+
}) };
|
|
8205
|
+
}
|
|
8206
|
+
function isRecordLike(value) {
|
|
8207
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
8208
|
+
}
|
|
8209
|
+
/** Does every branch of the body schema carry `field`? (A discriminated union has several.) */
|
|
8210
|
+
function hasNameField(json, field) {
|
|
8211
|
+
const branches = json["oneOf"] ?? json["anyOf"];
|
|
8212
|
+
if (Array.isArray(branches)) return branches.length > 0 && branches.every((b) => isRecordLike(b) && hasNameField(b, field));
|
|
8213
|
+
const properties = json["properties"];
|
|
8214
|
+
return isRecordLike(properties) && Object.prototype.hasOwnProperty.call(properties, field);
|
|
8215
|
+
}
|
|
8216
|
+
/**
|
|
8217
|
+
* Declare the kinds of a package. The keys are the kind names. The result is
|
|
8218
|
+
* what `ctx.records.declare` sends to the engine and what `ctx.records.kind`
|
|
8219
|
+
* types its handle from.
|
|
8220
|
+
*/
|
|
8221
|
+
function defineRecordKinds(specs) {
|
|
8222
|
+
const out = {};
|
|
8223
|
+
for (const [name, spec] of Object.entries(specs)) {
|
|
8224
|
+
const secretPaths = collectZodSecretPaths(spec.schema);
|
|
8225
|
+
const nameField = spec.entry?.nameField ?? "name";
|
|
8226
|
+
const fields = bodyFieldsOf(spec.schema);
|
|
8227
|
+
if (spec.entry !== void 0 && !hasNameField(fields, nameField)) throw new DeclarationRefusedError(`kind "${name}": an entry kind's schema needs a "${nameField}" field`);
|
|
8228
|
+
const parsed = RecordKindDeclarationSchema.parse({
|
|
8229
|
+
database: spec.database,
|
|
8230
|
+
class: spec.class,
|
|
8231
|
+
writeTrigger: spec.writeTrigger,
|
|
8232
|
+
device: spec.device,
|
|
8233
|
+
at: spec.at,
|
|
8234
|
+
indexes: spec.indexes === void 0 ? void 0 : [...spec.indexes],
|
|
8235
|
+
retention: spec.retention,
|
|
8236
|
+
deviceRemoval: spec.deviceRemoval,
|
|
8237
|
+
maxDataBytes: spec.maxDataBytes,
|
|
8238
|
+
secretPaths: [...secretPaths],
|
|
8239
|
+
secretArrayKeys: spec.secretArrayKeys === void 0 ? void 0 : { ...spec.secretArrayKeys },
|
|
8240
|
+
adoptsFrom: spec.adoptsFrom,
|
|
8241
|
+
transactFamily: spec.transactFamily,
|
|
8242
|
+
entry: spec.entry === void 0 ? void 0 : {
|
|
8243
|
+
title: spec.entry.title,
|
|
8244
|
+
nameField,
|
|
8245
|
+
fields
|
|
8246
|
+
}
|
|
8247
|
+
});
|
|
8248
|
+
assertValidDeclaration(name, parsed);
|
|
8249
|
+
out[name] = {
|
|
8250
|
+
name,
|
|
8251
|
+
schema: spec.schema,
|
|
8252
|
+
declaration: parsed
|
|
8253
|
+
};
|
|
8254
|
+
}
|
|
8255
|
+
return out;
|
|
8256
|
+
}
|
|
8257
|
+
/**
|
|
8258
|
+
* Entry kinds (D881): every list of user-created entries (notification
|
|
8259
|
+
* targets, brokers, LLM profiles) is ONE record kind with an id, a name and a
|
|
8260
|
+
* kind-specific body, and the admin UI lists/adds/edits/deletes all of them
|
|
8261
|
+
* through the `record-entries` capability with password fields derived from
|
|
8262
|
+
* the schema (`.meta({ secret: true })`).
|
|
8263
|
+
*/
|
|
8264
|
+
/** The body of a plain entry: a name and the fields the kind adds. */
|
|
8265
|
+
function entryBody(shape) {
|
|
8266
|
+
return object({
|
|
8267
|
+
name: string$2().min(1),
|
|
8268
|
+
...shape
|
|
8269
|
+
});
|
|
8270
|
+
}
|
|
8271
|
+
/**
|
|
8272
|
+
* Declare one entry kind. An entry is configuration: never trimmed by the
|
|
8273
|
+
* engine, never aged, belonging to no device.
|
|
8274
|
+
*/
|
|
8275
|
+
function defineEntryKind(name, spec) {
|
|
8276
|
+
const defined = defineRecordKinds({ [name]: {
|
|
8277
|
+
schema: spec.schema,
|
|
8278
|
+
class: "config",
|
|
8279
|
+
writeTrigger: spec.writeTrigger ?? "an operator adds or edits an entry in the entries UI",
|
|
8280
|
+
retention: { none: "an entry goes only when the operator deletes it" },
|
|
8281
|
+
...spec.database === void 0 ? {} : { database: spec.database },
|
|
8282
|
+
...spec.indexes === void 0 ? {} : { indexes: spec.indexes },
|
|
8283
|
+
...spec.secretArrayKeys === void 0 ? {} : { secretArrayKeys: spec.secretArrayKeys },
|
|
8284
|
+
...spec.adoptsFrom === void 0 ? {} : { adoptsFrom: spec.adoptsFrom },
|
|
8285
|
+
entry: {
|
|
8286
|
+
title: spec.title,
|
|
8287
|
+
...spec.nameField === void 0 ? {} : { nameField: spec.nameField }
|
|
8288
|
+
}
|
|
8289
|
+
} })[name];
|
|
8290
|
+
if (defined === void 0) throw new DeclarationRefusedError(`entry kind "${name}" was not built`);
|
|
8291
|
+
return defined;
|
|
8292
|
+
}
|
|
8293
|
+
/**
|
|
8294
|
+
* Legacy source for broker entry adoption (B2): brokers live in addon-settings
|
|
8295
|
+
* as one row `<addonId>.brokers` whose value is an array until records-adopt
|
|
8296
|
+
* copies them into the entry kind.
|
|
8297
|
+
*/
|
|
8298
|
+
var SETTINGS_BROKERS_ADOPTS_PREFIX = "@settings-brokers/";
|
|
8299
|
+
/** The `adoptsFrom` value for an addon's broker entry kind. */
|
|
8300
|
+
function settingsBrokersAdoptsFrom(addonId) {
|
|
8301
|
+
return `${SETTINGS_BROKERS_ADOPTS_PREFIX}${addonId}`;
|
|
8302
|
+
}
|
|
7710
8303
|
/** Shared Zod schemas used across streaming capabilities. */
|
|
7711
8304
|
var CamProfileSchema = _enum([
|
|
7712
8305
|
"high",
|
|
@@ -8171,75 +8764,12 @@ method(object({ deviceId: number() }), array(StreamSourceEntrySchema)), method(o
|
|
|
8171
8764
|
kind: "mutation",
|
|
8172
8765
|
auth: "admin"
|
|
8173
8766
|
}), method(object({ deviceId: number() }), unknown().nullable()), method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" });
|
|
8174
|
-
function defOf(schema) {
|
|
8175
|
-
return schema._zod?.def ?? {};
|
|
8176
|
-
}
|
|
8177
|
-
function declaredHere(schema) {
|
|
8178
|
-
return globalRegistry.get(schema)?.secret === true;
|
|
8179
|
-
}
|
|
8180
|
-
/** Wrapper kinds whose `innerType` is the field itself. */
|
|
8181
|
-
var WRAPPERS = new Set([
|
|
8182
|
-
"optional",
|
|
8183
|
-
"nullable",
|
|
8184
|
-
"default",
|
|
8185
|
-
"prefault",
|
|
8186
|
-
"catch",
|
|
8187
|
-
"readonly",
|
|
8188
|
-
"nonoptional"
|
|
8189
|
-
]);
|
|
8190
|
-
/**
|
|
8191
|
-
* The schema layers that make up ONE field: the schema itself and every
|
|
8192
|
-
* wrapper below it (optional / default / nullable / readonly / catch), plus
|
|
8193
|
-
* both sides of a pipe (`z.preprocess` puts the real schema on `out`,
|
|
8194
|
-
* `.transform` on `in`).
|
|
8195
|
-
*/
|
|
8196
|
-
function layersOf(schema) {
|
|
8197
|
-
const out = [];
|
|
8198
|
-
const queue = [schema];
|
|
8199
|
-
while (queue.length > 0) {
|
|
8200
|
-
const s = queue.shift();
|
|
8201
|
-
if (!s || out.includes(s)) continue;
|
|
8202
|
-
out.push(s);
|
|
8203
|
-
const def = defOf(s);
|
|
8204
|
-
if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
|
|
8205
|
-
if (def.type === "pipe") {
|
|
8206
|
-
if (def.in) queue.push(def.in);
|
|
8207
|
-
if (def.out) queue.push(def.out);
|
|
8208
|
-
}
|
|
8209
|
-
}
|
|
8210
|
-
return out;
|
|
8211
|
-
}
|
|
8212
|
-
/** True when any layer of this field declares `.meta({ secret: true })`. */
|
|
8213
|
-
function isZodSecret(schema) {
|
|
8214
|
-
return layersOf(schema).some(declaredHere);
|
|
8215
|
-
}
|
|
8216
|
-
/**
|
|
8217
|
-
* Every declared secret path in a config schema: dotted keys, `[]` for "each
|
|
8218
|
-
* element of this array" (`connection.password`, `rows[].token`). A declared
|
|
8219
|
-
* object or array is reported as one path and not descended into — everything
|
|
8220
|
-
* under it is secret.
|
|
8221
|
-
*/
|
|
8222
|
-
function collectZodSecretPaths(schema, prefix = "") {
|
|
8223
|
-
if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
|
|
8224
|
-
const paths = [];
|
|
8225
|
-
for (const layer of layersOf(schema)) {
|
|
8226
|
-
const def = defOf(layer);
|
|
8227
|
-
if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
|
|
8228
|
-
else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
|
|
8229
|
-
else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
|
|
8230
|
-
else if (def.type === "intersection") {
|
|
8231
|
-
if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
|
|
8232
|
-
if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
|
|
8233
|
-
}
|
|
8234
|
-
}
|
|
8235
|
-
return [...new Set(paths)];
|
|
8236
|
-
}
|
|
8237
8767
|
object({
|
|
8238
8768
|
code: string$2().regex(/^[a-z][a-z0-9-]*(\.[a-z0-9-]+)+$/),
|
|
8239
8769
|
params: record(string$2(), union([string$2(), number()])).optional()
|
|
8240
8770
|
});
|
|
8241
8771
|
//#endregion
|
|
8242
|
-
//#region ../types/dist/err-msg-
|
|
8772
|
+
//#region ../types/dist/err-msg-BXKzRBwg.mjs
|
|
8243
8773
|
var DeviceType = /* @__PURE__ */ function(DeviceType) {
|
|
8244
8774
|
DeviceType["Camera"] = "camera";
|
|
8245
8775
|
DeviceType["Hub"] = "hub";
|
|
@@ -8331,6 +8861,10 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
|
|
|
8331
8861
|
* native PetKit (`nodepetkit` `FeederDevice`), reusable by other feeder
|
|
8332
8862
|
* integrations sharing the same food/desiccant/hopper surface. */
|
|
8333
8863
|
DeviceType["PetFeeder"] = "pet-feeder";
|
|
8864
|
+
/** Built-in dishwasher — program lifecycle, door / remote-start gates,
|
|
8865
|
+
* salt and rinse-aid levels. Installed with the `dishwasher` cap.
|
|
8866
|
+
* Sources: native Bosch Home Connect, reusable by similar integrations. */
|
|
8867
|
+
DeviceType["Dishwasher"] = "dishwasher";
|
|
8334
8868
|
return DeviceType;
|
|
8335
8869
|
}({});
|
|
8336
8870
|
var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
|
|
@@ -8508,6 +9042,9 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
|
|
|
8508
9042
|
/** Virtual HA toggle (input_boolean.*) — distinguishable from a
|
|
8509
9043
|
* real Switch device for UI rendering / export adapters. */
|
|
8510
9044
|
DeviceRole["BinaryHelper"] = "binary-helper";
|
|
9045
|
+
/** A smart plug: a `switch` whose source says it is an outlet (HA
|
|
9046
|
+
* `device_class: outlet`). The Alexa export shows it as a SMARTPLUG. */
|
|
9047
|
+
DeviceRole["Outlet"] = "outlet";
|
|
8511
9048
|
/** Generic motion / occupancy / moving event source. Distinct from
|
|
8512
9049
|
* the camera accessory PirSensor role: that one is a camera child;
|
|
8513
9050
|
* this is a standalone HA / 3rd-party motion sensor. */
|
|
@@ -8585,7 +9122,7 @@ function errMsg(err) {
|
|
|
8585
9122
|
return String(err);
|
|
8586
9123
|
}
|
|
8587
9124
|
//#endregion
|
|
8588
|
-
//#region ../types/dist/composition-
|
|
9125
|
+
//#region ../types/dist/composition-CB6PMT9p.mjs
|
|
8589
9126
|
/**
|
|
8590
9127
|
* The ffmpeg build every CamStack node downloads, per platform and arch.
|
|
8591
9128
|
*
|
|
@@ -11789,11 +12326,10 @@ var ClipModelMetaSchema = object({
|
|
|
11789
12326
|
/**
|
|
11790
12327
|
* The `vector-store` index this model's vectors live in. ONE feature space
|
|
11791
12328
|
* per index: two models share an index only when their vectors are ranked
|
|
11792
|
-
* against each other, which for CLIP means never across families.
|
|
11793
|
-
*
|
|
11794
|
-
* `modelId`); any other model gets its own.
|
|
12329
|
+
* against each other, which for CLIP means never across families. Every
|
|
12330
|
+
* model gets its own.
|
|
11795
12331
|
*/
|
|
11796
|
-
vectorIndex: string$2().regex(/^object-clip
|
|
12332
|
+
vectorIndex: string$2().regex(/^object-clip-[a-z0-9][a-z0-9-]*$/),
|
|
11797
12333
|
/**
|
|
11798
12334
|
* The text encoder's tokenizer, a declared SIBLING file of its onnx. The name
|
|
11799
12335
|
* must be unique per tokenizer: every model's siblings land in ONE flat
|
|
@@ -12972,8 +13508,13 @@ var AlertSeveritySchema = _enum([
|
|
|
12972
13508
|
"info",
|
|
12973
13509
|
"success",
|
|
12974
13510
|
"warning",
|
|
12975
|
-
"error"
|
|
13511
|
+
"error",
|
|
13512
|
+
"critical"
|
|
12976
13513
|
]);
|
|
13514
|
+
var AlertActionSchema = object({
|
|
13515
|
+
label: string$2(),
|
|
13516
|
+
href: string$2().optional()
|
|
13517
|
+
});
|
|
12977
13518
|
var AlertStatusSchema = _enum([
|
|
12978
13519
|
"active",
|
|
12979
13520
|
"in-progress",
|
|
@@ -12991,6 +13532,7 @@ var AlertSchema = object({
|
|
|
12991
13532
|
severity: AlertSeveritySchema,
|
|
12992
13533
|
title: string$2(),
|
|
12993
13534
|
message: string$2(),
|
|
13535
|
+
action: AlertActionSchema.optional(),
|
|
12994
13536
|
status: AlertStatusSchema,
|
|
12995
13537
|
progress: number().optional(),
|
|
12996
13538
|
read: boolean(),
|
|
@@ -15575,6 +16117,41 @@ var ComposableCapabilitiesSchema = object({ caps: array(object({
|
|
|
15575
16117
|
keyField: string$2()
|
|
15576
16118
|
}).optional()
|
|
15577
16119
|
})) });
|
|
16120
|
+
/**
|
|
16121
|
+
* The report of a one-shot "move this owner's plaintext secrets into the
|
|
16122
|
+
* keychain" run (D878). COUNTS only - never a value, never a ref.
|
|
16123
|
+
*
|
|
16124
|
+
* The owner runs it on its own rows, through its own write path; an operator
|
|
16125
|
+
* script (`scripts/hub/migrate-raw-secrets.ts`) calls the owner's cap method.
|
|
16126
|
+
* Dry run (`apply: false`) reports what WOULD move and changes nothing.
|
|
16127
|
+
*/
|
|
16128
|
+
var RawSecretMigrationInputSchema = object({
|
|
16129
|
+
/** `false` (the default of the script) = report only. */
|
|
16130
|
+
apply: boolean() });
|
|
16131
|
+
var RawSecretMigrationReportSchema = object({
|
|
16132
|
+
apply: boolean(),
|
|
16133
|
+
/** Rows that can carry a secret (a profile, an enrolment). */
|
|
16134
|
+
rows: number().int(),
|
|
16135
|
+
/** Rows whose secret was plaintext when the run started. */
|
|
16136
|
+
raw: number().int(),
|
|
16137
|
+
/** Rows that already held a keychain marker when the run started. */
|
|
16138
|
+
markers: number().int(),
|
|
16139
|
+
/** Plaintext rows moved by THIS run (always 0 on a dry run). */
|
|
16140
|
+
migrated: number().int(),
|
|
16141
|
+
/** Plaintext rows left in place because the move or its read-back failed. */
|
|
16142
|
+
failed: number().int(),
|
|
16143
|
+
/** After the run: rows still holding plaintext. */
|
|
16144
|
+
remainingRaw: number().int(),
|
|
16145
|
+
/** After the run: markers the keychain could not resolve right now. */
|
|
16146
|
+
unresolvedMarkers: number().int(),
|
|
16147
|
+
/**
|
|
16148
|
+
* A second, redundant copy of the secrets' rows that the run found (and, on
|
|
16149
|
+
* `apply`, deleted after verifying the first). Owners with a single copy omit it.
|
|
16150
|
+
*/
|
|
16151
|
+
redundantCopies: number().int().optional(),
|
|
16152
|
+
/** True when nothing is raw and every marker resolves. */
|
|
16153
|
+
verified: boolean()
|
|
16154
|
+
});
|
|
15578
16155
|
/** Where a block runs. The operator chooses — a block driving a device on an
|
|
15579
16156
|
* agent is the reason placement is not fixed to the hub. */
|
|
15580
16157
|
var CoreBlockPlacementSchema = union([literal("hub"), string$2().min(1)]);
|
|
@@ -15801,6 +16378,9 @@ method(object({}), object({ blocks: array(CoreBlockSchema) }), { auth: "admin" }
|
|
|
15801
16378
|
}), SettingsUpdateResultSchema, {
|
|
15802
16379
|
kind: "mutation",
|
|
15803
16380
|
auth: "admin"
|
|
16381
|
+
}), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
|
|
16382
|
+
kind: "mutation",
|
|
16383
|
+
auth: "admin"
|
|
15804
16384
|
}), method(object({}), object({ libs: array(object({
|
|
15805
16385
|
filePath: string$2(),
|
|
15806
16386
|
content: string$2()
|
|
@@ -16064,6 +16644,347 @@ id: union([string$2(), number()]) }), {
|
|
|
16064
16644
|
auth: "admin"
|
|
16065
16645
|
});
|
|
16066
16646
|
/**
|
|
16647
|
+
* records - an addon's own facts and documents (D881): ledgers, audit rows,
|
|
16648
|
+
* config documents, mirrors. The third storage API next to `ctx.settings`
|
|
16649
|
+
* (operator intent, D870) and device-history (numbers over time, D850).
|
|
16650
|
+
*
|
|
16651
|
+
* Who the OWNER is: `callerAddonId`, stamped by the transport on a call that
|
|
16652
|
+
* crossed a process and stated by a hub in-process caller (`ctx.records` does
|
|
16653
|
+
* that with the addon id closed over). It is deliberately NOT in any input
|
|
16654
|
+
* schema, so a session can never supply it, and a call with no stamp is refused
|
|
16655
|
+
* `records/no-caller`. A kind is readable and writable only by its owner; other
|
|
16656
|
+
* addons go through the owner's capability.
|
|
16657
|
+
*
|
|
16658
|
+
* Every read is three-way: a row, `null`, or the call THROWS. A failed read is
|
|
16659
|
+
* never `[]`. Secret fields are never on the wire: a read shows the
|
|
16660
|
+
* redaction token, `secretRefs` hands the owner's `ctx.secrets` the refs it
|
|
16661
|
+
* resolves itself, and a write may carry only a keychain marker bound to the
|
|
16662
|
+
* row's own ref.
|
|
16663
|
+
*
|
|
16664
|
+
* Internal: addons reach it through `ctx.records`, never directly.
|
|
16665
|
+
*/
|
|
16666
|
+
var RecordIdSchema = string$2().min(1).max(256);
|
|
16667
|
+
/** A JSON object body. Size is the engine's check (`maxDataBytes`), not a schema's. */
|
|
16668
|
+
var RecordBodySchema = record(string$2(), unknown());
|
|
16669
|
+
var RecordInputSchema = object({
|
|
16670
|
+
id: RecordIdSchema,
|
|
16671
|
+
/** The device this row belongs to (D865 removal, per-device reads). */
|
|
16672
|
+
deviceId: number().int().optional(),
|
|
16673
|
+
/** The domain clock, ms: observed / created / opened. */
|
|
16674
|
+
at: number().int().optional(),
|
|
16675
|
+
/** Producer-set expiry, ms. Refused on a kind whose retention is an engine TTL. */
|
|
16676
|
+
expiresAt: number().int().optional(),
|
|
16677
|
+
data: RecordBodySchema
|
|
16678
|
+
});
|
|
16679
|
+
var RecordViewSchema = object({
|
|
16680
|
+
id: string$2(),
|
|
16681
|
+
deviceId: number().int().nullable(),
|
|
16682
|
+
at: number().nullable(),
|
|
16683
|
+
expiresAt: number().nullable(),
|
|
16684
|
+
rev: number().int(),
|
|
16685
|
+
updatedAt: number(),
|
|
16686
|
+
data: RecordBodySchema
|
|
16687
|
+
});
|
|
16688
|
+
/** Declared index fields only. Anything else does not compile, by design. */
|
|
16689
|
+
var RecordWhereSchema = record(RecordFieldPathSchema, union([
|
|
16690
|
+
string$2(),
|
|
16691
|
+
number(),
|
|
16692
|
+
boolean(),
|
|
16693
|
+
object({ in: array(union([
|
|
16694
|
+
string$2(),
|
|
16695
|
+
number(),
|
|
16696
|
+
boolean()
|
|
16697
|
+
])).min(1).max(RECORD_BATCH_MAX) }),
|
|
16698
|
+
object({
|
|
16699
|
+
gt: union([string$2(), number()]).optional(),
|
|
16700
|
+
gte: union([string$2(), number()]).optional(),
|
|
16701
|
+
lt: union([string$2(), number()]).optional(),
|
|
16702
|
+
lte: union([string$2(), number()]).optional()
|
|
16703
|
+
}).refine((r) => Object.keys(r).length > 0, { message: "name at least one bound" })
|
|
16704
|
+
]));
|
|
16705
|
+
var KindShape = { kind: RecordKindNameSchema };
|
|
16706
|
+
var TimeWindowShape = {
|
|
16707
|
+
deviceId: number().int().optional(),
|
|
16708
|
+
atFrom: number().optional(),
|
|
16709
|
+
atTo: number().optional()
|
|
16710
|
+
};
|
|
16711
|
+
var RecordQueryInputSchema = object({
|
|
16712
|
+
...KindShape,
|
|
16713
|
+
...TimeWindowShape,
|
|
16714
|
+
where: RecordWhereSchema.optional(),
|
|
16715
|
+
/** Without `where`: `at` (default for a kind with a clock) or `id`. With `where` the order is the index's. */
|
|
16716
|
+
order: _enum(["at", "id"]).optional(),
|
|
16717
|
+
desc: boolean().optional(),
|
|
16718
|
+
limit: number().int().min(1).max(RECORD_QUERY_MAX).default(100),
|
|
16719
|
+
/** Opaque keyset cursor from a previous answer. There is no offset. */
|
|
16720
|
+
cursor: string$2().min(1).optional()
|
|
16721
|
+
});
|
|
16722
|
+
var RecordQueryResultSchema = object({
|
|
16723
|
+
records: array(RecordViewSchema),
|
|
16724
|
+
nextCursor: string$2().nullable()
|
|
16725
|
+
});
|
|
16726
|
+
var RecordKindStateSchema = _enum([
|
|
16727
|
+
"created",
|
|
16728
|
+
"unchanged",
|
|
16729
|
+
"updated"
|
|
16730
|
+
]);
|
|
16731
|
+
var DeclareKindResultSchema = object({
|
|
16732
|
+
kindId: number().int(),
|
|
16733
|
+
state: RecordKindStateSchema,
|
|
16734
|
+
createdIndexes: array(string$2()),
|
|
16735
|
+
/** The boot guard: the kind is empty while its legacy table still holds rows. */
|
|
16736
|
+
adoptionPending: object({
|
|
16737
|
+
legacyTable: string$2(),
|
|
16738
|
+
legacyRows: number().int()
|
|
16739
|
+
}).nullable()
|
|
16740
|
+
});
|
|
16741
|
+
/** Keychain refs a write released (the old marker is gone from the row): the owner deletes the values. */
|
|
16742
|
+
var SecretRefsList = array(string$2());
|
|
16743
|
+
var RecordSecretRefsSchema = record(string$2(), record(string$2(), string$2()));
|
|
16744
|
+
method(object({ kinds: record(RecordKindNameSchema, RecordKindDeclarationSchema) }), object({ kinds: record(string$2(), DeclareKindResultSchema) }), {
|
|
16745
|
+
kind: "mutation",
|
|
16746
|
+
auth: "admin"
|
|
16747
|
+
}), method(object({
|
|
16748
|
+
...KindShape,
|
|
16749
|
+
id: RecordIdSchema
|
|
16750
|
+
}), RecordViewSchema.nullable(), { auth: "admin" }), method(object({
|
|
16751
|
+
...KindShape,
|
|
16752
|
+
ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
|
|
16753
|
+
}), array(RecordViewSchema), { auth: "admin" }), method(object({
|
|
16754
|
+
...KindShape,
|
|
16755
|
+
ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
|
|
16756
|
+
}), RecordSecretRefsSchema, { auth: "admin" }), method(object({
|
|
16757
|
+
...KindShape,
|
|
16758
|
+
record: RecordInputSchema,
|
|
16759
|
+
/** Compare-and-set. `0` means "the row must not exist". */
|
|
16760
|
+
ifRev: number().int().min(0).optional()
|
|
16761
|
+
}), object({
|
|
16762
|
+
rev: number().int(),
|
|
16763
|
+
releasedRefs: SecretRefsList
|
|
16764
|
+
}), {
|
|
16765
|
+
kind: "mutation",
|
|
16766
|
+
auth: "admin"
|
|
16767
|
+
}), method(object({
|
|
16768
|
+
...KindShape,
|
|
16769
|
+
records: array(RecordInputSchema).min(1).max(RECORD_BATCH_MAX)
|
|
16770
|
+
}), object({
|
|
16771
|
+
count: number().int(),
|
|
16772
|
+
releasedRefs: SecretRefsList
|
|
16773
|
+
}), {
|
|
16774
|
+
kind: "mutation",
|
|
16775
|
+
auth: "admin"
|
|
16776
|
+
}), method(object({
|
|
16777
|
+
...KindShape,
|
|
16778
|
+
id: RecordIdSchema,
|
|
16779
|
+
data: RecordBodySchema,
|
|
16780
|
+
at: number().int().nullable().optional(),
|
|
16781
|
+
expiresAt: number().int().nullable().optional(),
|
|
16782
|
+
ifRev: number().int().min(1).optional()
|
|
16783
|
+
}), object({
|
|
16784
|
+
rev: number().int(),
|
|
16785
|
+
releasedRefs: SecretRefsList
|
|
16786
|
+
}), {
|
|
16787
|
+
kind: "mutation",
|
|
16788
|
+
auth: "admin"
|
|
16789
|
+
}), method(object({
|
|
16790
|
+
...KindShape,
|
|
16791
|
+
id: RecordIdSchema
|
|
16792
|
+
}), object({
|
|
16793
|
+
deleted: boolean(),
|
|
16794
|
+
secretRefs: SecretRefsList
|
|
16795
|
+
}), {
|
|
16796
|
+
kind: "mutation",
|
|
16797
|
+
auth: "admin"
|
|
16798
|
+
}), method(object({
|
|
16799
|
+
...KindShape,
|
|
16800
|
+
ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
|
|
16801
|
+
}), object({
|
|
16802
|
+
deleted: number().int(),
|
|
16803
|
+
secretRefs: SecretRefsList
|
|
16804
|
+
}), {
|
|
16805
|
+
kind: "mutation",
|
|
16806
|
+
auth: "admin"
|
|
16807
|
+
}), method(RecordQueryInputSchema, RecordQueryResultSchema, { auth: "admin" }), method(object({
|
|
16808
|
+
...KindShape,
|
|
16809
|
+
...TimeWindowShape,
|
|
16810
|
+
where: RecordWhereSchema.optional()
|
|
16811
|
+
}), object({ count: number().int() }), { auth: "admin" }), method(object({
|
|
16812
|
+
...KindShape,
|
|
16813
|
+
deviceId: number().int().optional(),
|
|
16814
|
+
from: number(),
|
|
16815
|
+
to: number(),
|
|
16816
|
+
bucketMs: number().int().positive()
|
|
16817
|
+
}), object({ buckets: array(object({
|
|
16818
|
+
bucketStart: number(),
|
|
16819
|
+
count: number().int()
|
|
16820
|
+
})) }), { auth: "admin" }), method(object({
|
|
16821
|
+
...KindShape,
|
|
16822
|
+
op: _enum([
|
|
16823
|
+
"sum",
|
|
16824
|
+
"min",
|
|
16825
|
+
"max",
|
|
16826
|
+
"count"
|
|
16827
|
+
]),
|
|
16828
|
+
field: RecordFieldPathSchema.optional(),
|
|
16829
|
+
groupBy: RecordFieldPathSchema.optional(),
|
|
16830
|
+
where: RecordWhereSchema.optional()
|
|
16831
|
+
}), object({ rows: array(object({
|
|
16832
|
+
group: union([
|
|
16833
|
+
string$2(),
|
|
16834
|
+
number(),
|
|
16835
|
+
_null()
|
|
16836
|
+
]),
|
|
16837
|
+
value: number().nullable()
|
|
16838
|
+
})) }), { auth: "admin" }), method(object({
|
|
16839
|
+
...KindShape,
|
|
16840
|
+
deviceId: number().int().optional(),
|
|
16841
|
+
atBefore: number().optional(),
|
|
16842
|
+
where: RecordWhereSchema.optional()
|
|
16843
|
+
}), object({
|
|
16844
|
+
deleted: number().int(),
|
|
16845
|
+
secretRefs: SecretRefsList
|
|
16846
|
+
}), {
|
|
16847
|
+
kind: "mutation",
|
|
16848
|
+
auth: "admin"
|
|
16849
|
+
}), method(object({
|
|
16850
|
+
deviceId: number().int(),
|
|
16851
|
+
kinds: array(RecordKindNameSchema).optional()
|
|
16852
|
+
}), object({
|
|
16853
|
+
deleted: record(string$2(), number().int()),
|
|
16854
|
+
secretRefs: SecretRefsList
|
|
16855
|
+
}), {
|
|
16856
|
+
kind: "mutation",
|
|
16857
|
+
auth: "admin"
|
|
16858
|
+
}), method(object(KindShape), object({ id: number().int() }), {
|
|
16859
|
+
kind: "mutation",
|
|
16860
|
+
auth: "admin"
|
|
16861
|
+
});
|
|
16862
|
+
/** One table of the settings database. */
|
|
16863
|
+
var StorageTableSchema = object({
|
|
16864
|
+
/** The table's full name, e.g. `recorder:addon-settings` or `addon-device-settings`. */
|
|
16865
|
+
name: string$2(),
|
|
16866
|
+
/** The owner prefix of a scoped name (`recorder` for `recorder:addon-settings`), else null. */
|
|
16867
|
+
owner: string$2().nullable(),
|
|
16868
|
+
rows: number().int().nonnegative(),
|
|
16869
|
+
/** Bytes the table's pages occupy (`dbstat`); null when the engine cannot measure. */
|
|
16870
|
+
bytes: number().int().nonnegative().nullable(),
|
|
16871
|
+
/** Declared by an addon since this engine process started (a running addon claims it). */
|
|
16872
|
+
declaredThisBoot: boolean()
|
|
16873
|
+
});
|
|
16874
|
+
/** One declared record kind (D881) as System -> Data shows it. */
|
|
16875
|
+
var StorageKindSchema = object({
|
|
16876
|
+
owner: string$2(),
|
|
16877
|
+
kind: string$2(),
|
|
16878
|
+
database: _enum(["settings", "events"]),
|
|
16879
|
+
class: string$2(),
|
|
16880
|
+
state: _enum([
|
|
16881
|
+
"declared",
|
|
16882
|
+
"orphaned",
|
|
16883
|
+
"dropped"
|
|
16884
|
+
]),
|
|
16885
|
+
/** `null` when the caller asked for no counts (`counts: false`). */
|
|
16886
|
+
rows: number().int().nonnegative().nullable(),
|
|
16887
|
+
/** Rows x the average size of a sample; null for an empty kind. */
|
|
16888
|
+
bytesEstimate: number().int().nonnegative().nullable(),
|
|
16889
|
+
writeTrigger: string$2(),
|
|
16890
|
+
retention: RecordRetentionSchema,
|
|
16891
|
+
/** `true` when the kind is an entry kind (the generic entries UI lists it). */
|
|
16892
|
+
entry: boolean(),
|
|
16893
|
+
/** The whole declaration, secret paths and entry descriptor included (the entries service builds its handle from it). */
|
|
16894
|
+
declaration: RecordKindDeclarationSchema
|
|
16895
|
+
});
|
|
16896
|
+
method(object({ ownerPrefix: string$2().min(1).optional() }), object({ tables: array(StorageTableSchema) }), { auth: "admin" }), method(object({
|
|
16897
|
+
collection: string$2().min(1),
|
|
16898
|
+
expectRows: number().int().nonnegative()
|
|
16899
|
+
}), object({
|
|
16900
|
+
dropped: literal(true),
|
|
16901
|
+
rows: number().int().nonnegative()
|
|
16902
|
+
}), {
|
|
16903
|
+
kind: "mutation",
|
|
16904
|
+
auth: "admin"
|
|
16905
|
+
}), method(object({
|
|
16906
|
+
owner: string$2().min(1).optional(),
|
|
16907
|
+
/** `false` skips the per-kind row count (a catalog read only). Default true. */
|
|
16908
|
+
counts: boolean().optional()
|
|
16909
|
+
}), object({ kinds: array(StorageKindSchema) }), { auth: "admin" }), method(RecordQueryInputSchema.extend({
|
|
16910
|
+
owner: string$2().min(1),
|
|
16911
|
+
kind: RecordKindNameSchema
|
|
16912
|
+
}), RecordQueryResultSchema, { auth: "admin" }), method(object({
|
|
16913
|
+
owner: string$2().min(1),
|
|
16914
|
+
kind: RecordKindNameSchema,
|
|
16915
|
+
records: array(RecordInputSchema).max(RECORD_BATCH_MAX),
|
|
16916
|
+
/** The LAST batch: the copy is complete, the boot guard stops asking. */
|
|
16917
|
+
complete: boolean().optional()
|
|
16918
|
+
}).refine((input) => input.records.length > 0 || input.complete === true, { message: "records must be non-empty unless complete is true" }), object({ adopted: number().int() }), {
|
|
16919
|
+
kind: "mutation",
|
|
16920
|
+
auth: "admin"
|
|
16921
|
+
}), method(object({
|
|
16922
|
+
collection: string$2().min(1),
|
|
16923
|
+
cursor: string$2().optional(),
|
|
16924
|
+
limit: number().int().min(1).max(1e3).optional()
|
|
16925
|
+
}), object({
|
|
16926
|
+
rows: array(object({
|
|
16927
|
+
id: string$2(),
|
|
16928
|
+
data: record(string$2(), unknown())
|
|
16929
|
+
})),
|
|
16930
|
+
nextCursor: string$2().nullable()
|
|
16931
|
+
}), { auth: "admin" }), method(object({ collection: string$2().min(1) }), object({ adopted: boolean() }), { auth: "admin" });
|
|
16932
|
+
/**
|
|
16933
|
+
* record-entries - the ONE admin surface for every list of user-created entries
|
|
16934
|
+
* (D881): notification targets, brokers, LLM profiles, anything an addon
|
|
16935
|
+
* declares as an ENTRY kind (`entry: { title }` in `defineRecordKinds`).
|
|
16936
|
+
*
|
|
16937
|
+
* The UI is generic. `listEntryKinds` hands it, per kind, the JSON Schema of
|
|
16938
|
+
* the entry body with `secret: true` on every credential field, so a password
|
|
16939
|
+
* field is derived from the schema and never from a name. `putEntry` takes the
|
|
16940
|
+
* redaction token for an untouched secret (the stored value is kept), a string
|
|
16941
|
+
* for a new one, and the clear instruction to remove one. A read never carries
|
|
16942
|
+
* a secret value, and a locked keychain refuses the write with
|
|
16943
|
+
* `records/secret-unavailable` instead of storing plaintext.
|
|
16944
|
+
*
|
|
16945
|
+
* Hub-only, served in-process (it acts for each entry's owner on the keychain).
|
|
16946
|
+
*/
|
|
16947
|
+
var EntryKindInfoSchema = object({
|
|
16948
|
+
owner: string$2(),
|
|
16949
|
+
kind: RecordKindNameSchema,
|
|
16950
|
+
title: string$2(),
|
|
16951
|
+
nameField: string$2(),
|
|
16952
|
+
/** JSON Schema of the body; `secret: true` marks a password field. */
|
|
16953
|
+
fields: record(string$2(), unknown()),
|
|
16954
|
+
secretPaths: array(string$2()),
|
|
16955
|
+
rows: number().int().nonnegative()
|
|
16956
|
+
});
|
|
16957
|
+
var EntryViewSchema = object({
|
|
16958
|
+
id: RecordIdSchema,
|
|
16959
|
+
name: string$2(),
|
|
16960
|
+
rev: number().int(),
|
|
16961
|
+
updatedAt: number(),
|
|
16962
|
+
/** Secret fields hold the redaction token. */
|
|
16963
|
+
data: RecordBodySchema
|
|
16964
|
+
});
|
|
16965
|
+
var EntryAddress = {
|
|
16966
|
+
owner: string$2().min(1),
|
|
16967
|
+
kind: RecordKindNameSchema
|
|
16968
|
+
};
|
|
16969
|
+
method(object({}), object({ kinds: array(EntryKindInfoSchema) }), { auth: "admin" }), method(object({ ...EntryAddress }), object({ entries: array(EntryViewSchema) }), { auth: "admin" }), method(object({
|
|
16970
|
+
...EntryAddress,
|
|
16971
|
+
id: RecordIdSchema.optional(),
|
|
16972
|
+
data: RecordBodySchema,
|
|
16973
|
+
ifRev: number().int().min(1).optional()
|
|
16974
|
+
}), object({
|
|
16975
|
+
id: string$2(),
|
|
16976
|
+
rev: number().int()
|
|
16977
|
+
}), {
|
|
16978
|
+
kind: "mutation",
|
|
16979
|
+
auth: "admin"
|
|
16980
|
+
}), method(object({
|
|
16981
|
+
...EntryAddress,
|
|
16982
|
+
id: RecordIdSchema
|
|
16983
|
+
}), object({ deleted: boolean() }), {
|
|
16984
|
+
kind: "mutation",
|
|
16985
|
+
auth: "admin"
|
|
16986
|
+
});
|
|
16987
|
+
/**
|
|
16067
16988
|
* `keychain` — the hub's encrypted store of secret values (D787).
|
|
16068
16989
|
*
|
|
16069
16990
|
* Settings blobs never hold a secret: they hold a marker
|
|
@@ -16604,6 +17525,16 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
|
|
|
16604
17525
|
kind: "mutation",
|
|
16605
17526
|
auth: "admin",
|
|
16606
17527
|
caller: "required"
|
|
17528
|
+
}), method(object({
|
|
17529
|
+
ref: string$2().min(1),
|
|
17530
|
+
value: string$2().min(1)
|
|
17531
|
+
}), object({
|
|
17532
|
+
ref: string$2(),
|
|
17533
|
+
version: number().int()
|
|
17534
|
+
}), {
|
|
17535
|
+
kind: "mutation",
|
|
17536
|
+
auth: "admin",
|
|
17537
|
+
caller: "required"
|
|
16607
17538
|
}), method(object({ refs: array(string$2().min(1)).max(1e3) }), object({
|
|
16608
17539
|
deleted: array(string$2()).readonly(),
|
|
16609
17540
|
kept: array(object({
|
|
@@ -39282,6 +40213,9 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
|
|
|
39282
40213
|
}), _void(), { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
|
|
39283
40214
|
kind: "mutation",
|
|
39284
40215
|
auth: "admin"
|
|
40216
|
+
}), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
|
|
40217
|
+
kind: "mutation",
|
|
40218
|
+
auth: "admin"
|
|
39285
40219
|
}), method(ProfileRefInputSchema, _void(), {
|
|
39286
40220
|
kind: "mutation",
|
|
39287
40221
|
auth: "admin"
|
|
@@ -49791,6 +50725,41 @@ var ServerRollbackInfoSchema = object({
|
|
|
49791
50725
|
atMs: number(),
|
|
49792
50726
|
reason: string$2()
|
|
49793
50727
|
});
|
|
50728
|
+
/**
|
|
50729
|
+
* The runner boot check (D877): the runners this node PLANNED (hub: one per
|
|
50730
|
+
* `resolveRunnerId` over its forked addons; agent: the runners its process
|
|
50731
|
+
* service holds, because only the hub plans) against the states the process
|
|
50732
|
+
* service reports. Kept in memory, recomputed by the same one-shot check after
|
|
50733
|
+
* every boot, served on `getServerPackageStatus`.
|
|
50734
|
+
*
|
|
50735
|
+
* `failed` is the D6 breaker's terminal state, `refused` a deterministic Init
|
|
50736
|
+
* refusal (an addon that said "I will not start, and here is why"), `missing` a
|
|
50737
|
+
* planned runner the process service has no entry for.
|
|
50738
|
+
*/
|
|
50739
|
+
var RunnerRefusalSchema = object({
|
|
50740
|
+
runnerId: string$2(),
|
|
50741
|
+
addonIds: array(string$2()),
|
|
50742
|
+
reason: string$2()
|
|
50743
|
+
});
|
|
50744
|
+
var RunnerBootCheckSchema = object({
|
|
50745
|
+
checkedAtMs: number(),
|
|
50746
|
+
/** Runners planned for this node. */
|
|
50747
|
+
expected: number(),
|
|
50748
|
+
/** Planned runners whose process is `running`. */
|
|
50749
|
+
running: number(),
|
|
50750
|
+
failed: array(string$2()),
|
|
50751
|
+
refused: array(RunnerRefusalSchema),
|
|
50752
|
+
missing: array(string$2()),
|
|
50753
|
+
/**
|
|
50754
|
+
* Runners still on their way: `starting`, or `crashed` waiting on a backoff
|
|
50755
|
+
* respawn. The check is FINAL only when this is empty; until then nothing is
|
|
50756
|
+
* pushed and the verdict is re-evaluated on the next runner state change.
|
|
50757
|
+
* Optional for version skew (absent = settled).
|
|
50758
|
+
*/
|
|
50759
|
+
pending: array(string$2()).optional(),
|
|
50760
|
+
/** True when the plan is the hub's (`missing` is then meaningful); false on an agent. */
|
|
50761
|
+
planKnown: boolean()
|
|
50762
|
+
});
|
|
49794
50763
|
var ServerPackageStatusSchema = object({
|
|
49795
50764
|
/** Root package name (`@camstack/server` on the hub). */
|
|
49796
50765
|
packageName: string$2(),
|
|
@@ -49853,7 +50822,14 @@ var ServerPackageStatusSchema = object({
|
|
|
49853
50822
|
* for version skew: an older provider's payload simply omits it, and an
|
|
49854
50823
|
* absent wrapper is unknown — never `native`.
|
|
49855
50824
|
*/
|
|
49856
|
-
wrapper: WrapperIdentitySchema.optional()
|
|
50825
|
+
wrapper: WrapperIdentitySchema.optional(),
|
|
50826
|
+
/**
|
|
50827
|
+
* What this node PLANNED to run against what its process service reports
|
|
50828
|
+
* (D877). Absent until the one-shot boot check has run (~60 s after boot) and
|
|
50829
|
+
* on a provider that predates it. Absent is "not checked yet", never "all
|
|
50830
|
+
* well": a consumer that needs the answer treats it as pending.
|
|
50831
|
+
*/
|
|
50832
|
+
runners: RunnerBootCheckSchema.optional()
|
|
49857
50833
|
});
|
|
49858
50834
|
var ServerUpdateCheckResultSchema = object({
|
|
49859
50835
|
packageName: string$2(),
|
|
@@ -49904,6 +50880,13 @@ var ServerUpdateOutcomeSchema = _enum([
|
|
|
49904
50880
|
"refused",
|
|
49905
50881
|
"failed"
|
|
49906
50882
|
]);
|
|
50883
|
+
/** One addon the pre-flight found the target version would refuse (D877). */
|
|
50884
|
+
var UpdateBlockerSchema = object({
|
|
50885
|
+
addonId: string$2(),
|
|
50886
|
+
reason: string$2(),
|
|
50887
|
+
/** What the operator does about it. */
|
|
50888
|
+
remedy: string$2()
|
|
50889
|
+
});
|
|
49907
50890
|
var ServerUpdateActionResultSchema = object({
|
|
49908
50891
|
accepted: boolean(),
|
|
49909
50892
|
targetVersion: string$2().nullable(),
|
|
@@ -49921,14 +50904,27 @@ var ServerUpdateActionResultSchema = object({
|
|
|
49921
50904
|
* The failure itself, verbatim enough to act on (the npm output for a
|
|
49922
50905
|
* staging install). Non-null only for `failed`.
|
|
49923
50906
|
*/
|
|
49924
|
-
error: string$2().nullable().optional()
|
|
50907
|
+
error: string$2().nullable().optional(),
|
|
50908
|
+
/**
|
|
50909
|
+
* The addons the target version would refuse to start on this node's live
|
|
50910
|
+
* store (D877), present when the pre-flight refused the update
|
|
50911
|
+
* (`reason: 'addon-would-refuse'`). Optional for version skew.
|
|
50912
|
+
*/
|
|
50913
|
+
blockers: array(UpdateBlockerSchema).optional()
|
|
49925
50914
|
});
|
|
49926
50915
|
method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), ServerUpdateCheckResultSchema, {
|
|
49927
50916
|
kind: "mutation",
|
|
49928
50917
|
auth: "admin"
|
|
49929
|
-
}), method(object({
|
|
49930
|
-
/** Explicit target version; omitted = latest from the registry. */
|
|
49931
|
-
version: string$2().optional()
|
|
50918
|
+
}), method(object({
|
|
50919
|
+
/** Explicit target version; omitted = latest from the registry. */
|
|
50920
|
+
version: string$2().optional(),
|
|
50921
|
+
/**
|
|
50922
|
+
* Apply even though the pre-flight (D877) found addons the target would
|
|
50923
|
+
* refuse to start. Off by default: those addons stay down until the
|
|
50924
|
+
* remedy is run, which is the incident this gate exists to prevent.
|
|
50925
|
+
*/
|
|
50926
|
+
acknowledgeRefusals: boolean().optional()
|
|
50927
|
+
}), ServerUpdateActionResultSchema, {
|
|
49932
50928
|
kind: "mutation",
|
|
49933
50929
|
auth: "admin",
|
|
49934
50930
|
timeoutMs: 16 * 6e4
|
|
@@ -52374,7 +53370,9 @@ var ManifestShapeSchema = object({
|
|
|
52374
53370
|
var AddonProcessSchema = object({
|
|
52375
53371
|
pid: number().optional(),
|
|
52376
53372
|
mode: string$2(),
|
|
52377
|
-
state: string$2()
|
|
53373
|
+
state: string$2(),
|
|
53374
|
+
/** Why the runner is `refused` (an addon's own words), when it is (D877). */
|
|
53375
|
+
reason: string$2().optional()
|
|
52378
53376
|
});
|
|
52379
53377
|
/**
|
|
52380
53378
|
* Per-addon health snapshot from the kernel's AddonHealthMonitor.
|
|
@@ -53142,7 +54140,8 @@ var batteryCapability = {
|
|
|
53142
54140
|
DeviceType.Button,
|
|
53143
54141
|
DeviceType.Switch,
|
|
53144
54142
|
DeviceType.PetFeeder,
|
|
53145
|
-
DeviceType.Container
|
|
54143
|
+
DeviceType.Container,
|
|
54144
|
+
DeviceType.Thermostat
|
|
53146
54145
|
],
|
|
53147
54146
|
methods: {
|
|
53148
54147
|
/**
|
|
@@ -53780,6 +54779,12 @@ var ClimateControlStatusSchema = object({
|
|
|
53780
54779
|
/** Horizontal louver swing on/off. Null when the device has no
|
|
53781
54780
|
* horizontal swing surface (gate with `DeviceFeature.ClimateSwingHorizontal`). */
|
|
53782
54781
|
swingHorizontal: boolean().nullable(),
|
|
54782
|
+
/** Lowest setpoint the device accepts, Celsius. Absent / null = not reported. */
|
|
54783
|
+
minTemp: number().nullable().optional(),
|
|
54784
|
+
/** Highest setpoint the device accepts, Celsius. Absent / null = not reported. */
|
|
54785
|
+
maxTemp: number().nullable().optional(),
|
|
54786
|
+
/** Setpoint granularity, Celsius (0.5, 1). Absent / null = not reported. */
|
|
54787
|
+
tempStep: number().positive().nullable().optional(),
|
|
53783
54788
|
/** Ms epoch when the slice was last updated (push or command). */
|
|
53784
54789
|
lastFetchedAt: number()
|
|
53785
54790
|
});
|
|
@@ -54626,6 +55631,125 @@ onStatusChanged: { data: object({
|
|
|
54626
55631
|
* whether persisting is worth a SQLite commit. */
|
|
54627
55632
|
volatileStateFields: ["lastChangedAt"]
|
|
54628
55633
|
};
|
|
55634
|
+
/**
|
|
55635
|
+
* Smart-dishwasher cap — program lifecycle, door / remote-start gates,
|
|
55636
|
+
* consumable levels (salt, rinse aid) and common program options.
|
|
55637
|
+
*
|
|
55638
|
+
* Sources: native Bosch Home Connect (`dishwasher` device type). Reusable
|
|
55639
|
+
* by any integration that exposes the same program / option surface.
|
|
55640
|
+
*
|
|
55641
|
+
* `kind: 'poll'` — cloud REST APIs typically have no push channel; the
|
|
55642
|
+
* provider refreshes the slice on an interval and eagerly after commands.
|
|
55643
|
+
*/
|
|
55644
|
+
var DishwasherStateSchema = _enum([
|
|
55645
|
+
"idle",
|
|
55646
|
+
"running",
|
|
55647
|
+
"paused",
|
|
55648
|
+
"finished",
|
|
55649
|
+
"error",
|
|
55650
|
+
"unavailable"
|
|
55651
|
+
]);
|
|
55652
|
+
var DishwasherConsumableLevelSchema = _enum([
|
|
55653
|
+
"ok",
|
|
55654
|
+
"low",
|
|
55655
|
+
"empty"
|
|
55656
|
+
]);
|
|
55657
|
+
var DishwasherStatusSchema = object({
|
|
55658
|
+
state: DishwasherStateSchema,
|
|
55659
|
+
/** Active program id/name, or null when none selected / unknown. */
|
|
55660
|
+
program: string$2().nullable(),
|
|
55661
|
+
/** Program tokens the hardware accepts — drives the UI selector. */
|
|
55662
|
+
availablePrograms: array(string$2()),
|
|
55663
|
+
/** Minutes remaining on the active cycle, or null when not running. */
|
|
55664
|
+
remainingMinutes: number().int().nonnegative().nullable(),
|
|
55665
|
+
/** Cycle completion 0..100, or null when not applicable. */
|
|
55666
|
+
progressPercent: number().min(0).max(100).nullable(),
|
|
55667
|
+
/** True when the door is reported open. */
|
|
55668
|
+
doorOpen: boolean(),
|
|
55669
|
+
/** True when remote start is allowed (door closed, power on, etc.). */
|
|
55670
|
+
remoteStartAllowed: boolean(),
|
|
55671
|
+
/** Main power / switched-on state. */
|
|
55672
|
+
powerOn: boolean(),
|
|
55673
|
+
saltLevel: DishwasherConsumableLevelSchema.nullable(),
|
|
55674
|
+
rinseAidLevel: DishwasherConsumableLevelSchema.nullable(),
|
|
55675
|
+
halfLoad: boolean(),
|
|
55676
|
+
hygienePlus: boolean(),
|
|
55677
|
+
errorCode: number().nullable(),
|
|
55678
|
+
errorLabel: string$2().nullable(),
|
|
55679
|
+
lastFetchedAt: number()
|
|
55680
|
+
});
|
|
55681
|
+
var dishwasherCapability = {
|
|
55682
|
+
name: "dishwasher",
|
|
55683
|
+
scope: "device",
|
|
55684
|
+
deviceNative: true,
|
|
55685
|
+
mode: "singleton",
|
|
55686
|
+
deviceTypes: [DeviceType.Dishwasher],
|
|
55687
|
+
methods: {
|
|
55688
|
+
start: method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
55689
|
+
kind: "mutation",
|
|
55690
|
+
auth: "protected"
|
|
55691
|
+
}),
|
|
55692
|
+
pause: method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
55693
|
+
kind: "mutation",
|
|
55694
|
+
auth: "protected"
|
|
55695
|
+
}),
|
|
55696
|
+
stop: method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
55697
|
+
kind: "mutation",
|
|
55698
|
+
auth: "protected"
|
|
55699
|
+
}),
|
|
55700
|
+
setProgram: method(object({
|
|
55701
|
+
deviceId: number().int().nonnegative(),
|
|
55702
|
+
program: string$2().min(1)
|
|
55703
|
+
}), _void(), {
|
|
55704
|
+
kind: "mutation",
|
|
55705
|
+
auth: "protected"
|
|
55706
|
+
}),
|
|
55707
|
+
setPower: method(object({
|
|
55708
|
+
deviceId: number().int().nonnegative(),
|
|
55709
|
+
on: boolean()
|
|
55710
|
+
}), _void(), {
|
|
55711
|
+
kind: "mutation",
|
|
55712
|
+
auth: "protected"
|
|
55713
|
+
}),
|
|
55714
|
+
setHalfLoad: method(object({
|
|
55715
|
+
deviceId: number().int().nonnegative(),
|
|
55716
|
+
on: boolean()
|
|
55717
|
+
}), _void(), {
|
|
55718
|
+
kind: "mutation",
|
|
55719
|
+
auth: "protected"
|
|
55720
|
+
}),
|
|
55721
|
+
setHygienePlus: method(object({
|
|
55722
|
+
deviceId: number().int().nonnegative(),
|
|
55723
|
+
on: boolean()
|
|
55724
|
+
}), _void(), {
|
|
55725
|
+
kind: "mutation",
|
|
55726
|
+
auth: "protected"
|
|
55727
|
+
}),
|
|
55728
|
+
setOption: method(object({
|
|
55729
|
+
deviceId: number().int().nonnegative(),
|
|
55730
|
+
key: string$2().min(1),
|
|
55731
|
+
value: union([
|
|
55732
|
+
boolean(),
|
|
55733
|
+
string$2(),
|
|
55734
|
+
number()
|
|
55735
|
+
])
|
|
55736
|
+
}), _void(), {
|
|
55737
|
+
kind: "mutation",
|
|
55738
|
+
auth: "protected"
|
|
55739
|
+
})
|
|
55740
|
+
},
|
|
55741
|
+
status: {
|
|
55742
|
+
schema: DishwasherStatusSchema,
|
|
55743
|
+
kind: "poll"
|
|
55744
|
+
},
|
|
55745
|
+
runtimeState: DishwasherStatusSchema,
|
|
55746
|
+
durability: "session",
|
|
55747
|
+
history: { fields: { progressPercent: {
|
|
55748
|
+
kind: "gauge",
|
|
55749
|
+
unit: "%",
|
|
55750
|
+
deadband: 2
|
|
55751
|
+
} } }
|
|
55752
|
+
};
|
|
54629
55753
|
var DoorbellStatusSchema = object({
|
|
54630
55754
|
/** Ms epoch of the last press. null = never observed since this provider started. */
|
|
54631
55755
|
lastPressedAt: number().nullable(),
|
|
@@ -55428,6 +56552,32 @@ var gasCapability = {
|
|
|
55428
56552
|
* whether persisting is worth a SQLite commit. */
|
|
55429
56553
|
volatileStateFields: ["lastChangedAt"]
|
|
55430
56554
|
};
|
|
56555
|
+
var HeatingValveStatusSchema = object({
|
|
56556
|
+
/** Radiator valve opening 0 (closed) .. 100 (open). Null = not yet known. */
|
|
56557
|
+
position: number().min(0).max(100).nullable(),
|
|
56558
|
+
/** Ms epoch when the slice was last updated (push or poll). */
|
|
56559
|
+
lastFetchedAt: number()
|
|
56560
|
+
});
|
|
56561
|
+
var heatingValveCapability = {
|
|
56562
|
+
name: "heating-valve",
|
|
56563
|
+
scope: "device",
|
|
56564
|
+
deviceNative: true,
|
|
56565
|
+
mode: "singleton",
|
|
56566
|
+
deviceTypes: [DeviceType.Thermostat],
|
|
56567
|
+
methods: {},
|
|
56568
|
+
status: {
|
|
56569
|
+
schema: HeatingValveStatusSchema,
|
|
56570
|
+
kind: "push"
|
|
56571
|
+
},
|
|
56572
|
+
runtimeState: HeatingValveStatusSchema,
|
|
56573
|
+
durability: "session",
|
|
56574
|
+
history: { fields: { position: {
|
|
56575
|
+
kind: "gauge",
|
|
56576
|
+
unit: "%",
|
|
56577
|
+
deadband: 1
|
|
56578
|
+
} } },
|
|
56579
|
+
volatileStateFields: ["lastFetchedAt"]
|
|
56580
|
+
};
|
|
55431
56581
|
/**
|
|
55432
56582
|
* Humidifier / dehumidifier cap. Models HA `humidifier.*` entities —
|
|
55433
56583
|
* an on/off actuator with an optional target-humidity setpoint and an
|
|
@@ -56560,7 +57710,19 @@ var TlsStatusSchema = object({
|
|
|
56560
57710
|
sans: array(string$2()),
|
|
56561
57711
|
caCertPem: string$2().nullable(),
|
|
56562
57712
|
reissueError: string$2().nullable(),
|
|
56563
|
-
restartRequired: boolean()
|
|
57713
|
+
restartRequired: boolean(),
|
|
57714
|
+
/** An uploaded certificate is served but no CA is kept for it and it is not publicly signed (D873). */
|
|
57715
|
+
caMissing: boolean(),
|
|
57716
|
+
/** Does the hub's own generated CA carry a critical name constraint? `null` while it has none. */
|
|
57717
|
+
localCaConstrained: boolean().nullable(),
|
|
57718
|
+
/** ISO time the generated CA was replaced by a constrained one; devices must re-download it. */
|
|
57719
|
+
caReplacedAt: string$2().nullable(),
|
|
57720
|
+
/** The uploaded certificate kept on disk, selectable again after "Revert to generated". */
|
|
57721
|
+
storedUpload: object({
|
|
57722
|
+
leafFingerprintSha256: string$2(),
|
|
57723
|
+
validTo: string$2(),
|
|
57724
|
+
hasCa: boolean()
|
|
57725
|
+
}).nullable()
|
|
56564
57726
|
});
|
|
56565
57727
|
method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(object({
|
|
56566
57728
|
/**
|
|
@@ -56616,6 +57778,9 @@ method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(obje
|
|
|
56616
57778
|
}), method(_void(), object({ pem: string$2() })), method(_void(), TlsStatusSchema, {
|
|
56617
57779
|
kind: "mutation",
|
|
56618
57780
|
auth: "admin"
|
|
57781
|
+
}), method(_void(), TlsStatusSchema, {
|
|
57782
|
+
kind: "mutation",
|
|
57783
|
+
auth: "admin"
|
|
56619
57784
|
});
|
|
56620
57785
|
var LockControlStatusSchema = object({
|
|
56621
57786
|
/** Lifecycle state of the lock. `jammed` means the motor reported
|
|
@@ -63109,7 +64274,11 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
63109
64274
|
kind: "mutation",
|
|
63110
64275
|
auth: "admin",
|
|
63111
64276
|
access: "delete"
|
|
63112
|
-
}), method(object({ userId: string$2() }), TotpStatusSchema, { auth: "admin" }), method(
|
|
64277
|
+
}), method(object({ userId: string$2() }), TotpStatusSchema, { auth: "admin" }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
|
|
64278
|
+
kind: "mutation",
|
|
64279
|
+
auth: "admin",
|
|
64280
|
+
access: "create"
|
|
64281
|
+
}), method(object({
|
|
63113
64282
|
userId: string$2(),
|
|
63114
64283
|
code: string$2()
|
|
63115
64284
|
}), object({ valid: boolean() }), {
|
|
@@ -64829,6 +65998,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
|
|
|
64829
65998
|
dayNight: dayNightCapability,
|
|
64830
65999
|
deviceDiscovery: deviceDiscoveryCapability,
|
|
64831
66000
|
deviceStatus: deviceStatusCapability,
|
|
66001
|
+
dishwasher: dishwasherCapability,
|
|
64832
66002
|
doorbell: doorbellCapability,
|
|
64833
66003
|
enumSensor: enumSensorCapability,
|
|
64834
66004
|
eventEmitter: eventEmitterCapability,
|
|
@@ -64836,6 +66006,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
|
|
|
64836
66006
|
featureProbe: featureProbeCapability,
|
|
64837
66007
|
flood: floodCapability,
|
|
64838
66008
|
gas: gasCapability,
|
|
66009
|
+
heatingValve: heatingValveCapability,
|
|
64839
66010
|
humidifier: humidifierCapability,
|
|
64840
66011
|
humiditySensor: humiditySensorCapability,
|
|
64841
66012
|
image: imageCapability,
|
|
@@ -64921,13 +66092,14 @@ var BaseDevice = class {
|
|
|
64921
66092
|
get state() {
|
|
64922
66093
|
if (!this._stateProxyCache) {
|
|
64923
66094
|
const cache = {};
|
|
64924
|
-
const handler = { get: (
|
|
66095
|
+
const handler = { get: (target, key) => {
|
|
64925
66096
|
const k = key;
|
|
64926
|
-
|
|
66097
|
+
const existing = Reflect.get(target, k);
|
|
66098
|
+
if (existing !== void 0) return existing;
|
|
64927
66099
|
const cap = DEVICE_LOCAL_STATE_CAPS[k];
|
|
64928
66100
|
if (!cap) return void 0;
|
|
64929
66101
|
const proxy = this.sliceProxy(cap);
|
|
64930
|
-
|
|
66102
|
+
Reflect.set(target, k, proxy);
|
|
64931
66103
|
return proxy;
|
|
64932
66104
|
} };
|
|
64933
66105
|
this._stateProxyCache = new Proxy(cache, handler);
|
|
@@ -65126,7 +66298,7 @@ var BaseDevice = class {
|
|
|
65126
66298
|
async updateSourceInfo(patch) {
|
|
65127
66299
|
const next = mergeSourceInfo(this.sourceInfo, patch);
|
|
65128
66300
|
this._sourceInfoCache = Object.freeze({ ...next });
|
|
65129
|
-
const action = this.ctx.api
|
|
66301
|
+
const action = this.ctx.api.deviceManager?.setMetadata;
|
|
65130
66302
|
if (action) try {
|
|
65131
66303
|
await action.mutate({
|
|
65132
66304
|
deviceId: this.id,
|
|
@@ -65161,7 +66333,7 @@ var BaseDevice = class {
|
|
|
65161
66333
|
* device boot on a meta refresh.
|
|
65162
66334
|
*/
|
|
65163
66335
|
async refreshFeatures() {
|
|
65164
|
-
const action = this.ctx.api
|
|
66336
|
+
const action = this.ctx.api.deviceManager?.registerDevice;
|
|
65165
66337
|
if (!action) return;
|
|
65166
66338
|
try {
|
|
65167
66339
|
await action.mutate({
|
|
@@ -65560,6 +66732,12 @@ var BaseDeviceProvider = class extends BaseAddon {
|
|
|
65560
66732
|
provider: this
|
|
65561
66733
|
}];
|
|
65562
66734
|
}
|
|
66735
|
+
/** Flatten `super.onInitialize()` whether it returned an array or an envelope. */
|
|
66736
|
+
providerRegistrationsFromSuper(result) {
|
|
66737
|
+
if (Array.isArray(result)) return result;
|
|
66738
|
+
if (result !== void 0 && result.providers !== void 0) return [...result.providers];
|
|
66739
|
+
return [];
|
|
66740
|
+
}
|
|
65563
66741
|
async onShutdown() {
|
|
65564
66742
|
this._restoreShuttingDown = true;
|
|
65565
66743
|
this.cancelRestoreRetries();
|
|
@@ -66086,7 +67264,7 @@ var BaseDeviceProvider = class extends BaseAddon {
|
|
|
66086
67264
|
return toDeviceSummary(device, this.addonId);
|
|
66087
67265
|
}
|
|
66088
67266
|
};
|
|
66089
|
-
DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Camera, DeviceType.Hub, DeviceType.Switch, DeviceType.Siren, DeviceType.Light, DeviceType.Fan, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder;
|
|
67267
|
+
DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Camera, DeviceType.Hub, DeviceType.Switch, DeviceType.Siren, DeviceType.Light, DeviceType.Fan, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.Dishwasher;
|
|
66090
67268
|
new Set(Object.values(DeviceType));
|
|
66091
67269
|
Object.freeze({
|
|
66092
67270
|
"accessories.getStatus": {
|
|
@@ -67235,6 +68413,12 @@ Object.freeze({
|
|
|
67235
68413
|
addonId: null,
|
|
67236
68414
|
access: "view"
|
|
67237
68415
|
},
|
|
68416
|
+
"coreBlocks.migrateRawSecrets": {
|
|
68417
|
+
capName: "core-blocks",
|
|
68418
|
+
capScope: "system",
|
|
68419
|
+
addonId: null,
|
|
68420
|
+
access: "create"
|
|
68421
|
+
},
|
|
67238
68422
|
"coreBlocks.restart": {
|
|
67239
68423
|
capName: "core-blocks",
|
|
67240
68424
|
capScope: "system",
|
|
@@ -68501,6 +69685,60 @@ Object.freeze({
|
|
|
68501
69685
|
addonId: null,
|
|
68502
69686
|
access: "view"
|
|
68503
69687
|
},
|
|
69688
|
+
"dishwasher.getStatus": {
|
|
69689
|
+
capName: "dishwasher",
|
|
69690
|
+
capScope: "device",
|
|
69691
|
+
addonId: null,
|
|
69692
|
+
access: "view"
|
|
69693
|
+
},
|
|
69694
|
+
"dishwasher.pause": {
|
|
69695
|
+
capName: "dishwasher",
|
|
69696
|
+
capScope: "device",
|
|
69697
|
+
addonId: null,
|
|
69698
|
+
access: "create"
|
|
69699
|
+
},
|
|
69700
|
+
"dishwasher.setHalfLoad": {
|
|
69701
|
+
capName: "dishwasher",
|
|
69702
|
+
capScope: "device",
|
|
69703
|
+
addonId: null,
|
|
69704
|
+
access: "create"
|
|
69705
|
+
},
|
|
69706
|
+
"dishwasher.setHygienePlus": {
|
|
69707
|
+
capName: "dishwasher",
|
|
69708
|
+
capScope: "device",
|
|
69709
|
+
addonId: null,
|
|
69710
|
+
access: "create"
|
|
69711
|
+
},
|
|
69712
|
+
"dishwasher.setOption": {
|
|
69713
|
+
capName: "dishwasher",
|
|
69714
|
+
capScope: "device",
|
|
69715
|
+
addonId: null,
|
|
69716
|
+
access: "create"
|
|
69717
|
+
},
|
|
69718
|
+
"dishwasher.setPower": {
|
|
69719
|
+
capName: "dishwasher",
|
|
69720
|
+
capScope: "device",
|
|
69721
|
+
addonId: null,
|
|
69722
|
+
access: "create"
|
|
69723
|
+
},
|
|
69724
|
+
"dishwasher.setProgram": {
|
|
69725
|
+
capName: "dishwasher",
|
|
69726
|
+
capScope: "device",
|
|
69727
|
+
addonId: null,
|
|
69728
|
+
access: "create"
|
|
69729
|
+
},
|
|
69730
|
+
"dishwasher.start": {
|
|
69731
|
+
capName: "dishwasher",
|
|
69732
|
+
capScope: "device",
|
|
69733
|
+
addonId: null,
|
|
69734
|
+
access: "create"
|
|
69735
|
+
},
|
|
69736
|
+
"dishwasher.stop": {
|
|
69737
|
+
capName: "dishwasher",
|
|
69738
|
+
capScope: "device",
|
|
69739
|
+
addonId: null,
|
|
69740
|
+
access: "create"
|
|
69741
|
+
},
|
|
68504
69742
|
"doorbell.getStatus": {
|
|
68505
69743
|
capName: "doorbell",
|
|
68506
69744
|
capScope: "device",
|
|
@@ -68711,6 +69949,12 @@ Object.freeze({
|
|
|
68711
69949
|
addonId: null,
|
|
68712
69950
|
access: "view"
|
|
68713
69951
|
},
|
|
69952
|
+
"heatingValve.getStatus": {
|
|
69953
|
+
capName: "heating-valve",
|
|
69954
|
+
capScope: "device",
|
|
69955
|
+
addonId: null,
|
|
69956
|
+
access: "view"
|
|
69957
|
+
},
|
|
68714
69958
|
"humidifier.getStatus": {
|
|
68715
69959
|
capName: "humidifier",
|
|
68716
69960
|
capScope: "device",
|
|
@@ -68921,6 +70165,12 @@ Object.freeze({
|
|
|
68921
70165
|
addonId: null,
|
|
68922
70166
|
access: "create"
|
|
68923
70167
|
},
|
|
70168
|
+
"keychainAdmin.importSecret": {
|
|
70169
|
+
capName: "keychain-admin",
|
|
70170
|
+
capScope: "system",
|
|
70171
|
+
addonId: null,
|
|
70172
|
+
access: "create"
|
|
70173
|
+
},
|
|
68924
70174
|
"keychainAdmin.listAudit": {
|
|
68925
70175
|
capName: "keychain-admin",
|
|
68926
70176
|
capScope: "system",
|
|
@@ -69089,6 +70339,12 @@ Object.freeze({
|
|
|
69089
70339
|
addonId: null,
|
|
69090
70340
|
access: "view"
|
|
69091
70341
|
},
|
|
70342
|
+
"llm.migrateRawSecrets": {
|
|
70343
|
+
capName: "llm",
|
|
70344
|
+
capScope: "system",
|
|
70345
|
+
addonId: null,
|
|
70346
|
+
access: "create"
|
|
70347
|
+
},
|
|
69092
70348
|
"llm.resolveModelRef": {
|
|
69093
70349
|
capName: "llm",
|
|
69094
70350
|
capScope: "system",
|
|
@@ -69317,6 +70573,12 @@ Object.freeze({
|
|
|
69317
70573
|
addonId: null,
|
|
69318
70574
|
access: "create"
|
|
69319
70575
|
},
|
|
70576
|
+
"localNetwork.useStoredUploadedCertificate": {
|
|
70577
|
+
capName: "local-network",
|
|
70578
|
+
capScope: "system",
|
|
70579
|
+
addonId: null,
|
|
70580
|
+
access: "create"
|
|
70581
|
+
},
|
|
69320
70582
|
"lockControl.getStatus": {
|
|
69321
70583
|
capName: "lock-control",
|
|
69322
70584
|
capScope: "device",
|
|
@@ -71969,6 +73231,30 @@ Object.freeze({
|
|
|
71969
73231
|
addonId: null,
|
|
71970
73232
|
access: "create"
|
|
71971
73233
|
},
|
|
73234
|
+
"recordEntries.deleteEntry": {
|
|
73235
|
+
capName: "record-entries",
|
|
73236
|
+
capScope: "system",
|
|
73237
|
+
addonId: null,
|
|
73238
|
+
access: "delete"
|
|
73239
|
+
},
|
|
73240
|
+
"recordEntries.listEntries": {
|
|
73241
|
+
capName: "record-entries",
|
|
73242
|
+
capScope: "system",
|
|
73243
|
+
addonId: null,
|
|
73244
|
+
access: "view"
|
|
73245
|
+
},
|
|
73246
|
+
"recordEntries.listEntryKinds": {
|
|
73247
|
+
capName: "record-entries",
|
|
73248
|
+
capScope: "system",
|
|
73249
|
+
addonId: null,
|
|
73250
|
+
access: "view"
|
|
73251
|
+
},
|
|
73252
|
+
"recordEntries.putEntry": {
|
|
73253
|
+
capName: "record-entries",
|
|
73254
|
+
capScope: "system",
|
|
73255
|
+
addonId: null,
|
|
73256
|
+
access: "create"
|
|
73257
|
+
},
|
|
71972
73258
|
"recording.getAvailability": {
|
|
71973
73259
|
capName: "recording",
|
|
71974
73260
|
capScope: "device",
|
|
@@ -72269,6 +73555,102 @@ Object.freeze({
|
|
|
72269
73555
|
addonId: null,
|
|
72270
73556
|
access: "view"
|
|
72271
73557
|
},
|
|
73558
|
+
"records.aggregate": {
|
|
73559
|
+
capName: "records",
|
|
73560
|
+
capScope: "system",
|
|
73561
|
+
addonId: null,
|
|
73562
|
+
access: "view"
|
|
73563
|
+
},
|
|
73564
|
+
"records.allocateId": {
|
|
73565
|
+
capName: "records",
|
|
73566
|
+
capScope: "system",
|
|
73567
|
+
addonId: null,
|
|
73568
|
+
access: "create"
|
|
73569
|
+
},
|
|
73570
|
+
"records.count": {
|
|
73571
|
+
capName: "records",
|
|
73572
|
+
capScope: "system",
|
|
73573
|
+
addonId: null,
|
|
73574
|
+
access: "view"
|
|
73575
|
+
},
|
|
73576
|
+
"records.declareKinds": {
|
|
73577
|
+
capName: "records",
|
|
73578
|
+
capScope: "system",
|
|
73579
|
+
addonId: null,
|
|
73580
|
+
access: "create"
|
|
73581
|
+
},
|
|
73582
|
+
"records.delete": {
|
|
73583
|
+
capName: "records",
|
|
73584
|
+
capScope: "system",
|
|
73585
|
+
addonId: null,
|
|
73586
|
+
access: "delete"
|
|
73587
|
+
},
|
|
73588
|
+
"records.deleteDevice": {
|
|
73589
|
+
capName: "records",
|
|
73590
|
+
capScope: "system",
|
|
73591
|
+
addonId: null,
|
|
73592
|
+
access: "delete"
|
|
73593
|
+
},
|
|
73594
|
+
"records.deleteMany": {
|
|
73595
|
+
capName: "records",
|
|
73596
|
+
capScope: "system",
|
|
73597
|
+
addonId: null,
|
|
73598
|
+
access: "delete"
|
|
73599
|
+
},
|
|
73600
|
+
"records.deleteWhere": {
|
|
73601
|
+
capName: "records",
|
|
73602
|
+
capScope: "system",
|
|
73603
|
+
addonId: null,
|
|
73604
|
+
access: "delete"
|
|
73605
|
+
},
|
|
73606
|
+
"records.get": {
|
|
73607
|
+
capName: "records",
|
|
73608
|
+
capScope: "system",
|
|
73609
|
+
addonId: null,
|
|
73610
|
+
access: "view"
|
|
73611
|
+
},
|
|
73612
|
+
"records.getMany": {
|
|
73613
|
+
capName: "records",
|
|
73614
|
+
capScope: "system",
|
|
73615
|
+
addonId: null,
|
|
73616
|
+
access: "view"
|
|
73617
|
+
},
|
|
73618
|
+
"records.histogram": {
|
|
73619
|
+
capName: "records",
|
|
73620
|
+
capScope: "system",
|
|
73621
|
+
addonId: null,
|
|
73622
|
+
access: "view"
|
|
73623
|
+
},
|
|
73624
|
+
"records.patch": {
|
|
73625
|
+
capName: "records",
|
|
73626
|
+
capScope: "system",
|
|
73627
|
+
addonId: null,
|
|
73628
|
+
access: "create"
|
|
73629
|
+
},
|
|
73630
|
+
"records.put": {
|
|
73631
|
+
capName: "records",
|
|
73632
|
+
capScope: "system",
|
|
73633
|
+
addonId: null,
|
|
73634
|
+
access: "create"
|
|
73635
|
+
},
|
|
73636
|
+
"records.putMany": {
|
|
73637
|
+
capName: "records",
|
|
73638
|
+
capScope: "system",
|
|
73639
|
+
addonId: null,
|
|
73640
|
+
access: "create"
|
|
73641
|
+
},
|
|
73642
|
+
"records.query": {
|
|
73643
|
+
capName: "records",
|
|
73644
|
+
capScope: "system",
|
|
73645
|
+
addonId: null,
|
|
73646
|
+
access: "view"
|
|
73647
|
+
},
|
|
73648
|
+
"records.secretRefs": {
|
|
73649
|
+
capName: "records",
|
|
73650
|
+
capScope: "system",
|
|
73651
|
+
addonId: null,
|
|
73652
|
+
access: "view"
|
|
73653
|
+
},
|
|
72272
73654
|
"sceneMonitor.captureReference": {
|
|
72273
73655
|
capName: "scene-monitor",
|
|
72274
73656
|
capScope: "device",
|
|
@@ -72701,6 +74083,48 @@ Object.freeze({
|
|
|
72701
74083
|
addonId: null,
|
|
72702
74084
|
access: "create"
|
|
72703
74085
|
},
|
|
74086
|
+
"storageAdmin.adoptRecords": {
|
|
74087
|
+
capName: "storage-admin",
|
|
74088
|
+
capScope: "system",
|
|
74089
|
+
addonId: null,
|
|
74090
|
+
access: "create"
|
|
74091
|
+
},
|
|
74092
|
+
"storageAdmin.dropCollection": {
|
|
74093
|
+
capName: "storage-admin",
|
|
74094
|
+
capScope: "system",
|
|
74095
|
+
addonId: null,
|
|
74096
|
+
access: "delete"
|
|
74097
|
+
},
|
|
74098
|
+
"storageAdmin.isAdoptedLegacyTable": {
|
|
74099
|
+
capName: "storage-admin",
|
|
74100
|
+
capScope: "system",
|
|
74101
|
+
addonId: null,
|
|
74102
|
+
access: "view"
|
|
74103
|
+
},
|
|
74104
|
+
"storageAdmin.listKinds": {
|
|
74105
|
+
capName: "storage-admin",
|
|
74106
|
+
capScope: "system",
|
|
74107
|
+
addonId: null,
|
|
74108
|
+
access: "view"
|
|
74109
|
+
},
|
|
74110
|
+
"storageAdmin.listTables": {
|
|
74111
|
+
capName: "storage-admin",
|
|
74112
|
+
capScope: "system",
|
|
74113
|
+
addonId: null,
|
|
74114
|
+
access: "view"
|
|
74115
|
+
},
|
|
74116
|
+
"storageAdmin.readLegacyCollection": {
|
|
74117
|
+
capName: "storage-admin",
|
|
74118
|
+
capScope: "system",
|
|
74119
|
+
addonId: null,
|
|
74120
|
+
access: "view"
|
|
74121
|
+
},
|
|
74122
|
+
"storageAdmin.readRecords": {
|
|
74123
|
+
capName: "storage-admin",
|
|
74124
|
+
capScope: "system",
|
|
74125
|
+
addonId: null,
|
|
74126
|
+
access: "view"
|
|
74127
|
+
},
|
|
72704
74128
|
"storageEvictable.evict": {
|
|
72705
74129
|
capName: "storage-evictable",
|
|
72706
74130
|
capScope: "system",
|
|
@@ -73613,6 +75037,12 @@ Object.freeze({
|
|
|
73613
75037
|
addonId: null,
|
|
73614
75038
|
access: "view"
|
|
73615
75039
|
},
|
|
75040
|
+
"userManagement.migrateRawSecrets": {
|
|
75041
|
+
capName: "user-management",
|
|
75042
|
+
capScope: "system",
|
|
75043
|
+
addonId: null,
|
|
75044
|
+
access: "create"
|
|
75045
|
+
},
|
|
73616
75046
|
"userManagement.oauthExchangeCode": {
|
|
73617
75047
|
capName: "user-management",
|
|
73618
75048
|
capScope: "system",
|
|
@@ -74112,7 +75542,7 @@ Object.freeze({
|
|
|
74112
75542
|
access: "create"
|
|
74113
75543
|
}
|
|
74114
75544
|
});
|
|
74115
|
-
DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder;
|
|
75545
|
+
DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.Dishwasher;
|
|
74116
75546
|
DeviceFeature.BatteryOperated;
|
|
74117
75547
|
Object.freeze({
|
|
74118
75548
|
"accessories.getStatus": [{
|
|
@@ -74936,6 +76366,51 @@ Object.freeze({
|
|
|
74936
76366
|
form: "single",
|
|
74937
76367
|
optional: false
|
|
74938
76368
|
}],
|
|
76369
|
+
"dishwasher.getStatus": [{
|
|
76370
|
+
name: "deviceId",
|
|
76371
|
+
form: "single",
|
|
76372
|
+
optional: false
|
|
76373
|
+
}],
|
|
76374
|
+
"dishwasher.pause": [{
|
|
76375
|
+
name: "deviceId",
|
|
76376
|
+
form: "single",
|
|
76377
|
+
optional: false
|
|
76378
|
+
}],
|
|
76379
|
+
"dishwasher.setHalfLoad": [{
|
|
76380
|
+
name: "deviceId",
|
|
76381
|
+
form: "single",
|
|
76382
|
+
optional: false
|
|
76383
|
+
}],
|
|
76384
|
+
"dishwasher.setHygienePlus": [{
|
|
76385
|
+
name: "deviceId",
|
|
76386
|
+
form: "single",
|
|
76387
|
+
optional: false
|
|
76388
|
+
}],
|
|
76389
|
+
"dishwasher.setOption": [{
|
|
76390
|
+
name: "deviceId",
|
|
76391
|
+
form: "single",
|
|
76392
|
+
optional: false
|
|
76393
|
+
}],
|
|
76394
|
+
"dishwasher.setPower": [{
|
|
76395
|
+
name: "deviceId",
|
|
76396
|
+
form: "single",
|
|
76397
|
+
optional: false
|
|
76398
|
+
}],
|
|
76399
|
+
"dishwasher.setProgram": [{
|
|
76400
|
+
name: "deviceId",
|
|
76401
|
+
form: "single",
|
|
76402
|
+
optional: false
|
|
76403
|
+
}],
|
|
76404
|
+
"dishwasher.start": [{
|
|
76405
|
+
name: "deviceId",
|
|
76406
|
+
form: "single",
|
|
76407
|
+
optional: false
|
|
76408
|
+
}],
|
|
76409
|
+
"dishwasher.stop": [{
|
|
76410
|
+
name: "deviceId",
|
|
76411
|
+
form: "single",
|
|
76412
|
+
optional: false
|
|
76413
|
+
}],
|
|
74939
76414
|
"doorbell.getStatus": [{
|
|
74940
76415
|
name: "deviceId",
|
|
74941
76416
|
form: "single",
|
|
@@ -75005,6 +76480,11 @@ Object.freeze({
|
|
|
75005
76480
|
form: "single",
|
|
75006
76481
|
optional: false
|
|
75007
76482
|
}],
|
|
76483
|
+
"heatingValve.getStatus": [{
|
|
76484
|
+
name: "deviceId",
|
|
76485
|
+
form: "single",
|
|
76486
|
+
optional: false
|
|
76487
|
+
}],
|
|
75008
76488
|
"humidifier.getStatus": [{
|
|
75009
76489
|
name: "deviceId",
|
|
75010
76490
|
form: "single",
|
|
@@ -76289,6 +77769,37 @@ Object.freeze({
|
|
|
76289
77769
|
form: "single",
|
|
76290
77770
|
optional: false
|
|
76291
77771
|
}],
|
|
77772
|
+
"records.count": [{
|
|
77773
|
+
name: "deviceId",
|
|
77774
|
+
form: "single",
|
|
77775
|
+
optional: true
|
|
77776
|
+
}],
|
|
77777
|
+
"records.deleteDevice": [{
|
|
77778
|
+
name: "deviceId",
|
|
77779
|
+
form: "single",
|
|
77780
|
+
optional: false
|
|
77781
|
+
}],
|
|
77782
|
+
"records.deleteWhere": [{
|
|
77783
|
+
name: "deviceId",
|
|
77784
|
+
form: "single",
|
|
77785
|
+
optional: true
|
|
77786
|
+
}],
|
|
77787
|
+
"records.histogram": [{
|
|
77788
|
+
name: "deviceId",
|
|
77789
|
+
form: "single",
|
|
77790
|
+
optional: true
|
|
77791
|
+
}],
|
|
77792
|
+
"records.putMany": [{
|
|
77793
|
+
name: "records",
|
|
77794
|
+
form: "object-array",
|
|
77795
|
+
optional: false,
|
|
77796
|
+
itemField: "deviceId"
|
|
77797
|
+
}],
|
|
77798
|
+
"records.query": [{
|
|
77799
|
+
name: "deviceId",
|
|
77800
|
+
form: "single",
|
|
77801
|
+
optional: true
|
|
77802
|
+
}],
|
|
76292
77803
|
"sceneMonitor.captureReference": [{
|
|
76293
77804
|
name: "deviceId",
|
|
76294
77805
|
form: "single",
|
|
@@ -76405,6 +77916,17 @@ Object.freeze({
|
|
|
76405
77916
|
form: "single",
|
|
76406
77917
|
optional: false
|
|
76407
77918
|
}],
|
|
77919
|
+
"storageAdmin.adoptRecords": [{
|
|
77920
|
+
name: "records",
|
|
77921
|
+
form: "object-array",
|
|
77922
|
+
optional: false,
|
|
77923
|
+
itemField: "deviceId"
|
|
77924
|
+
}],
|
|
77925
|
+
"storageAdmin.readRecords": [{
|
|
77926
|
+
name: "deviceId",
|
|
77927
|
+
form: "single",
|
|
77928
|
+
optional: true
|
|
77929
|
+
}],
|
|
76408
77930
|
"streamBroker.acquireEgressTranscode": [{
|
|
76409
77931
|
name: "deviceId",
|
|
76410
77932
|
form: "single",
|
|
@@ -187810,13 +189332,15 @@ var matterConnectionSchema = object({
|
|
|
187810
189332
|
/** PULL-reconcile interval for the commissioned-node inventory. */
|
|
187811
189333
|
reconcileIntervalMs: preprocess((v) => v === "" || v === null ? void 0 : v, number().int().min(1e4).max(864e5).default(3e5)).describe("Node-inventory reconcile interval (ms)")
|
|
187812
189334
|
});
|
|
187813
|
-
/**
|
|
187814
|
-
var
|
|
189335
|
+
/** A single registered Matter fabric ("broker"). */
|
|
189336
|
+
var MatterBrokerEntrySchema = object({
|
|
187815
189337
|
id: string$2().min(1),
|
|
187816
189338
|
name: string$2().min(1),
|
|
187817
189339
|
connection: matterConnectionSchema,
|
|
187818
189340
|
integrationId: string$2().optional()
|
|
187819
|
-
})
|
|
189341
|
+
});
|
|
189342
|
+
/** Top-level addon config — an ordered list of broker entries (default empty). */
|
|
189343
|
+
var matterAddonConfigSchema = object({ brokers: array(MatterBrokerEntrySchema).default([]) });
|
|
187820
189344
|
/** Narrow an `unknown` to a shallow plain-object record (cast-free boundary). */
|
|
187821
189345
|
function toRecord(value) {
|
|
187822
189346
|
if (typeof value === "object" && value !== null && !Array.isArray(value)) return Object.fromEntries(Object.entries(value));
|
|
@@ -188791,6 +190315,70 @@ var MatterNodeDevice = class extends BaseDevice {
|
|
|
188791
190315
|
return specs;
|
|
188792
190316
|
}
|
|
188793
190317
|
};
|
|
190318
|
+
var matterBrokersEntryKind = defineEntryKind("brokers", {
|
|
190319
|
+
title: "Matter brokers",
|
|
190320
|
+
schema: entryBody({
|
|
190321
|
+
connection: MatterBrokerEntrySchema.shape.connection,
|
|
190322
|
+
integrationId: string$2().optional()
|
|
190323
|
+
}),
|
|
190324
|
+
writeTrigger: "an operator adds, edits or removes a Matter fabric broker",
|
|
190325
|
+
adoptsFrom: settingsBrokersAdoptsFrom("matter-broker")
|
|
190326
|
+
});
|
|
190327
|
+
//#endregion
|
|
190328
|
+
//#region src/matter-broker-store.ts
|
|
190329
|
+
function rowToEntry(id, data) {
|
|
190330
|
+
const parsed = MatterBrokerEntrySchema.safeParse({
|
|
190331
|
+
id,
|
|
190332
|
+
name: data.name,
|
|
190333
|
+
connection: data.connection,
|
|
190334
|
+
integrationId: data.integrationId
|
|
190335
|
+
});
|
|
190336
|
+
return parsed.success ? parsed.data : null;
|
|
190337
|
+
}
|
|
190338
|
+
var MatterBrokerStore = class MatterBrokerStore {
|
|
190339
|
+
kind;
|
|
190340
|
+
constructor(kind) {
|
|
190341
|
+
this.kind = kind;
|
|
190342
|
+
}
|
|
190343
|
+
static of(records) {
|
|
190344
|
+
return new MatterBrokerStore(records.kind(matterBrokersEntryKind));
|
|
190345
|
+
}
|
|
190346
|
+
async listResolved() {
|
|
190347
|
+
const page = await this.kind.query({ limit: 1e3 });
|
|
190348
|
+
const out = [];
|
|
190349
|
+
for (const record of page.records) {
|
|
190350
|
+
let data = record.data;
|
|
190351
|
+
try {
|
|
190352
|
+
const resolved = await this.kind.getResolved(record.id);
|
|
190353
|
+
if (resolved !== null) data = resolved.data;
|
|
190354
|
+
} catch (err) {
|
|
190355
|
+
if (!(err instanceof RecordSecretUnavailableError)) throw err;
|
|
190356
|
+
}
|
|
190357
|
+
const entry = rowToEntry(record.id, data);
|
|
190358
|
+
if (entry !== null) out.push(entry);
|
|
190359
|
+
}
|
|
190360
|
+
return out;
|
|
190361
|
+
}
|
|
190362
|
+
async replaceAll(entries) {
|
|
190363
|
+
const page = await this.kind.query({ limit: 1e3 });
|
|
190364
|
+
const nextIds = new Set(entries.map((e) => e.id));
|
|
190365
|
+
for (const row of page.records) if (!nextIds.has(row.id)) await this.kind.delete(row.id);
|
|
190366
|
+
for (const entry of entries) {
|
|
190367
|
+
const { id, name, connection, integrationId } = entry;
|
|
190368
|
+
const body = {
|
|
190369
|
+
name,
|
|
190370
|
+
connection,
|
|
190371
|
+
...integrationId === void 0 ? {} : { integrationId }
|
|
190372
|
+
};
|
|
190373
|
+
const parsed = matterBrokersEntryKind.schema.safeParse(body);
|
|
190374
|
+
if (!parsed.success) throw new Error(`invalid Matter broker '${id}': ${parsed.error.message}`);
|
|
190375
|
+
await this.kind.put({
|
|
190376
|
+
id,
|
|
190377
|
+
data: parsed.data
|
|
190378
|
+
});
|
|
190379
|
+
}
|
|
190380
|
+
}
|
|
190381
|
+
};
|
|
188794
190382
|
//#endregion
|
|
188795
190383
|
//#region src/addon.ts
|
|
188796
190384
|
/** Default config — a fresh install starts with no fabric. */
|
|
@@ -188815,11 +190403,18 @@ var MatterBrokerAddon = class extends BaseDeviceProvider {
|
|
|
188815
190403
|
providerName = "Matter";
|
|
188816
190404
|
deviceClasses = { [DeviceType.Container]: MatterNodeDevice };
|
|
188817
190405
|
registry = null;
|
|
190406
|
+
brokerStore = null;
|
|
190407
|
+
activeBrokers = [];
|
|
188818
190408
|
constructor() {
|
|
188819
190409
|
super({ ...DEFAULTS });
|
|
188820
190410
|
}
|
|
188821
190411
|
async onInitialize() {
|
|
188822
|
-
const regs = await super.onInitialize();
|
|
190412
|
+
const regs = this.providerRegistrationsFromSuper(await super.onInitialize());
|
|
190413
|
+
const records = this.ctx.records;
|
|
190414
|
+
if (records === void 0) throw new Error("matter-broker: ctx.records is required (hub-only addon)");
|
|
190415
|
+
await records.declare({ brokers: matterBrokersEntryKind });
|
|
190416
|
+
this.brokerStore = MatterBrokerStore.of(records);
|
|
190417
|
+
this.activeBrokers = await this.loadPersistedBrokers();
|
|
188823
190418
|
this.registry = new MatterBrokerRegistry(this.ctx.logger, {
|
|
188824
190419
|
dataDir: this.ctx.dataDir,
|
|
188825
190420
|
onBrokerConnected: (brokerId) => {
|
|
@@ -188837,8 +190432,8 @@ var MatterBrokerAddon = class extends BaseDeviceProvider {
|
|
|
188837
190432
|
}
|
|
188838
190433
|
});
|
|
188839
190434
|
matterCommands.setDispatcher((brokerId, invocation) => this.requireRegistry().invokeCommand(brokerId, invocation));
|
|
188840
|
-
await this.registry.restore(this.
|
|
188841
|
-
this.ctx.logger.info("Matter: broker addon initialised", { meta: { brokerCount: this.
|
|
190435
|
+
await this.registry.restore(this.activeBrokers);
|
|
190436
|
+
this.ctx.logger.info("Matter: broker addon initialised", { meta: { brokerCount: this.activeBrokers.length } });
|
|
188842
190437
|
await this.reconcileIntegrationsToBrokers();
|
|
188843
190438
|
this.subscribeIntegrationLifecycle();
|
|
188844
190439
|
return [
|
|
@@ -188853,10 +190448,28 @@ var MatterBrokerAddon = class extends BaseDeviceProvider {
|
|
|
188853
190448
|
}
|
|
188854
190449
|
];
|
|
188855
190450
|
}
|
|
190451
|
+
async loadPersistedBrokers() {
|
|
190452
|
+
const store = this.brokerStore;
|
|
190453
|
+
if (store !== null) {
|
|
190454
|
+
const fromRecords = await store.listResolved();
|
|
190455
|
+
if (fromRecords.length > 0) return fromRecords;
|
|
190456
|
+
}
|
|
190457
|
+
return this.config.brokers;
|
|
190458
|
+
}
|
|
190459
|
+
async persistBrokerEntries(entries) {
|
|
190460
|
+
this.activeBrokers = [...entries];
|
|
190461
|
+
const store = this.brokerStore;
|
|
190462
|
+
if (store !== null) {
|
|
190463
|
+
await store.replaceAll(entries);
|
|
190464
|
+
return;
|
|
190465
|
+
}
|
|
190466
|
+
await this.updateGlobalSettings({ brokers: [...entries] });
|
|
190467
|
+
}
|
|
188856
190468
|
async onConfigChanged() {
|
|
188857
190469
|
const reg = this.registry;
|
|
188858
190470
|
if (!reg) return;
|
|
188859
|
-
|
|
190471
|
+
this.activeBrokers = await this.loadPersistedBrokers();
|
|
190472
|
+
const persisted = this.activeBrokers;
|
|
188860
190473
|
const liveIds = new Set(reg.list().map((b) => b.id));
|
|
188861
190474
|
const persistedIds = new Set(persisted.map((e) => e.id));
|
|
188862
190475
|
for (const liveId of liveIds) if (!persistedIds.has(liveId)) try {
|
|
@@ -188887,7 +190500,7 @@ var MatterBrokerAddon = class extends BaseDeviceProvider {
|
|
|
188887
190500
|
...b,
|
|
188888
190501
|
id: created.id
|
|
188889
190502
|
} : b);
|
|
188890
|
-
await this.
|
|
190503
|
+
await this.persistBrokerEntries(next);
|
|
188891
190504
|
}
|
|
188892
190505
|
} catch (err) {
|
|
188893
190506
|
this.ctx.logger.warn("Matter onConfigChanged: failed to start new broker", { meta: {
|
|
@@ -188968,8 +190581,8 @@ var MatterBrokerAddon = class extends BaseDeviceProvider {
|
|
|
188968
190581
|
return buildMatterBrokerProvider({
|
|
188969
190582
|
ownerAddonId: this.ctx.id,
|
|
188970
190583
|
registry: this.requireRegistry(),
|
|
188971
|
-
getBrokers: () => this.
|
|
188972
|
-
persistBrokers: (brokers) => this.
|
|
190584
|
+
getBrokers: () => this.activeBrokers,
|
|
190585
|
+
persistBrokers: (brokers) => this.persistBrokerEntries(brokers),
|
|
188973
190586
|
cascadeRemoveDevices: (brokerId) => this.cascadeRemoveDevicesForBroker(brokerId),
|
|
188974
190587
|
logger: this.ctx.logger
|
|
188975
190588
|
});
|
|
@@ -188994,7 +190607,7 @@ var MatterBrokerAddon = class extends BaseDeviceProvider {
|
|
|
188994
190607
|
const settings = await this.ctx.api.integrations.getSettings.query({ id: integration.id });
|
|
188995
190608
|
const brokerId = typeof settings["brokerId"] === "string" ? settings["brokerId"] : void 0;
|
|
188996
190609
|
if (brokerId === void 0) continue;
|
|
188997
|
-
if (!this.
|
|
190610
|
+
if (!this.activeBrokers.some((b) => b.id === brokerId)) {
|
|
188998
190611
|
this.ctx.logger.warn("Matter integration→broker: linked broker not found", { meta: {
|
|
188999
190612
|
integrationId: integration.id,
|
|
189000
190613
|
brokerId
|
|
@@ -189003,7 +190616,7 @@ var MatterBrokerAddon = class extends BaseDeviceProvider {
|
|
|
189003
190616
|
}
|
|
189004
190617
|
this.requireRegistry().linkIntegration(integration.id, brokerId);
|
|
189005
190618
|
}
|
|
189006
|
-
const toRemove = this.
|
|
190619
|
+
const toRemove = this.activeBrokers.filter((b) => b.integrationId !== void 0 && !surviving.has(b.integrationId)).map((b) => b.id);
|
|
189007
190620
|
if (toRemove.length === 0) return;
|
|
189008
190621
|
for (const id of toRemove) try {
|
|
189009
190622
|
await this.requireRegistry().removeEntry(id);
|
|
@@ -189014,8 +190627,8 @@ var MatterBrokerAddon = class extends BaseDeviceProvider {
|
|
|
189014
190627
|
error: errMsg(err)
|
|
189015
190628
|
} });
|
|
189016
190629
|
}
|
|
189017
|
-
const nextBrokers = this.
|
|
189018
|
-
await this.
|
|
190630
|
+
const nextBrokers = this.activeBrokers.filter((b) => !toRemove.includes(b.id));
|
|
190631
|
+
await this.persistBrokerEntries(nextBrokers);
|
|
189019
190632
|
} catch (err) {
|
|
189020
190633
|
this.ctx.logger.warn("Matter integration→broker reconcile failed", { meta: { error: errMsg(err) } });
|
|
189021
190634
|
}
|