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