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