@camstack/addon-provider-reolink 1.2.186 → 1.2.187
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 +1034 -119
- package/dist/addon.mjs +1034 -119
- package/package.json +1 -1
package/dist/addon.js
CHANGED
|
@@ -36,7 +36,7 @@ let node_os = require("node:os");
|
|
|
36
36
|
node_os = require_chunk.__toESM(node_os, 1);
|
|
37
37
|
let node_fs = require("node:fs");
|
|
38
38
|
node_fs = require_chunk.__toESM(node_fs, 1);
|
|
39
|
-
//#region ../types/dist/event-category-
|
|
39
|
+
//#region ../types/dist/event-category-BvOFi6PY.mjs
|
|
40
40
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
41
41
|
EventCategory["SystemBoot"] = "system.boot";
|
|
42
42
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -100,6 +100,24 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
100
100
|
* consumes this category and maps it to the `addon-crash-loop` kind.
|
|
101
101
|
*/
|
|
102
102
|
EventCategory["AddonRunnerFailed"] = "addon.runner-failed";
|
|
103
|
+
/**
|
|
104
|
+
* A runner whose addon refused to start with a typed reason (D877) - parked
|
|
105
|
+
* in `refused`, never counted by the crash breaker, retried on operator
|
|
106
|
+
* action. One event per refusal.
|
|
107
|
+
*/
|
|
108
|
+
EventCategory["AddonRunnerRefused"] = "addon.runner-refused";
|
|
109
|
+
/**
|
|
110
|
+
* A runner settled on a state (D877): `running` (READY), `crashed`, `failed` or
|
|
111
|
+
* `refused`. In-process telemetry for the boot check (re-evaluate while any
|
|
112
|
+
* runner is still pending) and the alert centre (close a recovered runner).
|
|
113
|
+
*/
|
|
114
|
+
EventCategory["ProcessStateChanged"] = "process.state-changed";
|
|
115
|
+
/**
|
|
116
|
+
* The node's one-shot runner boot check (D877): planned runners against the
|
|
117
|
+
* process service, `degraded` when any is failed, refused or missing. The
|
|
118
|
+
* alert centre turns it into one alert and a direct critical push.
|
|
119
|
+
*/
|
|
120
|
+
EventCategory["SystemRunnerCheck"] = "system.runner-check";
|
|
103
121
|
EventCategory["AddonError"] = "addon.error";
|
|
104
122
|
EventCategory["AddonPageReady"] = "addon.page-ready";
|
|
105
123
|
EventCategory["AddonWidgetReady"] = "addon.widget-ready";
|
|
@@ -5424,7 +5442,7 @@ var ZodIssueCode = {
|
|
|
5424
5442
|
var ZodFirstPartyTypeKind;
|
|
5425
5443
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5426
5444
|
//#endregion
|
|
5427
|
-
//#region ../types/dist/sleep-
|
|
5445
|
+
//#region ../types/dist/sleep-bZIhUvjd.mjs
|
|
5428
5446
|
/**
|
|
5429
5447
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5430
5448
|
* window to float samples (D455).
|
|
@@ -5541,7 +5559,7 @@ function isKeychainStoredField(field) {
|
|
|
5541
5559
|
var SECRET_CLEAR = { $secretClear: true };
|
|
5542
5560
|
/** The `'***'` token D634 redaction writes for non-admins. */
|
|
5543
5561
|
var LEGACY_DEVICE_REDACTION = "***";
|
|
5544
|
-
function isRecord$
|
|
5562
|
+
function isRecord$5(value) {
|
|
5545
5563
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5546
5564
|
}
|
|
5547
5565
|
function makeSecretMarker(ref) {
|
|
@@ -5552,16 +5570,16 @@ function makeSecretMarker(ref) {
|
|
|
5552
5570
|
}
|
|
5553
5571
|
/** A stored marker: an object whose `$secret` is a non-empty string. */
|
|
5554
5572
|
function isSecretMarker(value) {
|
|
5555
|
-
if (!isRecord$
|
|
5573
|
+
if (!isRecord$5(value)) return false;
|
|
5556
5574
|
const ref = value["$secret"];
|
|
5557
5575
|
return typeof ref === "string" && ref.length > 0;
|
|
5558
5576
|
}
|
|
5559
5577
|
/** Anything carrying a `$secret` key — a stored marker or a UI view of one. */
|
|
5560
5578
|
function isSecretMarkerLike(value) {
|
|
5561
|
-
return isRecord$
|
|
5579
|
+
return isRecord$5(value) && Object.prototype.hasOwnProperty.call(value, "$secret");
|
|
5562
5580
|
}
|
|
5563
5581
|
function isSecretClear(value) {
|
|
5564
|
-
return isRecord$
|
|
5582
|
+
return isRecord$5(value) && value["$secretClear"] === true;
|
|
5565
5583
|
}
|
|
5566
5584
|
/**
|
|
5567
5585
|
* The UI view of a stored secret field value: a marker becomes "set", inline
|
|
@@ -6171,7 +6189,7 @@ var KeychainWriteRefusedError = class extends Error {
|
|
|
6171
6189
|
}
|
|
6172
6190
|
};
|
|
6173
6191
|
var KEEP = { kind: "keep" };
|
|
6174
|
-
function isRecord$
|
|
6192
|
+
function isRecord$4(value) {
|
|
6175
6193
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6176
6194
|
}
|
|
6177
6195
|
function defaultMintId() {
|
|
@@ -6184,7 +6202,7 @@ function collectSecretMarkerRefs(value, out = []) {
|
|
|
6184
6202
|
return out;
|
|
6185
6203
|
}
|
|
6186
6204
|
if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
|
|
6187
|
-
else if (isRecord$
|
|
6205
|
+
else if (isRecord$4(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
6188
6206
|
return out;
|
|
6189
6207
|
}
|
|
6190
6208
|
async function storedValueEquals(secrets, marker, candidate) {
|
|
@@ -6239,7 +6257,7 @@ function rowId(row, idKey) {
|
|
|
6239
6257
|
return null;
|
|
6240
6258
|
}
|
|
6241
6259
|
async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
6242
|
-
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$
|
|
6260
|
+
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$4) : [];
|
|
6243
6261
|
if (!Array.isArray(incoming)) {
|
|
6244
6262
|
ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
|
|
6245
6263
|
return {
|
|
@@ -6255,7 +6273,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
|
6255
6273
|
const kept = /* @__PURE__ */ new Set();
|
|
6256
6274
|
const rows = [];
|
|
6257
6275
|
for (const row of incoming) {
|
|
6258
|
-
if (!isRecord$
|
|
6276
|
+
if (!isRecord$4(row)) {
|
|
6259
6277
|
rows.push(row);
|
|
6260
6278
|
continue;
|
|
6261
6279
|
}
|
|
@@ -6280,7 +6298,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
6280
6298
|
case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
|
|
6281
6299
|
case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
|
|
6282
6300
|
case "object": {
|
|
6283
|
-
if (!isRecord$
|
|
6301
|
+
if (!isRecord$4(incoming)) {
|
|
6284
6302
|
if (incoming === void 0) return KEEP;
|
|
6285
6303
|
ctx.deletes.push(...collectSecretMarkerRefs(stored));
|
|
6286
6304
|
return {
|
|
@@ -6288,7 +6306,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
6288
6306
|
value: incoming
|
|
6289
6307
|
};
|
|
6290
6308
|
}
|
|
6291
|
-
const storedObj = isRecord$
|
|
6309
|
+
const storedObj = isRecord$4(stored) ? stored : {};
|
|
6292
6310
|
return {
|
|
6293
6311
|
kind: "value",
|
|
6294
6312
|
value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
|
|
@@ -6411,7 +6429,7 @@ async function resolveSecretMarkers(value, secrets, options = {}) {
|
|
|
6411
6429
|
value: items
|
|
6412
6430
|
};
|
|
6413
6431
|
}
|
|
6414
|
-
if (isRecord$
|
|
6432
|
+
if (isRecord$4(v)) {
|
|
6415
6433
|
const out = {};
|
|
6416
6434
|
for (const [k, child] of Object.entries(v)) {
|
|
6417
6435
|
const s = substitute(child);
|
|
@@ -6679,7 +6697,6 @@ function createHandle(raw, opts) {
|
|
|
6679
6697
|
const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
|
|
6680
6698
|
const readAddonStoreResult = raw.readAddonStoreResult;
|
|
6681
6699
|
const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
|
|
6682
|
-
const readDeviceStoreBatch = raw.readDeviceStoreBatch;
|
|
6683
6700
|
const overrides = {
|
|
6684
6701
|
readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
|
|
6685
6702
|
...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
|
|
@@ -6703,12 +6720,12 @@ function createHandle(raw, opts) {
|
|
|
6703
6720
|
};
|
|
6704
6721
|
} } : {},
|
|
6705
6722
|
readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
|
|
6706
|
-
|
|
6707
|
-
const rows = await readDeviceStoreBatch
|
|
6723
|
+
readDeviceStoreBatch: async (deviceIds) => {
|
|
6724
|
+
const rows = await raw.readDeviceStoreBatch(deviceIds);
|
|
6708
6725
|
const out = /* @__PURE__ */ new Map();
|
|
6709
6726
|
for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
|
|
6710
6727
|
return out;
|
|
6711
|
-
}
|
|
6728
|
+
},
|
|
6712
6729
|
writeAddonStore: async (patch) => {
|
|
6713
6730
|
await writeAddon(patch);
|
|
6714
6731
|
},
|
|
@@ -7335,7 +7352,7 @@ var BaseAddon = class {
|
|
|
7335
7352
|
if (!ctx) return;
|
|
7336
7353
|
const addonId = ctx.id;
|
|
7337
7354
|
setImmediate(() => {
|
|
7338
|
-
ctx.api.addons
|
|
7355
|
+
ctx.api.addons.restartAddon.mutate({ addonId }).then(() => {
|
|
7339
7356
|
ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
|
|
7340
7357
|
}).catch((err) => {
|
|
7341
7358
|
ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
@@ -7535,7 +7552,7 @@ var BaseAddon = class {
|
|
|
7535
7552
|
return this._addonSecretTree;
|
|
7536
7553
|
}
|
|
7537
7554
|
deviceSecretTree() {
|
|
7538
|
-
this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
|
|
7555
|
+
this._deviceSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.deviceSettingsSchema()), this.secretStatePaths);
|
|
7539
7556
|
return this._deviceSecretTree;
|
|
7540
7557
|
}
|
|
7541
7558
|
/**
|
|
@@ -7611,42 +7628,135 @@ var BaseAddon = class {
|
|
|
7611
7628
|
this[timerOf] = timer;
|
|
7612
7629
|
}
|
|
7613
7630
|
/**
|
|
7614
|
-
* Wrap `ctx.settings.readAddonStore()` with a
|
|
7615
|
-
*
|
|
7616
|
-
* swap, or any race where the SqliteSettingsBackend is between shutdown and
|
|
7617
|
-
* re-initialize) doesn't propagate up into `initialize()` and leave the
|
|
7631
|
+
* Wrap `ctx.settings.readAddonStore()` with a retry budget so a transient
|
|
7632
|
+
* settings-store outage doesn't propagate up into `initialize()` and leave the
|
|
7618
7633
|
* addon permanently broken.
|
|
7619
7634
|
*
|
|
7620
|
-
*
|
|
7621
|
-
*
|
|
7622
|
-
* `
|
|
7635
|
+
* Two kinds of outage, two budgets:
|
|
7636
|
+
* - the store's own restart fingerprints (`SqliteSettingsBackend not
|
|
7637
|
+
* initialized`, `provider not available`): a short budget, then the addon
|
|
7638
|
+
* falls back to `{}` (defaults) - its first successful patch rehydrates;
|
|
7639
|
+
* - a TRANSPORT failure (the hub is restarting while this runner boots:
|
|
7640
|
+
* `discovery deadline exceeded`, `parent could not route`, a refused or
|
|
7641
|
+
* timed-out connection). Since D870 a runner's settings read THROWS instead
|
|
7642
|
+
* of answering `{}`, so without a budget a hub restart ends in a respawn
|
|
7643
|
+
* loop. A long, bounded budget; only after it the error propagates - the
|
|
7644
|
+
* addon never runs on defaults for a store it could not ask.
|
|
7645
|
+
* Anything else propagates immediately so real bugs surface.
|
|
7623
7646
|
*/
|
|
7624
7647
|
async readAddonStoreWithRetry() {
|
|
7625
7648
|
const settings = this.rawSettings();
|
|
7626
7649
|
if (!settings) return {};
|
|
7627
|
-
const delaysMs = [
|
|
7628
|
-
150,
|
|
7629
|
-
350,
|
|
7630
|
-
600,
|
|
7631
|
-
900
|
|
7632
|
-
];
|
|
7633
7650
|
let lastErr;
|
|
7634
|
-
for (let attempt = 0
|
|
7651
|
+
for (let attempt = 0;; attempt++) try {
|
|
7635
7652
|
const stored = await settings.readAddonStore() ?? {};
|
|
7636
7653
|
this.settingsStoreReady = true;
|
|
7637
7654
|
return stored;
|
|
7638
7655
|
} catch (err) {
|
|
7639
7656
|
lastErr = err;
|
|
7640
|
-
const
|
|
7641
|
-
if (
|
|
7642
|
-
|
|
7643
|
-
|
|
7657
|
+
const kind = classifyStoreError(err);
|
|
7658
|
+
if (kind === "permanent") throw err;
|
|
7659
|
+
const delay = (kind === "transport" ? TRANSPORT_RETRY_DELAYS_MS : RESTART_RETRY_DELAYS_MS)[attempt];
|
|
7660
|
+
if (delay === void 0) {
|
|
7661
|
+
if (kind === "transport") throw err;
|
|
7662
|
+
break;
|
|
7663
|
+
}
|
|
7664
|
+
await new Promise((r) => setTimeout(r, delay));
|
|
7644
7665
|
}
|
|
7645
7666
|
this.settingsStoreReady = false;
|
|
7646
7667
|
this._ctx?.logger?.warn?.("readAddonStore: settings-store unavailable after retries — using defaults", { meta: { error: lastErr instanceof Error ? lastErr.message : String(lastErr) } });
|
|
7647
7668
|
return {};
|
|
7648
7669
|
}
|
|
7649
7670
|
};
|
|
7671
|
+
/** The settings store's own restart fingerprints. */
|
|
7672
|
+
var RESTART_RETRY_DELAYS_MS = [
|
|
7673
|
+
150,
|
|
7674
|
+
350,
|
|
7675
|
+
600,
|
|
7676
|
+
900
|
|
7677
|
+
];
|
|
7678
|
+
/** A hub restarting under a booting runner: ~100 s in total. */
|
|
7679
|
+
var TRANSPORT_RETRY_DELAYS_MS = [
|
|
7680
|
+
150,
|
|
7681
|
+
350,
|
|
7682
|
+
600,
|
|
7683
|
+
900,
|
|
7684
|
+
2e3,
|
|
7685
|
+
5e3,
|
|
7686
|
+
1e4,
|
|
7687
|
+
2e4,
|
|
7688
|
+
3e4,
|
|
7689
|
+
3e4
|
|
7690
|
+
];
|
|
7691
|
+
var RESTART_FINGERPRINTS = ["SqliteSettingsBackend not initialized", "provider not available"];
|
|
7692
|
+
/** Node / socket error codes of a connection that did not happen or broke. */
|
|
7693
|
+
var TRANSPORT_CODES = new Set([
|
|
7694
|
+
"ECONNREFUSED",
|
|
7695
|
+
"ECONNRESET",
|
|
7696
|
+
"ETIMEDOUT",
|
|
7697
|
+
"EPIPE",
|
|
7698
|
+
"EHOSTUNREACH",
|
|
7699
|
+
"ENETUNREACH"
|
|
7700
|
+
]);
|
|
7701
|
+
/** tRPC error codes that mean "the other side is not answering now", not "your call is wrong". */
|
|
7702
|
+
var UNAVAILABLE_TRPC_CODES = new Set([
|
|
7703
|
+
"TIMEOUT",
|
|
7704
|
+
"SERVICE_UNAVAILABLE",
|
|
7705
|
+
"BAD_GATEWAY",
|
|
7706
|
+
"GATEWAY_TIMEOUT"
|
|
7707
|
+
]);
|
|
7708
|
+
/** The exact phrases OUR transport raises when it cannot reach the hub. */
|
|
7709
|
+
var TRANSPORT_PHRASES = [
|
|
7710
|
+
"discovery deadline exceeded",
|
|
7711
|
+
"parent could not route child unowned cap call",
|
|
7712
|
+
"UDS request timed out after",
|
|
7713
|
+
"channel closed"
|
|
7714
|
+
];
|
|
7715
|
+
/** Moleculer error `type`s of a call that could not be served right now. */
|
|
7716
|
+
var MOLECULER_TRANSIENT_TYPES = new Set([
|
|
7717
|
+
"REQUEST_TIMEOUT",
|
|
7718
|
+
"SERVICE_NOT_FOUND",
|
|
7719
|
+
"SERVICE_NOT_AVAILABLE",
|
|
7720
|
+
"REQUEST_REJECTED",
|
|
7721
|
+
"BROKER_DISCONNECTED"
|
|
7722
|
+
]);
|
|
7723
|
+
function stringProp(value, key) {
|
|
7724
|
+
if (typeof value !== "object" || value === null) return void 0;
|
|
7725
|
+
const found = Reflect.get(value, key);
|
|
7726
|
+
return typeof found === "string" ? found : void 0;
|
|
7727
|
+
}
|
|
7728
|
+
/** The code an error carries: its own, its cause's, or a tRPC `data.code`. */
|
|
7729
|
+
function errorCode(err) {
|
|
7730
|
+
const out = {};
|
|
7731
|
+
const cause = typeof err === "object" && err !== null ? Reflect.get(err, "cause") : void 0;
|
|
7732
|
+
const data = typeof err === "object" && err !== null ? Reflect.get(err, "data") : void 0;
|
|
7733
|
+
const node = stringProp(err, "code") ?? stringProp(cause, "code");
|
|
7734
|
+
if (node !== void 0) out.node = node;
|
|
7735
|
+
const trpc = stringProp(data, "code");
|
|
7736
|
+
if (trpc !== void 0) out.trpc = trpc;
|
|
7737
|
+
return out;
|
|
7738
|
+
}
|
|
7739
|
+
/**
|
|
7740
|
+
* Is a settings read failure worth retrying, and with which budget? Only
|
|
7741
|
+
* EXPLICIT signals count: a socket error code, a tRPC "unavailable" code, or
|
|
7742
|
+
* one of the exact phrases our own transport raises. A message that merely
|
|
7743
|
+
* contains "timed out" or "unreachable" is not evidence of anything, and
|
|
7744
|
+
* `settings store not wired` is a wiring bug that retrying cannot fix.
|
|
7745
|
+
*/
|
|
7746
|
+
function classifyStoreError(err) {
|
|
7747
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
7748
|
+
if (RESTART_FINGERPRINTS.some((f) => message.includes(f))) return "restart";
|
|
7749
|
+
const code = errorCode(err);
|
|
7750
|
+
if (code.node !== void 0 && TRANSPORT_CODES.has(code.node)) return "transport";
|
|
7751
|
+
if (code.trpc !== void 0 && UNAVAILABLE_TRPC_CODES.has(code.trpc)) return "transport";
|
|
7752
|
+
if (typeof err === "object" && err !== null) {
|
|
7753
|
+
if (Reflect.get(err, "retryable") === true) return "transport";
|
|
7754
|
+
const type = stringProp(err, "type");
|
|
7755
|
+
if (type !== void 0 && MOLECULER_TRANSIENT_TYPES.has(type)) return "transport";
|
|
7756
|
+
}
|
|
7757
|
+
if (TRANSPORT_PHRASES.some((f) => message.includes(f))) return "transport";
|
|
7758
|
+
return "permanent";
|
|
7759
|
+
}
|
|
7650
7760
|
/**
|
|
7651
7761
|
* Collect the keys of every field marked `perNode: true`, recursing into
|
|
7652
7762
|
* layout containers (`group` fields and `sub-tabs` tabs) the same way
|
|
@@ -7736,6 +7846,156 @@ var PeerBytesTicketSchema = object({
|
|
|
7736
7846
|
*/
|
|
7737
7847
|
declaredBytes: number().int().nonnegative().nullable()
|
|
7738
7848
|
});
|
|
7849
|
+
/** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
|
|
7850
|
+
/** The files a kind may live in. `history` is device-history's (D850), never records. */
|
|
7851
|
+
var RECORD_DATABASES = ["settings", "events"];
|
|
7852
|
+
/** The classes of a kind: the `@durable` vocabulary, one authority (replaces the annotation). */
|
|
7853
|
+
var RECORD_CLASSES = [
|
|
7854
|
+
"config",
|
|
7855
|
+
"ledger",
|
|
7856
|
+
"audit",
|
|
7857
|
+
"mirror",
|
|
7858
|
+
"ephemeral"
|
|
7859
|
+
];
|
|
7860
|
+
var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
|
|
7861
|
+
var RECORD_MAX_DATA_BYTES = 1024 * 1024;
|
|
7862
|
+
var RECORD_BATCH_MAX = 1e3;
|
|
7863
|
+
var RECORD_QUERY_MAX = 1e3;
|
|
7864
|
+
function defOf(schema) {
|
|
7865
|
+
const zodBag = Reflect.get(schema, "_zod");
|
|
7866
|
+
if (typeof zodBag !== "object" || zodBag === null) return {};
|
|
7867
|
+
const def = Reflect.get(zodBag, "def");
|
|
7868
|
+
if (typeof def !== "object" || def === null) return {};
|
|
7869
|
+
return def;
|
|
7870
|
+
}
|
|
7871
|
+
function declaredHere(schema) {
|
|
7872
|
+
return globalRegistry.get(schema)?.secret === true;
|
|
7873
|
+
}
|
|
7874
|
+
/** Wrapper kinds whose `innerType` is the field itself. */
|
|
7875
|
+
var WRAPPERS = new Set([
|
|
7876
|
+
"optional",
|
|
7877
|
+
"nullable",
|
|
7878
|
+
"default",
|
|
7879
|
+
"prefault",
|
|
7880
|
+
"catch",
|
|
7881
|
+
"readonly",
|
|
7882
|
+
"nonoptional"
|
|
7883
|
+
]);
|
|
7884
|
+
/**
|
|
7885
|
+
* The schema layers that make up ONE field: the schema itself and every
|
|
7886
|
+
* wrapper below it (optional / default / nullable / readonly / catch), plus
|
|
7887
|
+
* both sides of a pipe (`z.preprocess` puts the real schema on `out`,
|
|
7888
|
+
* `.transform` on `in`).
|
|
7889
|
+
*/
|
|
7890
|
+
function layersOf(schema) {
|
|
7891
|
+
const out = [];
|
|
7892
|
+
const queue = [schema];
|
|
7893
|
+
while (queue.length > 0) {
|
|
7894
|
+
const s = queue.shift();
|
|
7895
|
+
if (!s || out.includes(s)) continue;
|
|
7896
|
+
out.push(s);
|
|
7897
|
+
const def = defOf(s);
|
|
7898
|
+
if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
|
|
7899
|
+
if (def.type === "pipe") {
|
|
7900
|
+
if (def.in) queue.push(def.in);
|
|
7901
|
+
if (def.out) queue.push(def.out);
|
|
7902
|
+
}
|
|
7903
|
+
}
|
|
7904
|
+
return out;
|
|
7905
|
+
}
|
|
7906
|
+
/** True when any layer of this field declares `.meta({ secret: true })`. */
|
|
7907
|
+
function isZodSecret(schema) {
|
|
7908
|
+
return layersOf(schema).some(declaredHere);
|
|
7909
|
+
}
|
|
7910
|
+
/**
|
|
7911
|
+
* Every declared secret path in a config schema: dotted keys, `[]` for "each
|
|
7912
|
+
* element of this array" (`connection.password`, `rows[].token`). A declared
|
|
7913
|
+
* object or array is reported as one path and not descended into — everything
|
|
7914
|
+
* under it is secret.
|
|
7915
|
+
*/
|
|
7916
|
+
function collectZodSecretPaths(schema, prefix = "") {
|
|
7917
|
+
if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
|
|
7918
|
+
const paths = [];
|
|
7919
|
+
for (const layer of layersOf(schema)) {
|
|
7920
|
+
const def = defOf(layer);
|
|
7921
|
+
if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
|
|
7922
|
+
else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
|
|
7923
|
+
else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
|
|
7924
|
+
else if (def.type === "intersection") {
|
|
7925
|
+
if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
|
|
7926
|
+
if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
|
|
7927
|
+
}
|
|
7928
|
+
}
|
|
7929
|
+
return [...new Set(paths)];
|
|
7930
|
+
}
|
|
7931
|
+
/**
|
|
7932
|
+
* Record kinds (D881): the declaration an addon makes of one kind of fact, the
|
|
7933
|
+
* Zod row schema that describes it, and the helper that turns the two into the
|
|
7934
|
+
* JSON the engine stores.
|
|
7935
|
+
*
|
|
7936
|
+
* A kind is declared ONCE, next to the code that owns it, and the engine's
|
|
7937
|
+
* reconciler creates its indexes - nothing creates DDL at runtime from a write.
|
|
7938
|
+
* Everything the generic machinery needs (secret fields, the entry descriptor)
|
|
7939
|
+
* is DERIVED from the Zod schema: `.meta({ secret: true })` marks a credential,
|
|
7940
|
+
* never a field name (D879).
|
|
7941
|
+
*/
|
|
7942
|
+
/** A JSON field path: `trackId`, `auth.accessToken`. Charset-restricted: it is rendered into DDL. */
|
|
7943
|
+
var RecordFieldPathSchema = string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}(\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,3}$/);
|
|
7944
|
+
var RecordIndexSchema = object({
|
|
7945
|
+
name: string().regex(/^[a-z][a-z0-9_]{0,31}$/),
|
|
7946
|
+
fields: array(RecordFieldPathSchema).min(1).max(4),
|
|
7947
|
+
unique: boolean().optional()
|
|
7948
|
+
}).strict();
|
|
7949
|
+
var RecordRetentionSchema = union([
|
|
7950
|
+
object({
|
|
7951
|
+
ttlMs: number().int().positive(),
|
|
7952
|
+
from: _enum(["at", "write"])
|
|
7953
|
+
}).strict(),
|
|
7954
|
+
object({
|
|
7955
|
+
maxRows: number().int().positive().optional(),
|
|
7956
|
+
maxRowsPerDevice: number().int().positive().optional()
|
|
7957
|
+
}).strict().refine((r) => r.maxRows !== void 0 || r.maxRowsPerDevice !== void 0, { message: "name maxRows, maxRowsPerDevice or both" }),
|
|
7958
|
+
object({
|
|
7959
|
+
owner: string().min(1),
|
|
7960
|
+
reason: string().min(1)
|
|
7961
|
+
}).strict(),
|
|
7962
|
+
object({ none: string().min(1) }).strict()
|
|
7963
|
+
]);
|
|
7964
|
+
/** The descriptor a generic entries UI reads (D881 "generic entries"). */
|
|
7965
|
+
var EntryDescriptorSchema = object({
|
|
7966
|
+
title: string().min(1),
|
|
7967
|
+
/** The record body field shown as the entry's name. */
|
|
7968
|
+
nameField: string().min(1),
|
|
7969
|
+
/** JSON Schema of the entry body; `secret: true` marks a password field. */
|
|
7970
|
+
fields: record(string(), unknown())
|
|
7971
|
+
}).strict();
|
|
7972
|
+
/** What crosses the wire and sits in the engine's catalog: JSON only, no Zod. */
|
|
7973
|
+
var RecordKindDeclarationSchema = object({
|
|
7974
|
+
database: _enum(RECORD_DATABASES).default("settings"),
|
|
7975
|
+
class: _enum(RECORD_CLASSES),
|
|
7976
|
+
writeTrigger: string().min(1),
|
|
7977
|
+
device: _enum([
|
|
7978
|
+
"required",
|
|
7979
|
+
"optional",
|
|
7980
|
+
"none"
|
|
7981
|
+
]).default("none"),
|
|
7982
|
+
at: _enum(["required", "none"]).default("none"),
|
|
7983
|
+
indexes: array(RecordIndexSchema).max(8).default([]),
|
|
7984
|
+
retention: RecordRetentionSchema,
|
|
7985
|
+
deviceRemoval: _enum(["delete", "none"]).default("none"),
|
|
7986
|
+
maxDataBytes: number().int().positive().max(RECORD_MAX_DATA_BYTES).default(RECORD_DEFAULT_MAX_DATA_BYTES),
|
|
7987
|
+
/** Derived from the Zod schema; never written by hand. */
|
|
7988
|
+
secretPaths: array(string().min(1)).default([]),
|
|
7989
|
+
/** The id key of each array that carries a secret (`{ headers: 'name' }`). */
|
|
7990
|
+
secretArrayKeys: record(string(), string()).default({}),
|
|
7991
|
+
/** The legacy table this kind adopts from; the boot guard reads it (D853: no migration code). */
|
|
7992
|
+
adoptsFrom: string().min(1).optional(),
|
|
7993
|
+
/** Kinds that must agree through `transact` sit in one file under one family name. */
|
|
7994
|
+
transactFamily: string().min(1).optional(),
|
|
7995
|
+
entry: EntryDescriptorSchema.optional()
|
|
7996
|
+
}).strict();
|
|
7997
|
+
/** The kind names: lower-case, dash separated, short enough for an index name. */
|
|
7998
|
+
var RecordKindNameSchema = string().regex(/^[a-z][a-z0-9-]{0,47}$/);
|
|
7739
7999
|
/** Shared Zod schemas used across streaming capabilities. */
|
|
7740
8000
|
var CamProfileSchema = _enum([
|
|
7741
8001
|
"high",
|
|
@@ -8234,69 +8494,6 @@ method(object({ deviceId: number() }), array(StreamSourceEntrySchema)), method(o
|
|
|
8234
8494
|
kind: "mutation",
|
|
8235
8495
|
auth: "admin"
|
|
8236
8496
|
}), method(object({ deviceId: number() }), unknown().nullable()), method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" });
|
|
8237
|
-
function defOf(schema) {
|
|
8238
|
-
return schema._zod?.def ?? {};
|
|
8239
|
-
}
|
|
8240
|
-
function declaredHere(schema) {
|
|
8241
|
-
return globalRegistry.get(schema)?.secret === true;
|
|
8242
|
-
}
|
|
8243
|
-
/** Wrapper kinds whose `innerType` is the field itself. */
|
|
8244
|
-
var WRAPPERS = new Set([
|
|
8245
|
-
"optional",
|
|
8246
|
-
"nullable",
|
|
8247
|
-
"default",
|
|
8248
|
-
"prefault",
|
|
8249
|
-
"catch",
|
|
8250
|
-
"readonly",
|
|
8251
|
-
"nonoptional"
|
|
8252
|
-
]);
|
|
8253
|
-
/**
|
|
8254
|
-
* The schema layers that make up ONE field: the schema itself and every
|
|
8255
|
-
* wrapper below it (optional / default / nullable / readonly / catch), plus
|
|
8256
|
-
* both sides of a pipe (`z.preprocess` puts the real schema on `out`,
|
|
8257
|
-
* `.transform` on `in`).
|
|
8258
|
-
*/
|
|
8259
|
-
function layersOf(schema) {
|
|
8260
|
-
const out = [];
|
|
8261
|
-
const queue = [schema];
|
|
8262
|
-
while (queue.length > 0) {
|
|
8263
|
-
const s = queue.shift();
|
|
8264
|
-
if (!s || out.includes(s)) continue;
|
|
8265
|
-
out.push(s);
|
|
8266
|
-
const def = defOf(s);
|
|
8267
|
-
if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
|
|
8268
|
-
if (def.type === "pipe") {
|
|
8269
|
-
if (def.in) queue.push(def.in);
|
|
8270
|
-
if (def.out) queue.push(def.out);
|
|
8271
|
-
}
|
|
8272
|
-
}
|
|
8273
|
-
return out;
|
|
8274
|
-
}
|
|
8275
|
-
/** True when any layer of this field declares `.meta({ secret: true })`. */
|
|
8276
|
-
function isZodSecret(schema) {
|
|
8277
|
-
return layersOf(schema).some(declaredHere);
|
|
8278
|
-
}
|
|
8279
|
-
/**
|
|
8280
|
-
* Every declared secret path in a config schema: dotted keys, `[]` for "each
|
|
8281
|
-
* element of this array" (`connection.password`, `rows[].token`). A declared
|
|
8282
|
-
* object or array is reported as one path and not descended into — everything
|
|
8283
|
-
* under it is secret.
|
|
8284
|
-
*/
|
|
8285
|
-
function collectZodSecretPaths(schema, prefix = "") {
|
|
8286
|
-
if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
|
|
8287
|
-
const paths = [];
|
|
8288
|
-
for (const layer of layersOf(schema)) {
|
|
8289
|
-
const def = defOf(layer);
|
|
8290
|
-
if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
|
|
8291
|
-
else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
|
|
8292
|
-
else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
|
|
8293
|
-
else if (def.type === "intersection") {
|
|
8294
|
-
if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
|
|
8295
|
-
if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
|
|
8296
|
-
}
|
|
8297
|
-
}
|
|
8298
|
-
return [...new Set(paths)];
|
|
8299
|
-
}
|
|
8300
8497
|
object({
|
|
8301
8498
|
code: string().regex(/^[a-z][a-z0-9-]*(\.[a-z0-9-]+)+$/),
|
|
8302
8499
|
params: record(string(), union([string(), number()])).optional()
|
|
@@ -8340,7 +8537,7 @@ function sleep$2(ms) {
|
|
|
8340
8537
|
return new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)));
|
|
8341
8538
|
}
|
|
8342
8539
|
//#endregion
|
|
8343
|
-
//#region ../types/dist/err-msg
|
|
8540
|
+
//#region ../types/dist/err-msg--2RrYiLO.mjs
|
|
8344
8541
|
var DeviceType = /* @__PURE__ */ function(DeviceType) {
|
|
8345
8542
|
DeviceType["Camera"] = "camera";
|
|
8346
8543
|
DeviceType["Hub"] = "hub";
|
|
@@ -8609,6 +8806,9 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
|
|
|
8609
8806
|
/** Virtual HA toggle (input_boolean.*) — distinguishable from a
|
|
8610
8807
|
* real Switch device for UI rendering / export adapters. */
|
|
8611
8808
|
DeviceRole["BinaryHelper"] = "binary-helper";
|
|
8809
|
+
/** A smart plug: a `switch` whose source says it is an outlet (HA
|
|
8810
|
+
* `device_class: outlet`). The Alexa export shows it as a SMARTPLUG. */
|
|
8811
|
+
DeviceRole["Outlet"] = "outlet";
|
|
8612
8812
|
/** Generic motion / occupancy / moving event source. Distinct from
|
|
8613
8813
|
* the camera accessory PirSensor role: that one is a camera child;
|
|
8614
8814
|
* this is a standalone HA / 3rd-party motion sensor. */
|
|
@@ -8676,7 +8876,7 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
|
|
|
8676
8876
|
return DeviceRole;
|
|
8677
8877
|
}({});
|
|
8678
8878
|
//#endregion
|
|
8679
|
-
//#region ../types/dist/composition-
|
|
8879
|
+
//#region ../types/dist/composition-DOwQB_Ua.mjs
|
|
8680
8880
|
/**
|
|
8681
8881
|
* The ffmpeg build every CamStack node downloads, per platform and arch.
|
|
8682
8882
|
*
|
|
@@ -12432,11 +12632,10 @@ var ClipModelMetaSchema = object({
|
|
|
12432
12632
|
/**
|
|
12433
12633
|
* The `vector-store` index this model's vectors live in. ONE feature space
|
|
12434
12634
|
* per index: two models share an index only when their vectors are ranked
|
|
12435
|
-
* against each other, which for CLIP means never across families.
|
|
12436
|
-
*
|
|
12437
|
-
* `modelId`); any other model gets its own.
|
|
12635
|
+
* against each other, which for CLIP means never across families. Every
|
|
12636
|
+
* model gets its own.
|
|
12438
12637
|
*/
|
|
12439
|
-
vectorIndex: string().regex(/^object-clip
|
|
12638
|
+
vectorIndex: string().regex(/^object-clip-[a-z0-9][a-z0-9-]*$/),
|
|
12440
12639
|
/**
|
|
12441
12640
|
* The text encoder's tokenizer, a declared SIBLING file of its onnx. The name
|
|
12442
12641
|
* must be unique per tokenizer: every model's siblings land in ONE flat
|
|
@@ -16169,6 +16368,41 @@ var ComposableCapabilitiesSchema = object({ caps: array(object({
|
|
|
16169
16368
|
keyField: string()
|
|
16170
16369
|
}).optional()
|
|
16171
16370
|
})) });
|
|
16371
|
+
/**
|
|
16372
|
+
* The report of a one-shot "move this owner's plaintext secrets into the
|
|
16373
|
+
* keychain" run (D878). COUNTS only - never a value, never a ref.
|
|
16374
|
+
*
|
|
16375
|
+
* The owner runs it on its own rows, through its own write path; an operator
|
|
16376
|
+
* script (`scripts/hub/migrate-raw-secrets.ts`) calls the owner's cap method.
|
|
16377
|
+
* Dry run (`apply: false`) reports what WOULD move and changes nothing.
|
|
16378
|
+
*/
|
|
16379
|
+
var RawSecretMigrationInputSchema = object({
|
|
16380
|
+
/** `false` (the default of the script) = report only. */
|
|
16381
|
+
apply: boolean() });
|
|
16382
|
+
var RawSecretMigrationReportSchema = object({
|
|
16383
|
+
apply: boolean(),
|
|
16384
|
+
/** Rows that can carry a secret (a profile, an enrolment). */
|
|
16385
|
+
rows: number().int(),
|
|
16386
|
+
/** Rows whose secret was plaintext when the run started. */
|
|
16387
|
+
raw: number().int(),
|
|
16388
|
+
/** Rows that already held a keychain marker when the run started. */
|
|
16389
|
+
markers: number().int(),
|
|
16390
|
+
/** Plaintext rows moved by THIS run (always 0 on a dry run). */
|
|
16391
|
+
migrated: number().int(),
|
|
16392
|
+
/** Plaintext rows left in place because the move or its read-back failed. */
|
|
16393
|
+
failed: number().int(),
|
|
16394
|
+
/** After the run: rows still holding plaintext. */
|
|
16395
|
+
remainingRaw: number().int(),
|
|
16396
|
+
/** After the run: markers the keychain could not resolve right now. */
|
|
16397
|
+
unresolvedMarkers: number().int(),
|
|
16398
|
+
/**
|
|
16399
|
+
* A second, redundant copy of the secrets' rows that the run found (and, on
|
|
16400
|
+
* `apply`, deleted after verifying the first). Owners with a single copy omit it.
|
|
16401
|
+
*/
|
|
16402
|
+
redundantCopies: number().int().optional(),
|
|
16403
|
+
/** True when nothing is raw and every marker resolves. */
|
|
16404
|
+
verified: boolean()
|
|
16405
|
+
});
|
|
16172
16406
|
/** Where a block runs. The operator chooses — a block driving a device on an
|
|
16173
16407
|
* agent is the reason placement is not fixed to the hub. */
|
|
16174
16408
|
var CoreBlockPlacementSchema = union([literal("hub"), string().min(1)]);
|
|
@@ -16395,6 +16629,9 @@ method(object({}), object({ blocks: array(CoreBlockSchema) }), { auth: "admin" }
|
|
|
16395
16629
|
}), SettingsUpdateResultSchema, {
|
|
16396
16630
|
kind: "mutation",
|
|
16397
16631
|
auth: "admin"
|
|
16632
|
+
}), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
|
|
16633
|
+
kind: "mutation",
|
|
16634
|
+
auth: "admin"
|
|
16398
16635
|
}), method(object({}), object({ libs: array(object({
|
|
16399
16636
|
filePath: string(),
|
|
16400
16637
|
content: string()
|
|
@@ -16658,6 +16895,347 @@ id: union([string(), number()]) }), {
|
|
|
16658
16895
|
auth: "admin"
|
|
16659
16896
|
});
|
|
16660
16897
|
/**
|
|
16898
|
+
* records - an addon's own facts and documents (D881): ledgers, audit rows,
|
|
16899
|
+
* config documents, mirrors. The third storage API next to `ctx.settings`
|
|
16900
|
+
* (operator intent, D870) and device-history (numbers over time, D850).
|
|
16901
|
+
*
|
|
16902
|
+
* Who the OWNER is: `callerAddonId`, stamped by the transport on a call that
|
|
16903
|
+
* crossed a process and stated by a hub in-process caller (`ctx.records` does
|
|
16904
|
+
* that with the addon id closed over). It is deliberately NOT in any input
|
|
16905
|
+
* schema, so a session can never supply it, and a call with no stamp is refused
|
|
16906
|
+
* `records/no-caller`. A kind is readable and writable only by its owner; other
|
|
16907
|
+
* addons go through the owner's capability.
|
|
16908
|
+
*
|
|
16909
|
+
* Every read is three-way: a row, `null`, or the call THROWS. A failed read is
|
|
16910
|
+
* never `[]`. Secret fields are never on the wire: a read shows the
|
|
16911
|
+
* redaction token, `secretRefs` hands the owner's `ctx.secrets` the refs it
|
|
16912
|
+
* resolves itself, and a write may carry only a keychain marker bound to the
|
|
16913
|
+
* row's own ref.
|
|
16914
|
+
*
|
|
16915
|
+
* Internal: addons reach it through `ctx.records`, never directly.
|
|
16916
|
+
*/
|
|
16917
|
+
var RecordIdSchema = string().min(1).max(256);
|
|
16918
|
+
/** A JSON object body. Size is the engine's check (`maxDataBytes`), not a schema's. */
|
|
16919
|
+
var RecordBodySchema = record(string(), unknown());
|
|
16920
|
+
var RecordInputSchema = object({
|
|
16921
|
+
id: RecordIdSchema,
|
|
16922
|
+
/** The device this row belongs to (D865 removal, per-device reads). */
|
|
16923
|
+
deviceId: number().int().optional(),
|
|
16924
|
+
/** The domain clock, ms: observed / created / opened. */
|
|
16925
|
+
at: number().int().optional(),
|
|
16926
|
+
/** Producer-set expiry, ms. Refused on a kind whose retention is an engine TTL. */
|
|
16927
|
+
expiresAt: number().int().optional(),
|
|
16928
|
+
data: RecordBodySchema
|
|
16929
|
+
});
|
|
16930
|
+
var RecordViewSchema = object({
|
|
16931
|
+
id: string(),
|
|
16932
|
+
deviceId: number().int().nullable(),
|
|
16933
|
+
at: number().nullable(),
|
|
16934
|
+
expiresAt: number().nullable(),
|
|
16935
|
+
rev: number().int(),
|
|
16936
|
+
updatedAt: number(),
|
|
16937
|
+
data: RecordBodySchema
|
|
16938
|
+
});
|
|
16939
|
+
/** Declared index fields only. Anything else does not compile, by design. */
|
|
16940
|
+
var RecordWhereSchema = record(RecordFieldPathSchema, union([
|
|
16941
|
+
string(),
|
|
16942
|
+
number(),
|
|
16943
|
+
boolean(),
|
|
16944
|
+
object({ in: array(union([
|
|
16945
|
+
string(),
|
|
16946
|
+
number(),
|
|
16947
|
+
boolean()
|
|
16948
|
+
])).min(1).max(RECORD_BATCH_MAX) }),
|
|
16949
|
+
object({
|
|
16950
|
+
gt: union([string(), number()]).optional(),
|
|
16951
|
+
gte: union([string(), number()]).optional(),
|
|
16952
|
+
lt: union([string(), number()]).optional(),
|
|
16953
|
+
lte: union([string(), number()]).optional()
|
|
16954
|
+
}).refine((r) => Object.keys(r).length > 0, { message: "name at least one bound" })
|
|
16955
|
+
]));
|
|
16956
|
+
var KindShape = { kind: RecordKindNameSchema };
|
|
16957
|
+
var TimeWindowShape = {
|
|
16958
|
+
deviceId: number().int().optional(),
|
|
16959
|
+
atFrom: number().optional(),
|
|
16960
|
+
atTo: number().optional()
|
|
16961
|
+
};
|
|
16962
|
+
var RecordQueryInputSchema = object({
|
|
16963
|
+
...KindShape,
|
|
16964
|
+
...TimeWindowShape,
|
|
16965
|
+
where: RecordWhereSchema.optional(),
|
|
16966
|
+
/** Without `where`: `at` (default for a kind with a clock) or `id`. With `where` the order is the index's. */
|
|
16967
|
+
order: _enum(["at", "id"]).optional(),
|
|
16968
|
+
desc: boolean().optional(),
|
|
16969
|
+
limit: number().int().min(1).max(RECORD_QUERY_MAX).default(100),
|
|
16970
|
+
/** Opaque keyset cursor from a previous answer. There is no offset. */
|
|
16971
|
+
cursor: string().min(1).optional()
|
|
16972
|
+
});
|
|
16973
|
+
var RecordQueryResultSchema = object({
|
|
16974
|
+
records: array(RecordViewSchema),
|
|
16975
|
+
nextCursor: string().nullable()
|
|
16976
|
+
});
|
|
16977
|
+
var RecordKindStateSchema = _enum([
|
|
16978
|
+
"created",
|
|
16979
|
+
"unchanged",
|
|
16980
|
+
"updated"
|
|
16981
|
+
]);
|
|
16982
|
+
var DeclareKindResultSchema = object({
|
|
16983
|
+
kindId: number().int(),
|
|
16984
|
+
state: RecordKindStateSchema,
|
|
16985
|
+
createdIndexes: array(string()),
|
|
16986
|
+
/** The boot guard: the kind is empty while its legacy table still holds rows. */
|
|
16987
|
+
adoptionPending: object({
|
|
16988
|
+
legacyTable: string(),
|
|
16989
|
+
legacyRows: number().int()
|
|
16990
|
+
}).nullable()
|
|
16991
|
+
});
|
|
16992
|
+
/** Keychain refs a write released (the old marker is gone from the row): the owner deletes the values. */
|
|
16993
|
+
var SecretRefsList = array(string());
|
|
16994
|
+
var RecordSecretRefsSchema = record(string(), record(string(), string()));
|
|
16995
|
+
method(object({ kinds: record(RecordKindNameSchema, RecordKindDeclarationSchema) }), object({ kinds: record(string(), DeclareKindResultSchema) }), {
|
|
16996
|
+
kind: "mutation",
|
|
16997
|
+
auth: "admin"
|
|
16998
|
+
}), method(object({
|
|
16999
|
+
...KindShape,
|
|
17000
|
+
id: RecordIdSchema
|
|
17001
|
+
}), RecordViewSchema.nullable(), { auth: "admin" }), method(object({
|
|
17002
|
+
...KindShape,
|
|
17003
|
+
ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
|
|
17004
|
+
}), array(RecordViewSchema), { auth: "admin" }), method(object({
|
|
17005
|
+
...KindShape,
|
|
17006
|
+
ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
|
|
17007
|
+
}), RecordSecretRefsSchema, { auth: "admin" }), method(object({
|
|
17008
|
+
...KindShape,
|
|
17009
|
+
record: RecordInputSchema,
|
|
17010
|
+
/** Compare-and-set. `0` means "the row must not exist". */
|
|
17011
|
+
ifRev: number().int().min(0).optional()
|
|
17012
|
+
}), object({
|
|
17013
|
+
rev: number().int(),
|
|
17014
|
+
releasedRefs: SecretRefsList
|
|
17015
|
+
}), {
|
|
17016
|
+
kind: "mutation",
|
|
17017
|
+
auth: "admin"
|
|
17018
|
+
}), method(object({
|
|
17019
|
+
...KindShape,
|
|
17020
|
+
records: array(RecordInputSchema).min(1).max(RECORD_BATCH_MAX)
|
|
17021
|
+
}), object({
|
|
17022
|
+
count: number().int(),
|
|
17023
|
+
releasedRefs: SecretRefsList
|
|
17024
|
+
}), {
|
|
17025
|
+
kind: "mutation",
|
|
17026
|
+
auth: "admin"
|
|
17027
|
+
}), method(object({
|
|
17028
|
+
...KindShape,
|
|
17029
|
+
id: RecordIdSchema,
|
|
17030
|
+
data: RecordBodySchema,
|
|
17031
|
+
at: number().int().nullable().optional(),
|
|
17032
|
+
expiresAt: number().int().nullable().optional(),
|
|
17033
|
+
ifRev: number().int().min(1).optional()
|
|
17034
|
+
}), object({
|
|
17035
|
+
rev: number().int(),
|
|
17036
|
+
releasedRefs: SecretRefsList
|
|
17037
|
+
}), {
|
|
17038
|
+
kind: "mutation",
|
|
17039
|
+
auth: "admin"
|
|
17040
|
+
}), method(object({
|
|
17041
|
+
...KindShape,
|
|
17042
|
+
id: RecordIdSchema
|
|
17043
|
+
}), object({
|
|
17044
|
+
deleted: boolean(),
|
|
17045
|
+
secretRefs: SecretRefsList
|
|
17046
|
+
}), {
|
|
17047
|
+
kind: "mutation",
|
|
17048
|
+
auth: "admin"
|
|
17049
|
+
}), method(object({
|
|
17050
|
+
...KindShape,
|
|
17051
|
+
ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
|
|
17052
|
+
}), object({
|
|
17053
|
+
deleted: number().int(),
|
|
17054
|
+
secretRefs: SecretRefsList
|
|
17055
|
+
}), {
|
|
17056
|
+
kind: "mutation",
|
|
17057
|
+
auth: "admin"
|
|
17058
|
+
}), method(RecordQueryInputSchema, RecordQueryResultSchema, { auth: "admin" }), method(object({
|
|
17059
|
+
...KindShape,
|
|
17060
|
+
...TimeWindowShape,
|
|
17061
|
+
where: RecordWhereSchema.optional()
|
|
17062
|
+
}), object({ count: number().int() }), { auth: "admin" }), method(object({
|
|
17063
|
+
...KindShape,
|
|
17064
|
+
deviceId: number().int().optional(),
|
|
17065
|
+
from: number(),
|
|
17066
|
+
to: number(),
|
|
17067
|
+
bucketMs: number().int().positive()
|
|
17068
|
+
}), object({ buckets: array(object({
|
|
17069
|
+
bucketStart: number(),
|
|
17070
|
+
count: number().int()
|
|
17071
|
+
})) }), { auth: "admin" }), method(object({
|
|
17072
|
+
...KindShape,
|
|
17073
|
+
op: _enum([
|
|
17074
|
+
"sum",
|
|
17075
|
+
"min",
|
|
17076
|
+
"max",
|
|
17077
|
+
"count"
|
|
17078
|
+
]),
|
|
17079
|
+
field: RecordFieldPathSchema.optional(),
|
|
17080
|
+
groupBy: RecordFieldPathSchema.optional(),
|
|
17081
|
+
where: RecordWhereSchema.optional()
|
|
17082
|
+
}), object({ rows: array(object({
|
|
17083
|
+
group: union([
|
|
17084
|
+
string(),
|
|
17085
|
+
number(),
|
|
17086
|
+
_null()
|
|
17087
|
+
]),
|
|
17088
|
+
value: number().nullable()
|
|
17089
|
+
})) }), { auth: "admin" }), method(object({
|
|
17090
|
+
...KindShape,
|
|
17091
|
+
deviceId: number().int().optional(),
|
|
17092
|
+
atBefore: number().optional(),
|
|
17093
|
+
where: RecordWhereSchema.optional()
|
|
17094
|
+
}), object({
|
|
17095
|
+
deleted: number().int(),
|
|
17096
|
+
secretRefs: SecretRefsList
|
|
17097
|
+
}), {
|
|
17098
|
+
kind: "mutation",
|
|
17099
|
+
auth: "admin"
|
|
17100
|
+
}), method(object({
|
|
17101
|
+
deviceId: number().int(),
|
|
17102
|
+
kinds: array(RecordKindNameSchema).optional()
|
|
17103
|
+
}), object({
|
|
17104
|
+
deleted: record(string(), number().int()),
|
|
17105
|
+
secretRefs: SecretRefsList
|
|
17106
|
+
}), {
|
|
17107
|
+
kind: "mutation",
|
|
17108
|
+
auth: "admin"
|
|
17109
|
+
}), method(object(KindShape), object({ id: number().int() }), {
|
|
17110
|
+
kind: "mutation",
|
|
17111
|
+
auth: "admin"
|
|
17112
|
+
});
|
|
17113
|
+
/** One table of the settings database. */
|
|
17114
|
+
var StorageTableSchema = object({
|
|
17115
|
+
/** The table's full name, e.g. `recorder:addon-settings` or `addon-device-settings`. */
|
|
17116
|
+
name: string(),
|
|
17117
|
+
/** The owner prefix of a scoped name (`recorder` for `recorder:addon-settings`), else null. */
|
|
17118
|
+
owner: string().nullable(),
|
|
17119
|
+
rows: number().int().nonnegative(),
|
|
17120
|
+
/** Bytes the table's pages occupy (`dbstat`); null when the engine cannot measure. */
|
|
17121
|
+
bytes: number().int().nonnegative().nullable(),
|
|
17122
|
+
/** Declared by an addon since this engine process started (a running addon claims it). */
|
|
17123
|
+
declaredThisBoot: boolean()
|
|
17124
|
+
});
|
|
17125
|
+
/** One declared record kind (D881) as System -> Data shows it. */
|
|
17126
|
+
var StorageKindSchema = object({
|
|
17127
|
+
owner: string(),
|
|
17128
|
+
kind: string(),
|
|
17129
|
+
database: _enum(["settings", "events"]),
|
|
17130
|
+
class: string(),
|
|
17131
|
+
state: _enum([
|
|
17132
|
+
"declared",
|
|
17133
|
+
"orphaned",
|
|
17134
|
+
"dropped"
|
|
17135
|
+
]),
|
|
17136
|
+
/** `null` when the caller asked for no counts (`counts: false`). */
|
|
17137
|
+
rows: number().int().nonnegative().nullable(),
|
|
17138
|
+
/** Rows x the average size of a sample; null for an empty kind. */
|
|
17139
|
+
bytesEstimate: number().int().nonnegative().nullable(),
|
|
17140
|
+
writeTrigger: string(),
|
|
17141
|
+
retention: RecordRetentionSchema,
|
|
17142
|
+
/** `true` when the kind is an entry kind (the generic entries UI lists it). */
|
|
17143
|
+
entry: boolean(),
|
|
17144
|
+
/** The whole declaration, secret paths and entry descriptor included (the entries service builds its handle from it). */
|
|
17145
|
+
declaration: RecordKindDeclarationSchema
|
|
17146
|
+
});
|
|
17147
|
+
method(object({ ownerPrefix: string().min(1).optional() }), object({ tables: array(StorageTableSchema) }), { auth: "admin" }), method(object({
|
|
17148
|
+
collection: string().min(1),
|
|
17149
|
+
expectRows: number().int().nonnegative()
|
|
17150
|
+
}), object({
|
|
17151
|
+
dropped: literal(true),
|
|
17152
|
+
rows: number().int().nonnegative()
|
|
17153
|
+
}), {
|
|
17154
|
+
kind: "mutation",
|
|
17155
|
+
auth: "admin"
|
|
17156
|
+
}), method(object({
|
|
17157
|
+
owner: string().min(1).optional(),
|
|
17158
|
+
/** `false` skips the per-kind row count (a catalog read only). Default true. */
|
|
17159
|
+
counts: boolean().optional()
|
|
17160
|
+
}), object({ kinds: array(StorageKindSchema) }), { auth: "admin" }), method(RecordQueryInputSchema.extend({
|
|
17161
|
+
owner: string().min(1),
|
|
17162
|
+
kind: RecordKindNameSchema
|
|
17163
|
+
}), RecordQueryResultSchema, { auth: "admin" }), method(object({
|
|
17164
|
+
owner: string().min(1),
|
|
17165
|
+
kind: RecordKindNameSchema,
|
|
17166
|
+
records: array(RecordInputSchema).max(RECORD_BATCH_MAX),
|
|
17167
|
+
/** The LAST batch: the copy is complete, the boot guard stops asking. */
|
|
17168
|
+
complete: boolean().optional()
|
|
17169
|
+
}).refine((input) => input.records.length > 0 || input.complete === true, { message: "records must be non-empty unless complete is true" }), object({ adopted: number().int() }), {
|
|
17170
|
+
kind: "mutation",
|
|
17171
|
+
auth: "admin"
|
|
17172
|
+
}), method(object({
|
|
17173
|
+
collection: string().min(1),
|
|
17174
|
+
cursor: string().optional(),
|
|
17175
|
+
limit: number().int().min(1).max(1e3).optional()
|
|
17176
|
+
}), object({
|
|
17177
|
+
rows: array(object({
|
|
17178
|
+
id: string(),
|
|
17179
|
+
data: record(string(), unknown())
|
|
17180
|
+
})),
|
|
17181
|
+
nextCursor: string().nullable()
|
|
17182
|
+
}), { auth: "admin" }), method(object({ collection: string().min(1) }), object({ adopted: boolean() }), { auth: "admin" });
|
|
17183
|
+
/**
|
|
17184
|
+
* record-entries - the ONE admin surface for every list of user-created entries
|
|
17185
|
+
* (D881): notification targets, brokers, LLM profiles, anything an addon
|
|
17186
|
+
* declares as an ENTRY kind (`entry: { title }` in `defineRecordKinds`).
|
|
17187
|
+
*
|
|
17188
|
+
* The UI is generic. `listEntryKinds` hands it, per kind, the JSON Schema of
|
|
17189
|
+
* the entry body with `secret: true` on every credential field, so a password
|
|
17190
|
+
* field is derived from the schema and never from a name. `putEntry` takes the
|
|
17191
|
+
* redaction token for an untouched secret (the stored value is kept), a string
|
|
17192
|
+
* for a new one, and the clear instruction to remove one. A read never carries
|
|
17193
|
+
* a secret value, and a locked keychain refuses the write with
|
|
17194
|
+
* `records/secret-unavailable` instead of storing plaintext.
|
|
17195
|
+
*
|
|
17196
|
+
* Hub-only, served in-process (it acts for each entry's owner on the keychain).
|
|
17197
|
+
*/
|
|
17198
|
+
var EntryKindInfoSchema = object({
|
|
17199
|
+
owner: string(),
|
|
17200
|
+
kind: RecordKindNameSchema,
|
|
17201
|
+
title: string(),
|
|
17202
|
+
nameField: string(),
|
|
17203
|
+
/** JSON Schema of the body; `secret: true` marks a password field. */
|
|
17204
|
+
fields: record(string(), unknown()),
|
|
17205
|
+
secretPaths: array(string()),
|
|
17206
|
+
rows: number().int().nonnegative()
|
|
17207
|
+
});
|
|
17208
|
+
var EntryViewSchema = object({
|
|
17209
|
+
id: RecordIdSchema,
|
|
17210
|
+
name: string(),
|
|
17211
|
+
rev: number().int(),
|
|
17212
|
+
updatedAt: number(),
|
|
17213
|
+
/** Secret fields hold the redaction token. */
|
|
17214
|
+
data: RecordBodySchema
|
|
17215
|
+
});
|
|
17216
|
+
var EntryAddress = {
|
|
17217
|
+
owner: string().min(1),
|
|
17218
|
+
kind: RecordKindNameSchema
|
|
17219
|
+
};
|
|
17220
|
+
method(object({}), object({ kinds: array(EntryKindInfoSchema) }), { auth: "admin" }), method(object({ ...EntryAddress }), object({ entries: array(EntryViewSchema) }), { auth: "admin" }), method(object({
|
|
17221
|
+
...EntryAddress,
|
|
17222
|
+
id: RecordIdSchema.optional(),
|
|
17223
|
+
data: RecordBodySchema,
|
|
17224
|
+
ifRev: number().int().min(1).optional()
|
|
17225
|
+
}), object({
|
|
17226
|
+
id: string(),
|
|
17227
|
+
rev: number().int()
|
|
17228
|
+
}), {
|
|
17229
|
+
kind: "mutation",
|
|
17230
|
+
auth: "admin"
|
|
17231
|
+
}), method(object({
|
|
17232
|
+
...EntryAddress,
|
|
17233
|
+
id: RecordIdSchema
|
|
17234
|
+
}), object({ deleted: boolean() }), {
|
|
17235
|
+
kind: "mutation",
|
|
17236
|
+
auth: "admin"
|
|
17237
|
+
});
|
|
17238
|
+
/**
|
|
16661
17239
|
* `keychain` — the hub's encrypted store of secret values (D787).
|
|
16662
17240
|
*
|
|
16663
17241
|
* Settings blobs never hold a secret: they hold a marker
|
|
@@ -17198,6 +17776,16 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
|
|
|
17198
17776
|
kind: "mutation",
|
|
17199
17777
|
auth: "admin",
|
|
17200
17778
|
caller: "required"
|
|
17779
|
+
}), method(object({
|
|
17780
|
+
ref: string().min(1),
|
|
17781
|
+
value: string().min(1)
|
|
17782
|
+
}), object({
|
|
17783
|
+
ref: string(),
|
|
17784
|
+
version: number().int()
|
|
17785
|
+
}), {
|
|
17786
|
+
kind: "mutation",
|
|
17787
|
+
auth: "admin",
|
|
17788
|
+
caller: "required"
|
|
17201
17789
|
}), method(object({ refs: array(string().min(1)).max(1e3) }), object({
|
|
17202
17790
|
deleted: array(string()).readonly(),
|
|
17203
17791
|
kept: array(object({
|
|
@@ -39991,6 +40579,9 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
|
|
|
39991
40579
|
}), _void(), { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
|
|
39992
40580
|
kind: "mutation",
|
|
39993
40581
|
auth: "admin"
|
|
40582
|
+
}), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
|
|
40583
|
+
kind: "mutation",
|
|
40584
|
+
auth: "admin"
|
|
39994
40585
|
}), method(ProfileRefInputSchema, _void(), {
|
|
39995
40586
|
kind: "mutation",
|
|
39996
40587
|
auth: "admin"
|
|
@@ -50521,6 +51112,41 @@ var ServerRollbackInfoSchema = object({
|
|
|
50521
51112
|
atMs: number(),
|
|
50522
51113
|
reason: string()
|
|
50523
51114
|
});
|
|
51115
|
+
/**
|
|
51116
|
+
* The runner boot check (D877): the runners this node PLANNED (hub: one per
|
|
51117
|
+
* `resolveRunnerId` over its forked addons; agent: the runners its process
|
|
51118
|
+
* service holds, because only the hub plans) against the states the process
|
|
51119
|
+
* service reports. Kept in memory, recomputed by the same one-shot check after
|
|
51120
|
+
* every boot, served on `getServerPackageStatus`.
|
|
51121
|
+
*
|
|
51122
|
+
* `failed` is the D6 breaker's terminal state, `refused` a deterministic Init
|
|
51123
|
+
* refusal (an addon that said "I will not start, and here is why"), `missing` a
|
|
51124
|
+
* planned runner the process service has no entry for.
|
|
51125
|
+
*/
|
|
51126
|
+
var RunnerRefusalSchema = object({
|
|
51127
|
+
runnerId: string(),
|
|
51128
|
+
addonIds: array(string()),
|
|
51129
|
+
reason: string()
|
|
51130
|
+
});
|
|
51131
|
+
var RunnerBootCheckSchema = object({
|
|
51132
|
+
checkedAtMs: number(),
|
|
51133
|
+
/** Runners planned for this node. */
|
|
51134
|
+
expected: number(),
|
|
51135
|
+
/** Planned runners whose process is `running`. */
|
|
51136
|
+
running: number(),
|
|
51137
|
+
failed: array(string()),
|
|
51138
|
+
refused: array(RunnerRefusalSchema),
|
|
51139
|
+
missing: array(string()),
|
|
51140
|
+
/**
|
|
51141
|
+
* Runners still on their way: `starting`, or `crashed` waiting on a backoff
|
|
51142
|
+
* respawn. The check is FINAL only when this is empty; until then nothing is
|
|
51143
|
+
* pushed and the verdict is re-evaluated on the next runner state change.
|
|
51144
|
+
* Optional for version skew (absent = settled).
|
|
51145
|
+
*/
|
|
51146
|
+
pending: array(string()).optional(),
|
|
51147
|
+
/** True when the plan is the hub's (`missing` is then meaningful); false on an agent. */
|
|
51148
|
+
planKnown: boolean()
|
|
51149
|
+
});
|
|
50524
51150
|
var ServerPackageStatusSchema = object({
|
|
50525
51151
|
/** Root package name (`@camstack/server` on the hub). */
|
|
50526
51152
|
packageName: string(),
|
|
@@ -50583,7 +51209,14 @@ var ServerPackageStatusSchema = object({
|
|
|
50583
51209
|
* for version skew: an older provider's payload simply omits it, and an
|
|
50584
51210
|
* absent wrapper is unknown — never `native`.
|
|
50585
51211
|
*/
|
|
50586
|
-
wrapper: WrapperIdentitySchema.optional()
|
|
51212
|
+
wrapper: WrapperIdentitySchema.optional(),
|
|
51213
|
+
/**
|
|
51214
|
+
* What this node PLANNED to run against what its process service reports
|
|
51215
|
+
* (D877). Absent until the one-shot boot check has run (~60 s after boot) and
|
|
51216
|
+
* on a provider that predates it. Absent is "not checked yet", never "all
|
|
51217
|
+
* well": a consumer that needs the answer treats it as pending.
|
|
51218
|
+
*/
|
|
51219
|
+
runners: RunnerBootCheckSchema.optional()
|
|
50587
51220
|
});
|
|
50588
51221
|
var ServerUpdateCheckResultSchema = object({
|
|
50589
51222
|
packageName: string(),
|
|
@@ -50634,6 +51267,13 @@ var ServerUpdateOutcomeSchema = _enum([
|
|
|
50634
51267
|
"refused",
|
|
50635
51268
|
"failed"
|
|
50636
51269
|
]);
|
|
51270
|
+
/** One addon the pre-flight found the target version would refuse (D877). */
|
|
51271
|
+
var UpdateBlockerSchema = object({
|
|
51272
|
+
addonId: string(),
|
|
51273
|
+
reason: string(),
|
|
51274
|
+
/** What the operator does about it. */
|
|
51275
|
+
remedy: string()
|
|
51276
|
+
});
|
|
50637
51277
|
var ServerUpdateActionResultSchema = object({
|
|
50638
51278
|
accepted: boolean(),
|
|
50639
51279
|
targetVersion: string().nullable(),
|
|
@@ -50651,14 +51291,27 @@ var ServerUpdateActionResultSchema = object({
|
|
|
50651
51291
|
* The failure itself, verbatim enough to act on (the npm output for a
|
|
50652
51292
|
* staging install). Non-null only for `failed`.
|
|
50653
51293
|
*/
|
|
50654
|
-
error: string().nullable().optional()
|
|
51294
|
+
error: string().nullable().optional(),
|
|
51295
|
+
/**
|
|
51296
|
+
* The addons the target version would refuse to start on this node's live
|
|
51297
|
+
* store (D877), present when the pre-flight refused the update
|
|
51298
|
+
* (`reason: 'addon-would-refuse'`). Optional for version skew.
|
|
51299
|
+
*/
|
|
51300
|
+
blockers: array(UpdateBlockerSchema).optional()
|
|
50655
51301
|
});
|
|
50656
51302
|
method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), ServerUpdateCheckResultSchema, {
|
|
50657
51303
|
kind: "mutation",
|
|
50658
51304
|
auth: "admin"
|
|
50659
|
-
}), method(object({
|
|
50660
|
-
/** Explicit target version; omitted = latest from the registry. */
|
|
50661
|
-
version: string().optional()
|
|
51305
|
+
}), method(object({
|
|
51306
|
+
/** Explicit target version; omitted = latest from the registry. */
|
|
51307
|
+
version: string().optional(),
|
|
51308
|
+
/**
|
|
51309
|
+
* Apply even though the pre-flight (D877) found addons the target would
|
|
51310
|
+
* refuse to start. Off by default: those addons stay down until the
|
|
51311
|
+
* remedy is run, which is the incident this gate exists to prevent.
|
|
51312
|
+
*/
|
|
51313
|
+
acknowledgeRefusals: boolean().optional()
|
|
51314
|
+
}), ServerUpdateActionResultSchema, {
|
|
50662
51315
|
kind: "mutation",
|
|
50663
51316
|
auth: "admin",
|
|
50664
51317
|
timeoutMs: 16 * 6e4
|
|
@@ -53626,7 +54279,9 @@ var ManifestShapeSchema = object({
|
|
|
53626
54279
|
var AddonProcessSchema = object({
|
|
53627
54280
|
pid: number().optional(),
|
|
53628
54281
|
mode: string(),
|
|
53629
|
-
state: string()
|
|
54282
|
+
state: string(),
|
|
54283
|
+
/** Why the runner is `refused` (an addon's own words), when it is (D877). */
|
|
54284
|
+
reason: string().optional()
|
|
53630
54285
|
});
|
|
53631
54286
|
/**
|
|
53632
54287
|
* Per-addon health snapshot from the kernel's AddonHealthMonitor.
|
|
@@ -55015,6 +55670,12 @@ var ClimateControlStatusSchema = object({
|
|
|
55015
55670
|
/** Horizontal louver swing on/off. Null when the device has no
|
|
55016
55671
|
* horizontal swing surface (gate with `DeviceFeature.ClimateSwingHorizontal`). */
|
|
55017
55672
|
swingHorizontal: boolean().nullable(),
|
|
55673
|
+
/** Lowest setpoint the device accepts, Celsius. Absent / null = not reported. */
|
|
55674
|
+
minTemp: number().nullable().optional(),
|
|
55675
|
+
/** Highest setpoint the device accepts, Celsius. Absent / null = not reported. */
|
|
55676
|
+
maxTemp: number().nullable().optional(),
|
|
55677
|
+
/** Setpoint granularity, Celsius (0.5, 1). Absent / null = not reported. */
|
|
55678
|
+
tempStep: number().positive().nullable().optional(),
|
|
55018
55679
|
/** Ms epoch when the slice was last updated (push or command). */
|
|
55019
55680
|
lastFetchedAt: number()
|
|
55020
55681
|
});
|
|
@@ -57795,7 +58456,19 @@ var TlsStatusSchema = object({
|
|
|
57795
58456
|
sans: array(string()),
|
|
57796
58457
|
caCertPem: string().nullable(),
|
|
57797
58458
|
reissueError: string().nullable(),
|
|
57798
|
-
restartRequired: boolean()
|
|
58459
|
+
restartRequired: boolean(),
|
|
58460
|
+
/** An uploaded certificate is served but no CA is kept for it and it is not publicly signed (D873). */
|
|
58461
|
+
caMissing: boolean(),
|
|
58462
|
+
/** Does the hub's own generated CA carry a critical name constraint? `null` while it has none. */
|
|
58463
|
+
localCaConstrained: boolean().nullable(),
|
|
58464
|
+
/** ISO time the generated CA was replaced by a constrained one; devices must re-download it. */
|
|
58465
|
+
caReplacedAt: string().nullable(),
|
|
58466
|
+
/** The uploaded certificate kept on disk, selectable again after "Revert to generated". */
|
|
58467
|
+
storedUpload: object({
|
|
58468
|
+
leafFingerprintSha256: string(),
|
|
58469
|
+
validTo: string(),
|
|
58470
|
+
hasCa: boolean()
|
|
58471
|
+
}).nullable()
|
|
57799
58472
|
});
|
|
57800
58473
|
method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(object({
|
|
57801
58474
|
/**
|
|
@@ -57851,6 +58524,9 @@ method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(obje
|
|
|
57851
58524
|
}), method(_void(), object({ pem: string() })), method(_void(), TlsStatusSchema, {
|
|
57852
58525
|
kind: "mutation",
|
|
57853
58526
|
auth: "admin"
|
|
58527
|
+
}), method(_void(), TlsStatusSchema, {
|
|
58528
|
+
kind: "mutation",
|
|
58529
|
+
auth: "admin"
|
|
57854
58530
|
});
|
|
57855
58531
|
var LockControlStatusSchema = object({
|
|
57856
58532
|
/** Lifecycle state of the lock. `jammed` means the motor reported
|
|
@@ -64914,7 +65590,11 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
64914
65590
|
kind: "mutation",
|
|
64915
65591
|
auth: "admin",
|
|
64916
65592
|
access: "delete"
|
|
64917
|
-
}), method(object({ userId: string() }), TotpStatusSchema, { auth: "admin" }), method(
|
|
65593
|
+
}), method(object({ userId: string() }), TotpStatusSchema, { auth: "admin" }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
|
|
65594
|
+
kind: "mutation",
|
|
65595
|
+
auth: "admin",
|
|
65596
|
+
access: "create"
|
|
65597
|
+
}), method(object({
|
|
64918
65598
|
userId: string(),
|
|
64919
65599
|
code: string()
|
|
64920
65600
|
}), object({ valid: boolean() }), {
|
|
@@ -66741,13 +67421,14 @@ var BaseDevice = class {
|
|
|
66741
67421
|
get state() {
|
|
66742
67422
|
if (!this._stateProxyCache) {
|
|
66743
67423
|
const cache = {};
|
|
66744
|
-
const handler = { get: (
|
|
67424
|
+
const handler = { get: (target, key) => {
|
|
66745
67425
|
const k = key;
|
|
66746
|
-
|
|
67426
|
+
const existing = Reflect.get(target, k);
|
|
67427
|
+
if (existing !== void 0) return existing;
|
|
66747
67428
|
const cap = DEVICE_LOCAL_STATE_CAPS[k];
|
|
66748
67429
|
if (!cap) return void 0;
|
|
66749
67430
|
const proxy = this.sliceProxy(cap);
|
|
66750
|
-
|
|
67431
|
+
Reflect.set(target, k, proxy);
|
|
66751
67432
|
return proxy;
|
|
66752
67433
|
} };
|
|
66753
67434
|
this._stateProxyCache = new Proxy(cache, handler);
|
|
@@ -66946,7 +67627,7 @@ var BaseDevice = class {
|
|
|
66946
67627
|
async updateSourceInfo(patch) {
|
|
66947
67628
|
const next = mergeSourceInfo(this.sourceInfo, patch);
|
|
66948
67629
|
this._sourceInfoCache = Object.freeze({ ...next });
|
|
66949
|
-
const action = this.ctx.api
|
|
67630
|
+
const action = this.ctx.api.deviceManager?.setMetadata;
|
|
66950
67631
|
if (action) try {
|
|
66951
67632
|
await action.mutate({
|
|
66952
67633
|
deviceId: this.id,
|
|
@@ -66981,7 +67662,7 @@ var BaseDevice = class {
|
|
|
66981
67662
|
* device boot on a meta refresh.
|
|
66982
67663
|
*/
|
|
66983
67664
|
async refreshFeatures() {
|
|
66984
|
-
const action = this.ctx.api
|
|
67665
|
+
const action = this.ctx.api.deviceManager?.registerDevice;
|
|
66985
67666
|
if (!action) return;
|
|
66986
67667
|
try {
|
|
66987
67668
|
await action.mutate({
|
|
@@ -69055,6 +69736,12 @@ Object.freeze({
|
|
|
69055
69736
|
addonId: null,
|
|
69056
69737
|
access: "view"
|
|
69057
69738
|
},
|
|
69739
|
+
"coreBlocks.migrateRawSecrets": {
|
|
69740
|
+
capName: "core-blocks",
|
|
69741
|
+
capScope: "system",
|
|
69742
|
+
addonId: null,
|
|
69743
|
+
access: "create"
|
|
69744
|
+
},
|
|
69058
69745
|
"coreBlocks.restart": {
|
|
69059
69746
|
capName: "core-blocks",
|
|
69060
69747
|
capScope: "system",
|
|
@@ -70741,6 +71428,12 @@ Object.freeze({
|
|
|
70741
71428
|
addonId: null,
|
|
70742
71429
|
access: "create"
|
|
70743
71430
|
},
|
|
71431
|
+
"keychainAdmin.importSecret": {
|
|
71432
|
+
capName: "keychain-admin",
|
|
71433
|
+
capScope: "system",
|
|
71434
|
+
addonId: null,
|
|
71435
|
+
access: "create"
|
|
71436
|
+
},
|
|
70744
71437
|
"keychainAdmin.listAudit": {
|
|
70745
71438
|
capName: "keychain-admin",
|
|
70746
71439
|
capScope: "system",
|
|
@@ -70909,6 +71602,12 @@ Object.freeze({
|
|
|
70909
71602
|
addonId: null,
|
|
70910
71603
|
access: "view"
|
|
70911
71604
|
},
|
|
71605
|
+
"llm.migrateRawSecrets": {
|
|
71606
|
+
capName: "llm",
|
|
71607
|
+
capScope: "system",
|
|
71608
|
+
addonId: null,
|
|
71609
|
+
access: "create"
|
|
71610
|
+
},
|
|
70912
71611
|
"llm.resolveModelRef": {
|
|
70913
71612
|
capName: "llm",
|
|
70914
71613
|
capScope: "system",
|
|
@@ -71137,6 +71836,12 @@ Object.freeze({
|
|
|
71137
71836
|
addonId: null,
|
|
71138
71837
|
access: "create"
|
|
71139
71838
|
},
|
|
71839
|
+
"localNetwork.useStoredUploadedCertificate": {
|
|
71840
|
+
capName: "local-network",
|
|
71841
|
+
capScope: "system",
|
|
71842
|
+
addonId: null,
|
|
71843
|
+
access: "create"
|
|
71844
|
+
},
|
|
71140
71845
|
"lockControl.getStatus": {
|
|
71141
71846
|
capName: "lock-control",
|
|
71142
71847
|
capScope: "device",
|
|
@@ -73789,6 +74494,30 @@ Object.freeze({
|
|
|
73789
74494
|
addonId: null,
|
|
73790
74495
|
access: "create"
|
|
73791
74496
|
},
|
|
74497
|
+
"recordEntries.deleteEntry": {
|
|
74498
|
+
capName: "record-entries",
|
|
74499
|
+
capScope: "system",
|
|
74500
|
+
addonId: null,
|
|
74501
|
+
access: "delete"
|
|
74502
|
+
},
|
|
74503
|
+
"recordEntries.listEntries": {
|
|
74504
|
+
capName: "record-entries",
|
|
74505
|
+
capScope: "system",
|
|
74506
|
+
addonId: null,
|
|
74507
|
+
access: "view"
|
|
74508
|
+
},
|
|
74509
|
+
"recordEntries.listEntryKinds": {
|
|
74510
|
+
capName: "record-entries",
|
|
74511
|
+
capScope: "system",
|
|
74512
|
+
addonId: null,
|
|
74513
|
+
access: "view"
|
|
74514
|
+
},
|
|
74515
|
+
"recordEntries.putEntry": {
|
|
74516
|
+
capName: "record-entries",
|
|
74517
|
+
capScope: "system",
|
|
74518
|
+
addonId: null,
|
|
74519
|
+
access: "create"
|
|
74520
|
+
},
|
|
73792
74521
|
"recording.getAvailability": {
|
|
73793
74522
|
capName: "recording",
|
|
73794
74523
|
capScope: "device",
|
|
@@ -74089,6 +74818,102 @@ Object.freeze({
|
|
|
74089
74818
|
addonId: null,
|
|
74090
74819
|
access: "view"
|
|
74091
74820
|
},
|
|
74821
|
+
"records.aggregate": {
|
|
74822
|
+
capName: "records",
|
|
74823
|
+
capScope: "system",
|
|
74824
|
+
addonId: null,
|
|
74825
|
+
access: "view"
|
|
74826
|
+
},
|
|
74827
|
+
"records.allocateId": {
|
|
74828
|
+
capName: "records",
|
|
74829
|
+
capScope: "system",
|
|
74830
|
+
addonId: null,
|
|
74831
|
+
access: "create"
|
|
74832
|
+
},
|
|
74833
|
+
"records.count": {
|
|
74834
|
+
capName: "records",
|
|
74835
|
+
capScope: "system",
|
|
74836
|
+
addonId: null,
|
|
74837
|
+
access: "view"
|
|
74838
|
+
},
|
|
74839
|
+
"records.declareKinds": {
|
|
74840
|
+
capName: "records",
|
|
74841
|
+
capScope: "system",
|
|
74842
|
+
addonId: null,
|
|
74843
|
+
access: "create"
|
|
74844
|
+
},
|
|
74845
|
+
"records.delete": {
|
|
74846
|
+
capName: "records",
|
|
74847
|
+
capScope: "system",
|
|
74848
|
+
addonId: null,
|
|
74849
|
+
access: "delete"
|
|
74850
|
+
},
|
|
74851
|
+
"records.deleteDevice": {
|
|
74852
|
+
capName: "records",
|
|
74853
|
+
capScope: "system",
|
|
74854
|
+
addonId: null,
|
|
74855
|
+
access: "delete"
|
|
74856
|
+
},
|
|
74857
|
+
"records.deleteMany": {
|
|
74858
|
+
capName: "records",
|
|
74859
|
+
capScope: "system",
|
|
74860
|
+
addonId: null,
|
|
74861
|
+
access: "delete"
|
|
74862
|
+
},
|
|
74863
|
+
"records.deleteWhere": {
|
|
74864
|
+
capName: "records",
|
|
74865
|
+
capScope: "system",
|
|
74866
|
+
addonId: null,
|
|
74867
|
+
access: "delete"
|
|
74868
|
+
},
|
|
74869
|
+
"records.get": {
|
|
74870
|
+
capName: "records",
|
|
74871
|
+
capScope: "system",
|
|
74872
|
+
addonId: null,
|
|
74873
|
+
access: "view"
|
|
74874
|
+
},
|
|
74875
|
+
"records.getMany": {
|
|
74876
|
+
capName: "records",
|
|
74877
|
+
capScope: "system",
|
|
74878
|
+
addonId: null,
|
|
74879
|
+
access: "view"
|
|
74880
|
+
},
|
|
74881
|
+
"records.histogram": {
|
|
74882
|
+
capName: "records",
|
|
74883
|
+
capScope: "system",
|
|
74884
|
+
addonId: null,
|
|
74885
|
+
access: "view"
|
|
74886
|
+
},
|
|
74887
|
+
"records.patch": {
|
|
74888
|
+
capName: "records",
|
|
74889
|
+
capScope: "system",
|
|
74890
|
+
addonId: null,
|
|
74891
|
+
access: "create"
|
|
74892
|
+
},
|
|
74893
|
+
"records.put": {
|
|
74894
|
+
capName: "records",
|
|
74895
|
+
capScope: "system",
|
|
74896
|
+
addonId: null,
|
|
74897
|
+
access: "create"
|
|
74898
|
+
},
|
|
74899
|
+
"records.putMany": {
|
|
74900
|
+
capName: "records",
|
|
74901
|
+
capScope: "system",
|
|
74902
|
+
addonId: null,
|
|
74903
|
+
access: "create"
|
|
74904
|
+
},
|
|
74905
|
+
"records.query": {
|
|
74906
|
+
capName: "records",
|
|
74907
|
+
capScope: "system",
|
|
74908
|
+
addonId: null,
|
|
74909
|
+
access: "view"
|
|
74910
|
+
},
|
|
74911
|
+
"records.secretRefs": {
|
|
74912
|
+
capName: "records",
|
|
74913
|
+
capScope: "system",
|
|
74914
|
+
addonId: null,
|
|
74915
|
+
access: "view"
|
|
74916
|
+
},
|
|
74092
74917
|
"sceneMonitor.captureReference": {
|
|
74093
74918
|
capName: "scene-monitor",
|
|
74094
74919
|
capScope: "device",
|
|
@@ -74521,6 +75346,48 @@ Object.freeze({
|
|
|
74521
75346
|
addonId: null,
|
|
74522
75347
|
access: "create"
|
|
74523
75348
|
},
|
|
75349
|
+
"storageAdmin.adoptRecords": {
|
|
75350
|
+
capName: "storage-admin",
|
|
75351
|
+
capScope: "system",
|
|
75352
|
+
addonId: null,
|
|
75353
|
+
access: "create"
|
|
75354
|
+
},
|
|
75355
|
+
"storageAdmin.dropCollection": {
|
|
75356
|
+
capName: "storage-admin",
|
|
75357
|
+
capScope: "system",
|
|
75358
|
+
addonId: null,
|
|
75359
|
+
access: "delete"
|
|
75360
|
+
},
|
|
75361
|
+
"storageAdmin.isAdoptedLegacyTable": {
|
|
75362
|
+
capName: "storage-admin",
|
|
75363
|
+
capScope: "system",
|
|
75364
|
+
addonId: null,
|
|
75365
|
+
access: "view"
|
|
75366
|
+
},
|
|
75367
|
+
"storageAdmin.listKinds": {
|
|
75368
|
+
capName: "storage-admin",
|
|
75369
|
+
capScope: "system",
|
|
75370
|
+
addonId: null,
|
|
75371
|
+
access: "view"
|
|
75372
|
+
},
|
|
75373
|
+
"storageAdmin.listTables": {
|
|
75374
|
+
capName: "storage-admin",
|
|
75375
|
+
capScope: "system",
|
|
75376
|
+
addonId: null,
|
|
75377
|
+
access: "view"
|
|
75378
|
+
},
|
|
75379
|
+
"storageAdmin.readLegacyCollection": {
|
|
75380
|
+
capName: "storage-admin",
|
|
75381
|
+
capScope: "system",
|
|
75382
|
+
addonId: null,
|
|
75383
|
+
access: "view"
|
|
75384
|
+
},
|
|
75385
|
+
"storageAdmin.readRecords": {
|
|
75386
|
+
capName: "storage-admin",
|
|
75387
|
+
capScope: "system",
|
|
75388
|
+
addonId: null,
|
|
75389
|
+
access: "view"
|
|
75390
|
+
},
|
|
74524
75391
|
"storageEvictable.evict": {
|
|
74525
75392
|
capName: "storage-evictable",
|
|
74526
75393
|
capScope: "system",
|
|
@@ -75433,6 +76300,12 @@ Object.freeze({
|
|
|
75433
76300
|
addonId: null,
|
|
75434
76301
|
access: "view"
|
|
75435
76302
|
},
|
|
76303
|
+
"userManagement.migrateRawSecrets": {
|
|
76304
|
+
capName: "user-management",
|
|
76305
|
+
capScope: "system",
|
|
76306
|
+
addonId: null,
|
|
76307
|
+
access: "create"
|
|
76308
|
+
},
|
|
75436
76309
|
"userManagement.oauthExchangeCode": {
|
|
75437
76310
|
capName: "user-management",
|
|
75438
76311
|
capScope: "system",
|
|
@@ -78261,6 +79134,37 @@ Object.freeze({
|
|
|
78261
79134
|
form: "single",
|
|
78262
79135
|
optional: false
|
|
78263
79136
|
}],
|
|
79137
|
+
"records.count": [{
|
|
79138
|
+
name: "deviceId",
|
|
79139
|
+
form: "single",
|
|
79140
|
+
optional: true
|
|
79141
|
+
}],
|
|
79142
|
+
"records.deleteDevice": [{
|
|
79143
|
+
name: "deviceId",
|
|
79144
|
+
form: "single",
|
|
79145
|
+
optional: false
|
|
79146
|
+
}],
|
|
79147
|
+
"records.deleteWhere": [{
|
|
79148
|
+
name: "deviceId",
|
|
79149
|
+
form: "single",
|
|
79150
|
+
optional: true
|
|
79151
|
+
}],
|
|
79152
|
+
"records.histogram": [{
|
|
79153
|
+
name: "deviceId",
|
|
79154
|
+
form: "single",
|
|
79155
|
+
optional: true
|
|
79156
|
+
}],
|
|
79157
|
+
"records.putMany": [{
|
|
79158
|
+
name: "records",
|
|
79159
|
+
form: "object-array",
|
|
79160
|
+
optional: false,
|
|
79161
|
+
itemField: "deviceId"
|
|
79162
|
+
}],
|
|
79163
|
+
"records.query": [{
|
|
79164
|
+
name: "deviceId",
|
|
79165
|
+
form: "single",
|
|
79166
|
+
optional: true
|
|
79167
|
+
}],
|
|
78264
79168
|
"sceneMonitor.captureReference": [{
|
|
78265
79169
|
name: "deviceId",
|
|
78266
79170
|
form: "single",
|
|
@@ -78377,6 +79281,17 @@ Object.freeze({
|
|
|
78377
79281
|
form: "single",
|
|
78378
79282
|
optional: false
|
|
78379
79283
|
}],
|
|
79284
|
+
"storageAdmin.adoptRecords": [{
|
|
79285
|
+
name: "records",
|
|
79286
|
+
form: "object-array",
|
|
79287
|
+
optional: false,
|
|
79288
|
+
itemField: "deviceId"
|
|
79289
|
+
}],
|
|
79290
|
+
"storageAdmin.readRecords": [{
|
|
79291
|
+
name: "deviceId",
|
|
79292
|
+
form: "single",
|
|
79293
|
+
optional: true
|
|
79294
|
+
}],
|
|
78380
79295
|
"streamBroker.acquireEgressTranscode": [{
|
|
78381
79296
|
name: "deviceId",
|
|
78382
79297
|
form: "single",
|