@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.js
CHANGED
|
@@ -35,7 +35,7 @@ let node_stream_promises = require("node:stream/promises");
|
|
|
35
35
|
let node_child_process = require("node:child_process");
|
|
36
36
|
require("node:zlib");
|
|
37
37
|
let node_os = require("node:os");
|
|
38
|
-
//#region ../types/dist/event-category-
|
|
38
|
+
//#region ../types/dist/event-category-BvOFi6PY.mjs
|
|
39
39
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
40
40
|
EventCategory["SystemBoot"] = "system.boot";
|
|
41
41
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -99,6 +99,24 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
99
99
|
* consumes this category and maps it to the `addon-crash-loop` kind.
|
|
100
100
|
*/
|
|
101
101
|
EventCategory["AddonRunnerFailed"] = "addon.runner-failed";
|
|
102
|
+
/**
|
|
103
|
+
* A runner whose addon refused to start with a typed reason (D877) - parked
|
|
104
|
+
* in `refused`, never counted by the crash breaker, retried on operator
|
|
105
|
+
* action. One event per refusal.
|
|
106
|
+
*/
|
|
107
|
+
EventCategory["AddonRunnerRefused"] = "addon.runner-refused";
|
|
108
|
+
/**
|
|
109
|
+
* A runner settled on a state (D877): `running` (READY), `crashed`, `failed` or
|
|
110
|
+
* `refused`. In-process telemetry for the boot check (re-evaluate while any
|
|
111
|
+
* runner is still pending) and the alert centre (close a recovered runner).
|
|
112
|
+
*/
|
|
113
|
+
EventCategory["ProcessStateChanged"] = "process.state-changed";
|
|
114
|
+
/**
|
|
115
|
+
* The node's one-shot runner boot check (D877): planned runners against the
|
|
116
|
+
* process service, `degraded` when any is failed, refused or missing. The
|
|
117
|
+
* alert centre turns it into one alert and a direct critical push.
|
|
118
|
+
*/
|
|
119
|
+
EventCategory["SystemRunnerCheck"] = "system.runner-check";
|
|
102
120
|
EventCategory["AddonError"] = "addon.error";
|
|
103
121
|
EventCategory["AddonPageReady"] = "addon.page-ready";
|
|
104
122
|
EventCategory["AddonWidgetReady"] = "addon.widget-ready";
|
|
@@ -5423,7 +5441,7 @@ var ZodIssueCode = {
|
|
|
5423
5441
|
var ZodFirstPartyTypeKind;
|
|
5424
5442
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5425
5443
|
//#endregion
|
|
5426
|
-
//#region ../types/dist/sleep-
|
|
5444
|
+
//#region ../types/dist/sleep-bZIhUvjd.mjs
|
|
5427
5445
|
/**
|
|
5428
5446
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5429
5447
|
* window to float samples (D455).
|
|
@@ -5540,7 +5558,7 @@ function isKeychainStoredField(field) {
|
|
|
5540
5558
|
var SECRET_CLEAR = { $secretClear: true };
|
|
5541
5559
|
/** The `'***'` token D634 redaction writes for non-admins. */
|
|
5542
5560
|
var LEGACY_DEVICE_REDACTION = "***";
|
|
5543
|
-
function isRecord$
|
|
5561
|
+
function isRecord$5(value) {
|
|
5544
5562
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5545
5563
|
}
|
|
5546
5564
|
function makeSecretMarker(ref) {
|
|
@@ -5551,12 +5569,12 @@ function makeSecretMarker(ref) {
|
|
|
5551
5569
|
}
|
|
5552
5570
|
/** A stored marker: an object whose `$secret` is a non-empty string. */
|
|
5553
5571
|
function isSecretMarker(value) {
|
|
5554
|
-
if (!isRecord$
|
|
5572
|
+
if (!isRecord$5(value)) return false;
|
|
5555
5573
|
const ref = value["$secret"];
|
|
5556
5574
|
return typeof ref === "string" && ref.length > 0;
|
|
5557
5575
|
}
|
|
5558
5576
|
function isSecretClear(value) {
|
|
5559
|
-
return isRecord$
|
|
5577
|
+
return isRecord$5(value) && value["$secretClear"] === true;
|
|
5560
5578
|
}
|
|
5561
5579
|
/**
|
|
5562
5580
|
* The UI view of a stored secret field value: a marker becomes "set", inline
|
|
@@ -6166,7 +6184,7 @@ var KeychainWriteRefusedError = class extends Error {
|
|
|
6166
6184
|
}
|
|
6167
6185
|
};
|
|
6168
6186
|
var KEEP = { kind: "keep" };
|
|
6169
|
-
function isRecord$
|
|
6187
|
+
function isRecord$4(value) {
|
|
6170
6188
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6171
6189
|
}
|
|
6172
6190
|
function defaultMintId() {
|
|
@@ -6179,7 +6197,7 @@ function collectSecretMarkerRefs(value, out = []) {
|
|
|
6179
6197
|
return out;
|
|
6180
6198
|
}
|
|
6181
6199
|
if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
|
|
6182
|
-
else if (isRecord$
|
|
6200
|
+
else if (isRecord$4(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
6183
6201
|
return out;
|
|
6184
6202
|
}
|
|
6185
6203
|
async function storedValueEquals(secrets, marker, candidate) {
|
|
@@ -6234,7 +6252,7 @@ function rowId(row, idKey) {
|
|
|
6234
6252
|
return null;
|
|
6235
6253
|
}
|
|
6236
6254
|
async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
6237
|
-
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$
|
|
6255
|
+
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$4) : [];
|
|
6238
6256
|
if (!Array.isArray(incoming)) {
|
|
6239
6257
|
ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
|
|
6240
6258
|
return {
|
|
@@ -6250,7 +6268,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
|
6250
6268
|
const kept = /* @__PURE__ */ new Set();
|
|
6251
6269
|
const rows = [];
|
|
6252
6270
|
for (const row of incoming) {
|
|
6253
|
-
if (!isRecord$
|
|
6271
|
+
if (!isRecord$4(row)) {
|
|
6254
6272
|
rows.push(row);
|
|
6255
6273
|
continue;
|
|
6256
6274
|
}
|
|
@@ -6275,7 +6293,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
6275
6293
|
case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
|
|
6276
6294
|
case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
|
|
6277
6295
|
case "object": {
|
|
6278
|
-
if (!isRecord$
|
|
6296
|
+
if (!isRecord$4(incoming)) {
|
|
6279
6297
|
if (incoming === void 0) return KEEP;
|
|
6280
6298
|
ctx.deletes.push(...collectSecretMarkerRefs(stored));
|
|
6281
6299
|
return {
|
|
@@ -6283,7 +6301,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
6283
6301
|
value: incoming
|
|
6284
6302
|
};
|
|
6285
6303
|
}
|
|
6286
|
-
const storedObj = isRecord$
|
|
6304
|
+
const storedObj = isRecord$4(stored) ? stored : {};
|
|
6287
6305
|
return {
|
|
6288
6306
|
kind: "value",
|
|
6289
6307
|
value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
|
|
@@ -6406,7 +6424,7 @@ async function resolveSecretMarkers(value, secrets, options = {}) {
|
|
|
6406
6424
|
value: items
|
|
6407
6425
|
};
|
|
6408
6426
|
}
|
|
6409
|
-
if (isRecord$
|
|
6427
|
+
if (isRecord$4(v)) {
|
|
6410
6428
|
const out = {};
|
|
6411
6429
|
for (const [k, child] of Object.entries(v)) {
|
|
6412
6430
|
const s = substitute(child);
|
|
@@ -6674,7 +6692,6 @@ function createHandle(raw, opts) {
|
|
|
6674
6692
|
const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
|
|
6675
6693
|
const readAddonStoreResult = raw.readAddonStoreResult;
|
|
6676
6694
|
const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
|
|
6677
|
-
const readDeviceStoreBatch = raw.readDeviceStoreBatch;
|
|
6678
6695
|
const overrides = {
|
|
6679
6696
|
readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
|
|
6680
6697
|
...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
|
|
@@ -6698,12 +6715,12 @@ function createHandle(raw, opts) {
|
|
|
6698
6715
|
};
|
|
6699
6716
|
} } : {},
|
|
6700
6717
|
readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
|
|
6701
|
-
|
|
6702
|
-
const rows = await readDeviceStoreBatch
|
|
6718
|
+
readDeviceStoreBatch: async (deviceIds) => {
|
|
6719
|
+
const rows = await raw.readDeviceStoreBatch(deviceIds);
|
|
6703
6720
|
const out = /* @__PURE__ */ new Map();
|
|
6704
6721
|
for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
|
|
6705
6722
|
return out;
|
|
6706
|
-
}
|
|
6723
|
+
},
|
|
6707
6724
|
writeAddonStore: async (patch) => {
|
|
6708
6725
|
await writeAddon(patch);
|
|
6709
6726
|
},
|
|
@@ -7330,7 +7347,7 @@ var BaseAddon = class {
|
|
|
7330
7347
|
if (!ctx) return;
|
|
7331
7348
|
const addonId = ctx.id;
|
|
7332
7349
|
setImmediate(() => {
|
|
7333
|
-
ctx.api.addons
|
|
7350
|
+
ctx.api.addons.restartAddon.mutate({ addonId }).then(() => {
|
|
7334
7351
|
ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
|
|
7335
7352
|
}).catch((err) => {
|
|
7336
7353
|
ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
@@ -7530,7 +7547,7 @@ var BaseAddon = class {
|
|
|
7530
7547
|
return this._addonSecretTree;
|
|
7531
7548
|
}
|
|
7532
7549
|
deviceSecretTree() {
|
|
7533
|
-
this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
|
|
7550
|
+
this._deviceSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.deviceSettingsSchema()), this.secretStatePaths);
|
|
7534
7551
|
return this._deviceSecretTree;
|
|
7535
7552
|
}
|
|
7536
7553
|
/**
|
|
@@ -7606,42 +7623,135 @@ var BaseAddon = class {
|
|
|
7606
7623
|
this[timerOf] = timer;
|
|
7607
7624
|
}
|
|
7608
7625
|
/**
|
|
7609
|
-
* Wrap `ctx.settings.readAddonStore()` with a
|
|
7610
|
-
*
|
|
7611
|
-
* swap, or any race where the SqliteSettingsBackend is between shutdown and
|
|
7612
|
-
* re-initialize) doesn't propagate up into `initialize()` and leave the
|
|
7626
|
+
* Wrap `ctx.settings.readAddonStore()` with a retry budget so a transient
|
|
7627
|
+
* settings-store outage doesn't propagate up into `initialize()` and leave the
|
|
7613
7628
|
* addon permanently broken.
|
|
7614
7629
|
*
|
|
7615
|
-
*
|
|
7616
|
-
*
|
|
7617
|
-
* `
|
|
7630
|
+
* Two kinds of outage, two budgets:
|
|
7631
|
+
* - the store's own restart fingerprints (`SqliteSettingsBackend not
|
|
7632
|
+
* initialized`, `provider not available`): a short budget, then the addon
|
|
7633
|
+
* falls back to `{}` (defaults) - its first successful patch rehydrates;
|
|
7634
|
+
* - a TRANSPORT failure (the hub is restarting while this runner boots:
|
|
7635
|
+
* `discovery deadline exceeded`, `parent could not route`, a refused or
|
|
7636
|
+
* timed-out connection). Since D870 a runner's settings read THROWS instead
|
|
7637
|
+
* of answering `{}`, so without a budget a hub restart ends in a respawn
|
|
7638
|
+
* loop. A long, bounded budget; only after it the error propagates - the
|
|
7639
|
+
* addon never runs on defaults for a store it could not ask.
|
|
7640
|
+
* Anything else propagates immediately so real bugs surface.
|
|
7618
7641
|
*/
|
|
7619
7642
|
async readAddonStoreWithRetry() {
|
|
7620
7643
|
const settings = this.rawSettings();
|
|
7621
7644
|
if (!settings) return {};
|
|
7622
|
-
const delaysMs = [
|
|
7623
|
-
150,
|
|
7624
|
-
350,
|
|
7625
|
-
600,
|
|
7626
|
-
900
|
|
7627
|
-
];
|
|
7628
7645
|
let lastErr;
|
|
7629
|
-
for (let attempt = 0
|
|
7646
|
+
for (let attempt = 0;; attempt++) try {
|
|
7630
7647
|
const stored = await settings.readAddonStore() ?? {};
|
|
7631
7648
|
this.settingsStoreReady = true;
|
|
7632
7649
|
return stored;
|
|
7633
7650
|
} catch (err) {
|
|
7634
7651
|
lastErr = err;
|
|
7635
|
-
const
|
|
7636
|
-
if (
|
|
7637
|
-
|
|
7638
|
-
|
|
7652
|
+
const kind = classifyStoreError(err);
|
|
7653
|
+
if (kind === "permanent") throw err;
|
|
7654
|
+
const delay = (kind === "transport" ? TRANSPORT_RETRY_DELAYS_MS : RESTART_RETRY_DELAYS_MS)[attempt];
|
|
7655
|
+
if (delay === void 0) {
|
|
7656
|
+
if (kind === "transport") throw err;
|
|
7657
|
+
break;
|
|
7658
|
+
}
|
|
7659
|
+
await new Promise((r) => setTimeout(r, delay));
|
|
7639
7660
|
}
|
|
7640
7661
|
this.settingsStoreReady = false;
|
|
7641
7662
|
this._ctx?.logger?.warn?.("readAddonStore: settings-store unavailable after retries — using defaults", { meta: { error: lastErr instanceof Error ? lastErr.message : String(lastErr) } });
|
|
7642
7663
|
return {};
|
|
7643
7664
|
}
|
|
7644
7665
|
};
|
|
7666
|
+
/** The settings store's own restart fingerprints. */
|
|
7667
|
+
var RESTART_RETRY_DELAYS_MS = [
|
|
7668
|
+
150,
|
|
7669
|
+
350,
|
|
7670
|
+
600,
|
|
7671
|
+
900
|
|
7672
|
+
];
|
|
7673
|
+
/** A hub restarting under a booting runner: ~100 s in total. */
|
|
7674
|
+
var TRANSPORT_RETRY_DELAYS_MS = [
|
|
7675
|
+
150,
|
|
7676
|
+
350,
|
|
7677
|
+
600,
|
|
7678
|
+
900,
|
|
7679
|
+
2e3,
|
|
7680
|
+
5e3,
|
|
7681
|
+
1e4,
|
|
7682
|
+
2e4,
|
|
7683
|
+
3e4,
|
|
7684
|
+
3e4
|
|
7685
|
+
];
|
|
7686
|
+
var RESTART_FINGERPRINTS = ["SqliteSettingsBackend not initialized", "provider not available"];
|
|
7687
|
+
/** Node / socket error codes of a connection that did not happen or broke. */
|
|
7688
|
+
var TRANSPORT_CODES = new Set([
|
|
7689
|
+
"ECONNREFUSED",
|
|
7690
|
+
"ECONNRESET",
|
|
7691
|
+
"ETIMEDOUT",
|
|
7692
|
+
"EPIPE",
|
|
7693
|
+
"EHOSTUNREACH",
|
|
7694
|
+
"ENETUNREACH"
|
|
7695
|
+
]);
|
|
7696
|
+
/** tRPC error codes that mean "the other side is not answering now", not "your call is wrong". */
|
|
7697
|
+
var UNAVAILABLE_TRPC_CODES = new Set([
|
|
7698
|
+
"TIMEOUT",
|
|
7699
|
+
"SERVICE_UNAVAILABLE",
|
|
7700
|
+
"BAD_GATEWAY",
|
|
7701
|
+
"GATEWAY_TIMEOUT"
|
|
7702
|
+
]);
|
|
7703
|
+
/** The exact phrases OUR transport raises when it cannot reach the hub. */
|
|
7704
|
+
var TRANSPORT_PHRASES = [
|
|
7705
|
+
"discovery deadline exceeded",
|
|
7706
|
+
"parent could not route child unowned cap call",
|
|
7707
|
+
"UDS request timed out after",
|
|
7708
|
+
"channel closed"
|
|
7709
|
+
];
|
|
7710
|
+
/** Moleculer error `type`s of a call that could not be served right now. */
|
|
7711
|
+
var MOLECULER_TRANSIENT_TYPES = new Set([
|
|
7712
|
+
"REQUEST_TIMEOUT",
|
|
7713
|
+
"SERVICE_NOT_FOUND",
|
|
7714
|
+
"SERVICE_NOT_AVAILABLE",
|
|
7715
|
+
"REQUEST_REJECTED",
|
|
7716
|
+
"BROKER_DISCONNECTED"
|
|
7717
|
+
]);
|
|
7718
|
+
function stringProp(value, key) {
|
|
7719
|
+
if (typeof value !== "object" || value === null) return void 0;
|
|
7720
|
+
const found = Reflect.get(value, key);
|
|
7721
|
+
return typeof found === "string" ? found : void 0;
|
|
7722
|
+
}
|
|
7723
|
+
/** The code an error carries: its own, its cause's, or a tRPC `data.code`. */
|
|
7724
|
+
function errorCode(err) {
|
|
7725
|
+
const out = {};
|
|
7726
|
+
const cause = typeof err === "object" && err !== null ? Reflect.get(err, "cause") : void 0;
|
|
7727
|
+
const data = typeof err === "object" && err !== null ? Reflect.get(err, "data") : void 0;
|
|
7728
|
+
const node = stringProp(err, "code") ?? stringProp(cause, "code");
|
|
7729
|
+
if (node !== void 0) out.node = node;
|
|
7730
|
+
const trpc = stringProp(data, "code");
|
|
7731
|
+
if (trpc !== void 0) out.trpc = trpc;
|
|
7732
|
+
return out;
|
|
7733
|
+
}
|
|
7734
|
+
/**
|
|
7735
|
+
* Is a settings read failure worth retrying, and with which budget? Only
|
|
7736
|
+
* EXPLICIT signals count: a socket error code, a tRPC "unavailable" code, or
|
|
7737
|
+
* one of the exact phrases our own transport raises. A message that merely
|
|
7738
|
+
* contains "timed out" or "unreachable" is not evidence of anything, and
|
|
7739
|
+
* `settings store not wired` is a wiring bug that retrying cannot fix.
|
|
7740
|
+
*/
|
|
7741
|
+
function classifyStoreError(err) {
|
|
7742
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
7743
|
+
if (RESTART_FINGERPRINTS.some((f) => message.includes(f))) return "restart";
|
|
7744
|
+
const code = errorCode(err);
|
|
7745
|
+
if (code.node !== void 0 && TRANSPORT_CODES.has(code.node)) return "transport";
|
|
7746
|
+
if (code.trpc !== void 0 && UNAVAILABLE_TRPC_CODES.has(code.trpc)) return "transport";
|
|
7747
|
+
if (typeof err === "object" && err !== null) {
|
|
7748
|
+
if (Reflect.get(err, "retryable") === true) return "transport";
|
|
7749
|
+
const type = stringProp(err, "type");
|
|
7750
|
+
if (type !== void 0 && MOLECULER_TRANSIENT_TYPES.has(type)) return "transport";
|
|
7751
|
+
}
|
|
7752
|
+
if (TRANSPORT_PHRASES.some((f) => message.includes(f))) return "transport";
|
|
7753
|
+
return "permanent";
|
|
7754
|
+
}
|
|
7645
7755
|
/**
|
|
7646
7756
|
* Collect the keys of every field marked `perNode: true`, recursing into
|
|
7647
7757
|
* layout containers (`group` fields and `sub-tabs` tabs) the same way
|
|
@@ -7731,6 +7841,156 @@ var PeerBytesTicketSchema = object({
|
|
|
7731
7841
|
*/
|
|
7732
7842
|
declaredBytes: number().int().nonnegative().nullable()
|
|
7733
7843
|
});
|
|
7844
|
+
/** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
|
|
7845
|
+
/** The files a kind may live in. `history` is device-history's (D850), never records. */
|
|
7846
|
+
var RECORD_DATABASES = ["settings", "events"];
|
|
7847
|
+
/** The classes of a kind: the `@durable` vocabulary, one authority (replaces the annotation). */
|
|
7848
|
+
var RECORD_CLASSES = [
|
|
7849
|
+
"config",
|
|
7850
|
+
"ledger",
|
|
7851
|
+
"audit",
|
|
7852
|
+
"mirror",
|
|
7853
|
+
"ephemeral"
|
|
7854
|
+
];
|
|
7855
|
+
var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
|
|
7856
|
+
var RECORD_MAX_DATA_BYTES = 1024 * 1024;
|
|
7857
|
+
var RECORD_BATCH_MAX = 1e3;
|
|
7858
|
+
var RECORD_QUERY_MAX = 1e3;
|
|
7859
|
+
function defOf(schema) {
|
|
7860
|
+
const zodBag = Reflect.get(schema, "_zod");
|
|
7861
|
+
if (typeof zodBag !== "object" || zodBag === null) return {};
|
|
7862
|
+
const def = Reflect.get(zodBag, "def");
|
|
7863
|
+
if (typeof def !== "object" || def === null) return {};
|
|
7864
|
+
return def;
|
|
7865
|
+
}
|
|
7866
|
+
function declaredHere(schema) {
|
|
7867
|
+
return globalRegistry.get(schema)?.secret === true;
|
|
7868
|
+
}
|
|
7869
|
+
/** Wrapper kinds whose `innerType` is the field itself. */
|
|
7870
|
+
var WRAPPERS = new Set([
|
|
7871
|
+
"optional",
|
|
7872
|
+
"nullable",
|
|
7873
|
+
"default",
|
|
7874
|
+
"prefault",
|
|
7875
|
+
"catch",
|
|
7876
|
+
"readonly",
|
|
7877
|
+
"nonoptional"
|
|
7878
|
+
]);
|
|
7879
|
+
/**
|
|
7880
|
+
* The schema layers that make up ONE field: the schema itself and every
|
|
7881
|
+
* wrapper below it (optional / default / nullable / readonly / catch), plus
|
|
7882
|
+
* both sides of a pipe (`z.preprocess` puts the real schema on `out`,
|
|
7883
|
+
* `.transform` on `in`).
|
|
7884
|
+
*/
|
|
7885
|
+
function layersOf(schema) {
|
|
7886
|
+
const out = [];
|
|
7887
|
+
const queue = [schema];
|
|
7888
|
+
while (queue.length > 0) {
|
|
7889
|
+
const s = queue.shift();
|
|
7890
|
+
if (!s || out.includes(s)) continue;
|
|
7891
|
+
out.push(s);
|
|
7892
|
+
const def = defOf(s);
|
|
7893
|
+
if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
|
|
7894
|
+
if (def.type === "pipe") {
|
|
7895
|
+
if (def.in) queue.push(def.in);
|
|
7896
|
+
if (def.out) queue.push(def.out);
|
|
7897
|
+
}
|
|
7898
|
+
}
|
|
7899
|
+
return out;
|
|
7900
|
+
}
|
|
7901
|
+
/** True when any layer of this field declares `.meta({ secret: true })`. */
|
|
7902
|
+
function isZodSecret(schema) {
|
|
7903
|
+
return layersOf(schema).some(declaredHere);
|
|
7904
|
+
}
|
|
7905
|
+
/**
|
|
7906
|
+
* Every declared secret path in a config schema: dotted keys, `[]` for "each
|
|
7907
|
+
* element of this array" (`connection.password`, `rows[].token`). A declared
|
|
7908
|
+
* object or array is reported as one path and not descended into — everything
|
|
7909
|
+
* under it is secret.
|
|
7910
|
+
*/
|
|
7911
|
+
function collectZodSecretPaths(schema, prefix = "") {
|
|
7912
|
+
if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
|
|
7913
|
+
const paths = [];
|
|
7914
|
+
for (const layer of layersOf(schema)) {
|
|
7915
|
+
const def = defOf(layer);
|
|
7916
|
+
if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
|
|
7917
|
+
else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
|
|
7918
|
+
else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
|
|
7919
|
+
else if (def.type === "intersection") {
|
|
7920
|
+
if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
|
|
7921
|
+
if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
|
|
7922
|
+
}
|
|
7923
|
+
}
|
|
7924
|
+
return [...new Set(paths)];
|
|
7925
|
+
}
|
|
7926
|
+
/**
|
|
7927
|
+
* Record kinds (D881): the declaration an addon makes of one kind of fact, the
|
|
7928
|
+
* Zod row schema that describes it, and the helper that turns the two into the
|
|
7929
|
+
* JSON the engine stores.
|
|
7930
|
+
*
|
|
7931
|
+
* A kind is declared ONCE, next to the code that owns it, and the engine's
|
|
7932
|
+
* reconciler creates its indexes - nothing creates DDL at runtime from a write.
|
|
7933
|
+
* Everything the generic machinery needs (secret fields, the entry descriptor)
|
|
7934
|
+
* is DERIVED from the Zod schema: `.meta({ secret: true })` marks a credential,
|
|
7935
|
+
* never a field name (D879).
|
|
7936
|
+
*/
|
|
7937
|
+
/** A JSON field path: `trackId`, `auth.accessToken`. Charset-restricted: it is rendered into DDL. */
|
|
7938
|
+
var RecordFieldPathSchema = string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}(\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,3}$/);
|
|
7939
|
+
var RecordIndexSchema = object({
|
|
7940
|
+
name: string().regex(/^[a-z][a-z0-9_]{0,31}$/),
|
|
7941
|
+
fields: array(RecordFieldPathSchema).min(1).max(4),
|
|
7942
|
+
unique: boolean().optional()
|
|
7943
|
+
}).strict();
|
|
7944
|
+
var RecordRetentionSchema = union([
|
|
7945
|
+
object({
|
|
7946
|
+
ttlMs: number().int().positive(),
|
|
7947
|
+
from: _enum(["at", "write"])
|
|
7948
|
+
}).strict(),
|
|
7949
|
+
object({
|
|
7950
|
+
maxRows: number().int().positive().optional(),
|
|
7951
|
+
maxRowsPerDevice: number().int().positive().optional()
|
|
7952
|
+
}).strict().refine((r) => r.maxRows !== void 0 || r.maxRowsPerDevice !== void 0, { message: "name maxRows, maxRowsPerDevice or both" }),
|
|
7953
|
+
object({
|
|
7954
|
+
owner: string().min(1),
|
|
7955
|
+
reason: string().min(1)
|
|
7956
|
+
}).strict(),
|
|
7957
|
+
object({ none: string().min(1) }).strict()
|
|
7958
|
+
]);
|
|
7959
|
+
/** The descriptor a generic entries UI reads (D881 "generic entries"). */
|
|
7960
|
+
var EntryDescriptorSchema = object({
|
|
7961
|
+
title: string().min(1),
|
|
7962
|
+
/** The record body field shown as the entry's name. */
|
|
7963
|
+
nameField: string().min(1),
|
|
7964
|
+
/** JSON Schema of the entry body; `secret: true` marks a password field. */
|
|
7965
|
+
fields: record(string(), unknown())
|
|
7966
|
+
}).strict();
|
|
7967
|
+
/** What crosses the wire and sits in the engine's catalog: JSON only, no Zod. */
|
|
7968
|
+
var RecordKindDeclarationSchema = object({
|
|
7969
|
+
database: _enum(RECORD_DATABASES).default("settings"),
|
|
7970
|
+
class: _enum(RECORD_CLASSES),
|
|
7971
|
+
writeTrigger: string().min(1),
|
|
7972
|
+
device: _enum([
|
|
7973
|
+
"required",
|
|
7974
|
+
"optional",
|
|
7975
|
+
"none"
|
|
7976
|
+
]).default("none"),
|
|
7977
|
+
at: _enum(["required", "none"]).default("none"),
|
|
7978
|
+
indexes: array(RecordIndexSchema).max(8).default([]),
|
|
7979
|
+
retention: RecordRetentionSchema,
|
|
7980
|
+
deviceRemoval: _enum(["delete", "none"]).default("none"),
|
|
7981
|
+
maxDataBytes: number().int().positive().max(RECORD_MAX_DATA_BYTES).default(RECORD_DEFAULT_MAX_DATA_BYTES),
|
|
7982
|
+
/** Derived from the Zod schema; never written by hand. */
|
|
7983
|
+
secretPaths: array(string().min(1)).default([]),
|
|
7984
|
+
/** The id key of each array that carries a secret (`{ headers: 'name' }`). */
|
|
7985
|
+
secretArrayKeys: record(string(), string()).default({}),
|
|
7986
|
+
/** The legacy table this kind adopts from; the boot guard reads it (D853: no migration code). */
|
|
7987
|
+
adoptsFrom: string().min(1).optional(),
|
|
7988
|
+
/** Kinds that must agree through `transact` sit in one file under one family name. */
|
|
7989
|
+
transactFamily: string().min(1).optional(),
|
|
7990
|
+
entry: EntryDescriptorSchema.optional()
|
|
7991
|
+
}).strict();
|
|
7992
|
+
/** The kind names: lower-case, dash separated, short enough for an index name. */
|
|
7993
|
+
var RecordKindNameSchema = string().regex(/^[a-z][a-z0-9-]{0,47}$/);
|
|
7734
7994
|
/** Shared Zod schemas used across streaming capabilities. */
|
|
7735
7995
|
var CamProfileSchema = _enum([
|
|
7736
7996
|
"high",
|
|
@@ -8195,69 +8455,6 @@ method(object({ deviceId: number() }), array(StreamSourceEntrySchema)), method(o
|
|
|
8195
8455
|
kind: "mutation",
|
|
8196
8456
|
auth: "admin"
|
|
8197
8457
|
}), method(object({ deviceId: number() }), unknown().nullable()), method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" });
|
|
8198
|
-
function defOf(schema) {
|
|
8199
|
-
return schema._zod?.def ?? {};
|
|
8200
|
-
}
|
|
8201
|
-
function declaredHere(schema) {
|
|
8202
|
-
return globalRegistry.get(schema)?.secret === true;
|
|
8203
|
-
}
|
|
8204
|
-
/** Wrapper kinds whose `innerType` is the field itself. */
|
|
8205
|
-
var WRAPPERS = new Set([
|
|
8206
|
-
"optional",
|
|
8207
|
-
"nullable",
|
|
8208
|
-
"default",
|
|
8209
|
-
"prefault",
|
|
8210
|
-
"catch",
|
|
8211
|
-
"readonly",
|
|
8212
|
-
"nonoptional"
|
|
8213
|
-
]);
|
|
8214
|
-
/**
|
|
8215
|
-
* The schema layers that make up ONE field: the schema itself and every
|
|
8216
|
-
* wrapper below it (optional / default / nullable / readonly / catch), plus
|
|
8217
|
-
* both sides of a pipe (`z.preprocess` puts the real schema on `out`,
|
|
8218
|
-
* `.transform` on `in`).
|
|
8219
|
-
*/
|
|
8220
|
-
function layersOf(schema) {
|
|
8221
|
-
const out = [];
|
|
8222
|
-
const queue = [schema];
|
|
8223
|
-
while (queue.length > 0) {
|
|
8224
|
-
const s = queue.shift();
|
|
8225
|
-
if (!s || out.includes(s)) continue;
|
|
8226
|
-
out.push(s);
|
|
8227
|
-
const def = defOf(s);
|
|
8228
|
-
if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
|
|
8229
|
-
if (def.type === "pipe") {
|
|
8230
|
-
if (def.in) queue.push(def.in);
|
|
8231
|
-
if (def.out) queue.push(def.out);
|
|
8232
|
-
}
|
|
8233
|
-
}
|
|
8234
|
-
return out;
|
|
8235
|
-
}
|
|
8236
|
-
/** True when any layer of this field declares `.meta({ secret: true })`. */
|
|
8237
|
-
function isZodSecret(schema) {
|
|
8238
|
-
return layersOf(schema).some(declaredHere);
|
|
8239
|
-
}
|
|
8240
|
-
/**
|
|
8241
|
-
* Every declared secret path in a config schema: dotted keys, `[]` for "each
|
|
8242
|
-
* element of this array" (`connection.password`, `rows[].token`). A declared
|
|
8243
|
-
* object or array is reported as one path and not descended into — everything
|
|
8244
|
-
* under it is secret.
|
|
8245
|
-
*/
|
|
8246
|
-
function collectZodSecretPaths(schema, prefix = "") {
|
|
8247
|
-
if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
|
|
8248
|
-
const paths = [];
|
|
8249
|
-
for (const layer of layersOf(schema)) {
|
|
8250
|
-
const def = defOf(layer);
|
|
8251
|
-
if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
|
|
8252
|
-
else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
|
|
8253
|
-
else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
|
|
8254
|
-
else if (def.type === "intersection") {
|
|
8255
|
-
if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
|
|
8256
|
-
if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
|
|
8257
|
-
}
|
|
8258
|
-
}
|
|
8259
|
-
return [...new Set(paths)];
|
|
8260
|
-
}
|
|
8261
8458
|
object({
|
|
8262
8459
|
code: string().regex(/^[a-z][a-z0-9-]*(\.[a-z0-9-]+)+$/),
|
|
8263
8460
|
params: record(string(), union([string(), number()])).optional()
|
|
@@ -8277,7 +8474,7 @@ function userError(code, params, englishFallback) {
|
|
|
8277
8474
|
return new CamstackError(code, params, englishFallback);
|
|
8278
8475
|
}
|
|
8279
8476
|
//#endregion
|
|
8280
|
-
//#region ../types/dist/err-msg
|
|
8477
|
+
//#region ../types/dist/err-msg--2RrYiLO.mjs
|
|
8281
8478
|
var DeviceType = /* @__PURE__ */ function(DeviceType) {
|
|
8282
8479
|
DeviceType["Camera"] = "camera";
|
|
8283
8480
|
DeviceType["Hub"] = "hub";
|
|
@@ -8546,6 +8743,9 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
|
|
|
8546
8743
|
/** Virtual HA toggle (input_boolean.*) — distinguishable from a
|
|
8547
8744
|
* real Switch device for UI rendering / export adapters. */
|
|
8548
8745
|
DeviceRole["BinaryHelper"] = "binary-helper";
|
|
8746
|
+
/** A smart plug: a `switch` whose source says it is an outlet (HA
|
|
8747
|
+
* `device_class: outlet`). The Alexa export shows it as a SMARTPLUG. */
|
|
8748
|
+
DeviceRole["Outlet"] = "outlet";
|
|
8549
8749
|
/** Generic motion / occupancy / moving event source. Distinct from
|
|
8550
8750
|
* the camera accessory PirSensor role: that one is a camera child;
|
|
8551
8751
|
* this is a standalone HA / 3rd-party motion sensor. */
|
|
@@ -8613,7 +8813,7 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
|
|
|
8613
8813
|
return DeviceRole;
|
|
8614
8814
|
}({});
|
|
8615
8815
|
//#endregion
|
|
8616
|
-
//#region ../types/dist/composition-
|
|
8816
|
+
//#region ../types/dist/composition-DOwQB_Ua.mjs
|
|
8617
8817
|
/**
|
|
8618
8818
|
* The ffmpeg build every CamStack node downloads, per platform and arch.
|
|
8619
8819
|
*
|
|
@@ -11837,11 +12037,10 @@ var ClipModelMetaSchema = object({
|
|
|
11837
12037
|
/**
|
|
11838
12038
|
* The `vector-store` index this model's vectors live in. ONE feature space
|
|
11839
12039
|
* per index: two models share an index only when their vectors are ranked
|
|
11840
|
-
* against each other, which for CLIP means never across families.
|
|
11841
|
-
*
|
|
11842
|
-
* `modelId`); any other model gets its own.
|
|
12040
|
+
* against each other, which for CLIP means never across families. Every
|
|
12041
|
+
* model gets its own.
|
|
11843
12042
|
*/
|
|
11844
|
-
vectorIndex: string().regex(/^object-clip
|
|
12043
|
+
vectorIndex: string().regex(/^object-clip-[a-z0-9][a-z0-9-]*$/),
|
|
11845
12044
|
/**
|
|
11846
12045
|
* The text encoder's tokenizer, a declared SIBLING file of its onnx. The name
|
|
11847
12046
|
* must be unique per tokenizer: every model's siblings land in ONE flat
|
|
@@ -15574,6 +15773,41 @@ var ComposableCapabilitiesSchema = object({ caps: array(object({
|
|
|
15574
15773
|
keyField: string()
|
|
15575
15774
|
}).optional()
|
|
15576
15775
|
})) });
|
|
15776
|
+
/**
|
|
15777
|
+
* The report of a one-shot "move this owner's plaintext secrets into the
|
|
15778
|
+
* keychain" run (D878). COUNTS only - never a value, never a ref.
|
|
15779
|
+
*
|
|
15780
|
+
* The owner runs it on its own rows, through its own write path; an operator
|
|
15781
|
+
* script (`scripts/hub/migrate-raw-secrets.ts`) calls the owner's cap method.
|
|
15782
|
+
* Dry run (`apply: false`) reports what WOULD move and changes nothing.
|
|
15783
|
+
*/
|
|
15784
|
+
var RawSecretMigrationInputSchema = object({
|
|
15785
|
+
/** `false` (the default of the script) = report only. */
|
|
15786
|
+
apply: boolean() });
|
|
15787
|
+
var RawSecretMigrationReportSchema = object({
|
|
15788
|
+
apply: boolean(),
|
|
15789
|
+
/** Rows that can carry a secret (a profile, an enrolment). */
|
|
15790
|
+
rows: number().int(),
|
|
15791
|
+
/** Rows whose secret was plaintext when the run started. */
|
|
15792
|
+
raw: number().int(),
|
|
15793
|
+
/** Rows that already held a keychain marker when the run started. */
|
|
15794
|
+
markers: number().int(),
|
|
15795
|
+
/** Plaintext rows moved by THIS run (always 0 on a dry run). */
|
|
15796
|
+
migrated: number().int(),
|
|
15797
|
+
/** Plaintext rows left in place because the move or its read-back failed. */
|
|
15798
|
+
failed: number().int(),
|
|
15799
|
+
/** After the run: rows still holding plaintext. */
|
|
15800
|
+
remainingRaw: number().int(),
|
|
15801
|
+
/** After the run: markers the keychain could not resolve right now. */
|
|
15802
|
+
unresolvedMarkers: number().int(),
|
|
15803
|
+
/**
|
|
15804
|
+
* A second, redundant copy of the secrets' rows that the run found (and, on
|
|
15805
|
+
* `apply`, deleted after verifying the first). Owners with a single copy omit it.
|
|
15806
|
+
*/
|
|
15807
|
+
redundantCopies: number().int().optional(),
|
|
15808
|
+
/** True when nothing is raw and every marker resolves. */
|
|
15809
|
+
verified: boolean()
|
|
15810
|
+
});
|
|
15577
15811
|
/** Where a block runs. The operator chooses — a block driving a device on an
|
|
15578
15812
|
* agent is the reason placement is not fixed to the hub. */
|
|
15579
15813
|
var CoreBlockPlacementSchema = union([literal("hub"), string().min(1)]);
|
|
@@ -15800,6 +16034,9 @@ method(object({}), object({ blocks: array(CoreBlockSchema) }), { auth: "admin" }
|
|
|
15800
16034
|
}), SettingsUpdateResultSchema, {
|
|
15801
16035
|
kind: "mutation",
|
|
15802
16036
|
auth: "admin"
|
|
16037
|
+
}), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
|
|
16038
|
+
kind: "mutation",
|
|
16039
|
+
auth: "admin"
|
|
15803
16040
|
}), method(object({}), object({ libs: array(object({
|
|
15804
16041
|
filePath: string(),
|
|
15805
16042
|
content: string()
|
|
@@ -16063,6 +16300,347 @@ id: union([string(), number()]) }), {
|
|
|
16063
16300
|
auth: "admin"
|
|
16064
16301
|
});
|
|
16065
16302
|
/**
|
|
16303
|
+
* records - an addon's own facts and documents (D881): ledgers, audit rows,
|
|
16304
|
+
* config documents, mirrors. The third storage API next to `ctx.settings`
|
|
16305
|
+
* (operator intent, D870) and device-history (numbers over time, D850).
|
|
16306
|
+
*
|
|
16307
|
+
* Who the OWNER is: `callerAddonId`, stamped by the transport on a call that
|
|
16308
|
+
* crossed a process and stated by a hub in-process caller (`ctx.records` does
|
|
16309
|
+
* that with the addon id closed over). It is deliberately NOT in any input
|
|
16310
|
+
* schema, so a session can never supply it, and a call with no stamp is refused
|
|
16311
|
+
* `records/no-caller`. A kind is readable and writable only by its owner; other
|
|
16312
|
+
* addons go through the owner's capability.
|
|
16313
|
+
*
|
|
16314
|
+
* Every read is three-way: a row, `null`, or the call THROWS. A failed read is
|
|
16315
|
+
* never `[]`. Secret fields are never on the wire: a read shows the
|
|
16316
|
+
* redaction token, `secretRefs` hands the owner's `ctx.secrets` the refs it
|
|
16317
|
+
* resolves itself, and a write may carry only a keychain marker bound to the
|
|
16318
|
+
* row's own ref.
|
|
16319
|
+
*
|
|
16320
|
+
* Internal: addons reach it through `ctx.records`, never directly.
|
|
16321
|
+
*/
|
|
16322
|
+
var RecordIdSchema = string().min(1).max(256);
|
|
16323
|
+
/** A JSON object body. Size is the engine's check (`maxDataBytes`), not a schema's. */
|
|
16324
|
+
var RecordBodySchema = record(string(), unknown());
|
|
16325
|
+
var RecordInputSchema = object({
|
|
16326
|
+
id: RecordIdSchema,
|
|
16327
|
+
/** The device this row belongs to (D865 removal, per-device reads). */
|
|
16328
|
+
deviceId: number().int().optional(),
|
|
16329
|
+
/** The domain clock, ms: observed / created / opened. */
|
|
16330
|
+
at: number().int().optional(),
|
|
16331
|
+
/** Producer-set expiry, ms. Refused on a kind whose retention is an engine TTL. */
|
|
16332
|
+
expiresAt: number().int().optional(),
|
|
16333
|
+
data: RecordBodySchema
|
|
16334
|
+
});
|
|
16335
|
+
var RecordViewSchema = object({
|
|
16336
|
+
id: string(),
|
|
16337
|
+
deviceId: number().int().nullable(),
|
|
16338
|
+
at: number().nullable(),
|
|
16339
|
+
expiresAt: number().nullable(),
|
|
16340
|
+
rev: number().int(),
|
|
16341
|
+
updatedAt: number(),
|
|
16342
|
+
data: RecordBodySchema
|
|
16343
|
+
});
|
|
16344
|
+
/** Declared index fields only. Anything else does not compile, by design. */
|
|
16345
|
+
var RecordWhereSchema = record(RecordFieldPathSchema, union([
|
|
16346
|
+
string(),
|
|
16347
|
+
number(),
|
|
16348
|
+
boolean(),
|
|
16349
|
+
object({ in: array(union([
|
|
16350
|
+
string(),
|
|
16351
|
+
number(),
|
|
16352
|
+
boolean()
|
|
16353
|
+
])).min(1).max(RECORD_BATCH_MAX) }),
|
|
16354
|
+
object({
|
|
16355
|
+
gt: union([string(), number()]).optional(),
|
|
16356
|
+
gte: union([string(), number()]).optional(),
|
|
16357
|
+
lt: union([string(), number()]).optional(),
|
|
16358
|
+
lte: union([string(), number()]).optional()
|
|
16359
|
+
}).refine((r) => Object.keys(r).length > 0, { message: "name at least one bound" })
|
|
16360
|
+
]));
|
|
16361
|
+
var KindShape = { kind: RecordKindNameSchema };
|
|
16362
|
+
var TimeWindowShape = {
|
|
16363
|
+
deviceId: number().int().optional(),
|
|
16364
|
+
atFrom: number().optional(),
|
|
16365
|
+
atTo: number().optional()
|
|
16366
|
+
};
|
|
16367
|
+
var RecordQueryInputSchema = object({
|
|
16368
|
+
...KindShape,
|
|
16369
|
+
...TimeWindowShape,
|
|
16370
|
+
where: RecordWhereSchema.optional(),
|
|
16371
|
+
/** Without `where`: `at` (default for a kind with a clock) or `id`. With `where` the order is the index's. */
|
|
16372
|
+
order: _enum(["at", "id"]).optional(),
|
|
16373
|
+
desc: boolean().optional(),
|
|
16374
|
+
limit: number().int().min(1).max(RECORD_QUERY_MAX).default(100),
|
|
16375
|
+
/** Opaque keyset cursor from a previous answer. There is no offset. */
|
|
16376
|
+
cursor: string().min(1).optional()
|
|
16377
|
+
});
|
|
16378
|
+
var RecordQueryResultSchema = object({
|
|
16379
|
+
records: array(RecordViewSchema),
|
|
16380
|
+
nextCursor: string().nullable()
|
|
16381
|
+
});
|
|
16382
|
+
var RecordKindStateSchema = _enum([
|
|
16383
|
+
"created",
|
|
16384
|
+
"unchanged",
|
|
16385
|
+
"updated"
|
|
16386
|
+
]);
|
|
16387
|
+
var DeclareKindResultSchema = object({
|
|
16388
|
+
kindId: number().int(),
|
|
16389
|
+
state: RecordKindStateSchema,
|
|
16390
|
+
createdIndexes: array(string()),
|
|
16391
|
+
/** The boot guard: the kind is empty while its legacy table still holds rows. */
|
|
16392
|
+
adoptionPending: object({
|
|
16393
|
+
legacyTable: string(),
|
|
16394
|
+
legacyRows: number().int()
|
|
16395
|
+
}).nullable()
|
|
16396
|
+
});
|
|
16397
|
+
/** Keychain refs a write released (the old marker is gone from the row): the owner deletes the values. */
|
|
16398
|
+
var SecretRefsList = array(string());
|
|
16399
|
+
var RecordSecretRefsSchema = record(string(), record(string(), string()));
|
|
16400
|
+
method(object({ kinds: record(RecordKindNameSchema, RecordKindDeclarationSchema) }), object({ kinds: record(string(), DeclareKindResultSchema) }), {
|
|
16401
|
+
kind: "mutation",
|
|
16402
|
+
auth: "admin"
|
|
16403
|
+
}), method(object({
|
|
16404
|
+
...KindShape,
|
|
16405
|
+
id: RecordIdSchema
|
|
16406
|
+
}), RecordViewSchema.nullable(), { auth: "admin" }), method(object({
|
|
16407
|
+
...KindShape,
|
|
16408
|
+
ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
|
|
16409
|
+
}), array(RecordViewSchema), { auth: "admin" }), method(object({
|
|
16410
|
+
...KindShape,
|
|
16411
|
+
ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
|
|
16412
|
+
}), RecordSecretRefsSchema, { auth: "admin" }), method(object({
|
|
16413
|
+
...KindShape,
|
|
16414
|
+
record: RecordInputSchema,
|
|
16415
|
+
/** Compare-and-set. `0` means "the row must not exist". */
|
|
16416
|
+
ifRev: number().int().min(0).optional()
|
|
16417
|
+
}), object({
|
|
16418
|
+
rev: number().int(),
|
|
16419
|
+
releasedRefs: SecretRefsList
|
|
16420
|
+
}), {
|
|
16421
|
+
kind: "mutation",
|
|
16422
|
+
auth: "admin"
|
|
16423
|
+
}), method(object({
|
|
16424
|
+
...KindShape,
|
|
16425
|
+
records: array(RecordInputSchema).min(1).max(RECORD_BATCH_MAX)
|
|
16426
|
+
}), object({
|
|
16427
|
+
count: number().int(),
|
|
16428
|
+
releasedRefs: SecretRefsList
|
|
16429
|
+
}), {
|
|
16430
|
+
kind: "mutation",
|
|
16431
|
+
auth: "admin"
|
|
16432
|
+
}), method(object({
|
|
16433
|
+
...KindShape,
|
|
16434
|
+
id: RecordIdSchema,
|
|
16435
|
+
data: RecordBodySchema,
|
|
16436
|
+
at: number().int().nullable().optional(),
|
|
16437
|
+
expiresAt: number().int().nullable().optional(),
|
|
16438
|
+
ifRev: number().int().min(1).optional()
|
|
16439
|
+
}), object({
|
|
16440
|
+
rev: number().int(),
|
|
16441
|
+
releasedRefs: SecretRefsList
|
|
16442
|
+
}), {
|
|
16443
|
+
kind: "mutation",
|
|
16444
|
+
auth: "admin"
|
|
16445
|
+
}), method(object({
|
|
16446
|
+
...KindShape,
|
|
16447
|
+
id: RecordIdSchema
|
|
16448
|
+
}), object({
|
|
16449
|
+
deleted: boolean(),
|
|
16450
|
+
secretRefs: SecretRefsList
|
|
16451
|
+
}), {
|
|
16452
|
+
kind: "mutation",
|
|
16453
|
+
auth: "admin"
|
|
16454
|
+
}), method(object({
|
|
16455
|
+
...KindShape,
|
|
16456
|
+
ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
|
|
16457
|
+
}), object({
|
|
16458
|
+
deleted: number().int(),
|
|
16459
|
+
secretRefs: SecretRefsList
|
|
16460
|
+
}), {
|
|
16461
|
+
kind: "mutation",
|
|
16462
|
+
auth: "admin"
|
|
16463
|
+
}), method(RecordQueryInputSchema, RecordQueryResultSchema, { auth: "admin" }), method(object({
|
|
16464
|
+
...KindShape,
|
|
16465
|
+
...TimeWindowShape,
|
|
16466
|
+
where: RecordWhereSchema.optional()
|
|
16467
|
+
}), object({ count: number().int() }), { auth: "admin" }), method(object({
|
|
16468
|
+
...KindShape,
|
|
16469
|
+
deviceId: number().int().optional(),
|
|
16470
|
+
from: number(),
|
|
16471
|
+
to: number(),
|
|
16472
|
+
bucketMs: number().int().positive()
|
|
16473
|
+
}), object({ buckets: array(object({
|
|
16474
|
+
bucketStart: number(),
|
|
16475
|
+
count: number().int()
|
|
16476
|
+
})) }), { auth: "admin" }), method(object({
|
|
16477
|
+
...KindShape,
|
|
16478
|
+
op: _enum([
|
|
16479
|
+
"sum",
|
|
16480
|
+
"min",
|
|
16481
|
+
"max",
|
|
16482
|
+
"count"
|
|
16483
|
+
]),
|
|
16484
|
+
field: RecordFieldPathSchema.optional(),
|
|
16485
|
+
groupBy: RecordFieldPathSchema.optional(),
|
|
16486
|
+
where: RecordWhereSchema.optional()
|
|
16487
|
+
}), object({ rows: array(object({
|
|
16488
|
+
group: union([
|
|
16489
|
+
string(),
|
|
16490
|
+
number(),
|
|
16491
|
+
_null()
|
|
16492
|
+
]),
|
|
16493
|
+
value: number().nullable()
|
|
16494
|
+
})) }), { auth: "admin" }), method(object({
|
|
16495
|
+
...KindShape,
|
|
16496
|
+
deviceId: number().int().optional(),
|
|
16497
|
+
atBefore: number().optional(),
|
|
16498
|
+
where: RecordWhereSchema.optional()
|
|
16499
|
+
}), object({
|
|
16500
|
+
deleted: number().int(),
|
|
16501
|
+
secretRefs: SecretRefsList
|
|
16502
|
+
}), {
|
|
16503
|
+
kind: "mutation",
|
|
16504
|
+
auth: "admin"
|
|
16505
|
+
}), method(object({
|
|
16506
|
+
deviceId: number().int(),
|
|
16507
|
+
kinds: array(RecordKindNameSchema).optional()
|
|
16508
|
+
}), object({
|
|
16509
|
+
deleted: record(string(), number().int()),
|
|
16510
|
+
secretRefs: SecretRefsList
|
|
16511
|
+
}), {
|
|
16512
|
+
kind: "mutation",
|
|
16513
|
+
auth: "admin"
|
|
16514
|
+
}), method(object(KindShape), object({ id: number().int() }), {
|
|
16515
|
+
kind: "mutation",
|
|
16516
|
+
auth: "admin"
|
|
16517
|
+
});
|
|
16518
|
+
/** One table of the settings database. */
|
|
16519
|
+
var StorageTableSchema = object({
|
|
16520
|
+
/** The table's full name, e.g. `recorder:addon-settings` or `addon-device-settings`. */
|
|
16521
|
+
name: string(),
|
|
16522
|
+
/** The owner prefix of a scoped name (`recorder` for `recorder:addon-settings`), else null. */
|
|
16523
|
+
owner: string().nullable(),
|
|
16524
|
+
rows: number().int().nonnegative(),
|
|
16525
|
+
/** Bytes the table's pages occupy (`dbstat`); null when the engine cannot measure. */
|
|
16526
|
+
bytes: number().int().nonnegative().nullable(),
|
|
16527
|
+
/** Declared by an addon since this engine process started (a running addon claims it). */
|
|
16528
|
+
declaredThisBoot: boolean()
|
|
16529
|
+
});
|
|
16530
|
+
/** One declared record kind (D881) as System -> Data shows it. */
|
|
16531
|
+
var StorageKindSchema = object({
|
|
16532
|
+
owner: string(),
|
|
16533
|
+
kind: string(),
|
|
16534
|
+
database: _enum(["settings", "events"]),
|
|
16535
|
+
class: string(),
|
|
16536
|
+
state: _enum([
|
|
16537
|
+
"declared",
|
|
16538
|
+
"orphaned",
|
|
16539
|
+
"dropped"
|
|
16540
|
+
]),
|
|
16541
|
+
/** `null` when the caller asked for no counts (`counts: false`). */
|
|
16542
|
+
rows: number().int().nonnegative().nullable(),
|
|
16543
|
+
/** Rows x the average size of a sample; null for an empty kind. */
|
|
16544
|
+
bytesEstimate: number().int().nonnegative().nullable(),
|
|
16545
|
+
writeTrigger: string(),
|
|
16546
|
+
retention: RecordRetentionSchema,
|
|
16547
|
+
/** `true` when the kind is an entry kind (the generic entries UI lists it). */
|
|
16548
|
+
entry: boolean(),
|
|
16549
|
+
/** The whole declaration, secret paths and entry descriptor included (the entries service builds its handle from it). */
|
|
16550
|
+
declaration: RecordKindDeclarationSchema
|
|
16551
|
+
});
|
|
16552
|
+
method(object({ ownerPrefix: string().min(1).optional() }), object({ tables: array(StorageTableSchema) }), { auth: "admin" }), method(object({
|
|
16553
|
+
collection: string().min(1),
|
|
16554
|
+
expectRows: number().int().nonnegative()
|
|
16555
|
+
}), object({
|
|
16556
|
+
dropped: literal(true),
|
|
16557
|
+
rows: number().int().nonnegative()
|
|
16558
|
+
}), {
|
|
16559
|
+
kind: "mutation",
|
|
16560
|
+
auth: "admin"
|
|
16561
|
+
}), method(object({
|
|
16562
|
+
owner: string().min(1).optional(),
|
|
16563
|
+
/** `false` skips the per-kind row count (a catalog read only). Default true. */
|
|
16564
|
+
counts: boolean().optional()
|
|
16565
|
+
}), object({ kinds: array(StorageKindSchema) }), { auth: "admin" }), method(RecordQueryInputSchema.extend({
|
|
16566
|
+
owner: string().min(1),
|
|
16567
|
+
kind: RecordKindNameSchema
|
|
16568
|
+
}), RecordQueryResultSchema, { auth: "admin" }), method(object({
|
|
16569
|
+
owner: string().min(1),
|
|
16570
|
+
kind: RecordKindNameSchema,
|
|
16571
|
+
records: array(RecordInputSchema).max(RECORD_BATCH_MAX),
|
|
16572
|
+
/** The LAST batch: the copy is complete, the boot guard stops asking. */
|
|
16573
|
+
complete: boolean().optional()
|
|
16574
|
+
}).refine((input) => input.records.length > 0 || input.complete === true, { message: "records must be non-empty unless complete is true" }), object({ adopted: number().int() }), {
|
|
16575
|
+
kind: "mutation",
|
|
16576
|
+
auth: "admin"
|
|
16577
|
+
}), method(object({
|
|
16578
|
+
collection: string().min(1),
|
|
16579
|
+
cursor: string().optional(),
|
|
16580
|
+
limit: number().int().min(1).max(1e3).optional()
|
|
16581
|
+
}), object({
|
|
16582
|
+
rows: array(object({
|
|
16583
|
+
id: string(),
|
|
16584
|
+
data: record(string(), unknown())
|
|
16585
|
+
})),
|
|
16586
|
+
nextCursor: string().nullable()
|
|
16587
|
+
}), { auth: "admin" }), method(object({ collection: string().min(1) }), object({ adopted: boolean() }), { auth: "admin" });
|
|
16588
|
+
/**
|
|
16589
|
+
* record-entries - the ONE admin surface for every list of user-created entries
|
|
16590
|
+
* (D881): notification targets, brokers, LLM profiles, anything an addon
|
|
16591
|
+
* declares as an ENTRY kind (`entry: { title }` in `defineRecordKinds`).
|
|
16592
|
+
*
|
|
16593
|
+
* The UI is generic. `listEntryKinds` hands it, per kind, the JSON Schema of
|
|
16594
|
+
* the entry body with `secret: true` on every credential field, so a password
|
|
16595
|
+
* field is derived from the schema and never from a name. `putEntry` takes the
|
|
16596
|
+
* redaction token for an untouched secret (the stored value is kept), a string
|
|
16597
|
+
* for a new one, and the clear instruction to remove one. A read never carries
|
|
16598
|
+
* a secret value, and a locked keychain refuses the write with
|
|
16599
|
+
* `records/secret-unavailable` instead of storing plaintext.
|
|
16600
|
+
*
|
|
16601
|
+
* Hub-only, served in-process (it acts for each entry's owner on the keychain).
|
|
16602
|
+
*/
|
|
16603
|
+
var EntryKindInfoSchema = object({
|
|
16604
|
+
owner: string(),
|
|
16605
|
+
kind: RecordKindNameSchema,
|
|
16606
|
+
title: string(),
|
|
16607
|
+
nameField: string(),
|
|
16608
|
+
/** JSON Schema of the body; `secret: true` marks a password field. */
|
|
16609
|
+
fields: record(string(), unknown()),
|
|
16610
|
+
secretPaths: array(string()),
|
|
16611
|
+
rows: number().int().nonnegative()
|
|
16612
|
+
});
|
|
16613
|
+
var EntryViewSchema = object({
|
|
16614
|
+
id: RecordIdSchema,
|
|
16615
|
+
name: string(),
|
|
16616
|
+
rev: number().int(),
|
|
16617
|
+
updatedAt: number(),
|
|
16618
|
+
/** Secret fields hold the redaction token. */
|
|
16619
|
+
data: RecordBodySchema
|
|
16620
|
+
});
|
|
16621
|
+
var EntryAddress = {
|
|
16622
|
+
owner: string().min(1),
|
|
16623
|
+
kind: RecordKindNameSchema
|
|
16624
|
+
};
|
|
16625
|
+
method(object({}), object({ kinds: array(EntryKindInfoSchema) }), { auth: "admin" }), method(object({ ...EntryAddress }), object({ entries: array(EntryViewSchema) }), { auth: "admin" }), method(object({
|
|
16626
|
+
...EntryAddress,
|
|
16627
|
+
id: RecordIdSchema.optional(),
|
|
16628
|
+
data: RecordBodySchema,
|
|
16629
|
+
ifRev: number().int().min(1).optional()
|
|
16630
|
+
}), object({
|
|
16631
|
+
id: string(),
|
|
16632
|
+
rev: number().int()
|
|
16633
|
+
}), {
|
|
16634
|
+
kind: "mutation",
|
|
16635
|
+
auth: "admin"
|
|
16636
|
+
}), method(object({
|
|
16637
|
+
...EntryAddress,
|
|
16638
|
+
id: RecordIdSchema
|
|
16639
|
+
}), object({ deleted: boolean() }), {
|
|
16640
|
+
kind: "mutation",
|
|
16641
|
+
auth: "admin"
|
|
16642
|
+
});
|
|
16643
|
+
/**
|
|
16066
16644
|
* `keychain` — the hub's encrypted store of secret values (D787).
|
|
16067
16645
|
*
|
|
16068
16646
|
* Settings blobs never hold a secret: they hold a marker
|
|
@@ -16603,6 +17181,16 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
|
|
|
16603
17181
|
kind: "mutation",
|
|
16604
17182
|
auth: "admin",
|
|
16605
17183
|
caller: "required"
|
|
17184
|
+
}), method(object({
|
|
17185
|
+
ref: string().min(1),
|
|
17186
|
+
value: string().min(1)
|
|
17187
|
+
}), object({
|
|
17188
|
+
ref: string(),
|
|
17189
|
+
version: number().int()
|
|
17190
|
+
}), {
|
|
17191
|
+
kind: "mutation",
|
|
17192
|
+
auth: "admin",
|
|
17193
|
+
caller: "required"
|
|
16606
17194
|
}), method(object({ refs: array(string().min(1)).max(1e3) }), object({
|
|
16607
17195
|
deleted: array(string()).readonly(),
|
|
16608
17196
|
kept: array(object({
|
|
@@ -39377,6 +39965,9 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
|
|
|
39377
39965
|
}), _void(), { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
|
|
39378
39966
|
kind: "mutation",
|
|
39379
39967
|
auth: "admin"
|
|
39968
|
+
}), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
|
|
39969
|
+
kind: "mutation",
|
|
39970
|
+
auth: "admin"
|
|
39380
39971
|
}), method(ProfileRefInputSchema, _void(), {
|
|
39381
39972
|
kind: "mutation",
|
|
39382
39973
|
auth: "admin"
|
|
@@ -49886,6 +50477,41 @@ var ServerRollbackInfoSchema = object({
|
|
|
49886
50477
|
atMs: number(),
|
|
49887
50478
|
reason: string()
|
|
49888
50479
|
});
|
|
50480
|
+
/**
|
|
50481
|
+
* The runner boot check (D877): the runners this node PLANNED (hub: one per
|
|
50482
|
+
* `resolveRunnerId` over its forked addons; agent: the runners its process
|
|
50483
|
+
* service holds, because only the hub plans) against the states the process
|
|
50484
|
+
* service reports. Kept in memory, recomputed by the same one-shot check after
|
|
50485
|
+
* every boot, served on `getServerPackageStatus`.
|
|
50486
|
+
*
|
|
50487
|
+
* `failed` is the D6 breaker's terminal state, `refused` a deterministic Init
|
|
50488
|
+
* refusal (an addon that said "I will not start, and here is why"), `missing` a
|
|
50489
|
+
* planned runner the process service has no entry for.
|
|
50490
|
+
*/
|
|
50491
|
+
var RunnerRefusalSchema = object({
|
|
50492
|
+
runnerId: string(),
|
|
50493
|
+
addonIds: array(string()),
|
|
50494
|
+
reason: string()
|
|
50495
|
+
});
|
|
50496
|
+
var RunnerBootCheckSchema = object({
|
|
50497
|
+
checkedAtMs: number(),
|
|
50498
|
+
/** Runners planned for this node. */
|
|
50499
|
+
expected: number(),
|
|
50500
|
+
/** Planned runners whose process is `running`. */
|
|
50501
|
+
running: number(),
|
|
50502
|
+
failed: array(string()),
|
|
50503
|
+
refused: array(RunnerRefusalSchema),
|
|
50504
|
+
missing: array(string()),
|
|
50505
|
+
/**
|
|
50506
|
+
* Runners still on their way: `starting`, or `crashed` waiting on a backoff
|
|
50507
|
+
* respawn. The check is FINAL only when this is empty; until then nothing is
|
|
50508
|
+
* pushed and the verdict is re-evaluated on the next runner state change.
|
|
50509
|
+
* Optional for version skew (absent = settled).
|
|
50510
|
+
*/
|
|
50511
|
+
pending: array(string()).optional(),
|
|
50512
|
+
/** True when the plan is the hub's (`missing` is then meaningful); false on an agent. */
|
|
50513
|
+
planKnown: boolean()
|
|
50514
|
+
});
|
|
49889
50515
|
var ServerPackageStatusSchema = object({
|
|
49890
50516
|
/** Root package name (`@camstack/server` on the hub). */
|
|
49891
50517
|
packageName: string(),
|
|
@@ -49948,7 +50574,14 @@ var ServerPackageStatusSchema = object({
|
|
|
49948
50574
|
* for version skew: an older provider's payload simply omits it, and an
|
|
49949
50575
|
* absent wrapper is unknown — never `native`.
|
|
49950
50576
|
*/
|
|
49951
|
-
wrapper: WrapperIdentitySchema.optional()
|
|
50577
|
+
wrapper: WrapperIdentitySchema.optional(),
|
|
50578
|
+
/**
|
|
50579
|
+
* What this node PLANNED to run against what its process service reports
|
|
50580
|
+
* (D877). Absent until the one-shot boot check has run (~60 s after boot) and
|
|
50581
|
+
* on a provider that predates it. Absent is "not checked yet", never "all
|
|
50582
|
+
* well": a consumer that needs the answer treats it as pending.
|
|
50583
|
+
*/
|
|
50584
|
+
runners: RunnerBootCheckSchema.optional()
|
|
49952
50585
|
});
|
|
49953
50586
|
var ServerUpdateCheckResultSchema = object({
|
|
49954
50587
|
packageName: string(),
|
|
@@ -49999,6 +50632,13 @@ var ServerUpdateOutcomeSchema = _enum([
|
|
|
49999
50632
|
"refused",
|
|
50000
50633
|
"failed"
|
|
50001
50634
|
]);
|
|
50635
|
+
/** One addon the pre-flight found the target version would refuse (D877). */
|
|
50636
|
+
var UpdateBlockerSchema = object({
|
|
50637
|
+
addonId: string(),
|
|
50638
|
+
reason: string(),
|
|
50639
|
+
/** What the operator does about it. */
|
|
50640
|
+
remedy: string()
|
|
50641
|
+
});
|
|
50002
50642
|
var ServerUpdateActionResultSchema = object({
|
|
50003
50643
|
accepted: boolean(),
|
|
50004
50644
|
targetVersion: string().nullable(),
|
|
@@ -50016,14 +50656,27 @@ var ServerUpdateActionResultSchema = object({
|
|
|
50016
50656
|
* The failure itself, verbatim enough to act on (the npm output for a
|
|
50017
50657
|
* staging install). Non-null only for `failed`.
|
|
50018
50658
|
*/
|
|
50019
|
-
error: string().nullable().optional()
|
|
50659
|
+
error: string().nullable().optional(),
|
|
50660
|
+
/**
|
|
50661
|
+
* The addons the target version would refuse to start on this node's live
|
|
50662
|
+
* store (D877), present when the pre-flight refused the update
|
|
50663
|
+
* (`reason: 'addon-would-refuse'`). Optional for version skew.
|
|
50664
|
+
*/
|
|
50665
|
+
blockers: array(UpdateBlockerSchema).optional()
|
|
50020
50666
|
});
|
|
50021
50667
|
method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), ServerUpdateCheckResultSchema, {
|
|
50022
50668
|
kind: "mutation",
|
|
50023
50669
|
auth: "admin"
|
|
50024
|
-
}), method(object({
|
|
50025
|
-
/** Explicit target version; omitted = latest from the registry. */
|
|
50026
|
-
version: string().optional()
|
|
50670
|
+
}), method(object({
|
|
50671
|
+
/** Explicit target version; omitted = latest from the registry. */
|
|
50672
|
+
version: string().optional(),
|
|
50673
|
+
/**
|
|
50674
|
+
* Apply even though the pre-flight (D877) found addons the target would
|
|
50675
|
+
* refuse to start. Off by default: those addons stay down until the
|
|
50676
|
+
* remedy is run, which is the incident this gate exists to prevent.
|
|
50677
|
+
*/
|
|
50678
|
+
acknowledgeRefusals: boolean().optional()
|
|
50679
|
+
}), ServerUpdateActionResultSchema, {
|
|
50027
50680
|
kind: "mutation",
|
|
50028
50681
|
auth: "admin",
|
|
50029
50682
|
timeoutMs: 16 * 6e4
|
|
@@ -52982,7 +53635,9 @@ var ManifestShapeSchema = object({
|
|
|
52982
53635
|
var AddonProcessSchema = object({
|
|
52983
53636
|
pid: number().optional(),
|
|
52984
53637
|
mode: string(),
|
|
52985
|
-
state: string()
|
|
53638
|
+
state: string(),
|
|
53639
|
+
/** Why the runner is `refused` (an addon's own words), when it is (D877). */
|
|
53640
|
+
reason: string().optional()
|
|
52986
53641
|
});
|
|
52987
53642
|
/**
|
|
52988
53643
|
* Per-addon health snapshot from the kernel's AddonHealthMonitor.
|
|
@@ -54371,6 +55026,12 @@ var ClimateControlStatusSchema = object({
|
|
|
54371
55026
|
/** Horizontal louver swing on/off. Null when the device has no
|
|
54372
55027
|
* horizontal swing surface (gate with `DeviceFeature.ClimateSwingHorizontal`). */
|
|
54373
55028
|
swingHorizontal: boolean().nullable(),
|
|
55029
|
+
/** Lowest setpoint the device accepts, Celsius. Absent / null = not reported. */
|
|
55030
|
+
minTemp: number().nullable().optional(),
|
|
55031
|
+
/** Highest setpoint the device accepts, Celsius. Absent / null = not reported. */
|
|
55032
|
+
maxTemp: number().nullable().optional(),
|
|
55033
|
+
/** Setpoint granularity, Celsius (0.5, 1). Absent / null = not reported. */
|
|
55034
|
+
tempStep: number().positive().nullable().optional(),
|
|
54374
55035
|
/** Ms epoch when the slice was last updated (push or command). */
|
|
54375
55036
|
lastFetchedAt: number()
|
|
54376
55037
|
});
|
|
@@ -57151,7 +57812,19 @@ var TlsStatusSchema = object({
|
|
|
57151
57812
|
sans: array(string()),
|
|
57152
57813
|
caCertPem: string().nullable(),
|
|
57153
57814
|
reissueError: string().nullable(),
|
|
57154
|
-
restartRequired: boolean()
|
|
57815
|
+
restartRequired: boolean(),
|
|
57816
|
+
/** An uploaded certificate is served but no CA is kept for it and it is not publicly signed (D873). */
|
|
57817
|
+
caMissing: boolean(),
|
|
57818
|
+
/** Does the hub's own generated CA carry a critical name constraint? `null` while it has none. */
|
|
57819
|
+
localCaConstrained: boolean().nullable(),
|
|
57820
|
+
/** ISO time the generated CA was replaced by a constrained one; devices must re-download it. */
|
|
57821
|
+
caReplacedAt: string().nullable(),
|
|
57822
|
+
/** The uploaded certificate kept on disk, selectable again after "Revert to generated". */
|
|
57823
|
+
storedUpload: object({
|
|
57824
|
+
leafFingerprintSha256: string(),
|
|
57825
|
+
validTo: string(),
|
|
57826
|
+
hasCa: boolean()
|
|
57827
|
+
}).nullable()
|
|
57155
57828
|
});
|
|
57156
57829
|
method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(object({
|
|
57157
57830
|
/**
|
|
@@ -57207,6 +57880,9 @@ method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(obje
|
|
|
57207
57880
|
}), method(_void(), object({ pem: string() })), method(_void(), TlsStatusSchema, {
|
|
57208
57881
|
kind: "mutation",
|
|
57209
57882
|
auth: "admin"
|
|
57883
|
+
}), method(_void(), TlsStatusSchema, {
|
|
57884
|
+
kind: "mutation",
|
|
57885
|
+
auth: "admin"
|
|
57210
57886
|
});
|
|
57211
57887
|
var LockControlStatusSchema = object({
|
|
57212
57888
|
/** Lifecycle state of the lock. `jammed` means the motor reported
|
|
@@ -64162,7 +64838,11 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
64162
64838
|
kind: "mutation",
|
|
64163
64839
|
auth: "admin",
|
|
64164
64840
|
access: "delete"
|
|
64165
|
-
}), method(object({ userId: string() }), TotpStatusSchema, { auth: "admin" }), method(
|
|
64841
|
+
}), method(object({ userId: string() }), TotpStatusSchema, { auth: "admin" }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
|
|
64842
|
+
kind: "mutation",
|
|
64843
|
+
auth: "admin",
|
|
64844
|
+
access: "create"
|
|
64845
|
+
}), method(object({
|
|
64166
64846
|
userId: string(),
|
|
64167
64847
|
code: string()
|
|
64168
64848
|
}), object({ valid: boolean() }), {
|
|
@@ -65974,13 +66654,14 @@ var BaseDevice = class {
|
|
|
65974
66654
|
get state() {
|
|
65975
66655
|
if (!this._stateProxyCache) {
|
|
65976
66656
|
const cache = {};
|
|
65977
|
-
const handler = { get: (
|
|
66657
|
+
const handler = { get: (target, key) => {
|
|
65978
66658
|
const k = key;
|
|
65979
|
-
|
|
66659
|
+
const existing = Reflect.get(target, k);
|
|
66660
|
+
if (existing !== void 0) return existing;
|
|
65980
66661
|
const cap = DEVICE_LOCAL_STATE_CAPS[k];
|
|
65981
66662
|
if (!cap) return void 0;
|
|
65982
66663
|
const proxy = this.sliceProxy(cap);
|
|
65983
|
-
|
|
66664
|
+
Reflect.set(target, k, proxy);
|
|
65984
66665
|
return proxy;
|
|
65985
66666
|
} };
|
|
65986
66667
|
this._stateProxyCache = new Proxy(cache, handler);
|
|
@@ -66179,7 +66860,7 @@ var BaseDevice = class {
|
|
|
66179
66860
|
async updateSourceInfo(patch) {
|
|
66180
66861
|
const next = mergeSourceInfo(this.sourceInfo, patch);
|
|
66181
66862
|
this._sourceInfoCache = Object.freeze({ ...next });
|
|
66182
|
-
const action = this.ctx.api
|
|
66863
|
+
const action = this.ctx.api.deviceManager?.setMetadata;
|
|
66183
66864
|
if (action) try {
|
|
66184
66865
|
await action.mutate({
|
|
66185
66866
|
deviceId: this.id,
|
|
@@ -66214,7 +66895,7 @@ var BaseDevice = class {
|
|
|
66214
66895
|
* device boot on a meta refresh.
|
|
66215
66896
|
*/
|
|
66216
66897
|
async refreshFeatures() {
|
|
66217
|
-
const action = this.ctx.api
|
|
66898
|
+
const action = this.ctx.api.deviceManager?.registerDevice;
|
|
66218
66899
|
if (!action) return;
|
|
66219
66900
|
try {
|
|
66220
66901
|
await action.mutate({
|
|
@@ -67139,6 +67820,10 @@ var BaseDeviceProvider = class extends BaseAddon {
|
|
|
67139
67820
|
return toDeviceSummary(device, this.addonId);
|
|
67140
67821
|
}
|
|
67141
67822
|
};
|
|
67823
|
+
/** Map entry helper — concrete camera/hub classes widen to `DeviceConstructor<IDevice>`. */
|
|
67824
|
+
function widenDeviceConstructor(ctor) {
|
|
67825
|
+
return ctor;
|
|
67826
|
+
}
|
|
67142
67827
|
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;
|
|
67143
67828
|
new Set(Object.values(DeviceType));
|
|
67144
67829
|
Object.freeze({
|
|
@@ -68288,6 +68973,12 @@ Object.freeze({
|
|
|
68288
68973
|
addonId: null,
|
|
68289
68974
|
access: "view"
|
|
68290
68975
|
},
|
|
68976
|
+
"coreBlocks.migrateRawSecrets": {
|
|
68977
|
+
capName: "core-blocks",
|
|
68978
|
+
capScope: "system",
|
|
68979
|
+
addonId: null,
|
|
68980
|
+
access: "create"
|
|
68981
|
+
},
|
|
68291
68982
|
"coreBlocks.restart": {
|
|
68292
68983
|
capName: "core-blocks",
|
|
68293
68984
|
capScope: "system",
|
|
@@ -69974,6 +70665,12 @@ Object.freeze({
|
|
|
69974
70665
|
addonId: null,
|
|
69975
70666
|
access: "create"
|
|
69976
70667
|
},
|
|
70668
|
+
"keychainAdmin.importSecret": {
|
|
70669
|
+
capName: "keychain-admin",
|
|
70670
|
+
capScope: "system",
|
|
70671
|
+
addonId: null,
|
|
70672
|
+
access: "create"
|
|
70673
|
+
},
|
|
69977
70674
|
"keychainAdmin.listAudit": {
|
|
69978
70675
|
capName: "keychain-admin",
|
|
69979
70676
|
capScope: "system",
|
|
@@ -70142,6 +70839,12 @@ Object.freeze({
|
|
|
70142
70839
|
addonId: null,
|
|
70143
70840
|
access: "view"
|
|
70144
70841
|
},
|
|
70842
|
+
"llm.migrateRawSecrets": {
|
|
70843
|
+
capName: "llm",
|
|
70844
|
+
capScope: "system",
|
|
70845
|
+
addonId: null,
|
|
70846
|
+
access: "create"
|
|
70847
|
+
},
|
|
70145
70848
|
"llm.resolveModelRef": {
|
|
70146
70849
|
capName: "llm",
|
|
70147
70850
|
capScope: "system",
|
|
@@ -70370,6 +71073,12 @@ Object.freeze({
|
|
|
70370
71073
|
addonId: null,
|
|
70371
71074
|
access: "create"
|
|
70372
71075
|
},
|
|
71076
|
+
"localNetwork.useStoredUploadedCertificate": {
|
|
71077
|
+
capName: "local-network",
|
|
71078
|
+
capScope: "system",
|
|
71079
|
+
addonId: null,
|
|
71080
|
+
access: "create"
|
|
71081
|
+
},
|
|
70373
71082
|
"lockControl.getStatus": {
|
|
70374
71083
|
capName: "lock-control",
|
|
70375
71084
|
capScope: "device",
|
|
@@ -73022,6 +73731,30 @@ Object.freeze({
|
|
|
73022
73731
|
addonId: null,
|
|
73023
73732
|
access: "create"
|
|
73024
73733
|
},
|
|
73734
|
+
"recordEntries.deleteEntry": {
|
|
73735
|
+
capName: "record-entries",
|
|
73736
|
+
capScope: "system",
|
|
73737
|
+
addonId: null,
|
|
73738
|
+
access: "delete"
|
|
73739
|
+
},
|
|
73740
|
+
"recordEntries.listEntries": {
|
|
73741
|
+
capName: "record-entries",
|
|
73742
|
+
capScope: "system",
|
|
73743
|
+
addonId: null,
|
|
73744
|
+
access: "view"
|
|
73745
|
+
},
|
|
73746
|
+
"recordEntries.listEntryKinds": {
|
|
73747
|
+
capName: "record-entries",
|
|
73748
|
+
capScope: "system",
|
|
73749
|
+
addonId: null,
|
|
73750
|
+
access: "view"
|
|
73751
|
+
},
|
|
73752
|
+
"recordEntries.putEntry": {
|
|
73753
|
+
capName: "record-entries",
|
|
73754
|
+
capScope: "system",
|
|
73755
|
+
addonId: null,
|
|
73756
|
+
access: "create"
|
|
73757
|
+
},
|
|
73025
73758
|
"recording.getAvailability": {
|
|
73026
73759
|
capName: "recording",
|
|
73027
73760
|
capScope: "device",
|
|
@@ -73322,6 +74055,102 @@ Object.freeze({
|
|
|
73322
74055
|
addonId: null,
|
|
73323
74056
|
access: "view"
|
|
73324
74057
|
},
|
|
74058
|
+
"records.aggregate": {
|
|
74059
|
+
capName: "records",
|
|
74060
|
+
capScope: "system",
|
|
74061
|
+
addonId: null,
|
|
74062
|
+
access: "view"
|
|
74063
|
+
},
|
|
74064
|
+
"records.allocateId": {
|
|
74065
|
+
capName: "records",
|
|
74066
|
+
capScope: "system",
|
|
74067
|
+
addonId: null,
|
|
74068
|
+
access: "create"
|
|
74069
|
+
},
|
|
74070
|
+
"records.count": {
|
|
74071
|
+
capName: "records",
|
|
74072
|
+
capScope: "system",
|
|
74073
|
+
addonId: null,
|
|
74074
|
+
access: "view"
|
|
74075
|
+
},
|
|
74076
|
+
"records.declareKinds": {
|
|
74077
|
+
capName: "records",
|
|
74078
|
+
capScope: "system",
|
|
74079
|
+
addonId: null,
|
|
74080
|
+
access: "create"
|
|
74081
|
+
},
|
|
74082
|
+
"records.delete": {
|
|
74083
|
+
capName: "records",
|
|
74084
|
+
capScope: "system",
|
|
74085
|
+
addonId: null,
|
|
74086
|
+
access: "delete"
|
|
74087
|
+
},
|
|
74088
|
+
"records.deleteDevice": {
|
|
74089
|
+
capName: "records",
|
|
74090
|
+
capScope: "system",
|
|
74091
|
+
addonId: null,
|
|
74092
|
+
access: "delete"
|
|
74093
|
+
},
|
|
74094
|
+
"records.deleteMany": {
|
|
74095
|
+
capName: "records",
|
|
74096
|
+
capScope: "system",
|
|
74097
|
+
addonId: null,
|
|
74098
|
+
access: "delete"
|
|
74099
|
+
},
|
|
74100
|
+
"records.deleteWhere": {
|
|
74101
|
+
capName: "records",
|
|
74102
|
+
capScope: "system",
|
|
74103
|
+
addonId: null,
|
|
74104
|
+
access: "delete"
|
|
74105
|
+
},
|
|
74106
|
+
"records.get": {
|
|
74107
|
+
capName: "records",
|
|
74108
|
+
capScope: "system",
|
|
74109
|
+
addonId: null,
|
|
74110
|
+
access: "view"
|
|
74111
|
+
},
|
|
74112
|
+
"records.getMany": {
|
|
74113
|
+
capName: "records",
|
|
74114
|
+
capScope: "system",
|
|
74115
|
+
addonId: null,
|
|
74116
|
+
access: "view"
|
|
74117
|
+
},
|
|
74118
|
+
"records.histogram": {
|
|
74119
|
+
capName: "records",
|
|
74120
|
+
capScope: "system",
|
|
74121
|
+
addonId: null,
|
|
74122
|
+
access: "view"
|
|
74123
|
+
},
|
|
74124
|
+
"records.patch": {
|
|
74125
|
+
capName: "records",
|
|
74126
|
+
capScope: "system",
|
|
74127
|
+
addonId: null,
|
|
74128
|
+
access: "create"
|
|
74129
|
+
},
|
|
74130
|
+
"records.put": {
|
|
74131
|
+
capName: "records",
|
|
74132
|
+
capScope: "system",
|
|
74133
|
+
addonId: null,
|
|
74134
|
+
access: "create"
|
|
74135
|
+
},
|
|
74136
|
+
"records.putMany": {
|
|
74137
|
+
capName: "records",
|
|
74138
|
+
capScope: "system",
|
|
74139
|
+
addonId: null,
|
|
74140
|
+
access: "create"
|
|
74141
|
+
},
|
|
74142
|
+
"records.query": {
|
|
74143
|
+
capName: "records",
|
|
74144
|
+
capScope: "system",
|
|
74145
|
+
addonId: null,
|
|
74146
|
+
access: "view"
|
|
74147
|
+
},
|
|
74148
|
+
"records.secretRefs": {
|
|
74149
|
+
capName: "records",
|
|
74150
|
+
capScope: "system",
|
|
74151
|
+
addonId: null,
|
|
74152
|
+
access: "view"
|
|
74153
|
+
},
|
|
73325
74154
|
"sceneMonitor.captureReference": {
|
|
73326
74155
|
capName: "scene-monitor",
|
|
73327
74156
|
capScope: "device",
|
|
@@ -73754,6 +74583,48 @@ Object.freeze({
|
|
|
73754
74583
|
addonId: null,
|
|
73755
74584
|
access: "create"
|
|
73756
74585
|
},
|
|
74586
|
+
"storageAdmin.adoptRecords": {
|
|
74587
|
+
capName: "storage-admin",
|
|
74588
|
+
capScope: "system",
|
|
74589
|
+
addonId: null,
|
|
74590
|
+
access: "create"
|
|
74591
|
+
},
|
|
74592
|
+
"storageAdmin.dropCollection": {
|
|
74593
|
+
capName: "storage-admin",
|
|
74594
|
+
capScope: "system",
|
|
74595
|
+
addonId: null,
|
|
74596
|
+
access: "delete"
|
|
74597
|
+
},
|
|
74598
|
+
"storageAdmin.isAdoptedLegacyTable": {
|
|
74599
|
+
capName: "storage-admin",
|
|
74600
|
+
capScope: "system",
|
|
74601
|
+
addonId: null,
|
|
74602
|
+
access: "view"
|
|
74603
|
+
},
|
|
74604
|
+
"storageAdmin.listKinds": {
|
|
74605
|
+
capName: "storage-admin",
|
|
74606
|
+
capScope: "system",
|
|
74607
|
+
addonId: null,
|
|
74608
|
+
access: "view"
|
|
74609
|
+
},
|
|
74610
|
+
"storageAdmin.listTables": {
|
|
74611
|
+
capName: "storage-admin",
|
|
74612
|
+
capScope: "system",
|
|
74613
|
+
addonId: null,
|
|
74614
|
+
access: "view"
|
|
74615
|
+
},
|
|
74616
|
+
"storageAdmin.readLegacyCollection": {
|
|
74617
|
+
capName: "storage-admin",
|
|
74618
|
+
capScope: "system",
|
|
74619
|
+
addonId: null,
|
|
74620
|
+
access: "view"
|
|
74621
|
+
},
|
|
74622
|
+
"storageAdmin.readRecords": {
|
|
74623
|
+
capName: "storage-admin",
|
|
74624
|
+
capScope: "system",
|
|
74625
|
+
addonId: null,
|
|
74626
|
+
access: "view"
|
|
74627
|
+
},
|
|
73757
74628
|
"storageEvictable.evict": {
|
|
73758
74629
|
capName: "storage-evictable",
|
|
73759
74630
|
capScope: "system",
|
|
@@ -74666,6 +75537,12 @@ Object.freeze({
|
|
|
74666
75537
|
addonId: null,
|
|
74667
75538
|
access: "view"
|
|
74668
75539
|
},
|
|
75540
|
+
"userManagement.migrateRawSecrets": {
|
|
75541
|
+
capName: "user-management",
|
|
75542
|
+
capScope: "system",
|
|
75543
|
+
addonId: null,
|
|
75544
|
+
access: "create"
|
|
75545
|
+
},
|
|
74669
75546
|
"userManagement.oauthExchangeCode": {
|
|
74670
75547
|
capName: "user-management",
|
|
74671
75548
|
capScope: "system",
|
|
@@ -77548,6 +78425,37 @@ Object.freeze({
|
|
|
77548
78425
|
form: "single",
|
|
77549
78426
|
optional: false
|
|
77550
78427
|
}],
|
|
78428
|
+
"records.count": [{
|
|
78429
|
+
name: "deviceId",
|
|
78430
|
+
form: "single",
|
|
78431
|
+
optional: true
|
|
78432
|
+
}],
|
|
78433
|
+
"records.deleteDevice": [{
|
|
78434
|
+
name: "deviceId",
|
|
78435
|
+
form: "single",
|
|
78436
|
+
optional: false
|
|
78437
|
+
}],
|
|
78438
|
+
"records.deleteWhere": [{
|
|
78439
|
+
name: "deviceId",
|
|
78440
|
+
form: "single",
|
|
78441
|
+
optional: true
|
|
78442
|
+
}],
|
|
78443
|
+
"records.histogram": [{
|
|
78444
|
+
name: "deviceId",
|
|
78445
|
+
form: "single",
|
|
78446
|
+
optional: true
|
|
78447
|
+
}],
|
|
78448
|
+
"records.putMany": [{
|
|
78449
|
+
name: "records",
|
|
78450
|
+
form: "object-array",
|
|
78451
|
+
optional: false,
|
|
78452
|
+
itemField: "deviceId"
|
|
78453
|
+
}],
|
|
78454
|
+
"records.query": [{
|
|
78455
|
+
name: "deviceId",
|
|
78456
|
+
form: "single",
|
|
78457
|
+
optional: true
|
|
78458
|
+
}],
|
|
77551
78459
|
"sceneMonitor.captureReference": [{
|
|
77552
78460
|
name: "deviceId",
|
|
77553
78461
|
form: "single",
|
|
@@ -77664,6 +78572,17 @@ Object.freeze({
|
|
|
77664
78572
|
form: "single",
|
|
77665
78573
|
optional: false
|
|
77666
78574
|
}],
|
|
78575
|
+
"storageAdmin.adoptRecords": [{
|
|
78576
|
+
name: "records",
|
|
78577
|
+
form: "object-array",
|
|
78578
|
+
optional: false,
|
|
78579
|
+
itemField: "deviceId"
|
|
78580
|
+
}],
|
|
78581
|
+
"storageAdmin.readRecords": [{
|
|
78582
|
+
name: "deviceId",
|
|
78583
|
+
form: "single",
|
|
78584
|
+
optional: true
|
|
78585
|
+
}],
|
|
77667
78586
|
"streamBroker.acquireEgressTranscode": [{
|
|
77668
78587
|
name: "deviceId",
|
|
77669
78588
|
form: "single",
|
|
@@ -96002,7 +96921,7 @@ function isMeaningfulIdentifier(s) {
|
|
|
96002
96921
|
var AmcrestProviderAddon = class extends BaseDeviceProvider {
|
|
96003
96922
|
addonId = AMCREST_ADDON_ID;
|
|
96004
96923
|
providerName = "Amcrest";
|
|
96005
|
-
deviceClasses = { [DeviceType.Camera]: AmcrestCamera };
|
|
96924
|
+
deviceClasses = { [DeviceType.Camera]: widenDeviceConstructor(AmcrestCamera) };
|
|
96006
96925
|
constructor() {
|
|
96007
96926
|
super({});
|
|
96008
96927
|
}
|