@camstack/addon-provider-rademacher 0.2.122 → 0.2.124
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 +2044 -62
- package/dist/addon.mjs +2044 -62
- package/package.json +1 -1
package/dist/addon.mjs
CHANGED
|
@@ -983,7 +983,7 @@ var Rademacher = class {
|
|
|
983
983
|
}
|
|
984
984
|
};
|
|
985
985
|
//#endregion
|
|
986
|
-
//#region ../types/dist/event-category-
|
|
986
|
+
//#region ../types/dist/event-category-DaIZi00R.mjs
|
|
987
987
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
988
988
|
EventCategory["SystemBoot"] = "system.boot";
|
|
989
989
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -1062,6 +1062,13 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
1062
1062
|
*/
|
|
1063
1063
|
EventCategory["AddonLoadFailed"] = "addon.load-failed";
|
|
1064
1064
|
/**
|
|
1065
|
+
* A keychain value was stored or removed (D787). Carries the ref, its
|
|
1066
|
+
* owner and the new version — NEVER the value. A process holding the ref
|
|
1067
|
+
* drops its cached copy and the owning `BaseAddon` re-resolves its config.
|
|
1068
|
+
* Telemetry (D8): a process that misses it still revalidates by version.
|
|
1069
|
+
*/
|
|
1070
|
+
EventCategory["KeychainChanged"] = "keychain.changed";
|
|
1071
|
+
/**
|
|
1065
1072
|
* Addon recovered from a previous failure. Emitted when an addon
|
|
1066
1073
|
* transitions from `failed` back to `healthy` (typically via the
|
|
1067
1074
|
* monitor's auto-retry loop, or after manual `addons.retryLoad`).
|
|
@@ -6354,7 +6361,7 @@ var ZodIssueCode = {
|
|
|
6354
6361
|
var ZodFirstPartyTypeKind;
|
|
6355
6362
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
6356
6363
|
//#endregion
|
|
6357
|
-
//#region ../types/dist/sleep-
|
|
6364
|
+
//#region ../types/dist/sleep-Cr5YOk3m.mjs
|
|
6358
6365
|
/**
|
|
6359
6366
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
6360
6367
|
* window to float samples (D455).
|
|
@@ -6433,6 +6440,97 @@ function buildAlawTable() {
|
|
|
6433
6440
|
}
|
|
6434
6441
|
buildUlawTable();
|
|
6435
6442
|
buildAlawTable();
|
|
6443
|
+
/** Is this field's stored value a credential? */
|
|
6444
|
+
function isSecretConfigField(field) {
|
|
6445
|
+
if (field.type === "password") return true;
|
|
6446
|
+
return "secret" in field && field.secret === true;
|
|
6447
|
+
}
|
|
6448
|
+
/**
|
|
6449
|
+
* Is this field's value stored in the KEYCHAIN (D787)? Every secret field is,
|
|
6450
|
+
* by its TYPE, unless it opts out with `storage: 'inline'` — never by its name.
|
|
6451
|
+
*/
|
|
6452
|
+
function isKeychainStoredField(field) {
|
|
6453
|
+
if (!isSecretConfigField(field)) return false;
|
|
6454
|
+
if (field.type === "textarea" && field.isJson === true) return false;
|
|
6455
|
+
return !("storage" in field && field.storage === "inline");
|
|
6456
|
+
}
|
|
6457
|
+
/**
|
|
6458
|
+
* What a settings blob holds where a secret used to be.
|
|
6459
|
+
*
|
|
6460
|
+
* A keychain-stored field never holds its value. It holds a self-describing
|
|
6461
|
+
* MARKER, `{"$secret":"secret://…","v":1}` — an object, never a string, so no
|
|
6462
|
+
* code can mistake it for a credential and no form can send it to a camera as
|
|
6463
|
+
* a password. The empty state is `null` / absent, never `''`.
|
|
6464
|
+
*
|
|
6465
|
+
* The same shapes travel to and from the admin UI:
|
|
6466
|
+
*
|
|
6467
|
+
* - read: `hydrateSchema` hands a secret field a {@link SecretFieldView}
|
|
6468
|
+
* (`{ $secret, v, set: true }`) or `null` — the browser learns whether a
|
|
6469
|
+
* value is set, never the value.
|
|
6470
|
+
* - write: an untouched field submits the view back unchanged (KEEP); a typed
|
|
6471
|
+
* value is a plain non-empty string (CHANGE); the Clear button submits
|
|
6472
|
+
* {@link SECRET_CLEAR} (CLEAR). `''`, `null` and the legacy redaction tokens
|
|
6473
|
+
* are KEEP — an empty string is what a defaults-fallback pushes back, and
|
|
6474
|
+
* treating it as "clear" is how a save destroyed a stored credential before.
|
|
6475
|
+
*
|
|
6476
|
+
* Pure and browser-safe.
|
|
6477
|
+
*/
|
|
6478
|
+
var SECRET_CLEAR = { $secretClear: true };
|
|
6479
|
+
/** The `'***'` token D634 redaction writes for non-admins. */
|
|
6480
|
+
var LEGACY_DEVICE_REDACTION = "***";
|
|
6481
|
+
function isRecord$1(value) {
|
|
6482
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6483
|
+
}
|
|
6484
|
+
function makeSecretMarker(ref) {
|
|
6485
|
+
return {
|
|
6486
|
+
$secret: ref,
|
|
6487
|
+
v: 1
|
|
6488
|
+
};
|
|
6489
|
+
}
|
|
6490
|
+
/** A stored marker: an object whose `$secret` is a non-empty string. */
|
|
6491
|
+
function isSecretMarker(value) {
|
|
6492
|
+
if (!isRecord$1(value)) return false;
|
|
6493
|
+
const ref = value["$secret"];
|
|
6494
|
+
return typeof ref === "string" && ref.length > 0;
|
|
6495
|
+
}
|
|
6496
|
+
function isSecretClear(value) {
|
|
6497
|
+
return isRecord$1(value) && value["$secretClear"] === true;
|
|
6498
|
+
}
|
|
6499
|
+
/**
|
|
6500
|
+
* The UI view of a stored secret field value: a marker becomes "set", inline
|
|
6501
|
+
* plaintext becomes "set (inline)", nothing becomes `null`. A value never
|
|
6502
|
+
* survives this function.
|
|
6503
|
+
*/
|
|
6504
|
+
function toSecretFieldView(stored) {
|
|
6505
|
+
if (isSecretMarker(stored)) return {
|
|
6506
|
+
$secret: stored.$secret,
|
|
6507
|
+
v: 1,
|
|
6508
|
+
set: true
|
|
6509
|
+
};
|
|
6510
|
+
if (typeof stored === "string" && stored.length > 0) return {
|
|
6511
|
+
$secret: null,
|
|
6512
|
+
v: 1,
|
|
6513
|
+
set: true,
|
|
6514
|
+
inline: true
|
|
6515
|
+
};
|
|
6516
|
+
return null;
|
|
6517
|
+
}
|
|
6518
|
+
/**
|
|
6519
|
+
* Classify an incoming value for a secret path. Only a non-empty string that is
|
|
6520
|
+
* not a redaction token sets a value; only {@link SECRET_CLEAR} clears.
|
|
6521
|
+
* Everything else — a marker (ours or anyone's), a UI view, `''`, `null`,
|
|
6522
|
+
* `undefined`, a redaction token, a non-string — keeps what is stored.
|
|
6523
|
+
*/
|
|
6524
|
+
function classifySecretWrite(incoming) {
|
|
6525
|
+
if (isSecretClear(incoming)) return { kind: "clear" };
|
|
6526
|
+
if (typeof incoming !== "string") return { kind: "keep" };
|
|
6527
|
+
if (incoming.length === 0) return { kind: "keep" };
|
|
6528
|
+
if (incoming === "__camstack_redacted__" || incoming === LEGACY_DEVICE_REDACTION) return { kind: "keep" };
|
|
6529
|
+
return {
|
|
6530
|
+
kind: "set",
|
|
6531
|
+
value: incoming
|
|
6532
|
+
};
|
|
6533
|
+
}
|
|
6436
6534
|
Object.fromEntries([
|
|
6437
6535
|
{
|
|
6438
6536
|
id: "overview",
|
|
@@ -6604,33 +6702,19 @@ Object.fromEntries([
|
|
|
6604
6702
|
function isValuelessField(field) {
|
|
6605
6703
|
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";
|
|
6606
6704
|
}
|
|
6607
|
-
|
|
6608
|
-
* Merge a `ConfigUISchema` with a raw `values` record into a
|
|
6609
|
-
* `ConfigUISchemaWithValues`. Used by every `get*Settings` backend endpoint
|
|
6610
|
-
* before returning to the admin UI. Groups are walked recursively.
|
|
6611
|
-
*
|
|
6612
|
-
* For each leaf field:
|
|
6613
|
-
* - structural fields (`separator`, `info`, `button`) pass through unchanged
|
|
6614
|
-
* - other fields get `value = values[key] ?? field.default ?? null`
|
|
6615
|
-
*
|
|
6616
|
-
* Unknown keys in `values` (keys not declared in the schema) are silently
|
|
6617
|
-
* ignored — they don't contribute to the output. Missing keys fall back to
|
|
6618
|
-
* the schema default or `null`. This mirrors the old backend behaviour where
|
|
6619
|
-
* `FormBuilder` rendered `values[key] ?? field.default`.
|
|
6620
|
-
*/
|
|
6621
|
-
function hydrateSchema(schema, values) {
|
|
6705
|
+
function hydrateSchema(schema, values, options = {}) {
|
|
6622
6706
|
return {
|
|
6623
6707
|
...schema.tabs ? { tabs: [...schema.tabs] } : {},
|
|
6624
6708
|
sections: schema.sections.map((section) => ({
|
|
6625
6709
|
...section,
|
|
6626
|
-
fields: section.fields.map((field) => hydrateField(field, values))
|
|
6710
|
+
fields: section.fields.map((field) => hydrateField(field, values, options))
|
|
6627
6711
|
}))
|
|
6628
6712
|
};
|
|
6629
6713
|
}
|
|
6630
|
-
function hydrateField(field, values) {
|
|
6714
|
+
function hydrateField(field, values, options) {
|
|
6631
6715
|
if (isValuelessField(field)) return field;
|
|
6632
6716
|
if (field.type === "group") {
|
|
6633
|
-
const hydratedChildren = field.fields.map((child) => hydrateField(child, values));
|
|
6717
|
+
const hydratedChildren = field.fields.map((child) => hydrateField(child, values, options));
|
|
6634
6718
|
return {
|
|
6635
6719
|
...field,
|
|
6636
6720
|
fields: hydratedChildren
|
|
@@ -6639,7 +6723,7 @@ function hydrateField(field, values) {
|
|
|
6639
6723
|
if (field.type === "sub-tabs") {
|
|
6640
6724
|
const hydratedTabs = field.tabs.map((tab) => ({
|
|
6641
6725
|
...tab,
|
|
6642
|
-
fields: tab.fields.map((child) => hydrateField(child, values))
|
|
6726
|
+
fields: tab.fields.map((child) => hydrateField(child, values, options))
|
|
6643
6727
|
}));
|
|
6644
6728
|
return {
|
|
6645
6729
|
...field,
|
|
@@ -6649,6 +6733,33 @@ function hydrateField(field, values) {
|
|
|
6649
6733
|
const key = field.key;
|
|
6650
6734
|
const storedValue = Object.prototype.hasOwnProperty.call(values, key) ? values[key] : void 0;
|
|
6651
6735
|
const defaultValue = field.default;
|
|
6736
|
+
const asView = (v) => isSecretMarker(v) || options.inlineSecretsAsViews === true && v !== void 0;
|
|
6737
|
+
if (isKeychainStoredField(field) && asView(storedValue)) return {
|
|
6738
|
+
...field,
|
|
6739
|
+
value: toSecretFieldView(storedValue)
|
|
6740
|
+
};
|
|
6741
|
+
if (isKeychainStoredField(field) && options.inlineSecretsAsViews === true) return {
|
|
6742
|
+
...field,
|
|
6743
|
+
value: null
|
|
6744
|
+
};
|
|
6745
|
+
if (field.type === "editable-array" && Array.isArray(storedValue)) {
|
|
6746
|
+
const secretItemKeys = field.itemFields.filter((item) => "key" in item && isKeychainStoredField(item)).map((item) => "key" in item ? item.key : "");
|
|
6747
|
+
if (secretItemKeys.length > 0) {
|
|
6748
|
+
const rows = storedValue.map((row) => {
|
|
6749
|
+
if (row === null || typeof row !== "object" || Array.isArray(row)) return row;
|
|
6750
|
+
const out = { ...row };
|
|
6751
|
+
for (const k of secretItemKeys) {
|
|
6752
|
+
const v = Reflect.get(row, k);
|
|
6753
|
+
if (asView(v)) out[k] = toSecretFieldView(v);
|
|
6754
|
+
}
|
|
6755
|
+
return out;
|
|
6756
|
+
});
|
|
6757
|
+
return {
|
|
6758
|
+
...field,
|
|
6759
|
+
value: rows
|
|
6760
|
+
};
|
|
6761
|
+
}
|
|
6762
|
+
}
|
|
6652
6763
|
if (field.multiple) {
|
|
6653
6764
|
const stored = Array.isArray(storedValue) ? storedValue : storedValue !== void 0 && storedValue !== null ? [storedValue] : [];
|
|
6654
6765
|
const itemFallback = field.multiple.itemDefault !== void 0 ? field.multiple.itemDefault : defaultValue !== void 0 ? defaultValue : typeOf(field) === "string" ? "" : null;
|
|
@@ -6891,6 +7002,431 @@ function projectStore(store, perNodeKeys, nodeId) {
|
|
|
6891
7002
|
}
|
|
6892
7003
|
return out;
|
|
6893
7004
|
}
|
|
7005
|
+
var GLOBAL_SCOPE = { kind: "global" };
|
|
7006
|
+
/** The scope every addon-wide (not per-node, not per-device) setting lives in. */
|
|
7007
|
+
function globalSecretScope() {
|
|
7008
|
+
return GLOBAL_SCOPE;
|
|
7009
|
+
}
|
|
7010
|
+
function encodeSegment(value) {
|
|
7011
|
+
return encodeURIComponent(value);
|
|
7012
|
+
}
|
|
7013
|
+
/**
|
|
7014
|
+
* The field path of a value inside an array item, addressed by the item's id:
|
|
7015
|
+
* `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
|
|
7016
|
+
* `providers[authentik].clientSecret`.
|
|
7017
|
+
*/
|
|
7018
|
+
function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
|
|
7019
|
+
return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
|
|
7020
|
+
}
|
|
7021
|
+
/** A write to a secret path could not be stored in the keychain, so it was refused. */
|
|
7022
|
+
var KeychainWriteRefusedError = class extends Error {
|
|
7023
|
+
fieldPath;
|
|
7024
|
+
constructor(fieldPath, cause) {
|
|
7025
|
+
super(`secret "${fieldPath}" was not saved: the keychain could not store it (${cause instanceof Error ? cause.message : String(cause)}). Nothing was written.`);
|
|
7026
|
+
this.fieldPath = fieldPath;
|
|
7027
|
+
this.name = "KeychainWriteRefusedError";
|
|
7028
|
+
}
|
|
7029
|
+
};
|
|
7030
|
+
var KEEP = { kind: "keep" };
|
|
7031
|
+
function isRecord(value) {
|
|
7032
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7033
|
+
}
|
|
7034
|
+
function defaultMintId() {
|
|
7035
|
+
return globalThis.crypto.randomUUID();
|
|
7036
|
+
}
|
|
7037
|
+
/** Every marker ref anywhere under `value`. */
|
|
7038
|
+
function collectSecretMarkerRefs(value, out = []) {
|
|
7039
|
+
if (isSecretMarker(value)) {
|
|
7040
|
+
out.push(value.$secret);
|
|
7041
|
+
return out;
|
|
7042
|
+
}
|
|
7043
|
+
if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
|
|
7044
|
+
else if (isRecord(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
7045
|
+
return out;
|
|
7046
|
+
}
|
|
7047
|
+
async function storedValueEquals(secrets, marker, candidate) {
|
|
7048
|
+
const resolved = (await secrets.resolve([marker.$secret]))[marker.$secret];
|
|
7049
|
+
return resolved?.kind === "value" && resolved.value === candidate;
|
|
7050
|
+
}
|
|
7051
|
+
async function writeLeaf(ctx, incoming, stored, fieldPath) {
|
|
7052
|
+
const intent = classifySecretWrite(incoming);
|
|
7053
|
+
const ref = ctx.secrets.ref(ctx.scope, fieldPath);
|
|
7054
|
+
const storedIsOurs = isSecretMarker(stored) && stored.$secret === ref;
|
|
7055
|
+
if (intent.kind === "keep") return KEEP;
|
|
7056
|
+
if (intent.kind === "set" && !ctx.operatorWrite && typeof stored === "string" && stored === intent.value) return KEEP;
|
|
7057
|
+
if (intent.kind === "clear") {
|
|
7058
|
+
if (storedIsOurs) ctx.deletes.push(ref);
|
|
7059
|
+
return {
|
|
7060
|
+
kind: "value",
|
|
7061
|
+
value: null
|
|
7062
|
+
};
|
|
7063
|
+
}
|
|
7064
|
+
if (storedIsOurs && await storedValueEquals(ctx.secrets, stored, intent.value)) return {
|
|
7065
|
+
kind: "value",
|
|
7066
|
+
value: stored
|
|
7067
|
+
};
|
|
7068
|
+
try {
|
|
7069
|
+
await ctx.secrets.put(ref, intent.value);
|
|
7070
|
+
} catch (err) {
|
|
7071
|
+
throw new KeychainWriteRefusedError(fieldPath, err);
|
|
7072
|
+
}
|
|
7073
|
+
return {
|
|
7074
|
+
kind: "value",
|
|
7075
|
+
value: makeSecretMarker(ref)
|
|
7076
|
+
};
|
|
7077
|
+
}
|
|
7078
|
+
/** Apply a member result onto `out`: KEEP restores the stored member, or removes it. */
|
|
7079
|
+
function applyMember(out, key, result, storedParent) {
|
|
7080
|
+
if (result.kind === "value") {
|
|
7081
|
+
out[key] = result.value;
|
|
7082
|
+
return;
|
|
7083
|
+
}
|
|
7084
|
+
if (Object.prototype.hasOwnProperty.call(storedParent, key)) out[key] = storedParent[key];
|
|
7085
|
+
else delete out[key];
|
|
7086
|
+
}
|
|
7087
|
+
async function writeMembers(ctx, children, incoming, stored, pathOf) {
|
|
7088
|
+
const out = { ...incoming };
|
|
7089
|
+
for (const [member, node] of children) applyMember(out, member, await writeNode(ctx, node, incoming[member], stored[member], pathOf(member)), stored);
|
|
7090
|
+
return out;
|
|
7091
|
+
}
|
|
7092
|
+
function rowId(row, idKey) {
|
|
7093
|
+
const raw = row[idKey];
|
|
7094
|
+
if (typeof raw === "string" && raw.length > 0) return raw;
|
|
7095
|
+
if (typeof raw === "number" && Number.isFinite(raw)) return String(raw);
|
|
7096
|
+
return null;
|
|
7097
|
+
}
|
|
7098
|
+
async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
7099
|
+
const storedRows = Array.isArray(stored) ? stored.filter(isRecord) : [];
|
|
7100
|
+
if (!Array.isArray(incoming)) {
|
|
7101
|
+
ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
|
|
7102
|
+
return {
|
|
7103
|
+
kind: "value",
|
|
7104
|
+
value: incoming
|
|
7105
|
+
};
|
|
7106
|
+
}
|
|
7107
|
+
const storedById = /* @__PURE__ */ new Map();
|
|
7108
|
+
for (const row of storedRows) {
|
|
7109
|
+
const id = rowId(row, node.idKey);
|
|
7110
|
+
if (id !== null) storedById.set(id, row);
|
|
7111
|
+
}
|
|
7112
|
+
const kept = /* @__PURE__ */ new Set();
|
|
7113
|
+
const rows = [];
|
|
7114
|
+
for (const row of incoming) {
|
|
7115
|
+
if (!isRecord(row)) {
|
|
7116
|
+
rows.push(row);
|
|
7117
|
+
continue;
|
|
7118
|
+
}
|
|
7119
|
+
const id = rowId(row, node.idKey) ?? ctx.mintId();
|
|
7120
|
+
kept.add(id);
|
|
7121
|
+
const withId = {
|
|
7122
|
+
...row,
|
|
7123
|
+
[node.idKey]: row[node.idKey] ?? id
|
|
7124
|
+
};
|
|
7125
|
+
if (rowId(withId, node.idKey) === null) withId[node.idKey] = id;
|
|
7126
|
+
const storedRow = storedById.get(id) ?? {};
|
|
7127
|
+
rows.push(await writeMembers(ctx, node.item, withId, storedRow, (member) => arrayItemFieldPath(fieldPath, id, member)));
|
|
7128
|
+
}
|
|
7129
|
+
for (const [id, row] of storedById) if (!kept.has(id)) ctx.deletes.push(...collectSecretMarkerRefs(row));
|
|
7130
|
+
return {
|
|
7131
|
+
kind: "value",
|
|
7132
|
+
value: rows
|
|
7133
|
+
};
|
|
7134
|
+
}
|
|
7135
|
+
async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
7136
|
+
switch (node.kind) {
|
|
7137
|
+
case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
|
|
7138
|
+
case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
|
|
7139
|
+
case "object": {
|
|
7140
|
+
if (!isRecord(incoming)) {
|
|
7141
|
+
if (incoming === void 0) return KEEP;
|
|
7142
|
+
ctx.deletes.push(...collectSecretMarkerRefs(stored));
|
|
7143
|
+
return {
|
|
7144
|
+
kind: "value",
|
|
7145
|
+
value: incoming
|
|
7146
|
+
};
|
|
7147
|
+
}
|
|
7148
|
+
const storedObj = isRecord(stored) ? stored : {};
|
|
7149
|
+
return {
|
|
7150
|
+
kind: "value",
|
|
7151
|
+
value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
|
|
7152
|
+
};
|
|
7153
|
+
}
|
|
7154
|
+
}
|
|
7155
|
+
}
|
|
7156
|
+
/** Split a perNode-scoped key (`key@nodeId`). */
|
|
7157
|
+
function splitNodeKey(key) {
|
|
7158
|
+
const at = key.indexOf("@");
|
|
7159
|
+
return at <= 0 ? {
|
|
7160
|
+
base: key,
|
|
7161
|
+
nodeId: null
|
|
7162
|
+
} : {
|
|
7163
|
+
base: key.slice(0, at),
|
|
7164
|
+
nodeId: key.slice(at + 1)
|
|
7165
|
+
};
|
|
7166
|
+
}
|
|
7167
|
+
/** Rewrite a settings patch so no secret value reaches the blob. See the file doc. */
|
|
7168
|
+
async function transformSecretWrite(input) {
|
|
7169
|
+
const deletes = [];
|
|
7170
|
+
const base = {
|
|
7171
|
+
secrets: input.secrets,
|
|
7172
|
+
mintId: input.mintId ?? defaultMintId,
|
|
7173
|
+
deletes,
|
|
7174
|
+
operatorWrite: input.operatorWrite === true
|
|
7175
|
+
};
|
|
7176
|
+
const out = {};
|
|
7177
|
+
for (const [key, incoming] of Object.entries(input.patch)) {
|
|
7178
|
+
const { base: baseKey, nodeId } = splitNodeKey(key);
|
|
7179
|
+
const node = input.tree.get(baseKey);
|
|
7180
|
+
if (node === void 0) {
|
|
7181
|
+
out[key] = incoming;
|
|
7182
|
+
continue;
|
|
7183
|
+
}
|
|
7184
|
+
const scope = nodeId !== null && nodeId.length > 0 ? {
|
|
7185
|
+
kind: "node",
|
|
7186
|
+
nodeId
|
|
7187
|
+
} : input.scope ?? globalSecretScope();
|
|
7188
|
+
const result = await writeNode({
|
|
7189
|
+
...base,
|
|
7190
|
+
scope
|
|
7191
|
+
}, node, incoming, input.stored[key], baseKey);
|
|
7192
|
+
if (result.kind === "value") out[key] = result.value;
|
|
7193
|
+
}
|
|
7194
|
+
return {
|
|
7195
|
+
patch: out,
|
|
7196
|
+
afterWrite: async () => {
|
|
7197
|
+
if (deletes.length === 0) return { orphaned: [] };
|
|
7198
|
+
try {
|
|
7199
|
+
await input.secrets.delete([...new Set(deletes)]);
|
|
7200
|
+
return { orphaned: [] };
|
|
7201
|
+
} catch {
|
|
7202
|
+
return { orphaned: [...new Set(deletes)] };
|
|
7203
|
+
}
|
|
7204
|
+
}
|
|
7205
|
+
};
|
|
7206
|
+
}
|
|
7207
|
+
/**
|
|
7208
|
+
* Replace every marker in `value` with its keychain value. Returns the SAME
|
|
7209
|
+
* reference when there is no marker (no allocation, no keychain call).
|
|
7210
|
+
*/
|
|
7211
|
+
async function resolveSecretMarkers(value, secrets) {
|
|
7212
|
+
const refs = collectSecretMarkerRefs(value);
|
|
7213
|
+
if (refs.length === 0) return {
|
|
7214
|
+
value,
|
|
7215
|
+
unresolved: []
|
|
7216
|
+
};
|
|
7217
|
+
const answers = await secrets.resolve(refs);
|
|
7218
|
+
const unresolved = [];
|
|
7219
|
+
for (const ref of new Set(refs)) {
|
|
7220
|
+
const answer = answers[ref];
|
|
7221
|
+
if (answer === void 0) unresolved.push({
|
|
7222
|
+
ref,
|
|
7223
|
+
reason: "not-initialized"
|
|
7224
|
+
});
|
|
7225
|
+
else if (answer.kind === "unavailable") unresolved.push({
|
|
7226
|
+
ref,
|
|
7227
|
+
reason: answer.reason
|
|
7228
|
+
});
|
|
7229
|
+
else if (answer.kind === "missing" || answer.kind === "forbidden") unresolved.push({
|
|
7230
|
+
ref,
|
|
7231
|
+
reason: answer.kind
|
|
7232
|
+
});
|
|
7233
|
+
}
|
|
7234
|
+
const substitute = (v) => {
|
|
7235
|
+
if (isSecretMarker(v)) {
|
|
7236
|
+
const answer = answers[v.$secret];
|
|
7237
|
+
return answer?.kind === "value" ? {
|
|
7238
|
+
keep: true,
|
|
7239
|
+
value: answer.value
|
|
7240
|
+
} : {
|
|
7241
|
+
keep: false,
|
|
7242
|
+
value: void 0
|
|
7243
|
+
};
|
|
7244
|
+
}
|
|
7245
|
+
if (Array.isArray(v)) {
|
|
7246
|
+
const items = [];
|
|
7247
|
+
for (const item of v) {
|
|
7248
|
+
const s = substitute(item);
|
|
7249
|
+
if (s.keep) items.push(s.value);
|
|
7250
|
+
}
|
|
7251
|
+
return {
|
|
7252
|
+
keep: true,
|
|
7253
|
+
value: items
|
|
7254
|
+
};
|
|
7255
|
+
}
|
|
7256
|
+
if (isRecord(v)) {
|
|
7257
|
+
const out = {};
|
|
7258
|
+
for (const [k, child] of Object.entries(v)) {
|
|
7259
|
+
const s = substitute(child);
|
|
7260
|
+
if (s.keep) out[k] = s.value;
|
|
7261
|
+
}
|
|
7262
|
+
return {
|
|
7263
|
+
keep: true,
|
|
7264
|
+
value: out
|
|
7265
|
+
};
|
|
7266
|
+
}
|
|
7267
|
+
return {
|
|
7268
|
+
keep: true,
|
|
7269
|
+
value: v
|
|
7270
|
+
};
|
|
7271
|
+
};
|
|
7272
|
+
return {
|
|
7273
|
+
value: substitute(value).value,
|
|
7274
|
+
unresolved
|
|
7275
|
+
};
|
|
7276
|
+
}
|
|
7277
|
+
function touchesTree(tree, patch) {
|
|
7278
|
+
if (tree.size === 0) return false;
|
|
7279
|
+
for (const key of Object.keys(patch)) {
|
|
7280
|
+
const at = key.indexOf("@");
|
|
7281
|
+
if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
|
|
7282
|
+
}
|
|
7283
|
+
return false;
|
|
7284
|
+
}
|
|
7285
|
+
/** The blob as stored now; a failed read REFUSES the write instead of guessing. */
|
|
7286
|
+
async function readStoredAddonBlob(raw) {
|
|
7287
|
+
const threeWay = raw.readAddonStoreResult;
|
|
7288
|
+
if (threeWay === void 0) return raw.readAddonStore();
|
|
7289
|
+
const result = await threeWay.call(raw);
|
|
7290
|
+
if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
|
|
7291
|
+
return result.kind === "missing" ? {} : result.value;
|
|
7292
|
+
}
|
|
7293
|
+
function createSecretAwareSettings(raw, opts) {
|
|
7294
|
+
const chains = /* @__PURE__ */ new Map();
|
|
7295
|
+
const serialize = (key, fn) => {
|
|
7296
|
+
const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
|
|
7297
|
+
const tail = next.catch(() => void 0);
|
|
7298
|
+
chains.set(key, tail);
|
|
7299
|
+
tail.then(() => {
|
|
7300
|
+
if (chains.get(key) === tail) chains.delete(key);
|
|
7301
|
+
});
|
|
7302
|
+
return next;
|
|
7303
|
+
};
|
|
7304
|
+
const write = async (chainKey, tree, scope, patch, readStored, rawWrite) => {
|
|
7305
|
+
if (!touchesTree(tree, patch)) return rawWrite(patch);
|
|
7306
|
+
return serialize(chainKey, async () => {
|
|
7307
|
+
const stored = await readStored();
|
|
7308
|
+
const result = await transformSecretWrite({
|
|
7309
|
+
tree,
|
|
7310
|
+
secrets: opts.secrets,
|
|
7311
|
+
patch,
|
|
7312
|
+
stored,
|
|
7313
|
+
...scope !== void 0 ? { scope } : {},
|
|
7314
|
+
operatorWrite: opts.isOperatorWrite?.() === true
|
|
7315
|
+
});
|
|
7316
|
+
if (Object.keys(result.patch).length > 0) await rawWrite(result.patch);
|
|
7317
|
+
const { orphaned } = await result.afterWrite();
|
|
7318
|
+
if (orphaned.length > 0) opts.onOrphaned(orphaned);
|
|
7319
|
+
});
|
|
7320
|
+
};
|
|
7321
|
+
const wrapped = {
|
|
7322
|
+
writeAddonStore: (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p)),
|
|
7323
|
+
writeDeviceStore: (deviceId, patch) => write(`device:${deviceId}`, opts.deviceTree(), {
|
|
7324
|
+
kind: "device",
|
|
7325
|
+
deviceId
|
|
7326
|
+
}, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p))
|
|
7327
|
+
};
|
|
7328
|
+
return new Proxy(raw, { get(target, prop, receiver) {
|
|
7329
|
+
if (prop === "writeAddonStore") return wrapped.writeAddonStore;
|
|
7330
|
+
if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
|
|
7331
|
+
const value = Reflect.get(target, prop, receiver);
|
|
7332
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
7333
|
+
} });
|
|
7334
|
+
}
|
|
7335
|
+
/** The context the addon sees: identical, except that its settings writes are secret-aware. */
|
|
7336
|
+
function withSecretAwareSettings(context, opts) {
|
|
7337
|
+
const raw = context.settings;
|
|
7338
|
+
if (raw === void 0) return context;
|
|
7339
|
+
const settings = createSecretAwareSettings(raw, opts);
|
|
7340
|
+
return new Proxy(context, { get(target, prop, receiver) {
|
|
7341
|
+
if (prop === "settings") return settings;
|
|
7342
|
+
return Reflect.get(target, prop, receiver);
|
|
7343
|
+
} });
|
|
7344
|
+
}
|
|
7345
|
+
var LEAF = { kind: "leaf" };
|
|
7346
|
+
var DEFAULT_ITEM_ID_KEY = "id";
|
|
7347
|
+
function collectFields(fields, out) {
|
|
7348
|
+
for (const field of fields) {
|
|
7349
|
+
if (field.type === "group") {
|
|
7350
|
+
collectFields(field.fields, out);
|
|
7351
|
+
continue;
|
|
7352
|
+
}
|
|
7353
|
+
if (field.type === "sub-tabs") {
|
|
7354
|
+
for (const tab of field.tabs) collectFields(tab.fields, out);
|
|
7355
|
+
continue;
|
|
7356
|
+
}
|
|
7357
|
+
if (field.type === "editable-array") {
|
|
7358
|
+
const item = /* @__PURE__ */ new Map();
|
|
7359
|
+
for (const itemField of field.itemFields) if ("key" in itemField && isKeychainStoredField(itemField)) item.set(itemField.key, LEAF);
|
|
7360
|
+
if (item.size > 0) out.set(field.key, {
|
|
7361
|
+
kind: "array",
|
|
7362
|
+
idKey: field.itemIdKey ?? DEFAULT_ITEM_ID_KEY,
|
|
7363
|
+
item
|
|
7364
|
+
});
|
|
7365
|
+
continue;
|
|
7366
|
+
}
|
|
7367
|
+
if (!("key" in field) || typeof field.key !== "string") continue;
|
|
7368
|
+
if (isKeychainStoredField(field)) out.set(field.key, LEAF);
|
|
7369
|
+
}
|
|
7370
|
+
}
|
|
7371
|
+
/** The secret tree a settings schema declares. */
|
|
7372
|
+
function secretTreeFromSchema(schema) {
|
|
7373
|
+
const out = /* @__PURE__ */ new Map();
|
|
7374
|
+
if (schema === null) return out;
|
|
7375
|
+
for (const section of schema.sections) collectFields(section.fields, out);
|
|
7376
|
+
return out;
|
|
7377
|
+
}
|
|
7378
|
+
/** Parse `a.b[id].c` into segments; throws on a malformed path (a declaration bug). */
|
|
7379
|
+
function parseSecretStatePath(path) {
|
|
7380
|
+
const segments = [];
|
|
7381
|
+
for (const raw of path.split(".")) {
|
|
7382
|
+
const m = /^([^[\]]+)(?:\[([^[\]]+)\])?$/.exec(raw);
|
|
7383
|
+
if (m === null || m[1] === void 0) throw new Error(`secretStatePaths: malformed path "${path}"`);
|
|
7384
|
+
segments.push(m[2] !== void 0 ? {
|
|
7385
|
+
key: m[1],
|
|
7386
|
+
idKey: m[2]
|
|
7387
|
+
} : { key: m[1] });
|
|
7388
|
+
}
|
|
7389
|
+
if (segments.length === 0) throw new Error(`secretStatePaths: empty path`);
|
|
7390
|
+
if (segments[segments.length - 1]?.idKey !== void 0) throw new Error(`secretStatePaths: "${path}" ends on an array — name the member that is secret`);
|
|
7391
|
+
return segments;
|
|
7392
|
+
}
|
|
7393
|
+
function insert(into, segments) {
|
|
7394
|
+
const [head, ...rest] = segments;
|
|
7395
|
+
if (head === void 0) return;
|
|
7396
|
+
if (rest.length === 0) {
|
|
7397
|
+
into.set(head.key, LEAF);
|
|
7398
|
+
return;
|
|
7399
|
+
}
|
|
7400
|
+
const existing = into.get(head.key);
|
|
7401
|
+
if (head.idKey !== void 0) {
|
|
7402
|
+
const item = new Map(existing?.kind === "array" ? existing.item : []);
|
|
7403
|
+
insert(item, rest);
|
|
7404
|
+
into.set(head.key, {
|
|
7405
|
+
kind: "array",
|
|
7406
|
+
idKey: head.idKey,
|
|
7407
|
+
item
|
|
7408
|
+
});
|
|
7409
|
+
return;
|
|
7410
|
+
}
|
|
7411
|
+
const children = new Map(existing?.kind === "object" ? existing.children : []);
|
|
7412
|
+
insert(children, rest);
|
|
7413
|
+
into.set(head.key, {
|
|
7414
|
+
kind: "object",
|
|
7415
|
+
children
|
|
7416
|
+
});
|
|
7417
|
+
}
|
|
7418
|
+
/** Add hidden-state paths (`secretStatePaths`) to a schema-derived tree. */
|
|
7419
|
+
function mergeSecretStatePaths(tree, paths) {
|
|
7420
|
+
if (paths.length === 0) return tree;
|
|
7421
|
+
const out = new Map(tree);
|
|
7422
|
+
for (const path of paths) insert(out, parseSecretStatePath(path));
|
|
7423
|
+
return out;
|
|
7424
|
+
}
|
|
7425
|
+
/** First retry of a secret the keychain could not serve; doubles to {@link SECRET_RETRY_MAX_MS}. */
|
|
7426
|
+
var SECRET_RETRY_FIRST_MS = 5e3;
|
|
7427
|
+
var SECRET_RETRY_MAX_MS = 5 * 6e4;
|
|
7428
|
+
/** Coalesces a burst of `keychain.changed` events into one re-resolve. */
|
|
7429
|
+
var SECRET_CHANGE_DEBOUNCE_MS = 250;
|
|
6894
7430
|
/**
|
|
6895
7431
|
* Base class for CamStack addons. Eliminates settings boilerplate:
|
|
6896
7432
|
*
|
|
@@ -6960,6 +7496,25 @@ var BaseAddon = class {
|
|
|
6960
7496
|
settingsStoreReady = false;
|
|
6961
7497
|
/** Default config values. Provided via constructor. */
|
|
6962
7498
|
defaults;
|
|
7499
|
+
/**
|
|
7500
|
+
* Hidden-state paths that hold secrets (D787) — values the addon writes
|
|
7501
|
+
* itself (`updateGlobalSettings`, `state()`) that no form field declares.
|
|
7502
|
+
* Stored in the keychain exactly like a `password` field. Syntax:
|
|
7503
|
+
* `'snapshotSigningKey'`, `'identity.pincode'`, `'tokens[userId].accessToken'`
|
|
7504
|
+
* (`key[<id field>]` addresses array items by id, never by index).
|
|
7505
|
+
*/
|
|
7506
|
+
secretStatePaths = [];
|
|
7507
|
+
_addonSecretTree = null;
|
|
7508
|
+
_deviceSecretTree = null;
|
|
7509
|
+
/** Refs the last resolved config pointed at — a change to one re-resolves. */
|
|
7510
|
+
_configSecretRefs = /* @__PURE__ */ new Set();
|
|
7511
|
+
_unresolvedSecrets = [];
|
|
7512
|
+
_secretRetryTimer = null;
|
|
7513
|
+
_secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
|
|
7514
|
+
_secretChangeTimer = null;
|
|
7515
|
+
_secretChangeUnsub = null;
|
|
7516
|
+
/** >0 while an OPERATOR's settings write is being applied. */
|
|
7517
|
+
_operatorWriteDepth = 0;
|
|
6963
7518
|
constructor(defaults) {
|
|
6964
7519
|
this.defaults = defaults;
|
|
6965
7520
|
this._config = { ...defaults };
|
|
@@ -6995,8 +7550,18 @@ var BaseAddon = class {
|
|
|
6995
7550
|
return this._config;
|
|
6996
7551
|
}
|
|
6997
7552
|
async initialize(context) {
|
|
6998
|
-
|
|
7553
|
+
const secrets = context.secrets;
|
|
7554
|
+
this._ctx = secrets !== void 0 ? withSecretAwareSettings(context, {
|
|
7555
|
+
secrets,
|
|
7556
|
+
addonTree: () => this.addonSecretTree(),
|
|
7557
|
+
deviceTree: () => this.deviceSecretTree(),
|
|
7558
|
+
onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
|
|
7559
|
+
isOperatorWrite: () => this._operatorWriteDepth > 0
|
|
7560
|
+
}) : context;
|
|
6999
7561
|
await this.resolveConfig();
|
|
7562
|
+
if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
|
|
7563
|
+
if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
|
|
7564
|
+
});
|
|
7000
7565
|
const result = await this.onInitialize();
|
|
7001
7566
|
this.emitLifecycle(EventCategory.AddonStarted);
|
|
7002
7567
|
const normalized = normalizeAddonInitResult(result);
|
|
@@ -7029,6 +7594,12 @@ var BaseAddon = class {
|
|
|
7029
7594
|
*/
|
|
7030
7595
|
async onHubReachable() {}
|
|
7031
7596
|
async shutdown() {
|
|
7597
|
+
this._secretChangeUnsub?.();
|
|
7598
|
+
this._secretChangeUnsub = null;
|
|
7599
|
+
if (this._secretRetryTimer !== null) clearTimeout(this._secretRetryTimer);
|
|
7600
|
+
if (this._secretChangeTimer !== null) clearTimeout(this._secretChangeTimer);
|
|
7601
|
+
this._secretRetryTimer = null;
|
|
7602
|
+
this._secretChangeTimer = null;
|
|
7032
7603
|
this.emitLifecycle(EventCategory.AddonStopped);
|
|
7033
7604
|
if (this.autoEmitReadiness) this.emitReadinessForProviders("down");
|
|
7034
7605
|
await this.onShutdown();
|
|
@@ -7107,7 +7678,7 @@ var BaseAddon = class {
|
|
|
7107
7678
|
return hydrateSchema(schema, overlay ? {
|
|
7108
7679
|
...projected,
|
|
7109
7680
|
...overlay
|
|
7110
|
-
} : projected);
|
|
7681
|
+
} : projected, { inlineSecretsAsViews: true });
|
|
7111
7682
|
}
|
|
7112
7683
|
/**
|
|
7113
7684
|
* The integration-level view of this addon's settings: exactly the sections
|
|
@@ -7156,7 +7727,7 @@ var BaseAddon = class {
|
|
|
7156
7727
|
return hydrateSchema({
|
|
7157
7728
|
...schema,
|
|
7158
7729
|
sections
|
|
7159
|
-
}, projected);
|
|
7730
|
+
}, projected, { inlineSecretsAsViews: true });
|
|
7160
7731
|
}
|
|
7161
7732
|
/**
|
|
7162
7733
|
* The raw addon store PROJECTED onto the target node's bare per-node keys:
|
|
@@ -7210,18 +7781,50 @@ var BaseAddon = class {
|
|
|
7210
7781
|
value: result.value[key]
|
|
7211
7782
|
};
|
|
7212
7783
|
}
|
|
7784
|
+
/**
|
|
7785
|
+
* The OPERATOR's write — a settings form or an admin API call, dispatched by
|
|
7786
|
+
* the kernel. Identical to {@link updateGlobalSettings}, except that a secret
|
|
7787
|
+
* the operator sends is stored as sent even when it equals a pre-keychain
|
|
7788
|
+
* inline value: the operator re-entering a password is a change, an addon
|
|
7789
|
+
* writing back what it read is not (D787).
|
|
7790
|
+
*/
|
|
7791
|
+
async updateGlobalSettingsAsOperator(patch, nodeId) {
|
|
7792
|
+
this._operatorWriteDepth++;
|
|
7793
|
+
try {
|
|
7794
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
7795
|
+
} finally {
|
|
7796
|
+
this._operatorWriteDepth--;
|
|
7797
|
+
}
|
|
7798
|
+
}
|
|
7213
7799
|
async updateGlobalSettings(patch, nodeId) {
|
|
7800
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
7801
|
+
}
|
|
7802
|
+
/**
|
|
7803
|
+
* REMOVE stored secrets — their keychain values and their markers (D787).
|
|
7804
|
+
*
|
|
7805
|
+
* Writing `''` to a secret field KEEPS what is stored (an empty string is
|
|
7806
|
+
* what a defaults fallback writes back, and it must never destroy a
|
|
7807
|
+
* credential), so code that means "forget this token" says so here. Without
|
|
7808
|
+
* a keychain (an older kernel) it writes `''`, as such code always did.
|
|
7809
|
+
*/
|
|
7810
|
+
async clearSecrets(keys, nodeId) {
|
|
7811
|
+
const tree = this.addonSecretTree();
|
|
7812
|
+
const keychain = this._ctx?.secrets !== void 0;
|
|
7813
|
+
const patch = {};
|
|
7814
|
+
for (const key of keys) patch[key] = keychain && tree.has(key) ? SECRET_CLEAR : "";
|
|
7815
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
7816
|
+
}
|
|
7817
|
+
async applyGlobalPatch(barePatch, nodeId) {
|
|
7214
7818
|
const keys = this.perNodeKeys();
|
|
7215
7819
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
7216
7820
|
const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
7217
|
-
const barePatch = patch;
|
|
7218
7821
|
const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
|
|
7219
7822
|
await this._ctx?.settings?.writeAddonStore(scoped);
|
|
7220
7823
|
if (target !== localNode) return;
|
|
7221
7824
|
await this.resolveConfig();
|
|
7222
7825
|
await this.onConfigChanged();
|
|
7223
7826
|
this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
|
|
7224
|
-
this.maybeAutoRestart(
|
|
7827
|
+
this.maybeAutoRestart(Object.keys(barePatch), this.globalSettingsSchema());
|
|
7225
7828
|
}
|
|
7226
7829
|
/**
|
|
7227
7830
|
* The set of field keys the global settings schema declares `perNode: true`
|
|
@@ -7246,7 +7849,7 @@ var BaseAddon = class {
|
|
|
7246
7849
|
* time to return its response before the addon is torn down and
|
|
7247
7850
|
* re-initialised by `AddonRegistryService.restartAddon`.
|
|
7248
7851
|
*/
|
|
7249
|
-
maybeAutoRestart(
|
|
7852
|
+
maybeAutoRestart(patchKeys, schema) {
|
|
7250
7853
|
if (!schema) return;
|
|
7251
7854
|
const restartKeys = /* @__PURE__ */ new Set();
|
|
7252
7855
|
for (const section of schema.sections) for (const field of section.fields) {
|
|
@@ -7254,13 +7857,13 @@ var BaseAddon = class {
|
|
|
7254
7857
|
if (field.requiresRestart) restartKeys.add(field.key);
|
|
7255
7858
|
}
|
|
7256
7859
|
if (restartKeys.size === 0) return;
|
|
7257
|
-
if (!
|
|
7860
|
+
if (!patchKeys.some((k) => restartKeys.has(k))) return;
|
|
7258
7861
|
const ctx = this._ctx;
|
|
7259
7862
|
if (!ctx) return;
|
|
7260
7863
|
const addonId = ctx.id;
|
|
7261
7864
|
setImmediate(() => {
|
|
7262
7865
|
ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
|
|
7263
|
-
ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields:
|
|
7866
|
+
ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
|
|
7264
7867
|
}).catch((err) => {
|
|
7265
7868
|
ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
7266
7869
|
});
|
|
@@ -7269,7 +7872,7 @@ var BaseAddon = class {
|
|
|
7269
7872
|
async getDeviceSettings(deviceId) {
|
|
7270
7873
|
const schema = this.deviceSettingsSchema();
|
|
7271
7874
|
if (!schema) return { sections: [] };
|
|
7272
|
-
return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {});
|
|
7875
|
+
return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
|
|
7273
7876
|
}
|
|
7274
7877
|
async updateDeviceSettings(deviceId, patch) {
|
|
7275
7878
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
@@ -7399,7 +8002,7 @@ var BaseAddon = class {
|
|
|
7399
8002
|
* selection at boot (absent scoped key ⇒ the constructor default wins).
|
|
7400
8003
|
*/
|
|
7401
8004
|
async resolveConfig() {
|
|
7402
|
-
const stored = await this.readAddonStoreWithRetry();
|
|
8005
|
+
const stored = await this.resolveStoredSecrets(await this.readAddonStoreWithRetry());
|
|
7403
8006
|
const perNode = this.perNodeKeys();
|
|
7404
8007
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
7405
8008
|
const resolved = { ...this.defaults };
|
|
@@ -7424,7 +8027,7 @@ var BaseAddon = class {
|
|
|
7424
8027
|
key,
|
|
7425
8028
|
schema,
|
|
7426
8029
|
fallback,
|
|
7427
|
-
read: () => this.readAddonStoreWithRetry(),
|
|
8030
|
+
read: async () => this.resolveStoredSecrets(await this.readAddonStoreWithRetry()),
|
|
7428
8031
|
write: async (patch) => {
|
|
7429
8032
|
await this._ctx?.settings?.writeAddonStore(patch);
|
|
7430
8033
|
},
|
|
@@ -7441,7 +8044,7 @@ var BaseAddon = class {
|
|
|
7441
8044
|
key,
|
|
7442
8045
|
schema,
|
|
7443
8046
|
fallback,
|
|
7444
|
-
read: async () => await this._ctx?.settings?.readDeviceStore(deviceId) ?? {},
|
|
8047
|
+
read: async () => this.resolveStoredSecrets(await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, false),
|
|
7445
8048
|
write: async (patch) => {
|
|
7446
8049
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
7447
8050
|
},
|
|
@@ -7453,6 +8056,70 @@ var BaseAddon = class {
|
|
|
7453
8056
|
} })
|
|
7454
8057
|
});
|
|
7455
8058
|
}
|
|
8059
|
+
/** The addon store's secret tree: schema fields by TYPE, plus `secretStatePaths`. */
|
|
8060
|
+
addonSecretTree() {
|
|
8061
|
+
this._addonSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.globalSettingsSchema()), this.secretStatePaths);
|
|
8062
|
+
return this._addonSecretTree;
|
|
8063
|
+
}
|
|
8064
|
+
deviceSecretTree() {
|
|
8065
|
+
this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
|
|
8066
|
+
return this._deviceSecretTree;
|
|
8067
|
+
}
|
|
8068
|
+
/**
|
|
8069
|
+
* Secrets of this addon's stored config that could not be resolved on the
|
|
8070
|
+
* last read, with why. Non-empty means the addon is running WITHOUT them —
|
|
8071
|
+
* an addon whose function needs one should report itself degraded rather
|
|
8072
|
+
* than start on an empty credential.
|
|
8073
|
+
*/
|
|
8074
|
+
get unresolvedSecrets() {
|
|
8075
|
+
return this._unresolvedSecrets;
|
|
8076
|
+
}
|
|
8077
|
+
/**
|
|
8078
|
+
* Substitute every keychain marker in a stored blob with its value. With no
|
|
8079
|
+
* keychain (no `ctx.secrets`) or no marker, the blob comes back unchanged.
|
|
8080
|
+
* An unresolvable value is LEFT OUT (never `''`), logged by ref — never by
|
|
8081
|
+
* value — and, when the cause can pass, retried with backoff. Nothing is
|
|
8082
|
+
* ever written back from here.
|
|
8083
|
+
*/
|
|
8084
|
+
async resolveStoredSecrets(blob, trackForConfig = true) {
|
|
8085
|
+
const secrets = this._ctx?.secrets;
|
|
8086
|
+
if (secrets === void 0) return blob;
|
|
8087
|
+
const refs = collectSecretMarkerRefs(blob);
|
|
8088
|
+
if (trackForConfig) this._configSecretRefs = new Set(refs);
|
|
8089
|
+
if (refs.length === 0) {
|
|
8090
|
+
if (trackForConfig) this._unresolvedSecrets = [];
|
|
8091
|
+
return blob;
|
|
8092
|
+
}
|
|
8093
|
+
const { value, unresolved } = await resolveSecretMarkers(blob, secrets);
|
|
8094
|
+
if (trackForConfig) {
|
|
8095
|
+
this._unresolvedSecrets = unresolved;
|
|
8096
|
+
if (unresolved.length > 0) {
|
|
8097
|
+
this._ctx?.logger?.error?.("secret unavailable — running without it, will retry", { meta: { secrets: unresolved.map((u) => ({
|
|
8098
|
+
ref: u.ref,
|
|
8099
|
+
reason: u.reason
|
|
8100
|
+
})) } });
|
|
8101
|
+
if (unresolved.some((u) => u.reason !== "missing" && u.reason !== "forbidden")) {
|
|
8102
|
+
this.scheduleSecretReresolve(this._secretRetryDelayMs);
|
|
8103
|
+
this._secretRetryDelayMs = Math.min(this._secretRetryDelayMs * 2, SECRET_RETRY_MAX_MS);
|
|
8104
|
+
}
|
|
8105
|
+
} else this._secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
|
|
8106
|
+
}
|
|
8107
|
+
return value;
|
|
8108
|
+
}
|
|
8109
|
+
/** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
|
|
8110
|
+
scheduleSecretReresolve(delayMs) {
|
|
8111
|
+
const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
|
|
8112
|
+
if (this[timerOf] !== null) return;
|
|
8113
|
+
const timer = setTimeout(() => {
|
|
8114
|
+
this[timerOf] = null;
|
|
8115
|
+
if (this._ctx === null) return;
|
|
8116
|
+
this.resolveConfig().then(() => this.onConfigChanged()).catch((err) => {
|
|
8117
|
+
this._ctx?.logger?.error?.("re-resolving secrets failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
8118
|
+
});
|
|
8119
|
+
}, delayMs);
|
|
8120
|
+
timer.unref?.();
|
|
8121
|
+
this[timerOf] = timer;
|
|
8122
|
+
}
|
|
7456
8123
|
/**
|
|
7457
8124
|
* Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
|
|
7458
8125
|
* transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
|
|
@@ -8028,6 +8695,69 @@ method(object({ deviceId: number() }), array(StreamSourceEntrySchema)), method(o
|
|
|
8028
8695
|
kind: "mutation",
|
|
8029
8696
|
auth: "admin"
|
|
8030
8697
|
}), method(object({ deviceId: number() }), unknown().nullable()), method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" });
|
|
8698
|
+
function defOf(schema) {
|
|
8699
|
+
return schema._zod?.def ?? {};
|
|
8700
|
+
}
|
|
8701
|
+
function declaredHere(schema) {
|
|
8702
|
+
return globalRegistry.get(schema)?.secret === true;
|
|
8703
|
+
}
|
|
8704
|
+
/** Wrapper kinds whose `innerType` is the field itself. */
|
|
8705
|
+
var WRAPPERS = new Set([
|
|
8706
|
+
"optional",
|
|
8707
|
+
"nullable",
|
|
8708
|
+
"default",
|
|
8709
|
+
"prefault",
|
|
8710
|
+
"catch",
|
|
8711
|
+
"readonly",
|
|
8712
|
+
"nonoptional"
|
|
8713
|
+
]);
|
|
8714
|
+
/**
|
|
8715
|
+
* The schema layers that make up ONE field: the schema itself and every
|
|
8716
|
+
* wrapper below it (optional / default / nullable / readonly / catch), plus
|
|
8717
|
+
* both sides of a pipe (`z.preprocess` puts the real schema on `out`,
|
|
8718
|
+
* `.transform` on `in`).
|
|
8719
|
+
*/
|
|
8720
|
+
function layersOf(schema) {
|
|
8721
|
+
const out = [];
|
|
8722
|
+
const queue = [schema];
|
|
8723
|
+
while (queue.length > 0) {
|
|
8724
|
+
const s = queue.shift();
|
|
8725
|
+
if (!s || out.includes(s)) continue;
|
|
8726
|
+
out.push(s);
|
|
8727
|
+
const def = defOf(s);
|
|
8728
|
+
if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
|
|
8729
|
+
if (def.type === "pipe") {
|
|
8730
|
+
if (def.in) queue.push(def.in);
|
|
8731
|
+
if (def.out) queue.push(def.out);
|
|
8732
|
+
}
|
|
8733
|
+
}
|
|
8734
|
+
return out;
|
|
8735
|
+
}
|
|
8736
|
+
/** True when any layer of this field declares `.meta({ secret: true })`. */
|
|
8737
|
+
function isZodSecret(schema) {
|
|
8738
|
+
return layersOf(schema).some(declaredHere);
|
|
8739
|
+
}
|
|
8740
|
+
/**
|
|
8741
|
+
* Every declared secret path in a config schema: dotted keys, `[]` for "each
|
|
8742
|
+
* element of this array" (`connection.password`, `rows[].token`). A declared
|
|
8743
|
+
* object or array is reported as one path and not descended into — everything
|
|
8744
|
+
* under it is secret.
|
|
8745
|
+
*/
|
|
8746
|
+
function collectZodSecretPaths(schema, prefix = "") {
|
|
8747
|
+
if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
|
|
8748
|
+
const paths = [];
|
|
8749
|
+
for (const layer of layersOf(schema)) {
|
|
8750
|
+
const def = defOf(layer);
|
|
8751
|
+
if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
|
|
8752
|
+
else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
|
|
8753
|
+
else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
|
|
8754
|
+
else if (def.type === "intersection") {
|
|
8755
|
+
if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
|
|
8756
|
+
if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
|
|
8757
|
+
}
|
|
8758
|
+
}
|
|
8759
|
+
return [...new Set(paths)];
|
|
8760
|
+
}
|
|
8031
8761
|
//#endregion
|
|
8032
8762
|
//#region ../types/dist/err-msg-DX6i_MY4.mjs
|
|
8033
8763
|
var DeviceType = /* @__PURE__ */ function(DeviceType) {
|
|
@@ -15058,6 +15788,196 @@ id: union([string(), number()]) }), {
|
|
|
15058
15788
|
kind: "mutation",
|
|
15059
15789
|
auth: "admin"
|
|
15060
15790
|
});
|
|
15791
|
+
/**
|
|
15792
|
+
* `keychain` — the hub's encrypted store of secret values (D787).
|
|
15793
|
+
*
|
|
15794
|
+
* Settings blobs never hold a secret: they hold a marker
|
|
15795
|
+
* `{"$secret":"secret://<owner>/<scope>/<fieldPath>","v":1}` and the value
|
|
15796
|
+
* lives here, AES-256-GCM under a data key that a master key wraps. This cap
|
|
15797
|
+
* is the OWNER's door to its own values: every method is owner-checked
|
|
15798
|
+
* against the CALLER, never against anything the caller claims.
|
|
15799
|
+
*
|
|
15800
|
+
* Who the caller is: the transport stamps `callerAddonId` into the args of a
|
|
15801
|
+
* call that crossed a process (the parent `LocalChildRegistry` from the UDS
|
|
15802
|
+
* connection, the agent from its child's connection carried in
|
|
15803
|
+
* `$hub-cap-fwd`'s envelope). A stamp always overwrites; a wire call with no
|
|
15804
|
+
* stamp has its claim stripped. Only a hub in-process caller may state its own
|
|
15805
|
+
* identity — `ctx.secrets` does that with the addon id closed over. This is
|
|
15806
|
+
* identity against BUGS and misrouting, not against a malicious addon (every
|
|
15807
|
+
* runner is the same OS user): see the threat model in
|
|
15808
|
+
* `docs/design/2026-10-08-secrets-keychain.md`.
|
|
15809
|
+
*
|
|
15810
|
+
* `callerAddonId` is deliberately NOT in any input schema: the tRPC router
|
|
15811
|
+
* parses the input, so a session can never supply it, and the internal mount
|
|
15812
|
+
* floors every method to admin anyway (D240).
|
|
15813
|
+
*
|
|
15814
|
+
* Internal: addons reach it through `ctx.secrets`, never directly.
|
|
15815
|
+
*/
|
|
15816
|
+
/** Why a value cannot be served right now. Never folded into "missing". */
|
|
15817
|
+
var KeychainUnavailableReasonSchema = _enum([
|
|
15818
|
+
"key-missing",
|
|
15819
|
+
"wrong-key",
|
|
15820
|
+
"key-file-unreadable",
|
|
15821
|
+
"store-unavailable",
|
|
15822
|
+
"not-initialized",
|
|
15823
|
+
"decrypt-failed"
|
|
15824
|
+
]);
|
|
15825
|
+
var KeychainStateSchema = discriminatedUnion("state", [object({ state: literal("ready") }), object({
|
|
15826
|
+
state: literal("locked"),
|
|
15827
|
+
reason: KeychainUnavailableReasonSchema
|
|
15828
|
+
})]);
|
|
15829
|
+
var KeychainResolveEntrySchema = discriminatedUnion("kind", [
|
|
15830
|
+
object({
|
|
15831
|
+
kind: literal("value"),
|
|
15832
|
+
value: string(),
|
|
15833
|
+
version: number().int()
|
|
15834
|
+
}),
|
|
15835
|
+
object({ kind: literal("missing") }),
|
|
15836
|
+
object({
|
|
15837
|
+
kind: literal("unavailable"),
|
|
15838
|
+
reason: KeychainUnavailableReasonSchema
|
|
15839
|
+
}),
|
|
15840
|
+
object({ kind: literal("forbidden") })
|
|
15841
|
+
]);
|
|
15842
|
+
var KeychainResolveResultSchema = record(string(), KeychainResolveEntrySchema);
|
|
15843
|
+
/** Metadata of one stored value — never the value. */
|
|
15844
|
+
var KeychainSecretMetaSchema = object({
|
|
15845
|
+
ref: string(),
|
|
15846
|
+
owner: string(),
|
|
15847
|
+
/** Formatted scope (`global`, `node/<id>`, `device/<id>`, …). */
|
|
15848
|
+
scope: string(),
|
|
15849
|
+
fieldPath: string(),
|
|
15850
|
+
version: number().int(),
|
|
15851
|
+
createdAt: number(),
|
|
15852
|
+
updatedAt: number(),
|
|
15853
|
+
/** `addon:<id>` | `user:<id>` | `system`. */
|
|
15854
|
+
updatedBy: string(),
|
|
15855
|
+
/** Coarse — written at most once an hour per ref. `null` = never read. */
|
|
15856
|
+
lastReadAt: number().nullable()
|
|
15857
|
+
});
|
|
15858
|
+
var RefListSchema = array(string().min(1)).max(512);
|
|
15859
|
+
method(object({
|
|
15860
|
+
ref: string().min(1),
|
|
15861
|
+
value: string().min(1)
|
|
15862
|
+
}), object({
|
|
15863
|
+
ref: string(),
|
|
15864
|
+
version: number().int()
|
|
15865
|
+
}), {
|
|
15866
|
+
kind: "mutation",
|
|
15867
|
+
auth: "admin"
|
|
15868
|
+
}), method(object({ refs: RefListSchema }), KeychainResolveResultSchema, { auth: "admin" }), method(object({ refs: RefListSchema }), object({ deleted: number().int() }), {
|
|
15869
|
+
kind: "mutation",
|
|
15870
|
+
auth: "admin"
|
|
15871
|
+
}), method(object({}), array(KeychainSecretMetaSchema).readonly(), { auth: "admin" }), method(object({}), KeychainStateSchema, { auth: "admin" });
|
|
15872
|
+
var KeychainKeySourceSchema = object({
|
|
15873
|
+
kind: _enum([
|
|
15874
|
+
"config-file",
|
|
15875
|
+
"previous-config-file",
|
|
15876
|
+
"platform",
|
|
15877
|
+
"default-file"
|
|
15878
|
+
]),
|
|
15879
|
+
/** File sources only — a path is not a secret. */
|
|
15880
|
+
path: string().optional(),
|
|
15881
|
+
/**
|
|
15882
|
+
* True when a whole-volume backup of the data directory carries this key
|
|
15883
|
+
* next to the database it protects (the default file). The page warns.
|
|
15884
|
+
*/
|
|
15885
|
+
sharesBackupWithDatabase: boolean()
|
|
15886
|
+
});
|
|
15887
|
+
var KeychainStatusSchema = object({
|
|
15888
|
+
keychain: KeychainStateSchema,
|
|
15889
|
+
/** The source of the master key in use; `null` while locked. */
|
|
15890
|
+
keySource: KeychainKeySourceSchema.nullable(),
|
|
15891
|
+
/** The source configured to be primary — differs from `keySource` while a rotation is pending. */
|
|
15892
|
+
configuredSource: KeychainKeySourceSchema,
|
|
15893
|
+
/** Short fingerprint of the master key in use (`HMAC(KEK, label)`, 16 hex). */
|
|
15894
|
+
fingerprint: string().nullable(),
|
|
15895
|
+
activeKeyId: string().nullable(),
|
|
15896
|
+
/**
|
|
15897
|
+
* The keychain unlocked with a NON-primary source: the configured primary
|
|
15898
|
+
* key is not the one that wraps the data key yet. `rotateMasterKey` moves it.
|
|
15899
|
+
*/
|
|
15900
|
+
rotationPending: boolean(),
|
|
15901
|
+
/** Wrapped copies of the data key under a previous master key, kept until purged. */
|
|
15902
|
+
retiredWraps: number().int(),
|
|
15903
|
+
recoveryKeyDownloadedAt: number().nullable(),
|
|
15904
|
+
secretCount: number().int()
|
|
15905
|
+
});
|
|
15906
|
+
/**
|
|
15907
|
+
* Whether a stored value is still pointed at by its owner's settings.
|
|
15908
|
+
* `unknown` is a first-class answer: a scope whose blob could not be read is
|
|
15909
|
+
* never reported as an orphan (and never deleted as one).
|
|
15910
|
+
*/
|
|
15911
|
+
var KeychainSecretUsageSchema = _enum([
|
|
15912
|
+
"in-use",
|
|
15913
|
+
"orphan",
|
|
15914
|
+
"unknown"
|
|
15915
|
+
]);
|
|
15916
|
+
var KeychainAdminSecretSchema = KeychainSecretMetaSchema.extend({ usage: KeychainSecretUsageSchema });
|
|
15917
|
+
var KeychainAuditActionSchema = _enum([
|
|
15918
|
+
"put",
|
|
15919
|
+
"delete",
|
|
15920
|
+
"reveal",
|
|
15921
|
+
"rotate-master-key",
|
|
15922
|
+
"purge-retired-keys",
|
|
15923
|
+
"download-recovery-key",
|
|
15924
|
+
"delete-orphans",
|
|
15925
|
+
"reset",
|
|
15926
|
+
"initialize"
|
|
15927
|
+
]);
|
|
15928
|
+
var KeychainAuditEntrySchema = object({
|
|
15929
|
+
id: string(),
|
|
15930
|
+
at: number(),
|
|
15931
|
+
action: KeychainAuditActionSchema,
|
|
15932
|
+
/** `addon:<id>` | `user:<id>` | `system`. */
|
|
15933
|
+
actor: string(),
|
|
15934
|
+
ref: string().nullable(),
|
|
15935
|
+
detail: string().nullable()
|
|
15936
|
+
});
|
|
15937
|
+
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({
|
|
15938
|
+
value: string(),
|
|
15939
|
+
version: number().int()
|
|
15940
|
+
}), {
|
|
15941
|
+
kind: "mutation",
|
|
15942
|
+
auth: "admin",
|
|
15943
|
+
caller: "required"
|
|
15944
|
+
}), method(object({ refs: array(string().min(1)).max(1e3) }), object({
|
|
15945
|
+
deleted: array(string()).readonly(),
|
|
15946
|
+
kept: array(object({
|
|
15947
|
+
ref: string(),
|
|
15948
|
+
usage: KeychainSecretUsageSchema
|
|
15949
|
+
})).readonly()
|
|
15950
|
+
}), {
|
|
15951
|
+
kind: "mutation",
|
|
15952
|
+
auth: "admin",
|
|
15953
|
+
caller: "required"
|
|
15954
|
+
}), method(object({}), object({
|
|
15955
|
+
fingerprint: string(),
|
|
15956
|
+
keySource: KeychainKeySourceSchema
|
|
15957
|
+
}), {
|
|
15958
|
+
kind: "mutation",
|
|
15959
|
+
auth: "admin",
|
|
15960
|
+
caller: "required"
|
|
15961
|
+
}), method(object({}), object({ purged: number().int() }), {
|
|
15962
|
+
kind: "mutation",
|
|
15963
|
+
auth: "admin",
|
|
15964
|
+
caller: "required"
|
|
15965
|
+
}), method(object({}), object({
|
|
15966
|
+
key: string(),
|
|
15967
|
+
fingerprint: string(),
|
|
15968
|
+
keySource: KeychainKeySourceSchema
|
|
15969
|
+
}), {
|
|
15970
|
+
kind: "mutation",
|
|
15971
|
+
auth: "admin",
|
|
15972
|
+
caller: "required"
|
|
15973
|
+
}), method(object({ confirm: literal("RESET KEYCHAIN") }), object({
|
|
15974
|
+
archivedCollection: string().nullable(),
|
|
15975
|
+
archived: number().int()
|
|
15976
|
+
}), {
|
|
15977
|
+
kind: "mutation",
|
|
15978
|
+
auth: "admin",
|
|
15979
|
+
caller: "required"
|
|
15980
|
+
});
|
|
15061
15981
|
method(_void(), object({
|
|
15062
15982
|
id: string(),
|
|
15063
15983
|
name: string(),
|
|
@@ -16176,6 +17096,10 @@ var DeviceInfoSchema = object({
|
|
|
16176
17096
|
isCamera: boolean(),
|
|
16177
17097
|
/** Current config values — serializable snapshot */
|
|
16178
17098
|
config: record(string(), unknown()),
|
|
17099
|
+
/** Paths inside `config` the device's schema declares secret (D783) —
|
|
17100
|
+
* what the non-admin redaction withholds. Paths, never values. Absent
|
|
17101
|
+
* when the owning runner has not reported them. */
|
|
17102
|
+
secretConfigPaths: array(string()).optional(),
|
|
16179
17103
|
/** Hardware + identity blob (manufacturer / model / firmware / sn /
|
|
16180
17104
|
* uid / mac / …). Populated by drivers; editable via setMetadata. */
|
|
16181
17105
|
metadata: record(string(), unknown()).nullable().optional(),
|
|
@@ -16381,12 +17305,22 @@ var DeviceRegisterPayloadSchema = object({
|
|
|
16381
17305
|
* call (workers re-register on init), so probe-driven updates
|
|
16382
17306
|
* (e.g. PTZ flag flipping after the abilities probe) propagate. */
|
|
16383
17307
|
features: array(string()).optional(),
|
|
16384
|
-
config: record(string(), unknown())
|
|
17308
|
+
config: record(string(), unknown()),
|
|
17309
|
+
/** Config paths the device's own schema DECLARES secret
|
|
17310
|
+
* (`.meta({ secret: true })` — dotted, `[]` for array items, e.g.
|
|
17311
|
+
* `connection.password`). Re-published on every register; the non-admin
|
|
17312
|
+
* redaction withholds them at any depth (D783). Optional: an older runner
|
|
17313
|
+
* omits it and the keyword backstop applies. */
|
|
17314
|
+
secretConfigPaths: array(string()).optional()
|
|
16385
17315
|
});
|
|
16386
17316
|
var DeviceRemovePayloadSchema = object({ deviceId: number() });
|
|
16387
17317
|
var DevicePersistConfigPayloadSchema = object({
|
|
16388
17318
|
deviceId: number(),
|
|
16389
|
-
data: record(string(), unknown())
|
|
17319
|
+
data: record(string(), unknown()),
|
|
17320
|
+
/** The paths the device's schema declares secret (D783), when the caller
|
|
17321
|
+
* knows them — those values are kept in the keychain, not the blob (D787).
|
|
17322
|
+
* Absent: the paths the device last reported at `registerDevice` apply. */
|
|
17323
|
+
secretConfigPaths: array(string()).optional()
|
|
16390
17324
|
});
|
|
16391
17325
|
/** What a migration actually did, per switch. `unreachable` is a first-class
|
|
16392
17326
|
* answer: a camera that could not be asked is not a camera that was silenced. */
|
|
@@ -18040,7 +18974,14 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
|
18040
18974
|
icon: string().optional(),
|
|
18041
18975
|
/** Addon-owned HTTP route the button navigates to (GET). */
|
|
18042
18976
|
startUrl: string(),
|
|
18043
|
-
stage: LoginStageEnum
|
|
18977
|
+
stage: LoginStageEnum,
|
|
18978
|
+
/**
|
|
18979
|
+
* The provider names an external identity a signed-in user can link to
|
|
18980
|
+
* their own account (D782): `auth.listLinkableProviders` /
|
|
18981
|
+
* `beginExternalLink` offer exactly the redirect methods that set this,
|
|
18982
|
+
* whatever their id. Absent / false — a login button only (magic-link).
|
|
18983
|
+
*/
|
|
18984
|
+
linkable: boolean().optional()
|
|
18044
18985
|
}),
|
|
18045
18986
|
object({
|
|
18046
18987
|
kind: literal("widget"),
|
|
@@ -23396,8 +24337,23 @@ var RetrainMacroClassSchema = _enum([
|
|
|
23396
24337
|
]);
|
|
23397
24338
|
/** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
|
|
23398
24339
|
var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
|
|
23399
|
-
/**
|
|
23400
|
-
|
|
24340
|
+
/**
|
|
24341
|
+
* Where a box came from. A machine-sourced box is a DRAFT on the page until
|
|
24342
|
+
* the operator confirms it; once saved it keeps its source as provenance.
|
|
24343
|
+
*
|
|
24344
|
+
* - `operator` — drawn by hand.
|
|
24345
|
+
* - `assist` — proposed by a detector run on the copy (the camera's own
|
|
24346
|
+
* model, or a larger teacher model).
|
|
24347
|
+
* - `pipeline` — the box the live pipeline actually drew on that frame, read
|
|
24348
|
+
* back from the track store (never a re-run).
|
|
24349
|
+
* - `llm` — proposed by a vision-capable LLM profile.
|
|
24350
|
+
*/
|
|
24351
|
+
var RetrainAnnotationSourceSchema = _enum([
|
|
24352
|
+
"operator",
|
|
24353
|
+
"assist",
|
|
24354
|
+
"pipeline",
|
|
24355
|
+
"llm"
|
|
24356
|
+
]);
|
|
23401
24357
|
/** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
|
|
23402
24358
|
var RetrainBboxSchema = object({
|
|
23403
24359
|
x: number(),
|
|
@@ -23415,7 +24371,8 @@ var RetrainBboxSchema = object({
|
|
|
23415
24371
|
*/
|
|
23416
24372
|
var RetrainAnnotationSchema = object({
|
|
23417
24373
|
id: string(),
|
|
23418
|
-
|
|
24374
|
+
/** The frame's track. Absent on a recording still, which has none. */
|
|
24375
|
+
trackId: string().optional(),
|
|
23419
24376
|
deviceId: number(),
|
|
23420
24377
|
/** The COPY in retrain storage — never the source track's media key. */
|
|
23421
24378
|
mediaKey: string(),
|
|
@@ -23464,18 +24421,63 @@ var RetrainFrameCandidateSchema = object({
|
|
|
23464
24421
|
* fail, whatever became of the original. */
|
|
23465
24422
|
copied: boolean()
|
|
23466
24423
|
});
|
|
24424
|
+
/**
|
|
24425
|
+
* One box the live pipeline drew on a copied frame — what a correction starts
|
|
24426
|
+
* from. Derived when the frame is listed, from the track store: the subject
|
|
24427
|
+
* box recorded on the source media row when there is one, else the track
|
|
24428
|
+
* position nearest the frame's capture time. Never stored as an annotation
|
|
24429
|
+
* until the operator confirms it.
|
|
24430
|
+
*/
|
|
24431
|
+
var RetrainPipelineBoxSchema = object({
|
|
24432
|
+
/** Normalised `[0,1]` against the full frame. */
|
|
24433
|
+
bbox: RetrainBboxSchema,
|
|
24434
|
+
macroClass: RetrainMacroClassSchema,
|
|
24435
|
+
label: string().optional(),
|
|
24436
|
+
subLabel: string().optional(),
|
|
24437
|
+
/** The detection score of the position used, when it was recorded. */
|
|
24438
|
+
score: number().optional(),
|
|
24439
|
+
/** The root model that produced the track, when it was recorded. */
|
|
24440
|
+
modelId: string().optional(),
|
|
24441
|
+
trackId: string(),
|
|
24442
|
+
/** `subject-box`: recorded on this very frame. `position`: the track's
|
|
24443
|
+
* position nearest the capture time, `deltaMs` away. */
|
|
24444
|
+
basis: _enum(["subject-box", "position"]),
|
|
24445
|
+
deltaMs: number()
|
|
24446
|
+
});
|
|
24447
|
+
/**
|
|
24448
|
+
* Where a retrain frame came from: a TRACK's stored media (copy-on-select),
|
|
24449
|
+
* or the RECORDING at an instant — the frame a model saw nothing in has no
|
|
24450
|
+
* track at all.
|
|
24451
|
+
*/
|
|
24452
|
+
var RetrainFrameOriginSchema = _enum(["track", "recording"]);
|
|
23467
24453
|
/** A frame the dataset OWNS: bytes copied at selection time. */
|
|
23468
24454
|
var RetrainFrameSchema = object({
|
|
23469
24455
|
frameId: string(),
|
|
23470
24456
|
deviceId: number(),
|
|
23471
|
-
|
|
23472
|
-
/**
|
|
23473
|
-
|
|
24457
|
+
origin: RetrainFrameOriginSchema,
|
|
24458
|
+
/** The track it was copied from. Absent on a recording still. */
|
|
24459
|
+
trackId: string().optional(),
|
|
24460
|
+
/** Provenance only. It may already point at nothing — that is expected.
|
|
24461
|
+
* Absent on a recording still. */
|
|
24462
|
+
sourceMediaId: number().int().optional(),
|
|
24463
|
+
/** A recording still: the playhead instant it was taken at. */
|
|
24464
|
+
epochMs: number().optional(),
|
|
23474
24465
|
sourceKind: MediaFileKindEnum,
|
|
23475
24466
|
sizeBytes: number().int(),
|
|
23476
24467
|
width: number().int(),
|
|
23477
24468
|
height: number().int(),
|
|
23478
|
-
copiedAt: number()
|
|
24469
|
+
copiedAt: number(),
|
|
24470
|
+
/** When the CAMERA captured the frame. Absent on a copy taken before D785. */
|
|
24471
|
+
capturedAt: number().optional(),
|
|
24472
|
+
/** The operator's "every subject in this frame is boxed". Detector
|
|
24473
|
+
* evaluation keeps only complete frames: an unboxed subject would count as
|
|
24474
|
+
* a false positive. */
|
|
24475
|
+
complete: boolean(),
|
|
24476
|
+
/** The boxes the pipeline drew on this frame. Present on list answers;
|
|
24477
|
+
* empty when nothing the track store holds can be placed on it. */
|
|
24478
|
+
pipelineBoxes: array(RetrainPipelineBoxSchema).readonly().optional(),
|
|
24479
|
+
/** The named collections this frame belongs to. Present on list answers. */
|
|
24480
|
+
collectionIds: array(string()).readonly().optional()
|
|
23479
24481
|
});
|
|
23480
24482
|
/** Why a copy-on-select could not be honoured — named, never a silent skip. */
|
|
23481
24483
|
var RetrainCopyRefusalSchema = _enum([
|
|
@@ -23496,6 +24498,53 @@ var RetrainFrameListSchema = object({
|
|
|
23496
24498
|
/** What the page pre-selects — the native key frame when one survives. */
|
|
23497
24499
|
autoPickMediaId: number().int().optional()
|
|
23498
24500
|
});
|
|
24501
|
+
/**
|
|
24502
|
+
* Which frames an annotated export carries. Every field narrows; an empty
|
|
24503
|
+
* filter is every annotated copy. A dataset VERSION is a frozen `frameIds`
|
|
24504
|
+
* list owned by whoever trains (the training orchestrator), so `frameIds` is
|
|
24505
|
+
* the primitive a version export uses; `batchId` re-selects what an earlier
|
|
24506
|
+
* export carried (`exportedInBatch`).
|
|
24507
|
+
*/
|
|
24508
|
+
var RetrainExportFilterSchema = object({
|
|
24509
|
+
deviceIds: array(number()).optional(),
|
|
24510
|
+
frameIds: array(string()).max(2e4).optional(),
|
|
24511
|
+
/** Only frames in at least one of these named collections. */
|
|
24512
|
+
collectionIds: array(string()).max(200).optional(),
|
|
24513
|
+
batchId: string().optional(),
|
|
24514
|
+
/** Only frames the operator marked complete (all subjects boxed). */
|
|
24515
|
+
completeOnly: boolean().optional()
|
|
24516
|
+
});
|
|
24517
|
+
/**
|
|
24518
|
+
* `frames`: the full frame copies, boxes in `annotations.json`.
|
|
24519
|
+
* `crops`: additionally one JPEG per subject, cut with the runtime detail-crop
|
|
24520
|
+
* convention — the classifier layout.
|
|
24521
|
+
*/
|
|
24522
|
+
var RetrainExportLayoutSchema = _enum(["frames", "crops"]);
|
|
24523
|
+
/**
|
|
24524
|
+
* Where `writeRetrainArchive` streams the tar: one HTTP request whose body is
|
|
24525
|
+
* the archive, sent chunk by chunk. Covers a presigned PUT and a provider
|
|
24526
|
+
* addon's data-plane upload route alike. Headers are sent verbatim and never
|
|
24527
|
+
* logged.
|
|
24528
|
+
*/
|
|
24529
|
+
var RetrainArchiveTargetSchema = object({
|
|
24530
|
+
kind: literal("http"),
|
|
24531
|
+
method: _enum(["PUT", "POST"]),
|
|
24532
|
+
url: string().url(),
|
|
24533
|
+
headers: record(string(), string()).optional()
|
|
24534
|
+
});
|
|
24535
|
+
var RetrainArchiveResultSchema = object({
|
|
24536
|
+
batchId: string(),
|
|
24537
|
+
frames: number().int(),
|
|
24538
|
+
crops: number().int(),
|
|
24539
|
+
annotations: number().int(),
|
|
24540
|
+
/** Frames planned but not shipped (unreadable copy, path too long). */
|
|
24541
|
+
missing: number().int(),
|
|
24542
|
+
bytes: number().int(),
|
|
24543
|
+
/** sha256 of the exact bytes sent. */
|
|
24544
|
+
sha256: string(),
|
|
24545
|
+
/** The target's HTTP status. */
|
|
24546
|
+
status: number().int()
|
|
24547
|
+
});
|
|
23499
24548
|
/** What the operator asked the assist to look for. */
|
|
23500
24549
|
var RetrainAssistSubjectSchema = discriminatedUnion("kind", [object({
|
|
23501
24550
|
kind: literal("package"),
|
|
@@ -23525,6 +24574,109 @@ var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
|
|
|
23525
24574
|
reason: string(),
|
|
23526
24575
|
detail: string().optional()
|
|
23527
24576
|
})]);
|
|
24577
|
+
/** A named set over the retrain corpus — membership only, it owns no pixels. */
|
|
24578
|
+
var RetrainCollectionSchema = object({
|
|
24579
|
+
id: string(),
|
|
24580
|
+
name: string(),
|
|
24581
|
+
createdAt: number(),
|
|
24582
|
+
frameCount: number().int()
|
|
24583
|
+
});
|
|
24584
|
+
var RetrainCollectionCreateResultSchema = discriminatedUnion("kind", [object({
|
|
24585
|
+
kind: literal("created"),
|
|
24586
|
+
collection: RetrainCollectionSchema
|
|
24587
|
+
}), object({
|
|
24588
|
+
kind: literal("refused"),
|
|
24589
|
+
reason: _enum(["empty-name", "duplicate-name"])
|
|
24590
|
+
})]);
|
|
24591
|
+
var RetrainCollectionRenameResultSchema = discriminatedUnion("kind", [object({
|
|
24592
|
+
kind: literal("renamed"),
|
|
24593
|
+
collection: RetrainCollectionSchema
|
|
24594
|
+
}), object({
|
|
24595
|
+
kind: literal("refused"),
|
|
24596
|
+
reason: _enum([
|
|
24597
|
+
"empty-name",
|
|
24598
|
+
"duplicate-name",
|
|
24599
|
+
"unknown-collection"
|
|
24600
|
+
])
|
|
24601
|
+
})]);
|
|
24602
|
+
/**
|
|
24603
|
+
* The outcome of adding the frame at a recording instant. Every refusal is
|
|
24604
|
+
* named: `still-unavailable` (not recording, a gap, or an undecodable frame —
|
|
24605
|
+
* `detail` says which), `still-busy` (the recorder is at its decode bound; try
|
|
24606
|
+
* again), `unreadable-image`, `write-failed`, `unknown-collection`.
|
|
24607
|
+
*/
|
|
24608
|
+
var AddRetrainFrameFromRecordingResultSchema = discriminatedUnion("kind", [object({
|
|
24609
|
+
kind: literal("added"),
|
|
24610
|
+
collectionId: string(),
|
|
24611
|
+
frame: RetrainFrameSchema,
|
|
24612
|
+
/** The moment was already in the dataset; nothing was decoded. */
|
|
24613
|
+
reused: boolean()
|
|
24614
|
+
}), object({
|
|
24615
|
+
kind: literal("refused"),
|
|
24616
|
+
reason: _enum([
|
|
24617
|
+
"unknown-collection",
|
|
24618
|
+
"still-unavailable",
|
|
24619
|
+
"still-busy",
|
|
24620
|
+
"unreadable-image",
|
|
24621
|
+
"write-failed"
|
|
24622
|
+
]),
|
|
24623
|
+
detail: string().optional()
|
|
24624
|
+
})]);
|
|
24625
|
+
/** A vision LLM profile the AI assist may use, and where it sends the frame. */
|
|
24626
|
+
var RetrainAssistProfileSchema = object({
|
|
24627
|
+
id: string(),
|
|
24628
|
+
name: string(),
|
|
24629
|
+
model: string(),
|
|
24630
|
+
kind: string(),
|
|
24631
|
+
/** `true` when the frame would leave the house (a cloud vendor, or an
|
|
24632
|
+
* endpoint that is not on the local network). The page confirms each such
|
|
24633
|
+
* run, and the provider refuses one without `allowCloud`. */
|
|
24634
|
+
leavesHouse: boolean()
|
|
24635
|
+
});
|
|
24636
|
+
/** A box the AI assist proposed: a draft, plus the model's own reason. */
|
|
24637
|
+
var RetrainLlmProposalSchema = RetrainAnnotationDraftSchema.extend({ reason: string() });
|
|
24638
|
+
/** What the AI assist said about a box that was already on the canvas. */
|
|
24639
|
+
var RetrainLlmReviewSchema = object({
|
|
24640
|
+
/** The `ref` the page sent the box under. */
|
|
24641
|
+
ref: string(),
|
|
24642
|
+
verdict: _enum([
|
|
24643
|
+
"confirmed",
|
|
24644
|
+
"wrong-class",
|
|
24645
|
+
"not-an-object",
|
|
24646
|
+
"uncertain"
|
|
24647
|
+
]),
|
|
24648
|
+
suggestedClass: RetrainMacroClassSchema.optional(),
|
|
24649
|
+
reason: string()
|
|
24650
|
+
});
|
|
24651
|
+
/**
|
|
24652
|
+
* The AI assist's answer. `proposed` carries drafts (`source: 'llm'`, the
|
|
24653
|
+
* model and its confidence) and reviews; items the model got wrong (a box off
|
|
24654
|
+
* the frame, an unasked class, an unknown ref) are dropped and counted in
|
|
24655
|
+
* `rejected`. A whole answer that is not the schema is `malformed-answer`.
|
|
24656
|
+
*/
|
|
24657
|
+
var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
|
|
24658
|
+
kind: literal("proposed"),
|
|
24659
|
+
profileId: string(),
|
|
24660
|
+
model: string(),
|
|
24661
|
+
/** The frame was sent outside the house for this answer. */
|
|
24662
|
+
leftHouse: boolean(),
|
|
24663
|
+
proposals: array(RetrainLlmProposalSchema).readonly(),
|
|
24664
|
+
reviews: array(RetrainLlmReviewSchema).readonly(),
|
|
24665
|
+
rejected: number().int()
|
|
24666
|
+
}), object({
|
|
24667
|
+
kind: literal("refused"),
|
|
24668
|
+
reason: _enum([
|
|
24669
|
+
"unknown-frame",
|
|
24670
|
+
"unreadable-frame",
|
|
24671
|
+
"unknown-profile",
|
|
24672
|
+
"profile-disabled",
|
|
24673
|
+
"no-vision",
|
|
24674
|
+
"cloud-not-confirmed",
|
|
24675
|
+
"llm-error",
|
|
24676
|
+
"malformed-answer"
|
|
24677
|
+
]),
|
|
24678
|
+
detail: string().optional()
|
|
24679
|
+
})]);
|
|
23528
24680
|
/** The outcome of a lifecycle move owned by the retrain page. */
|
|
23529
24681
|
var RetrainTransitionResultSchema = object({
|
|
23530
24682
|
trackId: string(),
|
|
@@ -24242,7 +25394,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
24242
25394
|
auth: "admin"
|
|
24243
25395
|
}), method(object({
|
|
24244
25396
|
deviceId: number(),
|
|
24245
|
-
trackId: string(),
|
|
25397
|
+
trackId: string().optional(),
|
|
24246
25398
|
frameId: string()
|
|
24247
25399
|
}), object({
|
|
24248
25400
|
removed: boolean(),
|
|
@@ -24259,7 +25411,8 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
24259
25411
|
auth: "admin"
|
|
24260
25412
|
}), method(object({
|
|
24261
25413
|
deviceId: number(),
|
|
24262
|
-
|
|
25414
|
+
/** The frame's track, when it has one — checked against the frame. */
|
|
25415
|
+
trackId: string().optional(),
|
|
24263
25416
|
frameId: string(),
|
|
24264
25417
|
subject: RetrainAssistSubjectSchema,
|
|
24265
25418
|
/** Which node runs it. Absent ⇒ wherever an unowned call lands. */
|
|
@@ -24267,12 +25420,16 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
24267
25420
|
}), RetrainAssistResultSchema, {
|
|
24268
25421
|
kind: "mutation",
|
|
24269
25422
|
auth: "admin"
|
|
24270
|
-
}), method(object({
|
|
25423
|
+
}), method(object({
|
|
25424
|
+
trackId: string().optional(),
|
|
25425
|
+
frameIds: array(string()).max(2e3).optional()
|
|
25426
|
+
}), array(RetrainAnnotationSchema).readonly(), {
|
|
24271
25427
|
kind: "query",
|
|
24272
25428
|
auth: "admin"
|
|
24273
25429
|
}), method(object({
|
|
24274
25430
|
deviceId: number(),
|
|
24275
|
-
|
|
25431
|
+
/** The frame's track, when it has one — checked against the frame. */
|
|
25432
|
+
trackId: string().optional(),
|
|
24276
25433
|
frameId: string(),
|
|
24277
25434
|
annotations: array(RetrainAnnotationDraftSchema)
|
|
24278
25435
|
}), array(RetrainAnnotationSchema).readonly(), {
|
|
@@ -24290,7 +25447,91 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
24290
25447
|
}), RetrainTransitionResultSchema, {
|
|
24291
25448
|
kind: "mutation",
|
|
24292
25449
|
auth: "admin"
|
|
24293
|
-
}), method(
|
|
25450
|
+
}), method(RetrainExportFilterSchema.extend({ layout: RetrainExportLayoutSchema.optional() }), object({ url: string() }), {
|
|
25451
|
+
kind: "query",
|
|
25452
|
+
auth: "admin"
|
|
25453
|
+
}), method(object({
|
|
25454
|
+
deviceId: number(),
|
|
25455
|
+
trackId: string().optional(),
|
|
25456
|
+
frameId: string(),
|
|
25457
|
+
complete: boolean()
|
|
25458
|
+
}), RetrainFrameSchema, {
|
|
25459
|
+
kind: "mutation",
|
|
25460
|
+
auth: "admin"
|
|
25461
|
+
}), method(object({
|
|
25462
|
+
filter: RetrainExportFilterSchema,
|
|
25463
|
+
layout: RetrainExportLayoutSchema,
|
|
25464
|
+
target: RetrainArchiveTargetSchema
|
|
25465
|
+
}), RetrainArchiveResultSchema, {
|
|
25466
|
+
kind: "mutation",
|
|
25467
|
+
auth: "admin",
|
|
25468
|
+
timeoutMs: 60 * 6e4
|
|
25469
|
+
}), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
|
|
25470
|
+
kind: "query",
|
|
25471
|
+
auth: "admin"
|
|
25472
|
+
}), method(object({
|
|
25473
|
+
deviceId: number(),
|
|
25474
|
+
trackId: string().optional(),
|
|
25475
|
+
frameId: string(),
|
|
25476
|
+
profileId: string(),
|
|
25477
|
+
classes: array(RetrainMacroClassSchema).min(1),
|
|
25478
|
+
boxes: array(object({
|
|
25479
|
+
ref: string(),
|
|
25480
|
+
bbox: RetrainBboxSchema,
|
|
25481
|
+
macroClass: RetrainMacroClassSchema,
|
|
25482
|
+
label: string().optional()
|
|
25483
|
+
})).max(50),
|
|
25484
|
+
allowCloud: boolean()
|
|
25485
|
+
}), RetrainLlmAssistResultSchema, {
|
|
25486
|
+
kind: "mutation",
|
|
25487
|
+
auth: "admin",
|
|
25488
|
+
timeoutMs: 18e4
|
|
25489
|
+
}), method(object({ name: string().max(120) }), RetrainCollectionCreateResultSchema, {
|
|
25490
|
+
kind: "mutation",
|
|
25491
|
+
auth: "admin"
|
|
25492
|
+
}), method(object({}), array(RetrainCollectionSchema).readonly(), {
|
|
25493
|
+
kind: "query",
|
|
25494
|
+
auth: "admin"
|
|
25495
|
+
}), method(object({
|
|
25496
|
+
id: string(),
|
|
25497
|
+
name: string().max(120)
|
|
25498
|
+
}), RetrainCollectionRenameResultSchema, {
|
|
25499
|
+
kind: "mutation",
|
|
25500
|
+
auth: "admin"
|
|
25501
|
+
}), method(object({ id: string() }), object({
|
|
25502
|
+
deleted: boolean(),
|
|
25503
|
+
removedFrames: number().int()
|
|
25504
|
+
}), {
|
|
25505
|
+
kind: "mutation",
|
|
25506
|
+
auth: "admin"
|
|
25507
|
+
}), method(object({
|
|
25508
|
+
collectionId: string(),
|
|
25509
|
+
deviceId: number(),
|
|
25510
|
+
epochMs: number()
|
|
25511
|
+
}), AddRetrainFrameFromRecordingResultSchema, {
|
|
25512
|
+
kind: "mutation",
|
|
25513
|
+
auth: "admin",
|
|
25514
|
+
timeoutMs: 6e4
|
|
25515
|
+
}), method(object({
|
|
25516
|
+
collectionId: string(),
|
|
25517
|
+
frameIds: array(string()).min(1).max(500)
|
|
25518
|
+
}), object({
|
|
25519
|
+
added: number().int(),
|
|
25520
|
+
alreadyMember: number().int(),
|
|
25521
|
+
unknownFrameIds: array(string()).readonly()
|
|
25522
|
+
}), {
|
|
25523
|
+
kind: "mutation",
|
|
25524
|
+
auth: "admin"
|
|
25525
|
+
}), method(object({
|
|
25526
|
+
collectionId: string(),
|
|
25527
|
+
frameId: string()
|
|
25528
|
+
}), object({
|
|
25529
|
+
removed: boolean(),
|
|
25530
|
+
deletedFrame: boolean()
|
|
25531
|
+
}), {
|
|
25532
|
+
kind: "mutation",
|
|
25533
|
+
auth: "admin"
|
|
25534
|
+
}), method(object({ collectionId: string() }), array(RetrainFrameSchema).readonly(), {
|
|
24294
25535
|
kind: "query",
|
|
24295
25536
|
auth: "admin"
|
|
24296
25537
|
}), method(object({
|
|
@@ -24916,13 +26157,31 @@ var RecommendationReasonSchema = discriminatedUnion("kind", [
|
|
|
24916
26157
|
object({
|
|
24917
26158
|
kind: literal("no-family-build"),
|
|
24918
26159
|
format: ModelFormatSchema$1
|
|
26160
|
+
}),
|
|
26161
|
+
object({
|
|
26162
|
+
kind: literal("kept-custom-pin"),
|
|
26163
|
+
modelId: string(),
|
|
26164
|
+
deviceKey: string()
|
|
24919
26165
|
})
|
|
24920
26166
|
]);
|
|
26167
|
+
/** Why a device is left exactly as it is, whatever the plan would pick (D786). */
|
|
26168
|
+
var KeptReasonSchema = _enum(["custom-pin"]);
|
|
26169
|
+
/**
|
|
26170
|
+
* Where a choice's latency came from (D791): this node's own benchmark
|
|
26171
|
+
* result, or the hardware-class table. Measured on the node beats the table.
|
|
26172
|
+
*/
|
|
26173
|
+
var LatencySourceSchema = discriminatedUnion("kind", [object({ kind: literal("table") }), object({
|
|
26174
|
+
kind: literal("node-benchmark"),
|
|
26175
|
+
resultId: string(),
|
|
26176
|
+
measuredAtMs: number()
|
|
26177
|
+
})]);
|
|
24921
26178
|
var DeviceModelChoiceSchema = object({
|
|
24922
26179
|
modelId: string(),
|
|
24923
26180
|
p50Ms: number(),
|
|
24924
26181
|
fps: number(),
|
|
24925
26182
|
measured: boolean(),
|
|
26183
|
+
/** Absent on a plan from before D791 — read as the table. */
|
|
26184
|
+
source: LatencySourceSchema.optional(),
|
|
24926
26185
|
/** Parallel sessions at the camera rate with the headroom kept free: ⌊fps × (1 − headroom) / camera fps⌋. */
|
|
24927
26186
|
capacitySessions: number(),
|
|
24928
26187
|
personRecall: number()
|
|
@@ -24933,6 +26192,8 @@ var DeviceRecommendationSchema = object({
|
|
|
24933
26192
|
enabled: boolean(),
|
|
24934
26193
|
available: boolean(),
|
|
24935
26194
|
chosen: DeviceModelChoiceSchema.nullable(),
|
|
26195
|
+
/** Present when the device is kept as is: Apply writes nothing on it. */
|
|
26196
|
+
kept: KeptReasonSchema.optional(),
|
|
24936
26197
|
reasons: array(RecommendationReasonSchema).readonly()
|
|
24937
26198
|
});
|
|
24938
26199
|
var NodeRecommendationSchema = object({
|
|
@@ -24986,6 +26247,17 @@ var AutoTuneWarningSchema = discriminatedUnion("kind", [
|
|
|
24986
26247
|
kind: literal("coral-enabled"),
|
|
24987
26248
|
nodeId: string(),
|
|
24988
26249
|
deviceKey: string()
|
|
26250
|
+
}),
|
|
26251
|
+
object({
|
|
26252
|
+
kind: literal("custom-pin-kept"),
|
|
26253
|
+
nodeId: string(),
|
|
26254
|
+
deviceKey: string().nullable(),
|
|
26255
|
+
deviceId: number().nullable(),
|
|
26256
|
+
modelId: string()
|
|
26257
|
+
}),
|
|
26258
|
+
object({
|
|
26259
|
+
kind: literal("custom-registry-unreadable"),
|
|
26260
|
+
error: string()
|
|
24989
26261
|
})
|
|
24990
26262
|
]);
|
|
24991
26263
|
var AutoTuneOptionsSchema = object({
|
|
@@ -25164,13 +26436,14 @@ var SuggestSharesResultSchema = object({
|
|
|
25164
26436
|
nodes: array(SuggestedNodeShareSchema).readonly()
|
|
25165
26437
|
});
|
|
25166
26438
|
/**
|
|
25167
|
-
* Where the node and device shares come from (D750, D755).
|
|
25168
|
-
* - `
|
|
25169
|
-
*
|
|
25170
|
-
*
|
|
25171
|
-
*
|
|
25172
|
-
*
|
|
25173
|
-
*
|
|
26439
|
+
* Where the node and device shares come from (D750, D755, D791).
|
|
26440
|
+
* - `benchmark` (default since D791) — each node's capacity as its own node
|
|
26441
|
+
* benchmark measured it; a node without fresh results is sized from
|
|
26442
|
+
* `hardware` and says so. Measured on the node beats the table.
|
|
26443
|
+
* - `hardware` — computed from each node's static capacity only (its
|
|
26444
|
+
* accelerators at their Auto tune models, from the latency table).
|
|
26445
|
+
* Both are recomputed whenever a node or device joins, leaves, is switched
|
|
26446
|
+
* on or off, changes model, or a benchmark result is written. No load input.
|
|
25174
26447
|
* - `manual` — the operator's stored sliders.
|
|
25175
26448
|
* Either way a node or device that cannot take sessions gives its share to
|
|
25176
26449
|
* the others in proportion; the stored values are never rewritten for that.
|
|
@@ -25219,6 +26492,362 @@ var EffectiveSharesSchema = object({
|
|
|
25219
26492
|
nodeWeights: record(string(), number()),
|
|
25220
26493
|
deviceWeights: record(string(), record(string(), number()))
|
|
25221
26494
|
});
|
|
26495
|
+
/**
|
|
26496
|
+
* Wire shapes of the node benchmark (D791): the operator's plan, the
|
|
26497
|
+
* preflight the confirmation shows, the run the orchestrator owns, what the
|
|
26498
|
+
* measuring runner reports, and the result rows Auto tune and the automatic
|
|
26499
|
+
* shares read.
|
|
26500
|
+
*
|
|
26501
|
+
* ONE node at a time, owned by the pipeline orchestrator. While a run is
|
|
26502
|
+
* active the cluster is in BENCHMARK MODE for that node: it is not a
|
|
26503
|
+
* detection candidate, camera pins naming it are ignored so its sessions move
|
|
26504
|
+
* elsewhere, and both come back when the mode ends — after a crash or a hub
|
|
26505
|
+
* restart too (a persisted manifest, reconciled against the registry).
|
|
26506
|
+
*
|
|
26507
|
+
* Two measurements, both on the node, driven by its own runner (frames never
|
|
26508
|
+
* cross a process at frame rate, D9):
|
|
26509
|
+
* - `device` — one accelerator × one candidate detector, root only, open
|
|
26510
|
+
* loop: how many streams at the camera rate it carries inside the frame
|
|
26511
|
+
* interval;
|
|
26512
|
+
* - `pipeline` — the chosen detector plus the operator's detail steps
|
|
26513
|
+
* (faces, plates, classifiers, CLIP…), on varied frames from the bench
|
|
26514
|
+
* clip: how many parallel sessions the node carries before latency, drops,
|
|
26515
|
+
* CPU, RAM or the event loop give out.
|
|
26516
|
+
*/
|
|
26517
|
+
/** Defaults and bounds, one place. */
|
|
26518
|
+
var NODE_BENCHMARK_DEFAULTS = {
|
|
26519
|
+
fpsPerStream: 10,
|
|
26520
|
+
budgetMinutes: 45,
|
|
26521
|
+
minBudgetMinutes: 10,
|
|
26522
|
+
maxBudgetMinutes: 120,
|
|
26523
|
+
/** A result older than this no longer beats the table. */
|
|
26524
|
+
staleAfterDays: 30,
|
|
26525
|
+
/** Warm-in per ramp step (not accounted). */
|
|
26526
|
+
settleSec: 5,
|
|
26527
|
+
/** Accounted window per ramp step. */
|
|
26528
|
+
measureSec: 20,
|
|
26529
|
+
/** Longest the drain may take before the run is refused. */
|
|
26530
|
+
drainTimeoutSec: 120,
|
|
26531
|
+
/** Candidate models per device in one run. */
|
|
26532
|
+
maxModelsPerDevice: 6
|
|
26533
|
+
};
|
|
26534
|
+
/** The two measurements a run can make. */
|
|
26535
|
+
var NodeBenchmarkPhaseSchema = _enum(["device", "pipeline"]);
|
|
26536
|
+
var NodeBenchmarkDevicePlanSchema = object({
|
|
26537
|
+
/** `<backend>:<device>` — `openvino:npu`, `coreml:all`, `cpu`. */
|
|
26538
|
+
deviceKey: string().min(1),
|
|
26539
|
+
/**
|
|
26540
|
+
* Root detector candidates for the `device` measurement, in the order
|
|
26541
|
+
* measured. The FIRST is the one the `pipeline` measurement runs.
|
|
26542
|
+
*/
|
|
26543
|
+
modelIds: array(string().min(1)).min(1).max(NODE_BENCHMARK_DEFAULTS.maxModelsPerDevice)
|
|
26544
|
+
});
|
|
26545
|
+
/** What the operator confirmed. */
|
|
26546
|
+
var NodeBenchmarkPlanSchema = object({
|
|
26547
|
+
nodeId: string().min(1),
|
|
26548
|
+
devices: array(NodeBenchmarkDevicePlanSchema).min(1),
|
|
26549
|
+
/** Which measurements run. At least one. */
|
|
26550
|
+
phases: array(NodeBenchmarkPhaseSchema).min(1).default(["device", "pipeline"]),
|
|
26551
|
+
/**
|
|
26552
|
+
* Detail steps (catalog step ids under the root: faces, plates,
|
|
26553
|
+
* classifiers, CLIP…) the `pipeline` measurement enables. The root
|
|
26554
|
+
* detector always runs.
|
|
26555
|
+
*/
|
|
26556
|
+
steps: array(string().min(1)).default([]),
|
|
26557
|
+
/** Offered rate of one stream / session. */
|
|
26558
|
+
fpsPerStream: number().int().min(1).max(30).default(NODE_BENCHMARK_DEFAULTS.fpsPerStream),
|
|
26559
|
+
/** Hard deadline: the mode ends and the cluster is restored when it passes. */
|
|
26560
|
+
budgetMinutes: number().int().min(NODE_BENCHMARK_DEFAULTS.minBudgetMinutes).max(NODE_BENCHMARK_DEFAULTS.maxBudgetMinutes).default(NODE_BENCHMARK_DEFAULTS.budgetMinutes),
|
|
26561
|
+
/** Keep the models the run downloaded (default: delete what was not installed before). */
|
|
26562
|
+
keepDownloadedModels: boolean().default(false),
|
|
26563
|
+
/** Start although the other nodes' capacity does not cover the sessions running now. */
|
|
26564
|
+
acceptInsufficientHeadroom: boolean().default(false)
|
|
26565
|
+
});
|
|
26566
|
+
var NodeBenchmarkRefusalSchema = object({
|
|
26567
|
+
kind: _enum([
|
|
26568
|
+
"benchmark-active",
|
|
26569
|
+
"node-offline",
|
|
26570
|
+
"unknown-device",
|
|
26571
|
+
"no-phase",
|
|
26572
|
+
"insufficient-headroom"
|
|
26573
|
+
]),
|
|
26574
|
+
detail: string(),
|
|
26575
|
+
overridable: boolean()
|
|
26576
|
+
});
|
|
26577
|
+
/** A camera whose detection leaves the node for the run. */
|
|
26578
|
+
var NodeBenchmarkMovingCameraSchema = object({
|
|
26579
|
+
deviceId: number(),
|
|
26580
|
+
/** Placed on the node now (a standing attach or a running session). */
|
|
26581
|
+
placedOnNode: boolean(),
|
|
26582
|
+
/** A node pin naming this node, ignored for the run. */
|
|
26583
|
+
pinnedToNode: boolean()
|
|
26584
|
+
});
|
|
26585
|
+
/** A camera that cannot leave: no other node can obtain its frames. */
|
|
26586
|
+
var NodeBenchmarkStayingCameraSchema = object({
|
|
26587
|
+
deviceId: number(),
|
|
26588
|
+
reason: literal("only-frame-source")
|
|
26589
|
+
});
|
|
26590
|
+
var NodeBenchmarkPreflightSchema = object({
|
|
26591
|
+
nodeId: string(),
|
|
26592
|
+
online: boolean(),
|
|
26593
|
+
moving: array(NodeBenchmarkMovingCameraSchema).readonly(),
|
|
26594
|
+
/** Keep running on the node during the run; the result is flagged contaminated. */
|
|
26595
|
+
staying: array(NodeBenchmarkStayingCameraSchema).readonly(),
|
|
26596
|
+
estimatedDurationMs: number(),
|
|
26597
|
+
/** The run ends and the cluster is restored at the latest after this long. */
|
|
26598
|
+
budgetMs: number(),
|
|
26599
|
+
phases: array(NodeBenchmarkPhaseSchema).readonly(),
|
|
26600
|
+
steps: array(string()).readonly(),
|
|
26601
|
+
devices: array(NodeBenchmarkDevicePlanSchema).readonly(),
|
|
26602
|
+
/** Parallel sessions the cluster runs now, and what the other nodes can carry. */
|
|
26603
|
+
headroom: object({
|
|
26604
|
+
sessionsNow: number(),
|
|
26605
|
+
otherNodesCapacitySessions: number().nullable()
|
|
26606
|
+
}),
|
|
26607
|
+
refusals: array(NodeBenchmarkRefusalSchema).readonly(),
|
|
26608
|
+
canStart: boolean()
|
|
26609
|
+
});
|
|
26610
|
+
/** Where the measuring runner is. */
|
|
26611
|
+
var NodeBenchProgressSchema = object({
|
|
26612
|
+
phase: _enum([
|
|
26613
|
+
"preparing",
|
|
26614
|
+
"device",
|
|
26615
|
+
"pipeline",
|
|
26616
|
+
"cleanup"
|
|
26617
|
+
]),
|
|
26618
|
+
deviceKey: string().nullable(),
|
|
26619
|
+
modelId: string().nullable(),
|
|
26620
|
+
/** Streams (device) or sessions (pipeline) of the step running now. */
|
|
26621
|
+
load: number().nullable(),
|
|
26622
|
+
cellsDone: number(),
|
|
26623
|
+
cellsTotal: number(),
|
|
26624
|
+
message: string()
|
|
26625
|
+
});
|
|
26626
|
+
/** What limited a ramp. `none` = the ramp ran out of steps still passing. */
|
|
26627
|
+
var NodeBenchLimitSchema = _enum([
|
|
26628
|
+
"p95",
|
|
26629
|
+
"drops",
|
|
26630
|
+
"errors",
|
|
26631
|
+
"stall",
|
|
26632
|
+
"cpu",
|
|
26633
|
+
"ram",
|
|
26634
|
+
"none"
|
|
26635
|
+
]);
|
|
26636
|
+
var NodeBenchRampStepSchema = object({
|
|
26637
|
+
load: number(),
|
|
26638
|
+
pass: boolean(),
|
|
26639
|
+
p95Ms: number(),
|
|
26640
|
+
dropRatio: number(),
|
|
26641
|
+
/** Completed frames per second over the accounted window. */
|
|
26642
|
+
fps: number(),
|
|
26643
|
+
cpuPct: number().nullable(),
|
|
26644
|
+
ramFreePct: number().nullable(),
|
|
26645
|
+
failReasons: array(string()).readonly()
|
|
26646
|
+
});
|
|
26647
|
+
var NodeBenchCellSchema = discriminatedUnion("phase", [object({
|
|
26648
|
+
phase: literal("device"),
|
|
26649
|
+
deviceKey: string(),
|
|
26650
|
+
modelId: string(),
|
|
26651
|
+
/** Single-stream latency (the K = 1 step). */
|
|
26652
|
+
p50Ms: number(),
|
|
26653
|
+
p95Ms: number(),
|
|
26654
|
+
p99Ms: number(),
|
|
26655
|
+
/** Frames per second sustained at the last passing step. */
|
|
26656
|
+
fps: number(),
|
|
26657
|
+
/** Streams at the camera rate the device carried inside the frame interval; 0 = not even one. */
|
|
26658
|
+
kMax: number(),
|
|
26659
|
+
limitedBy: NodeBenchLimitSchema,
|
|
26660
|
+
/** First call (model load + warm-up). */
|
|
26661
|
+
warmupMs: number(),
|
|
26662
|
+
ramp: array(NodeBenchRampStepSchema).readonly()
|
|
26663
|
+
}), object({
|
|
26664
|
+
phase: literal("pipeline"),
|
|
26665
|
+
deviceKey: string(),
|
|
26666
|
+
modelId: string(),
|
|
26667
|
+
steps: array(string()).readonly(),
|
|
26668
|
+
/** Parallel sessions at the camera rate the node carried; 0 = not even one. */
|
|
26669
|
+
maxSessions: number(),
|
|
26670
|
+
limitedBy: NodeBenchLimitSchema,
|
|
26671
|
+
/** Detail steps that produced at least one result on the clip — a step that never fired measured nothing. */
|
|
26672
|
+
stepsFired: array(string()).readonly(),
|
|
26673
|
+
warmupMs: number(),
|
|
26674
|
+
ramp: array(NodeBenchRampStepSchema).readonly()
|
|
26675
|
+
})]);
|
|
26676
|
+
/**
|
|
26677
|
+
* What a result was measured ON. A result whose fingerprint no longer matches
|
|
26678
|
+
* the node no longer beats the table.
|
|
26679
|
+
*/
|
|
26680
|
+
var NodeBenchFingerprintSchema = object({
|
|
26681
|
+
pipelineVersion: string().nullable(),
|
|
26682
|
+
cpuModel: string().nullable(),
|
|
26683
|
+
ramGb: number().nullable(),
|
|
26684
|
+
os: string().nullable(),
|
|
26685
|
+
/** Per device: the pool the cells ran on (runtime + tuning). */
|
|
26686
|
+
pools: record(string(), object({
|
|
26687
|
+
runtime: string(),
|
|
26688
|
+
numWorkers: number(),
|
|
26689
|
+
concurrency: number(),
|
|
26690
|
+
batchMode: string()
|
|
26691
|
+
})).default({})
|
|
26692
|
+
});
|
|
26693
|
+
/** The frames the run used. */
|
|
26694
|
+
var NodeBenchClipSchema = object({
|
|
26695
|
+
/** `camstack-bench-v1` or `reference-images` (the fallback when the clip is not reachable). */
|
|
26696
|
+
id: string(),
|
|
26697
|
+
revision: string().nullable(),
|
|
26698
|
+
frames: number(),
|
|
26699
|
+
width: number(),
|
|
26700
|
+
height: number()
|
|
26701
|
+
});
|
|
26702
|
+
var NodeBenchRunnerInputSchema = object({
|
|
26703
|
+
runId: string().min(1),
|
|
26704
|
+
devices: array(NodeBenchmarkDevicePlanSchema).min(1),
|
|
26705
|
+
phases: array(NodeBenchmarkPhaseSchema).min(1),
|
|
26706
|
+
/** The full detail step tree root for the `pipeline` measurement is built on the node from these ids. */
|
|
26707
|
+
steps: array(string()).default([]),
|
|
26708
|
+
fpsPerStream: number().int().min(1).max(30),
|
|
26709
|
+
/** The runner stops on its own past this instant, whatever the hub does. */
|
|
26710
|
+
deadlineAtMs: number(),
|
|
26711
|
+
settleSec: number().min(0).max(60).default(NODE_BENCHMARK_DEFAULTS.settleSec),
|
|
26712
|
+
measureSec: number().min(2).max(300).default(NODE_BENCHMARK_DEFAULTS.measureSec),
|
|
26713
|
+
keepDownloadedModels: boolean().default(false)
|
|
26714
|
+
});
|
|
26715
|
+
var NodeBenchRunnerStateSchema = _enum([
|
|
26716
|
+
"running",
|
|
26717
|
+
"done",
|
|
26718
|
+
"failed",
|
|
26719
|
+
"aborted"
|
|
26720
|
+
]);
|
|
26721
|
+
var NodeBenchRunnerStatusSchema = object({
|
|
26722
|
+
runId: string(),
|
|
26723
|
+
nodeId: string(),
|
|
26724
|
+
state: NodeBenchRunnerStateSchema,
|
|
26725
|
+
progress: NodeBenchProgressSchema.nullable(),
|
|
26726
|
+
/** Every finished cell so far — a run stopped half way keeps what it measured. */
|
|
26727
|
+
cells: array(NodeBenchCellSchema).readonly(),
|
|
26728
|
+
fingerprint: NodeBenchFingerprintSchema.nullable(),
|
|
26729
|
+
clip: NodeBenchClipSchema.nullable(),
|
|
26730
|
+
/** Cameras seen running on the node during the run (they share its pools). */
|
|
26731
|
+
activeCameraIds: array(number()).readonly(),
|
|
26732
|
+
/** Models the run downloaded and then deleted (not installed before). */
|
|
26733
|
+
deletedModels: array(string()).readonly(),
|
|
26734
|
+
error: string().nullable(),
|
|
26735
|
+
startedAtMs: number(),
|
|
26736
|
+
finishedAtMs: number().nullable()
|
|
26737
|
+
});
|
|
26738
|
+
var NodeBenchmarkStateSchema = _enum([
|
|
26739
|
+
"draining",
|
|
26740
|
+
"measuring",
|
|
26741
|
+
"restoring",
|
|
26742
|
+
"done",
|
|
26743
|
+
"failed",
|
|
26744
|
+
"aborted"
|
|
26745
|
+
]);
|
|
26746
|
+
/** Why a run ended. */
|
|
26747
|
+
var NodeBenchmarkEndReasonSchema = _enum([
|
|
26748
|
+
"completed",
|
|
26749
|
+
"operator-abort",
|
|
26750
|
+
"deadline",
|
|
26751
|
+
"node-lost",
|
|
26752
|
+
"runner-lost",
|
|
26753
|
+
"hub-restart",
|
|
26754
|
+
"drain-timeout",
|
|
26755
|
+
"failed"
|
|
26756
|
+
]);
|
|
26757
|
+
var NodeBenchmarkRunSchema = object({
|
|
26758
|
+
runId: string(),
|
|
26759
|
+
nodeId: string(),
|
|
26760
|
+
state: NodeBenchmarkStateSchema,
|
|
26761
|
+
plan: NodeBenchmarkPlanSchema,
|
|
26762
|
+
startedAtMs: number(),
|
|
26763
|
+
deadlineAtMs: number(),
|
|
26764
|
+
finishedAtMs: number().nullable(),
|
|
26765
|
+
endReason: NodeBenchmarkEndReasonSchema.nullable(),
|
|
26766
|
+
error: string().nullable(),
|
|
26767
|
+
/** Cameras moved off the node for the run. */
|
|
26768
|
+
moved: array(number()).readonly(),
|
|
26769
|
+
/** Cameras that stayed (their only frame source is the node). */
|
|
26770
|
+
staying: array(number()).readonly(),
|
|
26771
|
+
/** Something else ran on the node's pools during the run. */
|
|
26772
|
+
contaminated: boolean(),
|
|
26773
|
+
progress: NodeBenchProgressSchema.nullable(),
|
|
26774
|
+
resultIds: array(string()).readonly()
|
|
26775
|
+
});
|
|
26776
|
+
/** `getNodeBenchmarkStatus`: the active run (or the last one), and whether benchmark mode is on. */
|
|
26777
|
+
var NodeBenchmarkStatusSchema = object({
|
|
26778
|
+
/** The node the cluster is in benchmark mode for; null = none. */
|
|
26779
|
+
modeNodeId: string().nullable(),
|
|
26780
|
+
run: NodeBenchmarkRunSchema.nullable()
|
|
26781
|
+
});
|
|
26782
|
+
/**
|
|
26783
|
+
* One stored measurement — the only authority Auto tune and the automatic
|
|
26784
|
+
* shares read measured capacity from. Written by the orchestrator when a run
|
|
26785
|
+
* ends, never by anyone else.
|
|
26786
|
+
*/
|
|
26787
|
+
var NodeBenchmarkResultSchema = object({
|
|
26788
|
+
id: string(),
|
|
26789
|
+
runId: string(),
|
|
26790
|
+
nodeId: string(),
|
|
26791
|
+
cell: NodeBenchCellSchema,
|
|
26792
|
+
fpsPerStream: number(),
|
|
26793
|
+
fingerprint: NodeBenchFingerprintSchema.nullable(),
|
|
26794
|
+
clip: NodeBenchClipSchema.nullable(),
|
|
26795
|
+
/** Other work shared the node's pools (a camera that could not move, or the hub's own duties). */
|
|
26796
|
+
contaminated: boolean(),
|
|
26797
|
+
stayingCameras: array(number()).readonly(),
|
|
26798
|
+
/** The run ended early; the cell itself completed. */
|
|
26799
|
+
partialRun: boolean(),
|
|
26800
|
+
measuredAtMs: number()
|
|
26801
|
+
});
|
|
26802
|
+
var ListNodeBenchmarkResultsInputSchema = object({
|
|
26803
|
+
nodeId: string().optional(),
|
|
26804
|
+
deviceKey: string().optional()
|
|
26805
|
+
});
|
|
26806
|
+
/** A result with its standing today: does it still beat the table? */
|
|
26807
|
+
var NodeBenchmarkResultViewSchema = NodeBenchmarkResultSchema.extend({
|
|
26808
|
+
/** `fresh` beats the table; `stale` falls back to it; `superseded` = a newer row covers the same cell. */
|
|
26809
|
+
standing: _enum([
|
|
26810
|
+
"fresh",
|
|
26811
|
+
"stale",
|
|
26812
|
+
"superseded"
|
|
26813
|
+
]),
|
|
26814
|
+
staleWhy: _enum([
|
|
26815
|
+
"age",
|
|
26816
|
+
"runtime",
|
|
26817
|
+
"pool-tuning"
|
|
26818
|
+
]).nullable()
|
|
26819
|
+
});
|
|
26820
|
+
object({
|
|
26821
|
+
runId: string(),
|
|
26822
|
+
nodeId: string(),
|
|
26823
|
+
startedAtMs: number(),
|
|
26824
|
+
deadlineAtMs: number(),
|
|
26825
|
+
plan: NodeBenchmarkPlanSchema,
|
|
26826
|
+
moved: array(number()).readonly(),
|
|
26827
|
+
staying: array(number()).readonly()
|
|
26828
|
+
});
|
|
26829
|
+
/** Candidate detectors per device, for the plan editor. */
|
|
26830
|
+
var NodeBenchmarkCandidatesSchema = object({
|
|
26831
|
+
nodeId: string(),
|
|
26832
|
+
reachable: boolean(),
|
|
26833
|
+
devices: array(object({
|
|
26834
|
+
deviceKey: string(),
|
|
26835
|
+
enabled: boolean(),
|
|
26836
|
+
available: boolean(),
|
|
26837
|
+
/** Ordered: what Auto tune would pick first, then the rest of the family by accuracy. */
|
|
26838
|
+
suggested: array(string()).readonly(),
|
|
26839
|
+
/** Every root detector the device has a build for. */
|
|
26840
|
+
all: array(string()).readonly(),
|
|
26841
|
+
/** The model the device runs now, when pinned. */
|
|
26842
|
+
currentModelId: string().nullable()
|
|
26843
|
+
})).readonly(),
|
|
26844
|
+
/** Detail steps the node's catalog offers under the root (for the `pipeline` measurement). */
|
|
26845
|
+
steps: array(object({
|
|
26846
|
+
id: string(),
|
|
26847
|
+
name: string(),
|
|
26848
|
+
slot: string()
|
|
26849
|
+
})).readonly()
|
|
26850
|
+
});
|
|
25222
26851
|
object({
|
|
25223
26852
|
activeCameras: number(),
|
|
25224
26853
|
throttledCameras: number(),
|
|
@@ -26347,7 +27976,16 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
|
|
|
26347
27976
|
}), ParkedTrackFrameSchema.nullable()), method(object({
|
|
26348
27977
|
deviceId: number(),
|
|
26349
27978
|
trackId: string()
|
|
26350
|
-
}), object({ released: number().int().nonnegative() }), { kind: "mutation" })
|
|
27979
|
+
}), object({ released: number().int().nonnegative() }), { kind: "mutation" }), method(NodeBenchRunnerInputSchema, object({
|
|
27980
|
+
accepted: literal(true),
|
|
27981
|
+
runId: string()
|
|
27982
|
+
}), {
|
|
27983
|
+
kind: "mutation",
|
|
27984
|
+
auth: "admin"
|
|
27985
|
+
}), method(object({ runId: string() }), NodeBenchRunnerStatusSchema.nullable(), { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
|
|
27986
|
+
kind: "mutation",
|
|
27987
|
+
auth: "admin"
|
|
27988
|
+
});
|
|
26351
27989
|
var CameraPipelineConfigSchema = object({
|
|
26352
27990
|
engine: PipelineEngineChoiceSchema.optional(),
|
|
26353
27991
|
steps: array(PipelineStepInputSchema).readonly(),
|
|
@@ -26986,6 +28624,21 @@ method(object({
|
|
|
26986
28624
|
}), method(PlacementStatsInputSchema, PlacementStatsSchema, { auth: "admin" }), method(SuggestSharesInputSchema, SuggestSharesResultSchema, { auth: "admin" }), method(_void(), EffectiveSharesSchema, { auth: "admin" }), method(SetShareSourceInputSchema, object({ success: literal(true) }), {
|
|
26987
28625
|
kind: "mutation",
|
|
26988
28626
|
auth: "admin"
|
|
28627
|
+
}), method(NodeBenchmarkPlanSchema, NodeBenchmarkPreflightSchema, { auth: "admin" }), method(NodeBenchmarkPlanSchema, discriminatedUnion("kind", [object({
|
|
28628
|
+
kind: literal("started"),
|
|
28629
|
+
runId: string()
|
|
28630
|
+
}), object({
|
|
28631
|
+
kind: literal("refused"),
|
|
28632
|
+
preflight: NodeBenchmarkPreflightSchema
|
|
28633
|
+
})]), {
|
|
28634
|
+
kind: "mutation",
|
|
28635
|
+
auth: "admin"
|
|
28636
|
+
}), method(_void(), NodeBenchmarkStatusSchema, { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
|
|
28637
|
+
kind: "mutation",
|
|
28638
|
+
auth: "admin"
|
|
28639
|
+
}), method(object({ nodeId: string() }), NodeBenchmarkCandidatesSchema, { auth: "admin" }), method(ListNodeBenchmarkResultsInputSchema, array(NodeBenchmarkResultViewSchema).readonly(), { auth: "admin" }), method(object({ id: string() }), object({ deleted: boolean() }), {
|
|
28640
|
+
kind: "mutation",
|
|
28641
|
+
auth: "admin"
|
|
26989
28642
|
}), method(object({ deviceId: number() }), CameraPipelineSettingsSchema.nullable()), method(object({
|
|
26990
28643
|
deviceId: number(),
|
|
26991
28644
|
addonId: string(),
|
|
@@ -27622,7 +29275,19 @@ var SsoBridgeClaimsSchema = object({
|
|
|
27622
29275
|
* editing a descriptor must not retroactively extend or shorten a link the
|
|
27623
29276
|
* operator already consented to.
|
|
27624
29277
|
*/
|
|
27625
|
-
refreshTtl: union([number().int().positive(), literal("never")]).optional()
|
|
29278
|
+
refreshTtl: union([number().int().positive(), literal("never")]).optional(),
|
|
29279
|
+
/**
|
|
29280
|
+
* Opaque handle of a hub-side LINK intent (D782). Set by an OIDC callback
|
|
29281
|
+
* that was started from a signed-in user's "Link" button: the finish then
|
|
29282
|
+
* links this identity to the intent's user instead of signing anyone in.
|
|
29283
|
+
* The handle carries no user id — the hub resolves it, single-use.
|
|
29284
|
+
*/
|
|
29285
|
+
linkIntent: string().optional(),
|
|
29286
|
+
/**
|
|
29287
|
+
* Verified `iss` of the id_token behind an OIDC login bridge (D782). A
|
|
29288
|
+
* subject is unique only per issuer, so a link is bound to it.
|
|
29289
|
+
*/
|
|
29290
|
+
issuer: string().optional()
|
|
27626
29291
|
});
|
|
27627
29292
|
method(object({
|
|
27628
29293
|
claims: SsoBridgeClaimsSchema,
|
|
@@ -29557,7 +31222,22 @@ DeviceType.Camera, method(object({ deviceId: number().int().nonnegative() }), ar
|
|
|
29557
31222
|
* field their hints were silently stripped by the schema and the
|
|
29558
31223
|
* adaptive ladder started blind on the client's display size.
|
|
29559
31224
|
*/
|
|
29560
|
-
hints: webrtcClientHintsSchema.optional()
|
|
31225
|
+
hints: webrtcClientHintsSchema.optional(),
|
|
31226
|
+
/**
|
|
31227
|
+
* Talk-back (D771): relay the PEER's audio to the device's speaker
|
|
31228
|
+
* through the `intercom` cap's push-talk triple. When `true` and the
|
|
31229
|
+
* offer lets the peer send audio, the answer's audio is `sendrecv`
|
|
31230
|
+
* and every inbound frame goes to `intercom.pushTalkAudio` for this
|
|
31231
|
+
* `deviceId`; absent/false answers `sendonly`, as for every viewer.
|
|
31232
|
+
*
|
|
31233
|
+
* TRUSTED-CALLER ONLY. Set by the Alexa export for an Echo on a camera
|
|
31234
|
+
* with `intercom`, when the linked user may control that camera. The
|
|
31235
|
+
* hub STRIPS it from every request-bound call (a browser), exactly as
|
|
31236
|
+
* it overwrites `relayOnly` — a viewer's talk permission is the
|
|
31237
|
+
* intercom cap's own surface (share tokens gate it there), and this
|
|
31238
|
+
* flag must not become a second door to the camera's speaker.
|
|
31239
|
+
*/
|
|
31240
|
+
talkback: boolean().optional()
|
|
29561
31241
|
}), object({
|
|
29562
31242
|
sessionId: string(),
|
|
29563
31243
|
sdpAnswer: string()
|
|
@@ -33066,6 +34746,9 @@ var CreateIntegrationInputSchema = object({
|
|
|
33066
34746
|
enabled: boolean().optional(),
|
|
33067
34747
|
info: record(string(), unknown()).optional(),
|
|
33068
34748
|
settings: record(string(), unknown()).optional(),
|
|
34749
|
+
/** Keys of `settings` the form's schema declares secret (by type) — kept in
|
|
34750
|
+
* the keychain, not the table (D787). */
|
|
34751
|
+
secretKeys: array(string()).optional(),
|
|
33069
34752
|
skipRestart: boolean().optional()
|
|
33070
34753
|
});
|
|
33071
34754
|
var UpdateIntegrationInputSchema = object({
|
|
@@ -33089,7 +34772,9 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
|
|
|
33089
34772
|
auth: "admin"
|
|
33090
34773
|
}), method(object({ id: string() }), record(string(), unknown()), { auth: "admin" }), method(object({
|
|
33091
34774
|
id: string(),
|
|
33092
|
-
settings: record(string(), unknown())
|
|
34775
|
+
settings: record(string(), unknown()),
|
|
34776
|
+
/** Keys the form's schema declares secret (by type) — keychain-stored (D787). */
|
|
34777
|
+
secretKeys: array(string()).optional()
|
|
33093
34778
|
}), object({ success: boolean() }), {
|
|
33094
34779
|
kind: "mutation",
|
|
33095
34780
|
auth: "admin"
|
|
@@ -39911,6 +41596,32 @@ var TotpStatusSchema = object({
|
|
|
39911
41596
|
/** Null when no row exists OR the row is still pending confirmation. */
|
|
39912
41597
|
confirmedAt: number().nullable()
|
|
39913
41598
|
});
|
|
41599
|
+
/**
|
|
41600
|
+
* user-management — singleton capability for user accounts, API keys,
|
|
41601
|
+
* and scoped tokens.
|
|
41602
|
+
*
|
|
41603
|
+
* v2 model: every method gated by `auth: 'admin'`. Admin-only delegation
|
|
41604
|
+
* — the subset check on `setUserScopes` / `createScopedToken` is moot
|
|
41605
|
+
* because non-admins never reach these. If/when we open non-admin
|
|
41606
|
+
* delegation, structural caller-scope subset check goes inside the
|
|
41607
|
+
* provider.
|
|
41608
|
+
*/
|
|
41609
|
+
var ExternalIdentitySchema = object({
|
|
41610
|
+
/** Login-method id of the provider instance, e.g. `auth-oidc/authentik`. */
|
|
41611
|
+
provider: string(),
|
|
41612
|
+
/** The IdP's stable subject (`sub`) for this account. */
|
|
41613
|
+
subject: string(),
|
|
41614
|
+
/** The verified `iss` of the IdP the identity was linked under — `sub` is unique only per issuer. */
|
|
41615
|
+
issuer: string(),
|
|
41616
|
+
userId: string(),
|
|
41617
|
+
/** What the IdP called the account at link time (username / email) — display only. */
|
|
41618
|
+
label: string().optional(),
|
|
41619
|
+
linkedAt: number()
|
|
41620
|
+
});
|
|
41621
|
+
var ExternalIdentityKeySchema = object({
|
|
41622
|
+
provider: string().min(1),
|
|
41623
|
+
subject: string().min(1)
|
|
41624
|
+
});
|
|
39914
41625
|
method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserInputSchema, UserSummarySchema, {
|
|
39915
41626
|
kind: "mutation",
|
|
39916
41627
|
auth: "admin",
|
|
@@ -40024,7 +41735,22 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
40024
41735
|
userId: string(),
|
|
40025
41736
|
username: string(),
|
|
40026
41737
|
scopes: array(TokenScopeSchema)
|
|
40027
|
-
}).nullable(), { access: "view" }), method(
|
|
41738
|
+
}).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
|
|
41739
|
+
userId: string(),
|
|
41740
|
+
issuer: string()
|
|
41741
|
+
}).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
|
|
41742
|
+
userId: string(),
|
|
41743
|
+
issuer: string().min(1),
|
|
41744
|
+
label: string().optional()
|
|
41745
|
+
}), object({ success: literal(true) }), {
|
|
41746
|
+
kind: "mutation",
|
|
41747
|
+
auth: "admin",
|
|
41748
|
+
access: "create"
|
|
41749
|
+
}), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
41750
|
+
kind: "mutation",
|
|
41751
|
+
auth: "admin",
|
|
41752
|
+
access: "delete"
|
|
41753
|
+
}), method(_void(), array(OauthSessionSummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: boolean() }), {
|
|
40028
41754
|
kind: "mutation",
|
|
40029
41755
|
auth: "admin",
|
|
40030
41756
|
access: "delete"
|
|
@@ -41211,7 +42937,8 @@ var BaseDevice = class {
|
|
|
41211
42937
|
this.role = options.role;
|
|
41212
42938
|
this.parentDeviceId = ctx.parentDeviceId;
|
|
41213
42939
|
const seedData = ctx.persistedConfig ?? {};
|
|
41214
|
-
|
|
42940
|
+
const declaredSecretPaths = collectZodSecretPaths(schema);
|
|
42941
|
+
this.config = DeviceConfig.fromSchema(schema, (data) => ctx.persistConfig(data, { secretConfigPaths: declaredSecretPaths }), seedData, ({ droppedKeys, issues }) => {
|
|
41215
42942
|
ctx.logger.warn("Device config recovery: dropping invalid persisted fields", {
|
|
41216
42943
|
tags: {
|
|
41217
42944
|
deviceId: ctx.id,
|
|
@@ -44900,6 +46627,90 @@ Object.freeze({
|
|
|
44900
46627
|
addonId: null,
|
|
44901
46628
|
access: "create"
|
|
44902
46629
|
},
|
|
46630
|
+
"keychain.delete": {
|
|
46631
|
+
capName: "keychain",
|
|
46632
|
+
capScope: "system",
|
|
46633
|
+
addonId: null,
|
|
46634
|
+
access: "delete"
|
|
46635
|
+
},
|
|
46636
|
+
"keychain.getState": {
|
|
46637
|
+
capName: "keychain",
|
|
46638
|
+
capScope: "system",
|
|
46639
|
+
addonId: null,
|
|
46640
|
+
access: "view"
|
|
46641
|
+
},
|
|
46642
|
+
"keychain.listMeta": {
|
|
46643
|
+
capName: "keychain",
|
|
46644
|
+
capScope: "system",
|
|
46645
|
+
addonId: null,
|
|
46646
|
+
access: "view"
|
|
46647
|
+
},
|
|
46648
|
+
"keychain.put": {
|
|
46649
|
+
capName: "keychain",
|
|
46650
|
+
capScope: "system",
|
|
46651
|
+
addonId: null,
|
|
46652
|
+
access: "create"
|
|
46653
|
+
},
|
|
46654
|
+
"keychain.resolve": {
|
|
46655
|
+
capName: "keychain",
|
|
46656
|
+
capScope: "system",
|
|
46657
|
+
addonId: null,
|
|
46658
|
+
access: "view"
|
|
46659
|
+
},
|
|
46660
|
+
"keychainAdmin.deleteOrphans": {
|
|
46661
|
+
capName: "keychain-admin",
|
|
46662
|
+
capScope: "system",
|
|
46663
|
+
addonId: null,
|
|
46664
|
+
access: "delete"
|
|
46665
|
+
},
|
|
46666
|
+
"keychainAdmin.downloadRecoveryKey": {
|
|
46667
|
+
capName: "keychain-admin",
|
|
46668
|
+
capScope: "system",
|
|
46669
|
+
addonId: null,
|
|
46670
|
+
access: "create"
|
|
46671
|
+
},
|
|
46672
|
+
"keychainAdmin.listAudit": {
|
|
46673
|
+
capName: "keychain-admin",
|
|
46674
|
+
capScope: "system",
|
|
46675
|
+
addonId: null,
|
|
46676
|
+
access: "view"
|
|
46677
|
+
},
|
|
46678
|
+
"keychainAdmin.listSecrets": {
|
|
46679
|
+
capName: "keychain-admin",
|
|
46680
|
+
capScope: "system",
|
|
46681
|
+
addonId: null,
|
|
46682
|
+
access: "view"
|
|
46683
|
+
},
|
|
46684
|
+
"keychainAdmin.purgeRetiredKeys": {
|
|
46685
|
+
capName: "keychain-admin",
|
|
46686
|
+
capScope: "system",
|
|
46687
|
+
addonId: null,
|
|
46688
|
+
access: "delete"
|
|
46689
|
+
},
|
|
46690
|
+
"keychainAdmin.resetKeychain": {
|
|
46691
|
+
capName: "keychain-admin",
|
|
46692
|
+
capScope: "system",
|
|
46693
|
+
addonId: null,
|
|
46694
|
+
access: "delete"
|
|
46695
|
+
},
|
|
46696
|
+
"keychainAdmin.reveal": {
|
|
46697
|
+
capName: "keychain-admin",
|
|
46698
|
+
capScope: "system",
|
|
46699
|
+
addonId: null,
|
|
46700
|
+
access: "create"
|
|
46701
|
+
},
|
|
46702
|
+
"keychainAdmin.rotateMasterKey": {
|
|
46703
|
+
capName: "keychain-admin",
|
|
46704
|
+
capScope: "system",
|
|
46705
|
+
addonId: null,
|
|
46706
|
+
access: "create"
|
|
46707
|
+
},
|
|
46708
|
+
"keychainAdmin.status": {
|
|
46709
|
+
capName: "keychain-admin",
|
|
46710
|
+
capScope: "system",
|
|
46711
|
+
addonId: null,
|
|
46712
|
+
access: "view"
|
|
46713
|
+
},
|
|
44903
46714
|
"lawnMowerControl.dock": {
|
|
44904
46715
|
capName: "lawn-mower-control",
|
|
44905
46716
|
capScope: "device",
|
|
@@ -46274,6 +48085,18 @@ Object.freeze({
|
|
|
46274
48085
|
addonId: null,
|
|
46275
48086
|
access: "create"
|
|
46276
48087
|
},
|
|
48088
|
+
"pipelineAnalytics.addRetrainFrameFromRecording": {
|
|
48089
|
+
capName: "pipeline-analytics",
|
|
48090
|
+
capScope: "device",
|
|
48091
|
+
addonId: null,
|
|
48092
|
+
access: "create"
|
|
48093
|
+
},
|
|
48094
|
+
"pipelineAnalytics.addRetrainFramesToCollection": {
|
|
48095
|
+
capName: "pipeline-analytics",
|
|
48096
|
+
capScope: "device",
|
|
48097
|
+
addonId: null,
|
|
48098
|
+
access: "create"
|
|
48099
|
+
},
|
|
46277
48100
|
"pipelineAnalytics.applyDeviceSettingsPatch": {
|
|
46278
48101
|
capName: "pipeline-analytics",
|
|
46279
48102
|
capScope: "device",
|
|
@@ -46322,12 +48145,24 @@ Object.freeze({
|
|
|
46322
48145
|
addonId: null,
|
|
46323
48146
|
access: "view"
|
|
46324
48147
|
},
|
|
48148
|
+
"pipelineAnalytics.createRetrainCollection": {
|
|
48149
|
+
capName: "pipeline-analytics",
|
|
48150
|
+
capScope: "device",
|
|
48151
|
+
addonId: null,
|
|
48152
|
+
access: "create"
|
|
48153
|
+
},
|
|
46325
48154
|
"pipelineAnalytics.deleteDeviceEvents": {
|
|
46326
48155
|
capName: "pipeline-analytics",
|
|
46327
48156
|
capScope: "device",
|
|
46328
48157
|
addonId: null,
|
|
46329
48158
|
access: "delete"
|
|
46330
48159
|
},
|
|
48160
|
+
"pipelineAnalytics.deleteRetrainCollection": {
|
|
48161
|
+
capName: "pipeline-analytics",
|
|
48162
|
+
capScope: "device",
|
|
48163
|
+
addonId: null,
|
|
48164
|
+
access: "delete"
|
|
48165
|
+
},
|
|
46331
48166
|
"pipelineAnalytics.deleteTracks": {
|
|
46332
48167
|
capName: "pipeline-analytics",
|
|
46333
48168
|
capScope: "device",
|
|
@@ -46532,6 +48367,24 @@ Object.freeze({
|
|
|
46532
48367
|
addonId: null,
|
|
46533
48368
|
access: "view"
|
|
46534
48369
|
},
|
|
48370
|
+
"pipelineAnalytics.listRetrainAssistProfiles": {
|
|
48371
|
+
capName: "pipeline-analytics",
|
|
48372
|
+
capScope: "device",
|
|
48373
|
+
addonId: null,
|
|
48374
|
+
access: "view"
|
|
48375
|
+
},
|
|
48376
|
+
"pipelineAnalytics.listRetrainCollectionFrames": {
|
|
48377
|
+
capName: "pipeline-analytics",
|
|
48378
|
+
capScope: "device",
|
|
48379
|
+
addonId: null,
|
|
48380
|
+
access: "view"
|
|
48381
|
+
},
|
|
48382
|
+
"pipelineAnalytics.listRetrainCollections": {
|
|
48383
|
+
capName: "pipeline-analytics",
|
|
48384
|
+
capScope: "device",
|
|
48385
|
+
addonId: null,
|
|
48386
|
+
access: "view"
|
|
48387
|
+
},
|
|
46535
48388
|
"pipelineAnalytics.listRetrainFrames": {
|
|
46536
48389
|
capName: "pipeline-analytics",
|
|
46537
48390
|
capScope: "device",
|
|
@@ -46580,6 +48433,12 @@ Object.freeze({
|
|
|
46580
48433
|
addonId: null,
|
|
46581
48434
|
access: "create"
|
|
46582
48435
|
},
|
|
48436
|
+
"pipelineAnalytics.proposeRetrainAnnotationsWithLlm": {
|
|
48437
|
+
capName: "pipeline-analytics",
|
|
48438
|
+
capScope: "device",
|
|
48439
|
+
addonId: null,
|
|
48440
|
+
access: "create"
|
|
48441
|
+
},
|
|
46583
48442
|
"pipelineAnalytics.pruneEvents": {
|
|
46584
48443
|
capName: "pipeline-analytics",
|
|
46585
48444
|
capScope: "device",
|
|
@@ -46634,6 +48493,18 @@ Object.freeze({
|
|
|
46634
48493
|
addonId: null,
|
|
46635
48494
|
access: "create"
|
|
46636
48495
|
},
|
|
48496
|
+
"pipelineAnalytics.removeRetrainFrameFromCollection": {
|
|
48497
|
+
capName: "pipeline-analytics",
|
|
48498
|
+
capScope: "device",
|
|
48499
|
+
addonId: null,
|
|
48500
|
+
access: "delete"
|
|
48501
|
+
},
|
|
48502
|
+
"pipelineAnalytics.renameRetrainCollection": {
|
|
48503
|
+
capName: "pipeline-analytics",
|
|
48504
|
+
capScope: "device",
|
|
48505
|
+
addonId: null,
|
|
48506
|
+
access: "create"
|
|
48507
|
+
},
|
|
46637
48508
|
"pipelineAnalytics.restageRetrainTrack": {
|
|
46638
48509
|
capName: "pipeline-analytics",
|
|
46639
48510
|
capScope: "device",
|
|
@@ -46664,6 +48535,12 @@ Object.freeze({
|
|
|
46664
48535
|
addonId: null,
|
|
46665
48536
|
access: "create"
|
|
46666
48537
|
},
|
|
48538
|
+
"pipelineAnalytics.setRetrainFrameComplete": {
|
|
48539
|
+
capName: "pipeline-analytics",
|
|
48540
|
+
capScope: "device",
|
|
48541
|
+
addonId: null,
|
|
48542
|
+
access: "create"
|
|
48543
|
+
},
|
|
46667
48544
|
"pipelineAnalytics.setTrackFlags": {
|
|
46668
48545
|
capName: "pipeline-analytics",
|
|
46669
48546
|
capScope: "device",
|
|
@@ -46700,6 +48577,12 @@ Object.freeze({
|
|
|
46700
48577
|
addonId: null,
|
|
46701
48578
|
access: "delete"
|
|
46702
48579
|
},
|
|
48580
|
+
"pipelineAnalytics.writeRetrainArchive": {
|
|
48581
|
+
capName: "pipeline-analytics",
|
|
48582
|
+
capScope: "device",
|
|
48583
|
+
addonId: null,
|
|
48584
|
+
access: "create"
|
|
48585
|
+
},
|
|
46703
48586
|
"pipelineExecutor.cacheFrameInPool": {
|
|
46704
48587
|
capName: "pipeline-executor",
|
|
46705
48588
|
capScope: "system",
|
|
@@ -46910,6 +48793,12 @@ Object.freeze({
|
|
|
46910
48793
|
addonId: null,
|
|
46911
48794
|
access: "view"
|
|
46912
48795
|
},
|
|
48796
|
+
"pipelineOrchestrator.abortNodeBenchmark": {
|
|
48797
|
+
capName: "pipeline-orchestrator",
|
|
48798
|
+
capScope: "system",
|
|
48799
|
+
addonId: null,
|
|
48800
|
+
access: "create"
|
|
48801
|
+
},
|
|
46913
48802
|
"pipelineOrchestrator.applyAutoTune": {
|
|
46914
48803
|
capName: "pipeline-orchestrator",
|
|
46915
48804
|
capScope: "system",
|
|
@@ -46934,6 +48823,12 @@ Object.freeze({
|
|
|
46934
48823
|
addonId: null,
|
|
46935
48824
|
access: "create"
|
|
46936
48825
|
},
|
|
48826
|
+
"pipelineOrchestrator.deleteNodeBenchmarkResult": {
|
|
48827
|
+
capName: "pipeline-orchestrator",
|
|
48828
|
+
capScope: "system",
|
|
48829
|
+
addonId: null,
|
|
48830
|
+
access: "delete"
|
|
48831
|
+
},
|
|
46937
48832
|
"pipelineOrchestrator.getAgentLoad": {
|
|
46938
48833
|
capName: "pipeline-orchestrator",
|
|
46939
48834
|
capScope: "system",
|
|
@@ -47042,6 +48937,24 @@ Object.freeze({
|
|
|
47042
48937
|
addonId: null,
|
|
47043
48938
|
access: "view"
|
|
47044
48939
|
},
|
|
48940
|
+
"pipelineOrchestrator.getNodeBenchmarkCandidates": {
|
|
48941
|
+
capName: "pipeline-orchestrator",
|
|
48942
|
+
capScope: "system",
|
|
48943
|
+
addonId: null,
|
|
48944
|
+
access: "view"
|
|
48945
|
+
},
|
|
48946
|
+
"pipelineOrchestrator.getNodeBenchmarkPreflight": {
|
|
48947
|
+
capName: "pipeline-orchestrator",
|
|
48948
|
+
capScope: "system",
|
|
48949
|
+
addonId: null,
|
|
48950
|
+
access: "view"
|
|
48951
|
+
},
|
|
48952
|
+
"pipelineOrchestrator.getNodeBenchmarkStatus": {
|
|
48953
|
+
capName: "pipeline-orchestrator",
|
|
48954
|
+
capScope: "system",
|
|
48955
|
+
addonId: null,
|
|
48956
|
+
access: "view"
|
|
48957
|
+
},
|
|
47045
48958
|
"pipelineOrchestrator.getNodeInferenceDevices": {
|
|
47046
48959
|
capName: "pipeline-orchestrator",
|
|
47047
48960
|
capScope: "system",
|
|
@@ -47084,6 +48997,12 @@ Object.freeze({
|
|
|
47084
48997
|
addonId: null,
|
|
47085
48998
|
access: "view"
|
|
47086
48999
|
},
|
|
49000
|
+
"pipelineOrchestrator.listNodeBenchmarkResults": {
|
|
49001
|
+
capName: "pipeline-orchestrator",
|
|
49002
|
+
capScope: "system",
|
|
49003
|
+
addonId: null,
|
|
49004
|
+
access: "view"
|
|
49005
|
+
},
|
|
47087
49006
|
"pipelineOrchestrator.pauseForStorageMigration": {
|
|
47088
49007
|
capName: "pipeline-orchestrator",
|
|
47089
49008
|
capScope: "system",
|
|
@@ -47228,6 +49147,12 @@ Object.freeze({
|
|
|
47228
49147
|
addonId: null,
|
|
47229
49148
|
access: "create"
|
|
47230
49149
|
},
|
|
49150
|
+
"pipelineOrchestrator.startNodeBenchmark": {
|
|
49151
|
+
capName: "pipeline-orchestrator",
|
|
49152
|
+
capScope: "system",
|
|
49153
|
+
addonId: null,
|
|
49154
|
+
access: "create"
|
|
49155
|
+
},
|
|
47231
49156
|
"pipelineOrchestrator.suggestShares": {
|
|
47232
49157
|
capName: "pipeline-orchestrator",
|
|
47233
49158
|
capScope: "system",
|
|
@@ -47246,6 +49171,12 @@ Object.freeze({
|
|
|
47246
49171
|
addonId: null,
|
|
47247
49172
|
access: "create"
|
|
47248
49173
|
},
|
|
49174
|
+
"pipelineRunner.abortNodeBench": {
|
|
49175
|
+
capName: "pipeline-runner",
|
|
49176
|
+
capScope: "system",
|
|
49177
|
+
addonId: null,
|
|
49178
|
+
access: "create"
|
|
49179
|
+
},
|
|
47249
49180
|
"pipelineRunner.attachCamera": {
|
|
47250
49181
|
capName: "pipeline-runner",
|
|
47251
49182
|
capScope: "system",
|
|
@@ -47294,6 +49225,12 @@ Object.freeze({
|
|
|
47294
49225
|
addonId: null,
|
|
47295
49226
|
access: "view"
|
|
47296
49227
|
},
|
|
49228
|
+
"pipelineRunner.getNodeBenchStatus": {
|
|
49229
|
+
capName: "pipeline-runner",
|
|
49230
|
+
capScope: "system",
|
|
49231
|
+
addonId: null,
|
|
49232
|
+
access: "view"
|
|
49233
|
+
},
|
|
47297
49234
|
"pipelineRunner.getParkedTrackFrame": {
|
|
47298
49235
|
capName: "pipeline-runner",
|
|
47299
49236
|
capScope: "system",
|
|
@@ -47336,6 +49273,12 @@ Object.freeze({
|
|
|
47336
49273
|
addonId: null,
|
|
47337
49274
|
access: "create"
|
|
47338
49275
|
},
|
|
49276
|
+
"pipelineRunner.startNodeBench": {
|
|
49277
|
+
capName: "pipeline-runner",
|
|
49278
|
+
capScope: "system",
|
|
49279
|
+
addonId: null,
|
|
49280
|
+
access: "create"
|
|
49281
|
+
},
|
|
47339
49282
|
"plateGallery.assignPlate": {
|
|
47340
49283
|
capName: "plate-gallery",
|
|
47341
49284
|
capScope: "system",
|
|
@@ -49052,18 +50995,36 @@ Object.freeze({
|
|
|
49052
50995
|
addonId: null,
|
|
49053
50996
|
access: "delete"
|
|
49054
50997
|
},
|
|
50998
|
+
"userManagement.findUserByExternalIdentity": {
|
|
50999
|
+
capName: "user-management",
|
|
51000
|
+
capScope: "system",
|
|
51001
|
+
addonId: null,
|
|
51002
|
+
access: "view"
|
|
51003
|
+
},
|
|
49055
51004
|
"userManagement.getTotpStatus": {
|
|
49056
51005
|
capName: "user-management",
|
|
49057
51006
|
capScope: "system",
|
|
49058
51007
|
addonId: null,
|
|
49059
51008
|
access: "view"
|
|
49060
51009
|
},
|
|
51010
|
+
"userManagement.linkExternalIdentity": {
|
|
51011
|
+
capName: "user-management",
|
|
51012
|
+
capScope: "system",
|
|
51013
|
+
addonId: null,
|
|
51014
|
+
access: "create"
|
|
51015
|
+
},
|
|
49061
51016
|
"userManagement.listApiKeys": {
|
|
49062
51017
|
capName: "user-management",
|
|
49063
51018
|
capScope: "system",
|
|
49064
51019
|
addonId: null,
|
|
49065
51020
|
access: "view"
|
|
49066
51021
|
},
|
|
51022
|
+
"userManagement.listExternalIdentities": {
|
|
51023
|
+
capName: "user-management",
|
|
51024
|
+
capScope: "system",
|
|
51025
|
+
addonId: null,
|
|
51026
|
+
access: "view"
|
|
51027
|
+
},
|
|
49067
51028
|
"userManagement.listOauthSessions": {
|
|
49068
51029
|
capName: "user-management",
|
|
49069
51030
|
capScope: "system",
|
|
@@ -49142,6 +51103,12 @@ Object.freeze({
|
|
|
49142
51103
|
addonId: null,
|
|
49143
51104
|
access: "create"
|
|
49144
51105
|
},
|
|
51106
|
+
"userManagement.unlinkExternalIdentity": {
|
|
51107
|
+
capName: "user-management",
|
|
51108
|
+
capScope: "system",
|
|
51109
|
+
addonId: null,
|
|
51110
|
+
access: "delete"
|
|
51111
|
+
},
|
|
49145
51112
|
"userManagement.updateUser": {
|
|
49146
51113
|
capName: "user-management",
|
|
49147
51114
|
capScope: "system",
|
|
@@ -52241,6 +54208,11 @@ Object.freeze({
|
|
|
52241
54208
|
form: "single",
|
|
52242
54209
|
optional: false
|
|
52243
54210
|
}],
|
|
54211
|
+
"pipelineAnalytics.addRetrainFrameFromRecording": [{
|
|
54212
|
+
name: "deviceId",
|
|
54213
|
+
form: "single",
|
|
54214
|
+
optional: false
|
|
54215
|
+
}],
|
|
52244
54216
|
"pipelineAnalytics.applyDeviceSettingsPatch": [{
|
|
52245
54217
|
name: "deviceId",
|
|
52246
54218
|
form: "single",
|
|
@@ -52431,6 +54403,11 @@ Object.freeze({
|
|
|
52431
54403
|
form: "single",
|
|
52432
54404
|
optional: false
|
|
52433
54405
|
}],
|
|
54406
|
+
"pipelineAnalytics.proposeRetrainAnnotationsWithLlm": [{
|
|
54407
|
+
name: "deviceId",
|
|
54408
|
+
form: "single",
|
|
54409
|
+
optional: false
|
|
54410
|
+
}],
|
|
52434
54411
|
"pipelineAnalytics.pruneEventsBefore": [{
|
|
52435
54412
|
name: "deviceId",
|
|
52436
54413
|
form: "single",
|
|
@@ -52481,6 +54458,11 @@ Object.freeze({
|
|
|
52481
54458
|
form: "single",
|
|
52482
54459
|
optional: false
|
|
52483
54460
|
}],
|
|
54461
|
+
"pipelineAnalytics.setRetrainFrameComplete": [{
|
|
54462
|
+
name: "deviceId",
|
|
54463
|
+
form: "single",
|
|
54464
|
+
optional: false
|
|
54465
|
+
}],
|
|
52484
54466
|
"pipelineAnalytics.setTrackFlags": [{
|
|
52485
54467
|
name: "deviceId",
|
|
52486
54468
|
form: "single",
|
|
@@ -54542,7 +56524,7 @@ var MB = 1024 * 1024;
|
|
|
54542
56524
|
*/
|
|
54543
56525
|
var rademacherConnectionSchema = object({
|
|
54544
56526
|
host: string().min(1).describe("HomePilot hub host name or IP address"),
|
|
54545
|
-
password: string().default("").describe("Hub password (leave blank for an unprotected hub)"),
|
|
56527
|
+
password: string().default("").describe("Hub password (leave blank for an unprotected hub)").meta({ secret: true }),
|
|
54546
56528
|
basePath: string().default("").describe("API base path override (blank = auto-probe: v1 \"\" / v2 \"/hp\")"),
|
|
54547
56529
|
pollIntervalMs: preprocess((v) => v === "" || v === null ? void 0 : v, number().int().min(2e3).max(36e5).default(3e4)).describe("Device-state poll interval (ms)")
|
|
54548
56530
|
});
|