@camstack/addon-provider-amcrest 0.2.136 → 0.2.137
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 +1038 -119
- package/dist/addon.mjs +1038 -119
- package/package.json +1 -1
package/dist/addon.mjs
CHANGED
|
@@ -14,7 +14,7 @@ import { networkInterfaces } from "node:os";
|
|
|
14
14
|
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
15
15
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
16
16
|
//#endregion
|
|
17
|
-
//#region ../types/dist/event-category-
|
|
17
|
+
//#region ../types/dist/event-category-BvOFi6PY.mjs
|
|
18
18
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
19
19
|
EventCategory["SystemBoot"] = "system.boot";
|
|
20
20
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -78,6 +78,24 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
78
78
|
* consumes this category and maps it to the `addon-crash-loop` kind.
|
|
79
79
|
*/
|
|
80
80
|
EventCategory["AddonRunnerFailed"] = "addon.runner-failed";
|
|
81
|
+
/**
|
|
82
|
+
* A runner whose addon refused to start with a typed reason (D877) - parked
|
|
83
|
+
* in `refused`, never counted by the crash breaker, retried on operator
|
|
84
|
+
* action. One event per refusal.
|
|
85
|
+
*/
|
|
86
|
+
EventCategory["AddonRunnerRefused"] = "addon.runner-refused";
|
|
87
|
+
/**
|
|
88
|
+
* A runner settled on a state (D877): `running` (READY), `crashed`, `failed` or
|
|
89
|
+
* `refused`. In-process telemetry for the boot check (re-evaluate while any
|
|
90
|
+
* runner is still pending) and the alert centre (close a recovered runner).
|
|
91
|
+
*/
|
|
92
|
+
EventCategory["ProcessStateChanged"] = "process.state-changed";
|
|
93
|
+
/**
|
|
94
|
+
* The node's one-shot runner boot check (D877): planned runners against the
|
|
95
|
+
* process service, `degraded` when any is failed, refused or missing. The
|
|
96
|
+
* alert centre turns it into one alert and a direct critical push.
|
|
97
|
+
*/
|
|
98
|
+
EventCategory["SystemRunnerCheck"] = "system.runner-check";
|
|
81
99
|
EventCategory["AddonError"] = "addon.error";
|
|
82
100
|
EventCategory["AddonPageReady"] = "addon.page-ready";
|
|
83
101
|
EventCategory["AddonWidgetReady"] = "addon.widget-ready";
|
|
@@ -5402,7 +5420,7 @@ var ZodIssueCode = {
|
|
|
5402
5420
|
var ZodFirstPartyTypeKind;
|
|
5403
5421
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5404
5422
|
//#endregion
|
|
5405
|
-
//#region ../types/dist/sleep-
|
|
5423
|
+
//#region ../types/dist/sleep-bZIhUvjd.mjs
|
|
5406
5424
|
/**
|
|
5407
5425
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5408
5426
|
* window to float samples (D455).
|
|
@@ -5519,7 +5537,7 @@ function isKeychainStoredField(field) {
|
|
|
5519
5537
|
var SECRET_CLEAR = { $secretClear: true };
|
|
5520
5538
|
/** The `'***'` token D634 redaction writes for non-admins. */
|
|
5521
5539
|
var LEGACY_DEVICE_REDACTION = "***";
|
|
5522
|
-
function isRecord$
|
|
5540
|
+
function isRecord$5(value) {
|
|
5523
5541
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5524
5542
|
}
|
|
5525
5543
|
function makeSecretMarker(ref) {
|
|
@@ -5530,12 +5548,12 @@ function makeSecretMarker(ref) {
|
|
|
5530
5548
|
}
|
|
5531
5549
|
/** A stored marker: an object whose `$secret` is a non-empty string. */
|
|
5532
5550
|
function isSecretMarker(value) {
|
|
5533
|
-
if (!isRecord$
|
|
5551
|
+
if (!isRecord$5(value)) return false;
|
|
5534
5552
|
const ref = value["$secret"];
|
|
5535
5553
|
return typeof ref === "string" && ref.length > 0;
|
|
5536
5554
|
}
|
|
5537
5555
|
function isSecretClear(value) {
|
|
5538
|
-
return isRecord$
|
|
5556
|
+
return isRecord$5(value) && value["$secretClear"] === true;
|
|
5539
5557
|
}
|
|
5540
5558
|
/**
|
|
5541
5559
|
* The UI view of a stored secret field value: a marker becomes "set", inline
|
|
@@ -6145,7 +6163,7 @@ var KeychainWriteRefusedError = class extends Error {
|
|
|
6145
6163
|
}
|
|
6146
6164
|
};
|
|
6147
6165
|
var KEEP = { kind: "keep" };
|
|
6148
|
-
function isRecord$
|
|
6166
|
+
function isRecord$4(value) {
|
|
6149
6167
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6150
6168
|
}
|
|
6151
6169
|
function defaultMintId() {
|
|
@@ -6158,7 +6176,7 @@ function collectSecretMarkerRefs(value, out = []) {
|
|
|
6158
6176
|
return out;
|
|
6159
6177
|
}
|
|
6160
6178
|
if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
|
|
6161
|
-
else if (isRecord$
|
|
6179
|
+
else if (isRecord$4(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
6162
6180
|
return out;
|
|
6163
6181
|
}
|
|
6164
6182
|
async function storedValueEquals(secrets, marker, candidate) {
|
|
@@ -6213,7 +6231,7 @@ function rowId(row, idKey) {
|
|
|
6213
6231
|
return null;
|
|
6214
6232
|
}
|
|
6215
6233
|
async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
6216
|
-
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$
|
|
6234
|
+
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$4) : [];
|
|
6217
6235
|
if (!Array.isArray(incoming)) {
|
|
6218
6236
|
ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
|
|
6219
6237
|
return {
|
|
@@ -6229,7 +6247,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
|
6229
6247
|
const kept = /* @__PURE__ */ new Set();
|
|
6230
6248
|
const rows = [];
|
|
6231
6249
|
for (const row of incoming) {
|
|
6232
|
-
if (!isRecord$
|
|
6250
|
+
if (!isRecord$4(row)) {
|
|
6233
6251
|
rows.push(row);
|
|
6234
6252
|
continue;
|
|
6235
6253
|
}
|
|
@@ -6254,7 +6272,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
6254
6272
|
case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
|
|
6255
6273
|
case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
|
|
6256
6274
|
case "object": {
|
|
6257
|
-
if (!isRecord$
|
|
6275
|
+
if (!isRecord$4(incoming)) {
|
|
6258
6276
|
if (incoming === void 0) return KEEP;
|
|
6259
6277
|
ctx.deletes.push(...collectSecretMarkerRefs(stored));
|
|
6260
6278
|
return {
|
|
@@ -6262,7 +6280,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
6262
6280
|
value: incoming
|
|
6263
6281
|
};
|
|
6264
6282
|
}
|
|
6265
|
-
const storedObj = isRecord$
|
|
6283
|
+
const storedObj = isRecord$4(stored) ? stored : {};
|
|
6266
6284
|
return {
|
|
6267
6285
|
kind: "value",
|
|
6268
6286
|
value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
|
|
@@ -6385,7 +6403,7 @@ async function resolveSecretMarkers(value, secrets, options = {}) {
|
|
|
6385
6403
|
value: items
|
|
6386
6404
|
};
|
|
6387
6405
|
}
|
|
6388
|
-
if (isRecord$
|
|
6406
|
+
if (isRecord$4(v)) {
|
|
6389
6407
|
const out = {};
|
|
6390
6408
|
for (const [k, child] of Object.entries(v)) {
|
|
6391
6409
|
const s = substitute(child);
|
|
@@ -6653,7 +6671,6 @@ function createHandle(raw, opts) {
|
|
|
6653
6671
|
const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
|
|
6654
6672
|
const readAddonStoreResult = raw.readAddonStoreResult;
|
|
6655
6673
|
const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
|
|
6656
|
-
const readDeviceStoreBatch = raw.readDeviceStoreBatch;
|
|
6657
6674
|
const overrides = {
|
|
6658
6675
|
readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
|
|
6659
6676
|
...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
|
|
@@ -6677,12 +6694,12 @@ function createHandle(raw, opts) {
|
|
|
6677
6694
|
};
|
|
6678
6695
|
} } : {},
|
|
6679
6696
|
readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
|
|
6680
|
-
|
|
6681
|
-
const rows = await readDeviceStoreBatch
|
|
6697
|
+
readDeviceStoreBatch: async (deviceIds) => {
|
|
6698
|
+
const rows = await raw.readDeviceStoreBatch(deviceIds);
|
|
6682
6699
|
const out = /* @__PURE__ */ new Map();
|
|
6683
6700
|
for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
|
|
6684
6701
|
return out;
|
|
6685
|
-
}
|
|
6702
|
+
},
|
|
6686
6703
|
writeAddonStore: async (patch) => {
|
|
6687
6704
|
await writeAddon(patch);
|
|
6688
6705
|
},
|
|
@@ -7309,7 +7326,7 @@ var BaseAddon = class {
|
|
|
7309
7326
|
if (!ctx) return;
|
|
7310
7327
|
const addonId = ctx.id;
|
|
7311
7328
|
setImmediate(() => {
|
|
7312
|
-
ctx.api.addons
|
|
7329
|
+
ctx.api.addons.restartAddon.mutate({ addonId }).then(() => {
|
|
7313
7330
|
ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
|
|
7314
7331
|
}).catch((err) => {
|
|
7315
7332
|
ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
@@ -7509,7 +7526,7 @@ var BaseAddon = class {
|
|
|
7509
7526
|
return this._addonSecretTree;
|
|
7510
7527
|
}
|
|
7511
7528
|
deviceSecretTree() {
|
|
7512
|
-
this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
|
|
7529
|
+
this._deviceSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.deviceSettingsSchema()), this.secretStatePaths);
|
|
7513
7530
|
return this._deviceSecretTree;
|
|
7514
7531
|
}
|
|
7515
7532
|
/**
|
|
@@ -7585,42 +7602,135 @@ var BaseAddon = class {
|
|
|
7585
7602
|
this[timerOf] = timer;
|
|
7586
7603
|
}
|
|
7587
7604
|
/**
|
|
7588
|
-
* Wrap `ctx.settings.readAddonStore()` with a
|
|
7589
|
-
*
|
|
7590
|
-
* swap, or any race where the SqliteSettingsBackend is between shutdown and
|
|
7591
|
-
* re-initialize) doesn't propagate up into `initialize()` and leave the
|
|
7605
|
+
* Wrap `ctx.settings.readAddonStore()` with a retry budget so a transient
|
|
7606
|
+
* settings-store outage doesn't propagate up into `initialize()` and leave the
|
|
7592
7607
|
* addon permanently broken.
|
|
7593
7608
|
*
|
|
7594
|
-
*
|
|
7595
|
-
*
|
|
7596
|
-
* `
|
|
7609
|
+
* Two kinds of outage, two budgets:
|
|
7610
|
+
* - the store's own restart fingerprints (`SqliteSettingsBackend not
|
|
7611
|
+
* initialized`, `provider not available`): a short budget, then the addon
|
|
7612
|
+
* falls back to `{}` (defaults) - its first successful patch rehydrates;
|
|
7613
|
+
* - a TRANSPORT failure (the hub is restarting while this runner boots:
|
|
7614
|
+
* `discovery deadline exceeded`, `parent could not route`, a refused or
|
|
7615
|
+
* timed-out connection). Since D870 a runner's settings read THROWS instead
|
|
7616
|
+
* of answering `{}`, so without a budget a hub restart ends in a respawn
|
|
7617
|
+
* loop. A long, bounded budget; only after it the error propagates - the
|
|
7618
|
+
* addon never runs on defaults for a store it could not ask.
|
|
7619
|
+
* Anything else propagates immediately so real bugs surface.
|
|
7597
7620
|
*/
|
|
7598
7621
|
async readAddonStoreWithRetry() {
|
|
7599
7622
|
const settings = this.rawSettings();
|
|
7600
7623
|
if (!settings) return {};
|
|
7601
|
-
const delaysMs = [
|
|
7602
|
-
150,
|
|
7603
|
-
350,
|
|
7604
|
-
600,
|
|
7605
|
-
900
|
|
7606
|
-
];
|
|
7607
7624
|
let lastErr;
|
|
7608
|
-
for (let attempt = 0
|
|
7625
|
+
for (let attempt = 0;; attempt++) try {
|
|
7609
7626
|
const stored = await settings.readAddonStore() ?? {};
|
|
7610
7627
|
this.settingsStoreReady = true;
|
|
7611
7628
|
return stored;
|
|
7612
7629
|
} catch (err) {
|
|
7613
7630
|
lastErr = err;
|
|
7614
|
-
const
|
|
7615
|
-
if (
|
|
7616
|
-
|
|
7617
|
-
|
|
7631
|
+
const kind = classifyStoreError(err);
|
|
7632
|
+
if (kind === "permanent") throw err;
|
|
7633
|
+
const delay = (kind === "transport" ? TRANSPORT_RETRY_DELAYS_MS : RESTART_RETRY_DELAYS_MS)[attempt];
|
|
7634
|
+
if (delay === void 0) {
|
|
7635
|
+
if (kind === "transport") throw err;
|
|
7636
|
+
break;
|
|
7637
|
+
}
|
|
7638
|
+
await new Promise((r) => setTimeout(r, delay));
|
|
7618
7639
|
}
|
|
7619
7640
|
this.settingsStoreReady = false;
|
|
7620
7641
|
this._ctx?.logger?.warn?.("readAddonStore: settings-store unavailable after retries — using defaults", { meta: { error: lastErr instanceof Error ? lastErr.message : String(lastErr) } });
|
|
7621
7642
|
return {};
|
|
7622
7643
|
}
|
|
7623
7644
|
};
|
|
7645
|
+
/** The settings store's own restart fingerprints. */
|
|
7646
|
+
var RESTART_RETRY_DELAYS_MS = [
|
|
7647
|
+
150,
|
|
7648
|
+
350,
|
|
7649
|
+
600,
|
|
7650
|
+
900
|
|
7651
|
+
];
|
|
7652
|
+
/** A hub restarting under a booting runner: ~100 s in total. */
|
|
7653
|
+
var TRANSPORT_RETRY_DELAYS_MS = [
|
|
7654
|
+
150,
|
|
7655
|
+
350,
|
|
7656
|
+
600,
|
|
7657
|
+
900,
|
|
7658
|
+
2e3,
|
|
7659
|
+
5e3,
|
|
7660
|
+
1e4,
|
|
7661
|
+
2e4,
|
|
7662
|
+
3e4,
|
|
7663
|
+
3e4
|
|
7664
|
+
];
|
|
7665
|
+
var RESTART_FINGERPRINTS = ["SqliteSettingsBackend not initialized", "provider not available"];
|
|
7666
|
+
/** Node / socket error codes of a connection that did not happen or broke. */
|
|
7667
|
+
var TRANSPORT_CODES = new Set([
|
|
7668
|
+
"ECONNREFUSED",
|
|
7669
|
+
"ECONNRESET",
|
|
7670
|
+
"ETIMEDOUT",
|
|
7671
|
+
"EPIPE",
|
|
7672
|
+
"EHOSTUNREACH",
|
|
7673
|
+
"ENETUNREACH"
|
|
7674
|
+
]);
|
|
7675
|
+
/** tRPC error codes that mean "the other side is not answering now", not "your call is wrong". */
|
|
7676
|
+
var UNAVAILABLE_TRPC_CODES = new Set([
|
|
7677
|
+
"TIMEOUT",
|
|
7678
|
+
"SERVICE_UNAVAILABLE",
|
|
7679
|
+
"BAD_GATEWAY",
|
|
7680
|
+
"GATEWAY_TIMEOUT"
|
|
7681
|
+
]);
|
|
7682
|
+
/** The exact phrases OUR transport raises when it cannot reach the hub. */
|
|
7683
|
+
var TRANSPORT_PHRASES = [
|
|
7684
|
+
"discovery deadline exceeded",
|
|
7685
|
+
"parent could not route child unowned cap call",
|
|
7686
|
+
"UDS request timed out after",
|
|
7687
|
+
"channel closed"
|
|
7688
|
+
];
|
|
7689
|
+
/** Moleculer error `type`s of a call that could not be served right now. */
|
|
7690
|
+
var MOLECULER_TRANSIENT_TYPES = new Set([
|
|
7691
|
+
"REQUEST_TIMEOUT",
|
|
7692
|
+
"SERVICE_NOT_FOUND",
|
|
7693
|
+
"SERVICE_NOT_AVAILABLE",
|
|
7694
|
+
"REQUEST_REJECTED",
|
|
7695
|
+
"BROKER_DISCONNECTED"
|
|
7696
|
+
]);
|
|
7697
|
+
function stringProp(value, key) {
|
|
7698
|
+
if (typeof value !== "object" || value === null) return void 0;
|
|
7699
|
+
const found = Reflect.get(value, key);
|
|
7700
|
+
return typeof found === "string" ? found : void 0;
|
|
7701
|
+
}
|
|
7702
|
+
/** The code an error carries: its own, its cause's, or a tRPC `data.code`. */
|
|
7703
|
+
function errorCode(err) {
|
|
7704
|
+
const out = {};
|
|
7705
|
+
const cause = typeof err === "object" && err !== null ? Reflect.get(err, "cause") : void 0;
|
|
7706
|
+
const data = typeof err === "object" && err !== null ? Reflect.get(err, "data") : void 0;
|
|
7707
|
+
const node = stringProp(err, "code") ?? stringProp(cause, "code");
|
|
7708
|
+
if (node !== void 0) out.node = node;
|
|
7709
|
+
const trpc = stringProp(data, "code");
|
|
7710
|
+
if (trpc !== void 0) out.trpc = trpc;
|
|
7711
|
+
return out;
|
|
7712
|
+
}
|
|
7713
|
+
/**
|
|
7714
|
+
* Is a settings read failure worth retrying, and with which budget? Only
|
|
7715
|
+
* EXPLICIT signals count: a socket error code, a tRPC "unavailable" code, or
|
|
7716
|
+
* one of the exact phrases our own transport raises. A message that merely
|
|
7717
|
+
* contains "timed out" or "unreachable" is not evidence of anything, and
|
|
7718
|
+
* `settings store not wired` is a wiring bug that retrying cannot fix.
|
|
7719
|
+
*/
|
|
7720
|
+
function classifyStoreError(err) {
|
|
7721
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
7722
|
+
if (RESTART_FINGERPRINTS.some((f) => message.includes(f))) return "restart";
|
|
7723
|
+
const code = errorCode(err);
|
|
7724
|
+
if (code.node !== void 0 && TRANSPORT_CODES.has(code.node)) return "transport";
|
|
7725
|
+
if (code.trpc !== void 0 && UNAVAILABLE_TRPC_CODES.has(code.trpc)) return "transport";
|
|
7726
|
+
if (typeof err === "object" && err !== null) {
|
|
7727
|
+
if (Reflect.get(err, "retryable") === true) return "transport";
|
|
7728
|
+
const type = stringProp(err, "type");
|
|
7729
|
+
if (type !== void 0 && MOLECULER_TRANSIENT_TYPES.has(type)) return "transport";
|
|
7730
|
+
}
|
|
7731
|
+
if (TRANSPORT_PHRASES.some((f) => message.includes(f))) return "transport";
|
|
7732
|
+
return "permanent";
|
|
7733
|
+
}
|
|
7624
7734
|
/**
|
|
7625
7735
|
* Collect the keys of every field marked `perNode: true`, recursing into
|
|
7626
7736
|
* layout containers (`group` fields and `sub-tabs` tabs) the same way
|
|
@@ -7710,6 +7820,156 @@ var PeerBytesTicketSchema = object({
|
|
|
7710
7820
|
*/
|
|
7711
7821
|
declaredBytes: number().int().nonnegative().nullable()
|
|
7712
7822
|
});
|
|
7823
|
+
/** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
|
|
7824
|
+
/** The files a kind may live in. `history` is device-history's (D850), never records. */
|
|
7825
|
+
var RECORD_DATABASES = ["settings", "events"];
|
|
7826
|
+
/** The classes of a kind: the `@durable` vocabulary, one authority (replaces the annotation). */
|
|
7827
|
+
var RECORD_CLASSES = [
|
|
7828
|
+
"config",
|
|
7829
|
+
"ledger",
|
|
7830
|
+
"audit",
|
|
7831
|
+
"mirror",
|
|
7832
|
+
"ephemeral"
|
|
7833
|
+
];
|
|
7834
|
+
var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
|
|
7835
|
+
var RECORD_MAX_DATA_BYTES = 1024 * 1024;
|
|
7836
|
+
var RECORD_BATCH_MAX = 1e3;
|
|
7837
|
+
var RECORD_QUERY_MAX = 1e3;
|
|
7838
|
+
function defOf(schema) {
|
|
7839
|
+
const zodBag = Reflect.get(schema, "_zod");
|
|
7840
|
+
if (typeof zodBag !== "object" || zodBag === null) return {};
|
|
7841
|
+
const def = Reflect.get(zodBag, "def");
|
|
7842
|
+
if (typeof def !== "object" || def === null) return {};
|
|
7843
|
+
return def;
|
|
7844
|
+
}
|
|
7845
|
+
function declaredHere(schema) {
|
|
7846
|
+
return globalRegistry.get(schema)?.secret === true;
|
|
7847
|
+
}
|
|
7848
|
+
/** Wrapper kinds whose `innerType` is the field itself. */
|
|
7849
|
+
var WRAPPERS = new Set([
|
|
7850
|
+
"optional",
|
|
7851
|
+
"nullable",
|
|
7852
|
+
"default",
|
|
7853
|
+
"prefault",
|
|
7854
|
+
"catch",
|
|
7855
|
+
"readonly",
|
|
7856
|
+
"nonoptional"
|
|
7857
|
+
]);
|
|
7858
|
+
/**
|
|
7859
|
+
* The schema layers that make up ONE field: the schema itself and every
|
|
7860
|
+
* wrapper below it (optional / default / nullable / readonly / catch), plus
|
|
7861
|
+
* both sides of a pipe (`z.preprocess` puts the real schema on `out`,
|
|
7862
|
+
* `.transform` on `in`).
|
|
7863
|
+
*/
|
|
7864
|
+
function layersOf(schema) {
|
|
7865
|
+
const out = [];
|
|
7866
|
+
const queue = [schema];
|
|
7867
|
+
while (queue.length > 0) {
|
|
7868
|
+
const s = queue.shift();
|
|
7869
|
+
if (!s || out.includes(s)) continue;
|
|
7870
|
+
out.push(s);
|
|
7871
|
+
const def = defOf(s);
|
|
7872
|
+
if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
|
|
7873
|
+
if (def.type === "pipe") {
|
|
7874
|
+
if (def.in) queue.push(def.in);
|
|
7875
|
+
if (def.out) queue.push(def.out);
|
|
7876
|
+
}
|
|
7877
|
+
}
|
|
7878
|
+
return out;
|
|
7879
|
+
}
|
|
7880
|
+
/** True when any layer of this field declares `.meta({ secret: true })`. */
|
|
7881
|
+
function isZodSecret(schema) {
|
|
7882
|
+
return layersOf(schema).some(declaredHere);
|
|
7883
|
+
}
|
|
7884
|
+
/**
|
|
7885
|
+
* Every declared secret path in a config schema: dotted keys, `[]` for "each
|
|
7886
|
+
* element of this array" (`connection.password`, `rows[].token`). A declared
|
|
7887
|
+
* object or array is reported as one path and not descended into — everything
|
|
7888
|
+
* under it is secret.
|
|
7889
|
+
*/
|
|
7890
|
+
function collectZodSecretPaths(schema, prefix = "") {
|
|
7891
|
+
if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
|
|
7892
|
+
const paths = [];
|
|
7893
|
+
for (const layer of layersOf(schema)) {
|
|
7894
|
+
const def = defOf(layer);
|
|
7895
|
+
if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
|
|
7896
|
+
else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
|
|
7897
|
+
else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
|
|
7898
|
+
else if (def.type === "intersection") {
|
|
7899
|
+
if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
|
|
7900
|
+
if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
|
|
7901
|
+
}
|
|
7902
|
+
}
|
|
7903
|
+
return [...new Set(paths)];
|
|
7904
|
+
}
|
|
7905
|
+
/**
|
|
7906
|
+
* Record kinds (D881): the declaration an addon makes of one kind of fact, the
|
|
7907
|
+
* Zod row schema that describes it, and the helper that turns the two into the
|
|
7908
|
+
* JSON the engine stores.
|
|
7909
|
+
*
|
|
7910
|
+
* A kind is declared ONCE, next to the code that owns it, and the engine's
|
|
7911
|
+
* reconciler creates its indexes - nothing creates DDL at runtime from a write.
|
|
7912
|
+
* Everything the generic machinery needs (secret fields, the entry descriptor)
|
|
7913
|
+
* is DERIVED from the Zod schema: `.meta({ secret: true })` marks a credential,
|
|
7914
|
+
* never a field name (D879).
|
|
7915
|
+
*/
|
|
7916
|
+
/** A JSON field path: `trackId`, `auth.accessToken`. Charset-restricted: it is rendered into DDL. */
|
|
7917
|
+
var RecordFieldPathSchema = string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}(\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,3}$/);
|
|
7918
|
+
var RecordIndexSchema = object({
|
|
7919
|
+
name: string().regex(/^[a-z][a-z0-9_]{0,31}$/),
|
|
7920
|
+
fields: array(RecordFieldPathSchema).min(1).max(4),
|
|
7921
|
+
unique: boolean().optional()
|
|
7922
|
+
}).strict();
|
|
7923
|
+
var RecordRetentionSchema = union([
|
|
7924
|
+
object({
|
|
7925
|
+
ttlMs: number().int().positive(),
|
|
7926
|
+
from: _enum(["at", "write"])
|
|
7927
|
+
}).strict(),
|
|
7928
|
+
object({
|
|
7929
|
+
maxRows: number().int().positive().optional(),
|
|
7930
|
+
maxRowsPerDevice: number().int().positive().optional()
|
|
7931
|
+
}).strict().refine((r) => r.maxRows !== void 0 || r.maxRowsPerDevice !== void 0, { message: "name maxRows, maxRowsPerDevice or both" }),
|
|
7932
|
+
object({
|
|
7933
|
+
owner: string().min(1),
|
|
7934
|
+
reason: string().min(1)
|
|
7935
|
+
}).strict(),
|
|
7936
|
+
object({ none: string().min(1) }).strict()
|
|
7937
|
+
]);
|
|
7938
|
+
/** The descriptor a generic entries UI reads (D881 "generic entries"). */
|
|
7939
|
+
var EntryDescriptorSchema = object({
|
|
7940
|
+
title: string().min(1),
|
|
7941
|
+
/** The record body field shown as the entry's name. */
|
|
7942
|
+
nameField: string().min(1),
|
|
7943
|
+
/** JSON Schema of the entry body; `secret: true` marks a password field. */
|
|
7944
|
+
fields: record(string(), unknown())
|
|
7945
|
+
}).strict();
|
|
7946
|
+
/** What crosses the wire and sits in the engine's catalog: JSON only, no Zod. */
|
|
7947
|
+
var RecordKindDeclarationSchema = object({
|
|
7948
|
+
database: _enum(RECORD_DATABASES).default("settings"),
|
|
7949
|
+
class: _enum(RECORD_CLASSES),
|
|
7950
|
+
writeTrigger: string().min(1),
|
|
7951
|
+
device: _enum([
|
|
7952
|
+
"required",
|
|
7953
|
+
"optional",
|
|
7954
|
+
"none"
|
|
7955
|
+
]).default("none"),
|
|
7956
|
+
at: _enum(["required", "none"]).default("none"),
|
|
7957
|
+
indexes: array(RecordIndexSchema).max(8).default([]),
|
|
7958
|
+
retention: RecordRetentionSchema,
|
|
7959
|
+
deviceRemoval: _enum(["delete", "none"]).default("none"),
|
|
7960
|
+
maxDataBytes: number().int().positive().max(RECORD_MAX_DATA_BYTES).default(RECORD_DEFAULT_MAX_DATA_BYTES),
|
|
7961
|
+
/** Derived from the Zod schema; never written by hand. */
|
|
7962
|
+
secretPaths: array(string().min(1)).default([]),
|
|
7963
|
+
/** The id key of each array that carries a secret (`{ headers: 'name' }`). */
|
|
7964
|
+
secretArrayKeys: record(string(), string()).default({}),
|
|
7965
|
+
/** The legacy table this kind adopts from; the boot guard reads it (D853: no migration code). */
|
|
7966
|
+
adoptsFrom: string().min(1).optional(),
|
|
7967
|
+
/** Kinds that must agree through `transact` sit in one file under one family name. */
|
|
7968
|
+
transactFamily: string().min(1).optional(),
|
|
7969
|
+
entry: EntryDescriptorSchema.optional()
|
|
7970
|
+
}).strict();
|
|
7971
|
+
/** The kind names: lower-case, dash separated, short enough for an index name. */
|
|
7972
|
+
var RecordKindNameSchema = string().regex(/^[a-z][a-z0-9-]{0,47}$/);
|
|
7713
7973
|
/** Shared Zod schemas used across streaming capabilities. */
|
|
7714
7974
|
var CamProfileSchema = _enum([
|
|
7715
7975
|
"high",
|
|
@@ -8174,69 +8434,6 @@ method(object({ deviceId: number() }), array(StreamSourceEntrySchema)), method(o
|
|
|
8174
8434
|
kind: "mutation",
|
|
8175
8435
|
auth: "admin"
|
|
8176
8436
|
}), method(object({ deviceId: number() }), unknown().nullable()), method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" });
|
|
8177
|
-
function defOf(schema) {
|
|
8178
|
-
return schema._zod?.def ?? {};
|
|
8179
|
-
}
|
|
8180
|
-
function declaredHere(schema) {
|
|
8181
|
-
return globalRegistry.get(schema)?.secret === true;
|
|
8182
|
-
}
|
|
8183
|
-
/** Wrapper kinds whose `innerType` is the field itself. */
|
|
8184
|
-
var WRAPPERS = new Set([
|
|
8185
|
-
"optional",
|
|
8186
|
-
"nullable",
|
|
8187
|
-
"default",
|
|
8188
|
-
"prefault",
|
|
8189
|
-
"catch",
|
|
8190
|
-
"readonly",
|
|
8191
|
-
"nonoptional"
|
|
8192
|
-
]);
|
|
8193
|
-
/**
|
|
8194
|
-
* The schema layers that make up ONE field: the schema itself and every
|
|
8195
|
-
* wrapper below it (optional / default / nullable / readonly / catch), plus
|
|
8196
|
-
* both sides of a pipe (`z.preprocess` puts the real schema on `out`,
|
|
8197
|
-
* `.transform` on `in`).
|
|
8198
|
-
*/
|
|
8199
|
-
function layersOf(schema) {
|
|
8200
|
-
const out = [];
|
|
8201
|
-
const queue = [schema];
|
|
8202
|
-
while (queue.length > 0) {
|
|
8203
|
-
const s = queue.shift();
|
|
8204
|
-
if (!s || out.includes(s)) continue;
|
|
8205
|
-
out.push(s);
|
|
8206
|
-
const def = defOf(s);
|
|
8207
|
-
if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
|
|
8208
|
-
if (def.type === "pipe") {
|
|
8209
|
-
if (def.in) queue.push(def.in);
|
|
8210
|
-
if (def.out) queue.push(def.out);
|
|
8211
|
-
}
|
|
8212
|
-
}
|
|
8213
|
-
return out;
|
|
8214
|
-
}
|
|
8215
|
-
/** True when any layer of this field declares `.meta({ secret: true })`. */
|
|
8216
|
-
function isZodSecret(schema) {
|
|
8217
|
-
return layersOf(schema).some(declaredHere);
|
|
8218
|
-
}
|
|
8219
|
-
/**
|
|
8220
|
-
* Every declared secret path in a config schema: dotted keys, `[]` for "each
|
|
8221
|
-
* element of this array" (`connection.password`, `rows[].token`). A declared
|
|
8222
|
-
* object or array is reported as one path and not descended into — everything
|
|
8223
|
-
* under it is secret.
|
|
8224
|
-
*/
|
|
8225
|
-
function collectZodSecretPaths(schema, prefix = "") {
|
|
8226
|
-
if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
|
|
8227
|
-
const paths = [];
|
|
8228
|
-
for (const layer of layersOf(schema)) {
|
|
8229
|
-
const def = defOf(layer);
|
|
8230
|
-
if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
|
|
8231
|
-
else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
|
|
8232
|
-
else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
|
|
8233
|
-
else if (def.type === "intersection") {
|
|
8234
|
-
if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
|
|
8235
|
-
if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
|
|
8236
|
-
}
|
|
8237
|
-
}
|
|
8238
|
-
return [...new Set(paths)];
|
|
8239
|
-
}
|
|
8240
8437
|
object({
|
|
8241
8438
|
code: string().regex(/^[a-z][a-z0-9-]*(\.[a-z0-9-]+)+$/),
|
|
8242
8439
|
params: record(string(), union([string(), number()])).optional()
|
|
@@ -8256,7 +8453,7 @@ function userError(code, params, englishFallback) {
|
|
|
8256
8453
|
return new CamstackError(code, params, englishFallback);
|
|
8257
8454
|
}
|
|
8258
8455
|
//#endregion
|
|
8259
|
-
//#region ../types/dist/err-msg
|
|
8456
|
+
//#region ../types/dist/err-msg--2RrYiLO.mjs
|
|
8260
8457
|
var DeviceType = /* @__PURE__ */ function(DeviceType) {
|
|
8261
8458
|
DeviceType["Camera"] = "camera";
|
|
8262
8459
|
DeviceType["Hub"] = "hub";
|
|
@@ -8525,6 +8722,9 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
|
|
|
8525
8722
|
/** Virtual HA toggle (input_boolean.*) — distinguishable from a
|
|
8526
8723
|
* real Switch device for UI rendering / export adapters. */
|
|
8527
8724
|
DeviceRole["BinaryHelper"] = "binary-helper";
|
|
8725
|
+
/** A smart plug: a `switch` whose source says it is an outlet (HA
|
|
8726
|
+
* `device_class: outlet`). The Alexa export shows it as a SMARTPLUG. */
|
|
8727
|
+
DeviceRole["Outlet"] = "outlet";
|
|
8528
8728
|
/** Generic motion / occupancy / moving event source. Distinct from
|
|
8529
8729
|
* the camera accessory PirSensor role: that one is a camera child;
|
|
8530
8730
|
* this is a standalone HA / 3rd-party motion sensor. */
|
|
@@ -8592,7 +8792,7 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
|
|
|
8592
8792
|
return DeviceRole;
|
|
8593
8793
|
}({});
|
|
8594
8794
|
//#endregion
|
|
8595
|
-
//#region ../types/dist/composition-
|
|
8795
|
+
//#region ../types/dist/composition-DOwQB_Ua.mjs
|
|
8596
8796
|
/**
|
|
8597
8797
|
* The ffmpeg build every CamStack node downloads, per platform and arch.
|
|
8598
8798
|
*
|
|
@@ -11816,11 +12016,10 @@ var ClipModelMetaSchema = object({
|
|
|
11816
12016
|
/**
|
|
11817
12017
|
* The `vector-store` index this model's vectors live in. ONE feature space
|
|
11818
12018
|
* per index: two models share an index only when their vectors are ranked
|
|
11819
|
-
* against each other, which for CLIP means never across families.
|
|
11820
|
-
*
|
|
11821
|
-
* `modelId`); any other model gets its own.
|
|
12019
|
+
* against each other, which for CLIP means never across families. Every
|
|
12020
|
+
* model gets its own.
|
|
11822
12021
|
*/
|
|
11823
|
-
vectorIndex: string().regex(/^object-clip
|
|
12022
|
+
vectorIndex: string().regex(/^object-clip-[a-z0-9][a-z0-9-]*$/),
|
|
11824
12023
|
/**
|
|
11825
12024
|
* The text encoder's tokenizer, a declared SIBLING file of its onnx. The name
|
|
11826
12025
|
* must be unique per tokenizer: every model's siblings land in ONE flat
|
|
@@ -15553,6 +15752,41 @@ var ComposableCapabilitiesSchema = object({ caps: array(object({
|
|
|
15553
15752
|
keyField: string()
|
|
15554
15753
|
}).optional()
|
|
15555
15754
|
})) });
|
|
15755
|
+
/**
|
|
15756
|
+
* The report of a one-shot "move this owner's plaintext secrets into the
|
|
15757
|
+
* keychain" run (D878). COUNTS only - never a value, never a ref.
|
|
15758
|
+
*
|
|
15759
|
+
* The owner runs it on its own rows, through its own write path; an operator
|
|
15760
|
+
* script (`scripts/hub/migrate-raw-secrets.ts`) calls the owner's cap method.
|
|
15761
|
+
* Dry run (`apply: false`) reports what WOULD move and changes nothing.
|
|
15762
|
+
*/
|
|
15763
|
+
var RawSecretMigrationInputSchema = object({
|
|
15764
|
+
/** `false` (the default of the script) = report only. */
|
|
15765
|
+
apply: boolean() });
|
|
15766
|
+
var RawSecretMigrationReportSchema = object({
|
|
15767
|
+
apply: boolean(),
|
|
15768
|
+
/** Rows that can carry a secret (a profile, an enrolment). */
|
|
15769
|
+
rows: number().int(),
|
|
15770
|
+
/** Rows whose secret was plaintext when the run started. */
|
|
15771
|
+
raw: number().int(),
|
|
15772
|
+
/** Rows that already held a keychain marker when the run started. */
|
|
15773
|
+
markers: number().int(),
|
|
15774
|
+
/** Plaintext rows moved by THIS run (always 0 on a dry run). */
|
|
15775
|
+
migrated: number().int(),
|
|
15776
|
+
/** Plaintext rows left in place because the move or its read-back failed. */
|
|
15777
|
+
failed: number().int(),
|
|
15778
|
+
/** After the run: rows still holding plaintext. */
|
|
15779
|
+
remainingRaw: number().int(),
|
|
15780
|
+
/** After the run: markers the keychain could not resolve right now. */
|
|
15781
|
+
unresolvedMarkers: number().int(),
|
|
15782
|
+
/**
|
|
15783
|
+
* A second, redundant copy of the secrets' rows that the run found (and, on
|
|
15784
|
+
* `apply`, deleted after verifying the first). Owners with a single copy omit it.
|
|
15785
|
+
*/
|
|
15786
|
+
redundantCopies: number().int().optional(),
|
|
15787
|
+
/** True when nothing is raw and every marker resolves. */
|
|
15788
|
+
verified: boolean()
|
|
15789
|
+
});
|
|
15556
15790
|
/** Where a block runs. The operator chooses — a block driving a device on an
|
|
15557
15791
|
* agent is the reason placement is not fixed to the hub. */
|
|
15558
15792
|
var CoreBlockPlacementSchema = union([literal("hub"), string().min(1)]);
|
|
@@ -15779,6 +16013,9 @@ method(object({}), object({ blocks: array(CoreBlockSchema) }), { auth: "admin" }
|
|
|
15779
16013
|
}), SettingsUpdateResultSchema, {
|
|
15780
16014
|
kind: "mutation",
|
|
15781
16015
|
auth: "admin"
|
|
16016
|
+
}), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
|
|
16017
|
+
kind: "mutation",
|
|
16018
|
+
auth: "admin"
|
|
15782
16019
|
}), method(object({}), object({ libs: array(object({
|
|
15783
16020
|
filePath: string(),
|
|
15784
16021
|
content: string()
|
|
@@ -16042,6 +16279,347 @@ id: union([string(), number()]) }), {
|
|
|
16042
16279
|
auth: "admin"
|
|
16043
16280
|
});
|
|
16044
16281
|
/**
|
|
16282
|
+
* records - an addon's own facts and documents (D881): ledgers, audit rows,
|
|
16283
|
+
* config documents, mirrors. The third storage API next to `ctx.settings`
|
|
16284
|
+
* (operator intent, D870) and device-history (numbers over time, D850).
|
|
16285
|
+
*
|
|
16286
|
+
* Who the OWNER is: `callerAddonId`, stamped by the transport on a call that
|
|
16287
|
+
* crossed a process and stated by a hub in-process caller (`ctx.records` does
|
|
16288
|
+
* that with the addon id closed over). It is deliberately NOT in any input
|
|
16289
|
+
* schema, so a session can never supply it, and a call with no stamp is refused
|
|
16290
|
+
* `records/no-caller`. A kind is readable and writable only by its owner; other
|
|
16291
|
+
* addons go through the owner's capability.
|
|
16292
|
+
*
|
|
16293
|
+
* Every read is three-way: a row, `null`, or the call THROWS. A failed read is
|
|
16294
|
+
* never `[]`. Secret fields are never on the wire: a read shows the
|
|
16295
|
+
* redaction token, `secretRefs` hands the owner's `ctx.secrets` the refs it
|
|
16296
|
+
* resolves itself, and a write may carry only a keychain marker bound to the
|
|
16297
|
+
* row's own ref.
|
|
16298
|
+
*
|
|
16299
|
+
* Internal: addons reach it through `ctx.records`, never directly.
|
|
16300
|
+
*/
|
|
16301
|
+
var RecordIdSchema = string().min(1).max(256);
|
|
16302
|
+
/** A JSON object body. Size is the engine's check (`maxDataBytes`), not a schema's. */
|
|
16303
|
+
var RecordBodySchema = record(string(), unknown());
|
|
16304
|
+
var RecordInputSchema = object({
|
|
16305
|
+
id: RecordIdSchema,
|
|
16306
|
+
/** The device this row belongs to (D865 removal, per-device reads). */
|
|
16307
|
+
deviceId: number().int().optional(),
|
|
16308
|
+
/** The domain clock, ms: observed / created / opened. */
|
|
16309
|
+
at: number().int().optional(),
|
|
16310
|
+
/** Producer-set expiry, ms. Refused on a kind whose retention is an engine TTL. */
|
|
16311
|
+
expiresAt: number().int().optional(),
|
|
16312
|
+
data: RecordBodySchema
|
|
16313
|
+
});
|
|
16314
|
+
var RecordViewSchema = object({
|
|
16315
|
+
id: string(),
|
|
16316
|
+
deviceId: number().int().nullable(),
|
|
16317
|
+
at: number().nullable(),
|
|
16318
|
+
expiresAt: number().nullable(),
|
|
16319
|
+
rev: number().int(),
|
|
16320
|
+
updatedAt: number(),
|
|
16321
|
+
data: RecordBodySchema
|
|
16322
|
+
});
|
|
16323
|
+
/** Declared index fields only. Anything else does not compile, by design. */
|
|
16324
|
+
var RecordWhereSchema = record(RecordFieldPathSchema, union([
|
|
16325
|
+
string(),
|
|
16326
|
+
number(),
|
|
16327
|
+
boolean(),
|
|
16328
|
+
object({ in: array(union([
|
|
16329
|
+
string(),
|
|
16330
|
+
number(),
|
|
16331
|
+
boolean()
|
|
16332
|
+
])).min(1).max(RECORD_BATCH_MAX) }),
|
|
16333
|
+
object({
|
|
16334
|
+
gt: union([string(), number()]).optional(),
|
|
16335
|
+
gte: union([string(), number()]).optional(),
|
|
16336
|
+
lt: union([string(), number()]).optional(),
|
|
16337
|
+
lte: union([string(), number()]).optional()
|
|
16338
|
+
}).refine((r) => Object.keys(r).length > 0, { message: "name at least one bound" })
|
|
16339
|
+
]));
|
|
16340
|
+
var KindShape = { kind: RecordKindNameSchema };
|
|
16341
|
+
var TimeWindowShape = {
|
|
16342
|
+
deviceId: number().int().optional(),
|
|
16343
|
+
atFrom: number().optional(),
|
|
16344
|
+
atTo: number().optional()
|
|
16345
|
+
};
|
|
16346
|
+
var RecordQueryInputSchema = object({
|
|
16347
|
+
...KindShape,
|
|
16348
|
+
...TimeWindowShape,
|
|
16349
|
+
where: RecordWhereSchema.optional(),
|
|
16350
|
+
/** Without `where`: `at` (default for a kind with a clock) or `id`. With `where` the order is the index's. */
|
|
16351
|
+
order: _enum(["at", "id"]).optional(),
|
|
16352
|
+
desc: boolean().optional(),
|
|
16353
|
+
limit: number().int().min(1).max(RECORD_QUERY_MAX).default(100),
|
|
16354
|
+
/** Opaque keyset cursor from a previous answer. There is no offset. */
|
|
16355
|
+
cursor: string().min(1).optional()
|
|
16356
|
+
});
|
|
16357
|
+
var RecordQueryResultSchema = object({
|
|
16358
|
+
records: array(RecordViewSchema),
|
|
16359
|
+
nextCursor: string().nullable()
|
|
16360
|
+
});
|
|
16361
|
+
var RecordKindStateSchema = _enum([
|
|
16362
|
+
"created",
|
|
16363
|
+
"unchanged",
|
|
16364
|
+
"updated"
|
|
16365
|
+
]);
|
|
16366
|
+
var DeclareKindResultSchema = object({
|
|
16367
|
+
kindId: number().int(),
|
|
16368
|
+
state: RecordKindStateSchema,
|
|
16369
|
+
createdIndexes: array(string()),
|
|
16370
|
+
/** The boot guard: the kind is empty while its legacy table still holds rows. */
|
|
16371
|
+
adoptionPending: object({
|
|
16372
|
+
legacyTable: string(),
|
|
16373
|
+
legacyRows: number().int()
|
|
16374
|
+
}).nullable()
|
|
16375
|
+
});
|
|
16376
|
+
/** Keychain refs a write released (the old marker is gone from the row): the owner deletes the values. */
|
|
16377
|
+
var SecretRefsList = array(string());
|
|
16378
|
+
var RecordSecretRefsSchema = record(string(), record(string(), string()));
|
|
16379
|
+
method(object({ kinds: record(RecordKindNameSchema, RecordKindDeclarationSchema) }), object({ kinds: record(string(), DeclareKindResultSchema) }), {
|
|
16380
|
+
kind: "mutation",
|
|
16381
|
+
auth: "admin"
|
|
16382
|
+
}), method(object({
|
|
16383
|
+
...KindShape,
|
|
16384
|
+
id: RecordIdSchema
|
|
16385
|
+
}), RecordViewSchema.nullable(), { auth: "admin" }), method(object({
|
|
16386
|
+
...KindShape,
|
|
16387
|
+
ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
|
|
16388
|
+
}), array(RecordViewSchema), { auth: "admin" }), method(object({
|
|
16389
|
+
...KindShape,
|
|
16390
|
+
ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
|
|
16391
|
+
}), RecordSecretRefsSchema, { auth: "admin" }), method(object({
|
|
16392
|
+
...KindShape,
|
|
16393
|
+
record: RecordInputSchema,
|
|
16394
|
+
/** Compare-and-set. `0` means "the row must not exist". */
|
|
16395
|
+
ifRev: number().int().min(0).optional()
|
|
16396
|
+
}), object({
|
|
16397
|
+
rev: number().int(),
|
|
16398
|
+
releasedRefs: SecretRefsList
|
|
16399
|
+
}), {
|
|
16400
|
+
kind: "mutation",
|
|
16401
|
+
auth: "admin"
|
|
16402
|
+
}), method(object({
|
|
16403
|
+
...KindShape,
|
|
16404
|
+
records: array(RecordInputSchema).min(1).max(RECORD_BATCH_MAX)
|
|
16405
|
+
}), object({
|
|
16406
|
+
count: number().int(),
|
|
16407
|
+
releasedRefs: SecretRefsList
|
|
16408
|
+
}), {
|
|
16409
|
+
kind: "mutation",
|
|
16410
|
+
auth: "admin"
|
|
16411
|
+
}), method(object({
|
|
16412
|
+
...KindShape,
|
|
16413
|
+
id: RecordIdSchema,
|
|
16414
|
+
data: RecordBodySchema,
|
|
16415
|
+
at: number().int().nullable().optional(),
|
|
16416
|
+
expiresAt: number().int().nullable().optional(),
|
|
16417
|
+
ifRev: number().int().min(1).optional()
|
|
16418
|
+
}), object({
|
|
16419
|
+
rev: number().int(),
|
|
16420
|
+
releasedRefs: SecretRefsList
|
|
16421
|
+
}), {
|
|
16422
|
+
kind: "mutation",
|
|
16423
|
+
auth: "admin"
|
|
16424
|
+
}), method(object({
|
|
16425
|
+
...KindShape,
|
|
16426
|
+
id: RecordIdSchema
|
|
16427
|
+
}), object({
|
|
16428
|
+
deleted: boolean(),
|
|
16429
|
+
secretRefs: SecretRefsList
|
|
16430
|
+
}), {
|
|
16431
|
+
kind: "mutation",
|
|
16432
|
+
auth: "admin"
|
|
16433
|
+
}), method(object({
|
|
16434
|
+
...KindShape,
|
|
16435
|
+
ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
|
|
16436
|
+
}), object({
|
|
16437
|
+
deleted: number().int(),
|
|
16438
|
+
secretRefs: SecretRefsList
|
|
16439
|
+
}), {
|
|
16440
|
+
kind: "mutation",
|
|
16441
|
+
auth: "admin"
|
|
16442
|
+
}), method(RecordQueryInputSchema, RecordQueryResultSchema, { auth: "admin" }), method(object({
|
|
16443
|
+
...KindShape,
|
|
16444
|
+
...TimeWindowShape,
|
|
16445
|
+
where: RecordWhereSchema.optional()
|
|
16446
|
+
}), object({ count: number().int() }), { auth: "admin" }), method(object({
|
|
16447
|
+
...KindShape,
|
|
16448
|
+
deviceId: number().int().optional(),
|
|
16449
|
+
from: number(),
|
|
16450
|
+
to: number(),
|
|
16451
|
+
bucketMs: number().int().positive()
|
|
16452
|
+
}), object({ buckets: array(object({
|
|
16453
|
+
bucketStart: number(),
|
|
16454
|
+
count: number().int()
|
|
16455
|
+
})) }), { auth: "admin" }), method(object({
|
|
16456
|
+
...KindShape,
|
|
16457
|
+
op: _enum([
|
|
16458
|
+
"sum",
|
|
16459
|
+
"min",
|
|
16460
|
+
"max",
|
|
16461
|
+
"count"
|
|
16462
|
+
]),
|
|
16463
|
+
field: RecordFieldPathSchema.optional(),
|
|
16464
|
+
groupBy: RecordFieldPathSchema.optional(),
|
|
16465
|
+
where: RecordWhereSchema.optional()
|
|
16466
|
+
}), object({ rows: array(object({
|
|
16467
|
+
group: union([
|
|
16468
|
+
string(),
|
|
16469
|
+
number(),
|
|
16470
|
+
_null()
|
|
16471
|
+
]),
|
|
16472
|
+
value: number().nullable()
|
|
16473
|
+
})) }), { auth: "admin" }), method(object({
|
|
16474
|
+
...KindShape,
|
|
16475
|
+
deviceId: number().int().optional(),
|
|
16476
|
+
atBefore: number().optional(),
|
|
16477
|
+
where: RecordWhereSchema.optional()
|
|
16478
|
+
}), object({
|
|
16479
|
+
deleted: number().int(),
|
|
16480
|
+
secretRefs: SecretRefsList
|
|
16481
|
+
}), {
|
|
16482
|
+
kind: "mutation",
|
|
16483
|
+
auth: "admin"
|
|
16484
|
+
}), method(object({
|
|
16485
|
+
deviceId: number().int(),
|
|
16486
|
+
kinds: array(RecordKindNameSchema).optional()
|
|
16487
|
+
}), object({
|
|
16488
|
+
deleted: record(string(), number().int()),
|
|
16489
|
+
secretRefs: SecretRefsList
|
|
16490
|
+
}), {
|
|
16491
|
+
kind: "mutation",
|
|
16492
|
+
auth: "admin"
|
|
16493
|
+
}), method(object(KindShape), object({ id: number().int() }), {
|
|
16494
|
+
kind: "mutation",
|
|
16495
|
+
auth: "admin"
|
|
16496
|
+
});
|
|
16497
|
+
/** One table of the settings database. */
|
|
16498
|
+
var StorageTableSchema = object({
|
|
16499
|
+
/** The table's full name, e.g. `recorder:addon-settings` or `addon-device-settings`. */
|
|
16500
|
+
name: string(),
|
|
16501
|
+
/** The owner prefix of a scoped name (`recorder` for `recorder:addon-settings`), else null. */
|
|
16502
|
+
owner: string().nullable(),
|
|
16503
|
+
rows: number().int().nonnegative(),
|
|
16504
|
+
/** Bytes the table's pages occupy (`dbstat`); null when the engine cannot measure. */
|
|
16505
|
+
bytes: number().int().nonnegative().nullable(),
|
|
16506
|
+
/** Declared by an addon since this engine process started (a running addon claims it). */
|
|
16507
|
+
declaredThisBoot: boolean()
|
|
16508
|
+
});
|
|
16509
|
+
/** One declared record kind (D881) as System -> Data shows it. */
|
|
16510
|
+
var StorageKindSchema = object({
|
|
16511
|
+
owner: string(),
|
|
16512
|
+
kind: string(),
|
|
16513
|
+
database: _enum(["settings", "events"]),
|
|
16514
|
+
class: string(),
|
|
16515
|
+
state: _enum([
|
|
16516
|
+
"declared",
|
|
16517
|
+
"orphaned",
|
|
16518
|
+
"dropped"
|
|
16519
|
+
]),
|
|
16520
|
+
/** `null` when the caller asked for no counts (`counts: false`). */
|
|
16521
|
+
rows: number().int().nonnegative().nullable(),
|
|
16522
|
+
/** Rows x the average size of a sample; null for an empty kind. */
|
|
16523
|
+
bytesEstimate: number().int().nonnegative().nullable(),
|
|
16524
|
+
writeTrigger: string(),
|
|
16525
|
+
retention: RecordRetentionSchema,
|
|
16526
|
+
/** `true` when the kind is an entry kind (the generic entries UI lists it). */
|
|
16527
|
+
entry: boolean(),
|
|
16528
|
+
/** The whole declaration, secret paths and entry descriptor included (the entries service builds its handle from it). */
|
|
16529
|
+
declaration: RecordKindDeclarationSchema
|
|
16530
|
+
});
|
|
16531
|
+
method(object({ ownerPrefix: string().min(1).optional() }), object({ tables: array(StorageTableSchema) }), { auth: "admin" }), method(object({
|
|
16532
|
+
collection: string().min(1),
|
|
16533
|
+
expectRows: number().int().nonnegative()
|
|
16534
|
+
}), object({
|
|
16535
|
+
dropped: literal(true),
|
|
16536
|
+
rows: number().int().nonnegative()
|
|
16537
|
+
}), {
|
|
16538
|
+
kind: "mutation",
|
|
16539
|
+
auth: "admin"
|
|
16540
|
+
}), method(object({
|
|
16541
|
+
owner: string().min(1).optional(),
|
|
16542
|
+
/** `false` skips the per-kind row count (a catalog read only). Default true. */
|
|
16543
|
+
counts: boolean().optional()
|
|
16544
|
+
}), object({ kinds: array(StorageKindSchema) }), { auth: "admin" }), method(RecordQueryInputSchema.extend({
|
|
16545
|
+
owner: string().min(1),
|
|
16546
|
+
kind: RecordKindNameSchema
|
|
16547
|
+
}), RecordQueryResultSchema, { auth: "admin" }), method(object({
|
|
16548
|
+
owner: string().min(1),
|
|
16549
|
+
kind: RecordKindNameSchema,
|
|
16550
|
+
records: array(RecordInputSchema).max(RECORD_BATCH_MAX),
|
|
16551
|
+
/** The LAST batch: the copy is complete, the boot guard stops asking. */
|
|
16552
|
+
complete: boolean().optional()
|
|
16553
|
+
}).refine((input) => input.records.length > 0 || input.complete === true, { message: "records must be non-empty unless complete is true" }), object({ adopted: number().int() }), {
|
|
16554
|
+
kind: "mutation",
|
|
16555
|
+
auth: "admin"
|
|
16556
|
+
}), method(object({
|
|
16557
|
+
collection: string().min(1),
|
|
16558
|
+
cursor: string().optional(),
|
|
16559
|
+
limit: number().int().min(1).max(1e3).optional()
|
|
16560
|
+
}), object({
|
|
16561
|
+
rows: array(object({
|
|
16562
|
+
id: string(),
|
|
16563
|
+
data: record(string(), unknown())
|
|
16564
|
+
})),
|
|
16565
|
+
nextCursor: string().nullable()
|
|
16566
|
+
}), { auth: "admin" }), method(object({ collection: string().min(1) }), object({ adopted: boolean() }), { auth: "admin" });
|
|
16567
|
+
/**
|
|
16568
|
+
* record-entries - the ONE admin surface for every list of user-created entries
|
|
16569
|
+
* (D881): notification targets, brokers, LLM profiles, anything an addon
|
|
16570
|
+
* declares as an ENTRY kind (`entry: { title }` in `defineRecordKinds`).
|
|
16571
|
+
*
|
|
16572
|
+
* The UI is generic. `listEntryKinds` hands it, per kind, the JSON Schema of
|
|
16573
|
+
* the entry body with `secret: true` on every credential field, so a password
|
|
16574
|
+
* field is derived from the schema and never from a name. `putEntry` takes the
|
|
16575
|
+
* redaction token for an untouched secret (the stored value is kept), a string
|
|
16576
|
+
* for a new one, and the clear instruction to remove one. A read never carries
|
|
16577
|
+
* a secret value, and a locked keychain refuses the write with
|
|
16578
|
+
* `records/secret-unavailable` instead of storing plaintext.
|
|
16579
|
+
*
|
|
16580
|
+
* Hub-only, served in-process (it acts for each entry's owner on the keychain).
|
|
16581
|
+
*/
|
|
16582
|
+
var EntryKindInfoSchema = object({
|
|
16583
|
+
owner: string(),
|
|
16584
|
+
kind: RecordKindNameSchema,
|
|
16585
|
+
title: string(),
|
|
16586
|
+
nameField: string(),
|
|
16587
|
+
/** JSON Schema of the body; `secret: true` marks a password field. */
|
|
16588
|
+
fields: record(string(), unknown()),
|
|
16589
|
+
secretPaths: array(string()),
|
|
16590
|
+
rows: number().int().nonnegative()
|
|
16591
|
+
});
|
|
16592
|
+
var EntryViewSchema = object({
|
|
16593
|
+
id: RecordIdSchema,
|
|
16594
|
+
name: string(),
|
|
16595
|
+
rev: number().int(),
|
|
16596
|
+
updatedAt: number(),
|
|
16597
|
+
/** Secret fields hold the redaction token. */
|
|
16598
|
+
data: RecordBodySchema
|
|
16599
|
+
});
|
|
16600
|
+
var EntryAddress = {
|
|
16601
|
+
owner: string().min(1),
|
|
16602
|
+
kind: RecordKindNameSchema
|
|
16603
|
+
};
|
|
16604
|
+
method(object({}), object({ kinds: array(EntryKindInfoSchema) }), { auth: "admin" }), method(object({ ...EntryAddress }), object({ entries: array(EntryViewSchema) }), { auth: "admin" }), method(object({
|
|
16605
|
+
...EntryAddress,
|
|
16606
|
+
id: RecordIdSchema.optional(),
|
|
16607
|
+
data: RecordBodySchema,
|
|
16608
|
+
ifRev: number().int().min(1).optional()
|
|
16609
|
+
}), object({
|
|
16610
|
+
id: string(),
|
|
16611
|
+
rev: number().int()
|
|
16612
|
+
}), {
|
|
16613
|
+
kind: "mutation",
|
|
16614
|
+
auth: "admin"
|
|
16615
|
+
}), method(object({
|
|
16616
|
+
...EntryAddress,
|
|
16617
|
+
id: RecordIdSchema
|
|
16618
|
+
}), object({ deleted: boolean() }), {
|
|
16619
|
+
kind: "mutation",
|
|
16620
|
+
auth: "admin"
|
|
16621
|
+
});
|
|
16622
|
+
/**
|
|
16045
16623
|
* `keychain` — the hub's encrypted store of secret values (D787).
|
|
16046
16624
|
*
|
|
16047
16625
|
* Settings blobs never hold a secret: they hold a marker
|
|
@@ -16582,6 +17160,16 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
|
|
|
16582
17160
|
kind: "mutation",
|
|
16583
17161
|
auth: "admin",
|
|
16584
17162
|
caller: "required"
|
|
17163
|
+
}), method(object({
|
|
17164
|
+
ref: string().min(1),
|
|
17165
|
+
value: string().min(1)
|
|
17166
|
+
}), object({
|
|
17167
|
+
ref: string(),
|
|
17168
|
+
version: number().int()
|
|
17169
|
+
}), {
|
|
17170
|
+
kind: "mutation",
|
|
17171
|
+
auth: "admin",
|
|
17172
|
+
caller: "required"
|
|
16585
17173
|
}), method(object({ refs: array(string().min(1)).max(1e3) }), object({
|
|
16586
17174
|
deleted: array(string()).readonly(),
|
|
16587
17175
|
kept: array(object({
|
|
@@ -39356,6 +39944,9 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
|
|
|
39356
39944
|
}), _void(), { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
|
|
39357
39945
|
kind: "mutation",
|
|
39358
39946
|
auth: "admin"
|
|
39947
|
+
}), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
|
|
39948
|
+
kind: "mutation",
|
|
39949
|
+
auth: "admin"
|
|
39359
39950
|
}), method(ProfileRefInputSchema, _void(), {
|
|
39360
39951
|
kind: "mutation",
|
|
39361
39952
|
auth: "admin"
|
|
@@ -49865,6 +50456,41 @@ var ServerRollbackInfoSchema = object({
|
|
|
49865
50456
|
atMs: number(),
|
|
49866
50457
|
reason: string()
|
|
49867
50458
|
});
|
|
50459
|
+
/**
|
|
50460
|
+
* The runner boot check (D877): the runners this node PLANNED (hub: one per
|
|
50461
|
+
* `resolveRunnerId` over its forked addons; agent: the runners its process
|
|
50462
|
+
* service holds, because only the hub plans) against the states the process
|
|
50463
|
+
* service reports. Kept in memory, recomputed by the same one-shot check after
|
|
50464
|
+
* every boot, served on `getServerPackageStatus`.
|
|
50465
|
+
*
|
|
50466
|
+
* `failed` is the D6 breaker's terminal state, `refused` a deterministic Init
|
|
50467
|
+
* refusal (an addon that said "I will not start, and here is why"), `missing` a
|
|
50468
|
+
* planned runner the process service has no entry for.
|
|
50469
|
+
*/
|
|
50470
|
+
var RunnerRefusalSchema = object({
|
|
50471
|
+
runnerId: string(),
|
|
50472
|
+
addonIds: array(string()),
|
|
50473
|
+
reason: string()
|
|
50474
|
+
});
|
|
50475
|
+
var RunnerBootCheckSchema = object({
|
|
50476
|
+
checkedAtMs: number(),
|
|
50477
|
+
/** Runners planned for this node. */
|
|
50478
|
+
expected: number(),
|
|
50479
|
+
/** Planned runners whose process is `running`. */
|
|
50480
|
+
running: number(),
|
|
50481
|
+
failed: array(string()),
|
|
50482
|
+
refused: array(RunnerRefusalSchema),
|
|
50483
|
+
missing: array(string()),
|
|
50484
|
+
/**
|
|
50485
|
+
* Runners still on their way: `starting`, or `crashed` waiting on a backoff
|
|
50486
|
+
* respawn. The check is FINAL only when this is empty; until then nothing is
|
|
50487
|
+
* pushed and the verdict is re-evaluated on the next runner state change.
|
|
50488
|
+
* Optional for version skew (absent = settled).
|
|
50489
|
+
*/
|
|
50490
|
+
pending: array(string()).optional(),
|
|
50491
|
+
/** True when the plan is the hub's (`missing` is then meaningful); false on an agent. */
|
|
50492
|
+
planKnown: boolean()
|
|
50493
|
+
});
|
|
49868
50494
|
var ServerPackageStatusSchema = object({
|
|
49869
50495
|
/** Root package name (`@camstack/server` on the hub). */
|
|
49870
50496
|
packageName: string(),
|
|
@@ -49927,7 +50553,14 @@ var ServerPackageStatusSchema = object({
|
|
|
49927
50553
|
* for version skew: an older provider's payload simply omits it, and an
|
|
49928
50554
|
* absent wrapper is unknown — never `native`.
|
|
49929
50555
|
*/
|
|
49930
|
-
wrapper: WrapperIdentitySchema.optional()
|
|
50556
|
+
wrapper: WrapperIdentitySchema.optional(),
|
|
50557
|
+
/**
|
|
50558
|
+
* What this node PLANNED to run against what its process service reports
|
|
50559
|
+
* (D877). Absent until the one-shot boot check has run (~60 s after boot) and
|
|
50560
|
+
* on a provider that predates it. Absent is "not checked yet", never "all
|
|
50561
|
+
* well": a consumer that needs the answer treats it as pending.
|
|
50562
|
+
*/
|
|
50563
|
+
runners: RunnerBootCheckSchema.optional()
|
|
49931
50564
|
});
|
|
49932
50565
|
var ServerUpdateCheckResultSchema = object({
|
|
49933
50566
|
packageName: string(),
|
|
@@ -49978,6 +50611,13 @@ var ServerUpdateOutcomeSchema = _enum([
|
|
|
49978
50611
|
"refused",
|
|
49979
50612
|
"failed"
|
|
49980
50613
|
]);
|
|
50614
|
+
/** One addon the pre-flight found the target version would refuse (D877). */
|
|
50615
|
+
var UpdateBlockerSchema = object({
|
|
50616
|
+
addonId: string(),
|
|
50617
|
+
reason: string(),
|
|
50618
|
+
/** What the operator does about it. */
|
|
50619
|
+
remedy: string()
|
|
50620
|
+
});
|
|
49981
50621
|
var ServerUpdateActionResultSchema = object({
|
|
49982
50622
|
accepted: boolean(),
|
|
49983
50623
|
targetVersion: string().nullable(),
|
|
@@ -49995,14 +50635,27 @@ var ServerUpdateActionResultSchema = object({
|
|
|
49995
50635
|
* The failure itself, verbatim enough to act on (the npm output for a
|
|
49996
50636
|
* staging install). Non-null only for `failed`.
|
|
49997
50637
|
*/
|
|
49998
|
-
error: string().nullable().optional()
|
|
50638
|
+
error: string().nullable().optional(),
|
|
50639
|
+
/**
|
|
50640
|
+
* The addons the target version would refuse to start on this node's live
|
|
50641
|
+
* store (D877), present when the pre-flight refused the update
|
|
50642
|
+
* (`reason: 'addon-would-refuse'`). Optional for version skew.
|
|
50643
|
+
*/
|
|
50644
|
+
blockers: array(UpdateBlockerSchema).optional()
|
|
49999
50645
|
});
|
|
50000
50646
|
method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), ServerUpdateCheckResultSchema, {
|
|
50001
50647
|
kind: "mutation",
|
|
50002
50648
|
auth: "admin"
|
|
50003
|
-
}), method(object({
|
|
50004
|
-
/** Explicit target version; omitted = latest from the registry. */
|
|
50005
|
-
version: string().optional()
|
|
50649
|
+
}), method(object({
|
|
50650
|
+
/** Explicit target version; omitted = latest from the registry. */
|
|
50651
|
+
version: string().optional(),
|
|
50652
|
+
/**
|
|
50653
|
+
* Apply even though the pre-flight (D877) found addons the target would
|
|
50654
|
+
* refuse to start. Off by default: those addons stay down until the
|
|
50655
|
+
* remedy is run, which is the incident this gate exists to prevent.
|
|
50656
|
+
*/
|
|
50657
|
+
acknowledgeRefusals: boolean().optional()
|
|
50658
|
+
}), ServerUpdateActionResultSchema, {
|
|
50006
50659
|
kind: "mutation",
|
|
50007
50660
|
auth: "admin",
|
|
50008
50661
|
timeoutMs: 16 * 6e4
|
|
@@ -52961,7 +53614,9 @@ var ManifestShapeSchema = object({
|
|
|
52961
53614
|
var AddonProcessSchema = object({
|
|
52962
53615
|
pid: number().optional(),
|
|
52963
53616
|
mode: string(),
|
|
52964
|
-
state: string()
|
|
53617
|
+
state: string(),
|
|
53618
|
+
/** Why the runner is `refused` (an addon's own words), when it is (D877). */
|
|
53619
|
+
reason: string().optional()
|
|
52965
53620
|
});
|
|
52966
53621
|
/**
|
|
52967
53622
|
* Per-addon health snapshot from the kernel's AddonHealthMonitor.
|
|
@@ -54350,6 +55005,12 @@ var ClimateControlStatusSchema = object({
|
|
|
54350
55005
|
/** Horizontal louver swing on/off. Null when the device has no
|
|
54351
55006
|
* horizontal swing surface (gate with `DeviceFeature.ClimateSwingHorizontal`). */
|
|
54352
55007
|
swingHorizontal: boolean().nullable(),
|
|
55008
|
+
/** Lowest setpoint the device accepts, Celsius. Absent / null = not reported. */
|
|
55009
|
+
minTemp: number().nullable().optional(),
|
|
55010
|
+
/** Highest setpoint the device accepts, Celsius. Absent / null = not reported. */
|
|
55011
|
+
maxTemp: number().nullable().optional(),
|
|
55012
|
+
/** Setpoint granularity, Celsius (0.5, 1). Absent / null = not reported. */
|
|
55013
|
+
tempStep: number().positive().nullable().optional(),
|
|
54353
55014
|
/** Ms epoch when the slice was last updated (push or command). */
|
|
54354
55015
|
lastFetchedAt: number()
|
|
54355
55016
|
});
|
|
@@ -57130,7 +57791,19 @@ var TlsStatusSchema = object({
|
|
|
57130
57791
|
sans: array(string()),
|
|
57131
57792
|
caCertPem: string().nullable(),
|
|
57132
57793
|
reissueError: string().nullable(),
|
|
57133
|
-
restartRequired: boolean()
|
|
57794
|
+
restartRequired: boolean(),
|
|
57795
|
+
/** An uploaded certificate is served but no CA is kept for it and it is not publicly signed (D873). */
|
|
57796
|
+
caMissing: boolean(),
|
|
57797
|
+
/** Does the hub's own generated CA carry a critical name constraint? `null` while it has none. */
|
|
57798
|
+
localCaConstrained: boolean().nullable(),
|
|
57799
|
+
/** ISO time the generated CA was replaced by a constrained one; devices must re-download it. */
|
|
57800
|
+
caReplacedAt: string().nullable(),
|
|
57801
|
+
/** The uploaded certificate kept on disk, selectable again after "Revert to generated". */
|
|
57802
|
+
storedUpload: object({
|
|
57803
|
+
leafFingerprintSha256: string(),
|
|
57804
|
+
validTo: string(),
|
|
57805
|
+
hasCa: boolean()
|
|
57806
|
+
}).nullable()
|
|
57134
57807
|
});
|
|
57135
57808
|
method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(object({
|
|
57136
57809
|
/**
|
|
@@ -57186,6 +57859,9 @@ method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(obje
|
|
|
57186
57859
|
}), method(_void(), object({ pem: string() })), method(_void(), TlsStatusSchema, {
|
|
57187
57860
|
kind: "mutation",
|
|
57188
57861
|
auth: "admin"
|
|
57862
|
+
}), method(_void(), TlsStatusSchema, {
|
|
57863
|
+
kind: "mutation",
|
|
57864
|
+
auth: "admin"
|
|
57189
57865
|
});
|
|
57190
57866
|
var LockControlStatusSchema = object({
|
|
57191
57867
|
/** Lifecycle state of the lock. `jammed` means the motor reported
|
|
@@ -64141,7 +64817,11 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
64141
64817
|
kind: "mutation",
|
|
64142
64818
|
auth: "admin",
|
|
64143
64819
|
access: "delete"
|
|
64144
|
-
}), method(object({ userId: string() }), TotpStatusSchema, { auth: "admin" }), method(
|
|
64820
|
+
}), method(object({ userId: string() }), TotpStatusSchema, { auth: "admin" }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
|
|
64821
|
+
kind: "mutation",
|
|
64822
|
+
auth: "admin",
|
|
64823
|
+
access: "create"
|
|
64824
|
+
}), method(object({
|
|
64145
64825
|
userId: string(),
|
|
64146
64826
|
code: string()
|
|
64147
64827
|
}), object({ valid: boolean() }), {
|
|
@@ -65953,13 +66633,14 @@ var BaseDevice = class {
|
|
|
65953
66633
|
get state() {
|
|
65954
66634
|
if (!this._stateProxyCache) {
|
|
65955
66635
|
const cache = {};
|
|
65956
|
-
const handler = { get: (
|
|
66636
|
+
const handler = { get: (target, key) => {
|
|
65957
66637
|
const k = key;
|
|
65958
|
-
|
|
66638
|
+
const existing = Reflect.get(target, k);
|
|
66639
|
+
if (existing !== void 0) return existing;
|
|
65959
66640
|
const cap = DEVICE_LOCAL_STATE_CAPS[k];
|
|
65960
66641
|
if (!cap) return void 0;
|
|
65961
66642
|
const proxy = this.sliceProxy(cap);
|
|
65962
|
-
|
|
66643
|
+
Reflect.set(target, k, proxy);
|
|
65963
66644
|
return proxy;
|
|
65964
66645
|
} };
|
|
65965
66646
|
this._stateProxyCache = new Proxy(cache, handler);
|
|
@@ -66158,7 +66839,7 @@ var BaseDevice = class {
|
|
|
66158
66839
|
async updateSourceInfo(patch) {
|
|
66159
66840
|
const next = mergeSourceInfo(this.sourceInfo, patch);
|
|
66160
66841
|
this._sourceInfoCache = Object.freeze({ ...next });
|
|
66161
|
-
const action = this.ctx.api
|
|
66842
|
+
const action = this.ctx.api.deviceManager?.setMetadata;
|
|
66162
66843
|
if (action) try {
|
|
66163
66844
|
await action.mutate({
|
|
66164
66845
|
deviceId: this.id,
|
|
@@ -66193,7 +66874,7 @@ var BaseDevice = class {
|
|
|
66193
66874
|
* device boot on a meta refresh.
|
|
66194
66875
|
*/
|
|
66195
66876
|
async refreshFeatures() {
|
|
66196
|
-
const action = this.ctx.api
|
|
66877
|
+
const action = this.ctx.api.deviceManager?.registerDevice;
|
|
66197
66878
|
if (!action) return;
|
|
66198
66879
|
try {
|
|
66199
66880
|
await action.mutate({
|
|
@@ -67118,6 +67799,10 @@ var BaseDeviceProvider = class extends BaseAddon {
|
|
|
67118
67799
|
return toDeviceSummary(device, this.addonId);
|
|
67119
67800
|
}
|
|
67120
67801
|
};
|
|
67802
|
+
/** Map entry helper — concrete camera/hub classes widen to `DeviceConstructor<IDevice>`. */
|
|
67803
|
+
function widenDeviceConstructor(ctor) {
|
|
67804
|
+
return ctor;
|
|
67805
|
+
}
|
|
67121
67806
|
DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Camera, DeviceType.Hub, DeviceType.Switch, DeviceType.Siren, DeviceType.Light, DeviceType.Fan, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder;
|
|
67122
67807
|
new Set(Object.values(DeviceType));
|
|
67123
67808
|
Object.freeze({
|
|
@@ -68267,6 +68952,12 @@ Object.freeze({
|
|
|
68267
68952
|
addonId: null,
|
|
68268
68953
|
access: "view"
|
|
68269
68954
|
},
|
|
68955
|
+
"coreBlocks.migrateRawSecrets": {
|
|
68956
|
+
capName: "core-blocks",
|
|
68957
|
+
capScope: "system",
|
|
68958
|
+
addonId: null,
|
|
68959
|
+
access: "create"
|
|
68960
|
+
},
|
|
68270
68961
|
"coreBlocks.restart": {
|
|
68271
68962
|
capName: "core-blocks",
|
|
68272
68963
|
capScope: "system",
|
|
@@ -69953,6 +70644,12 @@ Object.freeze({
|
|
|
69953
70644
|
addonId: null,
|
|
69954
70645
|
access: "create"
|
|
69955
70646
|
},
|
|
70647
|
+
"keychainAdmin.importSecret": {
|
|
70648
|
+
capName: "keychain-admin",
|
|
70649
|
+
capScope: "system",
|
|
70650
|
+
addonId: null,
|
|
70651
|
+
access: "create"
|
|
70652
|
+
},
|
|
69956
70653
|
"keychainAdmin.listAudit": {
|
|
69957
70654
|
capName: "keychain-admin",
|
|
69958
70655
|
capScope: "system",
|
|
@@ -70121,6 +70818,12 @@ Object.freeze({
|
|
|
70121
70818
|
addonId: null,
|
|
70122
70819
|
access: "view"
|
|
70123
70820
|
},
|
|
70821
|
+
"llm.migrateRawSecrets": {
|
|
70822
|
+
capName: "llm",
|
|
70823
|
+
capScope: "system",
|
|
70824
|
+
addonId: null,
|
|
70825
|
+
access: "create"
|
|
70826
|
+
},
|
|
70124
70827
|
"llm.resolveModelRef": {
|
|
70125
70828
|
capName: "llm",
|
|
70126
70829
|
capScope: "system",
|
|
@@ -70349,6 +71052,12 @@ Object.freeze({
|
|
|
70349
71052
|
addonId: null,
|
|
70350
71053
|
access: "create"
|
|
70351
71054
|
},
|
|
71055
|
+
"localNetwork.useStoredUploadedCertificate": {
|
|
71056
|
+
capName: "local-network",
|
|
71057
|
+
capScope: "system",
|
|
71058
|
+
addonId: null,
|
|
71059
|
+
access: "create"
|
|
71060
|
+
},
|
|
70352
71061
|
"lockControl.getStatus": {
|
|
70353
71062
|
capName: "lock-control",
|
|
70354
71063
|
capScope: "device",
|
|
@@ -73001,6 +73710,30 @@ Object.freeze({
|
|
|
73001
73710
|
addonId: null,
|
|
73002
73711
|
access: "create"
|
|
73003
73712
|
},
|
|
73713
|
+
"recordEntries.deleteEntry": {
|
|
73714
|
+
capName: "record-entries",
|
|
73715
|
+
capScope: "system",
|
|
73716
|
+
addonId: null,
|
|
73717
|
+
access: "delete"
|
|
73718
|
+
},
|
|
73719
|
+
"recordEntries.listEntries": {
|
|
73720
|
+
capName: "record-entries",
|
|
73721
|
+
capScope: "system",
|
|
73722
|
+
addonId: null,
|
|
73723
|
+
access: "view"
|
|
73724
|
+
},
|
|
73725
|
+
"recordEntries.listEntryKinds": {
|
|
73726
|
+
capName: "record-entries",
|
|
73727
|
+
capScope: "system",
|
|
73728
|
+
addonId: null,
|
|
73729
|
+
access: "view"
|
|
73730
|
+
},
|
|
73731
|
+
"recordEntries.putEntry": {
|
|
73732
|
+
capName: "record-entries",
|
|
73733
|
+
capScope: "system",
|
|
73734
|
+
addonId: null,
|
|
73735
|
+
access: "create"
|
|
73736
|
+
},
|
|
73004
73737
|
"recording.getAvailability": {
|
|
73005
73738
|
capName: "recording",
|
|
73006
73739
|
capScope: "device",
|
|
@@ -73301,6 +74034,102 @@ Object.freeze({
|
|
|
73301
74034
|
addonId: null,
|
|
73302
74035
|
access: "view"
|
|
73303
74036
|
},
|
|
74037
|
+
"records.aggregate": {
|
|
74038
|
+
capName: "records",
|
|
74039
|
+
capScope: "system",
|
|
74040
|
+
addonId: null,
|
|
74041
|
+
access: "view"
|
|
74042
|
+
},
|
|
74043
|
+
"records.allocateId": {
|
|
74044
|
+
capName: "records",
|
|
74045
|
+
capScope: "system",
|
|
74046
|
+
addonId: null,
|
|
74047
|
+
access: "create"
|
|
74048
|
+
},
|
|
74049
|
+
"records.count": {
|
|
74050
|
+
capName: "records",
|
|
74051
|
+
capScope: "system",
|
|
74052
|
+
addonId: null,
|
|
74053
|
+
access: "view"
|
|
74054
|
+
},
|
|
74055
|
+
"records.declareKinds": {
|
|
74056
|
+
capName: "records",
|
|
74057
|
+
capScope: "system",
|
|
74058
|
+
addonId: null,
|
|
74059
|
+
access: "create"
|
|
74060
|
+
},
|
|
74061
|
+
"records.delete": {
|
|
74062
|
+
capName: "records",
|
|
74063
|
+
capScope: "system",
|
|
74064
|
+
addonId: null,
|
|
74065
|
+
access: "delete"
|
|
74066
|
+
},
|
|
74067
|
+
"records.deleteDevice": {
|
|
74068
|
+
capName: "records",
|
|
74069
|
+
capScope: "system",
|
|
74070
|
+
addonId: null,
|
|
74071
|
+
access: "delete"
|
|
74072
|
+
},
|
|
74073
|
+
"records.deleteMany": {
|
|
74074
|
+
capName: "records",
|
|
74075
|
+
capScope: "system",
|
|
74076
|
+
addonId: null,
|
|
74077
|
+
access: "delete"
|
|
74078
|
+
},
|
|
74079
|
+
"records.deleteWhere": {
|
|
74080
|
+
capName: "records",
|
|
74081
|
+
capScope: "system",
|
|
74082
|
+
addonId: null,
|
|
74083
|
+
access: "delete"
|
|
74084
|
+
},
|
|
74085
|
+
"records.get": {
|
|
74086
|
+
capName: "records",
|
|
74087
|
+
capScope: "system",
|
|
74088
|
+
addonId: null,
|
|
74089
|
+
access: "view"
|
|
74090
|
+
},
|
|
74091
|
+
"records.getMany": {
|
|
74092
|
+
capName: "records",
|
|
74093
|
+
capScope: "system",
|
|
74094
|
+
addonId: null,
|
|
74095
|
+
access: "view"
|
|
74096
|
+
},
|
|
74097
|
+
"records.histogram": {
|
|
74098
|
+
capName: "records",
|
|
74099
|
+
capScope: "system",
|
|
74100
|
+
addonId: null,
|
|
74101
|
+
access: "view"
|
|
74102
|
+
},
|
|
74103
|
+
"records.patch": {
|
|
74104
|
+
capName: "records",
|
|
74105
|
+
capScope: "system",
|
|
74106
|
+
addonId: null,
|
|
74107
|
+
access: "create"
|
|
74108
|
+
},
|
|
74109
|
+
"records.put": {
|
|
74110
|
+
capName: "records",
|
|
74111
|
+
capScope: "system",
|
|
74112
|
+
addonId: null,
|
|
74113
|
+
access: "create"
|
|
74114
|
+
},
|
|
74115
|
+
"records.putMany": {
|
|
74116
|
+
capName: "records",
|
|
74117
|
+
capScope: "system",
|
|
74118
|
+
addonId: null,
|
|
74119
|
+
access: "create"
|
|
74120
|
+
},
|
|
74121
|
+
"records.query": {
|
|
74122
|
+
capName: "records",
|
|
74123
|
+
capScope: "system",
|
|
74124
|
+
addonId: null,
|
|
74125
|
+
access: "view"
|
|
74126
|
+
},
|
|
74127
|
+
"records.secretRefs": {
|
|
74128
|
+
capName: "records",
|
|
74129
|
+
capScope: "system",
|
|
74130
|
+
addonId: null,
|
|
74131
|
+
access: "view"
|
|
74132
|
+
},
|
|
73304
74133
|
"sceneMonitor.captureReference": {
|
|
73305
74134
|
capName: "scene-monitor",
|
|
73306
74135
|
capScope: "device",
|
|
@@ -73733,6 +74562,48 @@ Object.freeze({
|
|
|
73733
74562
|
addonId: null,
|
|
73734
74563
|
access: "create"
|
|
73735
74564
|
},
|
|
74565
|
+
"storageAdmin.adoptRecords": {
|
|
74566
|
+
capName: "storage-admin",
|
|
74567
|
+
capScope: "system",
|
|
74568
|
+
addonId: null,
|
|
74569
|
+
access: "create"
|
|
74570
|
+
},
|
|
74571
|
+
"storageAdmin.dropCollection": {
|
|
74572
|
+
capName: "storage-admin",
|
|
74573
|
+
capScope: "system",
|
|
74574
|
+
addonId: null,
|
|
74575
|
+
access: "delete"
|
|
74576
|
+
},
|
|
74577
|
+
"storageAdmin.isAdoptedLegacyTable": {
|
|
74578
|
+
capName: "storage-admin",
|
|
74579
|
+
capScope: "system",
|
|
74580
|
+
addonId: null,
|
|
74581
|
+
access: "view"
|
|
74582
|
+
},
|
|
74583
|
+
"storageAdmin.listKinds": {
|
|
74584
|
+
capName: "storage-admin",
|
|
74585
|
+
capScope: "system",
|
|
74586
|
+
addonId: null,
|
|
74587
|
+
access: "view"
|
|
74588
|
+
},
|
|
74589
|
+
"storageAdmin.listTables": {
|
|
74590
|
+
capName: "storage-admin",
|
|
74591
|
+
capScope: "system",
|
|
74592
|
+
addonId: null,
|
|
74593
|
+
access: "view"
|
|
74594
|
+
},
|
|
74595
|
+
"storageAdmin.readLegacyCollection": {
|
|
74596
|
+
capName: "storage-admin",
|
|
74597
|
+
capScope: "system",
|
|
74598
|
+
addonId: null,
|
|
74599
|
+
access: "view"
|
|
74600
|
+
},
|
|
74601
|
+
"storageAdmin.readRecords": {
|
|
74602
|
+
capName: "storage-admin",
|
|
74603
|
+
capScope: "system",
|
|
74604
|
+
addonId: null,
|
|
74605
|
+
access: "view"
|
|
74606
|
+
},
|
|
73736
74607
|
"storageEvictable.evict": {
|
|
73737
74608
|
capName: "storage-evictable",
|
|
73738
74609
|
capScope: "system",
|
|
@@ -74645,6 +75516,12 @@ Object.freeze({
|
|
|
74645
75516
|
addonId: null,
|
|
74646
75517
|
access: "view"
|
|
74647
75518
|
},
|
|
75519
|
+
"userManagement.migrateRawSecrets": {
|
|
75520
|
+
capName: "user-management",
|
|
75521
|
+
capScope: "system",
|
|
75522
|
+
addonId: null,
|
|
75523
|
+
access: "create"
|
|
75524
|
+
},
|
|
74648
75525
|
"userManagement.oauthExchangeCode": {
|
|
74649
75526
|
capName: "user-management",
|
|
74650
75527
|
capScope: "system",
|
|
@@ -77527,6 +78404,37 @@ Object.freeze({
|
|
|
77527
78404
|
form: "single",
|
|
77528
78405
|
optional: false
|
|
77529
78406
|
}],
|
|
78407
|
+
"records.count": [{
|
|
78408
|
+
name: "deviceId",
|
|
78409
|
+
form: "single",
|
|
78410
|
+
optional: true
|
|
78411
|
+
}],
|
|
78412
|
+
"records.deleteDevice": [{
|
|
78413
|
+
name: "deviceId",
|
|
78414
|
+
form: "single",
|
|
78415
|
+
optional: false
|
|
78416
|
+
}],
|
|
78417
|
+
"records.deleteWhere": [{
|
|
78418
|
+
name: "deviceId",
|
|
78419
|
+
form: "single",
|
|
78420
|
+
optional: true
|
|
78421
|
+
}],
|
|
78422
|
+
"records.histogram": [{
|
|
78423
|
+
name: "deviceId",
|
|
78424
|
+
form: "single",
|
|
78425
|
+
optional: true
|
|
78426
|
+
}],
|
|
78427
|
+
"records.putMany": [{
|
|
78428
|
+
name: "records",
|
|
78429
|
+
form: "object-array",
|
|
78430
|
+
optional: false,
|
|
78431
|
+
itemField: "deviceId"
|
|
78432
|
+
}],
|
|
78433
|
+
"records.query": [{
|
|
78434
|
+
name: "deviceId",
|
|
78435
|
+
form: "single",
|
|
78436
|
+
optional: true
|
|
78437
|
+
}],
|
|
77530
78438
|
"sceneMonitor.captureReference": [{
|
|
77531
78439
|
name: "deviceId",
|
|
77532
78440
|
form: "single",
|
|
@@ -77643,6 +78551,17 @@ Object.freeze({
|
|
|
77643
78551
|
form: "single",
|
|
77644
78552
|
optional: false
|
|
77645
78553
|
}],
|
|
78554
|
+
"storageAdmin.adoptRecords": [{
|
|
78555
|
+
name: "records",
|
|
78556
|
+
form: "object-array",
|
|
78557
|
+
optional: false,
|
|
78558
|
+
itemField: "deviceId"
|
|
78559
|
+
}],
|
|
78560
|
+
"storageAdmin.readRecords": [{
|
|
78561
|
+
name: "deviceId",
|
|
78562
|
+
form: "single",
|
|
78563
|
+
optional: true
|
|
78564
|
+
}],
|
|
77646
78565
|
"streamBroker.acquireEgressTranscode": [{
|
|
77647
78566
|
name: "deviceId",
|
|
77648
78567
|
form: "single",
|
|
@@ -95981,7 +96900,7 @@ function isMeaningfulIdentifier(s) {
|
|
|
95981
96900
|
var AmcrestProviderAddon = class extends BaseDeviceProvider {
|
|
95982
96901
|
addonId = AMCREST_ADDON_ID;
|
|
95983
96902
|
providerName = "Amcrest";
|
|
95984
|
-
deviceClasses = { [DeviceType.Camera]: AmcrestCamera };
|
|
96903
|
+
deviceClasses = { [DeviceType.Camera]: widenDeviceConstructor(AmcrestCamera) };
|
|
95985
96904
|
constructor() {
|
|
95986
96905
|
super({});
|
|
95987
96906
|
}
|