@camstack/addon-provider-wyze 0.2.130 → 0.2.132
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 +2045 -63
- package/dist/addon.mjs +2045 -63
- package/package.json +1 -1
package/dist/addon.mjs
CHANGED
|
@@ -10,7 +10,7 @@ import { getCACertificates, setDefaultCACertificates } from "node:tls";
|
|
|
10
10
|
//#region \0rolldown/runtime.js
|
|
11
11
|
var __require$1 = /* @__PURE__ */ createRequire(import.meta.url);
|
|
12
12
|
//#endregion
|
|
13
|
-
//#region ../types/dist/event-category-
|
|
13
|
+
//#region ../types/dist/event-category-DaIZi00R.mjs
|
|
14
14
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
15
15
|
EventCategory["SystemBoot"] = "system.boot";
|
|
16
16
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -89,6 +89,13 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
89
89
|
*/
|
|
90
90
|
EventCategory["AddonLoadFailed"] = "addon.load-failed";
|
|
91
91
|
/**
|
|
92
|
+
* A keychain value was stored or removed (D787). Carries the ref, its
|
|
93
|
+
* owner and the new version — NEVER the value. A process holding the ref
|
|
94
|
+
* drops its cached copy and the owning `BaseAddon` re-resolves its config.
|
|
95
|
+
* Telemetry (D8): a process that misses it still revalidates by version.
|
|
96
|
+
*/
|
|
97
|
+
EventCategory["KeychainChanged"] = "keychain.changed";
|
|
98
|
+
/**
|
|
92
99
|
* Addon recovered from a previous failure. Emitted when an addon
|
|
93
100
|
* transitions from `failed` back to `healthy` (typically via the
|
|
94
101
|
* monitor's auto-retry loop, or after manual `addons.retryLoad`).
|
|
@@ -5381,7 +5388,7 @@ var ZodIssueCode = {
|
|
|
5381
5388
|
var ZodFirstPartyTypeKind;
|
|
5382
5389
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5383
5390
|
//#endregion
|
|
5384
|
-
//#region ../types/dist/sleep-
|
|
5391
|
+
//#region ../types/dist/sleep-Cr5YOk3m.mjs
|
|
5385
5392
|
/**
|
|
5386
5393
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5387
5394
|
* window to float samples (D455).
|
|
@@ -5460,6 +5467,97 @@ function buildAlawTable() {
|
|
|
5460
5467
|
}
|
|
5461
5468
|
buildUlawTable();
|
|
5462
5469
|
buildAlawTable();
|
|
5470
|
+
/** Is this field's stored value a credential? */
|
|
5471
|
+
function isSecretConfigField(field) {
|
|
5472
|
+
if (field.type === "password") return true;
|
|
5473
|
+
return "secret" in field && field.secret === true;
|
|
5474
|
+
}
|
|
5475
|
+
/**
|
|
5476
|
+
* Is this field's value stored in the KEYCHAIN (D787)? Every secret field is,
|
|
5477
|
+
* by its TYPE, unless it opts out with `storage: 'inline'` — never by its name.
|
|
5478
|
+
*/
|
|
5479
|
+
function isKeychainStoredField(field) {
|
|
5480
|
+
if (!isSecretConfigField(field)) return false;
|
|
5481
|
+
if (field.type === "textarea" && field.isJson === true) return false;
|
|
5482
|
+
return !("storage" in field && field.storage === "inline");
|
|
5483
|
+
}
|
|
5484
|
+
/**
|
|
5485
|
+
* What a settings blob holds where a secret used to be.
|
|
5486
|
+
*
|
|
5487
|
+
* A keychain-stored field never holds its value. It holds a self-describing
|
|
5488
|
+
* MARKER, `{"$secret":"secret://…","v":1}` — an object, never a string, so no
|
|
5489
|
+
* code can mistake it for a credential and no form can send it to a camera as
|
|
5490
|
+
* a password. The empty state is `null` / absent, never `''`.
|
|
5491
|
+
*
|
|
5492
|
+
* The same shapes travel to and from the admin UI:
|
|
5493
|
+
*
|
|
5494
|
+
* - read: `hydrateSchema` hands a secret field a {@link SecretFieldView}
|
|
5495
|
+
* (`{ $secret, v, set: true }`) or `null` — the browser learns whether a
|
|
5496
|
+
* value is set, never the value.
|
|
5497
|
+
* - write: an untouched field submits the view back unchanged (KEEP); a typed
|
|
5498
|
+
* value is a plain non-empty string (CHANGE); the Clear button submits
|
|
5499
|
+
* {@link SECRET_CLEAR} (CLEAR). `''`, `null` and the legacy redaction tokens
|
|
5500
|
+
* are KEEP — an empty string is what a defaults-fallback pushes back, and
|
|
5501
|
+
* treating it as "clear" is how a save destroyed a stored credential before.
|
|
5502
|
+
*
|
|
5503
|
+
* Pure and browser-safe.
|
|
5504
|
+
*/
|
|
5505
|
+
var SECRET_CLEAR = { $secretClear: true };
|
|
5506
|
+
/** The `'***'` token D634 redaction writes for non-admins. */
|
|
5507
|
+
var LEGACY_DEVICE_REDACTION = "***";
|
|
5508
|
+
function isRecord$1(value) {
|
|
5509
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5510
|
+
}
|
|
5511
|
+
function makeSecretMarker(ref) {
|
|
5512
|
+
return {
|
|
5513
|
+
$secret: ref,
|
|
5514
|
+
v: 1
|
|
5515
|
+
};
|
|
5516
|
+
}
|
|
5517
|
+
/** A stored marker: an object whose `$secret` is a non-empty string. */
|
|
5518
|
+
function isSecretMarker(value) {
|
|
5519
|
+
if (!isRecord$1(value)) return false;
|
|
5520
|
+
const ref = value["$secret"];
|
|
5521
|
+
return typeof ref === "string" && ref.length > 0;
|
|
5522
|
+
}
|
|
5523
|
+
function isSecretClear(value) {
|
|
5524
|
+
return isRecord$1(value) && value["$secretClear"] === true;
|
|
5525
|
+
}
|
|
5526
|
+
/**
|
|
5527
|
+
* The UI view of a stored secret field value: a marker becomes "set", inline
|
|
5528
|
+
* plaintext becomes "set (inline)", nothing becomes `null`. A value never
|
|
5529
|
+
* survives this function.
|
|
5530
|
+
*/
|
|
5531
|
+
function toSecretFieldView(stored) {
|
|
5532
|
+
if (isSecretMarker(stored)) return {
|
|
5533
|
+
$secret: stored.$secret,
|
|
5534
|
+
v: 1,
|
|
5535
|
+
set: true
|
|
5536
|
+
};
|
|
5537
|
+
if (typeof stored === "string" && stored.length > 0) return {
|
|
5538
|
+
$secret: null,
|
|
5539
|
+
v: 1,
|
|
5540
|
+
set: true,
|
|
5541
|
+
inline: true
|
|
5542
|
+
};
|
|
5543
|
+
return null;
|
|
5544
|
+
}
|
|
5545
|
+
/**
|
|
5546
|
+
* Classify an incoming value for a secret path. Only a non-empty string that is
|
|
5547
|
+
* not a redaction token sets a value; only {@link SECRET_CLEAR} clears.
|
|
5548
|
+
* Everything else — a marker (ours or anyone's), a UI view, `''`, `null`,
|
|
5549
|
+
* `undefined`, a redaction token, a non-string — keeps what is stored.
|
|
5550
|
+
*/
|
|
5551
|
+
function classifySecretWrite(incoming) {
|
|
5552
|
+
if (isSecretClear(incoming)) return { kind: "clear" };
|
|
5553
|
+
if (typeof incoming !== "string") return { kind: "keep" };
|
|
5554
|
+
if (incoming.length === 0) return { kind: "keep" };
|
|
5555
|
+
if (incoming === "__camstack_redacted__" || incoming === LEGACY_DEVICE_REDACTION) return { kind: "keep" };
|
|
5556
|
+
return {
|
|
5557
|
+
kind: "set",
|
|
5558
|
+
value: incoming
|
|
5559
|
+
};
|
|
5560
|
+
}
|
|
5463
5561
|
Object.fromEntries([
|
|
5464
5562
|
{
|
|
5465
5563
|
id: "overview",
|
|
@@ -5631,33 +5729,19 @@ Object.fromEntries([
|
|
|
5631
5729
|
function isValuelessField(field) {
|
|
5632
5730
|
return field.type === "separator" || field.type === "info" || field.type === "qr-code" || field.type === "button" || field.type === "object-array" || field.type === "widget" || field.type === "addon-action-button" || field.type === "device-action-button";
|
|
5633
5731
|
}
|
|
5634
|
-
|
|
5635
|
-
* Merge a `ConfigUISchema` with a raw `values` record into a
|
|
5636
|
-
* `ConfigUISchemaWithValues`. Used by every `get*Settings` backend endpoint
|
|
5637
|
-
* before returning to the admin UI. Groups are walked recursively.
|
|
5638
|
-
*
|
|
5639
|
-
* For each leaf field:
|
|
5640
|
-
* - structural fields (`separator`, `info`, `button`) pass through unchanged
|
|
5641
|
-
* - other fields get `value = values[key] ?? field.default ?? null`
|
|
5642
|
-
*
|
|
5643
|
-
* Unknown keys in `values` (keys not declared in the schema) are silently
|
|
5644
|
-
* ignored — they don't contribute to the output. Missing keys fall back to
|
|
5645
|
-
* the schema default or `null`. This mirrors the old backend behaviour where
|
|
5646
|
-
* `FormBuilder` rendered `values[key] ?? field.default`.
|
|
5647
|
-
*/
|
|
5648
|
-
function hydrateSchema(schema, values) {
|
|
5732
|
+
function hydrateSchema(schema, values, options = {}) {
|
|
5649
5733
|
return {
|
|
5650
5734
|
...schema.tabs ? { tabs: [...schema.tabs] } : {},
|
|
5651
5735
|
sections: schema.sections.map((section) => ({
|
|
5652
5736
|
...section,
|
|
5653
|
-
fields: section.fields.map((field) => hydrateField(field, values))
|
|
5737
|
+
fields: section.fields.map((field) => hydrateField(field, values, options))
|
|
5654
5738
|
}))
|
|
5655
5739
|
};
|
|
5656
5740
|
}
|
|
5657
|
-
function hydrateField(field, values) {
|
|
5741
|
+
function hydrateField(field, values, options) {
|
|
5658
5742
|
if (isValuelessField(field)) return field;
|
|
5659
5743
|
if (field.type === "group") {
|
|
5660
|
-
const hydratedChildren = field.fields.map((child) => hydrateField(child, values));
|
|
5744
|
+
const hydratedChildren = field.fields.map((child) => hydrateField(child, values, options));
|
|
5661
5745
|
return {
|
|
5662
5746
|
...field,
|
|
5663
5747
|
fields: hydratedChildren
|
|
@@ -5666,7 +5750,7 @@ function hydrateField(field, values) {
|
|
|
5666
5750
|
if (field.type === "sub-tabs") {
|
|
5667
5751
|
const hydratedTabs = field.tabs.map((tab) => ({
|
|
5668
5752
|
...tab,
|
|
5669
|
-
fields: tab.fields.map((child) => hydrateField(child, values))
|
|
5753
|
+
fields: tab.fields.map((child) => hydrateField(child, values, options))
|
|
5670
5754
|
}));
|
|
5671
5755
|
return {
|
|
5672
5756
|
...field,
|
|
@@ -5676,6 +5760,33 @@ function hydrateField(field, values) {
|
|
|
5676
5760
|
const key = field.key;
|
|
5677
5761
|
const storedValue = Object.prototype.hasOwnProperty.call(values, key) ? values[key] : void 0;
|
|
5678
5762
|
const defaultValue = field.default;
|
|
5763
|
+
const asView = (v) => isSecretMarker(v) || options.inlineSecretsAsViews === true && v !== void 0;
|
|
5764
|
+
if (isKeychainStoredField(field) && asView(storedValue)) return {
|
|
5765
|
+
...field,
|
|
5766
|
+
value: toSecretFieldView(storedValue)
|
|
5767
|
+
};
|
|
5768
|
+
if (isKeychainStoredField(field) && options.inlineSecretsAsViews === true) return {
|
|
5769
|
+
...field,
|
|
5770
|
+
value: null
|
|
5771
|
+
};
|
|
5772
|
+
if (field.type === "editable-array" && Array.isArray(storedValue)) {
|
|
5773
|
+
const secretItemKeys = field.itemFields.filter((item) => "key" in item && isKeychainStoredField(item)).map((item) => "key" in item ? item.key : "");
|
|
5774
|
+
if (secretItemKeys.length > 0) {
|
|
5775
|
+
const rows = storedValue.map((row) => {
|
|
5776
|
+
if (row === null || typeof row !== "object" || Array.isArray(row)) return row;
|
|
5777
|
+
const out = { ...row };
|
|
5778
|
+
for (const k of secretItemKeys) {
|
|
5779
|
+
const v = Reflect.get(row, k);
|
|
5780
|
+
if (asView(v)) out[k] = toSecretFieldView(v);
|
|
5781
|
+
}
|
|
5782
|
+
return out;
|
|
5783
|
+
});
|
|
5784
|
+
return {
|
|
5785
|
+
...field,
|
|
5786
|
+
value: rows
|
|
5787
|
+
};
|
|
5788
|
+
}
|
|
5789
|
+
}
|
|
5679
5790
|
if (field.multiple) {
|
|
5680
5791
|
const stored = Array.isArray(storedValue) ? storedValue : storedValue !== void 0 && storedValue !== null ? [storedValue] : [];
|
|
5681
5792
|
const itemFallback = field.multiple.itemDefault !== void 0 ? field.multiple.itemDefault : defaultValue !== void 0 ? defaultValue : typeOf(field) === "string" ? "" : null;
|
|
@@ -5918,6 +6029,431 @@ function projectStore(store, perNodeKeys, nodeId) {
|
|
|
5918
6029
|
}
|
|
5919
6030
|
return out;
|
|
5920
6031
|
}
|
|
6032
|
+
var GLOBAL_SCOPE = { kind: "global" };
|
|
6033
|
+
/** The scope every addon-wide (not per-node, not per-device) setting lives in. */
|
|
6034
|
+
function globalSecretScope() {
|
|
6035
|
+
return GLOBAL_SCOPE;
|
|
6036
|
+
}
|
|
6037
|
+
function encodeSegment(value) {
|
|
6038
|
+
return encodeURIComponent(value);
|
|
6039
|
+
}
|
|
6040
|
+
/**
|
|
6041
|
+
* The field path of a value inside an array item, addressed by the item's id:
|
|
6042
|
+
* `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
|
|
6043
|
+
* `providers[authentik].clientSecret`.
|
|
6044
|
+
*/
|
|
6045
|
+
function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
|
|
6046
|
+
return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
|
|
6047
|
+
}
|
|
6048
|
+
/** A write to a secret path could not be stored in the keychain, so it was refused. */
|
|
6049
|
+
var KeychainWriteRefusedError = class extends Error {
|
|
6050
|
+
fieldPath;
|
|
6051
|
+
constructor(fieldPath, cause) {
|
|
6052
|
+
super(`secret "${fieldPath}" was not saved: the keychain could not store it (${cause instanceof Error ? cause.message : String(cause)}). Nothing was written.`);
|
|
6053
|
+
this.fieldPath = fieldPath;
|
|
6054
|
+
this.name = "KeychainWriteRefusedError";
|
|
6055
|
+
}
|
|
6056
|
+
};
|
|
6057
|
+
var KEEP = { kind: "keep" };
|
|
6058
|
+
function isRecord(value) {
|
|
6059
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6060
|
+
}
|
|
6061
|
+
function defaultMintId() {
|
|
6062
|
+
return globalThis.crypto.randomUUID();
|
|
6063
|
+
}
|
|
6064
|
+
/** Every marker ref anywhere under `value`. */
|
|
6065
|
+
function collectSecretMarkerRefs(value, out = []) {
|
|
6066
|
+
if (isSecretMarker(value)) {
|
|
6067
|
+
out.push(value.$secret);
|
|
6068
|
+
return out;
|
|
6069
|
+
}
|
|
6070
|
+
if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
|
|
6071
|
+
else if (isRecord(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
6072
|
+
return out;
|
|
6073
|
+
}
|
|
6074
|
+
async function storedValueEquals(secrets, marker, candidate) {
|
|
6075
|
+
const resolved = (await secrets.resolve([marker.$secret]))[marker.$secret];
|
|
6076
|
+
return resolved?.kind === "value" && resolved.value === candidate;
|
|
6077
|
+
}
|
|
6078
|
+
async function writeLeaf(ctx, incoming, stored, fieldPath) {
|
|
6079
|
+
const intent = classifySecretWrite(incoming);
|
|
6080
|
+
const ref = ctx.secrets.ref(ctx.scope, fieldPath);
|
|
6081
|
+
const storedIsOurs = isSecretMarker(stored) && stored.$secret === ref;
|
|
6082
|
+
if (intent.kind === "keep") return KEEP;
|
|
6083
|
+
if (intent.kind === "set" && !ctx.operatorWrite && typeof stored === "string" && stored === intent.value) return KEEP;
|
|
6084
|
+
if (intent.kind === "clear") {
|
|
6085
|
+
if (storedIsOurs) ctx.deletes.push(ref);
|
|
6086
|
+
return {
|
|
6087
|
+
kind: "value",
|
|
6088
|
+
value: null
|
|
6089
|
+
};
|
|
6090
|
+
}
|
|
6091
|
+
if (storedIsOurs && await storedValueEquals(ctx.secrets, stored, intent.value)) return {
|
|
6092
|
+
kind: "value",
|
|
6093
|
+
value: stored
|
|
6094
|
+
};
|
|
6095
|
+
try {
|
|
6096
|
+
await ctx.secrets.put(ref, intent.value);
|
|
6097
|
+
} catch (err) {
|
|
6098
|
+
throw new KeychainWriteRefusedError(fieldPath, err);
|
|
6099
|
+
}
|
|
6100
|
+
return {
|
|
6101
|
+
kind: "value",
|
|
6102
|
+
value: makeSecretMarker(ref)
|
|
6103
|
+
};
|
|
6104
|
+
}
|
|
6105
|
+
/** Apply a member result onto `out`: KEEP restores the stored member, or removes it. */
|
|
6106
|
+
function applyMember(out, key, result, storedParent) {
|
|
6107
|
+
if (result.kind === "value") {
|
|
6108
|
+
out[key] = result.value;
|
|
6109
|
+
return;
|
|
6110
|
+
}
|
|
6111
|
+
if (Object.prototype.hasOwnProperty.call(storedParent, key)) out[key] = storedParent[key];
|
|
6112
|
+
else delete out[key];
|
|
6113
|
+
}
|
|
6114
|
+
async function writeMembers(ctx, children, incoming, stored, pathOf) {
|
|
6115
|
+
const out = { ...incoming };
|
|
6116
|
+
for (const [member, node] of children) applyMember(out, member, await writeNode(ctx, node, incoming[member], stored[member], pathOf(member)), stored);
|
|
6117
|
+
return out;
|
|
6118
|
+
}
|
|
6119
|
+
function rowId(row, idKey) {
|
|
6120
|
+
const raw = row[idKey];
|
|
6121
|
+
if (typeof raw === "string" && raw.length > 0) return raw;
|
|
6122
|
+
if (typeof raw === "number" && Number.isFinite(raw)) return String(raw);
|
|
6123
|
+
return null;
|
|
6124
|
+
}
|
|
6125
|
+
async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
6126
|
+
const storedRows = Array.isArray(stored) ? stored.filter(isRecord) : [];
|
|
6127
|
+
if (!Array.isArray(incoming)) {
|
|
6128
|
+
ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
|
|
6129
|
+
return {
|
|
6130
|
+
kind: "value",
|
|
6131
|
+
value: incoming
|
|
6132
|
+
};
|
|
6133
|
+
}
|
|
6134
|
+
const storedById = /* @__PURE__ */ new Map();
|
|
6135
|
+
for (const row of storedRows) {
|
|
6136
|
+
const id = rowId(row, node.idKey);
|
|
6137
|
+
if (id !== null) storedById.set(id, row);
|
|
6138
|
+
}
|
|
6139
|
+
const kept = /* @__PURE__ */ new Set();
|
|
6140
|
+
const rows = [];
|
|
6141
|
+
for (const row of incoming) {
|
|
6142
|
+
if (!isRecord(row)) {
|
|
6143
|
+
rows.push(row);
|
|
6144
|
+
continue;
|
|
6145
|
+
}
|
|
6146
|
+
const id = rowId(row, node.idKey) ?? ctx.mintId();
|
|
6147
|
+
kept.add(id);
|
|
6148
|
+
const withId = {
|
|
6149
|
+
...row,
|
|
6150
|
+
[node.idKey]: row[node.idKey] ?? id
|
|
6151
|
+
};
|
|
6152
|
+
if (rowId(withId, node.idKey) === null) withId[node.idKey] = id;
|
|
6153
|
+
const storedRow = storedById.get(id) ?? {};
|
|
6154
|
+
rows.push(await writeMembers(ctx, node.item, withId, storedRow, (member) => arrayItemFieldPath(fieldPath, id, member)));
|
|
6155
|
+
}
|
|
6156
|
+
for (const [id, row] of storedById) if (!kept.has(id)) ctx.deletes.push(...collectSecretMarkerRefs(row));
|
|
6157
|
+
return {
|
|
6158
|
+
kind: "value",
|
|
6159
|
+
value: rows
|
|
6160
|
+
};
|
|
6161
|
+
}
|
|
6162
|
+
async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
6163
|
+
switch (node.kind) {
|
|
6164
|
+
case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
|
|
6165
|
+
case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
|
|
6166
|
+
case "object": {
|
|
6167
|
+
if (!isRecord(incoming)) {
|
|
6168
|
+
if (incoming === void 0) return KEEP;
|
|
6169
|
+
ctx.deletes.push(...collectSecretMarkerRefs(stored));
|
|
6170
|
+
return {
|
|
6171
|
+
kind: "value",
|
|
6172
|
+
value: incoming
|
|
6173
|
+
};
|
|
6174
|
+
}
|
|
6175
|
+
const storedObj = isRecord(stored) ? stored : {};
|
|
6176
|
+
return {
|
|
6177
|
+
kind: "value",
|
|
6178
|
+
value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
|
|
6179
|
+
};
|
|
6180
|
+
}
|
|
6181
|
+
}
|
|
6182
|
+
}
|
|
6183
|
+
/** Split a perNode-scoped key (`key@nodeId`). */
|
|
6184
|
+
function splitNodeKey(key) {
|
|
6185
|
+
const at = key.indexOf("@");
|
|
6186
|
+
return at <= 0 ? {
|
|
6187
|
+
base: key,
|
|
6188
|
+
nodeId: null
|
|
6189
|
+
} : {
|
|
6190
|
+
base: key.slice(0, at),
|
|
6191
|
+
nodeId: key.slice(at + 1)
|
|
6192
|
+
};
|
|
6193
|
+
}
|
|
6194
|
+
/** Rewrite a settings patch so no secret value reaches the blob. See the file doc. */
|
|
6195
|
+
async function transformSecretWrite(input) {
|
|
6196
|
+
const deletes = [];
|
|
6197
|
+
const base = {
|
|
6198
|
+
secrets: input.secrets,
|
|
6199
|
+
mintId: input.mintId ?? defaultMintId,
|
|
6200
|
+
deletes,
|
|
6201
|
+
operatorWrite: input.operatorWrite === true
|
|
6202
|
+
};
|
|
6203
|
+
const out = {};
|
|
6204
|
+
for (const [key, incoming] of Object.entries(input.patch)) {
|
|
6205
|
+
const { base: baseKey, nodeId } = splitNodeKey(key);
|
|
6206
|
+
const node = input.tree.get(baseKey);
|
|
6207
|
+
if (node === void 0) {
|
|
6208
|
+
out[key] = incoming;
|
|
6209
|
+
continue;
|
|
6210
|
+
}
|
|
6211
|
+
const scope = nodeId !== null && nodeId.length > 0 ? {
|
|
6212
|
+
kind: "node",
|
|
6213
|
+
nodeId
|
|
6214
|
+
} : input.scope ?? globalSecretScope();
|
|
6215
|
+
const result = await writeNode({
|
|
6216
|
+
...base,
|
|
6217
|
+
scope
|
|
6218
|
+
}, node, incoming, input.stored[key], baseKey);
|
|
6219
|
+
if (result.kind === "value") out[key] = result.value;
|
|
6220
|
+
}
|
|
6221
|
+
return {
|
|
6222
|
+
patch: out,
|
|
6223
|
+
afterWrite: async () => {
|
|
6224
|
+
if (deletes.length === 0) return { orphaned: [] };
|
|
6225
|
+
try {
|
|
6226
|
+
await input.secrets.delete([...new Set(deletes)]);
|
|
6227
|
+
return { orphaned: [] };
|
|
6228
|
+
} catch {
|
|
6229
|
+
return { orphaned: [...new Set(deletes)] };
|
|
6230
|
+
}
|
|
6231
|
+
}
|
|
6232
|
+
};
|
|
6233
|
+
}
|
|
6234
|
+
/**
|
|
6235
|
+
* Replace every marker in `value` with its keychain value. Returns the SAME
|
|
6236
|
+
* reference when there is no marker (no allocation, no keychain call).
|
|
6237
|
+
*/
|
|
6238
|
+
async function resolveSecretMarkers(value, secrets) {
|
|
6239
|
+
const refs = collectSecretMarkerRefs(value);
|
|
6240
|
+
if (refs.length === 0) return {
|
|
6241
|
+
value,
|
|
6242
|
+
unresolved: []
|
|
6243
|
+
};
|
|
6244
|
+
const answers = await secrets.resolve(refs);
|
|
6245
|
+
const unresolved = [];
|
|
6246
|
+
for (const ref of new Set(refs)) {
|
|
6247
|
+
const answer = answers[ref];
|
|
6248
|
+
if (answer === void 0) unresolved.push({
|
|
6249
|
+
ref,
|
|
6250
|
+
reason: "not-initialized"
|
|
6251
|
+
});
|
|
6252
|
+
else if (answer.kind === "unavailable") unresolved.push({
|
|
6253
|
+
ref,
|
|
6254
|
+
reason: answer.reason
|
|
6255
|
+
});
|
|
6256
|
+
else if (answer.kind === "missing" || answer.kind === "forbidden") unresolved.push({
|
|
6257
|
+
ref,
|
|
6258
|
+
reason: answer.kind
|
|
6259
|
+
});
|
|
6260
|
+
}
|
|
6261
|
+
const substitute = (v) => {
|
|
6262
|
+
if (isSecretMarker(v)) {
|
|
6263
|
+
const answer = answers[v.$secret];
|
|
6264
|
+
return answer?.kind === "value" ? {
|
|
6265
|
+
keep: true,
|
|
6266
|
+
value: answer.value
|
|
6267
|
+
} : {
|
|
6268
|
+
keep: false,
|
|
6269
|
+
value: void 0
|
|
6270
|
+
};
|
|
6271
|
+
}
|
|
6272
|
+
if (Array.isArray(v)) {
|
|
6273
|
+
const items = [];
|
|
6274
|
+
for (const item of v) {
|
|
6275
|
+
const s = substitute(item);
|
|
6276
|
+
if (s.keep) items.push(s.value);
|
|
6277
|
+
}
|
|
6278
|
+
return {
|
|
6279
|
+
keep: true,
|
|
6280
|
+
value: items
|
|
6281
|
+
};
|
|
6282
|
+
}
|
|
6283
|
+
if (isRecord(v)) {
|
|
6284
|
+
const out = {};
|
|
6285
|
+
for (const [k, child] of Object.entries(v)) {
|
|
6286
|
+
const s = substitute(child);
|
|
6287
|
+
if (s.keep) out[k] = s.value;
|
|
6288
|
+
}
|
|
6289
|
+
return {
|
|
6290
|
+
keep: true,
|
|
6291
|
+
value: out
|
|
6292
|
+
};
|
|
6293
|
+
}
|
|
6294
|
+
return {
|
|
6295
|
+
keep: true,
|
|
6296
|
+
value: v
|
|
6297
|
+
};
|
|
6298
|
+
};
|
|
6299
|
+
return {
|
|
6300
|
+
value: substitute(value).value,
|
|
6301
|
+
unresolved
|
|
6302
|
+
};
|
|
6303
|
+
}
|
|
6304
|
+
function touchesTree(tree, patch) {
|
|
6305
|
+
if (tree.size === 0) return false;
|
|
6306
|
+
for (const key of Object.keys(patch)) {
|
|
6307
|
+
const at = key.indexOf("@");
|
|
6308
|
+
if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
|
|
6309
|
+
}
|
|
6310
|
+
return false;
|
|
6311
|
+
}
|
|
6312
|
+
/** The blob as stored now; a failed read REFUSES the write instead of guessing. */
|
|
6313
|
+
async function readStoredAddonBlob(raw) {
|
|
6314
|
+
const threeWay = raw.readAddonStoreResult;
|
|
6315
|
+
if (threeWay === void 0) return raw.readAddonStore();
|
|
6316
|
+
const result = await threeWay.call(raw);
|
|
6317
|
+
if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
|
|
6318
|
+
return result.kind === "missing" ? {} : result.value;
|
|
6319
|
+
}
|
|
6320
|
+
function createSecretAwareSettings(raw, opts) {
|
|
6321
|
+
const chains = /* @__PURE__ */ new Map();
|
|
6322
|
+
const serialize = (key, fn) => {
|
|
6323
|
+
const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
|
|
6324
|
+
const tail = next.catch(() => void 0);
|
|
6325
|
+
chains.set(key, tail);
|
|
6326
|
+
tail.then(() => {
|
|
6327
|
+
if (chains.get(key) === tail) chains.delete(key);
|
|
6328
|
+
});
|
|
6329
|
+
return next;
|
|
6330
|
+
};
|
|
6331
|
+
const write = async (chainKey, tree, scope, patch, readStored, rawWrite) => {
|
|
6332
|
+
if (!touchesTree(tree, patch)) return rawWrite(patch);
|
|
6333
|
+
return serialize(chainKey, async () => {
|
|
6334
|
+
const stored = await readStored();
|
|
6335
|
+
const result = await transformSecretWrite({
|
|
6336
|
+
tree,
|
|
6337
|
+
secrets: opts.secrets,
|
|
6338
|
+
patch,
|
|
6339
|
+
stored,
|
|
6340
|
+
...scope !== void 0 ? { scope } : {},
|
|
6341
|
+
operatorWrite: opts.isOperatorWrite?.() === true
|
|
6342
|
+
});
|
|
6343
|
+
if (Object.keys(result.patch).length > 0) await rawWrite(result.patch);
|
|
6344
|
+
const { orphaned } = await result.afterWrite();
|
|
6345
|
+
if (orphaned.length > 0) opts.onOrphaned(orphaned);
|
|
6346
|
+
});
|
|
6347
|
+
};
|
|
6348
|
+
const wrapped = {
|
|
6349
|
+
writeAddonStore: (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p)),
|
|
6350
|
+
writeDeviceStore: (deviceId, patch) => write(`device:${deviceId}`, opts.deviceTree(), {
|
|
6351
|
+
kind: "device",
|
|
6352
|
+
deviceId
|
|
6353
|
+
}, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p))
|
|
6354
|
+
};
|
|
6355
|
+
return new Proxy(raw, { get(target, prop, receiver) {
|
|
6356
|
+
if (prop === "writeAddonStore") return wrapped.writeAddonStore;
|
|
6357
|
+
if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
|
|
6358
|
+
const value = Reflect.get(target, prop, receiver);
|
|
6359
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
6360
|
+
} });
|
|
6361
|
+
}
|
|
6362
|
+
/** The context the addon sees: identical, except that its settings writes are secret-aware. */
|
|
6363
|
+
function withSecretAwareSettings(context, opts) {
|
|
6364
|
+
const raw = context.settings;
|
|
6365
|
+
if (raw === void 0) return context;
|
|
6366
|
+
const settings = createSecretAwareSettings(raw, opts);
|
|
6367
|
+
return new Proxy(context, { get(target, prop, receiver) {
|
|
6368
|
+
if (prop === "settings") return settings;
|
|
6369
|
+
return Reflect.get(target, prop, receiver);
|
|
6370
|
+
} });
|
|
6371
|
+
}
|
|
6372
|
+
var LEAF = { kind: "leaf" };
|
|
6373
|
+
var DEFAULT_ITEM_ID_KEY = "id";
|
|
6374
|
+
function collectFields(fields, out) {
|
|
6375
|
+
for (const field of fields) {
|
|
6376
|
+
if (field.type === "group") {
|
|
6377
|
+
collectFields(field.fields, out);
|
|
6378
|
+
continue;
|
|
6379
|
+
}
|
|
6380
|
+
if (field.type === "sub-tabs") {
|
|
6381
|
+
for (const tab of field.tabs) collectFields(tab.fields, out);
|
|
6382
|
+
continue;
|
|
6383
|
+
}
|
|
6384
|
+
if (field.type === "editable-array") {
|
|
6385
|
+
const item = /* @__PURE__ */ new Map();
|
|
6386
|
+
for (const itemField of field.itemFields) if ("key" in itemField && isKeychainStoredField(itemField)) item.set(itemField.key, LEAF);
|
|
6387
|
+
if (item.size > 0) out.set(field.key, {
|
|
6388
|
+
kind: "array",
|
|
6389
|
+
idKey: field.itemIdKey ?? DEFAULT_ITEM_ID_KEY,
|
|
6390
|
+
item
|
|
6391
|
+
});
|
|
6392
|
+
continue;
|
|
6393
|
+
}
|
|
6394
|
+
if (!("key" in field) || typeof field.key !== "string") continue;
|
|
6395
|
+
if (isKeychainStoredField(field)) out.set(field.key, LEAF);
|
|
6396
|
+
}
|
|
6397
|
+
}
|
|
6398
|
+
/** The secret tree a settings schema declares. */
|
|
6399
|
+
function secretTreeFromSchema(schema) {
|
|
6400
|
+
const out = /* @__PURE__ */ new Map();
|
|
6401
|
+
if (schema === null) return out;
|
|
6402
|
+
for (const section of schema.sections) collectFields(section.fields, out);
|
|
6403
|
+
return out;
|
|
6404
|
+
}
|
|
6405
|
+
/** Parse `a.b[id].c` into segments; throws on a malformed path (a declaration bug). */
|
|
6406
|
+
function parseSecretStatePath(path) {
|
|
6407
|
+
const segments = [];
|
|
6408
|
+
for (const raw of path.split(".")) {
|
|
6409
|
+
const m = /^([^[\]]+)(?:\[([^[\]]+)\])?$/.exec(raw);
|
|
6410
|
+
if (m === null || m[1] === void 0) throw new Error(`secretStatePaths: malformed path "${path}"`);
|
|
6411
|
+
segments.push(m[2] !== void 0 ? {
|
|
6412
|
+
key: m[1],
|
|
6413
|
+
idKey: m[2]
|
|
6414
|
+
} : { key: m[1] });
|
|
6415
|
+
}
|
|
6416
|
+
if (segments.length === 0) throw new Error(`secretStatePaths: empty path`);
|
|
6417
|
+
if (segments[segments.length - 1]?.idKey !== void 0) throw new Error(`secretStatePaths: "${path}" ends on an array — name the member that is secret`);
|
|
6418
|
+
return segments;
|
|
6419
|
+
}
|
|
6420
|
+
function insert(into, segments) {
|
|
6421
|
+
const [head, ...rest] = segments;
|
|
6422
|
+
if (head === void 0) return;
|
|
6423
|
+
if (rest.length === 0) {
|
|
6424
|
+
into.set(head.key, LEAF);
|
|
6425
|
+
return;
|
|
6426
|
+
}
|
|
6427
|
+
const existing = into.get(head.key);
|
|
6428
|
+
if (head.idKey !== void 0) {
|
|
6429
|
+
const item = new Map(existing?.kind === "array" ? existing.item : []);
|
|
6430
|
+
insert(item, rest);
|
|
6431
|
+
into.set(head.key, {
|
|
6432
|
+
kind: "array",
|
|
6433
|
+
idKey: head.idKey,
|
|
6434
|
+
item
|
|
6435
|
+
});
|
|
6436
|
+
return;
|
|
6437
|
+
}
|
|
6438
|
+
const children = new Map(existing?.kind === "object" ? existing.children : []);
|
|
6439
|
+
insert(children, rest);
|
|
6440
|
+
into.set(head.key, {
|
|
6441
|
+
kind: "object",
|
|
6442
|
+
children
|
|
6443
|
+
});
|
|
6444
|
+
}
|
|
6445
|
+
/** Add hidden-state paths (`secretStatePaths`) to a schema-derived tree. */
|
|
6446
|
+
function mergeSecretStatePaths(tree, paths) {
|
|
6447
|
+
if (paths.length === 0) return tree;
|
|
6448
|
+
const out = new Map(tree);
|
|
6449
|
+
for (const path of paths) insert(out, parseSecretStatePath(path));
|
|
6450
|
+
return out;
|
|
6451
|
+
}
|
|
6452
|
+
/** First retry of a secret the keychain could not serve; doubles to {@link SECRET_RETRY_MAX_MS}. */
|
|
6453
|
+
var SECRET_RETRY_FIRST_MS = 5e3;
|
|
6454
|
+
var SECRET_RETRY_MAX_MS = 5 * 6e4;
|
|
6455
|
+
/** Coalesces a burst of `keychain.changed` events into one re-resolve. */
|
|
6456
|
+
var SECRET_CHANGE_DEBOUNCE_MS = 250;
|
|
5921
6457
|
/**
|
|
5922
6458
|
* Base class for CamStack addons. Eliminates settings boilerplate:
|
|
5923
6459
|
*
|
|
@@ -5987,6 +6523,25 @@ var BaseAddon = class {
|
|
|
5987
6523
|
settingsStoreReady = false;
|
|
5988
6524
|
/** Default config values. Provided via constructor. */
|
|
5989
6525
|
defaults;
|
|
6526
|
+
/**
|
|
6527
|
+
* Hidden-state paths that hold secrets (D787) — values the addon writes
|
|
6528
|
+
* itself (`updateGlobalSettings`, `state()`) that no form field declares.
|
|
6529
|
+
* Stored in the keychain exactly like a `password` field. Syntax:
|
|
6530
|
+
* `'snapshotSigningKey'`, `'identity.pincode'`, `'tokens[userId].accessToken'`
|
|
6531
|
+
* (`key[<id field>]` addresses array items by id, never by index).
|
|
6532
|
+
*/
|
|
6533
|
+
secretStatePaths = [];
|
|
6534
|
+
_addonSecretTree = null;
|
|
6535
|
+
_deviceSecretTree = null;
|
|
6536
|
+
/** Refs the last resolved config pointed at — a change to one re-resolves. */
|
|
6537
|
+
_configSecretRefs = /* @__PURE__ */ new Set();
|
|
6538
|
+
_unresolvedSecrets = [];
|
|
6539
|
+
_secretRetryTimer = null;
|
|
6540
|
+
_secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
|
|
6541
|
+
_secretChangeTimer = null;
|
|
6542
|
+
_secretChangeUnsub = null;
|
|
6543
|
+
/** >0 while an OPERATOR's settings write is being applied. */
|
|
6544
|
+
_operatorWriteDepth = 0;
|
|
5990
6545
|
constructor(defaults) {
|
|
5991
6546
|
this.defaults = defaults;
|
|
5992
6547
|
this._config = { ...defaults };
|
|
@@ -6022,8 +6577,18 @@ var BaseAddon = class {
|
|
|
6022
6577
|
return this._config;
|
|
6023
6578
|
}
|
|
6024
6579
|
async initialize(context) {
|
|
6025
|
-
|
|
6580
|
+
const secrets = context.secrets;
|
|
6581
|
+
this._ctx = secrets !== void 0 ? withSecretAwareSettings(context, {
|
|
6582
|
+
secrets,
|
|
6583
|
+
addonTree: () => this.addonSecretTree(),
|
|
6584
|
+
deviceTree: () => this.deviceSecretTree(),
|
|
6585
|
+
onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
|
|
6586
|
+
isOperatorWrite: () => this._operatorWriteDepth > 0
|
|
6587
|
+
}) : context;
|
|
6026
6588
|
await this.resolveConfig();
|
|
6589
|
+
if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
|
|
6590
|
+
if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
|
|
6591
|
+
});
|
|
6027
6592
|
const result = await this.onInitialize();
|
|
6028
6593
|
this.emitLifecycle(EventCategory.AddonStarted);
|
|
6029
6594
|
const normalized = normalizeAddonInitResult(result);
|
|
@@ -6056,6 +6621,12 @@ var BaseAddon = class {
|
|
|
6056
6621
|
*/
|
|
6057
6622
|
async onHubReachable() {}
|
|
6058
6623
|
async shutdown() {
|
|
6624
|
+
this._secretChangeUnsub?.();
|
|
6625
|
+
this._secretChangeUnsub = null;
|
|
6626
|
+
if (this._secretRetryTimer !== null) clearTimeout(this._secretRetryTimer);
|
|
6627
|
+
if (this._secretChangeTimer !== null) clearTimeout(this._secretChangeTimer);
|
|
6628
|
+
this._secretRetryTimer = null;
|
|
6629
|
+
this._secretChangeTimer = null;
|
|
6059
6630
|
this.emitLifecycle(EventCategory.AddonStopped);
|
|
6060
6631
|
if (this.autoEmitReadiness) this.emitReadinessForProviders("down");
|
|
6061
6632
|
await this.onShutdown();
|
|
@@ -6134,7 +6705,7 @@ var BaseAddon = class {
|
|
|
6134
6705
|
return hydrateSchema(schema, overlay ? {
|
|
6135
6706
|
...projected,
|
|
6136
6707
|
...overlay
|
|
6137
|
-
} : projected);
|
|
6708
|
+
} : projected, { inlineSecretsAsViews: true });
|
|
6138
6709
|
}
|
|
6139
6710
|
/**
|
|
6140
6711
|
* The integration-level view of this addon's settings: exactly the sections
|
|
@@ -6183,7 +6754,7 @@ var BaseAddon = class {
|
|
|
6183
6754
|
return hydrateSchema({
|
|
6184
6755
|
...schema,
|
|
6185
6756
|
sections
|
|
6186
|
-
}, projected);
|
|
6757
|
+
}, projected, { inlineSecretsAsViews: true });
|
|
6187
6758
|
}
|
|
6188
6759
|
/**
|
|
6189
6760
|
* The raw addon store PROJECTED onto the target node's bare per-node keys:
|
|
@@ -6237,18 +6808,50 @@ var BaseAddon = class {
|
|
|
6237
6808
|
value: result.value[key]
|
|
6238
6809
|
};
|
|
6239
6810
|
}
|
|
6811
|
+
/**
|
|
6812
|
+
* The OPERATOR's write — a settings form or an admin API call, dispatched by
|
|
6813
|
+
* the kernel. Identical to {@link updateGlobalSettings}, except that a secret
|
|
6814
|
+
* the operator sends is stored as sent even when it equals a pre-keychain
|
|
6815
|
+
* inline value: the operator re-entering a password is a change, an addon
|
|
6816
|
+
* writing back what it read is not (D787).
|
|
6817
|
+
*/
|
|
6818
|
+
async updateGlobalSettingsAsOperator(patch, nodeId) {
|
|
6819
|
+
this._operatorWriteDepth++;
|
|
6820
|
+
try {
|
|
6821
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
6822
|
+
} finally {
|
|
6823
|
+
this._operatorWriteDepth--;
|
|
6824
|
+
}
|
|
6825
|
+
}
|
|
6240
6826
|
async updateGlobalSettings(patch, nodeId) {
|
|
6827
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
6828
|
+
}
|
|
6829
|
+
/**
|
|
6830
|
+
* REMOVE stored secrets — their keychain values and their markers (D787).
|
|
6831
|
+
*
|
|
6832
|
+
* Writing `''` to a secret field KEEPS what is stored (an empty string is
|
|
6833
|
+
* what a defaults fallback writes back, and it must never destroy a
|
|
6834
|
+
* credential), so code that means "forget this token" says so here. Without
|
|
6835
|
+
* a keychain (an older kernel) it writes `''`, as such code always did.
|
|
6836
|
+
*/
|
|
6837
|
+
async clearSecrets(keys, nodeId) {
|
|
6838
|
+
const tree = this.addonSecretTree();
|
|
6839
|
+
const keychain = this._ctx?.secrets !== void 0;
|
|
6840
|
+
const patch = {};
|
|
6841
|
+
for (const key of keys) patch[key] = keychain && tree.has(key) ? SECRET_CLEAR : "";
|
|
6842
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
6843
|
+
}
|
|
6844
|
+
async applyGlobalPatch(barePatch, nodeId) {
|
|
6241
6845
|
const keys = this.perNodeKeys();
|
|
6242
6846
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
6243
6847
|
const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
6244
|
-
const barePatch = patch;
|
|
6245
6848
|
const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
|
|
6246
6849
|
await this._ctx?.settings?.writeAddonStore(scoped);
|
|
6247
6850
|
if (target !== localNode) return;
|
|
6248
6851
|
await this.resolveConfig();
|
|
6249
6852
|
await this.onConfigChanged();
|
|
6250
6853
|
this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
|
|
6251
|
-
this.maybeAutoRestart(
|
|
6854
|
+
this.maybeAutoRestart(Object.keys(barePatch), this.globalSettingsSchema());
|
|
6252
6855
|
}
|
|
6253
6856
|
/**
|
|
6254
6857
|
* The set of field keys the global settings schema declares `perNode: true`
|
|
@@ -6273,7 +6876,7 @@ var BaseAddon = class {
|
|
|
6273
6876
|
* time to return its response before the addon is torn down and
|
|
6274
6877
|
* re-initialised by `AddonRegistryService.restartAddon`.
|
|
6275
6878
|
*/
|
|
6276
|
-
maybeAutoRestart(
|
|
6879
|
+
maybeAutoRestart(patchKeys, schema) {
|
|
6277
6880
|
if (!schema) return;
|
|
6278
6881
|
const restartKeys = /* @__PURE__ */ new Set();
|
|
6279
6882
|
for (const section of schema.sections) for (const field of section.fields) {
|
|
@@ -6281,13 +6884,13 @@ var BaseAddon = class {
|
|
|
6281
6884
|
if (field.requiresRestart) restartKeys.add(field.key);
|
|
6282
6885
|
}
|
|
6283
6886
|
if (restartKeys.size === 0) return;
|
|
6284
|
-
if (!
|
|
6887
|
+
if (!patchKeys.some((k) => restartKeys.has(k))) return;
|
|
6285
6888
|
const ctx = this._ctx;
|
|
6286
6889
|
if (!ctx) return;
|
|
6287
6890
|
const addonId = ctx.id;
|
|
6288
6891
|
setImmediate(() => {
|
|
6289
6892
|
ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
|
|
6290
|
-
ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields:
|
|
6893
|
+
ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
|
|
6291
6894
|
}).catch((err) => {
|
|
6292
6895
|
ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
6293
6896
|
});
|
|
@@ -6296,7 +6899,7 @@ var BaseAddon = class {
|
|
|
6296
6899
|
async getDeviceSettings(deviceId) {
|
|
6297
6900
|
const schema = this.deviceSettingsSchema();
|
|
6298
6901
|
if (!schema) return { sections: [] };
|
|
6299
|
-
return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {});
|
|
6902
|
+
return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
|
|
6300
6903
|
}
|
|
6301
6904
|
async updateDeviceSettings(deviceId, patch) {
|
|
6302
6905
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
@@ -6426,7 +7029,7 @@ var BaseAddon = class {
|
|
|
6426
7029
|
* selection at boot (absent scoped key ⇒ the constructor default wins).
|
|
6427
7030
|
*/
|
|
6428
7031
|
async resolveConfig() {
|
|
6429
|
-
const stored = await this.readAddonStoreWithRetry();
|
|
7032
|
+
const stored = await this.resolveStoredSecrets(await this.readAddonStoreWithRetry());
|
|
6430
7033
|
const perNode = this.perNodeKeys();
|
|
6431
7034
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
6432
7035
|
const resolved = { ...this.defaults };
|
|
@@ -6451,7 +7054,7 @@ var BaseAddon = class {
|
|
|
6451
7054
|
key,
|
|
6452
7055
|
schema,
|
|
6453
7056
|
fallback,
|
|
6454
|
-
read: () => this.readAddonStoreWithRetry(),
|
|
7057
|
+
read: async () => this.resolveStoredSecrets(await this.readAddonStoreWithRetry()),
|
|
6455
7058
|
write: async (patch) => {
|
|
6456
7059
|
await this._ctx?.settings?.writeAddonStore(patch);
|
|
6457
7060
|
},
|
|
@@ -6468,7 +7071,7 @@ var BaseAddon = class {
|
|
|
6468
7071
|
key,
|
|
6469
7072
|
schema,
|
|
6470
7073
|
fallback,
|
|
6471
|
-
read: async () => await this._ctx?.settings?.readDeviceStore(deviceId) ?? {},
|
|
7074
|
+
read: async () => this.resolveStoredSecrets(await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, false),
|
|
6472
7075
|
write: async (patch) => {
|
|
6473
7076
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
6474
7077
|
},
|
|
@@ -6480,6 +7083,70 @@ var BaseAddon = class {
|
|
|
6480
7083
|
} })
|
|
6481
7084
|
});
|
|
6482
7085
|
}
|
|
7086
|
+
/** The addon store's secret tree: schema fields by TYPE, plus `secretStatePaths`. */
|
|
7087
|
+
addonSecretTree() {
|
|
7088
|
+
this._addonSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.globalSettingsSchema()), this.secretStatePaths);
|
|
7089
|
+
return this._addonSecretTree;
|
|
7090
|
+
}
|
|
7091
|
+
deviceSecretTree() {
|
|
7092
|
+
this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
|
|
7093
|
+
return this._deviceSecretTree;
|
|
7094
|
+
}
|
|
7095
|
+
/**
|
|
7096
|
+
* Secrets of this addon's stored config that could not be resolved on the
|
|
7097
|
+
* last read, with why. Non-empty means the addon is running WITHOUT them —
|
|
7098
|
+
* an addon whose function needs one should report itself degraded rather
|
|
7099
|
+
* than start on an empty credential.
|
|
7100
|
+
*/
|
|
7101
|
+
get unresolvedSecrets() {
|
|
7102
|
+
return this._unresolvedSecrets;
|
|
7103
|
+
}
|
|
7104
|
+
/**
|
|
7105
|
+
* Substitute every keychain marker in a stored blob with its value. With no
|
|
7106
|
+
* keychain (no `ctx.secrets`) or no marker, the blob comes back unchanged.
|
|
7107
|
+
* An unresolvable value is LEFT OUT (never `''`), logged by ref — never by
|
|
7108
|
+
* value — and, when the cause can pass, retried with backoff. Nothing is
|
|
7109
|
+
* ever written back from here.
|
|
7110
|
+
*/
|
|
7111
|
+
async resolveStoredSecrets(blob, trackForConfig = true) {
|
|
7112
|
+
const secrets = this._ctx?.secrets;
|
|
7113
|
+
if (secrets === void 0) return blob;
|
|
7114
|
+
const refs = collectSecretMarkerRefs(blob);
|
|
7115
|
+
if (trackForConfig) this._configSecretRefs = new Set(refs);
|
|
7116
|
+
if (refs.length === 0) {
|
|
7117
|
+
if (trackForConfig) this._unresolvedSecrets = [];
|
|
7118
|
+
return blob;
|
|
7119
|
+
}
|
|
7120
|
+
const { value, unresolved } = await resolveSecretMarkers(blob, secrets);
|
|
7121
|
+
if (trackForConfig) {
|
|
7122
|
+
this._unresolvedSecrets = unresolved;
|
|
7123
|
+
if (unresolved.length > 0) {
|
|
7124
|
+
this._ctx?.logger?.error?.("secret unavailable — running without it, will retry", { meta: { secrets: unresolved.map((u) => ({
|
|
7125
|
+
ref: u.ref,
|
|
7126
|
+
reason: u.reason
|
|
7127
|
+
})) } });
|
|
7128
|
+
if (unresolved.some((u) => u.reason !== "missing" && u.reason !== "forbidden")) {
|
|
7129
|
+
this.scheduleSecretReresolve(this._secretRetryDelayMs);
|
|
7130
|
+
this._secretRetryDelayMs = Math.min(this._secretRetryDelayMs * 2, SECRET_RETRY_MAX_MS);
|
|
7131
|
+
}
|
|
7132
|
+
} else this._secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
|
|
7133
|
+
}
|
|
7134
|
+
return value;
|
|
7135
|
+
}
|
|
7136
|
+
/** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
|
|
7137
|
+
scheduleSecretReresolve(delayMs) {
|
|
7138
|
+
const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
|
|
7139
|
+
if (this[timerOf] !== null) return;
|
|
7140
|
+
const timer = setTimeout(() => {
|
|
7141
|
+
this[timerOf] = null;
|
|
7142
|
+
if (this._ctx === null) return;
|
|
7143
|
+
this.resolveConfig().then(() => this.onConfigChanged()).catch((err) => {
|
|
7144
|
+
this._ctx?.logger?.error?.("re-resolving secrets failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
7145
|
+
});
|
|
7146
|
+
}, delayMs);
|
|
7147
|
+
timer.unref?.();
|
|
7148
|
+
this[timerOf] = timer;
|
|
7149
|
+
}
|
|
6483
7150
|
/**
|
|
6484
7151
|
* Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
|
|
6485
7152
|
* transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
|
|
@@ -7055,6 +7722,69 @@ method(object({ deviceId: number() }), array(StreamSourceEntrySchema)), method(o
|
|
|
7055
7722
|
kind: "mutation",
|
|
7056
7723
|
auth: "admin"
|
|
7057
7724
|
}), method(object({ deviceId: number() }), unknown().nullable()), method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" });
|
|
7725
|
+
function defOf(schema) {
|
|
7726
|
+
return schema._zod?.def ?? {};
|
|
7727
|
+
}
|
|
7728
|
+
function declaredHere(schema) {
|
|
7729
|
+
return globalRegistry.get(schema)?.secret === true;
|
|
7730
|
+
}
|
|
7731
|
+
/** Wrapper kinds whose `innerType` is the field itself. */
|
|
7732
|
+
var WRAPPERS = new Set([
|
|
7733
|
+
"optional",
|
|
7734
|
+
"nullable",
|
|
7735
|
+
"default",
|
|
7736
|
+
"prefault",
|
|
7737
|
+
"catch",
|
|
7738
|
+
"readonly",
|
|
7739
|
+
"nonoptional"
|
|
7740
|
+
]);
|
|
7741
|
+
/**
|
|
7742
|
+
* The schema layers that make up ONE field: the schema itself and every
|
|
7743
|
+
* wrapper below it (optional / default / nullable / readonly / catch), plus
|
|
7744
|
+
* both sides of a pipe (`z.preprocess` puts the real schema on `out`,
|
|
7745
|
+
* `.transform` on `in`).
|
|
7746
|
+
*/
|
|
7747
|
+
function layersOf(schema) {
|
|
7748
|
+
const out = [];
|
|
7749
|
+
const queue = [schema];
|
|
7750
|
+
while (queue.length > 0) {
|
|
7751
|
+
const s = queue.shift();
|
|
7752
|
+
if (!s || out.includes(s)) continue;
|
|
7753
|
+
out.push(s);
|
|
7754
|
+
const def = defOf(s);
|
|
7755
|
+
if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
|
|
7756
|
+
if (def.type === "pipe") {
|
|
7757
|
+
if (def.in) queue.push(def.in);
|
|
7758
|
+
if (def.out) queue.push(def.out);
|
|
7759
|
+
}
|
|
7760
|
+
}
|
|
7761
|
+
return out;
|
|
7762
|
+
}
|
|
7763
|
+
/** True when any layer of this field declares `.meta({ secret: true })`. */
|
|
7764
|
+
function isZodSecret(schema) {
|
|
7765
|
+
return layersOf(schema).some(declaredHere);
|
|
7766
|
+
}
|
|
7767
|
+
/**
|
|
7768
|
+
* Every declared secret path in a config schema: dotted keys, `[]` for "each
|
|
7769
|
+
* element of this array" (`connection.password`, `rows[].token`). A declared
|
|
7770
|
+
* object or array is reported as one path and not descended into — everything
|
|
7771
|
+
* under it is secret.
|
|
7772
|
+
*/
|
|
7773
|
+
function collectZodSecretPaths(schema, prefix = "") {
|
|
7774
|
+
if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
|
|
7775
|
+
const paths = [];
|
|
7776
|
+
for (const layer of layersOf(schema)) {
|
|
7777
|
+
const def = defOf(layer);
|
|
7778
|
+
if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
|
|
7779
|
+
else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
|
|
7780
|
+
else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
|
|
7781
|
+
else if (def.type === "intersection") {
|
|
7782
|
+
if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
|
|
7783
|
+
if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
|
|
7784
|
+
}
|
|
7785
|
+
}
|
|
7786
|
+
return [...new Set(paths)];
|
|
7787
|
+
}
|
|
7058
7788
|
//#endregion
|
|
7059
7789
|
//#region ../types/dist/err-msg-DX6i_MY4.mjs
|
|
7060
7790
|
var DeviceType = /* @__PURE__ */ function(DeviceType) {
|
|
@@ -14105,6 +14835,196 @@ id: union([string(), number()]) }), {
|
|
|
14105
14835
|
kind: "mutation",
|
|
14106
14836
|
auth: "admin"
|
|
14107
14837
|
});
|
|
14838
|
+
/**
|
|
14839
|
+
* `keychain` — the hub's encrypted store of secret values (D787).
|
|
14840
|
+
*
|
|
14841
|
+
* Settings blobs never hold a secret: they hold a marker
|
|
14842
|
+
* `{"$secret":"secret://<owner>/<scope>/<fieldPath>","v":1}` and the value
|
|
14843
|
+
* lives here, AES-256-GCM under a data key that a master key wraps. This cap
|
|
14844
|
+
* is the OWNER's door to its own values: every method is owner-checked
|
|
14845
|
+
* against the CALLER, never against anything the caller claims.
|
|
14846
|
+
*
|
|
14847
|
+
* Who the caller is: the transport stamps `callerAddonId` into the args of a
|
|
14848
|
+
* call that crossed a process (the parent `LocalChildRegistry` from the UDS
|
|
14849
|
+
* connection, the agent from its child's connection carried in
|
|
14850
|
+
* `$hub-cap-fwd`'s envelope). A stamp always overwrites; a wire call with no
|
|
14851
|
+
* stamp has its claim stripped. Only a hub in-process caller may state its own
|
|
14852
|
+
* identity — `ctx.secrets` does that with the addon id closed over. This is
|
|
14853
|
+
* identity against BUGS and misrouting, not against a malicious addon (every
|
|
14854
|
+
* runner is the same OS user): see the threat model in
|
|
14855
|
+
* `docs/design/2026-10-08-secrets-keychain.md`.
|
|
14856
|
+
*
|
|
14857
|
+
* `callerAddonId` is deliberately NOT in any input schema: the tRPC router
|
|
14858
|
+
* parses the input, so a session can never supply it, and the internal mount
|
|
14859
|
+
* floors every method to admin anyway (D240).
|
|
14860
|
+
*
|
|
14861
|
+
* Internal: addons reach it through `ctx.secrets`, never directly.
|
|
14862
|
+
*/
|
|
14863
|
+
/** Why a value cannot be served right now. Never folded into "missing". */
|
|
14864
|
+
var KeychainUnavailableReasonSchema = _enum([
|
|
14865
|
+
"key-missing",
|
|
14866
|
+
"wrong-key",
|
|
14867
|
+
"key-file-unreadable",
|
|
14868
|
+
"store-unavailable",
|
|
14869
|
+
"not-initialized",
|
|
14870
|
+
"decrypt-failed"
|
|
14871
|
+
]);
|
|
14872
|
+
var KeychainStateSchema = discriminatedUnion("state", [object({ state: literal("ready") }), object({
|
|
14873
|
+
state: literal("locked"),
|
|
14874
|
+
reason: KeychainUnavailableReasonSchema
|
|
14875
|
+
})]);
|
|
14876
|
+
var KeychainResolveEntrySchema = discriminatedUnion("kind", [
|
|
14877
|
+
object({
|
|
14878
|
+
kind: literal("value"),
|
|
14879
|
+
value: string(),
|
|
14880
|
+
version: number().int()
|
|
14881
|
+
}),
|
|
14882
|
+
object({ kind: literal("missing") }),
|
|
14883
|
+
object({
|
|
14884
|
+
kind: literal("unavailable"),
|
|
14885
|
+
reason: KeychainUnavailableReasonSchema
|
|
14886
|
+
}),
|
|
14887
|
+
object({ kind: literal("forbidden") })
|
|
14888
|
+
]);
|
|
14889
|
+
var KeychainResolveResultSchema = record(string(), KeychainResolveEntrySchema);
|
|
14890
|
+
/** Metadata of one stored value — never the value. */
|
|
14891
|
+
var KeychainSecretMetaSchema = object({
|
|
14892
|
+
ref: string(),
|
|
14893
|
+
owner: string(),
|
|
14894
|
+
/** Formatted scope (`global`, `node/<id>`, `device/<id>`, …). */
|
|
14895
|
+
scope: string(),
|
|
14896
|
+
fieldPath: string(),
|
|
14897
|
+
version: number().int(),
|
|
14898
|
+
createdAt: number(),
|
|
14899
|
+
updatedAt: number(),
|
|
14900
|
+
/** `addon:<id>` | `user:<id>` | `system`. */
|
|
14901
|
+
updatedBy: string(),
|
|
14902
|
+
/** Coarse — written at most once an hour per ref. `null` = never read. */
|
|
14903
|
+
lastReadAt: number().nullable()
|
|
14904
|
+
});
|
|
14905
|
+
var RefListSchema = array(string().min(1)).max(512);
|
|
14906
|
+
method(object({
|
|
14907
|
+
ref: string().min(1),
|
|
14908
|
+
value: string().min(1)
|
|
14909
|
+
}), object({
|
|
14910
|
+
ref: string(),
|
|
14911
|
+
version: number().int()
|
|
14912
|
+
}), {
|
|
14913
|
+
kind: "mutation",
|
|
14914
|
+
auth: "admin"
|
|
14915
|
+
}), method(object({ refs: RefListSchema }), KeychainResolveResultSchema, { auth: "admin" }), method(object({ refs: RefListSchema }), object({ deleted: number().int() }), {
|
|
14916
|
+
kind: "mutation",
|
|
14917
|
+
auth: "admin"
|
|
14918
|
+
}), method(object({}), array(KeychainSecretMetaSchema).readonly(), { auth: "admin" }), method(object({}), KeychainStateSchema, { auth: "admin" });
|
|
14919
|
+
var KeychainKeySourceSchema = object({
|
|
14920
|
+
kind: _enum([
|
|
14921
|
+
"config-file",
|
|
14922
|
+
"previous-config-file",
|
|
14923
|
+
"platform",
|
|
14924
|
+
"default-file"
|
|
14925
|
+
]),
|
|
14926
|
+
/** File sources only — a path is not a secret. */
|
|
14927
|
+
path: string().optional(),
|
|
14928
|
+
/**
|
|
14929
|
+
* True when a whole-volume backup of the data directory carries this key
|
|
14930
|
+
* next to the database it protects (the default file). The page warns.
|
|
14931
|
+
*/
|
|
14932
|
+
sharesBackupWithDatabase: boolean()
|
|
14933
|
+
});
|
|
14934
|
+
var KeychainStatusSchema = object({
|
|
14935
|
+
keychain: KeychainStateSchema,
|
|
14936
|
+
/** The source of the master key in use; `null` while locked. */
|
|
14937
|
+
keySource: KeychainKeySourceSchema.nullable(),
|
|
14938
|
+
/** The source configured to be primary — differs from `keySource` while a rotation is pending. */
|
|
14939
|
+
configuredSource: KeychainKeySourceSchema,
|
|
14940
|
+
/** Short fingerprint of the master key in use (`HMAC(KEK, label)`, 16 hex). */
|
|
14941
|
+
fingerprint: string().nullable(),
|
|
14942
|
+
activeKeyId: string().nullable(),
|
|
14943
|
+
/**
|
|
14944
|
+
* The keychain unlocked with a NON-primary source: the configured primary
|
|
14945
|
+
* key is not the one that wraps the data key yet. `rotateMasterKey` moves it.
|
|
14946
|
+
*/
|
|
14947
|
+
rotationPending: boolean(),
|
|
14948
|
+
/** Wrapped copies of the data key under a previous master key, kept until purged. */
|
|
14949
|
+
retiredWraps: number().int(),
|
|
14950
|
+
recoveryKeyDownloadedAt: number().nullable(),
|
|
14951
|
+
secretCount: number().int()
|
|
14952
|
+
});
|
|
14953
|
+
/**
|
|
14954
|
+
* Whether a stored value is still pointed at by its owner's settings.
|
|
14955
|
+
* `unknown` is a first-class answer: a scope whose blob could not be read is
|
|
14956
|
+
* never reported as an orphan (and never deleted as one).
|
|
14957
|
+
*/
|
|
14958
|
+
var KeychainSecretUsageSchema = _enum([
|
|
14959
|
+
"in-use",
|
|
14960
|
+
"orphan",
|
|
14961
|
+
"unknown"
|
|
14962
|
+
]);
|
|
14963
|
+
var KeychainAdminSecretSchema = KeychainSecretMetaSchema.extend({ usage: KeychainSecretUsageSchema });
|
|
14964
|
+
var KeychainAuditActionSchema = _enum([
|
|
14965
|
+
"put",
|
|
14966
|
+
"delete",
|
|
14967
|
+
"reveal",
|
|
14968
|
+
"rotate-master-key",
|
|
14969
|
+
"purge-retired-keys",
|
|
14970
|
+
"download-recovery-key",
|
|
14971
|
+
"delete-orphans",
|
|
14972
|
+
"reset",
|
|
14973
|
+
"initialize"
|
|
14974
|
+
]);
|
|
14975
|
+
var KeychainAuditEntrySchema = object({
|
|
14976
|
+
id: string(),
|
|
14977
|
+
at: number(),
|
|
14978
|
+
action: KeychainAuditActionSchema,
|
|
14979
|
+
/** `addon:<id>` | `user:<id>` | `system`. */
|
|
14980
|
+
actor: string(),
|
|
14981
|
+
ref: string().nullable(),
|
|
14982
|
+
detail: string().nullable()
|
|
14983
|
+
});
|
|
14984
|
+
method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}), array(KeychainAdminSecretSchema).readonly(), { auth: "admin" }), method(object({ limit: number().int().min(1).max(500).optional() }), array(KeychainAuditEntrySchema).readonly(), { auth: "admin" }), method(object({ ref: string().min(1) }), object({
|
|
14985
|
+
value: string(),
|
|
14986
|
+
version: number().int()
|
|
14987
|
+
}), {
|
|
14988
|
+
kind: "mutation",
|
|
14989
|
+
auth: "admin",
|
|
14990
|
+
caller: "required"
|
|
14991
|
+
}), method(object({ refs: array(string().min(1)).max(1e3) }), object({
|
|
14992
|
+
deleted: array(string()).readonly(),
|
|
14993
|
+
kept: array(object({
|
|
14994
|
+
ref: string(),
|
|
14995
|
+
usage: KeychainSecretUsageSchema
|
|
14996
|
+
})).readonly()
|
|
14997
|
+
}), {
|
|
14998
|
+
kind: "mutation",
|
|
14999
|
+
auth: "admin",
|
|
15000
|
+
caller: "required"
|
|
15001
|
+
}), method(object({}), object({
|
|
15002
|
+
fingerprint: string(),
|
|
15003
|
+
keySource: KeychainKeySourceSchema
|
|
15004
|
+
}), {
|
|
15005
|
+
kind: "mutation",
|
|
15006
|
+
auth: "admin",
|
|
15007
|
+
caller: "required"
|
|
15008
|
+
}), method(object({}), object({ purged: number().int() }), {
|
|
15009
|
+
kind: "mutation",
|
|
15010
|
+
auth: "admin",
|
|
15011
|
+
caller: "required"
|
|
15012
|
+
}), method(object({}), object({
|
|
15013
|
+
key: string(),
|
|
15014
|
+
fingerprint: string(),
|
|
15015
|
+
keySource: KeychainKeySourceSchema
|
|
15016
|
+
}), {
|
|
15017
|
+
kind: "mutation",
|
|
15018
|
+
auth: "admin",
|
|
15019
|
+
caller: "required"
|
|
15020
|
+
}), method(object({ confirm: literal("RESET KEYCHAIN") }), object({
|
|
15021
|
+
archivedCollection: string().nullable(),
|
|
15022
|
+
archived: number().int()
|
|
15023
|
+
}), {
|
|
15024
|
+
kind: "mutation",
|
|
15025
|
+
auth: "admin",
|
|
15026
|
+
caller: "required"
|
|
15027
|
+
});
|
|
14108
15028
|
method(_void(), object({
|
|
14109
15029
|
id: string(),
|
|
14110
15030
|
name: string(),
|
|
@@ -15127,6 +16047,10 @@ var DeviceInfoSchema = object({
|
|
|
15127
16047
|
isCamera: boolean(),
|
|
15128
16048
|
/** Current config values — serializable snapshot */
|
|
15129
16049
|
config: record(string(), unknown()),
|
|
16050
|
+
/** Paths inside `config` the device's schema declares secret (D783) —
|
|
16051
|
+
* what the non-admin redaction withholds. Paths, never values. Absent
|
|
16052
|
+
* when the owning runner has not reported them. */
|
|
16053
|
+
secretConfigPaths: array(string()).optional(),
|
|
15130
16054
|
/** Hardware + identity blob (manufacturer / model / firmware / sn /
|
|
15131
16055
|
* uid / mac / …). Populated by drivers; editable via setMetadata. */
|
|
15132
16056
|
metadata: record(string(), unknown()).nullable().optional(),
|
|
@@ -15332,12 +16256,22 @@ var DeviceRegisterPayloadSchema = object({
|
|
|
15332
16256
|
* call (workers re-register on init), so probe-driven updates
|
|
15333
16257
|
* (e.g. PTZ flag flipping after the abilities probe) propagate. */
|
|
15334
16258
|
features: array(string()).optional(),
|
|
15335
|
-
config: record(string(), unknown())
|
|
16259
|
+
config: record(string(), unknown()),
|
|
16260
|
+
/** Config paths the device's own schema DECLARES secret
|
|
16261
|
+
* (`.meta({ secret: true })` — dotted, `[]` for array items, e.g.
|
|
16262
|
+
* `connection.password`). Re-published on every register; the non-admin
|
|
16263
|
+
* redaction withholds them at any depth (D783). Optional: an older runner
|
|
16264
|
+
* omits it and the keyword backstop applies. */
|
|
16265
|
+
secretConfigPaths: array(string()).optional()
|
|
15336
16266
|
});
|
|
15337
16267
|
var DeviceRemovePayloadSchema = object({ deviceId: number() });
|
|
15338
16268
|
var DevicePersistConfigPayloadSchema = object({
|
|
15339
16269
|
deviceId: number(),
|
|
15340
|
-
data: record(string(), unknown())
|
|
16270
|
+
data: record(string(), unknown()),
|
|
16271
|
+
/** The paths the device's schema declares secret (D783), when the caller
|
|
16272
|
+
* knows them — those values are kept in the keychain, not the blob (D787).
|
|
16273
|
+
* Absent: the paths the device last reported at `registerDevice` apply. */
|
|
16274
|
+
secretConfigPaths: array(string()).optional()
|
|
15341
16275
|
});
|
|
15342
16276
|
/** What a migration actually did, per switch. `unreachable` is a first-class
|
|
15343
16277
|
* answer: a camera that could not be asked is not a camera that was silenced. */
|
|
@@ -16991,7 +17925,14 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
|
16991
17925
|
icon: string().optional(),
|
|
16992
17926
|
/** Addon-owned HTTP route the button navigates to (GET). */
|
|
16993
17927
|
startUrl: string(),
|
|
16994
|
-
stage: LoginStageEnum
|
|
17928
|
+
stage: LoginStageEnum,
|
|
17929
|
+
/**
|
|
17930
|
+
* The provider names an external identity a signed-in user can link to
|
|
17931
|
+
* their own account (D782): `auth.listLinkableProviders` /
|
|
17932
|
+
* `beginExternalLink` offer exactly the redirect methods that set this,
|
|
17933
|
+
* whatever their id. Absent / false — a login button only (magic-link).
|
|
17934
|
+
*/
|
|
17935
|
+
linkable: boolean().optional()
|
|
16995
17936
|
}),
|
|
16996
17937
|
object({
|
|
16997
17938
|
kind: literal("widget"),
|
|
@@ -22347,8 +23288,23 @@ var RetrainMacroClassSchema = _enum([
|
|
|
22347
23288
|
]);
|
|
22348
23289
|
/** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
|
|
22349
23290
|
var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
|
|
22350
|
-
/**
|
|
22351
|
-
|
|
23291
|
+
/**
|
|
23292
|
+
* Where a box came from. A machine-sourced box is a DRAFT on the page until
|
|
23293
|
+
* the operator confirms it; once saved it keeps its source as provenance.
|
|
23294
|
+
*
|
|
23295
|
+
* - `operator` — drawn by hand.
|
|
23296
|
+
* - `assist` — proposed by a detector run on the copy (the camera's own
|
|
23297
|
+
* model, or a larger teacher model).
|
|
23298
|
+
* - `pipeline` — the box the live pipeline actually drew on that frame, read
|
|
23299
|
+
* back from the track store (never a re-run).
|
|
23300
|
+
* - `llm` — proposed by a vision-capable LLM profile.
|
|
23301
|
+
*/
|
|
23302
|
+
var RetrainAnnotationSourceSchema = _enum([
|
|
23303
|
+
"operator",
|
|
23304
|
+
"assist",
|
|
23305
|
+
"pipeline",
|
|
23306
|
+
"llm"
|
|
23307
|
+
]);
|
|
22352
23308
|
/** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
|
|
22353
23309
|
var RetrainBboxSchema = object({
|
|
22354
23310
|
x: number(),
|
|
@@ -22366,7 +23322,8 @@ var RetrainBboxSchema = object({
|
|
|
22366
23322
|
*/
|
|
22367
23323
|
var RetrainAnnotationSchema = object({
|
|
22368
23324
|
id: string(),
|
|
22369
|
-
|
|
23325
|
+
/** The frame's track. Absent on a recording still, which has none. */
|
|
23326
|
+
trackId: string().optional(),
|
|
22370
23327
|
deviceId: number(),
|
|
22371
23328
|
/** The COPY in retrain storage — never the source track's media key. */
|
|
22372
23329
|
mediaKey: string(),
|
|
@@ -22415,18 +23372,63 @@ var RetrainFrameCandidateSchema = object({
|
|
|
22415
23372
|
* fail, whatever became of the original. */
|
|
22416
23373
|
copied: boolean()
|
|
22417
23374
|
});
|
|
23375
|
+
/**
|
|
23376
|
+
* One box the live pipeline drew on a copied frame — what a correction starts
|
|
23377
|
+
* from. Derived when the frame is listed, from the track store: the subject
|
|
23378
|
+
* box recorded on the source media row when there is one, else the track
|
|
23379
|
+
* position nearest the frame's capture time. Never stored as an annotation
|
|
23380
|
+
* until the operator confirms it.
|
|
23381
|
+
*/
|
|
23382
|
+
var RetrainPipelineBoxSchema = object({
|
|
23383
|
+
/** Normalised `[0,1]` against the full frame. */
|
|
23384
|
+
bbox: RetrainBboxSchema,
|
|
23385
|
+
macroClass: RetrainMacroClassSchema,
|
|
23386
|
+
label: string().optional(),
|
|
23387
|
+
subLabel: string().optional(),
|
|
23388
|
+
/** The detection score of the position used, when it was recorded. */
|
|
23389
|
+
score: number().optional(),
|
|
23390
|
+
/** The root model that produced the track, when it was recorded. */
|
|
23391
|
+
modelId: string().optional(),
|
|
23392
|
+
trackId: string(),
|
|
23393
|
+
/** `subject-box`: recorded on this very frame. `position`: the track's
|
|
23394
|
+
* position nearest the capture time, `deltaMs` away. */
|
|
23395
|
+
basis: _enum(["subject-box", "position"]),
|
|
23396
|
+
deltaMs: number()
|
|
23397
|
+
});
|
|
23398
|
+
/**
|
|
23399
|
+
* Where a retrain frame came from: a TRACK's stored media (copy-on-select),
|
|
23400
|
+
* or the RECORDING at an instant — the frame a model saw nothing in has no
|
|
23401
|
+
* track at all.
|
|
23402
|
+
*/
|
|
23403
|
+
var RetrainFrameOriginSchema = _enum(["track", "recording"]);
|
|
22418
23404
|
/** A frame the dataset OWNS: bytes copied at selection time. */
|
|
22419
23405
|
var RetrainFrameSchema = object({
|
|
22420
23406
|
frameId: string(),
|
|
22421
23407
|
deviceId: number(),
|
|
22422
|
-
|
|
22423
|
-
/**
|
|
22424
|
-
|
|
23408
|
+
origin: RetrainFrameOriginSchema,
|
|
23409
|
+
/** The track it was copied from. Absent on a recording still. */
|
|
23410
|
+
trackId: string().optional(),
|
|
23411
|
+
/** Provenance only. It may already point at nothing — that is expected.
|
|
23412
|
+
* Absent on a recording still. */
|
|
23413
|
+
sourceMediaId: number().int().optional(),
|
|
23414
|
+
/** A recording still: the playhead instant it was taken at. */
|
|
23415
|
+
epochMs: number().optional(),
|
|
22425
23416
|
sourceKind: MediaFileKindEnum,
|
|
22426
23417
|
sizeBytes: number().int(),
|
|
22427
23418
|
width: number().int(),
|
|
22428
23419
|
height: number().int(),
|
|
22429
|
-
copiedAt: number()
|
|
23420
|
+
copiedAt: number(),
|
|
23421
|
+
/** When the CAMERA captured the frame. Absent on a copy taken before D785. */
|
|
23422
|
+
capturedAt: number().optional(),
|
|
23423
|
+
/** The operator's "every subject in this frame is boxed". Detector
|
|
23424
|
+
* evaluation keeps only complete frames: an unboxed subject would count as
|
|
23425
|
+
* a false positive. */
|
|
23426
|
+
complete: boolean(),
|
|
23427
|
+
/** The boxes the pipeline drew on this frame. Present on list answers;
|
|
23428
|
+
* empty when nothing the track store holds can be placed on it. */
|
|
23429
|
+
pipelineBoxes: array(RetrainPipelineBoxSchema).readonly().optional(),
|
|
23430
|
+
/** The named collections this frame belongs to. Present on list answers. */
|
|
23431
|
+
collectionIds: array(string()).readonly().optional()
|
|
22430
23432
|
});
|
|
22431
23433
|
/** Why a copy-on-select could not be honoured — named, never a silent skip. */
|
|
22432
23434
|
var RetrainCopyRefusalSchema = _enum([
|
|
@@ -22447,6 +23449,53 @@ var RetrainFrameListSchema = object({
|
|
|
22447
23449
|
/** What the page pre-selects — the native key frame when one survives. */
|
|
22448
23450
|
autoPickMediaId: number().int().optional()
|
|
22449
23451
|
});
|
|
23452
|
+
/**
|
|
23453
|
+
* Which frames an annotated export carries. Every field narrows; an empty
|
|
23454
|
+
* filter is every annotated copy. A dataset VERSION is a frozen `frameIds`
|
|
23455
|
+
* list owned by whoever trains (the training orchestrator), so `frameIds` is
|
|
23456
|
+
* the primitive a version export uses; `batchId` re-selects what an earlier
|
|
23457
|
+
* export carried (`exportedInBatch`).
|
|
23458
|
+
*/
|
|
23459
|
+
var RetrainExportFilterSchema = object({
|
|
23460
|
+
deviceIds: array(number()).optional(),
|
|
23461
|
+
frameIds: array(string()).max(2e4).optional(),
|
|
23462
|
+
/** Only frames in at least one of these named collections. */
|
|
23463
|
+
collectionIds: array(string()).max(200).optional(),
|
|
23464
|
+
batchId: string().optional(),
|
|
23465
|
+
/** Only frames the operator marked complete (all subjects boxed). */
|
|
23466
|
+
completeOnly: boolean().optional()
|
|
23467
|
+
});
|
|
23468
|
+
/**
|
|
23469
|
+
* `frames`: the full frame copies, boxes in `annotations.json`.
|
|
23470
|
+
* `crops`: additionally one JPEG per subject, cut with the runtime detail-crop
|
|
23471
|
+
* convention — the classifier layout.
|
|
23472
|
+
*/
|
|
23473
|
+
var RetrainExportLayoutSchema = _enum(["frames", "crops"]);
|
|
23474
|
+
/**
|
|
23475
|
+
* Where `writeRetrainArchive` streams the tar: one HTTP request whose body is
|
|
23476
|
+
* the archive, sent chunk by chunk. Covers a presigned PUT and a provider
|
|
23477
|
+
* addon's data-plane upload route alike. Headers are sent verbatim and never
|
|
23478
|
+
* logged.
|
|
23479
|
+
*/
|
|
23480
|
+
var RetrainArchiveTargetSchema = object({
|
|
23481
|
+
kind: literal("http"),
|
|
23482
|
+
method: _enum(["PUT", "POST"]),
|
|
23483
|
+
url: string().url(),
|
|
23484
|
+
headers: record(string(), string()).optional()
|
|
23485
|
+
});
|
|
23486
|
+
var RetrainArchiveResultSchema = object({
|
|
23487
|
+
batchId: string(),
|
|
23488
|
+
frames: number().int(),
|
|
23489
|
+
crops: number().int(),
|
|
23490
|
+
annotations: number().int(),
|
|
23491
|
+
/** Frames planned but not shipped (unreadable copy, path too long). */
|
|
23492
|
+
missing: number().int(),
|
|
23493
|
+
bytes: number().int(),
|
|
23494
|
+
/** sha256 of the exact bytes sent. */
|
|
23495
|
+
sha256: string(),
|
|
23496
|
+
/** The target's HTTP status. */
|
|
23497
|
+
status: number().int()
|
|
23498
|
+
});
|
|
22450
23499
|
/** What the operator asked the assist to look for. */
|
|
22451
23500
|
var RetrainAssistSubjectSchema = discriminatedUnion("kind", [object({
|
|
22452
23501
|
kind: literal("package"),
|
|
@@ -22476,6 +23525,109 @@ var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
|
|
|
22476
23525
|
reason: string(),
|
|
22477
23526
|
detail: string().optional()
|
|
22478
23527
|
})]);
|
|
23528
|
+
/** A named set over the retrain corpus — membership only, it owns no pixels. */
|
|
23529
|
+
var RetrainCollectionSchema = object({
|
|
23530
|
+
id: string(),
|
|
23531
|
+
name: string(),
|
|
23532
|
+
createdAt: number(),
|
|
23533
|
+
frameCount: number().int()
|
|
23534
|
+
});
|
|
23535
|
+
var RetrainCollectionCreateResultSchema = discriminatedUnion("kind", [object({
|
|
23536
|
+
kind: literal("created"),
|
|
23537
|
+
collection: RetrainCollectionSchema
|
|
23538
|
+
}), object({
|
|
23539
|
+
kind: literal("refused"),
|
|
23540
|
+
reason: _enum(["empty-name", "duplicate-name"])
|
|
23541
|
+
})]);
|
|
23542
|
+
var RetrainCollectionRenameResultSchema = discriminatedUnion("kind", [object({
|
|
23543
|
+
kind: literal("renamed"),
|
|
23544
|
+
collection: RetrainCollectionSchema
|
|
23545
|
+
}), object({
|
|
23546
|
+
kind: literal("refused"),
|
|
23547
|
+
reason: _enum([
|
|
23548
|
+
"empty-name",
|
|
23549
|
+
"duplicate-name",
|
|
23550
|
+
"unknown-collection"
|
|
23551
|
+
])
|
|
23552
|
+
})]);
|
|
23553
|
+
/**
|
|
23554
|
+
* The outcome of adding the frame at a recording instant. Every refusal is
|
|
23555
|
+
* named: `still-unavailable` (not recording, a gap, or an undecodable frame —
|
|
23556
|
+
* `detail` says which), `still-busy` (the recorder is at its decode bound; try
|
|
23557
|
+
* again), `unreadable-image`, `write-failed`, `unknown-collection`.
|
|
23558
|
+
*/
|
|
23559
|
+
var AddRetrainFrameFromRecordingResultSchema = discriminatedUnion("kind", [object({
|
|
23560
|
+
kind: literal("added"),
|
|
23561
|
+
collectionId: string(),
|
|
23562
|
+
frame: RetrainFrameSchema,
|
|
23563
|
+
/** The moment was already in the dataset; nothing was decoded. */
|
|
23564
|
+
reused: boolean()
|
|
23565
|
+
}), object({
|
|
23566
|
+
kind: literal("refused"),
|
|
23567
|
+
reason: _enum([
|
|
23568
|
+
"unknown-collection",
|
|
23569
|
+
"still-unavailable",
|
|
23570
|
+
"still-busy",
|
|
23571
|
+
"unreadable-image",
|
|
23572
|
+
"write-failed"
|
|
23573
|
+
]),
|
|
23574
|
+
detail: string().optional()
|
|
23575
|
+
})]);
|
|
23576
|
+
/** A vision LLM profile the AI assist may use, and where it sends the frame. */
|
|
23577
|
+
var RetrainAssistProfileSchema = object({
|
|
23578
|
+
id: string(),
|
|
23579
|
+
name: string(),
|
|
23580
|
+
model: string(),
|
|
23581
|
+
kind: string(),
|
|
23582
|
+
/** `true` when the frame would leave the house (a cloud vendor, or an
|
|
23583
|
+
* endpoint that is not on the local network). The page confirms each such
|
|
23584
|
+
* run, and the provider refuses one without `allowCloud`. */
|
|
23585
|
+
leavesHouse: boolean()
|
|
23586
|
+
});
|
|
23587
|
+
/** A box the AI assist proposed: a draft, plus the model's own reason. */
|
|
23588
|
+
var RetrainLlmProposalSchema = RetrainAnnotationDraftSchema.extend({ reason: string() });
|
|
23589
|
+
/** What the AI assist said about a box that was already on the canvas. */
|
|
23590
|
+
var RetrainLlmReviewSchema = object({
|
|
23591
|
+
/** The `ref` the page sent the box under. */
|
|
23592
|
+
ref: string(),
|
|
23593
|
+
verdict: _enum([
|
|
23594
|
+
"confirmed",
|
|
23595
|
+
"wrong-class",
|
|
23596
|
+
"not-an-object",
|
|
23597
|
+
"uncertain"
|
|
23598
|
+
]),
|
|
23599
|
+
suggestedClass: RetrainMacroClassSchema.optional(),
|
|
23600
|
+
reason: string()
|
|
23601
|
+
});
|
|
23602
|
+
/**
|
|
23603
|
+
* The AI assist's answer. `proposed` carries drafts (`source: 'llm'`, the
|
|
23604
|
+
* model and its confidence) and reviews; items the model got wrong (a box off
|
|
23605
|
+
* the frame, an unasked class, an unknown ref) are dropped and counted in
|
|
23606
|
+
* `rejected`. A whole answer that is not the schema is `malformed-answer`.
|
|
23607
|
+
*/
|
|
23608
|
+
var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
|
|
23609
|
+
kind: literal("proposed"),
|
|
23610
|
+
profileId: string(),
|
|
23611
|
+
model: string(),
|
|
23612
|
+
/** The frame was sent outside the house for this answer. */
|
|
23613
|
+
leftHouse: boolean(),
|
|
23614
|
+
proposals: array(RetrainLlmProposalSchema).readonly(),
|
|
23615
|
+
reviews: array(RetrainLlmReviewSchema).readonly(),
|
|
23616
|
+
rejected: number().int()
|
|
23617
|
+
}), object({
|
|
23618
|
+
kind: literal("refused"),
|
|
23619
|
+
reason: _enum([
|
|
23620
|
+
"unknown-frame",
|
|
23621
|
+
"unreadable-frame",
|
|
23622
|
+
"unknown-profile",
|
|
23623
|
+
"profile-disabled",
|
|
23624
|
+
"no-vision",
|
|
23625
|
+
"cloud-not-confirmed",
|
|
23626
|
+
"llm-error",
|
|
23627
|
+
"malformed-answer"
|
|
23628
|
+
]),
|
|
23629
|
+
detail: string().optional()
|
|
23630
|
+
})]);
|
|
22479
23631
|
/** The outcome of a lifecycle move owned by the retrain page. */
|
|
22480
23632
|
var RetrainTransitionResultSchema = object({
|
|
22481
23633
|
trackId: string(),
|
|
@@ -23193,7 +24345,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23193
24345
|
auth: "admin"
|
|
23194
24346
|
}), method(object({
|
|
23195
24347
|
deviceId: number(),
|
|
23196
|
-
trackId: string(),
|
|
24348
|
+
trackId: string().optional(),
|
|
23197
24349
|
frameId: string()
|
|
23198
24350
|
}), object({
|
|
23199
24351
|
removed: boolean(),
|
|
@@ -23210,7 +24362,8 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23210
24362
|
auth: "admin"
|
|
23211
24363
|
}), method(object({
|
|
23212
24364
|
deviceId: number(),
|
|
23213
|
-
|
|
24365
|
+
/** The frame's track, when it has one — checked against the frame. */
|
|
24366
|
+
trackId: string().optional(),
|
|
23214
24367
|
frameId: string(),
|
|
23215
24368
|
subject: RetrainAssistSubjectSchema,
|
|
23216
24369
|
/** Which node runs it. Absent ⇒ wherever an unowned call lands. */
|
|
@@ -23218,12 +24371,16 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23218
24371
|
}), RetrainAssistResultSchema, {
|
|
23219
24372
|
kind: "mutation",
|
|
23220
24373
|
auth: "admin"
|
|
23221
|
-
}), method(object({
|
|
24374
|
+
}), method(object({
|
|
24375
|
+
trackId: string().optional(),
|
|
24376
|
+
frameIds: array(string()).max(2e3).optional()
|
|
24377
|
+
}), array(RetrainAnnotationSchema).readonly(), {
|
|
23222
24378
|
kind: "query",
|
|
23223
24379
|
auth: "admin"
|
|
23224
24380
|
}), method(object({
|
|
23225
24381
|
deviceId: number(),
|
|
23226
|
-
|
|
24382
|
+
/** The frame's track, when it has one — checked against the frame. */
|
|
24383
|
+
trackId: string().optional(),
|
|
23227
24384
|
frameId: string(),
|
|
23228
24385
|
annotations: array(RetrainAnnotationDraftSchema)
|
|
23229
24386
|
}), array(RetrainAnnotationSchema).readonly(), {
|
|
@@ -23241,7 +24398,91 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23241
24398
|
}), RetrainTransitionResultSchema, {
|
|
23242
24399
|
kind: "mutation",
|
|
23243
24400
|
auth: "admin"
|
|
23244
|
-
}), method(
|
|
24401
|
+
}), method(RetrainExportFilterSchema.extend({ layout: RetrainExportLayoutSchema.optional() }), object({ url: string() }), {
|
|
24402
|
+
kind: "query",
|
|
24403
|
+
auth: "admin"
|
|
24404
|
+
}), method(object({
|
|
24405
|
+
deviceId: number(),
|
|
24406
|
+
trackId: string().optional(),
|
|
24407
|
+
frameId: string(),
|
|
24408
|
+
complete: boolean()
|
|
24409
|
+
}), RetrainFrameSchema, {
|
|
24410
|
+
kind: "mutation",
|
|
24411
|
+
auth: "admin"
|
|
24412
|
+
}), method(object({
|
|
24413
|
+
filter: RetrainExportFilterSchema,
|
|
24414
|
+
layout: RetrainExportLayoutSchema,
|
|
24415
|
+
target: RetrainArchiveTargetSchema
|
|
24416
|
+
}), RetrainArchiveResultSchema, {
|
|
24417
|
+
kind: "mutation",
|
|
24418
|
+
auth: "admin",
|
|
24419
|
+
timeoutMs: 60 * 6e4
|
|
24420
|
+
}), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
|
|
24421
|
+
kind: "query",
|
|
24422
|
+
auth: "admin"
|
|
24423
|
+
}), method(object({
|
|
24424
|
+
deviceId: number(),
|
|
24425
|
+
trackId: string().optional(),
|
|
24426
|
+
frameId: string(),
|
|
24427
|
+
profileId: string(),
|
|
24428
|
+
classes: array(RetrainMacroClassSchema).min(1),
|
|
24429
|
+
boxes: array(object({
|
|
24430
|
+
ref: string(),
|
|
24431
|
+
bbox: RetrainBboxSchema,
|
|
24432
|
+
macroClass: RetrainMacroClassSchema,
|
|
24433
|
+
label: string().optional()
|
|
24434
|
+
})).max(50),
|
|
24435
|
+
allowCloud: boolean()
|
|
24436
|
+
}), RetrainLlmAssistResultSchema, {
|
|
24437
|
+
kind: "mutation",
|
|
24438
|
+
auth: "admin",
|
|
24439
|
+
timeoutMs: 18e4
|
|
24440
|
+
}), method(object({ name: string().max(120) }), RetrainCollectionCreateResultSchema, {
|
|
24441
|
+
kind: "mutation",
|
|
24442
|
+
auth: "admin"
|
|
24443
|
+
}), method(object({}), array(RetrainCollectionSchema).readonly(), {
|
|
24444
|
+
kind: "query",
|
|
24445
|
+
auth: "admin"
|
|
24446
|
+
}), method(object({
|
|
24447
|
+
id: string(),
|
|
24448
|
+
name: string().max(120)
|
|
24449
|
+
}), RetrainCollectionRenameResultSchema, {
|
|
24450
|
+
kind: "mutation",
|
|
24451
|
+
auth: "admin"
|
|
24452
|
+
}), method(object({ id: string() }), object({
|
|
24453
|
+
deleted: boolean(),
|
|
24454
|
+
removedFrames: number().int()
|
|
24455
|
+
}), {
|
|
24456
|
+
kind: "mutation",
|
|
24457
|
+
auth: "admin"
|
|
24458
|
+
}), method(object({
|
|
24459
|
+
collectionId: string(),
|
|
24460
|
+
deviceId: number(),
|
|
24461
|
+
epochMs: number()
|
|
24462
|
+
}), AddRetrainFrameFromRecordingResultSchema, {
|
|
24463
|
+
kind: "mutation",
|
|
24464
|
+
auth: "admin",
|
|
24465
|
+
timeoutMs: 6e4
|
|
24466
|
+
}), method(object({
|
|
24467
|
+
collectionId: string(),
|
|
24468
|
+
frameIds: array(string()).min(1).max(500)
|
|
24469
|
+
}), object({
|
|
24470
|
+
added: number().int(),
|
|
24471
|
+
alreadyMember: number().int(),
|
|
24472
|
+
unknownFrameIds: array(string()).readonly()
|
|
24473
|
+
}), {
|
|
24474
|
+
kind: "mutation",
|
|
24475
|
+
auth: "admin"
|
|
24476
|
+
}), method(object({
|
|
24477
|
+
collectionId: string(),
|
|
24478
|
+
frameId: string()
|
|
24479
|
+
}), object({
|
|
24480
|
+
removed: boolean(),
|
|
24481
|
+
deletedFrame: boolean()
|
|
24482
|
+
}), {
|
|
24483
|
+
kind: "mutation",
|
|
24484
|
+
auth: "admin"
|
|
24485
|
+
}), method(object({ collectionId: string() }), array(RetrainFrameSchema).readonly(), {
|
|
23245
24486
|
kind: "query",
|
|
23246
24487
|
auth: "admin"
|
|
23247
24488
|
}), method(object({
|
|
@@ -23867,13 +25108,31 @@ var RecommendationReasonSchema = discriminatedUnion("kind", [
|
|
|
23867
25108
|
object({
|
|
23868
25109
|
kind: literal("no-family-build"),
|
|
23869
25110
|
format: ModelFormatSchema$1
|
|
25111
|
+
}),
|
|
25112
|
+
object({
|
|
25113
|
+
kind: literal("kept-custom-pin"),
|
|
25114
|
+
modelId: string(),
|
|
25115
|
+
deviceKey: string()
|
|
23870
25116
|
})
|
|
23871
25117
|
]);
|
|
25118
|
+
/** Why a device is left exactly as it is, whatever the plan would pick (D786). */
|
|
25119
|
+
var KeptReasonSchema = _enum(["custom-pin"]);
|
|
25120
|
+
/**
|
|
25121
|
+
* Where a choice's latency came from (D791): this node's own benchmark
|
|
25122
|
+
* result, or the hardware-class table. Measured on the node beats the table.
|
|
25123
|
+
*/
|
|
25124
|
+
var LatencySourceSchema = discriminatedUnion("kind", [object({ kind: literal("table") }), object({
|
|
25125
|
+
kind: literal("node-benchmark"),
|
|
25126
|
+
resultId: string(),
|
|
25127
|
+
measuredAtMs: number()
|
|
25128
|
+
})]);
|
|
23872
25129
|
var DeviceModelChoiceSchema = object({
|
|
23873
25130
|
modelId: string(),
|
|
23874
25131
|
p50Ms: number(),
|
|
23875
25132
|
fps: number(),
|
|
23876
25133
|
measured: boolean(),
|
|
25134
|
+
/** Absent on a plan from before D791 — read as the table. */
|
|
25135
|
+
source: LatencySourceSchema.optional(),
|
|
23877
25136
|
/** Parallel sessions at the camera rate with the headroom kept free: ⌊fps × (1 − headroom) / camera fps⌋. */
|
|
23878
25137
|
capacitySessions: number(),
|
|
23879
25138
|
personRecall: number()
|
|
@@ -23884,6 +25143,8 @@ var DeviceRecommendationSchema = object({
|
|
|
23884
25143
|
enabled: boolean(),
|
|
23885
25144
|
available: boolean(),
|
|
23886
25145
|
chosen: DeviceModelChoiceSchema.nullable(),
|
|
25146
|
+
/** Present when the device is kept as is: Apply writes nothing on it. */
|
|
25147
|
+
kept: KeptReasonSchema.optional(),
|
|
23887
25148
|
reasons: array(RecommendationReasonSchema).readonly()
|
|
23888
25149
|
});
|
|
23889
25150
|
var NodeRecommendationSchema = object({
|
|
@@ -23937,6 +25198,17 @@ var AutoTuneWarningSchema = discriminatedUnion("kind", [
|
|
|
23937
25198
|
kind: literal("coral-enabled"),
|
|
23938
25199
|
nodeId: string(),
|
|
23939
25200
|
deviceKey: string()
|
|
25201
|
+
}),
|
|
25202
|
+
object({
|
|
25203
|
+
kind: literal("custom-pin-kept"),
|
|
25204
|
+
nodeId: string(),
|
|
25205
|
+
deviceKey: string().nullable(),
|
|
25206
|
+
deviceId: number().nullable(),
|
|
25207
|
+
modelId: string()
|
|
25208
|
+
}),
|
|
25209
|
+
object({
|
|
25210
|
+
kind: literal("custom-registry-unreadable"),
|
|
25211
|
+
error: string()
|
|
23940
25212
|
})
|
|
23941
25213
|
]);
|
|
23942
25214
|
var AutoTuneOptionsSchema = object({
|
|
@@ -24115,13 +25387,14 @@ var SuggestSharesResultSchema = object({
|
|
|
24115
25387
|
nodes: array(SuggestedNodeShareSchema).readonly()
|
|
24116
25388
|
});
|
|
24117
25389
|
/**
|
|
24118
|
-
* Where the node and device shares come from (D750, D755).
|
|
24119
|
-
* - `
|
|
24120
|
-
*
|
|
24121
|
-
*
|
|
24122
|
-
*
|
|
24123
|
-
*
|
|
24124
|
-
*
|
|
25390
|
+
* Where the node and device shares come from (D750, D755, D791).
|
|
25391
|
+
* - `benchmark` (default since D791) — each node's capacity as its own node
|
|
25392
|
+
* benchmark measured it; a node without fresh results is sized from
|
|
25393
|
+
* `hardware` and says so. Measured on the node beats the table.
|
|
25394
|
+
* - `hardware` — computed from each node's static capacity only (its
|
|
25395
|
+
* accelerators at their Auto tune models, from the latency table).
|
|
25396
|
+
* Both are recomputed whenever a node or device joins, leaves, is switched
|
|
25397
|
+
* on or off, changes model, or a benchmark result is written. No load input.
|
|
24125
25398
|
* - `manual` — the operator's stored sliders.
|
|
24126
25399
|
* Either way a node or device that cannot take sessions gives its share to
|
|
24127
25400
|
* the others in proportion; the stored values are never rewritten for that.
|
|
@@ -24170,6 +25443,362 @@ var EffectiveSharesSchema = object({
|
|
|
24170
25443
|
nodeWeights: record(string(), number()),
|
|
24171
25444
|
deviceWeights: record(string(), record(string(), number()))
|
|
24172
25445
|
});
|
|
25446
|
+
/**
|
|
25447
|
+
* Wire shapes of the node benchmark (D791): the operator's plan, the
|
|
25448
|
+
* preflight the confirmation shows, the run the orchestrator owns, what the
|
|
25449
|
+
* measuring runner reports, and the result rows Auto tune and the automatic
|
|
25450
|
+
* shares read.
|
|
25451
|
+
*
|
|
25452
|
+
* ONE node at a time, owned by the pipeline orchestrator. While a run is
|
|
25453
|
+
* active the cluster is in BENCHMARK MODE for that node: it is not a
|
|
25454
|
+
* detection candidate, camera pins naming it are ignored so its sessions move
|
|
25455
|
+
* elsewhere, and both come back when the mode ends — after a crash or a hub
|
|
25456
|
+
* restart too (a persisted manifest, reconciled against the registry).
|
|
25457
|
+
*
|
|
25458
|
+
* Two measurements, both on the node, driven by its own runner (frames never
|
|
25459
|
+
* cross a process at frame rate, D9):
|
|
25460
|
+
* - `device` — one accelerator × one candidate detector, root only, open
|
|
25461
|
+
* loop: how many streams at the camera rate it carries inside the frame
|
|
25462
|
+
* interval;
|
|
25463
|
+
* - `pipeline` — the chosen detector plus the operator's detail steps
|
|
25464
|
+
* (faces, plates, classifiers, CLIP…), on varied frames from the bench
|
|
25465
|
+
* clip: how many parallel sessions the node carries before latency, drops,
|
|
25466
|
+
* CPU, RAM or the event loop give out.
|
|
25467
|
+
*/
|
|
25468
|
+
/** Defaults and bounds, one place. */
|
|
25469
|
+
var NODE_BENCHMARK_DEFAULTS = {
|
|
25470
|
+
fpsPerStream: 10,
|
|
25471
|
+
budgetMinutes: 45,
|
|
25472
|
+
minBudgetMinutes: 10,
|
|
25473
|
+
maxBudgetMinutes: 120,
|
|
25474
|
+
/** A result older than this no longer beats the table. */
|
|
25475
|
+
staleAfterDays: 30,
|
|
25476
|
+
/** Warm-in per ramp step (not accounted). */
|
|
25477
|
+
settleSec: 5,
|
|
25478
|
+
/** Accounted window per ramp step. */
|
|
25479
|
+
measureSec: 20,
|
|
25480
|
+
/** Longest the drain may take before the run is refused. */
|
|
25481
|
+
drainTimeoutSec: 120,
|
|
25482
|
+
/** Candidate models per device in one run. */
|
|
25483
|
+
maxModelsPerDevice: 6
|
|
25484
|
+
};
|
|
25485
|
+
/** The two measurements a run can make. */
|
|
25486
|
+
var NodeBenchmarkPhaseSchema = _enum(["device", "pipeline"]);
|
|
25487
|
+
var NodeBenchmarkDevicePlanSchema = object({
|
|
25488
|
+
/** `<backend>:<device>` — `openvino:npu`, `coreml:all`, `cpu`. */
|
|
25489
|
+
deviceKey: string().min(1),
|
|
25490
|
+
/**
|
|
25491
|
+
* Root detector candidates for the `device` measurement, in the order
|
|
25492
|
+
* measured. The FIRST is the one the `pipeline` measurement runs.
|
|
25493
|
+
*/
|
|
25494
|
+
modelIds: array(string().min(1)).min(1).max(NODE_BENCHMARK_DEFAULTS.maxModelsPerDevice)
|
|
25495
|
+
});
|
|
25496
|
+
/** What the operator confirmed. */
|
|
25497
|
+
var NodeBenchmarkPlanSchema = object({
|
|
25498
|
+
nodeId: string().min(1),
|
|
25499
|
+
devices: array(NodeBenchmarkDevicePlanSchema).min(1),
|
|
25500
|
+
/** Which measurements run. At least one. */
|
|
25501
|
+
phases: array(NodeBenchmarkPhaseSchema).min(1).default(["device", "pipeline"]),
|
|
25502
|
+
/**
|
|
25503
|
+
* Detail steps (catalog step ids under the root: faces, plates,
|
|
25504
|
+
* classifiers, CLIP…) the `pipeline` measurement enables. The root
|
|
25505
|
+
* detector always runs.
|
|
25506
|
+
*/
|
|
25507
|
+
steps: array(string().min(1)).default([]),
|
|
25508
|
+
/** Offered rate of one stream / session. */
|
|
25509
|
+
fpsPerStream: number().int().min(1).max(30).default(NODE_BENCHMARK_DEFAULTS.fpsPerStream),
|
|
25510
|
+
/** Hard deadline: the mode ends and the cluster is restored when it passes. */
|
|
25511
|
+
budgetMinutes: number().int().min(NODE_BENCHMARK_DEFAULTS.minBudgetMinutes).max(NODE_BENCHMARK_DEFAULTS.maxBudgetMinutes).default(NODE_BENCHMARK_DEFAULTS.budgetMinutes),
|
|
25512
|
+
/** Keep the models the run downloaded (default: delete what was not installed before). */
|
|
25513
|
+
keepDownloadedModels: boolean().default(false),
|
|
25514
|
+
/** Start although the other nodes' capacity does not cover the sessions running now. */
|
|
25515
|
+
acceptInsufficientHeadroom: boolean().default(false)
|
|
25516
|
+
});
|
|
25517
|
+
var NodeBenchmarkRefusalSchema = object({
|
|
25518
|
+
kind: _enum([
|
|
25519
|
+
"benchmark-active",
|
|
25520
|
+
"node-offline",
|
|
25521
|
+
"unknown-device",
|
|
25522
|
+
"no-phase",
|
|
25523
|
+
"insufficient-headroom"
|
|
25524
|
+
]),
|
|
25525
|
+
detail: string(),
|
|
25526
|
+
overridable: boolean()
|
|
25527
|
+
});
|
|
25528
|
+
/** A camera whose detection leaves the node for the run. */
|
|
25529
|
+
var NodeBenchmarkMovingCameraSchema = object({
|
|
25530
|
+
deviceId: number(),
|
|
25531
|
+
/** Placed on the node now (a standing attach or a running session). */
|
|
25532
|
+
placedOnNode: boolean(),
|
|
25533
|
+
/** A node pin naming this node, ignored for the run. */
|
|
25534
|
+
pinnedToNode: boolean()
|
|
25535
|
+
});
|
|
25536
|
+
/** A camera that cannot leave: no other node can obtain its frames. */
|
|
25537
|
+
var NodeBenchmarkStayingCameraSchema = object({
|
|
25538
|
+
deviceId: number(),
|
|
25539
|
+
reason: literal("only-frame-source")
|
|
25540
|
+
});
|
|
25541
|
+
var NodeBenchmarkPreflightSchema = object({
|
|
25542
|
+
nodeId: string(),
|
|
25543
|
+
online: boolean(),
|
|
25544
|
+
moving: array(NodeBenchmarkMovingCameraSchema).readonly(),
|
|
25545
|
+
/** Keep running on the node during the run; the result is flagged contaminated. */
|
|
25546
|
+
staying: array(NodeBenchmarkStayingCameraSchema).readonly(),
|
|
25547
|
+
estimatedDurationMs: number(),
|
|
25548
|
+
/** The run ends and the cluster is restored at the latest after this long. */
|
|
25549
|
+
budgetMs: number(),
|
|
25550
|
+
phases: array(NodeBenchmarkPhaseSchema).readonly(),
|
|
25551
|
+
steps: array(string()).readonly(),
|
|
25552
|
+
devices: array(NodeBenchmarkDevicePlanSchema).readonly(),
|
|
25553
|
+
/** Parallel sessions the cluster runs now, and what the other nodes can carry. */
|
|
25554
|
+
headroom: object({
|
|
25555
|
+
sessionsNow: number(),
|
|
25556
|
+
otherNodesCapacitySessions: number().nullable()
|
|
25557
|
+
}),
|
|
25558
|
+
refusals: array(NodeBenchmarkRefusalSchema).readonly(),
|
|
25559
|
+
canStart: boolean()
|
|
25560
|
+
});
|
|
25561
|
+
/** Where the measuring runner is. */
|
|
25562
|
+
var NodeBenchProgressSchema = object({
|
|
25563
|
+
phase: _enum([
|
|
25564
|
+
"preparing",
|
|
25565
|
+
"device",
|
|
25566
|
+
"pipeline",
|
|
25567
|
+
"cleanup"
|
|
25568
|
+
]),
|
|
25569
|
+
deviceKey: string().nullable(),
|
|
25570
|
+
modelId: string().nullable(),
|
|
25571
|
+
/** Streams (device) or sessions (pipeline) of the step running now. */
|
|
25572
|
+
load: number().nullable(),
|
|
25573
|
+
cellsDone: number(),
|
|
25574
|
+
cellsTotal: number(),
|
|
25575
|
+
message: string()
|
|
25576
|
+
});
|
|
25577
|
+
/** What limited a ramp. `none` = the ramp ran out of steps still passing. */
|
|
25578
|
+
var NodeBenchLimitSchema = _enum([
|
|
25579
|
+
"p95",
|
|
25580
|
+
"drops",
|
|
25581
|
+
"errors",
|
|
25582
|
+
"stall",
|
|
25583
|
+
"cpu",
|
|
25584
|
+
"ram",
|
|
25585
|
+
"none"
|
|
25586
|
+
]);
|
|
25587
|
+
var NodeBenchRampStepSchema = object({
|
|
25588
|
+
load: number(),
|
|
25589
|
+
pass: boolean(),
|
|
25590
|
+
p95Ms: number(),
|
|
25591
|
+
dropRatio: number(),
|
|
25592
|
+
/** Completed frames per second over the accounted window. */
|
|
25593
|
+
fps: number(),
|
|
25594
|
+
cpuPct: number().nullable(),
|
|
25595
|
+
ramFreePct: number().nullable(),
|
|
25596
|
+
failReasons: array(string()).readonly()
|
|
25597
|
+
});
|
|
25598
|
+
var NodeBenchCellSchema = discriminatedUnion("phase", [object({
|
|
25599
|
+
phase: literal("device"),
|
|
25600
|
+
deviceKey: string(),
|
|
25601
|
+
modelId: string(),
|
|
25602
|
+
/** Single-stream latency (the K = 1 step). */
|
|
25603
|
+
p50Ms: number(),
|
|
25604
|
+
p95Ms: number(),
|
|
25605
|
+
p99Ms: number(),
|
|
25606
|
+
/** Frames per second sustained at the last passing step. */
|
|
25607
|
+
fps: number(),
|
|
25608
|
+
/** Streams at the camera rate the device carried inside the frame interval; 0 = not even one. */
|
|
25609
|
+
kMax: number(),
|
|
25610
|
+
limitedBy: NodeBenchLimitSchema,
|
|
25611
|
+
/** First call (model load + warm-up). */
|
|
25612
|
+
warmupMs: number(),
|
|
25613
|
+
ramp: array(NodeBenchRampStepSchema).readonly()
|
|
25614
|
+
}), object({
|
|
25615
|
+
phase: literal("pipeline"),
|
|
25616
|
+
deviceKey: string(),
|
|
25617
|
+
modelId: string(),
|
|
25618
|
+
steps: array(string()).readonly(),
|
|
25619
|
+
/** Parallel sessions at the camera rate the node carried; 0 = not even one. */
|
|
25620
|
+
maxSessions: number(),
|
|
25621
|
+
limitedBy: NodeBenchLimitSchema,
|
|
25622
|
+
/** Detail steps that produced at least one result on the clip — a step that never fired measured nothing. */
|
|
25623
|
+
stepsFired: array(string()).readonly(),
|
|
25624
|
+
warmupMs: number(),
|
|
25625
|
+
ramp: array(NodeBenchRampStepSchema).readonly()
|
|
25626
|
+
})]);
|
|
25627
|
+
/**
|
|
25628
|
+
* What a result was measured ON. A result whose fingerprint no longer matches
|
|
25629
|
+
* the node no longer beats the table.
|
|
25630
|
+
*/
|
|
25631
|
+
var NodeBenchFingerprintSchema = object({
|
|
25632
|
+
pipelineVersion: string().nullable(),
|
|
25633
|
+
cpuModel: string().nullable(),
|
|
25634
|
+
ramGb: number().nullable(),
|
|
25635
|
+
os: string().nullable(),
|
|
25636
|
+
/** Per device: the pool the cells ran on (runtime + tuning). */
|
|
25637
|
+
pools: record(string(), object({
|
|
25638
|
+
runtime: string(),
|
|
25639
|
+
numWorkers: number(),
|
|
25640
|
+
concurrency: number(),
|
|
25641
|
+
batchMode: string()
|
|
25642
|
+
})).default({})
|
|
25643
|
+
});
|
|
25644
|
+
/** The frames the run used. */
|
|
25645
|
+
var NodeBenchClipSchema = object({
|
|
25646
|
+
/** `camstack-bench-v1` or `reference-images` (the fallback when the clip is not reachable). */
|
|
25647
|
+
id: string(),
|
|
25648
|
+
revision: string().nullable(),
|
|
25649
|
+
frames: number(),
|
|
25650
|
+
width: number(),
|
|
25651
|
+
height: number()
|
|
25652
|
+
});
|
|
25653
|
+
var NodeBenchRunnerInputSchema = object({
|
|
25654
|
+
runId: string().min(1),
|
|
25655
|
+
devices: array(NodeBenchmarkDevicePlanSchema).min(1),
|
|
25656
|
+
phases: array(NodeBenchmarkPhaseSchema).min(1),
|
|
25657
|
+
/** The full detail step tree root for the `pipeline` measurement is built on the node from these ids. */
|
|
25658
|
+
steps: array(string()).default([]),
|
|
25659
|
+
fpsPerStream: number().int().min(1).max(30),
|
|
25660
|
+
/** The runner stops on its own past this instant, whatever the hub does. */
|
|
25661
|
+
deadlineAtMs: number(),
|
|
25662
|
+
settleSec: number().min(0).max(60).default(NODE_BENCHMARK_DEFAULTS.settleSec),
|
|
25663
|
+
measureSec: number().min(2).max(300).default(NODE_BENCHMARK_DEFAULTS.measureSec),
|
|
25664
|
+
keepDownloadedModels: boolean().default(false)
|
|
25665
|
+
});
|
|
25666
|
+
var NodeBenchRunnerStateSchema = _enum([
|
|
25667
|
+
"running",
|
|
25668
|
+
"done",
|
|
25669
|
+
"failed",
|
|
25670
|
+
"aborted"
|
|
25671
|
+
]);
|
|
25672
|
+
var NodeBenchRunnerStatusSchema = object({
|
|
25673
|
+
runId: string(),
|
|
25674
|
+
nodeId: string(),
|
|
25675
|
+
state: NodeBenchRunnerStateSchema,
|
|
25676
|
+
progress: NodeBenchProgressSchema.nullable(),
|
|
25677
|
+
/** Every finished cell so far — a run stopped half way keeps what it measured. */
|
|
25678
|
+
cells: array(NodeBenchCellSchema).readonly(),
|
|
25679
|
+
fingerprint: NodeBenchFingerprintSchema.nullable(),
|
|
25680
|
+
clip: NodeBenchClipSchema.nullable(),
|
|
25681
|
+
/** Cameras seen running on the node during the run (they share its pools). */
|
|
25682
|
+
activeCameraIds: array(number()).readonly(),
|
|
25683
|
+
/** Models the run downloaded and then deleted (not installed before). */
|
|
25684
|
+
deletedModels: array(string()).readonly(),
|
|
25685
|
+
error: string().nullable(),
|
|
25686
|
+
startedAtMs: number(),
|
|
25687
|
+
finishedAtMs: number().nullable()
|
|
25688
|
+
});
|
|
25689
|
+
var NodeBenchmarkStateSchema = _enum([
|
|
25690
|
+
"draining",
|
|
25691
|
+
"measuring",
|
|
25692
|
+
"restoring",
|
|
25693
|
+
"done",
|
|
25694
|
+
"failed",
|
|
25695
|
+
"aborted"
|
|
25696
|
+
]);
|
|
25697
|
+
/** Why a run ended. */
|
|
25698
|
+
var NodeBenchmarkEndReasonSchema = _enum([
|
|
25699
|
+
"completed",
|
|
25700
|
+
"operator-abort",
|
|
25701
|
+
"deadline",
|
|
25702
|
+
"node-lost",
|
|
25703
|
+
"runner-lost",
|
|
25704
|
+
"hub-restart",
|
|
25705
|
+
"drain-timeout",
|
|
25706
|
+
"failed"
|
|
25707
|
+
]);
|
|
25708
|
+
var NodeBenchmarkRunSchema = object({
|
|
25709
|
+
runId: string(),
|
|
25710
|
+
nodeId: string(),
|
|
25711
|
+
state: NodeBenchmarkStateSchema,
|
|
25712
|
+
plan: NodeBenchmarkPlanSchema,
|
|
25713
|
+
startedAtMs: number(),
|
|
25714
|
+
deadlineAtMs: number(),
|
|
25715
|
+
finishedAtMs: number().nullable(),
|
|
25716
|
+
endReason: NodeBenchmarkEndReasonSchema.nullable(),
|
|
25717
|
+
error: string().nullable(),
|
|
25718
|
+
/** Cameras moved off the node for the run. */
|
|
25719
|
+
moved: array(number()).readonly(),
|
|
25720
|
+
/** Cameras that stayed (their only frame source is the node). */
|
|
25721
|
+
staying: array(number()).readonly(),
|
|
25722
|
+
/** Something else ran on the node's pools during the run. */
|
|
25723
|
+
contaminated: boolean(),
|
|
25724
|
+
progress: NodeBenchProgressSchema.nullable(),
|
|
25725
|
+
resultIds: array(string()).readonly()
|
|
25726
|
+
});
|
|
25727
|
+
/** `getNodeBenchmarkStatus`: the active run (or the last one), and whether benchmark mode is on. */
|
|
25728
|
+
var NodeBenchmarkStatusSchema = object({
|
|
25729
|
+
/** The node the cluster is in benchmark mode for; null = none. */
|
|
25730
|
+
modeNodeId: string().nullable(),
|
|
25731
|
+
run: NodeBenchmarkRunSchema.nullable()
|
|
25732
|
+
});
|
|
25733
|
+
/**
|
|
25734
|
+
* One stored measurement — the only authority Auto tune and the automatic
|
|
25735
|
+
* shares read measured capacity from. Written by the orchestrator when a run
|
|
25736
|
+
* ends, never by anyone else.
|
|
25737
|
+
*/
|
|
25738
|
+
var NodeBenchmarkResultSchema = object({
|
|
25739
|
+
id: string(),
|
|
25740
|
+
runId: string(),
|
|
25741
|
+
nodeId: string(),
|
|
25742
|
+
cell: NodeBenchCellSchema,
|
|
25743
|
+
fpsPerStream: number(),
|
|
25744
|
+
fingerprint: NodeBenchFingerprintSchema.nullable(),
|
|
25745
|
+
clip: NodeBenchClipSchema.nullable(),
|
|
25746
|
+
/** Other work shared the node's pools (a camera that could not move, or the hub's own duties). */
|
|
25747
|
+
contaminated: boolean(),
|
|
25748
|
+
stayingCameras: array(number()).readonly(),
|
|
25749
|
+
/** The run ended early; the cell itself completed. */
|
|
25750
|
+
partialRun: boolean(),
|
|
25751
|
+
measuredAtMs: number()
|
|
25752
|
+
});
|
|
25753
|
+
var ListNodeBenchmarkResultsInputSchema = object({
|
|
25754
|
+
nodeId: string().optional(),
|
|
25755
|
+
deviceKey: string().optional()
|
|
25756
|
+
});
|
|
25757
|
+
/** A result with its standing today: does it still beat the table? */
|
|
25758
|
+
var NodeBenchmarkResultViewSchema = NodeBenchmarkResultSchema.extend({
|
|
25759
|
+
/** `fresh` beats the table; `stale` falls back to it; `superseded` = a newer row covers the same cell. */
|
|
25760
|
+
standing: _enum([
|
|
25761
|
+
"fresh",
|
|
25762
|
+
"stale",
|
|
25763
|
+
"superseded"
|
|
25764
|
+
]),
|
|
25765
|
+
staleWhy: _enum([
|
|
25766
|
+
"age",
|
|
25767
|
+
"runtime",
|
|
25768
|
+
"pool-tuning"
|
|
25769
|
+
]).nullable()
|
|
25770
|
+
});
|
|
25771
|
+
object({
|
|
25772
|
+
runId: string(),
|
|
25773
|
+
nodeId: string(),
|
|
25774
|
+
startedAtMs: number(),
|
|
25775
|
+
deadlineAtMs: number(),
|
|
25776
|
+
plan: NodeBenchmarkPlanSchema,
|
|
25777
|
+
moved: array(number()).readonly(),
|
|
25778
|
+
staying: array(number()).readonly()
|
|
25779
|
+
});
|
|
25780
|
+
/** Candidate detectors per device, for the plan editor. */
|
|
25781
|
+
var NodeBenchmarkCandidatesSchema = object({
|
|
25782
|
+
nodeId: string(),
|
|
25783
|
+
reachable: boolean(),
|
|
25784
|
+
devices: array(object({
|
|
25785
|
+
deviceKey: string(),
|
|
25786
|
+
enabled: boolean(),
|
|
25787
|
+
available: boolean(),
|
|
25788
|
+
/** Ordered: what Auto tune would pick first, then the rest of the family by accuracy. */
|
|
25789
|
+
suggested: array(string()).readonly(),
|
|
25790
|
+
/** Every root detector the device has a build for. */
|
|
25791
|
+
all: array(string()).readonly(),
|
|
25792
|
+
/** The model the device runs now, when pinned. */
|
|
25793
|
+
currentModelId: string().nullable()
|
|
25794
|
+
})).readonly(),
|
|
25795
|
+
/** Detail steps the node's catalog offers under the root (for the `pipeline` measurement). */
|
|
25796
|
+
steps: array(object({
|
|
25797
|
+
id: string(),
|
|
25798
|
+
name: string(),
|
|
25799
|
+
slot: string()
|
|
25800
|
+
})).readonly()
|
|
25801
|
+
});
|
|
24173
25802
|
object({
|
|
24174
25803
|
activeCameras: number(),
|
|
24175
25804
|
throttledCameras: number(),
|
|
@@ -25298,7 +26927,16 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
|
|
|
25298
26927
|
}), ParkedTrackFrameSchema.nullable()), method(object({
|
|
25299
26928
|
deviceId: number(),
|
|
25300
26929
|
trackId: string()
|
|
25301
|
-
}), object({ released: number().int().nonnegative() }), { kind: "mutation" })
|
|
26930
|
+
}), object({ released: number().int().nonnegative() }), { kind: "mutation" }), method(NodeBenchRunnerInputSchema, object({
|
|
26931
|
+
accepted: literal(true),
|
|
26932
|
+
runId: string()
|
|
26933
|
+
}), {
|
|
26934
|
+
kind: "mutation",
|
|
26935
|
+
auth: "admin"
|
|
26936
|
+
}), method(object({ runId: string() }), NodeBenchRunnerStatusSchema.nullable(), { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
|
|
26937
|
+
kind: "mutation",
|
|
26938
|
+
auth: "admin"
|
|
26939
|
+
});
|
|
25302
26940
|
var CameraPipelineConfigSchema = object({
|
|
25303
26941
|
engine: PipelineEngineChoiceSchema.optional(),
|
|
25304
26942
|
steps: array(PipelineStepInputSchema).readonly(),
|
|
@@ -25937,6 +27575,21 @@ method(object({
|
|
|
25937
27575
|
}), method(PlacementStatsInputSchema, PlacementStatsSchema, { auth: "admin" }), method(SuggestSharesInputSchema, SuggestSharesResultSchema, { auth: "admin" }), method(_void(), EffectiveSharesSchema, { auth: "admin" }), method(SetShareSourceInputSchema, object({ success: literal(true) }), {
|
|
25938
27576
|
kind: "mutation",
|
|
25939
27577
|
auth: "admin"
|
|
27578
|
+
}), method(NodeBenchmarkPlanSchema, NodeBenchmarkPreflightSchema, { auth: "admin" }), method(NodeBenchmarkPlanSchema, discriminatedUnion("kind", [object({
|
|
27579
|
+
kind: literal("started"),
|
|
27580
|
+
runId: string()
|
|
27581
|
+
}), object({
|
|
27582
|
+
kind: literal("refused"),
|
|
27583
|
+
preflight: NodeBenchmarkPreflightSchema
|
|
27584
|
+
})]), {
|
|
27585
|
+
kind: "mutation",
|
|
27586
|
+
auth: "admin"
|
|
27587
|
+
}), method(_void(), NodeBenchmarkStatusSchema, { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
|
|
27588
|
+
kind: "mutation",
|
|
27589
|
+
auth: "admin"
|
|
27590
|
+
}), method(object({ nodeId: string() }), NodeBenchmarkCandidatesSchema, { auth: "admin" }), method(ListNodeBenchmarkResultsInputSchema, array(NodeBenchmarkResultViewSchema).readonly(), { auth: "admin" }), method(object({ id: string() }), object({ deleted: boolean() }), {
|
|
27591
|
+
kind: "mutation",
|
|
27592
|
+
auth: "admin"
|
|
25940
27593
|
}), method(object({ deviceId: number() }), CameraPipelineSettingsSchema.nullable()), method(object({
|
|
25941
27594
|
deviceId: number(),
|
|
25942
27595
|
addonId: string(),
|
|
@@ -26677,7 +28330,19 @@ var SsoBridgeClaimsSchema = object({
|
|
|
26677
28330
|
* editing a descriptor must not retroactively extend or shorten a link the
|
|
26678
28331
|
* operator already consented to.
|
|
26679
28332
|
*/
|
|
26680
|
-
refreshTtl: union([number().int().positive(), literal("never")]).optional()
|
|
28333
|
+
refreshTtl: union([number().int().positive(), literal("never")]).optional(),
|
|
28334
|
+
/**
|
|
28335
|
+
* Opaque handle of a hub-side LINK intent (D782). Set by an OIDC callback
|
|
28336
|
+
* that was started from a signed-in user's "Link" button: the finish then
|
|
28337
|
+
* links this identity to the intent's user instead of signing anyone in.
|
|
28338
|
+
* The handle carries no user id — the hub resolves it, single-use.
|
|
28339
|
+
*/
|
|
28340
|
+
linkIntent: string().optional(),
|
|
28341
|
+
/**
|
|
28342
|
+
* Verified `iss` of the id_token behind an OIDC login bridge (D782). A
|
|
28343
|
+
* subject is unique only per issuer, so a link is bound to it.
|
|
28344
|
+
*/
|
|
28345
|
+
issuer: string().optional()
|
|
26681
28346
|
});
|
|
26682
28347
|
method(object({
|
|
26683
28348
|
claims: SsoBridgeClaimsSchema,
|
|
@@ -28612,7 +30277,22 @@ DeviceType.Camera, method(object({ deviceId: number().int().nonnegative() }), ar
|
|
|
28612
30277
|
* field their hints were silently stripped by the schema and the
|
|
28613
30278
|
* adaptive ladder started blind on the client's display size.
|
|
28614
30279
|
*/
|
|
28615
|
-
hints: webrtcClientHintsSchema.optional()
|
|
30280
|
+
hints: webrtcClientHintsSchema.optional(),
|
|
30281
|
+
/**
|
|
30282
|
+
* Talk-back (D771): relay the PEER's audio to the device's speaker
|
|
30283
|
+
* through the `intercom` cap's push-talk triple. When `true` and the
|
|
30284
|
+
* offer lets the peer send audio, the answer's audio is `sendrecv`
|
|
30285
|
+
* and every inbound frame goes to `intercom.pushTalkAudio` for this
|
|
30286
|
+
* `deviceId`; absent/false answers `sendonly`, as for every viewer.
|
|
30287
|
+
*
|
|
30288
|
+
* TRUSTED-CALLER ONLY. Set by the Alexa export for an Echo on a camera
|
|
30289
|
+
* with `intercom`, when the linked user may control that camera. The
|
|
30290
|
+
* hub STRIPS it from every request-bound call (a browser), exactly as
|
|
30291
|
+
* it overwrites `relayOnly` — a viewer's talk permission is the
|
|
30292
|
+
* intercom cap's own surface (share tokens gate it there), and this
|
|
30293
|
+
* flag must not become a second door to the camera's speaker.
|
|
30294
|
+
*/
|
|
30295
|
+
talkback: boolean().optional()
|
|
28616
30296
|
}), object({
|
|
28617
30297
|
sessionId: string(),
|
|
28618
30298
|
sdpAnswer: string()
|
|
@@ -32129,6 +33809,9 @@ var CreateIntegrationInputSchema = object({
|
|
|
32129
33809
|
enabled: boolean().optional(),
|
|
32130
33810
|
info: record(string(), unknown()).optional(),
|
|
32131
33811
|
settings: record(string(), unknown()).optional(),
|
|
33812
|
+
/** Keys of `settings` the form's schema declares secret (by type) — kept in
|
|
33813
|
+
* the keychain, not the table (D787). */
|
|
33814
|
+
secretKeys: array(string()).optional(),
|
|
32132
33815
|
skipRestart: boolean().optional()
|
|
32133
33816
|
});
|
|
32134
33817
|
var UpdateIntegrationInputSchema = object({
|
|
@@ -32152,7 +33835,9 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
|
|
|
32152
33835
|
auth: "admin"
|
|
32153
33836
|
}), method(object({ id: string() }), record(string(), unknown()), { auth: "admin" }), method(object({
|
|
32154
33837
|
id: string(),
|
|
32155
|
-
settings: record(string(), unknown())
|
|
33838
|
+
settings: record(string(), unknown()),
|
|
33839
|
+
/** Keys the form's schema declares secret (by type) — keychain-stored (D787). */
|
|
33840
|
+
secretKeys: array(string()).optional()
|
|
32156
33841
|
}), object({ success: boolean() }), {
|
|
32157
33842
|
kind: "mutation",
|
|
32158
33843
|
auth: "admin"
|
|
@@ -38974,6 +40659,32 @@ var TotpStatusSchema = object({
|
|
|
38974
40659
|
/** Null when no row exists OR the row is still pending confirmation. */
|
|
38975
40660
|
confirmedAt: number().nullable()
|
|
38976
40661
|
});
|
|
40662
|
+
/**
|
|
40663
|
+
* user-management — singleton capability for user accounts, API keys,
|
|
40664
|
+
* and scoped tokens.
|
|
40665
|
+
*
|
|
40666
|
+
* v2 model: every method gated by `auth: 'admin'`. Admin-only delegation
|
|
40667
|
+
* — the subset check on `setUserScopes` / `createScopedToken` is moot
|
|
40668
|
+
* because non-admins never reach these. If/when we open non-admin
|
|
40669
|
+
* delegation, structural caller-scope subset check goes inside the
|
|
40670
|
+
* provider.
|
|
40671
|
+
*/
|
|
40672
|
+
var ExternalIdentitySchema = object({
|
|
40673
|
+
/** Login-method id of the provider instance, e.g. `auth-oidc/authentik`. */
|
|
40674
|
+
provider: string(),
|
|
40675
|
+
/** The IdP's stable subject (`sub`) for this account. */
|
|
40676
|
+
subject: string(),
|
|
40677
|
+
/** The verified `iss` of the IdP the identity was linked under — `sub` is unique only per issuer. */
|
|
40678
|
+
issuer: string(),
|
|
40679
|
+
userId: string(),
|
|
40680
|
+
/** What the IdP called the account at link time (username / email) — display only. */
|
|
40681
|
+
label: string().optional(),
|
|
40682
|
+
linkedAt: number()
|
|
40683
|
+
});
|
|
40684
|
+
var ExternalIdentityKeySchema = object({
|
|
40685
|
+
provider: string().min(1),
|
|
40686
|
+
subject: string().min(1)
|
|
40687
|
+
});
|
|
38977
40688
|
method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserInputSchema, UserSummarySchema, {
|
|
38978
40689
|
kind: "mutation",
|
|
38979
40690
|
auth: "admin",
|
|
@@ -39087,7 +40798,22 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
39087
40798
|
userId: string(),
|
|
39088
40799
|
username: string(),
|
|
39089
40800
|
scopes: array(TokenScopeSchema)
|
|
39090
|
-
}).nullable(), { access: "view" }), method(
|
|
40801
|
+
}).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
|
|
40802
|
+
userId: string(),
|
|
40803
|
+
issuer: string()
|
|
40804
|
+
}).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
|
|
40805
|
+
userId: string(),
|
|
40806
|
+
issuer: string().min(1),
|
|
40807
|
+
label: string().optional()
|
|
40808
|
+
}), object({ success: literal(true) }), {
|
|
40809
|
+
kind: "mutation",
|
|
40810
|
+
auth: "admin",
|
|
40811
|
+
access: "create"
|
|
40812
|
+
}), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
40813
|
+
kind: "mutation",
|
|
40814
|
+
auth: "admin",
|
|
40815
|
+
access: "delete"
|
|
40816
|
+
}), method(_void(), array(OauthSessionSummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: boolean() }), {
|
|
39091
40817
|
kind: "mutation",
|
|
39092
40818
|
auth: "admin",
|
|
39093
40819
|
access: "delete"
|
|
@@ -40274,7 +42000,8 @@ var BaseDevice = class {
|
|
|
40274
42000
|
this.role = options.role;
|
|
40275
42001
|
this.parentDeviceId = ctx.parentDeviceId;
|
|
40276
42002
|
const seedData = ctx.persistedConfig ?? {};
|
|
40277
|
-
|
|
42003
|
+
const declaredSecretPaths = collectZodSecretPaths(schema);
|
|
42004
|
+
this.config = DeviceConfig.fromSchema(schema, (data) => ctx.persistConfig(data, { secretConfigPaths: declaredSecretPaths }), seedData, ({ droppedKeys, issues }) => {
|
|
40278
42005
|
ctx.logger.warn("Device config recovery: dropping invalid persisted fields", {
|
|
40279
42006
|
tags: {
|
|
40280
42007
|
deviceId: ctx.id,
|
|
@@ -43963,6 +45690,90 @@ Object.freeze({
|
|
|
43963
45690
|
addonId: null,
|
|
43964
45691
|
access: "create"
|
|
43965
45692
|
},
|
|
45693
|
+
"keychain.delete": {
|
|
45694
|
+
capName: "keychain",
|
|
45695
|
+
capScope: "system",
|
|
45696
|
+
addonId: null,
|
|
45697
|
+
access: "delete"
|
|
45698
|
+
},
|
|
45699
|
+
"keychain.getState": {
|
|
45700
|
+
capName: "keychain",
|
|
45701
|
+
capScope: "system",
|
|
45702
|
+
addonId: null,
|
|
45703
|
+
access: "view"
|
|
45704
|
+
},
|
|
45705
|
+
"keychain.listMeta": {
|
|
45706
|
+
capName: "keychain",
|
|
45707
|
+
capScope: "system",
|
|
45708
|
+
addonId: null,
|
|
45709
|
+
access: "view"
|
|
45710
|
+
},
|
|
45711
|
+
"keychain.put": {
|
|
45712
|
+
capName: "keychain",
|
|
45713
|
+
capScope: "system",
|
|
45714
|
+
addonId: null,
|
|
45715
|
+
access: "create"
|
|
45716
|
+
},
|
|
45717
|
+
"keychain.resolve": {
|
|
45718
|
+
capName: "keychain",
|
|
45719
|
+
capScope: "system",
|
|
45720
|
+
addonId: null,
|
|
45721
|
+
access: "view"
|
|
45722
|
+
},
|
|
45723
|
+
"keychainAdmin.deleteOrphans": {
|
|
45724
|
+
capName: "keychain-admin",
|
|
45725
|
+
capScope: "system",
|
|
45726
|
+
addonId: null,
|
|
45727
|
+
access: "delete"
|
|
45728
|
+
},
|
|
45729
|
+
"keychainAdmin.downloadRecoveryKey": {
|
|
45730
|
+
capName: "keychain-admin",
|
|
45731
|
+
capScope: "system",
|
|
45732
|
+
addonId: null,
|
|
45733
|
+
access: "create"
|
|
45734
|
+
},
|
|
45735
|
+
"keychainAdmin.listAudit": {
|
|
45736
|
+
capName: "keychain-admin",
|
|
45737
|
+
capScope: "system",
|
|
45738
|
+
addonId: null,
|
|
45739
|
+
access: "view"
|
|
45740
|
+
},
|
|
45741
|
+
"keychainAdmin.listSecrets": {
|
|
45742
|
+
capName: "keychain-admin",
|
|
45743
|
+
capScope: "system",
|
|
45744
|
+
addonId: null,
|
|
45745
|
+
access: "view"
|
|
45746
|
+
},
|
|
45747
|
+
"keychainAdmin.purgeRetiredKeys": {
|
|
45748
|
+
capName: "keychain-admin",
|
|
45749
|
+
capScope: "system",
|
|
45750
|
+
addonId: null,
|
|
45751
|
+
access: "delete"
|
|
45752
|
+
},
|
|
45753
|
+
"keychainAdmin.resetKeychain": {
|
|
45754
|
+
capName: "keychain-admin",
|
|
45755
|
+
capScope: "system",
|
|
45756
|
+
addonId: null,
|
|
45757
|
+
access: "delete"
|
|
45758
|
+
},
|
|
45759
|
+
"keychainAdmin.reveal": {
|
|
45760
|
+
capName: "keychain-admin",
|
|
45761
|
+
capScope: "system",
|
|
45762
|
+
addonId: null,
|
|
45763
|
+
access: "create"
|
|
45764
|
+
},
|
|
45765
|
+
"keychainAdmin.rotateMasterKey": {
|
|
45766
|
+
capName: "keychain-admin",
|
|
45767
|
+
capScope: "system",
|
|
45768
|
+
addonId: null,
|
|
45769
|
+
access: "create"
|
|
45770
|
+
},
|
|
45771
|
+
"keychainAdmin.status": {
|
|
45772
|
+
capName: "keychain-admin",
|
|
45773
|
+
capScope: "system",
|
|
45774
|
+
addonId: null,
|
|
45775
|
+
access: "view"
|
|
45776
|
+
},
|
|
43966
45777
|
"lawnMowerControl.dock": {
|
|
43967
45778
|
capName: "lawn-mower-control",
|
|
43968
45779
|
capScope: "device",
|
|
@@ -45337,6 +47148,18 @@ Object.freeze({
|
|
|
45337
47148
|
addonId: null,
|
|
45338
47149
|
access: "create"
|
|
45339
47150
|
},
|
|
47151
|
+
"pipelineAnalytics.addRetrainFrameFromRecording": {
|
|
47152
|
+
capName: "pipeline-analytics",
|
|
47153
|
+
capScope: "device",
|
|
47154
|
+
addonId: null,
|
|
47155
|
+
access: "create"
|
|
47156
|
+
},
|
|
47157
|
+
"pipelineAnalytics.addRetrainFramesToCollection": {
|
|
47158
|
+
capName: "pipeline-analytics",
|
|
47159
|
+
capScope: "device",
|
|
47160
|
+
addonId: null,
|
|
47161
|
+
access: "create"
|
|
47162
|
+
},
|
|
45340
47163
|
"pipelineAnalytics.applyDeviceSettingsPatch": {
|
|
45341
47164
|
capName: "pipeline-analytics",
|
|
45342
47165
|
capScope: "device",
|
|
@@ -45385,12 +47208,24 @@ Object.freeze({
|
|
|
45385
47208
|
addonId: null,
|
|
45386
47209
|
access: "view"
|
|
45387
47210
|
},
|
|
47211
|
+
"pipelineAnalytics.createRetrainCollection": {
|
|
47212
|
+
capName: "pipeline-analytics",
|
|
47213
|
+
capScope: "device",
|
|
47214
|
+
addonId: null,
|
|
47215
|
+
access: "create"
|
|
47216
|
+
},
|
|
45388
47217
|
"pipelineAnalytics.deleteDeviceEvents": {
|
|
45389
47218
|
capName: "pipeline-analytics",
|
|
45390
47219
|
capScope: "device",
|
|
45391
47220
|
addonId: null,
|
|
45392
47221
|
access: "delete"
|
|
45393
47222
|
},
|
|
47223
|
+
"pipelineAnalytics.deleteRetrainCollection": {
|
|
47224
|
+
capName: "pipeline-analytics",
|
|
47225
|
+
capScope: "device",
|
|
47226
|
+
addonId: null,
|
|
47227
|
+
access: "delete"
|
|
47228
|
+
},
|
|
45394
47229
|
"pipelineAnalytics.deleteTracks": {
|
|
45395
47230
|
capName: "pipeline-analytics",
|
|
45396
47231
|
capScope: "device",
|
|
@@ -45595,6 +47430,24 @@ Object.freeze({
|
|
|
45595
47430
|
addonId: null,
|
|
45596
47431
|
access: "view"
|
|
45597
47432
|
},
|
|
47433
|
+
"pipelineAnalytics.listRetrainAssistProfiles": {
|
|
47434
|
+
capName: "pipeline-analytics",
|
|
47435
|
+
capScope: "device",
|
|
47436
|
+
addonId: null,
|
|
47437
|
+
access: "view"
|
|
47438
|
+
},
|
|
47439
|
+
"pipelineAnalytics.listRetrainCollectionFrames": {
|
|
47440
|
+
capName: "pipeline-analytics",
|
|
47441
|
+
capScope: "device",
|
|
47442
|
+
addonId: null,
|
|
47443
|
+
access: "view"
|
|
47444
|
+
},
|
|
47445
|
+
"pipelineAnalytics.listRetrainCollections": {
|
|
47446
|
+
capName: "pipeline-analytics",
|
|
47447
|
+
capScope: "device",
|
|
47448
|
+
addonId: null,
|
|
47449
|
+
access: "view"
|
|
47450
|
+
},
|
|
45598
47451
|
"pipelineAnalytics.listRetrainFrames": {
|
|
45599
47452
|
capName: "pipeline-analytics",
|
|
45600
47453
|
capScope: "device",
|
|
@@ -45643,6 +47496,12 @@ Object.freeze({
|
|
|
45643
47496
|
addonId: null,
|
|
45644
47497
|
access: "create"
|
|
45645
47498
|
},
|
|
47499
|
+
"pipelineAnalytics.proposeRetrainAnnotationsWithLlm": {
|
|
47500
|
+
capName: "pipeline-analytics",
|
|
47501
|
+
capScope: "device",
|
|
47502
|
+
addonId: null,
|
|
47503
|
+
access: "create"
|
|
47504
|
+
},
|
|
45646
47505
|
"pipelineAnalytics.pruneEvents": {
|
|
45647
47506
|
capName: "pipeline-analytics",
|
|
45648
47507
|
capScope: "device",
|
|
@@ -45697,6 +47556,18 @@ Object.freeze({
|
|
|
45697
47556
|
addonId: null,
|
|
45698
47557
|
access: "create"
|
|
45699
47558
|
},
|
|
47559
|
+
"pipelineAnalytics.removeRetrainFrameFromCollection": {
|
|
47560
|
+
capName: "pipeline-analytics",
|
|
47561
|
+
capScope: "device",
|
|
47562
|
+
addonId: null,
|
|
47563
|
+
access: "delete"
|
|
47564
|
+
},
|
|
47565
|
+
"pipelineAnalytics.renameRetrainCollection": {
|
|
47566
|
+
capName: "pipeline-analytics",
|
|
47567
|
+
capScope: "device",
|
|
47568
|
+
addonId: null,
|
|
47569
|
+
access: "create"
|
|
47570
|
+
},
|
|
45700
47571
|
"pipelineAnalytics.restageRetrainTrack": {
|
|
45701
47572
|
capName: "pipeline-analytics",
|
|
45702
47573
|
capScope: "device",
|
|
@@ -45727,6 +47598,12 @@ Object.freeze({
|
|
|
45727
47598
|
addonId: null,
|
|
45728
47599
|
access: "create"
|
|
45729
47600
|
},
|
|
47601
|
+
"pipelineAnalytics.setRetrainFrameComplete": {
|
|
47602
|
+
capName: "pipeline-analytics",
|
|
47603
|
+
capScope: "device",
|
|
47604
|
+
addonId: null,
|
|
47605
|
+
access: "create"
|
|
47606
|
+
},
|
|
45730
47607
|
"pipelineAnalytics.setTrackFlags": {
|
|
45731
47608
|
capName: "pipeline-analytics",
|
|
45732
47609
|
capScope: "device",
|
|
@@ -45763,6 +47640,12 @@ Object.freeze({
|
|
|
45763
47640
|
addonId: null,
|
|
45764
47641
|
access: "delete"
|
|
45765
47642
|
},
|
|
47643
|
+
"pipelineAnalytics.writeRetrainArchive": {
|
|
47644
|
+
capName: "pipeline-analytics",
|
|
47645
|
+
capScope: "device",
|
|
47646
|
+
addonId: null,
|
|
47647
|
+
access: "create"
|
|
47648
|
+
},
|
|
45766
47649
|
"pipelineExecutor.cacheFrameInPool": {
|
|
45767
47650
|
capName: "pipeline-executor",
|
|
45768
47651
|
capScope: "system",
|
|
@@ -45973,6 +47856,12 @@ Object.freeze({
|
|
|
45973
47856
|
addonId: null,
|
|
45974
47857
|
access: "view"
|
|
45975
47858
|
},
|
|
47859
|
+
"pipelineOrchestrator.abortNodeBenchmark": {
|
|
47860
|
+
capName: "pipeline-orchestrator",
|
|
47861
|
+
capScope: "system",
|
|
47862
|
+
addonId: null,
|
|
47863
|
+
access: "create"
|
|
47864
|
+
},
|
|
45976
47865
|
"pipelineOrchestrator.applyAutoTune": {
|
|
45977
47866
|
capName: "pipeline-orchestrator",
|
|
45978
47867
|
capScope: "system",
|
|
@@ -45997,6 +47886,12 @@ Object.freeze({
|
|
|
45997
47886
|
addonId: null,
|
|
45998
47887
|
access: "create"
|
|
45999
47888
|
},
|
|
47889
|
+
"pipelineOrchestrator.deleteNodeBenchmarkResult": {
|
|
47890
|
+
capName: "pipeline-orchestrator",
|
|
47891
|
+
capScope: "system",
|
|
47892
|
+
addonId: null,
|
|
47893
|
+
access: "delete"
|
|
47894
|
+
},
|
|
46000
47895
|
"pipelineOrchestrator.getAgentLoad": {
|
|
46001
47896
|
capName: "pipeline-orchestrator",
|
|
46002
47897
|
capScope: "system",
|
|
@@ -46105,6 +48000,24 @@ Object.freeze({
|
|
|
46105
48000
|
addonId: null,
|
|
46106
48001
|
access: "view"
|
|
46107
48002
|
},
|
|
48003
|
+
"pipelineOrchestrator.getNodeBenchmarkCandidates": {
|
|
48004
|
+
capName: "pipeline-orchestrator",
|
|
48005
|
+
capScope: "system",
|
|
48006
|
+
addonId: null,
|
|
48007
|
+
access: "view"
|
|
48008
|
+
},
|
|
48009
|
+
"pipelineOrchestrator.getNodeBenchmarkPreflight": {
|
|
48010
|
+
capName: "pipeline-orchestrator",
|
|
48011
|
+
capScope: "system",
|
|
48012
|
+
addonId: null,
|
|
48013
|
+
access: "view"
|
|
48014
|
+
},
|
|
48015
|
+
"pipelineOrchestrator.getNodeBenchmarkStatus": {
|
|
48016
|
+
capName: "pipeline-orchestrator",
|
|
48017
|
+
capScope: "system",
|
|
48018
|
+
addonId: null,
|
|
48019
|
+
access: "view"
|
|
48020
|
+
},
|
|
46108
48021
|
"pipelineOrchestrator.getNodeInferenceDevices": {
|
|
46109
48022
|
capName: "pipeline-orchestrator",
|
|
46110
48023
|
capScope: "system",
|
|
@@ -46147,6 +48060,12 @@ Object.freeze({
|
|
|
46147
48060
|
addonId: null,
|
|
46148
48061
|
access: "view"
|
|
46149
48062
|
},
|
|
48063
|
+
"pipelineOrchestrator.listNodeBenchmarkResults": {
|
|
48064
|
+
capName: "pipeline-orchestrator",
|
|
48065
|
+
capScope: "system",
|
|
48066
|
+
addonId: null,
|
|
48067
|
+
access: "view"
|
|
48068
|
+
},
|
|
46150
48069
|
"pipelineOrchestrator.pauseForStorageMigration": {
|
|
46151
48070
|
capName: "pipeline-orchestrator",
|
|
46152
48071
|
capScope: "system",
|
|
@@ -46291,6 +48210,12 @@ Object.freeze({
|
|
|
46291
48210
|
addonId: null,
|
|
46292
48211
|
access: "create"
|
|
46293
48212
|
},
|
|
48213
|
+
"pipelineOrchestrator.startNodeBenchmark": {
|
|
48214
|
+
capName: "pipeline-orchestrator",
|
|
48215
|
+
capScope: "system",
|
|
48216
|
+
addonId: null,
|
|
48217
|
+
access: "create"
|
|
48218
|
+
},
|
|
46294
48219
|
"pipelineOrchestrator.suggestShares": {
|
|
46295
48220
|
capName: "pipeline-orchestrator",
|
|
46296
48221
|
capScope: "system",
|
|
@@ -46309,6 +48234,12 @@ Object.freeze({
|
|
|
46309
48234
|
addonId: null,
|
|
46310
48235
|
access: "create"
|
|
46311
48236
|
},
|
|
48237
|
+
"pipelineRunner.abortNodeBench": {
|
|
48238
|
+
capName: "pipeline-runner",
|
|
48239
|
+
capScope: "system",
|
|
48240
|
+
addonId: null,
|
|
48241
|
+
access: "create"
|
|
48242
|
+
},
|
|
46312
48243
|
"pipelineRunner.attachCamera": {
|
|
46313
48244
|
capName: "pipeline-runner",
|
|
46314
48245
|
capScope: "system",
|
|
@@ -46357,6 +48288,12 @@ Object.freeze({
|
|
|
46357
48288
|
addonId: null,
|
|
46358
48289
|
access: "view"
|
|
46359
48290
|
},
|
|
48291
|
+
"pipelineRunner.getNodeBenchStatus": {
|
|
48292
|
+
capName: "pipeline-runner",
|
|
48293
|
+
capScope: "system",
|
|
48294
|
+
addonId: null,
|
|
48295
|
+
access: "view"
|
|
48296
|
+
},
|
|
46360
48297
|
"pipelineRunner.getParkedTrackFrame": {
|
|
46361
48298
|
capName: "pipeline-runner",
|
|
46362
48299
|
capScope: "system",
|
|
@@ -46399,6 +48336,12 @@ Object.freeze({
|
|
|
46399
48336
|
addonId: null,
|
|
46400
48337
|
access: "create"
|
|
46401
48338
|
},
|
|
48339
|
+
"pipelineRunner.startNodeBench": {
|
|
48340
|
+
capName: "pipeline-runner",
|
|
48341
|
+
capScope: "system",
|
|
48342
|
+
addonId: null,
|
|
48343
|
+
access: "create"
|
|
48344
|
+
},
|
|
46402
48345
|
"plateGallery.assignPlate": {
|
|
46403
48346
|
capName: "plate-gallery",
|
|
46404
48347
|
capScope: "system",
|
|
@@ -48115,18 +50058,36 @@ Object.freeze({
|
|
|
48115
50058
|
addonId: null,
|
|
48116
50059
|
access: "delete"
|
|
48117
50060
|
},
|
|
50061
|
+
"userManagement.findUserByExternalIdentity": {
|
|
50062
|
+
capName: "user-management",
|
|
50063
|
+
capScope: "system",
|
|
50064
|
+
addonId: null,
|
|
50065
|
+
access: "view"
|
|
50066
|
+
},
|
|
48118
50067
|
"userManagement.getTotpStatus": {
|
|
48119
50068
|
capName: "user-management",
|
|
48120
50069
|
capScope: "system",
|
|
48121
50070
|
addonId: null,
|
|
48122
50071
|
access: "view"
|
|
48123
50072
|
},
|
|
50073
|
+
"userManagement.linkExternalIdentity": {
|
|
50074
|
+
capName: "user-management",
|
|
50075
|
+
capScope: "system",
|
|
50076
|
+
addonId: null,
|
|
50077
|
+
access: "create"
|
|
50078
|
+
},
|
|
48124
50079
|
"userManagement.listApiKeys": {
|
|
48125
50080
|
capName: "user-management",
|
|
48126
50081
|
capScope: "system",
|
|
48127
50082
|
addonId: null,
|
|
48128
50083
|
access: "view"
|
|
48129
50084
|
},
|
|
50085
|
+
"userManagement.listExternalIdentities": {
|
|
50086
|
+
capName: "user-management",
|
|
50087
|
+
capScope: "system",
|
|
50088
|
+
addonId: null,
|
|
50089
|
+
access: "view"
|
|
50090
|
+
},
|
|
48130
50091
|
"userManagement.listOauthSessions": {
|
|
48131
50092
|
capName: "user-management",
|
|
48132
50093
|
capScope: "system",
|
|
@@ -48205,6 +50166,12 @@ Object.freeze({
|
|
|
48205
50166
|
addonId: null,
|
|
48206
50167
|
access: "create"
|
|
48207
50168
|
},
|
|
50169
|
+
"userManagement.unlinkExternalIdentity": {
|
|
50170
|
+
capName: "user-management",
|
|
50171
|
+
capScope: "system",
|
|
50172
|
+
addonId: null,
|
|
50173
|
+
access: "delete"
|
|
50174
|
+
},
|
|
48208
50175
|
"userManagement.updateUser": {
|
|
48209
50176
|
capName: "user-management",
|
|
48210
50177
|
capScope: "system",
|
|
@@ -51304,6 +53271,11 @@ Object.freeze({
|
|
|
51304
53271
|
form: "single",
|
|
51305
53272
|
optional: false
|
|
51306
53273
|
}],
|
|
53274
|
+
"pipelineAnalytics.addRetrainFrameFromRecording": [{
|
|
53275
|
+
name: "deviceId",
|
|
53276
|
+
form: "single",
|
|
53277
|
+
optional: false
|
|
53278
|
+
}],
|
|
51307
53279
|
"pipelineAnalytics.applyDeviceSettingsPatch": [{
|
|
51308
53280
|
name: "deviceId",
|
|
51309
53281
|
form: "single",
|
|
@@ -51494,6 +53466,11 @@ Object.freeze({
|
|
|
51494
53466
|
form: "single",
|
|
51495
53467
|
optional: false
|
|
51496
53468
|
}],
|
|
53469
|
+
"pipelineAnalytics.proposeRetrainAnnotationsWithLlm": [{
|
|
53470
|
+
name: "deviceId",
|
|
53471
|
+
form: "single",
|
|
53472
|
+
optional: false
|
|
53473
|
+
}],
|
|
51497
53474
|
"pipelineAnalytics.pruneEventsBefore": [{
|
|
51498
53475
|
name: "deviceId",
|
|
51499
53476
|
form: "single",
|
|
@@ -51544,6 +53521,11 @@ Object.freeze({
|
|
|
51544
53521
|
form: "single",
|
|
51545
53522
|
optional: false
|
|
51546
53523
|
}],
|
|
53524
|
+
"pipelineAnalytics.setRetrainFrameComplete": [{
|
|
53525
|
+
name: "deviceId",
|
|
53526
|
+
form: "single",
|
|
53527
|
+
optional: false
|
|
53528
|
+
}],
|
|
51547
53529
|
"pipelineAnalytics.setTrackFlags": [{
|
|
51548
53530
|
name: "deviceId",
|
|
51549
53531
|
form: "single",
|
|
@@ -58226,8 +60208,8 @@ function defaultWyzeCloudFacadeFactory(credentials) {
|
|
|
58226
60208
|
}
|
|
58227
60209
|
var wyzeCredentialsSchema = object({
|
|
58228
60210
|
email: string().min(1).describe("Wyze account email"),
|
|
58229
|
-
password: string().min(1).describe("Wyze account password"),
|
|
58230
|
-
apiKey: string().min(1).describe("Wyze developer API key"),
|
|
60211
|
+
password: string().min(1).describe("Wyze account password").meta({ secret: true }),
|
|
60212
|
+
apiKey: string().min(1).describe("Wyze developer API key").meta({ secret: true }),
|
|
58231
60213
|
apiId: string().min(1).describe("Wyze developer Key ID")
|
|
58232
60214
|
});
|
|
58233
60215
|
var TEST_LABEL = "Signs in to the Wyze cloud with these account credentials";
|