@camstack/addon-provider-mqtt-ha 0.1.3 → 0.1.4
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 +1033 -118
- package/dist/addon.mjs +1033 -118
- package/package.json +1 -1
package/dist/addon.js
CHANGED
|
@@ -33,7 +33,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
33
33
|
}) : target, mod));
|
|
34
34
|
var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["module.exports"] : __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
35
35
|
//#endregion
|
|
36
|
-
//#region ../types/dist/event-category-
|
|
36
|
+
//#region ../types/dist/event-category-BvOFi6PY.mjs
|
|
37
37
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
38
38
|
EventCategory["SystemBoot"] = "system.boot";
|
|
39
39
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -97,6 +97,24 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
97
97
|
* consumes this category and maps it to the `addon-crash-loop` kind.
|
|
98
98
|
*/
|
|
99
99
|
EventCategory["AddonRunnerFailed"] = "addon.runner-failed";
|
|
100
|
+
/**
|
|
101
|
+
* A runner whose addon refused to start with a typed reason (D877) - parked
|
|
102
|
+
* in `refused`, never counted by the crash breaker, retried on operator
|
|
103
|
+
* action. One event per refusal.
|
|
104
|
+
*/
|
|
105
|
+
EventCategory["AddonRunnerRefused"] = "addon.runner-refused";
|
|
106
|
+
/**
|
|
107
|
+
* A runner settled on a state (D877): `running` (READY), `crashed`, `failed` or
|
|
108
|
+
* `refused`. In-process telemetry for the boot check (re-evaluate while any
|
|
109
|
+
* runner is still pending) and the alert centre (close a recovered runner).
|
|
110
|
+
*/
|
|
111
|
+
EventCategory["ProcessStateChanged"] = "process.state-changed";
|
|
112
|
+
/**
|
|
113
|
+
* The node's one-shot runner boot check (D877): planned runners against the
|
|
114
|
+
* process service, `degraded` when any is failed, refused or missing. The
|
|
115
|
+
* alert centre turns it into one alert and a direct critical push.
|
|
116
|
+
*/
|
|
117
|
+
EventCategory["SystemRunnerCheck"] = "system.runner-check";
|
|
100
118
|
EventCategory["AddonError"] = "addon.error";
|
|
101
119
|
EventCategory["AddonPageReady"] = "addon.page-ready";
|
|
102
120
|
EventCategory["AddonWidgetReady"] = "addon.widget-ready";
|
|
@@ -5421,7 +5439,7 @@ var ZodIssueCode = {
|
|
|
5421
5439
|
var ZodFirstPartyTypeKind;
|
|
5422
5440
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5423
5441
|
//#endregion
|
|
5424
|
-
//#region ../types/dist/sleep-
|
|
5442
|
+
//#region ../types/dist/sleep-bZIhUvjd.mjs
|
|
5425
5443
|
/**
|
|
5426
5444
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5427
5445
|
* window to float samples (D455).
|
|
@@ -5538,7 +5556,7 @@ function isKeychainStoredField(field) {
|
|
|
5538
5556
|
var SECRET_CLEAR = { $secretClear: true };
|
|
5539
5557
|
/** The `'***'` token D634 redaction writes for non-admins. */
|
|
5540
5558
|
var LEGACY_DEVICE_REDACTION = "***";
|
|
5541
|
-
function isRecord$
|
|
5559
|
+
function isRecord$5(value) {
|
|
5542
5560
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5543
5561
|
}
|
|
5544
5562
|
function makeSecretMarker(ref) {
|
|
@@ -5549,12 +5567,12 @@ function makeSecretMarker(ref) {
|
|
|
5549
5567
|
}
|
|
5550
5568
|
/** A stored marker: an object whose `$secret` is a non-empty string. */
|
|
5551
5569
|
function isSecretMarker(value) {
|
|
5552
|
-
if (!isRecord$
|
|
5570
|
+
if (!isRecord$5(value)) return false;
|
|
5553
5571
|
const ref = value["$secret"];
|
|
5554
5572
|
return typeof ref === "string" && ref.length > 0;
|
|
5555
5573
|
}
|
|
5556
5574
|
function isSecretClear(value) {
|
|
5557
|
-
return isRecord$
|
|
5575
|
+
return isRecord$5(value) && value["$secretClear"] === true;
|
|
5558
5576
|
}
|
|
5559
5577
|
/**
|
|
5560
5578
|
* The UI view of a stored secret field value: a marker becomes "set", inline
|
|
@@ -6164,7 +6182,7 @@ var KeychainWriteRefusedError = class extends Error {
|
|
|
6164
6182
|
}
|
|
6165
6183
|
};
|
|
6166
6184
|
var KEEP = { kind: "keep" };
|
|
6167
|
-
function isRecord$
|
|
6185
|
+
function isRecord$4(value) {
|
|
6168
6186
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6169
6187
|
}
|
|
6170
6188
|
function defaultMintId() {
|
|
@@ -6177,7 +6195,7 @@ function collectSecretMarkerRefs(value, out = []) {
|
|
|
6177
6195
|
return out;
|
|
6178
6196
|
}
|
|
6179
6197
|
if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
|
|
6180
|
-
else if (isRecord$
|
|
6198
|
+
else if (isRecord$4(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
6181
6199
|
return out;
|
|
6182
6200
|
}
|
|
6183
6201
|
async function storedValueEquals(secrets, marker, candidate) {
|
|
@@ -6232,7 +6250,7 @@ function rowId(row, idKey) {
|
|
|
6232
6250
|
return null;
|
|
6233
6251
|
}
|
|
6234
6252
|
async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
6235
|
-
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$
|
|
6253
|
+
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$4) : [];
|
|
6236
6254
|
if (!Array.isArray(incoming)) {
|
|
6237
6255
|
ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
|
|
6238
6256
|
return {
|
|
@@ -6248,7 +6266,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
|
6248
6266
|
const kept = /* @__PURE__ */ new Set();
|
|
6249
6267
|
const rows = [];
|
|
6250
6268
|
for (const row of incoming) {
|
|
6251
|
-
if (!isRecord$
|
|
6269
|
+
if (!isRecord$4(row)) {
|
|
6252
6270
|
rows.push(row);
|
|
6253
6271
|
continue;
|
|
6254
6272
|
}
|
|
@@ -6273,7 +6291,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
6273
6291
|
case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
|
|
6274
6292
|
case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
|
|
6275
6293
|
case "object": {
|
|
6276
|
-
if (!isRecord$
|
|
6294
|
+
if (!isRecord$4(incoming)) {
|
|
6277
6295
|
if (incoming === void 0) return KEEP;
|
|
6278
6296
|
ctx.deletes.push(...collectSecretMarkerRefs(stored));
|
|
6279
6297
|
return {
|
|
@@ -6281,7 +6299,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
6281
6299
|
value: incoming
|
|
6282
6300
|
};
|
|
6283
6301
|
}
|
|
6284
|
-
const storedObj = isRecord$
|
|
6302
|
+
const storedObj = isRecord$4(stored) ? stored : {};
|
|
6285
6303
|
return {
|
|
6286
6304
|
kind: "value",
|
|
6287
6305
|
value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
|
|
@@ -6404,7 +6422,7 @@ async function resolveSecretMarkers(value, secrets, options = {}) {
|
|
|
6404
6422
|
value: items
|
|
6405
6423
|
};
|
|
6406
6424
|
}
|
|
6407
|
-
if (isRecord$
|
|
6425
|
+
if (isRecord$4(v)) {
|
|
6408
6426
|
const out = {};
|
|
6409
6427
|
for (const [k, child] of Object.entries(v)) {
|
|
6410
6428
|
const s = substitute(child);
|
|
@@ -6672,7 +6690,6 @@ function createHandle(raw, opts) {
|
|
|
6672
6690
|
const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
|
|
6673
6691
|
const readAddonStoreResult = raw.readAddonStoreResult;
|
|
6674
6692
|
const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
|
|
6675
|
-
const readDeviceStoreBatch = raw.readDeviceStoreBatch;
|
|
6676
6693
|
const overrides = {
|
|
6677
6694
|
readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
|
|
6678
6695
|
...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
|
|
@@ -6696,12 +6713,12 @@ function createHandle(raw, opts) {
|
|
|
6696
6713
|
};
|
|
6697
6714
|
} } : {},
|
|
6698
6715
|
readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
|
|
6699
|
-
|
|
6700
|
-
const rows = await readDeviceStoreBatch
|
|
6716
|
+
readDeviceStoreBatch: async (deviceIds) => {
|
|
6717
|
+
const rows = await raw.readDeviceStoreBatch(deviceIds);
|
|
6701
6718
|
const out = /* @__PURE__ */ new Map();
|
|
6702
6719
|
for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
|
|
6703
6720
|
return out;
|
|
6704
|
-
}
|
|
6721
|
+
},
|
|
6705
6722
|
writeAddonStore: async (patch) => {
|
|
6706
6723
|
await writeAddon(patch);
|
|
6707
6724
|
},
|
|
@@ -7328,7 +7345,7 @@ var BaseAddon = class {
|
|
|
7328
7345
|
if (!ctx) return;
|
|
7329
7346
|
const addonId = ctx.id;
|
|
7330
7347
|
setImmediate(() => {
|
|
7331
|
-
ctx.api.addons
|
|
7348
|
+
ctx.api.addons.restartAddon.mutate({ addonId }).then(() => {
|
|
7332
7349
|
ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
|
|
7333
7350
|
}).catch((err) => {
|
|
7334
7351
|
ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
@@ -7528,7 +7545,7 @@ var BaseAddon = class {
|
|
|
7528
7545
|
return this._addonSecretTree;
|
|
7529
7546
|
}
|
|
7530
7547
|
deviceSecretTree() {
|
|
7531
|
-
this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
|
|
7548
|
+
this._deviceSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.deviceSettingsSchema()), this.secretStatePaths);
|
|
7532
7549
|
return this._deviceSecretTree;
|
|
7533
7550
|
}
|
|
7534
7551
|
/**
|
|
@@ -7604,42 +7621,135 @@ var BaseAddon = class {
|
|
|
7604
7621
|
this[timerOf] = timer;
|
|
7605
7622
|
}
|
|
7606
7623
|
/**
|
|
7607
|
-
* Wrap `ctx.settings.readAddonStore()` with a
|
|
7608
|
-
*
|
|
7609
|
-
* swap, or any race where the SqliteSettingsBackend is between shutdown and
|
|
7610
|
-
* re-initialize) doesn't propagate up into `initialize()` and leave the
|
|
7624
|
+
* Wrap `ctx.settings.readAddonStore()` with a retry budget so a transient
|
|
7625
|
+
* settings-store outage doesn't propagate up into `initialize()` and leave the
|
|
7611
7626
|
* addon permanently broken.
|
|
7612
7627
|
*
|
|
7613
|
-
*
|
|
7614
|
-
*
|
|
7615
|
-
* `
|
|
7628
|
+
* Two kinds of outage, two budgets:
|
|
7629
|
+
* - the store's own restart fingerprints (`SqliteSettingsBackend not
|
|
7630
|
+
* initialized`, `provider not available`): a short budget, then the addon
|
|
7631
|
+
* falls back to `{}` (defaults) - its first successful patch rehydrates;
|
|
7632
|
+
* - a TRANSPORT failure (the hub is restarting while this runner boots:
|
|
7633
|
+
* `discovery deadline exceeded`, `parent could not route`, a refused or
|
|
7634
|
+
* timed-out connection). Since D870 a runner's settings read THROWS instead
|
|
7635
|
+
* of answering `{}`, so without a budget a hub restart ends in a respawn
|
|
7636
|
+
* loop. A long, bounded budget; only after it the error propagates - the
|
|
7637
|
+
* addon never runs on defaults for a store it could not ask.
|
|
7638
|
+
* Anything else propagates immediately so real bugs surface.
|
|
7616
7639
|
*/
|
|
7617
7640
|
async readAddonStoreWithRetry() {
|
|
7618
7641
|
const settings = this.rawSettings();
|
|
7619
7642
|
if (!settings) return {};
|
|
7620
|
-
const delaysMs = [
|
|
7621
|
-
150,
|
|
7622
|
-
350,
|
|
7623
|
-
600,
|
|
7624
|
-
900
|
|
7625
|
-
];
|
|
7626
7643
|
let lastErr;
|
|
7627
|
-
for (let attempt = 0
|
|
7644
|
+
for (let attempt = 0;; attempt++) try {
|
|
7628
7645
|
const stored = await settings.readAddonStore() ?? {};
|
|
7629
7646
|
this.settingsStoreReady = true;
|
|
7630
7647
|
return stored;
|
|
7631
7648
|
} catch (err) {
|
|
7632
7649
|
lastErr = err;
|
|
7633
|
-
const
|
|
7634
|
-
if (
|
|
7635
|
-
|
|
7636
|
-
|
|
7650
|
+
const kind = classifyStoreError(err);
|
|
7651
|
+
if (kind === "permanent") throw err;
|
|
7652
|
+
const delay = (kind === "transport" ? TRANSPORT_RETRY_DELAYS_MS : RESTART_RETRY_DELAYS_MS)[attempt];
|
|
7653
|
+
if (delay === void 0) {
|
|
7654
|
+
if (kind === "transport") throw err;
|
|
7655
|
+
break;
|
|
7656
|
+
}
|
|
7657
|
+
await new Promise((r) => setTimeout(r, delay));
|
|
7637
7658
|
}
|
|
7638
7659
|
this.settingsStoreReady = false;
|
|
7639
7660
|
this._ctx?.logger?.warn?.("readAddonStore: settings-store unavailable after retries — using defaults", { meta: { error: lastErr instanceof Error ? lastErr.message : String(lastErr) } });
|
|
7640
7661
|
return {};
|
|
7641
7662
|
}
|
|
7642
7663
|
};
|
|
7664
|
+
/** The settings store's own restart fingerprints. */
|
|
7665
|
+
var RESTART_RETRY_DELAYS_MS = [
|
|
7666
|
+
150,
|
|
7667
|
+
350,
|
|
7668
|
+
600,
|
|
7669
|
+
900
|
|
7670
|
+
];
|
|
7671
|
+
/** A hub restarting under a booting runner: ~100 s in total. */
|
|
7672
|
+
var TRANSPORT_RETRY_DELAYS_MS = [
|
|
7673
|
+
150,
|
|
7674
|
+
350,
|
|
7675
|
+
600,
|
|
7676
|
+
900,
|
|
7677
|
+
2e3,
|
|
7678
|
+
5e3,
|
|
7679
|
+
1e4,
|
|
7680
|
+
2e4,
|
|
7681
|
+
3e4,
|
|
7682
|
+
3e4
|
|
7683
|
+
];
|
|
7684
|
+
var RESTART_FINGERPRINTS = ["SqliteSettingsBackend not initialized", "provider not available"];
|
|
7685
|
+
/** Node / socket error codes of a connection that did not happen or broke. */
|
|
7686
|
+
var TRANSPORT_CODES = new Set([
|
|
7687
|
+
"ECONNREFUSED",
|
|
7688
|
+
"ECONNRESET",
|
|
7689
|
+
"ETIMEDOUT",
|
|
7690
|
+
"EPIPE",
|
|
7691
|
+
"EHOSTUNREACH",
|
|
7692
|
+
"ENETUNREACH"
|
|
7693
|
+
]);
|
|
7694
|
+
/** tRPC error codes that mean "the other side is not answering now", not "your call is wrong". */
|
|
7695
|
+
var UNAVAILABLE_TRPC_CODES = new Set([
|
|
7696
|
+
"TIMEOUT",
|
|
7697
|
+
"SERVICE_UNAVAILABLE",
|
|
7698
|
+
"BAD_GATEWAY",
|
|
7699
|
+
"GATEWAY_TIMEOUT"
|
|
7700
|
+
]);
|
|
7701
|
+
/** The exact phrases OUR transport raises when it cannot reach the hub. */
|
|
7702
|
+
var TRANSPORT_PHRASES = [
|
|
7703
|
+
"discovery deadline exceeded",
|
|
7704
|
+
"parent could not route child unowned cap call",
|
|
7705
|
+
"UDS request timed out after",
|
|
7706
|
+
"channel closed"
|
|
7707
|
+
];
|
|
7708
|
+
/** Moleculer error `type`s of a call that could not be served right now. */
|
|
7709
|
+
var MOLECULER_TRANSIENT_TYPES = new Set([
|
|
7710
|
+
"REQUEST_TIMEOUT",
|
|
7711
|
+
"SERVICE_NOT_FOUND",
|
|
7712
|
+
"SERVICE_NOT_AVAILABLE",
|
|
7713
|
+
"REQUEST_REJECTED",
|
|
7714
|
+
"BROKER_DISCONNECTED"
|
|
7715
|
+
]);
|
|
7716
|
+
function stringProp(value, key) {
|
|
7717
|
+
if (typeof value !== "object" || value === null) return void 0;
|
|
7718
|
+
const found = Reflect.get(value, key);
|
|
7719
|
+
return typeof found === "string" ? found : void 0;
|
|
7720
|
+
}
|
|
7721
|
+
/** The code an error carries: its own, its cause's, or a tRPC `data.code`. */
|
|
7722
|
+
function errorCode(err) {
|
|
7723
|
+
const out = {};
|
|
7724
|
+
const cause = typeof err === "object" && err !== null ? Reflect.get(err, "cause") : void 0;
|
|
7725
|
+
const data = typeof err === "object" && err !== null ? Reflect.get(err, "data") : void 0;
|
|
7726
|
+
const node = stringProp(err, "code") ?? stringProp(cause, "code");
|
|
7727
|
+
if (node !== void 0) out.node = node;
|
|
7728
|
+
const trpc = stringProp(data, "code");
|
|
7729
|
+
if (trpc !== void 0) out.trpc = trpc;
|
|
7730
|
+
return out;
|
|
7731
|
+
}
|
|
7732
|
+
/**
|
|
7733
|
+
* Is a settings read failure worth retrying, and with which budget? Only
|
|
7734
|
+
* EXPLICIT signals count: a socket error code, a tRPC "unavailable" code, or
|
|
7735
|
+
* one of the exact phrases our own transport raises. A message that merely
|
|
7736
|
+
* contains "timed out" or "unreachable" is not evidence of anything, and
|
|
7737
|
+
* `settings store not wired` is a wiring bug that retrying cannot fix.
|
|
7738
|
+
*/
|
|
7739
|
+
function classifyStoreError(err) {
|
|
7740
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
7741
|
+
if (RESTART_FINGERPRINTS.some((f) => message.includes(f))) return "restart";
|
|
7742
|
+
const code = errorCode(err);
|
|
7743
|
+
if (code.node !== void 0 && TRANSPORT_CODES.has(code.node)) return "transport";
|
|
7744
|
+
if (code.trpc !== void 0 && UNAVAILABLE_TRPC_CODES.has(code.trpc)) return "transport";
|
|
7745
|
+
if (typeof err === "object" && err !== null) {
|
|
7746
|
+
if (Reflect.get(err, "retryable") === true) return "transport";
|
|
7747
|
+
const type = stringProp(err, "type");
|
|
7748
|
+
if (type !== void 0 && MOLECULER_TRANSIENT_TYPES.has(type)) return "transport";
|
|
7749
|
+
}
|
|
7750
|
+
if (TRANSPORT_PHRASES.some((f) => message.includes(f))) return "transport";
|
|
7751
|
+
return "permanent";
|
|
7752
|
+
}
|
|
7643
7753
|
/**
|
|
7644
7754
|
* Collect the keys of every field marked `perNode: true`, recursing into
|
|
7645
7755
|
* layout containers (`group` fields and `sub-tabs` tabs) the same way
|
|
@@ -7729,6 +7839,156 @@ var PeerBytesTicketSchema = object({
|
|
|
7729
7839
|
*/
|
|
7730
7840
|
declaredBytes: number().int().nonnegative().nullable()
|
|
7731
7841
|
});
|
|
7842
|
+
/** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
|
|
7843
|
+
/** The files a kind may live in. `history` is device-history's (D850), never records. */
|
|
7844
|
+
var RECORD_DATABASES = ["settings", "events"];
|
|
7845
|
+
/** The classes of a kind: the `@durable` vocabulary, one authority (replaces the annotation). */
|
|
7846
|
+
var RECORD_CLASSES = [
|
|
7847
|
+
"config",
|
|
7848
|
+
"ledger",
|
|
7849
|
+
"audit",
|
|
7850
|
+
"mirror",
|
|
7851
|
+
"ephemeral"
|
|
7852
|
+
];
|
|
7853
|
+
var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
|
|
7854
|
+
var RECORD_MAX_DATA_BYTES = 1024 * 1024;
|
|
7855
|
+
var RECORD_BATCH_MAX = 1e3;
|
|
7856
|
+
var RECORD_QUERY_MAX = 1e3;
|
|
7857
|
+
function defOf(schema) {
|
|
7858
|
+
const zodBag = Reflect.get(schema, "_zod");
|
|
7859
|
+
if (typeof zodBag !== "object" || zodBag === null) return {};
|
|
7860
|
+
const def = Reflect.get(zodBag, "def");
|
|
7861
|
+
if (typeof def !== "object" || def === null) return {};
|
|
7862
|
+
return def;
|
|
7863
|
+
}
|
|
7864
|
+
function declaredHere(schema) {
|
|
7865
|
+
return globalRegistry.get(schema)?.secret === true;
|
|
7866
|
+
}
|
|
7867
|
+
/** Wrapper kinds whose `innerType` is the field itself. */
|
|
7868
|
+
var WRAPPERS = new Set([
|
|
7869
|
+
"optional",
|
|
7870
|
+
"nullable",
|
|
7871
|
+
"default",
|
|
7872
|
+
"prefault",
|
|
7873
|
+
"catch",
|
|
7874
|
+
"readonly",
|
|
7875
|
+
"nonoptional"
|
|
7876
|
+
]);
|
|
7877
|
+
/**
|
|
7878
|
+
* The schema layers that make up ONE field: the schema itself and every
|
|
7879
|
+
* wrapper below it (optional / default / nullable / readonly / catch), plus
|
|
7880
|
+
* both sides of a pipe (`z.preprocess` puts the real schema on `out`,
|
|
7881
|
+
* `.transform` on `in`).
|
|
7882
|
+
*/
|
|
7883
|
+
function layersOf(schema) {
|
|
7884
|
+
const out = [];
|
|
7885
|
+
const queue = [schema];
|
|
7886
|
+
while (queue.length > 0) {
|
|
7887
|
+
const s = queue.shift();
|
|
7888
|
+
if (!s || out.includes(s)) continue;
|
|
7889
|
+
out.push(s);
|
|
7890
|
+
const def = defOf(s);
|
|
7891
|
+
if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
|
|
7892
|
+
if (def.type === "pipe") {
|
|
7893
|
+
if (def.in) queue.push(def.in);
|
|
7894
|
+
if (def.out) queue.push(def.out);
|
|
7895
|
+
}
|
|
7896
|
+
}
|
|
7897
|
+
return out;
|
|
7898
|
+
}
|
|
7899
|
+
/** True when any layer of this field declares `.meta({ secret: true })`. */
|
|
7900
|
+
function isZodSecret(schema) {
|
|
7901
|
+
return layersOf(schema).some(declaredHere);
|
|
7902
|
+
}
|
|
7903
|
+
/**
|
|
7904
|
+
* Every declared secret path in a config schema: dotted keys, `[]` for "each
|
|
7905
|
+
* element of this array" (`connection.password`, `rows[].token`). A declared
|
|
7906
|
+
* object or array is reported as one path and not descended into — everything
|
|
7907
|
+
* under it is secret.
|
|
7908
|
+
*/
|
|
7909
|
+
function collectZodSecretPaths(schema, prefix = "") {
|
|
7910
|
+
if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
|
|
7911
|
+
const paths = [];
|
|
7912
|
+
for (const layer of layersOf(schema)) {
|
|
7913
|
+
const def = defOf(layer);
|
|
7914
|
+
if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
|
|
7915
|
+
else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
|
|
7916
|
+
else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
|
|
7917
|
+
else if (def.type === "intersection") {
|
|
7918
|
+
if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
|
|
7919
|
+
if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
|
|
7920
|
+
}
|
|
7921
|
+
}
|
|
7922
|
+
return [...new Set(paths)];
|
|
7923
|
+
}
|
|
7924
|
+
/**
|
|
7925
|
+
* Record kinds (D881): the declaration an addon makes of one kind of fact, the
|
|
7926
|
+
* Zod row schema that describes it, and the helper that turns the two into the
|
|
7927
|
+
* JSON the engine stores.
|
|
7928
|
+
*
|
|
7929
|
+
* A kind is declared ONCE, next to the code that owns it, and the engine's
|
|
7930
|
+
* reconciler creates its indexes - nothing creates DDL at runtime from a write.
|
|
7931
|
+
* Everything the generic machinery needs (secret fields, the entry descriptor)
|
|
7932
|
+
* is DERIVED from the Zod schema: `.meta({ secret: true })` marks a credential,
|
|
7933
|
+
* never a field name (D879).
|
|
7934
|
+
*/
|
|
7935
|
+
/** A JSON field path: `trackId`, `auth.accessToken`. Charset-restricted: it is rendered into DDL. */
|
|
7936
|
+
var RecordFieldPathSchema = string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}(\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,3}$/);
|
|
7937
|
+
var RecordIndexSchema = object({
|
|
7938
|
+
name: string().regex(/^[a-z][a-z0-9_]{0,31}$/),
|
|
7939
|
+
fields: array(RecordFieldPathSchema).min(1).max(4),
|
|
7940
|
+
unique: boolean().optional()
|
|
7941
|
+
}).strict();
|
|
7942
|
+
var RecordRetentionSchema = union([
|
|
7943
|
+
object({
|
|
7944
|
+
ttlMs: number().int().positive(),
|
|
7945
|
+
from: _enum(["at", "write"])
|
|
7946
|
+
}).strict(),
|
|
7947
|
+
object({
|
|
7948
|
+
maxRows: number().int().positive().optional(),
|
|
7949
|
+
maxRowsPerDevice: number().int().positive().optional()
|
|
7950
|
+
}).strict().refine((r) => r.maxRows !== void 0 || r.maxRowsPerDevice !== void 0, { message: "name maxRows, maxRowsPerDevice or both" }),
|
|
7951
|
+
object({
|
|
7952
|
+
owner: string().min(1),
|
|
7953
|
+
reason: string().min(1)
|
|
7954
|
+
}).strict(),
|
|
7955
|
+
object({ none: string().min(1) }).strict()
|
|
7956
|
+
]);
|
|
7957
|
+
/** The descriptor a generic entries UI reads (D881 "generic entries"). */
|
|
7958
|
+
var EntryDescriptorSchema = object({
|
|
7959
|
+
title: string().min(1),
|
|
7960
|
+
/** The record body field shown as the entry's name. */
|
|
7961
|
+
nameField: string().min(1),
|
|
7962
|
+
/** JSON Schema of the entry body; `secret: true` marks a password field. */
|
|
7963
|
+
fields: record(string(), unknown())
|
|
7964
|
+
}).strict();
|
|
7965
|
+
/** What crosses the wire and sits in the engine's catalog: JSON only, no Zod. */
|
|
7966
|
+
var RecordKindDeclarationSchema = object({
|
|
7967
|
+
database: _enum(RECORD_DATABASES).default("settings"),
|
|
7968
|
+
class: _enum(RECORD_CLASSES),
|
|
7969
|
+
writeTrigger: string().min(1),
|
|
7970
|
+
device: _enum([
|
|
7971
|
+
"required",
|
|
7972
|
+
"optional",
|
|
7973
|
+
"none"
|
|
7974
|
+
]).default("none"),
|
|
7975
|
+
at: _enum(["required", "none"]).default("none"),
|
|
7976
|
+
indexes: array(RecordIndexSchema).max(8).default([]),
|
|
7977
|
+
retention: RecordRetentionSchema,
|
|
7978
|
+
deviceRemoval: _enum(["delete", "none"]).default("none"),
|
|
7979
|
+
maxDataBytes: number().int().positive().max(RECORD_MAX_DATA_BYTES).default(RECORD_DEFAULT_MAX_DATA_BYTES),
|
|
7980
|
+
/** Derived from the Zod schema; never written by hand. */
|
|
7981
|
+
secretPaths: array(string().min(1)).default([]),
|
|
7982
|
+
/** The id key of each array that carries a secret (`{ headers: 'name' }`). */
|
|
7983
|
+
secretArrayKeys: record(string(), string()).default({}),
|
|
7984
|
+
/** The legacy table this kind adopts from; the boot guard reads it (D853: no migration code). */
|
|
7985
|
+
adoptsFrom: string().min(1).optional(),
|
|
7986
|
+
/** Kinds that must agree through `transact` sit in one file under one family name. */
|
|
7987
|
+
transactFamily: string().min(1).optional(),
|
|
7988
|
+
entry: EntryDescriptorSchema.optional()
|
|
7989
|
+
}).strict();
|
|
7990
|
+
/** The kind names: lower-case, dash separated, short enough for an index name. */
|
|
7991
|
+
var RecordKindNameSchema = string().regex(/^[a-z][a-z0-9-]{0,47}$/);
|
|
7732
7992
|
/** Shared Zod schemas used across streaming capabilities. */
|
|
7733
7993
|
var CamProfileSchema = _enum([
|
|
7734
7994
|
"high",
|
|
@@ -8193,75 +8453,12 @@ method(object({ deviceId: number() }), array(StreamSourceEntrySchema)), method(o
|
|
|
8193
8453
|
kind: "mutation",
|
|
8194
8454
|
auth: "admin"
|
|
8195
8455
|
}), method(object({ deviceId: number() }), unknown().nullable()), method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" });
|
|
8196
|
-
function defOf(schema) {
|
|
8197
|
-
return schema._zod?.def ?? {};
|
|
8198
|
-
}
|
|
8199
|
-
function declaredHere(schema) {
|
|
8200
|
-
return globalRegistry.get(schema)?.secret === true;
|
|
8201
|
-
}
|
|
8202
|
-
/** Wrapper kinds whose `innerType` is the field itself. */
|
|
8203
|
-
var WRAPPERS = new Set([
|
|
8204
|
-
"optional",
|
|
8205
|
-
"nullable",
|
|
8206
|
-
"default",
|
|
8207
|
-
"prefault",
|
|
8208
|
-
"catch",
|
|
8209
|
-
"readonly",
|
|
8210
|
-
"nonoptional"
|
|
8211
|
-
]);
|
|
8212
|
-
/**
|
|
8213
|
-
* The schema layers that make up ONE field: the schema itself and every
|
|
8214
|
-
* wrapper below it (optional / default / nullable / readonly / catch), plus
|
|
8215
|
-
* both sides of a pipe (`z.preprocess` puts the real schema on `out`,
|
|
8216
|
-
* `.transform` on `in`).
|
|
8217
|
-
*/
|
|
8218
|
-
function layersOf(schema) {
|
|
8219
|
-
const out = [];
|
|
8220
|
-
const queue = [schema];
|
|
8221
|
-
while (queue.length > 0) {
|
|
8222
|
-
const s = queue.shift();
|
|
8223
|
-
if (!s || out.includes(s)) continue;
|
|
8224
|
-
out.push(s);
|
|
8225
|
-
const def = defOf(s);
|
|
8226
|
-
if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
|
|
8227
|
-
if (def.type === "pipe") {
|
|
8228
|
-
if (def.in) queue.push(def.in);
|
|
8229
|
-
if (def.out) queue.push(def.out);
|
|
8230
|
-
}
|
|
8231
|
-
}
|
|
8232
|
-
return out;
|
|
8233
|
-
}
|
|
8234
|
-
/** True when any layer of this field declares `.meta({ secret: true })`. */
|
|
8235
|
-
function isZodSecret(schema) {
|
|
8236
|
-
return layersOf(schema).some(declaredHere);
|
|
8237
|
-
}
|
|
8238
|
-
/**
|
|
8239
|
-
* Every declared secret path in a config schema: dotted keys, `[]` for "each
|
|
8240
|
-
* element of this array" (`connection.password`, `rows[].token`). A declared
|
|
8241
|
-
* object or array is reported as one path and not descended into — everything
|
|
8242
|
-
* under it is secret.
|
|
8243
|
-
*/
|
|
8244
|
-
function collectZodSecretPaths(schema, prefix = "") {
|
|
8245
|
-
if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
|
|
8246
|
-
const paths = [];
|
|
8247
|
-
for (const layer of layersOf(schema)) {
|
|
8248
|
-
const def = defOf(layer);
|
|
8249
|
-
if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
|
|
8250
|
-
else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
|
|
8251
|
-
else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
|
|
8252
|
-
else if (def.type === "intersection") {
|
|
8253
|
-
if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
|
|
8254
|
-
if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
|
|
8255
|
-
}
|
|
8256
|
-
}
|
|
8257
|
-
return [...new Set(paths)];
|
|
8258
|
-
}
|
|
8259
8456
|
object({
|
|
8260
8457
|
code: string().regex(/^[a-z][a-z0-9-]*(\.[a-z0-9-]+)+$/),
|
|
8261
8458
|
params: record(string(), union([string(), number()])).optional()
|
|
8262
8459
|
});
|
|
8263
8460
|
//#endregion
|
|
8264
|
-
//#region ../types/dist/err-msg
|
|
8461
|
+
//#region ../types/dist/err-msg--2RrYiLO.mjs
|
|
8265
8462
|
var DeviceType = /* @__PURE__ */ function(DeviceType) {
|
|
8266
8463
|
DeviceType["Camera"] = "camera";
|
|
8267
8464
|
DeviceType["Hub"] = "hub";
|
|
@@ -8530,6 +8727,9 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
|
|
|
8530
8727
|
/** Virtual HA toggle (input_boolean.*) — distinguishable from a
|
|
8531
8728
|
* real Switch device for UI rendering / export adapters. */
|
|
8532
8729
|
DeviceRole["BinaryHelper"] = "binary-helper";
|
|
8730
|
+
/** A smart plug: a `switch` whose source says it is an outlet (HA
|
|
8731
|
+
* `device_class: outlet`). The Alexa export shows it as a SMARTPLUG. */
|
|
8732
|
+
DeviceRole["Outlet"] = "outlet";
|
|
8533
8733
|
/** Generic motion / occupancy / moving event source. Distinct from
|
|
8534
8734
|
* the camera accessory PirSensor role: that one is a camera child;
|
|
8535
8735
|
* this is a standalone HA / 3rd-party motion sensor. */
|
|
@@ -8607,7 +8807,7 @@ function errMsg(err) {
|
|
|
8607
8807
|
return String(err);
|
|
8608
8808
|
}
|
|
8609
8809
|
//#endregion
|
|
8610
|
-
//#region ../types/dist/composition-
|
|
8810
|
+
//#region ../types/dist/composition-DOwQB_Ua.mjs
|
|
8611
8811
|
/**
|
|
8612
8812
|
* The ffmpeg build every CamStack node downloads, per platform and arch.
|
|
8613
8813
|
*
|
|
@@ -11811,11 +12011,10 @@ var ClipModelMetaSchema = object({
|
|
|
11811
12011
|
/**
|
|
11812
12012
|
* The `vector-store` index this model's vectors live in. ONE feature space
|
|
11813
12013
|
* per index: two models share an index only when their vectors are ranked
|
|
11814
|
-
* against each other, which for CLIP means never across families.
|
|
11815
|
-
*
|
|
11816
|
-
* `modelId`); any other model gets its own.
|
|
12014
|
+
* against each other, which for CLIP means never across families. Every
|
|
12015
|
+
* model gets its own.
|
|
11817
12016
|
*/
|
|
11818
|
-
vectorIndex: string().regex(/^object-clip
|
|
12017
|
+
vectorIndex: string().regex(/^object-clip-[a-z0-9][a-z0-9-]*$/),
|
|
11819
12018
|
/**
|
|
11820
12019
|
* The text encoder's tokenizer, a declared SIBLING file of its onnx. The name
|
|
11821
12020
|
* must be unique per tokenizer: every model's siblings land in ONE flat
|
|
@@ -15548,6 +15747,41 @@ var ComposableCapabilitiesSchema = object({ caps: array(object({
|
|
|
15548
15747
|
keyField: string()
|
|
15549
15748
|
}).optional()
|
|
15550
15749
|
})) });
|
|
15750
|
+
/**
|
|
15751
|
+
* The report of a one-shot "move this owner's plaintext secrets into the
|
|
15752
|
+
* keychain" run (D878). COUNTS only - never a value, never a ref.
|
|
15753
|
+
*
|
|
15754
|
+
* The owner runs it on its own rows, through its own write path; an operator
|
|
15755
|
+
* script (`scripts/hub/migrate-raw-secrets.ts`) calls the owner's cap method.
|
|
15756
|
+
* Dry run (`apply: false`) reports what WOULD move and changes nothing.
|
|
15757
|
+
*/
|
|
15758
|
+
var RawSecretMigrationInputSchema = object({
|
|
15759
|
+
/** `false` (the default of the script) = report only. */
|
|
15760
|
+
apply: boolean() });
|
|
15761
|
+
var RawSecretMigrationReportSchema = object({
|
|
15762
|
+
apply: boolean(),
|
|
15763
|
+
/** Rows that can carry a secret (a profile, an enrolment). */
|
|
15764
|
+
rows: number().int(),
|
|
15765
|
+
/** Rows whose secret was plaintext when the run started. */
|
|
15766
|
+
raw: number().int(),
|
|
15767
|
+
/** Rows that already held a keychain marker when the run started. */
|
|
15768
|
+
markers: number().int(),
|
|
15769
|
+
/** Plaintext rows moved by THIS run (always 0 on a dry run). */
|
|
15770
|
+
migrated: number().int(),
|
|
15771
|
+
/** Plaintext rows left in place because the move or its read-back failed. */
|
|
15772
|
+
failed: number().int(),
|
|
15773
|
+
/** After the run: rows still holding plaintext. */
|
|
15774
|
+
remainingRaw: number().int(),
|
|
15775
|
+
/** After the run: markers the keychain could not resolve right now. */
|
|
15776
|
+
unresolvedMarkers: number().int(),
|
|
15777
|
+
/**
|
|
15778
|
+
* A second, redundant copy of the secrets' rows that the run found (and, on
|
|
15779
|
+
* `apply`, deleted after verifying the first). Owners with a single copy omit it.
|
|
15780
|
+
*/
|
|
15781
|
+
redundantCopies: number().int().optional(),
|
|
15782
|
+
/** True when nothing is raw and every marker resolves. */
|
|
15783
|
+
verified: boolean()
|
|
15784
|
+
});
|
|
15551
15785
|
/** Where a block runs. The operator chooses — a block driving a device on an
|
|
15552
15786
|
* agent is the reason placement is not fixed to the hub. */
|
|
15553
15787
|
var CoreBlockPlacementSchema = union([literal("hub"), string().min(1)]);
|
|
@@ -15774,6 +16008,9 @@ method(object({}), object({ blocks: array(CoreBlockSchema) }), { auth: "admin" }
|
|
|
15774
16008
|
}), SettingsUpdateResultSchema, {
|
|
15775
16009
|
kind: "mutation",
|
|
15776
16010
|
auth: "admin"
|
|
16011
|
+
}), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
|
|
16012
|
+
kind: "mutation",
|
|
16013
|
+
auth: "admin"
|
|
15777
16014
|
}), method(object({}), object({ libs: array(object({
|
|
15778
16015
|
filePath: string(),
|
|
15779
16016
|
content: string()
|
|
@@ -16037,6 +16274,347 @@ id: union([string(), number()]) }), {
|
|
|
16037
16274
|
auth: "admin"
|
|
16038
16275
|
});
|
|
16039
16276
|
/**
|
|
16277
|
+
* records - an addon's own facts and documents (D881): ledgers, audit rows,
|
|
16278
|
+
* config documents, mirrors. The third storage API next to `ctx.settings`
|
|
16279
|
+
* (operator intent, D870) and device-history (numbers over time, D850).
|
|
16280
|
+
*
|
|
16281
|
+
* Who the OWNER is: `callerAddonId`, stamped by the transport on a call that
|
|
16282
|
+
* crossed a process and stated by a hub in-process caller (`ctx.records` does
|
|
16283
|
+
* that with the addon id closed over). It is deliberately NOT in any input
|
|
16284
|
+
* schema, so a session can never supply it, and a call with no stamp is refused
|
|
16285
|
+
* `records/no-caller`. A kind is readable and writable only by its owner; other
|
|
16286
|
+
* addons go through the owner's capability.
|
|
16287
|
+
*
|
|
16288
|
+
* Every read is three-way: a row, `null`, or the call THROWS. A failed read is
|
|
16289
|
+
* never `[]`. Secret fields are never on the wire: a read shows the
|
|
16290
|
+
* redaction token, `secretRefs` hands the owner's `ctx.secrets` the refs it
|
|
16291
|
+
* resolves itself, and a write may carry only a keychain marker bound to the
|
|
16292
|
+
* row's own ref.
|
|
16293
|
+
*
|
|
16294
|
+
* Internal: addons reach it through `ctx.records`, never directly.
|
|
16295
|
+
*/
|
|
16296
|
+
var RecordIdSchema = string().min(1).max(256);
|
|
16297
|
+
/** A JSON object body. Size is the engine's check (`maxDataBytes`), not a schema's. */
|
|
16298
|
+
var RecordBodySchema = record(string(), unknown());
|
|
16299
|
+
var RecordInputSchema = object({
|
|
16300
|
+
id: RecordIdSchema,
|
|
16301
|
+
/** The device this row belongs to (D865 removal, per-device reads). */
|
|
16302
|
+
deviceId: number().int().optional(),
|
|
16303
|
+
/** The domain clock, ms: observed / created / opened. */
|
|
16304
|
+
at: number().int().optional(),
|
|
16305
|
+
/** Producer-set expiry, ms. Refused on a kind whose retention is an engine TTL. */
|
|
16306
|
+
expiresAt: number().int().optional(),
|
|
16307
|
+
data: RecordBodySchema
|
|
16308
|
+
});
|
|
16309
|
+
var RecordViewSchema = object({
|
|
16310
|
+
id: string(),
|
|
16311
|
+
deviceId: number().int().nullable(),
|
|
16312
|
+
at: number().nullable(),
|
|
16313
|
+
expiresAt: number().nullable(),
|
|
16314
|
+
rev: number().int(),
|
|
16315
|
+
updatedAt: number(),
|
|
16316
|
+
data: RecordBodySchema
|
|
16317
|
+
});
|
|
16318
|
+
/** Declared index fields only. Anything else does not compile, by design. */
|
|
16319
|
+
var RecordWhereSchema = record(RecordFieldPathSchema, union([
|
|
16320
|
+
string(),
|
|
16321
|
+
number(),
|
|
16322
|
+
boolean(),
|
|
16323
|
+
object({ in: array(union([
|
|
16324
|
+
string(),
|
|
16325
|
+
number(),
|
|
16326
|
+
boolean()
|
|
16327
|
+
])).min(1).max(RECORD_BATCH_MAX) }),
|
|
16328
|
+
object({
|
|
16329
|
+
gt: union([string(), number()]).optional(),
|
|
16330
|
+
gte: union([string(), number()]).optional(),
|
|
16331
|
+
lt: union([string(), number()]).optional(),
|
|
16332
|
+
lte: union([string(), number()]).optional()
|
|
16333
|
+
}).refine((r) => Object.keys(r).length > 0, { message: "name at least one bound" })
|
|
16334
|
+
]));
|
|
16335
|
+
var KindShape = { kind: RecordKindNameSchema };
|
|
16336
|
+
var TimeWindowShape = {
|
|
16337
|
+
deviceId: number().int().optional(),
|
|
16338
|
+
atFrom: number().optional(),
|
|
16339
|
+
atTo: number().optional()
|
|
16340
|
+
};
|
|
16341
|
+
var RecordQueryInputSchema = object({
|
|
16342
|
+
...KindShape,
|
|
16343
|
+
...TimeWindowShape,
|
|
16344
|
+
where: RecordWhereSchema.optional(),
|
|
16345
|
+
/** Without `where`: `at` (default for a kind with a clock) or `id`. With `where` the order is the index's. */
|
|
16346
|
+
order: _enum(["at", "id"]).optional(),
|
|
16347
|
+
desc: boolean().optional(),
|
|
16348
|
+
limit: number().int().min(1).max(RECORD_QUERY_MAX).default(100),
|
|
16349
|
+
/** Opaque keyset cursor from a previous answer. There is no offset. */
|
|
16350
|
+
cursor: string().min(1).optional()
|
|
16351
|
+
});
|
|
16352
|
+
var RecordQueryResultSchema = object({
|
|
16353
|
+
records: array(RecordViewSchema),
|
|
16354
|
+
nextCursor: string().nullable()
|
|
16355
|
+
});
|
|
16356
|
+
var RecordKindStateSchema = _enum([
|
|
16357
|
+
"created",
|
|
16358
|
+
"unchanged",
|
|
16359
|
+
"updated"
|
|
16360
|
+
]);
|
|
16361
|
+
var DeclareKindResultSchema = object({
|
|
16362
|
+
kindId: number().int(),
|
|
16363
|
+
state: RecordKindStateSchema,
|
|
16364
|
+
createdIndexes: array(string()),
|
|
16365
|
+
/** The boot guard: the kind is empty while its legacy table still holds rows. */
|
|
16366
|
+
adoptionPending: object({
|
|
16367
|
+
legacyTable: string(),
|
|
16368
|
+
legacyRows: number().int()
|
|
16369
|
+
}).nullable()
|
|
16370
|
+
});
|
|
16371
|
+
/** Keychain refs a write released (the old marker is gone from the row): the owner deletes the values. */
|
|
16372
|
+
var SecretRefsList = array(string());
|
|
16373
|
+
var RecordSecretRefsSchema = record(string(), record(string(), string()));
|
|
16374
|
+
method(object({ kinds: record(RecordKindNameSchema, RecordKindDeclarationSchema) }), object({ kinds: record(string(), DeclareKindResultSchema) }), {
|
|
16375
|
+
kind: "mutation",
|
|
16376
|
+
auth: "admin"
|
|
16377
|
+
}), method(object({
|
|
16378
|
+
...KindShape,
|
|
16379
|
+
id: RecordIdSchema
|
|
16380
|
+
}), RecordViewSchema.nullable(), { auth: "admin" }), method(object({
|
|
16381
|
+
...KindShape,
|
|
16382
|
+
ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
|
|
16383
|
+
}), array(RecordViewSchema), { auth: "admin" }), method(object({
|
|
16384
|
+
...KindShape,
|
|
16385
|
+
ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
|
|
16386
|
+
}), RecordSecretRefsSchema, { auth: "admin" }), method(object({
|
|
16387
|
+
...KindShape,
|
|
16388
|
+
record: RecordInputSchema,
|
|
16389
|
+
/** Compare-and-set. `0` means "the row must not exist". */
|
|
16390
|
+
ifRev: number().int().min(0).optional()
|
|
16391
|
+
}), object({
|
|
16392
|
+
rev: number().int(),
|
|
16393
|
+
releasedRefs: SecretRefsList
|
|
16394
|
+
}), {
|
|
16395
|
+
kind: "mutation",
|
|
16396
|
+
auth: "admin"
|
|
16397
|
+
}), method(object({
|
|
16398
|
+
...KindShape,
|
|
16399
|
+
records: array(RecordInputSchema).min(1).max(RECORD_BATCH_MAX)
|
|
16400
|
+
}), object({
|
|
16401
|
+
count: number().int(),
|
|
16402
|
+
releasedRefs: SecretRefsList
|
|
16403
|
+
}), {
|
|
16404
|
+
kind: "mutation",
|
|
16405
|
+
auth: "admin"
|
|
16406
|
+
}), method(object({
|
|
16407
|
+
...KindShape,
|
|
16408
|
+
id: RecordIdSchema,
|
|
16409
|
+
data: RecordBodySchema,
|
|
16410
|
+
at: number().int().nullable().optional(),
|
|
16411
|
+
expiresAt: number().int().nullable().optional(),
|
|
16412
|
+
ifRev: number().int().min(1).optional()
|
|
16413
|
+
}), object({
|
|
16414
|
+
rev: number().int(),
|
|
16415
|
+
releasedRefs: SecretRefsList
|
|
16416
|
+
}), {
|
|
16417
|
+
kind: "mutation",
|
|
16418
|
+
auth: "admin"
|
|
16419
|
+
}), method(object({
|
|
16420
|
+
...KindShape,
|
|
16421
|
+
id: RecordIdSchema
|
|
16422
|
+
}), object({
|
|
16423
|
+
deleted: boolean(),
|
|
16424
|
+
secretRefs: SecretRefsList
|
|
16425
|
+
}), {
|
|
16426
|
+
kind: "mutation",
|
|
16427
|
+
auth: "admin"
|
|
16428
|
+
}), method(object({
|
|
16429
|
+
...KindShape,
|
|
16430
|
+
ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
|
|
16431
|
+
}), object({
|
|
16432
|
+
deleted: number().int(),
|
|
16433
|
+
secretRefs: SecretRefsList
|
|
16434
|
+
}), {
|
|
16435
|
+
kind: "mutation",
|
|
16436
|
+
auth: "admin"
|
|
16437
|
+
}), method(RecordQueryInputSchema, RecordQueryResultSchema, { auth: "admin" }), method(object({
|
|
16438
|
+
...KindShape,
|
|
16439
|
+
...TimeWindowShape,
|
|
16440
|
+
where: RecordWhereSchema.optional()
|
|
16441
|
+
}), object({ count: number().int() }), { auth: "admin" }), method(object({
|
|
16442
|
+
...KindShape,
|
|
16443
|
+
deviceId: number().int().optional(),
|
|
16444
|
+
from: number(),
|
|
16445
|
+
to: number(),
|
|
16446
|
+
bucketMs: number().int().positive()
|
|
16447
|
+
}), object({ buckets: array(object({
|
|
16448
|
+
bucketStart: number(),
|
|
16449
|
+
count: number().int()
|
|
16450
|
+
})) }), { auth: "admin" }), method(object({
|
|
16451
|
+
...KindShape,
|
|
16452
|
+
op: _enum([
|
|
16453
|
+
"sum",
|
|
16454
|
+
"min",
|
|
16455
|
+
"max",
|
|
16456
|
+
"count"
|
|
16457
|
+
]),
|
|
16458
|
+
field: RecordFieldPathSchema.optional(),
|
|
16459
|
+
groupBy: RecordFieldPathSchema.optional(),
|
|
16460
|
+
where: RecordWhereSchema.optional()
|
|
16461
|
+
}), object({ rows: array(object({
|
|
16462
|
+
group: union([
|
|
16463
|
+
string(),
|
|
16464
|
+
number(),
|
|
16465
|
+
_null()
|
|
16466
|
+
]),
|
|
16467
|
+
value: number().nullable()
|
|
16468
|
+
})) }), { auth: "admin" }), method(object({
|
|
16469
|
+
...KindShape,
|
|
16470
|
+
deviceId: number().int().optional(),
|
|
16471
|
+
atBefore: number().optional(),
|
|
16472
|
+
where: RecordWhereSchema.optional()
|
|
16473
|
+
}), object({
|
|
16474
|
+
deleted: number().int(),
|
|
16475
|
+
secretRefs: SecretRefsList
|
|
16476
|
+
}), {
|
|
16477
|
+
kind: "mutation",
|
|
16478
|
+
auth: "admin"
|
|
16479
|
+
}), method(object({
|
|
16480
|
+
deviceId: number().int(),
|
|
16481
|
+
kinds: array(RecordKindNameSchema).optional()
|
|
16482
|
+
}), object({
|
|
16483
|
+
deleted: record(string(), number().int()),
|
|
16484
|
+
secretRefs: SecretRefsList
|
|
16485
|
+
}), {
|
|
16486
|
+
kind: "mutation",
|
|
16487
|
+
auth: "admin"
|
|
16488
|
+
}), method(object(KindShape), object({ id: number().int() }), {
|
|
16489
|
+
kind: "mutation",
|
|
16490
|
+
auth: "admin"
|
|
16491
|
+
});
|
|
16492
|
+
/** One table of the settings database. */
|
|
16493
|
+
var StorageTableSchema = object({
|
|
16494
|
+
/** The table's full name, e.g. `recorder:addon-settings` or `addon-device-settings`. */
|
|
16495
|
+
name: string(),
|
|
16496
|
+
/** The owner prefix of a scoped name (`recorder` for `recorder:addon-settings`), else null. */
|
|
16497
|
+
owner: string().nullable(),
|
|
16498
|
+
rows: number().int().nonnegative(),
|
|
16499
|
+
/** Bytes the table's pages occupy (`dbstat`); null when the engine cannot measure. */
|
|
16500
|
+
bytes: number().int().nonnegative().nullable(),
|
|
16501
|
+
/** Declared by an addon since this engine process started (a running addon claims it). */
|
|
16502
|
+
declaredThisBoot: boolean()
|
|
16503
|
+
});
|
|
16504
|
+
/** One declared record kind (D881) as System -> Data shows it. */
|
|
16505
|
+
var StorageKindSchema = object({
|
|
16506
|
+
owner: string(),
|
|
16507
|
+
kind: string(),
|
|
16508
|
+
database: _enum(["settings", "events"]),
|
|
16509
|
+
class: string(),
|
|
16510
|
+
state: _enum([
|
|
16511
|
+
"declared",
|
|
16512
|
+
"orphaned",
|
|
16513
|
+
"dropped"
|
|
16514
|
+
]),
|
|
16515
|
+
/** `null` when the caller asked for no counts (`counts: false`). */
|
|
16516
|
+
rows: number().int().nonnegative().nullable(),
|
|
16517
|
+
/** Rows x the average size of a sample; null for an empty kind. */
|
|
16518
|
+
bytesEstimate: number().int().nonnegative().nullable(),
|
|
16519
|
+
writeTrigger: string(),
|
|
16520
|
+
retention: RecordRetentionSchema,
|
|
16521
|
+
/** `true` when the kind is an entry kind (the generic entries UI lists it). */
|
|
16522
|
+
entry: boolean(),
|
|
16523
|
+
/** The whole declaration, secret paths and entry descriptor included (the entries service builds its handle from it). */
|
|
16524
|
+
declaration: RecordKindDeclarationSchema
|
|
16525
|
+
});
|
|
16526
|
+
method(object({ ownerPrefix: string().min(1).optional() }), object({ tables: array(StorageTableSchema) }), { auth: "admin" }), method(object({
|
|
16527
|
+
collection: string().min(1),
|
|
16528
|
+
expectRows: number().int().nonnegative()
|
|
16529
|
+
}), object({
|
|
16530
|
+
dropped: literal(true),
|
|
16531
|
+
rows: number().int().nonnegative()
|
|
16532
|
+
}), {
|
|
16533
|
+
kind: "mutation",
|
|
16534
|
+
auth: "admin"
|
|
16535
|
+
}), method(object({
|
|
16536
|
+
owner: string().min(1).optional(),
|
|
16537
|
+
/** `false` skips the per-kind row count (a catalog read only). Default true. */
|
|
16538
|
+
counts: boolean().optional()
|
|
16539
|
+
}), object({ kinds: array(StorageKindSchema) }), { auth: "admin" }), method(RecordQueryInputSchema.extend({
|
|
16540
|
+
owner: string().min(1),
|
|
16541
|
+
kind: RecordKindNameSchema
|
|
16542
|
+
}), RecordQueryResultSchema, { auth: "admin" }), method(object({
|
|
16543
|
+
owner: string().min(1),
|
|
16544
|
+
kind: RecordKindNameSchema,
|
|
16545
|
+
records: array(RecordInputSchema).max(RECORD_BATCH_MAX),
|
|
16546
|
+
/** The LAST batch: the copy is complete, the boot guard stops asking. */
|
|
16547
|
+
complete: boolean().optional()
|
|
16548
|
+
}).refine((input) => input.records.length > 0 || input.complete === true, { message: "records must be non-empty unless complete is true" }), object({ adopted: number().int() }), {
|
|
16549
|
+
kind: "mutation",
|
|
16550
|
+
auth: "admin"
|
|
16551
|
+
}), method(object({
|
|
16552
|
+
collection: string().min(1),
|
|
16553
|
+
cursor: string().optional(),
|
|
16554
|
+
limit: number().int().min(1).max(1e3).optional()
|
|
16555
|
+
}), object({
|
|
16556
|
+
rows: array(object({
|
|
16557
|
+
id: string(),
|
|
16558
|
+
data: record(string(), unknown())
|
|
16559
|
+
})),
|
|
16560
|
+
nextCursor: string().nullable()
|
|
16561
|
+
}), { auth: "admin" }), method(object({ collection: string().min(1) }), object({ adopted: boolean() }), { auth: "admin" });
|
|
16562
|
+
/**
|
|
16563
|
+
* record-entries - the ONE admin surface for every list of user-created entries
|
|
16564
|
+
* (D881): notification targets, brokers, LLM profiles, anything an addon
|
|
16565
|
+
* declares as an ENTRY kind (`entry: { title }` in `defineRecordKinds`).
|
|
16566
|
+
*
|
|
16567
|
+
* The UI is generic. `listEntryKinds` hands it, per kind, the JSON Schema of
|
|
16568
|
+
* the entry body with `secret: true` on every credential field, so a password
|
|
16569
|
+
* field is derived from the schema and never from a name. `putEntry` takes the
|
|
16570
|
+
* redaction token for an untouched secret (the stored value is kept), a string
|
|
16571
|
+
* for a new one, and the clear instruction to remove one. A read never carries
|
|
16572
|
+
* a secret value, and a locked keychain refuses the write with
|
|
16573
|
+
* `records/secret-unavailable` instead of storing plaintext.
|
|
16574
|
+
*
|
|
16575
|
+
* Hub-only, served in-process (it acts for each entry's owner on the keychain).
|
|
16576
|
+
*/
|
|
16577
|
+
var EntryKindInfoSchema = object({
|
|
16578
|
+
owner: string(),
|
|
16579
|
+
kind: RecordKindNameSchema,
|
|
16580
|
+
title: string(),
|
|
16581
|
+
nameField: string(),
|
|
16582
|
+
/** JSON Schema of the body; `secret: true` marks a password field. */
|
|
16583
|
+
fields: record(string(), unknown()),
|
|
16584
|
+
secretPaths: array(string()),
|
|
16585
|
+
rows: number().int().nonnegative()
|
|
16586
|
+
});
|
|
16587
|
+
var EntryViewSchema = object({
|
|
16588
|
+
id: RecordIdSchema,
|
|
16589
|
+
name: string(),
|
|
16590
|
+
rev: number().int(),
|
|
16591
|
+
updatedAt: number(),
|
|
16592
|
+
/** Secret fields hold the redaction token. */
|
|
16593
|
+
data: RecordBodySchema
|
|
16594
|
+
});
|
|
16595
|
+
var EntryAddress = {
|
|
16596
|
+
owner: string().min(1),
|
|
16597
|
+
kind: RecordKindNameSchema
|
|
16598
|
+
};
|
|
16599
|
+
method(object({}), object({ kinds: array(EntryKindInfoSchema) }), { auth: "admin" }), method(object({ ...EntryAddress }), object({ entries: array(EntryViewSchema) }), { auth: "admin" }), method(object({
|
|
16600
|
+
...EntryAddress,
|
|
16601
|
+
id: RecordIdSchema.optional(),
|
|
16602
|
+
data: RecordBodySchema,
|
|
16603
|
+
ifRev: number().int().min(1).optional()
|
|
16604
|
+
}), object({
|
|
16605
|
+
id: string(),
|
|
16606
|
+
rev: number().int()
|
|
16607
|
+
}), {
|
|
16608
|
+
kind: "mutation",
|
|
16609
|
+
auth: "admin"
|
|
16610
|
+
}), method(object({
|
|
16611
|
+
...EntryAddress,
|
|
16612
|
+
id: RecordIdSchema
|
|
16613
|
+
}), object({ deleted: boolean() }), {
|
|
16614
|
+
kind: "mutation",
|
|
16615
|
+
auth: "admin"
|
|
16616
|
+
});
|
|
16617
|
+
/**
|
|
16040
16618
|
* `keychain` — the hub's encrypted store of secret values (D787).
|
|
16041
16619
|
*
|
|
16042
16620
|
* Settings blobs never hold a secret: they hold a marker
|
|
@@ -16577,6 +17155,16 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
|
|
|
16577
17155
|
kind: "mutation",
|
|
16578
17156
|
auth: "admin",
|
|
16579
17157
|
caller: "required"
|
|
17158
|
+
}), method(object({
|
|
17159
|
+
ref: string().min(1),
|
|
17160
|
+
value: string().min(1)
|
|
17161
|
+
}), object({
|
|
17162
|
+
ref: string(),
|
|
17163
|
+
version: number().int()
|
|
17164
|
+
}), {
|
|
17165
|
+
kind: "mutation",
|
|
17166
|
+
auth: "admin",
|
|
17167
|
+
caller: "required"
|
|
16580
17168
|
}), method(object({ refs: array(string().min(1)).max(1e3) }), object({
|
|
16581
17169
|
deleted: array(string()).readonly(),
|
|
16582
17170
|
kept: array(object({
|
|
@@ -39255,6 +39843,9 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
|
|
|
39255
39843
|
}), _void(), { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
|
|
39256
39844
|
kind: "mutation",
|
|
39257
39845
|
auth: "admin"
|
|
39846
|
+
}), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
|
|
39847
|
+
kind: "mutation",
|
|
39848
|
+
auth: "admin"
|
|
39258
39849
|
}), method(ProfileRefInputSchema, _void(), {
|
|
39259
39850
|
kind: "mutation",
|
|
39260
39851
|
auth: "admin"
|
|
@@ -49764,6 +50355,41 @@ var ServerRollbackInfoSchema = object({
|
|
|
49764
50355
|
atMs: number(),
|
|
49765
50356
|
reason: string()
|
|
49766
50357
|
});
|
|
50358
|
+
/**
|
|
50359
|
+
* The runner boot check (D877): the runners this node PLANNED (hub: one per
|
|
50360
|
+
* `resolveRunnerId` over its forked addons; agent: the runners its process
|
|
50361
|
+
* service holds, because only the hub plans) against the states the process
|
|
50362
|
+
* service reports. Kept in memory, recomputed by the same one-shot check after
|
|
50363
|
+
* every boot, served on `getServerPackageStatus`.
|
|
50364
|
+
*
|
|
50365
|
+
* `failed` is the D6 breaker's terminal state, `refused` a deterministic Init
|
|
50366
|
+
* refusal (an addon that said "I will not start, and here is why"), `missing` a
|
|
50367
|
+
* planned runner the process service has no entry for.
|
|
50368
|
+
*/
|
|
50369
|
+
var RunnerRefusalSchema = object({
|
|
50370
|
+
runnerId: string(),
|
|
50371
|
+
addonIds: array(string()),
|
|
50372
|
+
reason: string()
|
|
50373
|
+
});
|
|
50374
|
+
var RunnerBootCheckSchema = object({
|
|
50375
|
+
checkedAtMs: number(),
|
|
50376
|
+
/** Runners planned for this node. */
|
|
50377
|
+
expected: number(),
|
|
50378
|
+
/** Planned runners whose process is `running`. */
|
|
50379
|
+
running: number(),
|
|
50380
|
+
failed: array(string()),
|
|
50381
|
+
refused: array(RunnerRefusalSchema),
|
|
50382
|
+
missing: array(string()),
|
|
50383
|
+
/**
|
|
50384
|
+
* Runners still on their way: `starting`, or `crashed` waiting on a backoff
|
|
50385
|
+
* respawn. The check is FINAL only when this is empty; until then nothing is
|
|
50386
|
+
* pushed and the verdict is re-evaluated on the next runner state change.
|
|
50387
|
+
* Optional for version skew (absent = settled).
|
|
50388
|
+
*/
|
|
50389
|
+
pending: array(string()).optional(),
|
|
50390
|
+
/** True when the plan is the hub's (`missing` is then meaningful); false on an agent. */
|
|
50391
|
+
planKnown: boolean()
|
|
50392
|
+
});
|
|
49767
50393
|
var ServerPackageStatusSchema = object({
|
|
49768
50394
|
/** Root package name (`@camstack/server` on the hub). */
|
|
49769
50395
|
packageName: string(),
|
|
@@ -49826,7 +50452,14 @@ var ServerPackageStatusSchema = object({
|
|
|
49826
50452
|
* for version skew: an older provider's payload simply omits it, and an
|
|
49827
50453
|
* absent wrapper is unknown — never `native`.
|
|
49828
50454
|
*/
|
|
49829
|
-
wrapper: WrapperIdentitySchema.optional()
|
|
50455
|
+
wrapper: WrapperIdentitySchema.optional(),
|
|
50456
|
+
/**
|
|
50457
|
+
* What this node PLANNED to run against what its process service reports
|
|
50458
|
+
* (D877). Absent until the one-shot boot check has run (~60 s after boot) and
|
|
50459
|
+
* on a provider that predates it. Absent is "not checked yet", never "all
|
|
50460
|
+
* well": a consumer that needs the answer treats it as pending.
|
|
50461
|
+
*/
|
|
50462
|
+
runners: RunnerBootCheckSchema.optional()
|
|
49830
50463
|
});
|
|
49831
50464
|
var ServerUpdateCheckResultSchema = object({
|
|
49832
50465
|
packageName: string(),
|
|
@@ -49877,6 +50510,13 @@ var ServerUpdateOutcomeSchema = _enum([
|
|
|
49877
50510
|
"refused",
|
|
49878
50511
|
"failed"
|
|
49879
50512
|
]);
|
|
50513
|
+
/** One addon the pre-flight found the target version would refuse (D877). */
|
|
50514
|
+
var UpdateBlockerSchema = object({
|
|
50515
|
+
addonId: string(),
|
|
50516
|
+
reason: string(),
|
|
50517
|
+
/** What the operator does about it. */
|
|
50518
|
+
remedy: string()
|
|
50519
|
+
});
|
|
49880
50520
|
var ServerUpdateActionResultSchema = object({
|
|
49881
50521
|
accepted: boolean(),
|
|
49882
50522
|
targetVersion: string().nullable(),
|
|
@@ -49894,14 +50534,27 @@ var ServerUpdateActionResultSchema = object({
|
|
|
49894
50534
|
* The failure itself, verbatim enough to act on (the npm output for a
|
|
49895
50535
|
* staging install). Non-null only for `failed`.
|
|
49896
50536
|
*/
|
|
49897
|
-
error: string().nullable().optional()
|
|
50537
|
+
error: string().nullable().optional(),
|
|
50538
|
+
/**
|
|
50539
|
+
* The addons the target version would refuse to start on this node's live
|
|
50540
|
+
* store (D877), present when the pre-flight refused the update
|
|
50541
|
+
* (`reason: 'addon-would-refuse'`). Optional for version skew.
|
|
50542
|
+
*/
|
|
50543
|
+
blockers: array(UpdateBlockerSchema).optional()
|
|
49898
50544
|
});
|
|
49899
50545
|
method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), ServerUpdateCheckResultSchema, {
|
|
49900
50546
|
kind: "mutation",
|
|
49901
50547
|
auth: "admin"
|
|
49902
|
-
}), method(object({
|
|
49903
|
-
/** Explicit target version; omitted = latest from the registry. */
|
|
49904
|
-
version: string().optional()
|
|
50548
|
+
}), method(object({
|
|
50549
|
+
/** Explicit target version; omitted = latest from the registry. */
|
|
50550
|
+
version: string().optional(),
|
|
50551
|
+
/**
|
|
50552
|
+
* Apply even though the pre-flight (D877) found addons the target would
|
|
50553
|
+
* refuse to start. Off by default: those addons stay down until the
|
|
50554
|
+
* remedy is run, which is the incident this gate exists to prevent.
|
|
50555
|
+
*/
|
|
50556
|
+
acknowledgeRefusals: boolean().optional()
|
|
50557
|
+
}), ServerUpdateActionResultSchema, {
|
|
49905
50558
|
kind: "mutation",
|
|
49906
50559
|
auth: "admin",
|
|
49907
50560
|
timeoutMs: 16 * 6e4
|
|
@@ -52347,7 +53000,9 @@ var ManifestShapeSchema = object({
|
|
|
52347
53000
|
var AddonProcessSchema = object({
|
|
52348
53001
|
pid: number().optional(),
|
|
52349
53002
|
mode: string(),
|
|
52350
|
-
state: string()
|
|
53003
|
+
state: string(),
|
|
53004
|
+
/** Why the runner is `refused` (an addon's own words), when it is (D877). */
|
|
53005
|
+
reason: string().optional()
|
|
52351
53006
|
});
|
|
52352
53007
|
/**
|
|
52353
53008
|
* Per-addon health snapshot from the kernel's AddonHealthMonitor.
|
|
@@ -53736,6 +54391,12 @@ var ClimateControlStatusSchema = object({
|
|
|
53736
54391
|
/** Horizontal louver swing on/off. Null when the device has no
|
|
53737
54392
|
* horizontal swing surface (gate with `DeviceFeature.ClimateSwingHorizontal`). */
|
|
53738
54393
|
swingHorizontal: boolean().nullable(),
|
|
54394
|
+
/** Lowest setpoint the device accepts, Celsius. Absent / null = not reported. */
|
|
54395
|
+
minTemp: number().nullable().optional(),
|
|
54396
|
+
/** Highest setpoint the device accepts, Celsius. Absent / null = not reported. */
|
|
54397
|
+
maxTemp: number().nullable().optional(),
|
|
54398
|
+
/** Setpoint granularity, Celsius (0.5, 1). Absent / null = not reported. */
|
|
54399
|
+
tempStep: number().positive().nullable().optional(),
|
|
53739
54400
|
/** Ms epoch when the slice was last updated (push or command). */
|
|
53740
54401
|
lastFetchedAt: number()
|
|
53741
54402
|
});
|
|
@@ -56516,7 +57177,19 @@ var TlsStatusSchema = object({
|
|
|
56516
57177
|
sans: array(string()),
|
|
56517
57178
|
caCertPem: string().nullable(),
|
|
56518
57179
|
reissueError: string().nullable(),
|
|
56519
|
-
restartRequired: boolean()
|
|
57180
|
+
restartRequired: boolean(),
|
|
57181
|
+
/** An uploaded certificate is served but no CA is kept for it and it is not publicly signed (D873). */
|
|
57182
|
+
caMissing: boolean(),
|
|
57183
|
+
/** Does the hub's own generated CA carry a critical name constraint? `null` while it has none. */
|
|
57184
|
+
localCaConstrained: boolean().nullable(),
|
|
57185
|
+
/** ISO time the generated CA was replaced by a constrained one; devices must re-download it. */
|
|
57186
|
+
caReplacedAt: string().nullable(),
|
|
57187
|
+
/** The uploaded certificate kept on disk, selectable again after "Revert to generated". */
|
|
57188
|
+
storedUpload: object({
|
|
57189
|
+
leafFingerprintSha256: string(),
|
|
57190
|
+
validTo: string(),
|
|
57191
|
+
hasCa: boolean()
|
|
57192
|
+
}).nullable()
|
|
56520
57193
|
});
|
|
56521
57194
|
method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(object({
|
|
56522
57195
|
/**
|
|
@@ -56572,6 +57245,9 @@ method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(obje
|
|
|
56572
57245
|
}), method(_void(), object({ pem: string() })), method(_void(), TlsStatusSchema, {
|
|
56573
57246
|
kind: "mutation",
|
|
56574
57247
|
auth: "admin"
|
|
57248
|
+
}), method(_void(), TlsStatusSchema, {
|
|
57249
|
+
kind: "mutation",
|
|
57250
|
+
auth: "admin"
|
|
56575
57251
|
});
|
|
56576
57252
|
var LockControlStatusSchema = object({
|
|
56577
57253
|
/** Lifecycle state of the lock. `jammed` means the motor reported
|
|
@@ -63065,7 +63741,11 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
63065
63741
|
kind: "mutation",
|
|
63066
63742
|
auth: "admin",
|
|
63067
63743
|
access: "delete"
|
|
63068
|
-
}), method(object({ userId: string() }), TotpStatusSchema, { auth: "admin" }), method(
|
|
63744
|
+
}), method(object({ userId: string() }), TotpStatusSchema, { auth: "admin" }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
|
|
63745
|
+
kind: "mutation",
|
|
63746
|
+
auth: "admin",
|
|
63747
|
+
access: "create"
|
|
63748
|
+
}), method(object({
|
|
63069
63749
|
userId: string(),
|
|
63070
63750
|
code: string()
|
|
63071
63751
|
}), object({ valid: boolean() }), {
|
|
@@ -64877,13 +65557,14 @@ var BaseDevice = class {
|
|
|
64877
65557
|
get state() {
|
|
64878
65558
|
if (!this._stateProxyCache) {
|
|
64879
65559
|
const cache = {};
|
|
64880
|
-
const handler = { get: (
|
|
65560
|
+
const handler = { get: (target, key) => {
|
|
64881
65561
|
const k = key;
|
|
64882
|
-
|
|
65562
|
+
const existing = Reflect.get(target, k);
|
|
65563
|
+
if (existing !== void 0) return existing;
|
|
64883
65564
|
const cap = DEVICE_LOCAL_STATE_CAPS[k];
|
|
64884
65565
|
if (!cap) return void 0;
|
|
64885
65566
|
const proxy = this.sliceProxy(cap);
|
|
64886
|
-
|
|
65567
|
+
Reflect.set(target, k, proxy);
|
|
64887
65568
|
return proxy;
|
|
64888
65569
|
} };
|
|
64889
65570
|
this._stateProxyCache = new Proxy(cache, handler);
|
|
@@ -65082,7 +65763,7 @@ var BaseDevice = class {
|
|
|
65082
65763
|
async updateSourceInfo(patch) {
|
|
65083
65764
|
const next = mergeSourceInfo(this.sourceInfo, patch);
|
|
65084
65765
|
this._sourceInfoCache = Object.freeze({ ...next });
|
|
65085
|
-
const action = this.ctx.api
|
|
65766
|
+
const action = this.ctx.api.deviceManager?.setMetadata;
|
|
65086
65767
|
if (action) try {
|
|
65087
65768
|
await action.mutate({
|
|
65088
65769
|
deviceId: this.id,
|
|
@@ -65117,7 +65798,7 @@ var BaseDevice = class {
|
|
|
65117
65798
|
* device boot on a meta refresh.
|
|
65118
65799
|
*/
|
|
65119
65800
|
async refreshFeatures() {
|
|
65120
|
-
const action = this.ctx.api
|
|
65801
|
+
const action = this.ctx.api.deviceManager?.registerDevice;
|
|
65121
65802
|
if (!action) return;
|
|
65122
65803
|
try {
|
|
65123
65804
|
await action.mutate({
|
|
@@ -67191,6 +67872,12 @@ Object.freeze({
|
|
|
67191
67872
|
addonId: null,
|
|
67192
67873
|
access: "view"
|
|
67193
67874
|
},
|
|
67875
|
+
"coreBlocks.migrateRawSecrets": {
|
|
67876
|
+
capName: "core-blocks",
|
|
67877
|
+
capScope: "system",
|
|
67878
|
+
addonId: null,
|
|
67879
|
+
access: "create"
|
|
67880
|
+
},
|
|
67194
67881
|
"coreBlocks.restart": {
|
|
67195
67882
|
capName: "core-blocks",
|
|
67196
67883
|
capScope: "system",
|
|
@@ -68877,6 +69564,12 @@ Object.freeze({
|
|
|
68877
69564
|
addonId: null,
|
|
68878
69565
|
access: "create"
|
|
68879
69566
|
},
|
|
69567
|
+
"keychainAdmin.importSecret": {
|
|
69568
|
+
capName: "keychain-admin",
|
|
69569
|
+
capScope: "system",
|
|
69570
|
+
addonId: null,
|
|
69571
|
+
access: "create"
|
|
69572
|
+
},
|
|
68880
69573
|
"keychainAdmin.listAudit": {
|
|
68881
69574
|
capName: "keychain-admin",
|
|
68882
69575
|
capScope: "system",
|
|
@@ -69045,6 +69738,12 @@ Object.freeze({
|
|
|
69045
69738
|
addonId: null,
|
|
69046
69739
|
access: "view"
|
|
69047
69740
|
},
|
|
69741
|
+
"llm.migrateRawSecrets": {
|
|
69742
|
+
capName: "llm",
|
|
69743
|
+
capScope: "system",
|
|
69744
|
+
addonId: null,
|
|
69745
|
+
access: "create"
|
|
69746
|
+
},
|
|
69048
69747
|
"llm.resolveModelRef": {
|
|
69049
69748
|
capName: "llm",
|
|
69050
69749
|
capScope: "system",
|
|
@@ -69273,6 +69972,12 @@ Object.freeze({
|
|
|
69273
69972
|
addonId: null,
|
|
69274
69973
|
access: "create"
|
|
69275
69974
|
},
|
|
69975
|
+
"localNetwork.useStoredUploadedCertificate": {
|
|
69976
|
+
capName: "local-network",
|
|
69977
|
+
capScope: "system",
|
|
69978
|
+
addonId: null,
|
|
69979
|
+
access: "create"
|
|
69980
|
+
},
|
|
69276
69981
|
"lockControl.getStatus": {
|
|
69277
69982
|
capName: "lock-control",
|
|
69278
69983
|
capScope: "device",
|
|
@@ -71925,6 +72630,30 @@ Object.freeze({
|
|
|
71925
72630
|
addonId: null,
|
|
71926
72631
|
access: "create"
|
|
71927
72632
|
},
|
|
72633
|
+
"recordEntries.deleteEntry": {
|
|
72634
|
+
capName: "record-entries",
|
|
72635
|
+
capScope: "system",
|
|
72636
|
+
addonId: null,
|
|
72637
|
+
access: "delete"
|
|
72638
|
+
},
|
|
72639
|
+
"recordEntries.listEntries": {
|
|
72640
|
+
capName: "record-entries",
|
|
72641
|
+
capScope: "system",
|
|
72642
|
+
addonId: null,
|
|
72643
|
+
access: "view"
|
|
72644
|
+
},
|
|
72645
|
+
"recordEntries.listEntryKinds": {
|
|
72646
|
+
capName: "record-entries",
|
|
72647
|
+
capScope: "system",
|
|
72648
|
+
addonId: null,
|
|
72649
|
+
access: "view"
|
|
72650
|
+
},
|
|
72651
|
+
"recordEntries.putEntry": {
|
|
72652
|
+
capName: "record-entries",
|
|
72653
|
+
capScope: "system",
|
|
72654
|
+
addonId: null,
|
|
72655
|
+
access: "create"
|
|
72656
|
+
},
|
|
71928
72657
|
"recording.getAvailability": {
|
|
71929
72658
|
capName: "recording",
|
|
71930
72659
|
capScope: "device",
|
|
@@ -72225,6 +72954,102 @@ Object.freeze({
|
|
|
72225
72954
|
addonId: null,
|
|
72226
72955
|
access: "view"
|
|
72227
72956
|
},
|
|
72957
|
+
"records.aggregate": {
|
|
72958
|
+
capName: "records",
|
|
72959
|
+
capScope: "system",
|
|
72960
|
+
addonId: null,
|
|
72961
|
+
access: "view"
|
|
72962
|
+
},
|
|
72963
|
+
"records.allocateId": {
|
|
72964
|
+
capName: "records",
|
|
72965
|
+
capScope: "system",
|
|
72966
|
+
addonId: null,
|
|
72967
|
+
access: "create"
|
|
72968
|
+
},
|
|
72969
|
+
"records.count": {
|
|
72970
|
+
capName: "records",
|
|
72971
|
+
capScope: "system",
|
|
72972
|
+
addonId: null,
|
|
72973
|
+
access: "view"
|
|
72974
|
+
},
|
|
72975
|
+
"records.declareKinds": {
|
|
72976
|
+
capName: "records",
|
|
72977
|
+
capScope: "system",
|
|
72978
|
+
addonId: null,
|
|
72979
|
+
access: "create"
|
|
72980
|
+
},
|
|
72981
|
+
"records.delete": {
|
|
72982
|
+
capName: "records",
|
|
72983
|
+
capScope: "system",
|
|
72984
|
+
addonId: null,
|
|
72985
|
+
access: "delete"
|
|
72986
|
+
},
|
|
72987
|
+
"records.deleteDevice": {
|
|
72988
|
+
capName: "records",
|
|
72989
|
+
capScope: "system",
|
|
72990
|
+
addonId: null,
|
|
72991
|
+
access: "delete"
|
|
72992
|
+
},
|
|
72993
|
+
"records.deleteMany": {
|
|
72994
|
+
capName: "records",
|
|
72995
|
+
capScope: "system",
|
|
72996
|
+
addonId: null,
|
|
72997
|
+
access: "delete"
|
|
72998
|
+
},
|
|
72999
|
+
"records.deleteWhere": {
|
|
73000
|
+
capName: "records",
|
|
73001
|
+
capScope: "system",
|
|
73002
|
+
addonId: null,
|
|
73003
|
+
access: "delete"
|
|
73004
|
+
},
|
|
73005
|
+
"records.get": {
|
|
73006
|
+
capName: "records",
|
|
73007
|
+
capScope: "system",
|
|
73008
|
+
addonId: null,
|
|
73009
|
+
access: "view"
|
|
73010
|
+
},
|
|
73011
|
+
"records.getMany": {
|
|
73012
|
+
capName: "records",
|
|
73013
|
+
capScope: "system",
|
|
73014
|
+
addonId: null,
|
|
73015
|
+
access: "view"
|
|
73016
|
+
},
|
|
73017
|
+
"records.histogram": {
|
|
73018
|
+
capName: "records",
|
|
73019
|
+
capScope: "system",
|
|
73020
|
+
addonId: null,
|
|
73021
|
+
access: "view"
|
|
73022
|
+
},
|
|
73023
|
+
"records.patch": {
|
|
73024
|
+
capName: "records",
|
|
73025
|
+
capScope: "system",
|
|
73026
|
+
addonId: null,
|
|
73027
|
+
access: "create"
|
|
73028
|
+
},
|
|
73029
|
+
"records.put": {
|
|
73030
|
+
capName: "records",
|
|
73031
|
+
capScope: "system",
|
|
73032
|
+
addonId: null,
|
|
73033
|
+
access: "create"
|
|
73034
|
+
},
|
|
73035
|
+
"records.putMany": {
|
|
73036
|
+
capName: "records",
|
|
73037
|
+
capScope: "system",
|
|
73038
|
+
addonId: null,
|
|
73039
|
+
access: "create"
|
|
73040
|
+
},
|
|
73041
|
+
"records.query": {
|
|
73042
|
+
capName: "records",
|
|
73043
|
+
capScope: "system",
|
|
73044
|
+
addonId: null,
|
|
73045
|
+
access: "view"
|
|
73046
|
+
},
|
|
73047
|
+
"records.secretRefs": {
|
|
73048
|
+
capName: "records",
|
|
73049
|
+
capScope: "system",
|
|
73050
|
+
addonId: null,
|
|
73051
|
+
access: "view"
|
|
73052
|
+
},
|
|
72228
73053
|
"sceneMonitor.captureReference": {
|
|
72229
73054
|
capName: "scene-monitor",
|
|
72230
73055
|
capScope: "device",
|
|
@@ -72657,6 +73482,48 @@ Object.freeze({
|
|
|
72657
73482
|
addonId: null,
|
|
72658
73483
|
access: "create"
|
|
72659
73484
|
},
|
|
73485
|
+
"storageAdmin.adoptRecords": {
|
|
73486
|
+
capName: "storage-admin",
|
|
73487
|
+
capScope: "system",
|
|
73488
|
+
addonId: null,
|
|
73489
|
+
access: "create"
|
|
73490
|
+
},
|
|
73491
|
+
"storageAdmin.dropCollection": {
|
|
73492
|
+
capName: "storage-admin",
|
|
73493
|
+
capScope: "system",
|
|
73494
|
+
addonId: null,
|
|
73495
|
+
access: "delete"
|
|
73496
|
+
},
|
|
73497
|
+
"storageAdmin.isAdoptedLegacyTable": {
|
|
73498
|
+
capName: "storage-admin",
|
|
73499
|
+
capScope: "system",
|
|
73500
|
+
addonId: null,
|
|
73501
|
+
access: "view"
|
|
73502
|
+
},
|
|
73503
|
+
"storageAdmin.listKinds": {
|
|
73504
|
+
capName: "storage-admin",
|
|
73505
|
+
capScope: "system",
|
|
73506
|
+
addonId: null,
|
|
73507
|
+
access: "view"
|
|
73508
|
+
},
|
|
73509
|
+
"storageAdmin.listTables": {
|
|
73510
|
+
capName: "storage-admin",
|
|
73511
|
+
capScope: "system",
|
|
73512
|
+
addonId: null,
|
|
73513
|
+
access: "view"
|
|
73514
|
+
},
|
|
73515
|
+
"storageAdmin.readLegacyCollection": {
|
|
73516
|
+
capName: "storage-admin",
|
|
73517
|
+
capScope: "system",
|
|
73518
|
+
addonId: null,
|
|
73519
|
+
access: "view"
|
|
73520
|
+
},
|
|
73521
|
+
"storageAdmin.readRecords": {
|
|
73522
|
+
capName: "storage-admin",
|
|
73523
|
+
capScope: "system",
|
|
73524
|
+
addonId: null,
|
|
73525
|
+
access: "view"
|
|
73526
|
+
},
|
|
72660
73527
|
"storageEvictable.evict": {
|
|
72661
73528
|
capName: "storage-evictable",
|
|
72662
73529
|
capScope: "system",
|
|
@@ -73569,6 +74436,12 @@ Object.freeze({
|
|
|
73569
74436
|
addonId: null,
|
|
73570
74437
|
access: "view"
|
|
73571
74438
|
},
|
|
74439
|
+
"userManagement.migrateRawSecrets": {
|
|
74440
|
+
capName: "user-management",
|
|
74441
|
+
capScope: "system",
|
|
74442
|
+
addonId: null,
|
|
74443
|
+
access: "create"
|
|
74444
|
+
},
|
|
73572
74445
|
"userManagement.oauthExchangeCode": {
|
|
73573
74446
|
capName: "user-management",
|
|
73574
74447
|
capScope: "system",
|
|
@@ -76245,6 +77118,37 @@ Object.freeze({
|
|
|
76245
77118
|
form: "single",
|
|
76246
77119
|
optional: false
|
|
76247
77120
|
}],
|
|
77121
|
+
"records.count": [{
|
|
77122
|
+
name: "deviceId",
|
|
77123
|
+
form: "single",
|
|
77124
|
+
optional: true
|
|
77125
|
+
}],
|
|
77126
|
+
"records.deleteDevice": [{
|
|
77127
|
+
name: "deviceId",
|
|
77128
|
+
form: "single",
|
|
77129
|
+
optional: false
|
|
77130
|
+
}],
|
|
77131
|
+
"records.deleteWhere": [{
|
|
77132
|
+
name: "deviceId",
|
|
77133
|
+
form: "single",
|
|
77134
|
+
optional: true
|
|
77135
|
+
}],
|
|
77136
|
+
"records.histogram": [{
|
|
77137
|
+
name: "deviceId",
|
|
77138
|
+
form: "single",
|
|
77139
|
+
optional: true
|
|
77140
|
+
}],
|
|
77141
|
+
"records.putMany": [{
|
|
77142
|
+
name: "records",
|
|
77143
|
+
form: "object-array",
|
|
77144
|
+
optional: false,
|
|
77145
|
+
itemField: "deviceId"
|
|
77146
|
+
}],
|
|
77147
|
+
"records.query": [{
|
|
77148
|
+
name: "deviceId",
|
|
77149
|
+
form: "single",
|
|
77150
|
+
optional: true
|
|
77151
|
+
}],
|
|
76248
77152
|
"sceneMonitor.captureReference": [{
|
|
76249
77153
|
name: "deviceId",
|
|
76250
77154
|
form: "single",
|
|
@@ -76361,6 +77265,17 @@ Object.freeze({
|
|
|
76361
77265
|
form: "single",
|
|
76362
77266
|
optional: false
|
|
76363
77267
|
}],
|
|
77268
|
+
"storageAdmin.adoptRecords": [{
|
|
77269
|
+
name: "records",
|
|
77270
|
+
form: "object-array",
|
|
77271
|
+
optional: false,
|
|
77272
|
+
itemField: "deviceId"
|
|
77273
|
+
}],
|
|
77274
|
+
"storageAdmin.readRecords": [{
|
|
77275
|
+
name: "deviceId",
|
|
77276
|
+
form: "single",
|
|
77277
|
+
optional: true
|
|
77278
|
+
}],
|
|
76364
77279
|
"streamBroker.acquireEgressTranscode": [{
|
|
76365
77280
|
name: "deviceId",
|
|
76366
77281
|
form: "single",
|