@camstack/addon-provider-unifi 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 +2045 -63
- package/dist/addon.mjs +2045 -63
- package/package.json +1 -1
package/dist/addon.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
//#region ../types/dist/event-category-
|
|
2
|
+
//#region ../types/dist/event-category-DaIZi00R.mjs
|
|
3
3
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
4
4
|
EventCategory["SystemBoot"] = "system.boot";
|
|
5
5
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -78,6 +78,13 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
78
78
|
*/
|
|
79
79
|
EventCategory["AddonLoadFailed"] = "addon.load-failed";
|
|
80
80
|
/**
|
|
81
|
+
* A keychain value was stored or removed (D787). Carries the ref, its
|
|
82
|
+
* owner and the new version — NEVER the value. A process holding the ref
|
|
83
|
+
* drops its cached copy and the owning `BaseAddon` re-resolves its config.
|
|
84
|
+
* Telemetry (D8): a process that misses it still revalidates by version.
|
|
85
|
+
*/
|
|
86
|
+
EventCategory["KeychainChanged"] = "keychain.changed";
|
|
87
|
+
/**
|
|
81
88
|
* Addon recovered from a previous failure. Emitted when an addon
|
|
82
89
|
* transitions from `failed` back to `healthy` (typically via the
|
|
83
90
|
* monitor's auto-retry loop, or after manual `addons.retryLoad`).
|
|
@@ -5370,7 +5377,7 @@ var ZodIssueCode = {
|
|
|
5370
5377
|
var ZodFirstPartyTypeKind;
|
|
5371
5378
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5372
5379
|
//#endregion
|
|
5373
|
-
//#region ../types/dist/sleep-
|
|
5380
|
+
//#region ../types/dist/sleep-Cr5YOk3m.mjs
|
|
5374
5381
|
/**
|
|
5375
5382
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5376
5383
|
* window to float samples (D455).
|
|
@@ -5449,6 +5456,97 @@ function buildAlawTable() {
|
|
|
5449
5456
|
}
|
|
5450
5457
|
buildUlawTable();
|
|
5451
5458
|
buildAlawTable();
|
|
5459
|
+
/** Is this field's stored value a credential? */
|
|
5460
|
+
function isSecretConfigField(field) {
|
|
5461
|
+
if (field.type === "password") return true;
|
|
5462
|
+
return "secret" in field && field.secret === true;
|
|
5463
|
+
}
|
|
5464
|
+
/**
|
|
5465
|
+
* Is this field's value stored in the KEYCHAIN (D787)? Every secret field is,
|
|
5466
|
+
* by its TYPE, unless it opts out with `storage: 'inline'` — never by its name.
|
|
5467
|
+
*/
|
|
5468
|
+
function isKeychainStoredField(field) {
|
|
5469
|
+
if (!isSecretConfigField(field)) return false;
|
|
5470
|
+
if (field.type === "textarea" && field.isJson === true) return false;
|
|
5471
|
+
return !("storage" in field && field.storage === "inline");
|
|
5472
|
+
}
|
|
5473
|
+
/**
|
|
5474
|
+
* What a settings blob holds where a secret used to be.
|
|
5475
|
+
*
|
|
5476
|
+
* A keychain-stored field never holds its value. It holds a self-describing
|
|
5477
|
+
* MARKER, `{"$secret":"secret://…","v":1}` — an object, never a string, so no
|
|
5478
|
+
* code can mistake it for a credential and no form can send it to a camera as
|
|
5479
|
+
* a password. The empty state is `null` / absent, never `''`.
|
|
5480
|
+
*
|
|
5481
|
+
* The same shapes travel to and from the admin UI:
|
|
5482
|
+
*
|
|
5483
|
+
* - read: `hydrateSchema` hands a secret field a {@link SecretFieldView}
|
|
5484
|
+
* (`{ $secret, v, set: true }`) or `null` — the browser learns whether a
|
|
5485
|
+
* value is set, never the value.
|
|
5486
|
+
* - write: an untouched field submits the view back unchanged (KEEP); a typed
|
|
5487
|
+
* value is a plain non-empty string (CHANGE); the Clear button submits
|
|
5488
|
+
* {@link SECRET_CLEAR} (CLEAR). `''`, `null` and the legacy redaction tokens
|
|
5489
|
+
* are KEEP — an empty string is what a defaults-fallback pushes back, and
|
|
5490
|
+
* treating it as "clear" is how a save destroyed a stored credential before.
|
|
5491
|
+
*
|
|
5492
|
+
* Pure and browser-safe.
|
|
5493
|
+
*/
|
|
5494
|
+
var SECRET_CLEAR = { $secretClear: true };
|
|
5495
|
+
/** The `'***'` token D634 redaction writes for non-admins. */
|
|
5496
|
+
var LEGACY_DEVICE_REDACTION = "***";
|
|
5497
|
+
function isRecord$1(value) {
|
|
5498
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5499
|
+
}
|
|
5500
|
+
function makeSecretMarker(ref) {
|
|
5501
|
+
return {
|
|
5502
|
+
$secret: ref,
|
|
5503
|
+
v: 1
|
|
5504
|
+
};
|
|
5505
|
+
}
|
|
5506
|
+
/** A stored marker: an object whose `$secret` is a non-empty string. */
|
|
5507
|
+
function isSecretMarker(value) {
|
|
5508
|
+
if (!isRecord$1(value)) return false;
|
|
5509
|
+
const ref = value["$secret"];
|
|
5510
|
+
return typeof ref === "string" && ref.length > 0;
|
|
5511
|
+
}
|
|
5512
|
+
function isSecretClear(value) {
|
|
5513
|
+
return isRecord$1(value) && value["$secretClear"] === true;
|
|
5514
|
+
}
|
|
5515
|
+
/**
|
|
5516
|
+
* The UI view of a stored secret field value: a marker becomes "set", inline
|
|
5517
|
+
* plaintext becomes "set (inline)", nothing becomes `null`. A value never
|
|
5518
|
+
* survives this function.
|
|
5519
|
+
*/
|
|
5520
|
+
function toSecretFieldView(stored) {
|
|
5521
|
+
if (isSecretMarker(stored)) return {
|
|
5522
|
+
$secret: stored.$secret,
|
|
5523
|
+
v: 1,
|
|
5524
|
+
set: true
|
|
5525
|
+
};
|
|
5526
|
+
if (typeof stored === "string" && stored.length > 0) return {
|
|
5527
|
+
$secret: null,
|
|
5528
|
+
v: 1,
|
|
5529
|
+
set: true,
|
|
5530
|
+
inline: true
|
|
5531
|
+
};
|
|
5532
|
+
return null;
|
|
5533
|
+
}
|
|
5534
|
+
/**
|
|
5535
|
+
* Classify an incoming value for a secret path. Only a non-empty string that is
|
|
5536
|
+
* not a redaction token sets a value; only {@link SECRET_CLEAR} clears.
|
|
5537
|
+
* Everything else — a marker (ours or anyone's), a UI view, `''`, `null`,
|
|
5538
|
+
* `undefined`, a redaction token, a non-string — keeps what is stored.
|
|
5539
|
+
*/
|
|
5540
|
+
function classifySecretWrite(incoming) {
|
|
5541
|
+
if (isSecretClear(incoming)) return { kind: "clear" };
|
|
5542
|
+
if (typeof incoming !== "string") return { kind: "keep" };
|
|
5543
|
+
if (incoming.length === 0) return { kind: "keep" };
|
|
5544
|
+
if (incoming === "__camstack_redacted__" || incoming === LEGACY_DEVICE_REDACTION) return { kind: "keep" };
|
|
5545
|
+
return {
|
|
5546
|
+
kind: "set",
|
|
5547
|
+
value: incoming
|
|
5548
|
+
};
|
|
5549
|
+
}
|
|
5452
5550
|
Object.fromEntries([
|
|
5453
5551
|
{
|
|
5454
5552
|
id: "overview",
|
|
@@ -5620,33 +5718,19 @@ Object.fromEntries([
|
|
|
5620
5718
|
function isValuelessField(field) {
|
|
5621
5719
|
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";
|
|
5622
5720
|
}
|
|
5623
|
-
|
|
5624
|
-
* Merge a `ConfigUISchema` with a raw `values` record into a
|
|
5625
|
-
* `ConfigUISchemaWithValues`. Used by every `get*Settings` backend endpoint
|
|
5626
|
-
* before returning to the admin UI. Groups are walked recursively.
|
|
5627
|
-
*
|
|
5628
|
-
* For each leaf field:
|
|
5629
|
-
* - structural fields (`separator`, `info`, `button`) pass through unchanged
|
|
5630
|
-
* - other fields get `value = values[key] ?? field.default ?? null`
|
|
5631
|
-
*
|
|
5632
|
-
* Unknown keys in `values` (keys not declared in the schema) are silently
|
|
5633
|
-
* ignored — they don't contribute to the output. Missing keys fall back to
|
|
5634
|
-
* the schema default or `null`. This mirrors the old backend behaviour where
|
|
5635
|
-
* `FormBuilder` rendered `values[key] ?? field.default`.
|
|
5636
|
-
*/
|
|
5637
|
-
function hydrateSchema(schema, values) {
|
|
5721
|
+
function hydrateSchema(schema, values, options = {}) {
|
|
5638
5722
|
return {
|
|
5639
5723
|
...schema.tabs ? { tabs: [...schema.tabs] } : {},
|
|
5640
5724
|
sections: schema.sections.map((section) => ({
|
|
5641
5725
|
...section,
|
|
5642
|
-
fields: section.fields.map((field) => hydrateField(field, values))
|
|
5726
|
+
fields: section.fields.map((field) => hydrateField(field, values, options))
|
|
5643
5727
|
}))
|
|
5644
5728
|
};
|
|
5645
5729
|
}
|
|
5646
|
-
function hydrateField(field, values) {
|
|
5730
|
+
function hydrateField(field, values, options) {
|
|
5647
5731
|
if (isValuelessField(field)) return field;
|
|
5648
5732
|
if (field.type === "group") {
|
|
5649
|
-
const hydratedChildren = field.fields.map((child) => hydrateField(child, values));
|
|
5733
|
+
const hydratedChildren = field.fields.map((child) => hydrateField(child, values, options));
|
|
5650
5734
|
return {
|
|
5651
5735
|
...field,
|
|
5652
5736
|
fields: hydratedChildren
|
|
@@ -5655,7 +5739,7 @@ function hydrateField(field, values) {
|
|
|
5655
5739
|
if (field.type === "sub-tabs") {
|
|
5656
5740
|
const hydratedTabs = field.tabs.map((tab) => ({
|
|
5657
5741
|
...tab,
|
|
5658
|
-
fields: tab.fields.map((child) => hydrateField(child, values))
|
|
5742
|
+
fields: tab.fields.map((child) => hydrateField(child, values, options))
|
|
5659
5743
|
}));
|
|
5660
5744
|
return {
|
|
5661
5745
|
...field,
|
|
@@ -5665,6 +5749,33 @@ function hydrateField(field, values) {
|
|
|
5665
5749
|
const key = field.key;
|
|
5666
5750
|
const storedValue = Object.prototype.hasOwnProperty.call(values, key) ? values[key] : void 0;
|
|
5667
5751
|
const defaultValue = field.default;
|
|
5752
|
+
const asView = (v) => isSecretMarker(v) || options.inlineSecretsAsViews === true && v !== void 0;
|
|
5753
|
+
if (isKeychainStoredField(field) && asView(storedValue)) return {
|
|
5754
|
+
...field,
|
|
5755
|
+
value: toSecretFieldView(storedValue)
|
|
5756
|
+
};
|
|
5757
|
+
if (isKeychainStoredField(field) && options.inlineSecretsAsViews === true) return {
|
|
5758
|
+
...field,
|
|
5759
|
+
value: null
|
|
5760
|
+
};
|
|
5761
|
+
if (field.type === "editable-array" && Array.isArray(storedValue)) {
|
|
5762
|
+
const secretItemKeys = field.itemFields.filter((item) => "key" in item && isKeychainStoredField(item)).map((item) => "key" in item ? item.key : "");
|
|
5763
|
+
if (secretItemKeys.length > 0) {
|
|
5764
|
+
const rows = storedValue.map((row) => {
|
|
5765
|
+
if (row === null || typeof row !== "object" || Array.isArray(row)) return row;
|
|
5766
|
+
const out = { ...row };
|
|
5767
|
+
for (const k of secretItemKeys) {
|
|
5768
|
+
const v = Reflect.get(row, k);
|
|
5769
|
+
if (asView(v)) out[k] = toSecretFieldView(v);
|
|
5770
|
+
}
|
|
5771
|
+
return out;
|
|
5772
|
+
});
|
|
5773
|
+
return {
|
|
5774
|
+
...field,
|
|
5775
|
+
value: rows
|
|
5776
|
+
};
|
|
5777
|
+
}
|
|
5778
|
+
}
|
|
5668
5779
|
if (field.multiple) {
|
|
5669
5780
|
const stored = Array.isArray(storedValue) ? storedValue : storedValue !== void 0 && storedValue !== null ? [storedValue] : [];
|
|
5670
5781
|
const itemFallback = field.multiple.itemDefault !== void 0 ? field.multiple.itemDefault : defaultValue !== void 0 ? defaultValue : typeOf(field) === "string" ? "" : null;
|
|
@@ -5907,6 +6018,431 @@ function projectStore(store, perNodeKeys, nodeId) {
|
|
|
5907
6018
|
}
|
|
5908
6019
|
return out;
|
|
5909
6020
|
}
|
|
6021
|
+
var GLOBAL_SCOPE = { kind: "global" };
|
|
6022
|
+
/** The scope every addon-wide (not per-node, not per-device) setting lives in. */
|
|
6023
|
+
function globalSecretScope() {
|
|
6024
|
+
return GLOBAL_SCOPE;
|
|
6025
|
+
}
|
|
6026
|
+
function encodeSegment(value) {
|
|
6027
|
+
return encodeURIComponent(value);
|
|
6028
|
+
}
|
|
6029
|
+
/**
|
|
6030
|
+
* The field path of a value inside an array item, addressed by the item's id:
|
|
6031
|
+
* `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
|
|
6032
|
+
* `providers[authentik].clientSecret`.
|
|
6033
|
+
*/
|
|
6034
|
+
function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
|
|
6035
|
+
return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
|
|
6036
|
+
}
|
|
6037
|
+
/** A write to a secret path could not be stored in the keychain, so it was refused. */
|
|
6038
|
+
var KeychainWriteRefusedError = class extends Error {
|
|
6039
|
+
fieldPath;
|
|
6040
|
+
constructor(fieldPath, cause) {
|
|
6041
|
+
super(`secret "${fieldPath}" was not saved: the keychain could not store it (${cause instanceof Error ? cause.message : String(cause)}). Nothing was written.`);
|
|
6042
|
+
this.fieldPath = fieldPath;
|
|
6043
|
+
this.name = "KeychainWriteRefusedError";
|
|
6044
|
+
}
|
|
6045
|
+
};
|
|
6046
|
+
var KEEP = { kind: "keep" };
|
|
6047
|
+
function isRecord(value) {
|
|
6048
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6049
|
+
}
|
|
6050
|
+
function defaultMintId() {
|
|
6051
|
+
return globalThis.crypto.randomUUID();
|
|
6052
|
+
}
|
|
6053
|
+
/** Every marker ref anywhere under `value`. */
|
|
6054
|
+
function collectSecretMarkerRefs(value, out = []) {
|
|
6055
|
+
if (isSecretMarker(value)) {
|
|
6056
|
+
out.push(value.$secret);
|
|
6057
|
+
return out;
|
|
6058
|
+
}
|
|
6059
|
+
if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
|
|
6060
|
+
else if (isRecord(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
6061
|
+
return out;
|
|
6062
|
+
}
|
|
6063
|
+
async function storedValueEquals(secrets, marker, candidate) {
|
|
6064
|
+
const resolved = (await secrets.resolve([marker.$secret]))[marker.$secret];
|
|
6065
|
+
return resolved?.kind === "value" && resolved.value === candidate;
|
|
6066
|
+
}
|
|
6067
|
+
async function writeLeaf(ctx, incoming, stored, fieldPath) {
|
|
6068
|
+
const intent = classifySecretWrite(incoming);
|
|
6069
|
+
const ref = ctx.secrets.ref(ctx.scope, fieldPath);
|
|
6070
|
+
const storedIsOurs = isSecretMarker(stored) && stored.$secret === ref;
|
|
6071
|
+
if (intent.kind === "keep") return KEEP;
|
|
6072
|
+
if (intent.kind === "set" && !ctx.operatorWrite && typeof stored === "string" && stored === intent.value) return KEEP;
|
|
6073
|
+
if (intent.kind === "clear") {
|
|
6074
|
+
if (storedIsOurs) ctx.deletes.push(ref);
|
|
6075
|
+
return {
|
|
6076
|
+
kind: "value",
|
|
6077
|
+
value: null
|
|
6078
|
+
};
|
|
6079
|
+
}
|
|
6080
|
+
if (storedIsOurs && await storedValueEquals(ctx.secrets, stored, intent.value)) return {
|
|
6081
|
+
kind: "value",
|
|
6082
|
+
value: stored
|
|
6083
|
+
};
|
|
6084
|
+
try {
|
|
6085
|
+
await ctx.secrets.put(ref, intent.value);
|
|
6086
|
+
} catch (err) {
|
|
6087
|
+
throw new KeychainWriteRefusedError(fieldPath, err);
|
|
6088
|
+
}
|
|
6089
|
+
return {
|
|
6090
|
+
kind: "value",
|
|
6091
|
+
value: makeSecretMarker(ref)
|
|
6092
|
+
};
|
|
6093
|
+
}
|
|
6094
|
+
/** Apply a member result onto `out`: KEEP restores the stored member, or removes it. */
|
|
6095
|
+
function applyMember(out, key, result, storedParent) {
|
|
6096
|
+
if (result.kind === "value") {
|
|
6097
|
+
out[key] = result.value;
|
|
6098
|
+
return;
|
|
6099
|
+
}
|
|
6100
|
+
if (Object.prototype.hasOwnProperty.call(storedParent, key)) out[key] = storedParent[key];
|
|
6101
|
+
else delete out[key];
|
|
6102
|
+
}
|
|
6103
|
+
async function writeMembers(ctx, children, incoming, stored, pathOf) {
|
|
6104
|
+
const out = { ...incoming };
|
|
6105
|
+
for (const [member, node] of children) applyMember(out, member, await writeNode(ctx, node, incoming[member], stored[member], pathOf(member)), stored);
|
|
6106
|
+
return out;
|
|
6107
|
+
}
|
|
6108
|
+
function rowId(row, idKey) {
|
|
6109
|
+
const raw = row[idKey];
|
|
6110
|
+
if (typeof raw === "string" && raw.length > 0) return raw;
|
|
6111
|
+
if (typeof raw === "number" && Number.isFinite(raw)) return String(raw);
|
|
6112
|
+
return null;
|
|
6113
|
+
}
|
|
6114
|
+
async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
6115
|
+
const storedRows = Array.isArray(stored) ? stored.filter(isRecord) : [];
|
|
6116
|
+
if (!Array.isArray(incoming)) {
|
|
6117
|
+
ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
|
|
6118
|
+
return {
|
|
6119
|
+
kind: "value",
|
|
6120
|
+
value: incoming
|
|
6121
|
+
};
|
|
6122
|
+
}
|
|
6123
|
+
const storedById = /* @__PURE__ */ new Map();
|
|
6124
|
+
for (const row of storedRows) {
|
|
6125
|
+
const id = rowId(row, node.idKey);
|
|
6126
|
+
if (id !== null) storedById.set(id, row);
|
|
6127
|
+
}
|
|
6128
|
+
const kept = /* @__PURE__ */ new Set();
|
|
6129
|
+
const rows = [];
|
|
6130
|
+
for (const row of incoming) {
|
|
6131
|
+
if (!isRecord(row)) {
|
|
6132
|
+
rows.push(row);
|
|
6133
|
+
continue;
|
|
6134
|
+
}
|
|
6135
|
+
const id = rowId(row, node.idKey) ?? ctx.mintId();
|
|
6136
|
+
kept.add(id);
|
|
6137
|
+
const withId = {
|
|
6138
|
+
...row,
|
|
6139
|
+
[node.idKey]: row[node.idKey] ?? id
|
|
6140
|
+
};
|
|
6141
|
+
if (rowId(withId, node.idKey) === null) withId[node.idKey] = id;
|
|
6142
|
+
const storedRow = storedById.get(id) ?? {};
|
|
6143
|
+
rows.push(await writeMembers(ctx, node.item, withId, storedRow, (member) => arrayItemFieldPath(fieldPath, id, member)));
|
|
6144
|
+
}
|
|
6145
|
+
for (const [id, row] of storedById) if (!kept.has(id)) ctx.deletes.push(...collectSecretMarkerRefs(row));
|
|
6146
|
+
return {
|
|
6147
|
+
kind: "value",
|
|
6148
|
+
value: rows
|
|
6149
|
+
};
|
|
6150
|
+
}
|
|
6151
|
+
async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
6152
|
+
switch (node.kind) {
|
|
6153
|
+
case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
|
|
6154
|
+
case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
|
|
6155
|
+
case "object": {
|
|
6156
|
+
if (!isRecord(incoming)) {
|
|
6157
|
+
if (incoming === void 0) return KEEP;
|
|
6158
|
+
ctx.deletes.push(...collectSecretMarkerRefs(stored));
|
|
6159
|
+
return {
|
|
6160
|
+
kind: "value",
|
|
6161
|
+
value: incoming
|
|
6162
|
+
};
|
|
6163
|
+
}
|
|
6164
|
+
const storedObj = isRecord(stored) ? stored : {};
|
|
6165
|
+
return {
|
|
6166
|
+
kind: "value",
|
|
6167
|
+
value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
|
|
6168
|
+
};
|
|
6169
|
+
}
|
|
6170
|
+
}
|
|
6171
|
+
}
|
|
6172
|
+
/** Split a perNode-scoped key (`key@nodeId`). */
|
|
6173
|
+
function splitNodeKey(key) {
|
|
6174
|
+
const at = key.indexOf("@");
|
|
6175
|
+
return at <= 0 ? {
|
|
6176
|
+
base: key,
|
|
6177
|
+
nodeId: null
|
|
6178
|
+
} : {
|
|
6179
|
+
base: key.slice(0, at),
|
|
6180
|
+
nodeId: key.slice(at + 1)
|
|
6181
|
+
};
|
|
6182
|
+
}
|
|
6183
|
+
/** Rewrite a settings patch so no secret value reaches the blob. See the file doc. */
|
|
6184
|
+
async function transformSecretWrite(input) {
|
|
6185
|
+
const deletes = [];
|
|
6186
|
+
const base = {
|
|
6187
|
+
secrets: input.secrets,
|
|
6188
|
+
mintId: input.mintId ?? defaultMintId,
|
|
6189
|
+
deletes,
|
|
6190
|
+
operatorWrite: input.operatorWrite === true
|
|
6191
|
+
};
|
|
6192
|
+
const out = {};
|
|
6193
|
+
for (const [key, incoming] of Object.entries(input.patch)) {
|
|
6194
|
+
const { base: baseKey, nodeId } = splitNodeKey(key);
|
|
6195
|
+
const node = input.tree.get(baseKey);
|
|
6196
|
+
if (node === void 0) {
|
|
6197
|
+
out[key] = incoming;
|
|
6198
|
+
continue;
|
|
6199
|
+
}
|
|
6200
|
+
const scope = nodeId !== null && nodeId.length > 0 ? {
|
|
6201
|
+
kind: "node",
|
|
6202
|
+
nodeId
|
|
6203
|
+
} : input.scope ?? globalSecretScope();
|
|
6204
|
+
const result = await writeNode({
|
|
6205
|
+
...base,
|
|
6206
|
+
scope
|
|
6207
|
+
}, node, incoming, input.stored[key], baseKey);
|
|
6208
|
+
if (result.kind === "value") out[key] = result.value;
|
|
6209
|
+
}
|
|
6210
|
+
return {
|
|
6211
|
+
patch: out,
|
|
6212
|
+
afterWrite: async () => {
|
|
6213
|
+
if (deletes.length === 0) return { orphaned: [] };
|
|
6214
|
+
try {
|
|
6215
|
+
await input.secrets.delete([...new Set(deletes)]);
|
|
6216
|
+
return { orphaned: [] };
|
|
6217
|
+
} catch {
|
|
6218
|
+
return { orphaned: [...new Set(deletes)] };
|
|
6219
|
+
}
|
|
6220
|
+
}
|
|
6221
|
+
};
|
|
6222
|
+
}
|
|
6223
|
+
/**
|
|
6224
|
+
* Replace every marker in `value` with its keychain value. Returns the SAME
|
|
6225
|
+
* reference when there is no marker (no allocation, no keychain call).
|
|
6226
|
+
*/
|
|
6227
|
+
async function resolveSecretMarkers(value, secrets) {
|
|
6228
|
+
const refs = collectSecretMarkerRefs(value);
|
|
6229
|
+
if (refs.length === 0) return {
|
|
6230
|
+
value,
|
|
6231
|
+
unresolved: []
|
|
6232
|
+
};
|
|
6233
|
+
const answers = await secrets.resolve(refs);
|
|
6234
|
+
const unresolved = [];
|
|
6235
|
+
for (const ref of new Set(refs)) {
|
|
6236
|
+
const answer = answers[ref];
|
|
6237
|
+
if (answer === void 0) unresolved.push({
|
|
6238
|
+
ref,
|
|
6239
|
+
reason: "not-initialized"
|
|
6240
|
+
});
|
|
6241
|
+
else if (answer.kind === "unavailable") unresolved.push({
|
|
6242
|
+
ref,
|
|
6243
|
+
reason: answer.reason
|
|
6244
|
+
});
|
|
6245
|
+
else if (answer.kind === "missing" || answer.kind === "forbidden") unresolved.push({
|
|
6246
|
+
ref,
|
|
6247
|
+
reason: answer.kind
|
|
6248
|
+
});
|
|
6249
|
+
}
|
|
6250
|
+
const substitute = (v) => {
|
|
6251
|
+
if (isSecretMarker(v)) {
|
|
6252
|
+
const answer = answers[v.$secret];
|
|
6253
|
+
return answer?.kind === "value" ? {
|
|
6254
|
+
keep: true,
|
|
6255
|
+
value: answer.value
|
|
6256
|
+
} : {
|
|
6257
|
+
keep: false,
|
|
6258
|
+
value: void 0
|
|
6259
|
+
};
|
|
6260
|
+
}
|
|
6261
|
+
if (Array.isArray(v)) {
|
|
6262
|
+
const items = [];
|
|
6263
|
+
for (const item of v) {
|
|
6264
|
+
const s = substitute(item);
|
|
6265
|
+
if (s.keep) items.push(s.value);
|
|
6266
|
+
}
|
|
6267
|
+
return {
|
|
6268
|
+
keep: true,
|
|
6269
|
+
value: items
|
|
6270
|
+
};
|
|
6271
|
+
}
|
|
6272
|
+
if (isRecord(v)) {
|
|
6273
|
+
const out = {};
|
|
6274
|
+
for (const [k, child] of Object.entries(v)) {
|
|
6275
|
+
const s = substitute(child);
|
|
6276
|
+
if (s.keep) out[k] = s.value;
|
|
6277
|
+
}
|
|
6278
|
+
return {
|
|
6279
|
+
keep: true,
|
|
6280
|
+
value: out
|
|
6281
|
+
};
|
|
6282
|
+
}
|
|
6283
|
+
return {
|
|
6284
|
+
keep: true,
|
|
6285
|
+
value: v
|
|
6286
|
+
};
|
|
6287
|
+
};
|
|
6288
|
+
return {
|
|
6289
|
+
value: substitute(value).value,
|
|
6290
|
+
unresolved
|
|
6291
|
+
};
|
|
6292
|
+
}
|
|
6293
|
+
function touchesTree(tree, patch) {
|
|
6294
|
+
if (tree.size === 0) return false;
|
|
6295
|
+
for (const key of Object.keys(patch)) {
|
|
6296
|
+
const at = key.indexOf("@");
|
|
6297
|
+
if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
|
|
6298
|
+
}
|
|
6299
|
+
return false;
|
|
6300
|
+
}
|
|
6301
|
+
/** The blob as stored now; a failed read REFUSES the write instead of guessing. */
|
|
6302
|
+
async function readStoredAddonBlob(raw) {
|
|
6303
|
+
const threeWay = raw.readAddonStoreResult;
|
|
6304
|
+
if (threeWay === void 0) return raw.readAddonStore();
|
|
6305
|
+
const result = await threeWay.call(raw);
|
|
6306
|
+
if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
|
|
6307
|
+
return result.kind === "missing" ? {} : result.value;
|
|
6308
|
+
}
|
|
6309
|
+
function createSecretAwareSettings(raw, opts) {
|
|
6310
|
+
const chains = /* @__PURE__ */ new Map();
|
|
6311
|
+
const serialize = (key, fn) => {
|
|
6312
|
+
const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
|
|
6313
|
+
const tail = next.catch(() => void 0);
|
|
6314
|
+
chains.set(key, tail);
|
|
6315
|
+
tail.then(() => {
|
|
6316
|
+
if (chains.get(key) === tail) chains.delete(key);
|
|
6317
|
+
});
|
|
6318
|
+
return next;
|
|
6319
|
+
};
|
|
6320
|
+
const write = async (chainKey, tree, scope, patch, readStored, rawWrite) => {
|
|
6321
|
+
if (!touchesTree(tree, patch)) return rawWrite(patch);
|
|
6322
|
+
return serialize(chainKey, async () => {
|
|
6323
|
+
const stored = await readStored();
|
|
6324
|
+
const result = await transformSecretWrite({
|
|
6325
|
+
tree,
|
|
6326
|
+
secrets: opts.secrets,
|
|
6327
|
+
patch,
|
|
6328
|
+
stored,
|
|
6329
|
+
...scope !== void 0 ? { scope } : {},
|
|
6330
|
+
operatorWrite: opts.isOperatorWrite?.() === true
|
|
6331
|
+
});
|
|
6332
|
+
if (Object.keys(result.patch).length > 0) await rawWrite(result.patch);
|
|
6333
|
+
const { orphaned } = await result.afterWrite();
|
|
6334
|
+
if (orphaned.length > 0) opts.onOrphaned(orphaned);
|
|
6335
|
+
});
|
|
6336
|
+
};
|
|
6337
|
+
const wrapped = {
|
|
6338
|
+
writeAddonStore: (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p)),
|
|
6339
|
+
writeDeviceStore: (deviceId, patch) => write(`device:${deviceId}`, opts.deviceTree(), {
|
|
6340
|
+
kind: "device",
|
|
6341
|
+
deviceId
|
|
6342
|
+
}, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p))
|
|
6343
|
+
};
|
|
6344
|
+
return new Proxy(raw, { get(target, prop, receiver) {
|
|
6345
|
+
if (prop === "writeAddonStore") return wrapped.writeAddonStore;
|
|
6346
|
+
if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
|
|
6347
|
+
const value = Reflect.get(target, prop, receiver);
|
|
6348
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
6349
|
+
} });
|
|
6350
|
+
}
|
|
6351
|
+
/** The context the addon sees: identical, except that its settings writes are secret-aware. */
|
|
6352
|
+
function withSecretAwareSettings(context, opts) {
|
|
6353
|
+
const raw = context.settings;
|
|
6354
|
+
if (raw === void 0) return context;
|
|
6355
|
+
const settings = createSecretAwareSettings(raw, opts);
|
|
6356
|
+
return new Proxy(context, { get(target, prop, receiver) {
|
|
6357
|
+
if (prop === "settings") return settings;
|
|
6358
|
+
return Reflect.get(target, prop, receiver);
|
|
6359
|
+
} });
|
|
6360
|
+
}
|
|
6361
|
+
var LEAF = { kind: "leaf" };
|
|
6362
|
+
var DEFAULT_ITEM_ID_KEY = "id";
|
|
6363
|
+
function collectFields(fields, out) {
|
|
6364
|
+
for (const field of fields) {
|
|
6365
|
+
if (field.type === "group") {
|
|
6366
|
+
collectFields(field.fields, out);
|
|
6367
|
+
continue;
|
|
6368
|
+
}
|
|
6369
|
+
if (field.type === "sub-tabs") {
|
|
6370
|
+
for (const tab of field.tabs) collectFields(tab.fields, out);
|
|
6371
|
+
continue;
|
|
6372
|
+
}
|
|
6373
|
+
if (field.type === "editable-array") {
|
|
6374
|
+
const item = /* @__PURE__ */ new Map();
|
|
6375
|
+
for (const itemField of field.itemFields) if ("key" in itemField && isKeychainStoredField(itemField)) item.set(itemField.key, LEAF);
|
|
6376
|
+
if (item.size > 0) out.set(field.key, {
|
|
6377
|
+
kind: "array",
|
|
6378
|
+
idKey: field.itemIdKey ?? DEFAULT_ITEM_ID_KEY,
|
|
6379
|
+
item
|
|
6380
|
+
});
|
|
6381
|
+
continue;
|
|
6382
|
+
}
|
|
6383
|
+
if (!("key" in field) || typeof field.key !== "string") continue;
|
|
6384
|
+
if (isKeychainStoredField(field)) out.set(field.key, LEAF);
|
|
6385
|
+
}
|
|
6386
|
+
}
|
|
6387
|
+
/** The secret tree a settings schema declares. */
|
|
6388
|
+
function secretTreeFromSchema(schema) {
|
|
6389
|
+
const out = /* @__PURE__ */ new Map();
|
|
6390
|
+
if (schema === null) return out;
|
|
6391
|
+
for (const section of schema.sections) collectFields(section.fields, out);
|
|
6392
|
+
return out;
|
|
6393
|
+
}
|
|
6394
|
+
/** Parse `a.b[id].c` into segments; throws on a malformed path (a declaration bug). */
|
|
6395
|
+
function parseSecretStatePath(path) {
|
|
6396
|
+
const segments = [];
|
|
6397
|
+
for (const raw of path.split(".")) {
|
|
6398
|
+
const m = /^([^[\]]+)(?:\[([^[\]]+)\])?$/.exec(raw);
|
|
6399
|
+
if (m === null || m[1] === void 0) throw new Error(`secretStatePaths: malformed path "${path}"`);
|
|
6400
|
+
segments.push(m[2] !== void 0 ? {
|
|
6401
|
+
key: m[1],
|
|
6402
|
+
idKey: m[2]
|
|
6403
|
+
} : { key: m[1] });
|
|
6404
|
+
}
|
|
6405
|
+
if (segments.length === 0) throw new Error(`secretStatePaths: empty path`);
|
|
6406
|
+
if (segments[segments.length - 1]?.idKey !== void 0) throw new Error(`secretStatePaths: "${path}" ends on an array — name the member that is secret`);
|
|
6407
|
+
return segments;
|
|
6408
|
+
}
|
|
6409
|
+
function insert(into, segments) {
|
|
6410
|
+
const [head, ...rest] = segments;
|
|
6411
|
+
if (head === void 0) return;
|
|
6412
|
+
if (rest.length === 0) {
|
|
6413
|
+
into.set(head.key, LEAF);
|
|
6414
|
+
return;
|
|
6415
|
+
}
|
|
6416
|
+
const existing = into.get(head.key);
|
|
6417
|
+
if (head.idKey !== void 0) {
|
|
6418
|
+
const item = new Map(existing?.kind === "array" ? existing.item : []);
|
|
6419
|
+
insert(item, rest);
|
|
6420
|
+
into.set(head.key, {
|
|
6421
|
+
kind: "array",
|
|
6422
|
+
idKey: head.idKey,
|
|
6423
|
+
item
|
|
6424
|
+
});
|
|
6425
|
+
return;
|
|
6426
|
+
}
|
|
6427
|
+
const children = new Map(existing?.kind === "object" ? existing.children : []);
|
|
6428
|
+
insert(children, rest);
|
|
6429
|
+
into.set(head.key, {
|
|
6430
|
+
kind: "object",
|
|
6431
|
+
children
|
|
6432
|
+
});
|
|
6433
|
+
}
|
|
6434
|
+
/** Add hidden-state paths (`secretStatePaths`) to a schema-derived tree. */
|
|
6435
|
+
function mergeSecretStatePaths(tree, paths) {
|
|
6436
|
+
if (paths.length === 0) return tree;
|
|
6437
|
+
const out = new Map(tree);
|
|
6438
|
+
for (const path of paths) insert(out, parseSecretStatePath(path));
|
|
6439
|
+
return out;
|
|
6440
|
+
}
|
|
6441
|
+
/** First retry of a secret the keychain could not serve; doubles to {@link SECRET_RETRY_MAX_MS}. */
|
|
6442
|
+
var SECRET_RETRY_FIRST_MS = 5e3;
|
|
6443
|
+
var SECRET_RETRY_MAX_MS = 5 * 6e4;
|
|
6444
|
+
/** Coalesces a burst of `keychain.changed` events into one re-resolve. */
|
|
6445
|
+
var SECRET_CHANGE_DEBOUNCE_MS = 250;
|
|
5910
6446
|
/**
|
|
5911
6447
|
* Base class for CamStack addons. Eliminates settings boilerplate:
|
|
5912
6448
|
*
|
|
@@ -5976,6 +6512,25 @@ var BaseAddon = class {
|
|
|
5976
6512
|
settingsStoreReady = false;
|
|
5977
6513
|
/** Default config values. Provided via constructor. */
|
|
5978
6514
|
defaults;
|
|
6515
|
+
/**
|
|
6516
|
+
* Hidden-state paths that hold secrets (D787) — values the addon writes
|
|
6517
|
+
* itself (`updateGlobalSettings`, `state()`) that no form field declares.
|
|
6518
|
+
* Stored in the keychain exactly like a `password` field. Syntax:
|
|
6519
|
+
* `'snapshotSigningKey'`, `'identity.pincode'`, `'tokens[userId].accessToken'`
|
|
6520
|
+
* (`key[<id field>]` addresses array items by id, never by index).
|
|
6521
|
+
*/
|
|
6522
|
+
secretStatePaths = [];
|
|
6523
|
+
_addonSecretTree = null;
|
|
6524
|
+
_deviceSecretTree = null;
|
|
6525
|
+
/** Refs the last resolved config pointed at — a change to one re-resolves. */
|
|
6526
|
+
_configSecretRefs = /* @__PURE__ */ new Set();
|
|
6527
|
+
_unresolvedSecrets = [];
|
|
6528
|
+
_secretRetryTimer = null;
|
|
6529
|
+
_secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
|
|
6530
|
+
_secretChangeTimer = null;
|
|
6531
|
+
_secretChangeUnsub = null;
|
|
6532
|
+
/** >0 while an OPERATOR's settings write is being applied. */
|
|
6533
|
+
_operatorWriteDepth = 0;
|
|
5979
6534
|
constructor(defaults) {
|
|
5980
6535
|
this.defaults = defaults;
|
|
5981
6536
|
this._config = { ...defaults };
|
|
@@ -6011,8 +6566,18 @@ var BaseAddon = class {
|
|
|
6011
6566
|
return this._config;
|
|
6012
6567
|
}
|
|
6013
6568
|
async initialize(context) {
|
|
6014
|
-
|
|
6569
|
+
const secrets = context.secrets;
|
|
6570
|
+
this._ctx = secrets !== void 0 ? withSecretAwareSettings(context, {
|
|
6571
|
+
secrets,
|
|
6572
|
+
addonTree: () => this.addonSecretTree(),
|
|
6573
|
+
deviceTree: () => this.deviceSecretTree(),
|
|
6574
|
+
onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
|
|
6575
|
+
isOperatorWrite: () => this._operatorWriteDepth > 0
|
|
6576
|
+
}) : context;
|
|
6015
6577
|
await this.resolveConfig();
|
|
6578
|
+
if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
|
|
6579
|
+
if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
|
|
6580
|
+
});
|
|
6016
6581
|
const result = await this.onInitialize();
|
|
6017
6582
|
this.emitLifecycle(EventCategory.AddonStarted);
|
|
6018
6583
|
const normalized = normalizeAddonInitResult(result);
|
|
@@ -6045,6 +6610,12 @@ var BaseAddon = class {
|
|
|
6045
6610
|
*/
|
|
6046
6611
|
async onHubReachable() {}
|
|
6047
6612
|
async shutdown() {
|
|
6613
|
+
this._secretChangeUnsub?.();
|
|
6614
|
+
this._secretChangeUnsub = null;
|
|
6615
|
+
if (this._secretRetryTimer !== null) clearTimeout(this._secretRetryTimer);
|
|
6616
|
+
if (this._secretChangeTimer !== null) clearTimeout(this._secretChangeTimer);
|
|
6617
|
+
this._secretRetryTimer = null;
|
|
6618
|
+
this._secretChangeTimer = null;
|
|
6048
6619
|
this.emitLifecycle(EventCategory.AddonStopped);
|
|
6049
6620
|
if (this.autoEmitReadiness) this.emitReadinessForProviders("down");
|
|
6050
6621
|
await this.onShutdown();
|
|
@@ -6123,7 +6694,7 @@ var BaseAddon = class {
|
|
|
6123
6694
|
return hydrateSchema(schema, overlay ? {
|
|
6124
6695
|
...projected,
|
|
6125
6696
|
...overlay
|
|
6126
|
-
} : projected);
|
|
6697
|
+
} : projected, { inlineSecretsAsViews: true });
|
|
6127
6698
|
}
|
|
6128
6699
|
/**
|
|
6129
6700
|
* The integration-level view of this addon's settings: exactly the sections
|
|
@@ -6172,7 +6743,7 @@ var BaseAddon = class {
|
|
|
6172
6743
|
return hydrateSchema({
|
|
6173
6744
|
...schema,
|
|
6174
6745
|
sections
|
|
6175
|
-
}, projected);
|
|
6746
|
+
}, projected, { inlineSecretsAsViews: true });
|
|
6176
6747
|
}
|
|
6177
6748
|
/**
|
|
6178
6749
|
* The raw addon store PROJECTED onto the target node's bare per-node keys:
|
|
@@ -6226,18 +6797,50 @@ var BaseAddon = class {
|
|
|
6226
6797
|
value: result.value[key]
|
|
6227
6798
|
};
|
|
6228
6799
|
}
|
|
6800
|
+
/**
|
|
6801
|
+
* The OPERATOR's write — a settings form or an admin API call, dispatched by
|
|
6802
|
+
* the kernel. Identical to {@link updateGlobalSettings}, except that a secret
|
|
6803
|
+
* the operator sends is stored as sent even when it equals a pre-keychain
|
|
6804
|
+
* inline value: the operator re-entering a password is a change, an addon
|
|
6805
|
+
* writing back what it read is not (D787).
|
|
6806
|
+
*/
|
|
6807
|
+
async updateGlobalSettingsAsOperator(patch, nodeId) {
|
|
6808
|
+
this._operatorWriteDepth++;
|
|
6809
|
+
try {
|
|
6810
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
6811
|
+
} finally {
|
|
6812
|
+
this._operatorWriteDepth--;
|
|
6813
|
+
}
|
|
6814
|
+
}
|
|
6229
6815
|
async updateGlobalSettings(patch, nodeId) {
|
|
6816
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
6817
|
+
}
|
|
6818
|
+
/**
|
|
6819
|
+
* REMOVE stored secrets — their keychain values and their markers (D787).
|
|
6820
|
+
*
|
|
6821
|
+
* Writing `''` to a secret field KEEPS what is stored (an empty string is
|
|
6822
|
+
* what a defaults fallback writes back, and it must never destroy a
|
|
6823
|
+
* credential), so code that means "forget this token" says so here. Without
|
|
6824
|
+
* a keychain (an older kernel) it writes `''`, as such code always did.
|
|
6825
|
+
*/
|
|
6826
|
+
async clearSecrets(keys, nodeId) {
|
|
6827
|
+
const tree = this.addonSecretTree();
|
|
6828
|
+
const keychain = this._ctx?.secrets !== void 0;
|
|
6829
|
+
const patch = {};
|
|
6830
|
+
for (const key of keys) patch[key] = keychain && tree.has(key) ? SECRET_CLEAR : "";
|
|
6831
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
6832
|
+
}
|
|
6833
|
+
async applyGlobalPatch(barePatch, nodeId) {
|
|
6230
6834
|
const keys = this.perNodeKeys();
|
|
6231
6835
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
6232
6836
|
const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
6233
|
-
const barePatch = patch;
|
|
6234
6837
|
const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
|
|
6235
6838
|
await this._ctx?.settings?.writeAddonStore(scoped);
|
|
6236
6839
|
if (target !== localNode) return;
|
|
6237
6840
|
await this.resolveConfig();
|
|
6238
6841
|
await this.onConfigChanged();
|
|
6239
6842
|
this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
|
|
6240
|
-
this.maybeAutoRestart(
|
|
6843
|
+
this.maybeAutoRestart(Object.keys(barePatch), this.globalSettingsSchema());
|
|
6241
6844
|
}
|
|
6242
6845
|
/**
|
|
6243
6846
|
* The set of field keys the global settings schema declares `perNode: true`
|
|
@@ -6262,7 +6865,7 @@ var BaseAddon = class {
|
|
|
6262
6865
|
* time to return its response before the addon is torn down and
|
|
6263
6866
|
* re-initialised by `AddonRegistryService.restartAddon`.
|
|
6264
6867
|
*/
|
|
6265
|
-
maybeAutoRestart(
|
|
6868
|
+
maybeAutoRestart(patchKeys, schema) {
|
|
6266
6869
|
if (!schema) return;
|
|
6267
6870
|
const restartKeys = /* @__PURE__ */ new Set();
|
|
6268
6871
|
for (const section of schema.sections) for (const field of section.fields) {
|
|
@@ -6270,13 +6873,13 @@ var BaseAddon = class {
|
|
|
6270
6873
|
if (field.requiresRestart) restartKeys.add(field.key);
|
|
6271
6874
|
}
|
|
6272
6875
|
if (restartKeys.size === 0) return;
|
|
6273
|
-
if (!
|
|
6876
|
+
if (!patchKeys.some((k) => restartKeys.has(k))) return;
|
|
6274
6877
|
const ctx = this._ctx;
|
|
6275
6878
|
if (!ctx) return;
|
|
6276
6879
|
const addonId = ctx.id;
|
|
6277
6880
|
setImmediate(() => {
|
|
6278
6881
|
ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
|
|
6279
|
-
ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields:
|
|
6882
|
+
ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
|
|
6280
6883
|
}).catch((err) => {
|
|
6281
6884
|
ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
6282
6885
|
});
|
|
@@ -6285,7 +6888,7 @@ var BaseAddon = class {
|
|
|
6285
6888
|
async getDeviceSettings(deviceId) {
|
|
6286
6889
|
const schema = this.deviceSettingsSchema();
|
|
6287
6890
|
if (!schema) return { sections: [] };
|
|
6288
|
-
return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {});
|
|
6891
|
+
return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
|
|
6289
6892
|
}
|
|
6290
6893
|
async updateDeviceSettings(deviceId, patch) {
|
|
6291
6894
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
@@ -6415,7 +7018,7 @@ var BaseAddon = class {
|
|
|
6415
7018
|
* selection at boot (absent scoped key ⇒ the constructor default wins).
|
|
6416
7019
|
*/
|
|
6417
7020
|
async resolveConfig() {
|
|
6418
|
-
const stored = await this.readAddonStoreWithRetry();
|
|
7021
|
+
const stored = await this.resolveStoredSecrets(await this.readAddonStoreWithRetry());
|
|
6419
7022
|
const perNode = this.perNodeKeys();
|
|
6420
7023
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
6421
7024
|
const resolved = { ...this.defaults };
|
|
@@ -6440,7 +7043,7 @@ var BaseAddon = class {
|
|
|
6440
7043
|
key,
|
|
6441
7044
|
schema,
|
|
6442
7045
|
fallback,
|
|
6443
|
-
read: () => this.readAddonStoreWithRetry(),
|
|
7046
|
+
read: async () => this.resolveStoredSecrets(await this.readAddonStoreWithRetry()),
|
|
6444
7047
|
write: async (patch) => {
|
|
6445
7048
|
await this._ctx?.settings?.writeAddonStore(patch);
|
|
6446
7049
|
},
|
|
@@ -6457,7 +7060,7 @@ var BaseAddon = class {
|
|
|
6457
7060
|
key,
|
|
6458
7061
|
schema,
|
|
6459
7062
|
fallback,
|
|
6460
|
-
read: async () => await this._ctx?.settings?.readDeviceStore(deviceId) ?? {},
|
|
7063
|
+
read: async () => this.resolveStoredSecrets(await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, false),
|
|
6461
7064
|
write: async (patch) => {
|
|
6462
7065
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
6463
7066
|
},
|
|
@@ -6469,6 +7072,70 @@ var BaseAddon = class {
|
|
|
6469
7072
|
} })
|
|
6470
7073
|
});
|
|
6471
7074
|
}
|
|
7075
|
+
/** The addon store's secret tree: schema fields by TYPE, plus `secretStatePaths`. */
|
|
7076
|
+
addonSecretTree() {
|
|
7077
|
+
this._addonSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.globalSettingsSchema()), this.secretStatePaths);
|
|
7078
|
+
return this._addonSecretTree;
|
|
7079
|
+
}
|
|
7080
|
+
deviceSecretTree() {
|
|
7081
|
+
this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
|
|
7082
|
+
return this._deviceSecretTree;
|
|
7083
|
+
}
|
|
7084
|
+
/**
|
|
7085
|
+
* Secrets of this addon's stored config that could not be resolved on the
|
|
7086
|
+
* last read, with why. Non-empty means the addon is running WITHOUT them —
|
|
7087
|
+
* an addon whose function needs one should report itself degraded rather
|
|
7088
|
+
* than start on an empty credential.
|
|
7089
|
+
*/
|
|
7090
|
+
get unresolvedSecrets() {
|
|
7091
|
+
return this._unresolvedSecrets;
|
|
7092
|
+
}
|
|
7093
|
+
/**
|
|
7094
|
+
* Substitute every keychain marker in a stored blob with its value. With no
|
|
7095
|
+
* keychain (no `ctx.secrets`) or no marker, the blob comes back unchanged.
|
|
7096
|
+
* An unresolvable value is LEFT OUT (never `''`), logged by ref — never by
|
|
7097
|
+
* value — and, when the cause can pass, retried with backoff. Nothing is
|
|
7098
|
+
* ever written back from here.
|
|
7099
|
+
*/
|
|
7100
|
+
async resolveStoredSecrets(blob, trackForConfig = true) {
|
|
7101
|
+
const secrets = this._ctx?.secrets;
|
|
7102
|
+
if (secrets === void 0) return blob;
|
|
7103
|
+
const refs = collectSecretMarkerRefs(blob);
|
|
7104
|
+
if (trackForConfig) this._configSecretRefs = new Set(refs);
|
|
7105
|
+
if (refs.length === 0) {
|
|
7106
|
+
if (trackForConfig) this._unresolvedSecrets = [];
|
|
7107
|
+
return blob;
|
|
7108
|
+
}
|
|
7109
|
+
const { value, unresolved } = await resolveSecretMarkers(blob, secrets);
|
|
7110
|
+
if (trackForConfig) {
|
|
7111
|
+
this._unresolvedSecrets = unresolved;
|
|
7112
|
+
if (unresolved.length > 0) {
|
|
7113
|
+
this._ctx?.logger?.error?.("secret unavailable — running without it, will retry", { meta: { secrets: unresolved.map((u) => ({
|
|
7114
|
+
ref: u.ref,
|
|
7115
|
+
reason: u.reason
|
|
7116
|
+
})) } });
|
|
7117
|
+
if (unresolved.some((u) => u.reason !== "missing" && u.reason !== "forbidden")) {
|
|
7118
|
+
this.scheduleSecretReresolve(this._secretRetryDelayMs);
|
|
7119
|
+
this._secretRetryDelayMs = Math.min(this._secretRetryDelayMs * 2, SECRET_RETRY_MAX_MS);
|
|
7120
|
+
}
|
|
7121
|
+
} else this._secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
|
|
7122
|
+
}
|
|
7123
|
+
return value;
|
|
7124
|
+
}
|
|
7125
|
+
/** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
|
|
7126
|
+
scheduleSecretReresolve(delayMs) {
|
|
7127
|
+
const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
|
|
7128
|
+
if (this[timerOf] !== null) return;
|
|
7129
|
+
const timer = setTimeout(() => {
|
|
7130
|
+
this[timerOf] = null;
|
|
7131
|
+
if (this._ctx === null) return;
|
|
7132
|
+
this.resolveConfig().then(() => this.onConfigChanged()).catch((err) => {
|
|
7133
|
+
this._ctx?.logger?.error?.("re-resolving secrets failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
7134
|
+
});
|
|
7135
|
+
}, delayMs);
|
|
7136
|
+
timer.unref?.();
|
|
7137
|
+
this[timerOf] = timer;
|
|
7138
|
+
}
|
|
6472
7139
|
/**
|
|
6473
7140
|
* Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
|
|
6474
7141
|
* transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
|
|
@@ -7044,6 +7711,69 @@ method(object({ deviceId: number() }), array(StreamSourceEntrySchema)), method(o
|
|
|
7044
7711
|
kind: "mutation",
|
|
7045
7712
|
auth: "admin"
|
|
7046
7713
|
}), method(object({ deviceId: number() }), unknown().nullable()), method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" });
|
|
7714
|
+
function defOf(schema) {
|
|
7715
|
+
return schema._zod?.def ?? {};
|
|
7716
|
+
}
|
|
7717
|
+
function declaredHere(schema) {
|
|
7718
|
+
return globalRegistry.get(schema)?.secret === true;
|
|
7719
|
+
}
|
|
7720
|
+
/** Wrapper kinds whose `innerType` is the field itself. */
|
|
7721
|
+
var WRAPPERS = new Set([
|
|
7722
|
+
"optional",
|
|
7723
|
+
"nullable",
|
|
7724
|
+
"default",
|
|
7725
|
+
"prefault",
|
|
7726
|
+
"catch",
|
|
7727
|
+
"readonly",
|
|
7728
|
+
"nonoptional"
|
|
7729
|
+
]);
|
|
7730
|
+
/**
|
|
7731
|
+
* The schema layers that make up ONE field: the schema itself and every
|
|
7732
|
+
* wrapper below it (optional / default / nullable / readonly / catch), plus
|
|
7733
|
+
* both sides of a pipe (`z.preprocess` puts the real schema on `out`,
|
|
7734
|
+
* `.transform` on `in`).
|
|
7735
|
+
*/
|
|
7736
|
+
function layersOf(schema) {
|
|
7737
|
+
const out = [];
|
|
7738
|
+
const queue = [schema];
|
|
7739
|
+
while (queue.length > 0) {
|
|
7740
|
+
const s = queue.shift();
|
|
7741
|
+
if (!s || out.includes(s)) continue;
|
|
7742
|
+
out.push(s);
|
|
7743
|
+
const def = defOf(s);
|
|
7744
|
+
if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
|
|
7745
|
+
if (def.type === "pipe") {
|
|
7746
|
+
if (def.in) queue.push(def.in);
|
|
7747
|
+
if (def.out) queue.push(def.out);
|
|
7748
|
+
}
|
|
7749
|
+
}
|
|
7750
|
+
return out;
|
|
7751
|
+
}
|
|
7752
|
+
/** True when any layer of this field declares `.meta({ secret: true })`. */
|
|
7753
|
+
function isZodSecret(schema) {
|
|
7754
|
+
return layersOf(schema).some(declaredHere);
|
|
7755
|
+
}
|
|
7756
|
+
/**
|
|
7757
|
+
* Every declared secret path in a config schema: dotted keys, `[]` for "each
|
|
7758
|
+
* element of this array" (`connection.password`, `rows[].token`). A declared
|
|
7759
|
+
* object or array is reported as one path and not descended into — everything
|
|
7760
|
+
* under it is secret.
|
|
7761
|
+
*/
|
|
7762
|
+
function collectZodSecretPaths(schema, prefix = "") {
|
|
7763
|
+
if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
|
|
7764
|
+
const paths = [];
|
|
7765
|
+
for (const layer of layersOf(schema)) {
|
|
7766
|
+
const def = defOf(layer);
|
|
7767
|
+
if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
|
|
7768
|
+
else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
|
|
7769
|
+
else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
|
|
7770
|
+
else if (def.type === "intersection") {
|
|
7771
|
+
if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
|
|
7772
|
+
if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
|
|
7773
|
+
}
|
|
7774
|
+
}
|
|
7775
|
+
return [...new Set(paths)];
|
|
7776
|
+
}
|
|
7047
7777
|
//#endregion
|
|
7048
7778
|
//#region ../types/dist/err-msg-DX6i_MY4.mjs
|
|
7049
7779
|
var DeviceType = /* @__PURE__ */ function(DeviceType) {
|
|
@@ -14074,6 +14804,196 @@ id: union([string(), number()]) }), {
|
|
|
14074
14804
|
kind: "mutation",
|
|
14075
14805
|
auth: "admin"
|
|
14076
14806
|
});
|
|
14807
|
+
/**
|
|
14808
|
+
* `keychain` — the hub's encrypted store of secret values (D787).
|
|
14809
|
+
*
|
|
14810
|
+
* Settings blobs never hold a secret: they hold a marker
|
|
14811
|
+
* `{"$secret":"secret://<owner>/<scope>/<fieldPath>","v":1}` and the value
|
|
14812
|
+
* lives here, AES-256-GCM under a data key that a master key wraps. This cap
|
|
14813
|
+
* is the OWNER's door to its own values: every method is owner-checked
|
|
14814
|
+
* against the CALLER, never against anything the caller claims.
|
|
14815
|
+
*
|
|
14816
|
+
* Who the caller is: the transport stamps `callerAddonId` into the args of a
|
|
14817
|
+
* call that crossed a process (the parent `LocalChildRegistry` from the UDS
|
|
14818
|
+
* connection, the agent from its child's connection carried in
|
|
14819
|
+
* `$hub-cap-fwd`'s envelope). A stamp always overwrites; a wire call with no
|
|
14820
|
+
* stamp has its claim stripped. Only a hub in-process caller may state its own
|
|
14821
|
+
* identity — `ctx.secrets` does that with the addon id closed over. This is
|
|
14822
|
+
* identity against BUGS and misrouting, not against a malicious addon (every
|
|
14823
|
+
* runner is the same OS user): see the threat model in
|
|
14824
|
+
* `docs/design/2026-10-08-secrets-keychain.md`.
|
|
14825
|
+
*
|
|
14826
|
+
* `callerAddonId` is deliberately NOT in any input schema: the tRPC router
|
|
14827
|
+
* parses the input, so a session can never supply it, and the internal mount
|
|
14828
|
+
* floors every method to admin anyway (D240).
|
|
14829
|
+
*
|
|
14830
|
+
* Internal: addons reach it through `ctx.secrets`, never directly.
|
|
14831
|
+
*/
|
|
14832
|
+
/** Why a value cannot be served right now. Never folded into "missing". */
|
|
14833
|
+
var KeychainUnavailableReasonSchema = _enum([
|
|
14834
|
+
"key-missing",
|
|
14835
|
+
"wrong-key",
|
|
14836
|
+
"key-file-unreadable",
|
|
14837
|
+
"store-unavailable",
|
|
14838
|
+
"not-initialized",
|
|
14839
|
+
"decrypt-failed"
|
|
14840
|
+
]);
|
|
14841
|
+
var KeychainStateSchema = discriminatedUnion("state", [object({ state: literal("ready") }), object({
|
|
14842
|
+
state: literal("locked"),
|
|
14843
|
+
reason: KeychainUnavailableReasonSchema
|
|
14844
|
+
})]);
|
|
14845
|
+
var KeychainResolveEntrySchema = discriminatedUnion("kind", [
|
|
14846
|
+
object({
|
|
14847
|
+
kind: literal("value"),
|
|
14848
|
+
value: string(),
|
|
14849
|
+
version: number().int()
|
|
14850
|
+
}),
|
|
14851
|
+
object({ kind: literal("missing") }),
|
|
14852
|
+
object({
|
|
14853
|
+
kind: literal("unavailable"),
|
|
14854
|
+
reason: KeychainUnavailableReasonSchema
|
|
14855
|
+
}),
|
|
14856
|
+
object({ kind: literal("forbidden") })
|
|
14857
|
+
]);
|
|
14858
|
+
var KeychainResolveResultSchema = record(string(), KeychainResolveEntrySchema);
|
|
14859
|
+
/** Metadata of one stored value — never the value. */
|
|
14860
|
+
var KeychainSecretMetaSchema = object({
|
|
14861
|
+
ref: string(),
|
|
14862
|
+
owner: string(),
|
|
14863
|
+
/** Formatted scope (`global`, `node/<id>`, `device/<id>`, …). */
|
|
14864
|
+
scope: string(),
|
|
14865
|
+
fieldPath: string(),
|
|
14866
|
+
version: number().int(),
|
|
14867
|
+
createdAt: number(),
|
|
14868
|
+
updatedAt: number(),
|
|
14869
|
+
/** `addon:<id>` | `user:<id>` | `system`. */
|
|
14870
|
+
updatedBy: string(),
|
|
14871
|
+
/** Coarse — written at most once an hour per ref. `null` = never read. */
|
|
14872
|
+
lastReadAt: number().nullable()
|
|
14873
|
+
});
|
|
14874
|
+
var RefListSchema = array(string().min(1)).max(512);
|
|
14875
|
+
method(object({
|
|
14876
|
+
ref: string().min(1),
|
|
14877
|
+
value: string().min(1)
|
|
14878
|
+
}), object({
|
|
14879
|
+
ref: string(),
|
|
14880
|
+
version: number().int()
|
|
14881
|
+
}), {
|
|
14882
|
+
kind: "mutation",
|
|
14883
|
+
auth: "admin"
|
|
14884
|
+
}), method(object({ refs: RefListSchema }), KeychainResolveResultSchema, { auth: "admin" }), method(object({ refs: RefListSchema }), object({ deleted: number().int() }), {
|
|
14885
|
+
kind: "mutation",
|
|
14886
|
+
auth: "admin"
|
|
14887
|
+
}), method(object({}), array(KeychainSecretMetaSchema).readonly(), { auth: "admin" }), method(object({}), KeychainStateSchema, { auth: "admin" });
|
|
14888
|
+
var KeychainKeySourceSchema = object({
|
|
14889
|
+
kind: _enum([
|
|
14890
|
+
"config-file",
|
|
14891
|
+
"previous-config-file",
|
|
14892
|
+
"platform",
|
|
14893
|
+
"default-file"
|
|
14894
|
+
]),
|
|
14895
|
+
/** File sources only — a path is not a secret. */
|
|
14896
|
+
path: string().optional(),
|
|
14897
|
+
/**
|
|
14898
|
+
* True when a whole-volume backup of the data directory carries this key
|
|
14899
|
+
* next to the database it protects (the default file). The page warns.
|
|
14900
|
+
*/
|
|
14901
|
+
sharesBackupWithDatabase: boolean()
|
|
14902
|
+
});
|
|
14903
|
+
var KeychainStatusSchema = object({
|
|
14904
|
+
keychain: KeychainStateSchema,
|
|
14905
|
+
/** The source of the master key in use; `null` while locked. */
|
|
14906
|
+
keySource: KeychainKeySourceSchema.nullable(),
|
|
14907
|
+
/** The source configured to be primary — differs from `keySource` while a rotation is pending. */
|
|
14908
|
+
configuredSource: KeychainKeySourceSchema,
|
|
14909
|
+
/** Short fingerprint of the master key in use (`HMAC(KEK, label)`, 16 hex). */
|
|
14910
|
+
fingerprint: string().nullable(),
|
|
14911
|
+
activeKeyId: string().nullable(),
|
|
14912
|
+
/**
|
|
14913
|
+
* The keychain unlocked with a NON-primary source: the configured primary
|
|
14914
|
+
* key is not the one that wraps the data key yet. `rotateMasterKey` moves it.
|
|
14915
|
+
*/
|
|
14916
|
+
rotationPending: boolean(),
|
|
14917
|
+
/** Wrapped copies of the data key under a previous master key, kept until purged. */
|
|
14918
|
+
retiredWraps: number().int(),
|
|
14919
|
+
recoveryKeyDownloadedAt: number().nullable(),
|
|
14920
|
+
secretCount: number().int()
|
|
14921
|
+
});
|
|
14922
|
+
/**
|
|
14923
|
+
* Whether a stored value is still pointed at by its owner's settings.
|
|
14924
|
+
* `unknown` is a first-class answer: a scope whose blob could not be read is
|
|
14925
|
+
* never reported as an orphan (and never deleted as one).
|
|
14926
|
+
*/
|
|
14927
|
+
var KeychainSecretUsageSchema = _enum([
|
|
14928
|
+
"in-use",
|
|
14929
|
+
"orphan",
|
|
14930
|
+
"unknown"
|
|
14931
|
+
]);
|
|
14932
|
+
var KeychainAdminSecretSchema = KeychainSecretMetaSchema.extend({ usage: KeychainSecretUsageSchema });
|
|
14933
|
+
var KeychainAuditActionSchema = _enum([
|
|
14934
|
+
"put",
|
|
14935
|
+
"delete",
|
|
14936
|
+
"reveal",
|
|
14937
|
+
"rotate-master-key",
|
|
14938
|
+
"purge-retired-keys",
|
|
14939
|
+
"download-recovery-key",
|
|
14940
|
+
"delete-orphans",
|
|
14941
|
+
"reset",
|
|
14942
|
+
"initialize"
|
|
14943
|
+
]);
|
|
14944
|
+
var KeychainAuditEntrySchema = object({
|
|
14945
|
+
id: string(),
|
|
14946
|
+
at: number(),
|
|
14947
|
+
action: KeychainAuditActionSchema,
|
|
14948
|
+
/** `addon:<id>` | `user:<id>` | `system`. */
|
|
14949
|
+
actor: string(),
|
|
14950
|
+
ref: string().nullable(),
|
|
14951
|
+
detail: string().nullable()
|
|
14952
|
+
});
|
|
14953
|
+
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({
|
|
14954
|
+
value: string(),
|
|
14955
|
+
version: number().int()
|
|
14956
|
+
}), {
|
|
14957
|
+
kind: "mutation",
|
|
14958
|
+
auth: "admin",
|
|
14959
|
+
caller: "required"
|
|
14960
|
+
}), method(object({ refs: array(string().min(1)).max(1e3) }), object({
|
|
14961
|
+
deleted: array(string()).readonly(),
|
|
14962
|
+
kept: array(object({
|
|
14963
|
+
ref: string(),
|
|
14964
|
+
usage: KeychainSecretUsageSchema
|
|
14965
|
+
})).readonly()
|
|
14966
|
+
}), {
|
|
14967
|
+
kind: "mutation",
|
|
14968
|
+
auth: "admin",
|
|
14969
|
+
caller: "required"
|
|
14970
|
+
}), method(object({}), object({
|
|
14971
|
+
fingerprint: string(),
|
|
14972
|
+
keySource: KeychainKeySourceSchema
|
|
14973
|
+
}), {
|
|
14974
|
+
kind: "mutation",
|
|
14975
|
+
auth: "admin",
|
|
14976
|
+
caller: "required"
|
|
14977
|
+
}), method(object({}), object({ purged: number().int() }), {
|
|
14978
|
+
kind: "mutation",
|
|
14979
|
+
auth: "admin",
|
|
14980
|
+
caller: "required"
|
|
14981
|
+
}), method(object({}), object({
|
|
14982
|
+
key: string(),
|
|
14983
|
+
fingerprint: string(),
|
|
14984
|
+
keySource: KeychainKeySourceSchema
|
|
14985
|
+
}), {
|
|
14986
|
+
kind: "mutation",
|
|
14987
|
+
auth: "admin",
|
|
14988
|
+
caller: "required"
|
|
14989
|
+
}), method(object({ confirm: literal("RESET KEYCHAIN") }), object({
|
|
14990
|
+
archivedCollection: string().nullable(),
|
|
14991
|
+
archived: number().int()
|
|
14992
|
+
}), {
|
|
14993
|
+
kind: "mutation",
|
|
14994
|
+
auth: "admin",
|
|
14995
|
+
caller: "required"
|
|
14996
|
+
});
|
|
14077
14997
|
method(_void(), object({
|
|
14078
14998
|
id: string(),
|
|
14079
14999
|
name: string(),
|
|
@@ -15192,6 +16112,10 @@ var DeviceInfoSchema = object({
|
|
|
15192
16112
|
isCamera: boolean(),
|
|
15193
16113
|
/** Current config values — serializable snapshot */
|
|
15194
16114
|
config: record(string(), unknown()),
|
|
16115
|
+
/** Paths inside `config` the device's schema declares secret (D783) —
|
|
16116
|
+
* what the non-admin redaction withholds. Paths, never values. Absent
|
|
16117
|
+
* when the owning runner has not reported them. */
|
|
16118
|
+
secretConfigPaths: array(string()).optional(),
|
|
15195
16119
|
/** Hardware + identity blob (manufacturer / model / firmware / sn /
|
|
15196
16120
|
* uid / mac / …). Populated by drivers; editable via setMetadata. */
|
|
15197
16121
|
metadata: record(string(), unknown()).nullable().optional(),
|
|
@@ -15397,12 +16321,22 @@ var DeviceRegisterPayloadSchema = object({
|
|
|
15397
16321
|
* call (workers re-register on init), so probe-driven updates
|
|
15398
16322
|
* (e.g. PTZ flag flipping after the abilities probe) propagate. */
|
|
15399
16323
|
features: array(string()).optional(),
|
|
15400
|
-
config: record(string(), unknown())
|
|
16324
|
+
config: record(string(), unknown()),
|
|
16325
|
+
/** Config paths the device's own schema DECLARES secret
|
|
16326
|
+
* (`.meta({ secret: true })` — dotted, `[]` for array items, e.g.
|
|
16327
|
+
* `connection.password`). Re-published on every register; the non-admin
|
|
16328
|
+
* redaction withholds them at any depth (D783). Optional: an older runner
|
|
16329
|
+
* omits it and the keyword backstop applies. */
|
|
16330
|
+
secretConfigPaths: array(string()).optional()
|
|
15401
16331
|
});
|
|
15402
16332
|
var DeviceRemovePayloadSchema = object({ deviceId: number() });
|
|
15403
16333
|
var DevicePersistConfigPayloadSchema = object({
|
|
15404
16334
|
deviceId: number(),
|
|
15405
|
-
data: record(string(), unknown())
|
|
16335
|
+
data: record(string(), unknown()),
|
|
16336
|
+
/** The paths the device's schema declares secret (D783), when the caller
|
|
16337
|
+
* knows them — those values are kept in the keychain, not the blob (D787).
|
|
16338
|
+
* Absent: the paths the device last reported at `registerDevice` apply. */
|
|
16339
|
+
secretConfigPaths: array(string()).optional()
|
|
15406
16340
|
});
|
|
15407
16341
|
/** What a migration actually did, per switch. `unreachable` is a first-class
|
|
15408
16342
|
* answer: a camera that could not be asked is not a camera that was silenced. */
|
|
@@ -17056,7 +17990,14 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
|
17056
17990
|
icon: string().optional(),
|
|
17057
17991
|
/** Addon-owned HTTP route the button navigates to (GET). */
|
|
17058
17992
|
startUrl: string(),
|
|
17059
|
-
stage: LoginStageEnum
|
|
17993
|
+
stage: LoginStageEnum,
|
|
17994
|
+
/**
|
|
17995
|
+
* The provider names an external identity a signed-in user can link to
|
|
17996
|
+
* their own account (D782): `auth.listLinkableProviders` /
|
|
17997
|
+
* `beginExternalLink` offer exactly the redirect methods that set this,
|
|
17998
|
+
* whatever their id. Absent / false — a login button only (magic-link).
|
|
17999
|
+
*/
|
|
18000
|
+
linkable: boolean().optional()
|
|
17060
18001
|
}),
|
|
17061
18002
|
object({
|
|
17062
18003
|
kind: literal("widget"),
|
|
@@ -22412,8 +23353,23 @@ var RetrainMacroClassSchema = _enum([
|
|
|
22412
23353
|
]);
|
|
22413
23354
|
/** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
|
|
22414
23355
|
var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
|
|
22415
|
-
/**
|
|
22416
|
-
|
|
23356
|
+
/**
|
|
23357
|
+
* Where a box came from. A machine-sourced box is a DRAFT on the page until
|
|
23358
|
+
* the operator confirms it; once saved it keeps its source as provenance.
|
|
23359
|
+
*
|
|
23360
|
+
* - `operator` — drawn by hand.
|
|
23361
|
+
* - `assist` — proposed by a detector run on the copy (the camera's own
|
|
23362
|
+
* model, or a larger teacher model).
|
|
23363
|
+
* - `pipeline` — the box the live pipeline actually drew on that frame, read
|
|
23364
|
+
* back from the track store (never a re-run).
|
|
23365
|
+
* - `llm` — proposed by a vision-capable LLM profile.
|
|
23366
|
+
*/
|
|
23367
|
+
var RetrainAnnotationSourceSchema = _enum([
|
|
23368
|
+
"operator",
|
|
23369
|
+
"assist",
|
|
23370
|
+
"pipeline",
|
|
23371
|
+
"llm"
|
|
23372
|
+
]);
|
|
22417
23373
|
/** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
|
|
22418
23374
|
var RetrainBboxSchema = object({
|
|
22419
23375
|
x: number(),
|
|
@@ -22431,7 +23387,8 @@ var RetrainBboxSchema = object({
|
|
|
22431
23387
|
*/
|
|
22432
23388
|
var RetrainAnnotationSchema = object({
|
|
22433
23389
|
id: string(),
|
|
22434
|
-
|
|
23390
|
+
/** The frame's track. Absent on a recording still, which has none. */
|
|
23391
|
+
trackId: string().optional(),
|
|
22435
23392
|
deviceId: number(),
|
|
22436
23393
|
/** The COPY in retrain storage — never the source track's media key. */
|
|
22437
23394
|
mediaKey: string(),
|
|
@@ -22480,18 +23437,63 @@ var RetrainFrameCandidateSchema = object({
|
|
|
22480
23437
|
* fail, whatever became of the original. */
|
|
22481
23438
|
copied: boolean()
|
|
22482
23439
|
});
|
|
23440
|
+
/**
|
|
23441
|
+
* One box the live pipeline drew on a copied frame — what a correction starts
|
|
23442
|
+
* from. Derived when the frame is listed, from the track store: the subject
|
|
23443
|
+
* box recorded on the source media row when there is one, else the track
|
|
23444
|
+
* position nearest the frame's capture time. Never stored as an annotation
|
|
23445
|
+
* until the operator confirms it.
|
|
23446
|
+
*/
|
|
23447
|
+
var RetrainPipelineBoxSchema = object({
|
|
23448
|
+
/** Normalised `[0,1]` against the full frame. */
|
|
23449
|
+
bbox: RetrainBboxSchema,
|
|
23450
|
+
macroClass: RetrainMacroClassSchema,
|
|
23451
|
+
label: string().optional(),
|
|
23452
|
+
subLabel: string().optional(),
|
|
23453
|
+
/** The detection score of the position used, when it was recorded. */
|
|
23454
|
+
score: number().optional(),
|
|
23455
|
+
/** The root model that produced the track, when it was recorded. */
|
|
23456
|
+
modelId: string().optional(),
|
|
23457
|
+
trackId: string(),
|
|
23458
|
+
/** `subject-box`: recorded on this very frame. `position`: the track's
|
|
23459
|
+
* position nearest the capture time, `deltaMs` away. */
|
|
23460
|
+
basis: _enum(["subject-box", "position"]),
|
|
23461
|
+
deltaMs: number()
|
|
23462
|
+
});
|
|
23463
|
+
/**
|
|
23464
|
+
* Where a retrain frame came from: a TRACK's stored media (copy-on-select),
|
|
23465
|
+
* or the RECORDING at an instant — the frame a model saw nothing in has no
|
|
23466
|
+
* track at all.
|
|
23467
|
+
*/
|
|
23468
|
+
var RetrainFrameOriginSchema = _enum(["track", "recording"]);
|
|
22483
23469
|
/** A frame the dataset OWNS: bytes copied at selection time. */
|
|
22484
23470
|
var RetrainFrameSchema = object({
|
|
22485
23471
|
frameId: string(),
|
|
22486
23472
|
deviceId: number(),
|
|
22487
|
-
|
|
22488
|
-
/**
|
|
22489
|
-
|
|
23473
|
+
origin: RetrainFrameOriginSchema,
|
|
23474
|
+
/** The track it was copied from. Absent on a recording still. */
|
|
23475
|
+
trackId: string().optional(),
|
|
23476
|
+
/** Provenance only. It may already point at nothing — that is expected.
|
|
23477
|
+
* Absent on a recording still. */
|
|
23478
|
+
sourceMediaId: number().int().optional(),
|
|
23479
|
+
/** A recording still: the playhead instant it was taken at. */
|
|
23480
|
+
epochMs: number().optional(),
|
|
22490
23481
|
sourceKind: MediaFileKindEnum,
|
|
22491
23482
|
sizeBytes: number().int(),
|
|
22492
23483
|
width: number().int(),
|
|
22493
23484
|
height: number().int(),
|
|
22494
|
-
copiedAt: number()
|
|
23485
|
+
copiedAt: number(),
|
|
23486
|
+
/** When the CAMERA captured the frame. Absent on a copy taken before D785. */
|
|
23487
|
+
capturedAt: number().optional(),
|
|
23488
|
+
/** The operator's "every subject in this frame is boxed". Detector
|
|
23489
|
+
* evaluation keeps only complete frames: an unboxed subject would count as
|
|
23490
|
+
* a false positive. */
|
|
23491
|
+
complete: boolean(),
|
|
23492
|
+
/** The boxes the pipeline drew on this frame. Present on list answers;
|
|
23493
|
+
* empty when nothing the track store holds can be placed on it. */
|
|
23494
|
+
pipelineBoxes: array(RetrainPipelineBoxSchema).readonly().optional(),
|
|
23495
|
+
/** The named collections this frame belongs to. Present on list answers. */
|
|
23496
|
+
collectionIds: array(string()).readonly().optional()
|
|
22495
23497
|
});
|
|
22496
23498
|
/** Why a copy-on-select could not be honoured — named, never a silent skip. */
|
|
22497
23499
|
var RetrainCopyRefusalSchema = _enum([
|
|
@@ -22512,6 +23514,53 @@ var RetrainFrameListSchema = object({
|
|
|
22512
23514
|
/** What the page pre-selects — the native key frame when one survives. */
|
|
22513
23515
|
autoPickMediaId: number().int().optional()
|
|
22514
23516
|
});
|
|
23517
|
+
/**
|
|
23518
|
+
* Which frames an annotated export carries. Every field narrows; an empty
|
|
23519
|
+
* filter is every annotated copy. A dataset VERSION is a frozen `frameIds`
|
|
23520
|
+
* list owned by whoever trains (the training orchestrator), so `frameIds` is
|
|
23521
|
+
* the primitive a version export uses; `batchId` re-selects what an earlier
|
|
23522
|
+
* export carried (`exportedInBatch`).
|
|
23523
|
+
*/
|
|
23524
|
+
var RetrainExportFilterSchema = object({
|
|
23525
|
+
deviceIds: array(number()).optional(),
|
|
23526
|
+
frameIds: array(string()).max(2e4).optional(),
|
|
23527
|
+
/** Only frames in at least one of these named collections. */
|
|
23528
|
+
collectionIds: array(string()).max(200).optional(),
|
|
23529
|
+
batchId: string().optional(),
|
|
23530
|
+
/** Only frames the operator marked complete (all subjects boxed). */
|
|
23531
|
+
completeOnly: boolean().optional()
|
|
23532
|
+
});
|
|
23533
|
+
/**
|
|
23534
|
+
* `frames`: the full frame copies, boxes in `annotations.json`.
|
|
23535
|
+
* `crops`: additionally one JPEG per subject, cut with the runtime detail-crop
|
|
23536
|
+
* convention — the classifier layout.
|
|
23537
|
+
*/
|
|
23538
|
+
var RetrainExportLayoutSchema = _enum(["frames", "crops"]);
|
|
23539
|
+
/**
|
|
23540
|
+
* Where `writeRetrainArchive` streams the tar: one HTTP request whose body is
|
|
23541
|
+
* the archive, sent chunk by chunk. Covers a presigned PUT and a provider
|
|
23542
|
+
* addon's data-plane upload route alike. Headers are sent verbatim and never
|
|
23543
|
+
* logged.
|
|
23544
|
+
*/
|
|
23545
|
+
var RetrainArchiveTargetSchema = object({
|
|
23546
|
+
kind: literal("http"),
|
|
23547
|
+
method: _enum(["PUT", "POST"]),
|
|
23548
|
+
url: string().url(),
|
|
23549
|
+
headers: record(string(), string()).optional()
|
|
23550
|
+
});
|
|
23551
|
+
var RetrainArchiveResultSchema = object({
|
|
23552
|
+
batchId: string(),
|
|
23553
|
+
frames: number().int(),
|
|
23554
|
+
crops: number().int(),
|
|
23555
|
+
annotations: number().int(),
|
|
23556
|
+
/** Frames planned but not shipped (unreadable copy, path too long). */
|
|
23557
|
+
missing: number().int(),
|
|
23558
|
+
bytes: number().int(),
|
|
23559
|
+
/** sha256 of the exact bytes sent. */
|
|
23560
|
+
sha256: string(),
|
|
23561
|
+
/** The target's HTTP status. */
|
|
23562
|
+
status: number().int()
|
|
23563
|
+
});
|
|
22515
23564
|
/** What the operator asked the assist to look for. */
|
|
22516
23565
|
var RetrainAssistSubjectSchema = discriminatedUnion("kind", [object({
|
|
22517
23566
|
kind: literal("package"),
|
|
@@ -22541,6 +23590,109 @@ var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
|
|
|
22541
23590
|
reason: string(),
|
|
22542
23591
|
detail: string().optional()
|
|
22543
23592
|
})]);
|
|
23593
|
+
/** A named set over the retrain corpus — membership only, it owns no pixels. */
|
|
23594
|
+
var RetrainCollectionSchema = object({
|
|
23595
|
+
id: string(),
|
|
23596
|
+
name: string(),
|
|
23597
|
+
createdAt: number(),
|
|
23598
|
+
frameCount: number().int()
|
|
23599
|
+
});
|
|
23600
|
+
var RetrainCollectionCreateResultSchema = discriminatedUnion("kind", [object({
|
|
23601
|
+
kind: literal("created"),
|
|
23602
|
+
collection: RetrainCollectionSchema
|
|
23603
|
+
}), object({
|
|
23604
|
+
kind: literal("refused"),
|
|
23605
|
+
reason: _enum(["empty-name", "duplicate-name"])
|
|
23606
|
+
})]);
|
|
23607
|
+
var RetrainCollectionRenameResultSchema = discriminatedUnion("kind", [object({
|
|
23608
|
+
kind: literal("renamed"),
|
|
23609
|
+
collection: RetrainCollectionSchema
|
|
23610
|
+
}), object({
|
|
23611
|
+
kind: literal("refused"),
|
|
23612
|
+
reason: _enum([
|
|
23613
|
+
"empty-name",
|
|
23614
|
+
"duplicate-name",
|
|
23615
|
+
"unknown-collection"
|
|
23616
|
+
])
|
|
23617
|
+
})]);
|
|
23618
|
+
/**
|
|
23619
|
+
* The outcome of adding the frame at a recording instant. Every refusal is
|
|
23620
|
+
* named: `still-unavailable` (not recording, a gap, or an undecodable frame —
|
|
23621
|
+
* `detail` says which), `still-busy` (the recorder is at its decode bound; try
|
|
23622
|
+
* again), `unreadable-image`, `write-failed`, `unknown-collection`.
|
|
23623
|
+
*/
|
|
23624
|
+
var AddRetrainFrameFromRecordingResultSchema = discriminatedUnion("kind", [object({
|
|
23625
|
+
kind: literal("added"),
|
|
23626
|
+
collectionId: string(),
|
|
23627
|
+
frame: RetrainFrameSchema,
|
|
23628
|
+
/** The moment was already in the dataset; nothing was decoded. */
|
|
23629
|
+
reused: boolean()
|
|
23630
|
+
}), object({
|
|
23631
|
+
kind: literal("refused"),
|
|
23632
|
+
reason: _enum([
|
|
23633
|
+
"unknown-collection",
|
|
23634
|
+
"still-unavailable",
|
|
23635
|
+
"still-busy",
|
|
23636
|
+
"unreadable-image",
|
|
23637
|
+
"write-failed"
|
|
23638
|
+
]),
|
|
23639
|
+
detail: string().optional()
|
|
23640
|
+
})]);
|
|
23641
|
+
/** A vision LLM profile the AI assist may use, and where it sends the frame. */
|
|
23642
|
+
var RetrainAssistProfileSchema = object({
|
|
23643
|
+
id: string(),
|
|
23644
|
+
name: string(),
|
|
23645
|
+
model: string(),
|
|
23646
|
+
kind: string(),
|
|
23647
|
+
/** `true` when the frame would leave the house (a cloud vendor, or an
|
|
23648
|
+
* endpoint that is not on the local network). The page confirms each such
|
|
23649
|
+
* run, and the provider refuses one without `allowCloud`. */
|
|
23650
|
+
leavesHouse: boolean()
|
|
23651
|
+
});
|
|
23652
|
+
/** A box the AI assist proposed: a draft, plus the model's own reason. */
|
|
23653
|
+
var RetrainLlmProposalSchema = RetrainAnnotationDraftSchema.extend({ reason: string() });
|
|
23654
|
+
/** What the AI assist said about a box that was already on the canvas. */
|
|
23655
|
+
var RetrainLlmReviewSchema = object({
|
|
23656
|
+
/** The `ref` the page sent the box under. */
|
|
23657
|
+
ref: string(),
|
|
23658
|
+
verdict: _enum([
|
|
23659
|
+
"confirmed",
|
|
23660
|
+
"wrong-class",
|
|
23661
|
+
"not-an-object",
|
|
23662
|
+
"uncertain"
|
|
23663
|
+
]),
|
|
23664
|
+
suggestedClass: RetrainMacroClassSchema.optional(),
|
|
23665
|
+
reason: string()
|
|
23666
|
+
});
|
|
23667
|
+
/**
|
|
23668
|
+
* The AI assist's answer. `proposed` carries drafts (`source: 'llm'`, the
|
|
23669
|
+
* model and its confidence) and reviews; items the model got wrong (a box off
|
|
23670
|
+
* the frame, an unasked class, an unknown ref) are dropped and counted in
|
|
23671
|
+
* `rejected`. A whole answer that is not the schema is `malformed-answer`.
|
|
23672
|
+
*/
|
|
23673
|
+
var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
|
|
23674
|
+
kind: literal("proposed"),
|
|
23675
|
+
profileId: string(),
|
|
23676
|
+
model: string(),
|
|
23677
|
+
/** The frame was sent outside the house for this answer. */
|
|
23678
|
+
leftHouse: boolean(),
|
|
23679
|
+
proposals: array(RetrainLlmProposalSchema).readonly(),
|
|
23680
|
+
reviews: array(RetrainLlmReviewSchema).readonly(),
|
|
23681
|
+
rejected: number().int()
|
|
23682
|
+
}), object({
|
|
23683
|
+
kind: literal("refused"),
|
|
23684
|
+
reason: _enum([
|
|
23685
|
+
"unknown-frame",
|
|
23686
|
+
"unreadable-frame",
|
|
23687
|
+
"unknown-profile",
|
|
23688
|
+
"profile-disabled",
|
|
23689
|
+
"no-vision",
|
|
23690
|
+
"cloud-not-confirmed",
|
|
23691
|
+
"llm-error",
|
|
23692
|
+
"malformed-answer"
|
|
23693
|
+
]),
|
|
23694
|
+
detail: string().optional()
|
|
23695
|
+
})]);
|
|
22544
23696
|
/** The outcome of a lifecycle move owned by the retrain page. */
|
|
22545
23697
|
var RetrainTransitionResultSchema = object({
|
|
22546
23698
|
trackId: string(),
|
|
@@ -23258,7 +24410,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23258
24410
|
auth: "admin"
|
|
23259
24411
|
}), method(object({
|
|
23260
24412
|
deviceId: number(),
|
|
23261
|
-
trackId: string(),
|
|
24413
|
+
trackId: string().optional(),
|
|
23262
24414
|
frameId: string()
|
|
23263
24415
|
}), object({
|
|
23264
24416
|
removed: boolean(),
|
|
@@ -23275,7 +24427,8 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23275
24427
|
auth: "admin"
|
|
23276
24428
|
}), method(object({
|
|
23277
24429
|
deviceId: number(),
|
|
23278
|
-
|
|
24430
|
+
/** The frame's track, when it has one — checked against the frame. */
|
|
24431
|
+
trackId: string().optional(),
|
|
23279
24432
|
frameId: string(),
|
|
23280
24433
|
subject: RetrainAssistSubjectSchema,
|
|
23281
24434
|
/** Which node runs it. Absent ⇒ wherever an unowned call lands. */
|
|
@@ -23283,12 +24436,16 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23283
24436
|
}), RetrainAssistResultSchema, {
|
|
23284
24437
|
kind: "mutation",
|
|
23285
24438
|
auth: "admin"
|
|
23286
|
-
}), method(object({
|
|
24439
|
+
}), method(object({
|
|
24440
|
+
trackId: string().optional(),
|
|
24441
|
+
frameIds: array(string()).max(2e3).optional()
|
|
24442
|
+
}), array(RetrainAnnotationSchema).readonly(), {
|
|
23287
24443
|
kind: "query",
|
|
23288
24444
|
auth: "admin"
|
|
23289
24445
|
}), method(object({
|
|
23290
24446
|
deviceId: number(),
|
|
23291
|
-
|
|
24447
|
+
/** The frame's track, when it has one — checked against the frame. */
|
|
24448
|
+
trackId: string().optional(),
|
|
23292
24449
|
frameId: string(),
|
|
23293
24450
|
annotations: array(RetrainAnnotationDraftSchema)
|
|
23294
24451
|
}), array(RetrainAnnotationSchema).readonly(), {
|
|
@@ -23306,7 +24463,91 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
23306
24463
|
}), RetrainTransitionResultSchema, {
|
|
23307
24464
|
kind: "mutation",
|
|
23308
24465
|
auth: "admin"
|
|
23309
|
-
}), method(
|
|
24466
|
+
}), method(RetrainExportFilterSchema.extend({ layout: RetrainExportLayoutSchema.optional() }), object({ url: string() }), {
|
|
24467
|
+
kind: "query",
|
|
24468
|
+
auth: "admin"
|
|
24469
|
+
}), method(object({
|
|
24470
|
+
deviceId: number(),
|
|
24471
|
+
trackId: string().optional(),
|
|
24472
|
+
frameId: string(),
|
|
24473
|
+
complete: boolean()
|
|
24474
|
+
}), RetrainFrameSchema, {
|
|
24475
|
+
kind: "mutation",
|
|
24476
|
+
auth: "admin"
|
|
24477
|
+
}), method(object({
|
|
24478
|
+
filter: RetrainExportFilterSchema,
|
|
24479
|
+
layout: RetrainExportLayoutSchema,
|
|
24480
|
+
target: RetrainArchiveTargetSchema
|
|
24481
|
+
}), RetrainArchiveResultSchema, {
|
|
24482
|
+
kind: "mutation",
|
|
24483
|
+
auth: "admin",
|
|
24484
|
+
timeoutMs: 60 * 6e4
|
|
24485
|
+
}), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
|
|
24486
|
+
kind: "query",
|
|
24487
|
+
auth: "admin"
|
|
24488
|
+
}), method(object({
|
|
24489
|
+
deviceId: number(),
|
|
24490
|
+
trackId: string().optional(),
|
|
24491
|
+
frameId: string(),
|
|
24492
|
+
profileId: string(),
|
|
24493
|
+
classes: array(RetrainMacroClassSchema).min(1),
|
|
24494
|
+
boxes: array(object({
|
|
24495
|
+
ref: string(),
|
|
24496
|
+
bbox: RetrainBboxSchema,
|
|
24497
|
+
macroClass: RetrainMacroClassSchema,
|
|
24498
|
+
label: string().optional()
|
|
24499
|
+
})).max(50),
|
|
24500
|
+
allowCloud: boolean()
|
|
24501
|
+
}), RetrainLlmAssistResultSchema, {
|
|
24502
|
+
kind: "mutation",
|
|
24503
|
+
auth: "admin",
|
|
24504
|
+
timeoutMs: 18e4
|
|
24505
|
+
}), method(object({ name: string().max(120) }), RetrainCollectionCreateResultSchema, {
|
|
24506
|
+
kind: "mutation",
|
|
24507
|
+
auth: "admin"
|
|
24508
|
+
}), method(object({}), array(RetrainCollectionSchema).readonly(), {
|
|
24509
|
+
kind: "query",
|
|
24510
|
+
auth: "admin"
|
|
24511
|
+
}), method(object({
|
|
24512
|
+
id: string(),
|
|
24513
|
+
name: string().max(120)
|
|
24514
|
+
}), RetrainCollectionRenameResultSchema, {
|
|
24515
|
+
kind: "mutation",
|
|
24516
|
+
auth: "admin"
|
|
24517
|
+
}), method(object({ id: string() }), object({
|
|
24518
|
+
deleted: boolean(),
|
|
24519
|
+
removedFrames: number().int()
|
|
24520
|
+
}), {
|
|
24521
|
+
kind: "mutation",
|
|
24522
|
+
auth: "admin"
|
|
24523
|
+
}), method(object({
|
|
24524
|
+
collectionId: string(),
|
|
24525
|
+
deviceId: number(),
|
|
24526
|
+
epochMs: number()
|
|
24527
|
+
}), AddRetrainFrameFromRecordingResultSchema, {
|
|
24528
|
+
kind: "mutation",
|
|
24529
|
+
auth: "admin",
|
|
24530
|
+
timeoutMs: 6e4
|
|
24531
|
+
}), method(object({
|
|
24532
|
+
collectionId: string(),
|
|
24533
|
+
frameIds: array(string()).min(1).max(500)
|
|
24534
|
+
}), object({
|
|
24535
|
+
added: number().int(),
|
|
24536
|
+
alreadyMember: number().int(),
|
|
24537
|
+
unknownFrameIds: array(string()).readonly()
|
|
24538
|
+
}), {
|
|
24539
|
+
kind: "mutation",
|
|
24540
|
+
auth: "admin"
|
|
24541
|
+
}), method(object({
|
|
24542
|
+
collectionId: string(),
|
|
24543
|
+
frameId: string()
|
|
24544
|
+
}), object({
|
|
24545
|
+
removed: boolean(),
|
|
24546
|
+
deletedFrame: boolean()
|
|
24547
|
+
}), {
|
|
24548
|
+
kind: "mutation",
|
|
24549
|
+
auth: "admin"
|
|
24550
|
+
}), method(object({ collectionId: string() }), array(RetrainFrameSchema).readonly(), {
|
|
23310
24551
|
kind: "query",
|
|
23311
24552
|
auth: "admin"
|
|
23312
24553
|
}), method(object({
|
|
@@ -23932,13 +25173,31 @@ var RecommendationReasonSchema = discriminatedUnion("kind", [
|
|
|
23932
25173
|
object({
|
|
23933
25174
|
kind: literal("no-family-build"),
|
|
23934
25175
|
format: ModelFormatSchema$1
|
|
25176
|
+
}),
|
|
25177
|
+
object({
|
|
25178
|
+
kind: literal("kept-custom-pin"),
|
|
25179
|
+
modelId: string(),
|
|
25180
|
+
deviceKey: string()
|
|
23935
25181
|
})
|
|
23936
25182
|
]);
|
|
25183
|
+
/** Why a device is left exactly as it is, whatever the plan would pick (D786). */
|
|
25184
|
+
var KeptReasonSchema = _enum(["custom-pin"]);
|
|
25185
|
+
/**
|
|
25186
|
+
* Where a choice's latency came from (D791): this node's own benchmark
|
|
25187
|
+
* result, or the hardware-class table. Measured on the node beats the table.
|
|
25188
|
+
*/
|
|
25189
|
+
var LatencySourceSchema = discriminatedUnion("kind", [object({ kind: literal("table") }), object({
|
|
25190
|
+
kind: literal("node-benchmark"),
|
|
25191
|
+
resultId: string(),
|
|
25192
|
+
measuredAtMs: number()
|
|
25193
|
+
})]);
|
|
23937
25194
|
var DeviceModelChoiceSchema = object({
|
|
23938
25195
|
modelId: string(),
|
|
23939
25196
|
p50Ms: number(),
|
|
23940
25197
|
fps: number(),
|
|
23941
25198
|
measured: boolean(),
|
|
25199
|
+
/** Absent on a plan from before D791 — read as the table. */
|
|
25200
|
+
source: LatencySourceSchema.optional(),
|
|
23942
25201
|
/** Parallel sessions at the camera rate with the headroom kept free: ⌊fps × (1 − headroom) / camera fps⌋. */
|
|
23943
25202
|
capacitySessions: number(),
|
|
23944
25203
|
personRecall: number()
|
|
@@ -23949,6 +25208,8 @@ var DeviceRecommendationSchema = object({
|
|
|
23949
25208
|
enabled: boolean(),
|
|
23950
25209
|
available: boolean(),
|
|
23951
25210
|
chosen: DeviceModelChoiceSchema.nullable(),
|
|
25211
|
+
/** Present when the device is kept as is: Apply writes nothing on it. */
|
|
25212
|
+
kept: KeptReasonSchema.optional(),
|
|
23952
25213
|
reasons: array(RecommendationReasonSchema).readonly()
|
|
23953
25214
|
});
|
|
23954
25215
|
var NodeRecommendationSchema = object({
|
|
@@ -24002,6 +25263,17 @@ var AutoTuneWarningSchema = discriminatedUnion("kind", [
|
|
|
24002
25263
|
kind: literal("coral-enabled"),
|
|
24003
25264
|
nodeId: string(),
|
|
24004
25265
|
deviceKey: string()
|
|
25266
|
+
}),
|
|
25267
|
+
object({
|
|
25268
|
+
kind: literal("custom-pin-kept"),
|
|
25269
|
+
nodeId: string(),
|
|
25270
|
+
deviceKey: string().nullable(),
|
|
25271
|
+
deviceId: number().nullable(),
|
|
25272
|
+
modelId: string()
|
|
25273
|
+
}),
|
|
25274
|
+
object({
|
|
25275
|
+
kind: literal("custom-registry-unreadable"),
|
|
25276
|
+
error: string()
|
|
24005
25277
|
})
|
|
24006
25278
|
]);
|
|
24007
25279
|
var AutoTuneOptionsSchema = object({
|
|
@@ -24180,13 +25452,14 @@ var SuggestSharesResultSchema = object({
|
|
|
24180
25452
|
nodes: array(SuggestedNodeShareSchema).readonly()
|
|
24181
25453
|
});
|
|
24182
25454
|
/**
|
|
24183
|
-
* Where the node and device shares come from (D750, D755).
|
|
24184
|
-
* - `
|
|
24185
|
-
*
|
|
24186
|
-
*
|
|
24187
|
-
*
|
|
24188
|
-
*
|
|
24189
|
-
*
|
|
25455
|
+
* Where the node and device shares come from (D750, D755, D791).
|
|
25456
|
+
* - `benchmark` (default since D791) — each node's capacity as its own node
|
|
25457
|
+
* benchmark measured it; a node without fresh results is sized from
|
|
25458
|
+
* `hardware` and says so. Measured on the node beats the table.
|
|
25459
|
+
* - `hardware` — computed from each node's static capacity only (its
|
|
25460
|
+
* accelerators at their Auto tune models, from the latency table).
|
|
25461
|
+
* Both are recomputed whenever a node or device joins, leaves, is switched
|
|
25462
|
+
* on or off, changes model, or a benchmark result is written. No load input.
|
|
24190
25463
|
* - `manual` — the operator's stored sliders.
|
|
24191
25464
|
* Either way a node or device that cannot take sessions gives its share to
|
|
24192
25465
|
* the others in proportion; the stored values are never rewritten for that.
|
|
@@ -24235,6 +25508,362 @@ var EffectiveSharesSchema = object({
|
|
|
24235
25508
|
nodeWeights: record(string(), number()),
|
|
24236
25509
|
deviceWeights: record(string(), record(string(), number()))
|
|
24237
25510
|
});
|
|
25511
|
+
/**
|
|
25512
|
+
* Wire shapes of the node benchmark (D791): the operator's plan, the
|
|
25513
|
+
* preflight the confirmation shows, the run the orchestrator owns, what the
|
|
25514
|
+
* measuring runner reports, and the result rows Auto tune and the automatic
|
|
25515
|
+
* shares read.
|
|
25516
|
+
*
|
|
25517
|
+
* ONE node at a time, owned by the pipeline orchestrator. While a run is
|
|
25518
|
+
* active the cluster is in BENCHMARK MODE for that node: it is not a
|
|
25519
|
+
* detection candidate, camera pins naming it are ignored so its sessions move
|
|
25520
|
+
* elsewhere, and both come back when the mode ends — after a crash or a hub
|
|
25521
|
+
* restart too (a persisted manifest, reconciled against the registry).
|
|
25522
|
+
*
|
|
25523
|
+
* Two measurements, both on the node, driven by its own runner (frames never
|
|
25524
|
+
* cross a process at frame rate, D9):
|
|
25525
|
+
* - `device` — one accelerator × one candidate detector, root only, open
|
|
25526
|
+
* loop: how many streams at the camera rate it carries inside the frame
|
|
25527
|
+
* interval;
|
|
25528
|
+
* - `pipeline` — the chosen detector plus the operator's detail steps
|
|
25529
|
+
* (faces, plates, classifiers, CLIP…), on varied frames from the bench
|
|
25530
|
+
* clip: how many parallel sessions the node carries before latency, drops,
|
|
25531
|
+
* CPU, RAM or the event loop give out.
|
|
25532
|
+
*/
|
|
25533
|
+
/** Defaults and bounds, one place. */
|
|
25534
|
+
var NODE_BENCHMARK_DEFAULTS = {
|
|
25535
|
+
fpsPerStream: 10,
|
|
25536
|
+
budgetMinutes: 45,
|
|
25537
|
+
minBudgetMinutes: 10,
|
|
25538
|
+
maxBudgetMinutes: 120,
|
|
25539
|
+
/** A result older than this no longer beats the table. */
|
|
25540
|
+
staleAfterDays: 30,
|
|
25541
|
+
/** Warm-in per ramp step (not accounted). */
|
|
25542
|
+
settleSec: 5,
|
|
25543
|
+
/** Accounted window per ramp step. */
|
|
25544
|
+
measureSec: 20,
|
|
25545
|
+
/** Longest the drain may take before the run is refused. */
|
|
25546
|
+
drainTimeoutSec: 120,
|
|
25547
|
+
/** Candidate models per device in one run. */
|
|
25548
|
+
maxModelsPerDevice: 6
|
|
25549
|
+
};
|
|
25550
|
+
/** The two measurements a run can make. */
|
|
25551
|
+
var NodeBenchmarkPhaseSchema = _enum(["device", "pipeline"]);
|
|
25552
|
+
var NodeBenchmarkDevicePlanSchema = object({
|
|
25553
|
+
/** `<backend>:<device>` — `openvino:npu`, `coreml:all`, `cpu`. */
|
|
25554
|
+
deviceKey: string().min(1),
|
|
25555
|
+
/**
|
|
25556
|
+
* Root detector candidates for the `device` measurement, in the order
|
|
25557
|
+
* measured. The FIRST is the one the `pipeline` measurement runs.
|
|
25558
|
+
*/
|
|
25559
|
+
modelIds: array(string().min(1)).min(1).max(NODE_BENCHMARK_DEFAULTS.maxModelsPerDevice)
|
|
25560
|
+
});
|
|
25561
|
+
/** What the operator confirmed. */
|
|
25562
|
+
var NodeBenchmarkPlanSchema = object({
|
|
25563
|
+
nodeId: string().min(1),
|
|
25564
|
+
devices: array(NodeBenchmarkDevicePlanSchema).min(1),
|
|
25565
|
+
/** Which measurements run. At least one. */
|
|
25566
|
+
phases: array(NodeBenchmarkPhaseSchema).min(1).default(["device", "pipeline"]),
|
|
25567
|
+
/**
|
|
25568
|
+
* Detail steps (catalog step ids under the root: faces, plates,
|
|
25569
|
+
* classifiers, CLIP…) the `pipeline` measurement enables. The root
|
|
25570
|
+
* detector always runs.
|
|
25571
|
+
*/
|
|
25572
|
+
steps: array(string().min(1)).default([]),
|
|
25573
|
+
/** Offered rate of one stream / session. */
|
|
25574
|
+
fpsPerStream: number().int().min(1).max(30).default(NODE_BENCHMARK_DEFAULTS.fpsPerStream),
|
|
25575
|
+
/** Hard deadline: the mode ends and the cluster is restored when it passes. */
|
|
25576
|
+
budgetMinutes: number().int().min(NODE_BENCHMARK_DEFAULTS.minBudgetMinutes).max(NODE_BENCHMARK_DEFAULTS.maxBudgetMinutes).default(NODE_BENCHMARK_DEFAULTS.budgetMinutes),
|
|
25577
|
+
/** Keep the models the run downloaded (default: delete what was not installed before). */
|
|
25578
|
+
keepDownloadedModels: boolean().default(false),
|
|
25579
|
+
/** Start although the other nodes' capacity does not cover the sessions running now. */
|
|
25580
|
+
acceptInsufficientHeadroom: boolean().default(false)
|
|
25581
|
+
});
|
|
25582
|
+
var NodeBenchmarkRefusalSchema = object({
|
|
25583
|
+
kind: _enum([
|
|
25584
|
+
"benchmark-active",
|
|
25585
|
+
"node-offline",
|
|
25586
|
+
"unknown-device",
|
|
25587
|
+
"no-phase",
|
|
25588
|
+
"insufficient-headroom"
|
|
25589
|
+
]),
|
|
25590
|
+
detail: string(),
|
|
25591
|
+
overridable: boolean()
|
|
25592
|
+
});
|
|
25593
|
+
/** A camera whose detection leaves the node for the run. */
|
|
25594
|
+
var NodeBenchmarkMovingCameraSchema = object({
|
|
25595
|
+
deviceId: number(),
|
|
25596
|
+
/** Placed on the node now (a standing attach or a running session). */
|
|
25597
|
+
placedOnNode: boolean(),
|
|
25598
|
+
/** A node pin naming this node, ignored for the run. */
|
|
25599
|
+
pinnedToNode: boolean()
|
|
25600
|
+
});
|
|
25601
|
+
/** A camera that cannot leave: no other node can obtain its frames. */
|
|
25602
|
+
var NodeBenchmarkStayingCameraSchema = object({
|
|
25603
|
+
deviceId: number(),
|
|
25604
|
+
reason: literal("only-frame-source")
|
|
25605
|
+
});
|
|
25606
|
+
var NodeBenchmarkPreflightSchema = object({
|
|
25607
|
+
nodeId: string(),
|
|
25608
|
+
online: boolean(),
|
|
25609
|
+
moving: array(NodeBenchmarkMovingCameraSchema).readonly(),
|
|
25610
|
+
/** Keep running on the node during the run; the result is flagged contaminated. */
|
|
25611
|
+
staying: array(NodeBenchmarkStayingCameraSchema).readonly(),
|
|
25612
|
+
estimatedDurationMs: number(),
|
|
25613
|
+
/** The run ends and the cluster is restored at the latest after this long. */
|
|
25614
|
+
budgetMs: number(),
|
|
25615
|
+
phases: array(NodeBenchmarkPhaseSchema).readonly(),
|
|
25616
|
+
steps: array(string()).readonly(),
|
|
25617
|
+
devices: array(NodeBenchmarkDevicePlanSchema).readonly(),
|
|
25618
|
+
/** Parallel sessions the cluster runs now, and what the other nodes can carry. */
|
|
25619
|
+
headroom: object({
|
|
25620
|
+
sessionsNow: number(),
|
|
25621
|
+
otherNodesCapacitySessions: number().nullable()
|
|
25622
|
+
}),
|
|
25623
|
+
refusals: array(NodeBenchmarkRefusalSchema).readonly(),
|
|
25624
|
+
canStart: boolean()
|
|
25625
|
+
});
|
|
25626
|
+
/** Where the measuring runner is. */
|
|
25627
|
+
var NodeBenchProgressSchema = object({
|
|
25628
|
+
phase: _enum([
|
|
25629
|
+
"preparing",
|
|
25630
|
+
"device",
|
|
25631
|
+
"pipeline",
|
|
25632
|
+
"cleanup"
|
|
25633
|
+
]),
|
|
25634
|
+
deviceKey: string().nullable(),
|
|
25635
|
+
modelId: string().nullable(),
|
|
25636
|
+
/** Streams (device) or sessions (pipeline) of the step running now. */
|
|
25637
|
+
load: number().nullable(),
|
|
25638
|
+
cellsDone: number(),
|
|
25639
|
+
cellsTotal: number(),
|
|
25640
|
+
message: string()
|
|
25641
|
+
});
|
|
25642
|
+
/** What limited a ramp. `none` = the ramp ran out of steps still passing. */
|
|
25643
|
+
var NodeBenchLimitSchema = _enum([
|
|
25644
|
+
"p95",
|
|
25645
|
+
"drops",
|
|
25646
|
+
"errors",
|
|
25647
|
+
"stall",
|
|
25648
|
+
"cpu",
|
|
25649
|
+
"ram",
|
|
25650
|
+
"none"
|
|
25651
|
+
]);
|
|
25652
|
+
var NodeBenchRampStepSchema = object({
|
|
25653
|
+
load: number(),
|
|
25654
|
+
pass: boolean(),
|
|
25655
|
+
p95Ms: number(),
|
|
25656
|
+
dropRatio: number(),
|
|
25657
|
+
/** Completed frames per second over the accounted window. */
|
|
25658
|
+
fps: number(),
|
|
25659
|
+
cpuPct: number().nullable(),
|
|
25660
|
+
ramFreePct: number().nullable(),
|
|
25661
|
+
failReasons: array(string()).readonly()
|
|
25662
|
+
});
|
|
25663
|
+
var NodeBenchCellSchema = discriminatedUnion("phase", [object({
|
|
25664
|
+
phase: literal("device"),
|
|
25665
|
+
deviceKey: string(),
|
|
25666
|
+
modelId: string(),
|
|
25667
|
+
/** Single-stream latency (the K = 1 step). */
|
|
25668
|
+
p50Ms: number(),
|
|
25669
|
+
p95Ms: number(),
|
|
25670
|
+
p99Ms: number(),
|
|
25671
|
+
/** Frames per second sustained at the last passing step. */
|
|
25672
|
+
fps: number(),
|
|
25673
|
+
/** Streams at the camera rate the device carried inside the frame interval; 0 = not even one. */
|
|
25674
|
+
kMax: number(),
|
|
25675
|
+
limitedBy: NodeBenchLimitSchema,
|
|
25676
|
+
/** First call (model load + warm-up). */
|
|
25677
|
+
warmupMs: number(),
|
|
25678
|
+
ramp: array(NodeBenchRampStepSchema).readonly()
|
|
25679
|
+
}), object({
|
|
25680
|
+
phase: literal("pipeline"),
|
|
25681
|
+
deviceKey: string(),
|
|
25682
|
+
modelId: string(),
|
|
25683
|
+
steps: array(string()).readonly(),
|
|
25684
|
+
/** Parallel sessions at the camera rate the node carried; 0 = not even one. */
|
|
25685
|
+
maxSessions: number(),
|
|
25686
|
+
limitedBy: NodeBenchLimitSchema,
|
|
25687
|
+
/** Detail steps that produced at least one result on the clip — a step that never fired measured nothing. */
|
|
25688
|
+
stepsFired: array(string()).readonly(),
|
|
25689
|
+
warmupMs: number(),
|
|
25690
|
+
ramp: array(NodeBenchRampStepSchema).readonly()
|
|
25691
|
+
})]);
|
|
25692
|
+
/**
|
|
25693
|
+
* What a result was measured ON. A result whose fingerprint no longer matches
|
|
25694
|
+
* the node no longer beats the table.
|
|
25695
|
+
*/
|
|
25696
|
+
var NodeBenchFingerprintSchema = object({
|
|
25697
|
+
pipelineVersion: string().nullable(),
|
|
25698
|
+
cpuModel: string().nullable(),
|
|
25699
|
+
ramGb: number().nullable(),
|
|
25700
|
+
os: string().nullable(),
|
|
25701
|
+
/** Per device: the pool the cells ran on (runtime + tuning). */
|
|
25702
|
+
pools: record(string(), object({
|
|
25703
|
+
runtime: string(),
|
|
25704
|
+
numWorkers: number(),
|
|
25705
|
+
concurrency: number(),
|
|
25706
|
+
batchMode: string()
|
|
25707
|
+
})).default({})
|
|
25708
|
+
});
|
|
25709
|
+
/** The frames the run used. */
|
|
25710
|
+
var NodeBenchClipSchema = object({
|
|
25711
|
+
/** `camstack-bench-v1` or `reference-images` (the fallback when the clip is not reachable). */
|
|
25712
|
+
id: string(),
|
|
25713
|
+
revision: string().nullable(),
|
|
25714
|
+
frames: number(),
|
|
25715
|
+
width: number(),
|
|
25716
|
+
height: number()
|
|
25717
|
+
});
|
|
25718
|
+
var NodeBenchRunnerInputSchema = object({
|
|
25719
|
+
runId: string().min(1),
|
|
25720
|
+
devices: array(NodeBenchmarkDevicePlanSchema).min(1),
|
|
25721
|
+
phases: array(NodeBenchmarkPhaseSchema).min(1),
|
|
25722
|
+
/** The full detail step tree root for the `pipeline` measurement is built on the node from these ids. */
|
|
25723
|
+
steps: array(string()).default([]),
|
|
25724
|
+
fpsPerStream: number().int().min(1).max(30),
|
|
25725
|
+
/** The runner stops on its own past this instant, whatever the hub does. */
|
|
25726
|
+
deadlineAtMs: number(),
|
|
25727
|
+
settleSec: number().min(0).max(60).default(NODE_BENCHMARK_DEFAULTS.settleSec),
|
|
25728
|
+
measureSec: number().min(2).max(300).default(NODE_BENCHMARK_DEFAULTS.measureSec),
|
|
25729
|
+
keepDownloadedModels: boolean().default(false)
|
|
25730
|
+
});
|
|
25731
|
+
var NodeBenchRunnerStateSchema = _enum([
|
|
25732
|
+
"running",
|
|
25733
|
+
"done",
|
|
25734
|
+
"failed",
|
|
25735
|
+
"aborted"
|
|
25736
|
+
]);
|
|
25737
|
+
var NodeBenchRunnerStatusSchema = object({
|
|
25738
|
+
runId: string(),
|
|
25739
|
+
nodeId: string(),
|
|
25740
|
+
state: NodeBenchRunnerStateSchema,
|
|
25741
|
+
progress: NodeBenchProgressSchema.nullable(),
|
|
25742
|
+
/** Every finished cell so far — a run stopped half way keeps what it measured. */
|
|
25743
|
+
cells: array(NodeBenchCellSchema).readonly(),
|
|
25744
|
+
fingerprint: NodeBenchFingerprintSchema.nullable(),
|
|
25745
|
+
clip: NodeBenchClipSchema.nullable(),
|
|
25746
|
+
/** Cameras seen running on the node during the run (they share its pools). */
|
|
25747
|
+
activeCameraIds: array(number()).readonly(),
|
|
25748
|
+
/** Models the run downloaded and then deleted (not installed before). */
|
|
25749
|
+
deletedModels: array(string()).readonly(),
|
|
25750
|
+
error: string().nullable(),
|
|
25751
|
+
startedAtMs: number(),
|
|
25752
|
+
finishedAtMs: number().nullable()
|
|
25753
|
+
});
|
|
25754
|
+
var NodeBenchmarkStateSchema = _enum([
|
|
25755
|
+
"draining",
|
|
25756
|
+
"measuring",
|
|
25757
|
+
"restoring",
|
|
25758
|
+
"done",
|
|
25759
|
+
"failed",
|
|
25760
|
+
"aborted"
|
|
25761
|
+
]);
|
|
25762
|
+
/** Why a run ended. */
|
|
25763
|
+
var NodeBenchmarkEndReasonSchema = _enum([
|
|
25764
|
+
"completed",
|
|
25765
|
+
"operator-abort",
|
|
25766
|
+
"deadline",
|
|
25767
|
+
"node-lost",
|
|
25768
|
+
"runner-lost",
|
|
25769
|
+
"hub-restart",
|
|
25770
|
+
"drain-timeout",
|
|
25771
|
+
"failed"
|
|
25772
|
+
]);
|
|
25773
|
+
var NodeBenchmarkRunSchema = object({
|
|
25774
|
+
runId: string(),
|
|
25775
|
+
nodeId: string(),
|
|
25776
|
+
state: NodeBenchmarkStateSchema,
|
|
25777
|
+
plan: NodeBenchmarkPlanSchema,
|
|
25778
|
+
startedAtMs: number(),
|
|
25779
|
+
deadlineAtMs: number(),
|
|
25780
|
+
finishedAtMs: number().nullable(),
|
|
25781
|
+
endReason: NodeBenchmarkEndReasonSchema.nullable(),
|
|
25782
|
+
error: string().nullable(),
|
|
25783
|
+
/** Cameras moved off the node for the run. */
|
|
25784
|
+
moved: array(number()).readonly(),
|
|
25785
|
+
/** Cameras that stayed (their only frame source is the node). */
|
|
25786
|
+
staying: array(number()).readonly(),
|
|
25787
|
+
/** Something else ran on the node's pools during the run. */
|
|
25788
|
+
contaminated: boolean(),
|
|
25789
|
+
progress: NodeBenchProgressSchema.nullable(),
|
|
25790
|
+
resultIds: array(string()).readonly()
|
|
25791
|
+
});
|
|
25792
|
+
/** `getNodeBenchmarkStatus`: the active run (or the last one), and whether benchmark mode is on. */
|
|
25793
|
+
var NodeBenchmarkStatusSchema = object({
|
|
25794
|
+
/** The node the cluster is in benchmark mode for; null = none. */
|
|
25795
|
+
modeNodeId: string().nullable(),
|
|
25796
|
+
run: NodeBenchmarkRunSchema.nullable()
|
|
25797
|
+
});
|
|
25798
|
+
/**
|
|
25799
|
+
* One stored measurement — the only authority Auto tune and the automatic
|
|
25800
|
+
* shares read measured capacity from. Written by the orchestrator when a run
|
|
25801
|
+
* ends, never by anyone else.
|
|
25802
|
+
*/
|
|
25803
|
+
var NodeBenchmarkResultSchema = object({
|
|
25804
|
+
id: string(),
|
|
25805
|
+
runId: string(),
|
|
25806
|
+
nodeId: string(),
|
|
25807
|
+
cell: NodeBenchCellSchema,
|
|
25808
|
+
fpsPerStream: number(),
|
|
25809
|
+
fingerprint: NodeBenchFingerprintSchema.nullable(),
|
|
25810
|
+
clip: NodeBenchClipSchema.nullable(),
|
|
25811
|
+
/** Other work shared the node's pools (a camera that could not move, or the hub's own duties). */
|
|
25812
|
+
contaminated: boolean(),
|
|
25813
|
+
stayingCameras: array(number()).readonly(),
|
|
25814
|
+
/** The run ended early; the cell itself completed. */
|
|
25815
|
+
partialRun: boolean(),
|
|
25816
|
+
measuredAtMs: number()
|
|
25817
|
+
});
|
|
25818
|
+
var ListNodeBenchmarkResultsInputSchema = object({
|
|
25819
|
+
nodeId: string().optional(),
|
|
25820
|
+
deviceKey: string().optional()
|
|
25821
|
+
});
|
|
25822
|
+
/** A result with its standing today: does it still beat the table? */
|
|
25823
|
+
var NodeBenchmarkResultViewSchema = NodeBenchmarkResultSchema.extend({
|
|
25824
|
+
/** `fresh` beats the table; `stale` falls back to it; `superseded` = a newer row covers the same cell. */
|
|
25825
|
+
standing: _enum([
|
|
25826
|
+
"fresh",
|
|
25827
|
+
"stale",
|
|
25828
|
+
"superseded"
|
|
25829
|
+
]),
|
|
25830
|
+
staleWhy: _enum([
|
|
25831
|
+
"age",
|
|
25832
|
+
"runtime",
|
|
25833
|
+
"pool-tuning"
|
|
25834
|
+
]).nullable()
|
|
25835
|
+
});
|
|
25836
|
+
object({
|
|
25837
|
+
runId: string(),
|
|
25838
|
+
nodeId: string(),
|
|
25839
|
+
startedAtMs: number(),
|
|
25840
|
+
deadlineAtMs: number(),
|
|
25841
|
+
plan: NodeBenchmarkPlanSchema,
|
|
25842
|
+
moved: array(number()).readonly(),
|
|
25843
|
+
staying: array(number()).readonly()
|
|
25844
|
+
});
|
|
25845
|
+
/** Candidate detectors per device, for the plan editor. */
|
|
25846
|
+
var NodeBenchmarkCandidatesSchema = object({
|
|
25847
|
+
nodeId: string(),
|
|
25848
|
+
reachable: boolean(),
|
|
25849
|
+
devices: array(object({
|
|
25850
|
+
deviceKey: string(),
|
|
25851
|
+
enabled: boolean(),
|
|
25852
|
+
available: boolean(),
|
|
25853
|
+
/** Ordered: what Auto tune would pick first, then the rest of the family by accuracy. */
|
|
25854
|
+
suggested: array(string()).readonly(),
|
|
25855
|
+
/** Every root detector the device has a build for. */
|
|
25856
|
+
all: array(string()).readonly(),
|
|
25857
|
+
/** The model the device runs now, when pinned. */
|
|
25858
|
+
currentModelId: string().nullable()
|
|
25859
|
+
})).readonly(),
|
|
25860
|
+
/** Detail steps the node's catalog offers under the root (for the `pipeline` measurement). */
|
|
25861
|
+
steps: array(object({
|
|
25862
|
+
id: string(),
|
|
25863
|
+
name: string(),
|
|
25864
|
+
slot: string()
|
|
25865
|
+
})).readonly()
|
|
25866
|
+
});
|
|
24238
25867
|
object({
|
|
24239
25868
|
activeCameras: number(),
|
|
24240
25869
|
throttledCameras: number(),
|
|
@@ -25363,7 +26992,16 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
|
|
|
25363
26992
|
}), ParkedTrackFrameSchema.nullable()), method(object({
|
|
25364
26993
|
deviceId: number(),
|
|
25365
26994
|
trackId: string()
|
|
25366
|
-
}), object({ released: number().int().nonnegative() }), { kind: "mutation" })
|
|
26995
|
+
}), object({ released: number().int().nonnegative() }), { kind: "mutation" }), method(NodeBenchRunnerInputSchema, object({
|
|
26996
|
+
accepted: literal(true),
|
|
26997
|
+
runId: string()
|
|
26998
|
+
}), {
|
|
26999
|
+
kind: "mutation",
|
|
27000
|
+
auth: "admin"
|
|
27001
|
+
}), method(object({ runId: string() }), NodeBenchRunnerStatusSchema.nullable(), { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
|
|
27002
|
+
kind: "mutation",
|
|
27003
|
+
auth: "admin"
|
|
27004
|
+
});
|
|
25367
27005
|
var CameraPipelineConfigSchema = object({
|
|
25368
27006
|
engine: PipelineEngineChoiceSchema.optional(),
|
|
25369
27007
|
steps: array(PipelineStepInputSchema).readonly(),
|
|
@@ -26002,6 +27640,21 @@ method(object({
|
|
|
26002
27640
|
}), method(PlacementStatsInputSchema, PlacementStatsSchema, { auth: "admin" }), method(SuggestSharesInputSchema, SuggestSharesResultSchema, { auth: "admin" }), method(_void(), EffectiveSharesSchema, { auth: "admin" }), method(SetShareSourceInputSchema, object({ success: literal(true) }), {
|
|
26003
27641
|
kind: "mutation",
|
|
26004
27642
|
auth: "admin"
|
|
27643
|
+
}), method(NodeBenchmarkPlanSchema, NodeBenchmarkPreflightSchema, { auth: "admin" }), method(NodeBenchmarkPlanSchema, discriminatedUnion("kind", [object({
|
|
27644
|
+
kind: literal("started"),
|
|
27645
|
+
runId: string()
|
|
27646
|
+
}), object({
|
|
27647
|
+
kind: literal("refused"),
|
|
27648
|
+
preflight: NodeBenchmarkPreflightSchema
|
|
27649
|
+
})]), {
|
|
27650
|
+
kind: "mutation",
|
|
27651
|
+
auth: "admin"
|
|
27652
|
+
}), method(_void(), NodeBenchmarkStatusSchema, { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
|
|
27653
|
+
kind: "mutation",
|
|
27654
|
+
auth: "admin"
|
|
27655
|
+
}), method(object({ nodeId: string() }), NodeBenchmarkCandidatesSchema, { auth: "admin" }), method(ListNodeBenchmarkResultsInputSchema, array(NodeBenchmarkResultViewSchema).readonly(), { auth: "admin" }), method(object({ id: string() }), object({ deleted: boolean() }), {
|
|
27656
|
+
kind: "mutation",
|
|
27657
|
+
auth: "admin"
|
|
26005
27658
|
}), method(object({ deviceId: number() }), CameraPipelineSettingsSchema.nullable()), method(object({
|
|
26006
27659
|
deviceId: number(),
|
|
26007
27660
|
addonId: string(),
|
|
@@ -26638,7 +28291,19 @@ var SsoBridgeClaimsSchema = object({
|
|
|
26638
28291
|
* editing a descriptor must not retroactively extend or shorten a link the
|
|
26639
28292
|
* operator already consented to.
|
|
26640
28293
|
*/
|
|
26641
|
-
refreshTtl: union([number().int().positive(), literal("never")]).optional()
|
|
28294
|
+
refreshTtl: union([number().int().positive(), literal("never")]).optional(),
|
|
28295
|
+
/**
|
|
28296
|
+
* Opaque handle of a hub-side LINK intent (D782). Set by an OIDC callback
|
|
28297
|
+
* that was started from a signed-in user's "Link" button: the finish then
|
|
28298
|
+
* links this identity to the intent's user instead of signing anyone in.
|
|
28299
|
+
* The handle carries no user id — the hub resolves it, single-use.
|
|
28300
|
+
*/
|
|
28301
|
+
linkIntent: string().optional(),
|
|
28302
|
+
/**
|
|
28303
|
+
* Verified `iss` of the id_token behind an OIDC login bridge (D782). A
|
|
28304
|
+
* subject is unique only per issuer, so a link is bound to it.
|
|
28305
|
+
*/
|
|
28306
|
+
issuer: string().optional()
|
|
26642
28307
|
});
|
|
26643
28308
|
method(object({
|
|
26644
28309
|
claims: SsoBridgeClaimsSchema,
|
|
@@ -28573,7 +30238,22 @@ DeviceType.Camera, method(object({ deviceId: number().int().nonnegative() }), ar
|
|
|
28573
30238
|
* field their hints were silently stripped by the schema and the
|
|
28574
30239
|
* adaptive ladder started blind on the client's display size.
|
|
28575
30240
|
*/
|
|
28576
|
-
hints: webrtcClientHintsSchema.optional()
|
|
30241
|
+
hints: webrtcClientHintsSchema.optional(),
|
|
30242
|
+
/**
|
|
30243
|
+
* Talk-back (D771): relay the PEER's audio to the device's speaker
|
|
30244
|
+
* through the `intercom` cap's push-talk triple. When `true` and the
|
|
30245
|
+
* offer lets the peer send audio, the answer's audio is `sendrecv`
|
|
30246
|
+
* and every inbound frame goes to `intercom.pushTalkAudio` for this
|
|
30247
|
+
* `deviceId`; absent/false answers `sendonly`, as for every viewer.
|
|
30248
|
+
*
|
|
30249
|
+
* TRUSTED-CALLER ONLY. Set by the Alexa export for an Echo on a camera
|
|
30250
|
+
* with `intercom`, when the linked user may control that camera. The
|
|
30251
|
+
* hub STRIPS it from every request-bound call (a browser), exactly as
|
|
30252
|
+
* it overwrites `relayOnly` — a viewer's talk permission is the
|
|
30253
|
+
* intercom cap's own surface (share tokens gate it there), and this
|
|
30254
|
+
* flag must not become a second door to the camera's speaker.
|
|
30255
|
+
*/
|
|
30256
|
+
talkback: boolean().optional()
|
|
28577
30257
|
}), object({
|
|
28578
30258
|
sessionId: string(),
|
|
28579
30259
|
sdpAnswer: string()
|
|
@@ -32099,6 +33779,9 @@ var CreateIntegrationInputSchema = object({
|
|
|
32099
33779
|
enabled: boolean().optional(),
|
|
32100
33780
|
info: record(string(), unknown()).optional(),
|
|
32101
33781
|
settings: record(string(), unknown()).optional(),
|
|
33782
|
+
/** Keys of `settings` the form's schema declares secret (by type) — kept in
|
|
33783
|
+
* the keychain, not the table (D787). */
|
|
33784
|
+
secretKeys: array(string()).optional(),
|
|
32102
33785
|
skipRestart: boolean().optional()
|
|
32103
33786
|
});
|
|
32104
33787
|
var UpdateIntegrationInputSchema = object({
|
|
@@ -32122,7 +33805,9 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
|
|
|
32122
33805
|
auth: "admin"
|
|
32123
33806
|
}), method(object({ id: string() }), record(string(), unknown()), { auth: "admin" }), method(object({
|
|
32124
33807
|
id: string(),
|
|
32125
|
-
settings: record(string(), unknown())
|
|
33808
|
+
settings: record(string(), unknown()),
|
|
33809
|
+
/** Keys the form's schema declares secret (by type) — keychain-stored (D787). */
|
|
33810
|
+
secretKeys: array(string()).optional()
|
|
32126
33811
|
}), object({ success: boolean() }), {
|
|
32127
33812
|
kind: "mutation",
|
|
32128
33813
|
auth: "admin"
|
|
@@ -38944,6 +40629,32 @@ var TotpStatusSchema = object({
|
|
|
38944
40629
|
/** Null when no row exists OR the row is still pending confirmation. */
|
|
38945
40630
|
confirmedAt: number().nullable()
|
|
38946
40631
|
});
|
|
40632
|
+
/**
|
|
40633
|
+
* user-management — singleton capability for user accounts, API keys,
|
|
40634
|
+
* and scoped tokens.
|
|
40635
|
+
*
|
|
40636
|
+
* v2 model: every method gated by `auth: 'admin'`. Admin-only delegation
|
|
40637
|
+
* — the subset check on `setUserScopes` / `createScopedToken` is moot
|
|
40638
|
+
* because non-admins never reach these. If/when we open non-admin
|
|
40639
|
+
* delegation, structural caller-scope subset check goes inside the
|
|
40640
|
+
* provider.
|
|
40641
|
+
*/
|
|
40642
|
+
var ExternalIdentitySchema = object({
|
|
40643
|
+
/** Login-method id of the provider instance, e.g. `auth-oidc/authentik`. */
|
|
40644
|
+
provider: string(),
|
|
40645
|
+
/** The IdP's stable subject (`sub`) for this account. */
|
|
40646
|
+
subject: string(),
|
|
40647
|
+
/** The verified `iss` of the IdP the identity was linked under — `sub` is unique only per issuer. */
|
|
40648
|
+
issuer: string(),
|
|
40649
|
+
userId: string(),
|
|
40650
|
+
/** What the IdP called the account at link time (username / email) — display only. */
|
|
40651
|
+
label: string().optional(),
|
|
40652
|
+
linkedAt: number()
|
|
40653
|
+
});
|
|
40654
|
+
var ExternalIdentityKeySchema = object({
|
|
40655
|
+
provider: string().min(1),
|
|
40656
|
+
subject: string().min(1)
|
|
40657
|
+
});
|
|
38947
40658
|
method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserInputSchema, UserSummarySchema, {
|
|
38948
40659
|
kind: "mutation",
|
|
38949
40660
|
auth: "admin",
|
|
@@ -39057,7 +40768,22 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
|
|
|
39057
40768
|
userId: string(),
|
|
39058
40769
|
username: string(),
|
|
39059
40770
|
scopes: array(TokenScopeSchema)
|
|
39060
|
-
}).nullable(), { access: "view" }), method(
|
|
40771
|
+
}).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
|
|
40772
|
+
userId: string(),
|
|
40773
|
+
issuer: string()
|
|
40774
|
+
}).nullable(), { auth: "admin" }), method(ExternalIdentityKeySchema.extend({
|
|
40775
|
+
userId: string(),
|
|
40776
|
+
issuer: string().min(1),
|
|
40777
|
+
label: string().optional()
|
|
40778
|
+
}), object({ success: literal(true) }), {
|
|
40779
|
+
kind: "mutation",
|
|
40780
|
+
auth: "admin",
|
|
40781
|
+
access: "create"
|
|
40782
|
+
}), method(ExternalIdentityKeySchema.extend({ userId: string() }), object({ success: boolean() }), {
|
|
40783
|
+
kind: "mutation",
|
|
40784
|
+
auth: "admin",
|
|
40785
|
+
access: "delete"
|
|
40786
|
+
}), method(_void(), array(OauthSessionSummarySchema), { auth: "admin" }), method(object({ id: string() }), object({ success: boolean() }), {
|
|
39061
40787
|
kind: "mutation",
|
|
39062
40788
|
auth: "admin",
|
|
39063
40789
|
access: "delete"
|
|
@@ -40244,7 +41970,8 @@ var BaseDevice = class {
|
|
|
40244
41970
|
this.role = options.role;
|
|
40245
41971
|
this.parentDeviceId = ctx.parentDeviceId;
|
|
40246
41972
|
const seedData = ctx.persistedConfig ?? {};
|
|
40247
|
-
|
|
41973
|
+
const declaredSecretPaths = collectZodSecretPaths(schema);
|
|
41974
|
+
this.config = DeviceConfig.fromSchema(schema, (data) => ctx.persistConfig(data, { secretConfigPaths: declaredSecretPaths }), seedData, ({ droppedKeys, issues }) => {
|
|
40248
41975
|
ctx.logger.warn("Device config recovery: dropping invalid persisted fields", {
|
|
40249
41976
|
tags: {
|
|
40250
41977
|
deviceId: ctx.id,
|
|
@@ -43933,6 +45660,90 @@ Object.freeze({
|
|
|
43933
45660
|
addonId: null,
|
|
43934
45661
|
access: "create"
|
|
43935
45662
|
},
|
|
45663
|
+
"keychain.delete": {
|
|
45664
|
+
capName: "keychain",
|
|
45665
|
+
capScope: "system",
|
|
45666
|
+
addonId: null,
|
|
45667
|
+
access: "delete"
|
|
45668
|
+
},
|
|
45669
|
+
"keychain.getState": {
|
|
45670
|
+
capName: "keychain",
|
|
45671
|
+
capScope: "system",
|
|
45672
|
+
addonId: null,
|
|
45673
|
+
access: "view"
|
|
45674
|
+
},
|
|
45675
|
+
"keychain.listMeta": {
|
|
45676
|
+
capName: "keychain",
|
|
45677
|
+
capScope: "system",
|
|
45678
|
+
addonId: null,
|
|
45679
|
+
access: "view"
|
|
45680
|
+
},
|
|
45681
|
+
"keychain.put": {
|
|
45682
|
+
capName: "keychain",
|
|
45683
|
+
capScope: "system",
|
|
45684
|
+
addonId: null,
|
|
45685
|
+
access: "create"
|
|
45686
|
+
},
|
|
45687
|
+
"keychain.resolve": {
|
|
45688
|
+
capName: "keychain",
|
|
45689
|
+
capScope: "system",
|
|
45690
|
+
addonId: null,
|
|
45691
|
+
access: "view"
|
|
45692
|
+
},
|
|
45693
|
+
"keychainAdmin.deleteOrphans": {
|
|
45694
|
+
capName: "keychain-admin",
|
|
45695
|
+
capScope: "system",
|
|
45696
|
+
addonId: null,
|
|
45697
|
+
access: "delete"
|
|
45698
|
+
},
|
|
45699
|
+
"keychainAdmin.downloadRecoveryKey": {
|
|
45700
|
+
capName: "keychain-admin",
|
|
45701
|
+
capScope: "system",
|
|
45702
|
+
addonId: null,
|
|
45703
|
+
access: "create"
|
|
45704
|
+
},
|
|
45705
|
+
"keychainAdmin.listAudit": {
|
|
45706
|
+
capName: "keychain-admin",
|
|
45707
|
+
capScope: "system",
|
|
45708
|
+
addonId: null,
|
|
45709
|
+
access: "view"
|
|
45710
|
+
},
|
|
45711
|
+
"keychainAdmin.listSecrets": {
|
|
45712
|
+
capName: "keychain-admin",
|
|
45713
|
+
capScope: "system",
|
|
45714
|
+
addonId: null,
|
|
45715
|
+
access: "view"
|
|
45716
|
+
},
|
|
45717
|
+
"keychainAdmin.purgeRetiredKeys": {
|
|
45718
|
+
capName: "keychain-admin",
|
|
45719
|
+
capScope: "system",
|
|
45720
|
+
addonId: null,
|
|
45721
|
+
access: "delete"
|
|
45722
|
+
},
|
|
45723
|
+
"keychainAdmin.resetKeychain": {
|
|
45724
|
+
capName: "keychain-admin",
|
|
45725
|
+
capScope: "system",
|
|
45726
|
+
addonId: null,
|
|
45727
|
+
access: "delete"
|
|
45728
|
+
},
|
|
45729
|
+
"keychainAdmin.reveal": {
|
|
45730
|
+
capName: "keychain-admin",
|
|
45731
|
+
capScope: "system",
|
|
45732
|
+
addonId: null,
|
|
45733
|
+
access: "create"
|
|
45734
|
+
},
|
|
45735
|
+
"keychainAdmin.rotateMasterKey": {
|
|
45736
|
+
capName: "keychain-admin",
|
|
45737
|
+
capScope: "system",
|
|
45738
|
+
addonId: null,
|
|
45739
|
+
access: "create"
|
|
45740
|
+
},
|
|
45741
|
+
"keychainAdmin.status": {
|
|
45742
|
+
capName: "keychain-admin",
|
|
45743
|
+
capScope: "system",
|
|
45744
|
+
addonId: null,
|
|
45745
|
+
access: "view"
|
|
45746
|
+
},
|
|
43936
45747
|
"lawnMowerControl.dock": {
|
|
43937
45748
|
capName: "lawn-mower-control",
|
|
43938
45749
|
capScope: "device",
|
|
@@ -45307,6 +47118,18 @@ Object.freeze({
|
|
|
45307
47118
|
addonId: null,
|
|
45308
47119
|
access: "create"
|
|
45309
47120
|
},
|
|
47121
|
+
"pipelineAnalytics.addRetrainFrameFromRecording": {
|
|
47122
|
+
capName: "pipeline-analytics",
|
|
47123
|
+
capScope: "device",
|
|
47124
|
+
addonId: null,
|
|
47125
|
+
access: "create"
|
|
47126
|
+
},
|
|
47127
|
+
"pipelineAnalytics.addRetrainFramesToCollection": {
|
|
47128
|
+
capName: "pipeline-analytics",
|
|
47129
|
+
capScope: "device",
|
|
47130
|
+
addonId: null,
|
|
47131
|
+
access: "create"
|
|
47132
|
+
},
|
|
45310
47133
|
"pipelineAnalytics.applyDeviceSettingsPatch": {
|
|
45311
47134
|
capName: "pipeline-analytics",
|
|
45312
47135
|
capScope: "device",
|
|
@@ -45355,12 +47178,24 @@ Object.freeze({
|
|
|
45355
47178
|
addonId: null,
|
|
45356
47179
|
access: "view"
|
|
45357
47180
|
},
|
|
47181
|
+
"pipelineAnalytics.createRetrainCollection": {
|
|
47182
|
+
capName: "pipeline-analytics",
|
|
47183
|
+
capScope: "device",
|
|
47184
|
+
addonId: null,
|
|
47185
|
+
access: "create"
|
|
47186
|
+
},
|
|
45358
47187
|
"pipelineAnalytics.deleteDeviceEvents": {
|
|
45359
47188
|
capName: "pipeline-analytics",
|
|
45360
47189
|
capScope: "device",
|
|
45361
47190
|
addonId: null,
|
|
45362
47191
|
access: "delete"
|
|
45363
47192
|
},
|
|
47193
|
+
"pipelineAnalytics.deleteRetrainCollection": {
|
|
47194
|
+
capName: "pipeline-analytics",
|
|
47195
|
+
capScope: "device",
|
|
47196
|
+
addonId: null,
|
|
47197
|
+
access: "delete"
|
|
47198
|
+
},
|
|
45364
47199
|
"pipelineAnalytics.deleteTracks": {
|
|
45365
47200
|
capName: "pipeline-analytics",
|
|
45366
47201
|
capScope: "device",
|
|
@@ -45565,6 +47400,24 @@ Object.freeze({
|
|
|
45565
47400
|
addonId: null,
|
|
45566
47401
|
access: "view"
|
|
45567
47402
|
},
|
|
47403
|
+
"pipelineAnalytics.listRetrainAssistProfiles": {
|
|
47404
|
+
capName: "pipeline-analytics",
|
|
47405
|
+
capScope: "device",
|
|
47406
|
+
addonId: null,
|
|
47407
|
+
access: "view"
|
|
47408
|
+
},
|
|
47409
|
+
"pipelineAnalytics.listRetrainCollectionFrames": {
|
|
47410
|
+
capName: "pipeline-analytics",
|
|
47411
|
+
capScope: "device",
|
|
47412
|
+
addonId: null,
|
|
47413
|
+
access: "view"
|
|
47414
|
+
},
|
|
47415
|
+
"pipelineAnalytics.listRetrainCollections": {
|
|
47416
|
+
capName: "pipeline-analytics",
|
|
47417
|
+
capScope: "device",
|
|
47418
|
+
addonId: null,
|
|
47419
|
+
access: "view"
|
|
47420
|
+
},
|
|
45568
47421
|
"pipelineAnalytics.listRetrainFrames": {
|
|
45569
47422
|
capName: "pipeline-analytics",
|
|
45570
47423
|
capScope: "device",
|
|
@@ -45613,6 +47466,12 @@ Object.freeze({
|
|
|
45613
47466
|
addonId: null,
|
|
45614
47467
|
access: "create"
|
|
45615
47468
|
},
|
|
47469
|
+
"pipelineAnalytics.proposeRetrainAnnotationsWithLlm": {
|
|
47470
|
+
capName: "pipeline-analytics",
|
|
47471
|
+
capScope: "device",
|
|
47472
|
+
addonId: null,
|
|
47473
|
+
access: "create"
|
|
47474
|
+
},
|
|
45616
47475
|
"pipelineAnalytics.pruneEvents": {
|
|
45617
47476
|
capName: "pipeline-analytics",
|
|
45618
47477
|
capScope: "device",
|
|
@@ -45667,6 +47526,18 @@ Object.freeze({
|
|
|
45667
47526
|
addonId: null,
|
|
45668
47527
|
access: "create"
|
|
45669
47528
|
},
|
|
47529
|
+
"pipelineAnalytics.removeRetrainFrameFromCollection": {
|
|
47530
|
+
capName: "pipeline-analytics",
|
|
47531
|
+
capScope: "device",
|
|
47532
|
+
addonId: null,
|
|
47533
|
+
access: "delete"
|
|
47534
|
+
},
|
|
47535
|
+
"pipelineAnalytics.renameRetrainCollection": {
|
|
47536
|
+
capName: "pipeline-analytics",
|
|
47537
|
+
capScope: "device",
|
|
47538
|
+
addonId: null,
|
|
47539
|
+
access: "create"
|
|
47540
|
+
},
|
|
45670
47541
|
"pipelineAnalytics.restageRetrainTrack": {
|
|
45671
47542
|
capName: "pipeline-analytics",
|
|
45672
47543
|
capScope: "device",
|
|
@@ -45697,6 +47568,12 @@ Object.freeze({
|
|
|
45697
47568
|
addonId: null,
|
|
45698
47569
|
access: "create"
|
|
45699
47570
|
},
|
|
47571
|
+
"pipelineAnalytics.setRetrainFrameComplete": {
|
|
47572
|
+
capName: "pipeline-analytics",
|
|
47573
|
+
capScope: "device",
|
|
47574
|
+
addonId: null,
|
|
47575
|
+
access: "create"
|
|
47576
|
+
},
|
|
45700
47577
|
"pipelineAnalytics.setTrackFlags": {
|
|
45701
47578
|
capName: "pipeline-analytics",
|
|
45702
47579
|
capScope: "device",
|
|
@@ -45733,6 +47610,12 @@ Object.freeze({
|
|
|
45733
47610
|
addonId: null,
|
|
45734
47611
|
access: "delete"
|
|
45735
47612
|
},
|
|
47613
|
+
"pipelineAnalytics.writeRetrainArchive": {
|
|
47614
|
+
capName: "pipeline-analytics",
|
|
47615
|
+
capScope: "device",
|
|
47616
|
+
addonId: null,
|
|
47617
|
+
access: "create"
|
|
47618
|
+
},
|
|
45736
47619
|
"pipelineExecutor.cacheFrameInPool": {
|
|
45737
47620
|
capName: "pipeline-executor",
|
|
45738
47621
|
capScope: "system",
|
|
@@ -45943,6 +47826,12 @@ Object.freeze({
|
|
|
45943
47826
|
addonId: null,
|
|
45944
47827
|
access: "view"
|
|
45945
47828
|
},
|
|
47829
|
+
"pipelineOrchestrator.abortNodeBenchmark": {
|
|
47830
|
+
capName: "pipeline-orchestrator",
|
|
47831
|
+
capScope: "system",
|
|
47832
|
+
addonId: null,
|
|
47833
|
+
access: "create"
|
|
47834
|
+
},
|
|
45946
47835
|
"pipelineOrchestrator.applyAutoTune": {
|
|
45947
47836
|
capName: "pipeline-orchestrator",
|
|
45948
47837
|
capScope: "system",
|
|
@@ -45967,6 +47856,12 @@ Object.freeze({
|
|
|
45967
47856
|
addonId: null,
|
|
45968
47857
|
access: "create"
|
|
45969
47858
|
},
|
|
47859
|
+
"pipelineOrchestrator.deleteNodeBenchmarkResult": {
|
|
47860
|
+
capName: "pipeline-orchestrator",
|
|
47861
|
+
capScope: "system",
|
|
47862
|
+
addonId: null,
|
|
47863
|
+
access: "delete"
|
|
47864
|
+
},
|
|
45970
47865
|
"pipelineOrchestrator.getAgentLoad": {
|
|
45971
47866
|
capName: "pipeline-orchestrator",
|
|
45972
47867
|
capScope: "system",
|
|
@@ -46075,6 +47970,24 @@ Object.freeze({
|
|
|
46075
47970
|
addonId: null,
|
|
46076
47971
|
access: "view"
|
|
46077
47972
|
},
|
|
47973
|
+
"pipelineOrchestrator.getNodeBenchmarkCandidates": {
|
|
47974
|
+
capName: "pipeline-orchestrator",
|
|
47975
|
+
capScope: "system",
|
|
47976
|
+
addonId: null,
|
|
47977
|
+
access: "view"
|
|
47978
|
+
},
|
|
47979
|
+
"pipelineOrchestrator.getNodeBenchmarkPreflight": {
|
|
47980
|
+
capName: "pipeline-orchestrator",
|
|
47981
|
+
capScope: "system",
|
|
47982
|
+
addonId: null,
|
|
47983
|
+
access: "view"
|
|
47984
|
+
},
|
|
47985
|
+
"pipelineOrchestrator.getNodeBenchmarkStatus": {
|
|
47986
|
+
capName: "pipeline-orchestrator",
|
|
47987
|
+
capScope: "system",
|
|
47988
|
+
addonId: null,
|
|
47989
|
+
access: "view"
|
|
47990
|
+
},
|
|
46078
47991
|
"pipelineOrchestrator.getNodeInferenceDevices": {
|
|
46079
47992
|
capName: "pipeline-orchestrator",
|
|
46080
47993
|
capScope: "system",
|
|
@@ -46117,6 +48030,12 @@ Object.freeze({
|
|
|
46117
48030
|
addonId: null,
|
|
46118
48031
|
access: "view"
|
|
46119
48032
|
},
|
|
48033
|
+
"pipelineOrchestrator.listNodeBenchmarkResults": {
|
|
48034
|
+
capName: "pipeline-orchestrator",
|
|
48035
|
+
capScope: "system",
|
|
48036
|
+
addonId: null,
|
|
48037
|
+
access: "view"
|
|
48038
|
+
},
|
|
46120
48039
|
"pipelineOrchestrator.pauseForStorageMigration": {
|
|
46121
48040
|
capName: "pipeline-orchestrator",
|
|
46122
48041
|
capScope: "system",
|
|
@@ -46261,6 +48180,12 @@ Object.freeze({
|
|
|
46261
48180
|
addonId: null,
|
|
46262
48181
|
access: "create"
|
|
46263
48182
|
},
|
|
48183
|
+
"pipelineOrchestrator.startNodeBenchmark": {
|
|
48184
|
+
capName: "pipeline-orchestrator",
|
|
48185
|
+
capScope: "system",
|
|
48186
|
+
addonId: null,
|
|
48187
|
+
access: "create"
|
|
48188
|
+
},
|
|
46264
48189
|
"pipelineOrchestrator.suggestShares": {
|
|
46265
48190
|
capName: "pipeline-orchestrator",
|
|
46266
48191
|
capScope: "system",
|
|
@@ -46279,6 +48204,12 @@ Object.freeze({
|
|
|
46279
48204
|
addonId: null,
|
|
46280
48205
|
access: "create"
|
|
46281
48206
|
},
|
|
48207
|
+
"pipelineRunner.abortNodeBench": {
|
|
48208
|
+
capName: "pipeline-runner",
|
|
48209
|
+
capScope: "system",
|
|
48210
|
+
addonId: null,
|
|
48211
|
+
access: "create"
|
|
48212
|
+
},
|
|
46282
48213
|
"pipelineRunner.attachCamera": {
|
|
46283
48214
|
capName: "pipeline-runner",
|
|
46284
48215
|
capScope: "system",
|
|
@@ -46327,6 +48258,12 @@ Object.freeze({
|
|
|
46327
48258
|
addonId: null,
|
|
46328
48259
|
access: "view"
|
|
46329
48260
|
},
|
|
48261
|
+
"pipelineRunner.getNodeBenchStatus": {
|
|
48262
|
+
capName: "pipeline-runner",
|
|
48263
|
+
capScope: "system",
|
|
48264
|
+
addonId: null,
|
|
48265
|
+
access: "view"
|
|
48266
|
+
},
|
|
46330
48267
|
"pipelineRunner.getParkedTrackFrame": {
|
|
46331
48268
|
capName: "pipeline-runner",
|
|
46332
48269
|
capScope: "system",
|
|
@@ -46369,6 +48306,12 @@ Object.freeze({
|
|
|
46369
48306
|
addonId: null,
|
|
46370
48307
|
access: "create"
|
|
46371
48308
|
},
|
|
48309
|
+
"pipelineRunner.startNodeBench": {
|
|
48310
|
+
capName: "pipeline-runner",
|
|
48311
|
+
capScope: "system",
|
|
48312
|
+
addonId: null,
|
|
48313
|
+
access: "create"
|
|
48314
|
+
},
|
|
46372
48315
|
"plateGallery.assignPlate": {
|
|
46373
48316
|
capName: "plate-gallery",
|
|
46374
48317
|
capScope: "system",
|
|
@@ -48085,18 +50028,36 @@ Object.freeze({
|
|
|
48085
50028
|
addonId: null,
|
|
48086
50029
|
access: "delete"
|
|
48087
50030
|
},
|
|
50031
|
+
"userManagement.findUserByExternalIdentity": {
|
|
50032
|
+
capName: "user-management",
|
|
50033
|
+
capScope: "system",
|
|
50034
|
+
addonId: null,
|
|
50035
|
+
access: "view"
|
|
50036
|
+
},
|
|
48088
50037
|
"userManagement.getTotpStatus": {
|
|
48089
50038
|
capName: "user-management",
|
|
48090
50039
|
capScope: "system",
|
|
48091
50040
|
addonId: null,
|
|
48092
50041
|
access: "view"
|
|
48093
50042
|
},
|
|
50043
|
+
"userManagement.linkExternalIdentity": {
|
|
50044
|
+
capName: "user-management",
|
|
50045
|
+
capScope: "system",
|
|
50046
|
+
addonId: null,
|
|
50047
|
+
access: "create"
|
|
50048
|
+
},
|
|
48094
50049
|
"userManagement.listApiKeys": {
|
|
48095
50050
|
capName: "user-management",
|
|
48096
50051
|
capScope: "system",
|
|
48097
50052
|
addonId: null,
|
|
48098
50053
|
access: "view"
|
|
48099
50054
|
},
|
|
50055
|
+
"userManagement.listExternalIdentities": {
|
|
50056
|
+
capName: "user-management",
|
|
50057
|
+
capScope: "system",
|
|
50058
|
+
addonId: null,
|
|
50059
|
+
access: "view"
|
|
50060
|
+
},
|
|
48100
50061
|
"userManagement.listOauthSessions": {
|
|
48101
50062
|
capName: "user-management",
|
|
48102
50063
|
capScope: "system",
|
|
@@ -48175,6 +50136,12 @@ Object.freeze({
|
|
|
48175
50136
|
addonId: null,
|
|
48176
50137
|
access: "create"
|
|
48177
50138
|
},
|
|
50139
|
+
"userManagement.unlinkExternalIdentity": {
|
|
50140
|
+
capName: "user-management",
|
|
50141
|
+
capScope: "system",
|
|
50142
|
+
addonId: null,
|
|
50143
|
+
access: "delete"
|
|
50144
|
+
},
|
|
48178
50145
|
"userManagement.updateUser": {
|
|
48179
50146
|
capName: "user-management",
|
|
48180
50147
|
capScope: "system",
|
|
@@ -51274,6 +53241,11 @@ Object.freeze({
|
|
|
51274
53241
|
form: "single",
|
|
51275
53242
|
optional: false
|
|
51276
53243
|
}],
|
|
53244
|
+
"pipelineAnalytics.addRetrainFrameFromRecording": [{
|
|
53245
|
+
name: "deviceId",
|
|
53246
|
+
form: "single",
|
|
53247
|
+
optional: false
|
|
53248
|
+
}],
|
|
51277
53249
|
"pipelineAnalytics.applyDeviceSettingsPatch": [{
|
|
51278
53250
|
name: "deviceId",
|
|
51279
53251
|
form: "single",
|
|
@@ -51464,6 +53436,11 @@ Object.freeze({
|
|
|
51464
53436
|
form: "single",
|
|
51465
53437
|
optional: false
|
|
51466
53438
|
}],
|
|
53439
|
+
"pipelineAnalytics.proposeRetrainAnnotationsWithLlm": [{
|
|
53440
|
+
name: "deviceId",
|
|
53441
|
+
form: "single",
|
|
53442
|
+
optional: false
|
|
53443
|
+
}],
|
|
51467
53444
|
"pipelineAnalytics.pruneEventsBefore": [{
|
|
51468
53445
|
name: "deviceId",
|
|
51469
53446
|
form: "single",
|
|
@@ -51514,6 +53491,11 @@ Object.freeze({
|
|
|
51514
53491
|
form: "single",
|
|
51515
53492
|
optional: false
|
|
51516
53493
|
}],
|
|
53494
|
+
"pipelineAnalytics.setRetrainFrameComplete": [{
|
|
53495
|
+
name: "deviceId",
|
|
53496
|
+
form: "single",
|
|
53497
|
+
optional: false
|
|
53498
|
+
}],
|
|
51517
53499
|
"pipelineAnalytics.setTrackFlags": [{
|
|
51518
53500
|
name: "deviceId",
|
|
51519
53501
|
form: "single",
|
|
@@ -53577,9 +55559,9 @@ var MB = 1024 * 1024;
|
|
|
53577
55559
|
var unifiConnectionSchema = object({
|
|
53578
55560
|
host: string().min(1).describe("Controller host name or IP address"),
|
|
53579
55561
|
port: preprocess((v) => v === "" || v === null ? void 0 : v, number().int().min(1).max(65535).default(443)).describe("Controller HTTPS port (443 on UniFi OS, 8443 on legacy)"),
|
|
53580
|
-
apiKey: string().default("").describe("UniFi OS API key (preferred). Leave blank to use username + password."),
|
|
55562
|
+
apiKey: string().default("").describe("UniFi OS API key (preferred). Leave blank to use username + password.").meta({ secret: true }),
|
|
53581
55563
|
username: string().default("").describe("Local admin username (when no API key)"),
|
|
53582
|
-
password: string().default("").describe("Local admin password (when no API key)"),
|
|
55564
|
+
password: string().default("").describe("Local admin password (when no API key)").meta({ secret: true }),
|
|
53583
55565
|
site: string().default("default").describe("Controller site name"),
|
|
53584
55566
|
pollIntervalMs: preprocess((v) => v === "" || v === null ? void 0 : v, number().int().min(2e3).max(36e5).default(3e4)).describe("Infra + client poll interval (ms)")
|
|
53585
55567
|
});
|