@camstack/addon-agent-ui 1.2.191 → 1.2.192
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { fileURLToPath } from "node:url";
|
|
3
|
-
//#region ../types/dist/event-category-
|
|
3
|
+
//#region ../types/dist/event-category-DaIZi00R.mjs
|
|
4
4
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
5
5
|
EventCategory["SystemBoot"] = "system.boot";
|
|
6
6
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -79,6 +79,13 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
79
79
|
*/
|
|
80
80
|
EventCategory["AddonLoadFailed"] = "addon.load-failed";
|
|
81
81
|
/**
|
|
82
|
+
* A keychain value was stored or removed (D787). Carries the ref, its
|
|
83
|
+
* owner and the new version — NEVER the value. A process holding the ref
|
|
84
|
+
* drops its cached copy and the owning `BaseAddon` re-resolves its config.
|
|
85
|
+
* Telemetry (D8): a process that misses it still revalidates by version.
|
|
86
|
+
*/
|
|
87
|
+
EventCategory["KeychainChanged"] = "keychain.changed";
|
|
88
|
+
/**
|
|
82
89
|
* Addon recovered from a previous failure. Emitted when an addon
|
|
83
90
|
* transitions from `failed` back to `healthy` (typically via the
|
|
84
91
|
* monitor's auto-retry loop, or after manual `addons.retryLoad`).
|
|
@@ -5371,7 +5378,7 @@ var ZodIssueCode = {
|
|
|
5371
5378
|
var ZodFirstPartyTypeKind;
|
|
5372
5379
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5373
5380
|
//#endregion
|
|
5374
|
-
//#region ../types/dist/sleep-
|
|
5381
|
+
//#region ../types/dist/sleep-Cr5YOk3m.mjs
|
|
5375
5382
|
/**
|
|
5376
5383
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5377
5384
|
* window to float samples (D455).
|
|
@@ -5450,6 +5457,97 @@ function buildAlawTable() {
|
|
|
5450
5457
|
}
|
|
5451
5458
|
buildUlawTable();
|
|
5452
5459
|
buildAlawTable();
|
|
5460
|
+
/** Is this field's stored value a credential? */
|
|
5461
|
+
function isSecretConfigField(field) {
|
|
5462
|
+
if (field.type === "password") return true;
|
|
5463
|
+
return "secret" in field && field.secret === true;
|
|
5464
|
+
}
|
|
5465
|
+
/**
|
|
5466
|
+
* Is this field's value stored in the KEYCHAIN (D787)? Every secret field is,
|
|
5467
|
+
* by its TYPE, unless it opts out with `storage: 'inline'` — never by its name.
|
|
5468
|
+
*/
|
|
5469
|
+
function isKeychainStoredField(field) {
|
|
5470
|
+
if (!isSecretConfigField(field)) return false;
|
|
5471
|
+
if (field.type === "textarea" && field.isJson === true) return false;
|
|
5472
|
+
return !("storage" in field && field.storage === "inline");
|
|
5473
|
+
}
|
|
5474
|
+
/**
|
|
5475
|
+
* What a settings blob holds where a secret used to be.
|
|
5476
|
+
*
|
|
5477
|
+
* A keychain-stored field never holds its value. It holds a self-describing
|
|
5478
|
+
* MARKER, `{"$secret":"secret://…","v":1}` — an object, never a string, so no
|
|
5479
|
+
* code can mistake it for a credential and no form can send it to a camera as
|
|
5480
|
+
* a password. The empty state is `null` / absent, never `''`.
|
|
5481
|
+
*
|
|
5482
|
+
* The same shapes travel to and from the admin UI:
|
|
5483
|
+
*
|
|
5484
|
+
* - read: `hydrateSchema` hands a secret field a {@link SecretFieldView}
|
|
5485
|
+
* (`{ $secret, v, set: true }`) or `null` — the browser learns whether a
|
|
5486
|
+
* value is set, never the value.
|
|
5487
|
+
* - write: an untouched field submits the view back unchanged (KEEP); a typed
|
|
5488
|
+
* value is a plain non-empty string (CHANGE); the Clear button submits
|
|
5489
|
+
* {@link SECRET_CLEAR} (CLEAR). `''`, `null` and the legacy redaction tokens
|
|
5490
|
+
* are KEEP — an empty string is what a defaults-fallback pushes back, and
|
|
5491
|
+
* treating it as "clear" is how a save destroyed a stored credential before.
|
|
5492
|
+
*
|
|
5493
|
+
* Pure and browser-safe.
|
|
5494
|
+
*/
|
|
5495
|
+
var SECRET_CLEAR = { $secretClear: true };
|
|
5496
|
+
/** The `'***'` token D634 redaction writes for non-admins. */
|
|
5497
|
+
var LEGACY_DEVICE_REDACTION = "***";
|
|
5498
|
+
function isRecord$1(value) {
|
|
5499
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5500
|
+
}
|
|
5501
|
+
function makeSecretMarker(ref) {
|
|
5502
|
+
return {
|
|
5503
|
+
$secret: ref,
|
|
5504
|
+
v: 1
|
|
5505
|
+
};
|
|
5506
|
+
}
|
|
5507
|
+
/** A stored marker: an object whose `$secret` is a non-empty string. */
|
|
5508
|
+
function isSecretMarker(value) {
|
|
5509
|
+
if (!isRecord$1(value)) return false;
|
|
5510
|
+
const ref = value["$secret"];
|
|
5511
|
+
return typeof ref === "string" && ref.length > 0;
|
|
5512
|
+
}
|
|
5513
|
+
function isSecretClear(value) {
|
|
5514
|
+
return isRecord$1(value) && value["$secretClear"] === true;
|
|
5515
|
+
}
|
|
5516
|
+
/**
|
|
5517
|
+
* The UI view of a stored secret field value: a marker becomes "set", inline
|
|
5518
|
+
* plaintext becomes "set (inline)", nothing becomes `null`. A value never
|
|
5519
|
+
* survives this function.
|
|
5520
|
+
*/
|
|
5521
|
+
function toSecretFieldView(stored) {
|
|
5522
|
+
if (isSecretMarker(stored)) return {
|
|
5523
|
+
$secret: stored.$secret,
|
|
5524
|
+
v: 1,
|
|
5525
|
+
set: true
|
|
5526
|
+
};
|
|
5527
|
+
if (typeof stored === "string" && stored.length > 0) return {
|
|
5528
|
+
$secret: null,
|
|
5529
|
+
v: 1,
|
|
5530
|
+
set: true,
|
|
5531
|
+
inline: true
|
|
5532
|
+
};
|
|
5533
|
+
return null;
|
|
5534
|
+
}
|
|
5535
|
+
/**
|
|
5536
|
+
* Classify an incoming value for a secret path. Only a non-empty string that is
|
|
5537
|
+
* not a redaction token sets a value; only {@link SECRET_CLEAR} clears.
|
|
5538
|
+
* Everything else — a marker (ours or anyone's), a UI view, `''`, `null`,
|
|
5539
|
+
* `undefined`, a redaction token, a non-string — keeps what is stored.
|
|
5540
|
+
*/
|
|
5541
|
+
function classifySecretWrite(incoming) {
|
|
5542
|
+
if (isSecretClear(incoming)) return { kind: "clear" };
|
|
5543
|
+
if (typeof incoming !== "string") return { kind: "keep" };
|
|
5544
|
+
if (incoming.length === 0) return { kind: "keep" };
|
|
5545
|
+
if (incoming === "__camstack_redacted__" || incoming === LEGACY_DEVICE_REDACTION) return { kind: "keep" };
|
|
5546
|
+
return {
|
|
5547
|
+
kind: "set",
|
|
5548
|
+
value: incoming
|
|
5549
|
+
};
|
|
5550
|
+
}
|
|
5453
5551
|
Object.fromEntries([
|
|
5454
5552
|
{
|
|
5455
5553
|
id: "overview",
|
|
@@ -5621,33 +5719,19 @@ Object.fromEntries([
|
|
|
5621
5719
|
function isValuelessField(field) {
|
|
5622
5720
|
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";
|
|
5623
5721
|
}
|
|
5624
|
-
|
|
5625
|
-
* Merge a `ConfigUISchema` with a raw `values` record into a
|
|
5626
|
-
* `ConfigUISchemaWithValues`. Used by every `get*Settings` backend endpoint
|
|
5627
|
-
* before returning to the admin UI. Groups are walked recursively.
|
|
5628
|
-
*
|
|
5629
|
-
* For each leaf field:
|
|
5630
|
-
* - structural fields (`separator`, `info`, `button`) pass through unchanged
|
|
5631
|
-
* - other fields get `value = values[key] ?? field.default ?? null`
|
|
5632
|
-
*
|
|
5633
|
-
* Unknown keys in `values` (keys not declared in the schema) are silently
|
|
5634
|
-
* ignored — they don't contribute to the output. Missing keys fall back to
|
|
5635
|
-
* the schema default or `null`. This mirrors the old backend behaviour where
|
|
5636
|
-
* `FormBuilder` rendered `values[key] ?? field.default`.
|
|
5637
|
-
*/
|
|
5638
|
-
function hydrateSchema(schema, values) {
|
|
5722
|
+
function hydrateSchema(schema, values, options = {}) {
|
|
5639
5723
|
return {
|
|
5640
5724
|
...schema.tabs ? { tabs: [...schema.tabs] } : {},
|
|
5641
5725
|
sections: schema.sections.map((section) => ({
|
|
5642
5726
|
...section,
|
|
5643
|
-
fields: section.fields.map((field) => hydrateField(field, values))
|
|
5727
|
+
fields: section.fields.map((field) => hydrateField(field, values, options))
|
|
5644
5728
|
}))
|
|
5645
5729
|
};
|
|
5646
5730
|
}
|
|
5647
|
-
function hydrateField(field, values) {
|
|
5731
|
+
function hydrateField(field, values, options) {
|
|
5648
5732
|
if (isValuelessField(field)) return field;
|
|
5649
5733
|
if (field.type === "group") {
|
|
5650
|
-
const hydratedChildren = field.fields.map((child) => hydrateField(child, values));
|
|
5734
|
+
const hydratedChildren = field.fields.map((child) => hydrateField(child, values, options));
|
|
5651
5735
|
return {
|
|
5652
5736
|
...field,
|
|
5653
5737
|
fields: hydratedChildren
|
|
@@ -5656,7 +5740,7 @@ function hydrateField(field, values) {
|
|
|
5656
5740
|
if (field.type === "sub-tabs") {
|
|
5657
5741
|
const hydratedTabs = field.tabs.map((tab) => ({
|
|
5658
5742
|
...tab,
|
|
5659
|
-
fields: tab.fields.map((child) => hydrateField(child, values))
|
|
5743
|
+
fields: tab.fields.map((child) => hydrateField(child, values, options))
|
|
5660
5744
|
}));
|
|
5661
5745
|
return {
|
|
5662
5746
|
...field,
|
|
@@ -5666,6 +5750,33 @@ function hydrateField(field, values) {
|
|
|
5666
5750
|
const key = field.key;
|
|
5667
5751
|
const storedValue = Object.prototype.hasOwnProperty.call(values, key) ? values[key] : void 0;
|
|
5668
5752
|
const defaultValue = field.default;
|
|
5753
|
+
const asView = (v) => isSecretMarker(v) || options.inlineSecretsAsViews === true && v !== void 0;
|
|
5754
|
+
if (isKeychainStoredField(field) && asView(storedValue)) return {
|
|
5755
|
+
...field,
|
|
5756
|
+
value: toSecretFieldView(storedValue)
|
|
5757
|
+
};
|
|
5758
|
+
if (isKeychainStoredField(field) && options.inlineSecretsAsViews === true) return {
|
|
5759
|
+
...field,
|
|
5760
|
+
value: null
|
|
5761
|
+
};
|
|
5762
|
+
if (field.type === "editable-array" && Array.isArray(storedValue)) {
|
|
5763
|
+
const secretItemKeys = field.itemFields.filter((item) => "key" in item && isKeychainStoredField(item)).map((item) => "key" in item ? item.key : "");
|
|
5764
|
+
if (secretItemKeys.length > 0) {
|
|
5765
|
+
const rows = storedValue.map((row) => {
|
|
5766
|
+
if (row === null || typeof row !== "object" || Array.isArray(row)) return row;
|
|
5767
|
+
const out = { ...row };
|
|
5768
|
+
for (const k of secretItemKeys) {
|
|
5769
|
+
const v = Reflect.get(row, k);
|
|
5770
|
+
if (asView(v)) out[k] = toSecretFieldView(v);
|
|
5771
|
+
}
|
|
5772
|
+
return out;
|
|
5773
|
+
});
|
|
5774
|
+
return {
|
|
5775
|
+
...field,
|
|
5776
|
+
value: rows
|
|
5777
|
+
};
|
|
5778
|
+
}
|
|
5779
|
+
}
|
|
5669
5780
|
if (field.multiple) {
|
|
5670
5781
|
const stored = Array.isArray(storedValue) ? storedValue : storedValue !== void 0 && storedValue !== null ? [storedValue] : [];
|
|
5671
5782
|
const itemFallback = field.multiple.itemDefault !== void 0 ? field.multiple.itemDefault : defaultValue !== void 0 ? defaultValue : typeOf(field) === "string" ? "" : null;
|
|
@@ -5908,6 +6019,431 @@ function projectStore(store, perNodeKeys, nodeId) {
|
|
|
5908
6019
|
}
|
|
5909
6020
|
return out;
|
|
5910
6021
|
}
|
|
6022
|
+
var GLOBAL_SCOPE = { kind: "global" };
|
|
6023
|
+
/** The scope every addon-wide (not per-node, not per-device) setting lives in. */
|
|
6024
|
+
function globalSecretScope() {
|
|
6025
|
+
return GLOBAL_SCOPE;
|
|
6026
|
+
}
|
|
6027
|
+
function encodeSegment(value) {
|
|
6028
|
+
return encodeURIComponent(value);
|
|
6029
|
+
}
|
|
6030
|
+
/**
|
|
6031
|
+
* The field path of a value inside an array item, addressed by the item's id:
|
|
6032
|
+
* `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
|
|
6033
|
+
* `providers[authentik].clientSecret`.
|
|
6034
|
+
*/
|
|
6035
|
+
function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
|
|
6036
|
+
return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
|
|
6037
|
+
}
|
|
6038
|
+
/** A write to a secret path could not be stored in the keychain, so it was refused. */
|
|
6039
|
+
var KeychainWriteRefusedError = class extends Error {
|
|
6040
|
+
fieldPath;
|
|
6041
|
+
constructor(fieldPath, cause) {
|
|
6042
|
+
super(`secret "${fieldPath}" was not saved: the keychain could not store it (${cause instanceof Error ? cause.message : String(cause)}). Nothing was written.`);
|
|
6043
|
+
this.fieldPath = fieldPath;
|
|
6044
|
+
this.name = "KeychainWriteRefusedError";
|
|
6045
|
+
}
|
|
6046
|
+
};
|
|
6047
|
+
var KEEP = { kind: "keep" };
|
|
6048
|
+
function isRecord(value) {
|
|
6049
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6050
|
+
}
|
|
6051
|
+
function defaultMintId() {
|
|
6052
|
+
return globalThis.crypto.randomUUID();
|
|
6053
|
+
}
|
|
6054
|
+
/** Every marker ref anywhere under `value`. */
|
|
6055
|
+
function collectSecretMarkerRefs(value, out = []) {
|
|
6056
|
+
if (isSecretMarker(value)) {
|
|
6057
|
+
out.push(value.$secret);
|
|
6058
|
+
return out;
|
|
6059
|
+
}
|
|
6060
|
+
if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
|
|
6061
|
+
else if (isRecord(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
6062
|
+
return out;
|
|
6063
|
+
}
|
|
6064
|
+
async function storedValueEquals(secrets, marker, candidate) {
|
|
6065
|
+
const resolved = (await secrets.resolve([marker.$secret]))[marker.$secret];
|
|
6066
|
+
return resolved?.kind === "value" && resolved.value === candidate;
|
|
6067
|
+
}
|
|
6068
|
+
async function writeLeaf(ctx, incoming, stored, fieldPath) {
|
|
6069
|
+
const intent = classifySecretWrite(incoming);
|
|
6070
|
+
const ref = ctx.secrets.ref(ctx.scope, fieldPath);
|
|
6071
|
+
const storedIsOurs = isSecretMarker(stored) && stored.$secret === ref;
|
|
6072
|
+
if (intent.kind === "keep") return KEEP;
|
|
6073
|
+
if (intent.kind === "set" && !ctx.operatorWrite && typeof stored === "string" && stored === intent.value) return KEEP;
|
|
6074
|
+
if (intent.kind === "clear") {
|
|
6075
|
+
if (storedIsOurs) ctx.deletes.push(ref);
|
|
6076
|
+
return {
|
|
6077
|
+
kind: "value",
|
|
6078
|
+
value: null
|
|
6079
|
+
};
|
|
6080
|
+
}
|
|
6081
|
+
if (storedIsOurs && await storedValueEquals(ctx.secrets, stored, intent.value)) return {
|
|
6082
|
+
kind: "value",
|
|
6083
|
+
value: stored
|
|
6084
|
+
};
|
|
6085
|
+
try {
|
|
6086
|
+
await ctx.secrets.put(ref, intent.value);
|
|
6087
|
+
} catch (err) {
|
|
6088
|
+
throw new KeychainWriteRefusedError(fieldPath, err);
|
|
6089
|
+
}
|
|
6090
|
+
return {
|
|
6091
|
+
kind: "value",
|
|
6092
|
+
value: makeSecretMarker(ref)
|
|
6093
|
+
};
|
|
6094
|
+
}
|
|
6095
|
+
/** Apply a member result onto `out`: KEEP restores the stored member, or removes it. */
|
|
6096
|
+
function applyMember(out, key, result, storedParent) {
|
|
6097
|
+
if (result.kind === "value") {
|
|
6098
|
+
out[key] = result.value;
|
|
6099
|
+
return;
|
|
6100
|
+
}
|
|
6101
|
+
if (Object.prototype.hasOwnProperty.call(storedParent, key)) out[key] = storedParent[key];
|
|
6102
|
+
else delete out[key];
|
|
6103
|
+
}
|
|
6104
|
+
async function writeMembers(ctx, children, incoming, stored, pathOf) {
|
|
6105
|
+
const out = { ...incoming };
|
|
6106
|
+
for (const [member, node] of children) applyMember(out, member, await writeNode(ctx, node, incoming[member], stored[member], pathOf(member)), stored);
|
|
6107
|
+
return out;
|
|
6108
|
+
}
|
|
6109
|
+
function rowId(row, idKey) {
|
|
6110
|
+
const raw = row[idKey];
|
|
6111
|
+
if (typeof raw === "string" && raw.length > 0) return raw;
|
|
6112
|
+
if (typeof raw === "number" && Number.isFinite(raw)) return String(raw);
|
|
6113
|
+
return null;
|
|
6114
|
+
}
|
|
6115
|
+
async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
6116
|
+
const storedRows = Array.isArray(stored) ? stored.filter(isRecord) : [];
|
|
6117
|
+
if (!Array.isArray(incoming)) {
|
|
6118
|
+
ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
|
|
6119
|
+
return {
|
|
6120
|
+
kind: "value",
|
|
6121
|
+
value: incoming
|
|
6122
|
+
};
|
|
6123
|
+
}
|
|
6124
|
+
const storedById = /* @__PURE__ */ new Map();
|
|
6125
|
+
for (const row of storedRows) {
|
|
6126
|
+
const id = rowId(row, node.idKey);
|
|
6127
|
+
if (id !== null) storedById.set(id, row);
|
|
6128
|
+
}
|
|
6129
|
+
const kept = /* @__PURE__ */ new Set();
|
|
6130
|
+
const rows = [];
|
|
6131
|
+
for (const row of incoming) {
|
|
6132
|
+
if (!isRecord(row)) {
|
|
6133
|
+
rows.push(row);
|
|
6134
|
+
continue;
|
|
6135
|
+
}
|
|
6136
|
+
const id = rowId(row, node.idKey) ?? ctx.mintId();
|
|
6137
|
+
kept.add(id);
|
|
6138
|
+
const withId = {
|
|
6139
|
+
...row,
|
|
6140
|
+
[node.idKey]: row[node.idKey] ?? id
|
|
6141
|
+
};
|
|
6142
|
+
if (rowId(withId, node.idKey) === null) withId[node.idKey] = id;
|
|
6143
|
+
const storedRow = storedById.get(id) ?? {};
|
|
6144
|
+
rows.push(await writeMembers(ctx, node.item, withId, storedRow, (member) => arrayItemFieldPath(fieldPath, id, member)));
|
|
6145
|
+
}
|
|
6146
|
+
for (const [id, row] of storedById) if (!kept.has(id)) ctx.deletes.push(...collectSecretMarkerRefs(row));
|
|
6147
|
+
return {
|
|
6148
|
+
kind: "value",
|
|
6149
|
+
value: rows
|
|
6150
|
+
};
|
|
6151
|
+
}
|
|
6152
|
+
async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
6153
|
+
switch (node.kind) {
|
|
6154
|
+
case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
|
|
6155
|
+
case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
|
|
6156
|
+
case "object": {
|
|
6157
|
+
if (!isRecord(incoming)) {
|
|
6158
|
+
if (incoming === void 0) return KEEP;
|
|
6159
|
+
ctx.deletes.push(...collectSecretMarkerRefs(stored));
|
|
6160
|
+
return {
|
|
6161
|
+
kind: "value",
|
|
6162
|
+
value: incoming
|
|
6163
|
+
};
|
|
6164
|
+
}
|
|
6165
|
+
const storedObj = isRecord(stored) ? stored : {};
|
|
6166
|
+
return {
|
|
6167
|
+
kind: "value",
|
|
6168
|
+
value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
|
|
6169
|
+
};
|
|
6170
|
+
}
|
|
6171
|
+
}
|
|
6172
|
+
}
|
|
6173
|
+
/** Split a perNode-scoped key (`key@nodeId`). */
|
|
6174
|
+
function splitNodeKey(key) {
|
|
6175
|
+
const at = key.indexOf("@");
|
|
6176
|
+
return at <= 0 ? {
|
|
6177
|
+
base: key,
|
|
6178
|
+
nodeId: null
|
|
6179
|
+
} : {
|
|
6180
|
+
base: key.slice(0, at),
|
|
6181
|
+
nodeId: key.slice(at + 1)
|
|
6182
|
+
};
|
|
6183
|
+
}
|
|
6184
|
+
/** Rewrite a settings patch so no secret value reaches the blob. See the file doc. */
|
|
6185
|
+
async function transformSecretWrite(input) {
|
|
6186
|
+
const deletes = [];
|
|
6187
|
+
const base = {
|
|
6188
|
+
secrets: input.secrets,
|
|
6189
|
+
mintId: input.mintId ?? defaultMintId,
|
|
6190
|
+
deletes,
|
|
6191
|
+
operatorWrite: input.operatorWrite === true
|
|
6192
|
+
};
|
|
6193
|
+
const out = {};
|
|
6194
|
+
for (const [key, incoming] of Object.entries(input.patch)) {
|
|
6195
|
+
const { base: baseKey, nodeId } = splitNodeKey(key);
|
|
6196
|
+
const node = input.tree.get(baseKey);
|
|
6197
|
+
if (node === void 0) {
|
|
6198
|
+
out[key] = incoming;
|
|
6199
|
+
continue;
|
|
6200
|
+
}
|
|
6201
|
+
const scope = nodeId !== null && nodeId.length > 0 ? {
|
|
6202
|
+
kind: "node",
|
|
6203
|
+
nodeId
|
|
6204
|
+
} : input.scope ?? globalSecretScope();
|
|
6205
|
+
const result = await writeNode({
|
|
6206
|
+
...base,
|
|
6207
|
+
scope
|
|
6208
|
+
}, node, incoming, input.stored[key], baseKey);
|
|
6209
|
+
if (result.kind === "value") out[key] = result.value;
|
|
6210
|
+
}
|
|
6211
|
+
return {
|
|
6212
|
+
patch: out,
|
|
6213
|
+
afterWrite: async () => {
|
|
6214
|
+
if (deletes.length === 0) return { orphaned: [] };
|
|
6215
|
+
try {
|
|
6216
|
+
await input.secrets.delete([...new Set(deletes)]);
|
|
6217
|
+
return { orphaned: [] };
|
|
6218
|
+
} catch {
|
|
6219
|
+
return { orphaned: [...new Set(deletes)] };
|
|
6220
|
+
}
|
|
6221
|
+
}
|
|
6222
|
+
};
|
|
6223
|
+
}
|
|
6224
|
+
/**
|
|
6225
|
+
* Replace every marker in `value` with its keychain value. Returns the SAME
|
|
6226
|
+
* reference when there is no marker (no allocation, no keychain call).
|
|
6227
|
+
*/
|
|
6228
|
+
async function resolveSecretMarkers(value, secrets) {
|
|
6229
|
+
const refs = collectSecretMarkerRefs(value);
|
|
6230
|
+
if (refs.length === 0) return {
|
|
6231
|
+
value,
|
|
6232
|
+
unresolved: []
|
|
6233
|
+
};
|
|
6234
|
+
const answers = await secrets.resolve(refs);
|
|
6235
|
+
const unresolved = [];
|
|
6236
|
+
for (const ref of new Set(refs)) {
|
|
6237
|
+
const answer = answers[ref];
|
|
6238
|
+
if (answer === void 0) unresolved.push({
|
|
6239
|
+
ref,
|
|
6240
|
+
reason: "not-initialized"
|
|
6241
|
+
});
|
|
6242
|
+
else if (answer.kind === "unavailable") unresolved.push({
|
|
6243
|
+
ref,
|
|
6244
|
+
reason: answer.reason
|
|
6245
|
+
});
|
|
6246
|
+
else if (answer.kind === "missing" || answer.kind === "forbidden") unresolved.push({
|
|
6247
|
+
ref,
|
|
6248
|
+
reason: answer.kind
|
|
6249
|
+
});
|
|
6250
|
+
}
|
|
6251
|
+
const substitute = (v) => {
|
|
6252
|
+
if (isSecretMarker(v)) {
|
|
6253
|
+
const answer = answers[v.$secret];
|
|
6254
|
+
return answer?.kind === "value" ? {
|
|
6255
|
+
keep: true,
|
|
6256
|
+
value: answer.value
|
|
6257
|
+
} : {
|
|
6258
|
+
keep: false,
|
|
6259
|
+
value: void 0
|
|
6260
|
+
};
|
|
6261
|
+
}
|
|
6262
|
+
if (Array.isArray(v)) {
|
|
6263
|
+
const items = [];
|
|
6264
|
+
for (const item of v) {
|
|
6265
|
+
const s = substitute(item);
|
|
6266
|
+
if (s.keep) items.push(s.value);
|
|
6267
|
+
}
|
|
6268
|
+
return {
|
|
6269
|
+
keep: true,
|
|
6270
|
+
value: items
|
|
6271
|
+
};
|
|
6272
|
+
}
|
|
6273
|
+
if (isRecord(v)) {
|
|
6274
|
+
const out = {};
|
|
6275
|
+
for (const [k, child] of Object.entries(v)) {
|
|
6276
|
+
const s = substitute(child);
|
|
6277
|
+
if (s.keep) out[k] = s.value;
|
|
6278
|
+
}
|
|
6279
|
+
return {
|
|
6280
|
+
keep: true,
|
|
6281
|
+
value: out
|
|
6282
|
+
};
|
|
6283
|
+
}
|
|
6284
|
+
return {
|
|
6285
|
+
keep: true,
|
|
6286
|
+
value: v
|
|
6287
|
+
};
|
|
6288
|
+
};
|
|
6289
|
+
return {
|
|
6290
|
+
value: substitute(value).value,
|
|
6291
|
+
unresolved
|
|
6292
|
+
};
|
|
6293
|
+
}
|
|
6294
|
+
function touchesTree(tree, patch) {
|
|
6295
|
+
if (tree.size === 0) return false;
|
|
6296
|
+
for (const key of Object.keys(patch)) {
|
|
6297
|
+
const at = key.indexOf("@");
|
|
6298
|
+
if (tree.has(at > 0 ? key.slice(0, at) : key)) return true;
|
|
6299
|
+
}
|
|
6300
|
+
return false;
|
|
6301
|
+
}
|
|
6302
|
+
/** The blob as stored now; a failed read REFUSES the write instead of guessing. */
|
|
6303
|
+
async function readStoredAddonBlob(raw) {
|
|
6304
|
+
const threeWay = raw.readAddonStoreResult;
|
|
6305
|
+
if (threeWay === void 0) return raw.readAddonStore();
|
|
6306
|
+
const result = await threeWay.call(raw);
|
|
6307
|
+
if (result.kind === "failed") throw new Error(`settings write refused: the stored blob could not be read (${result.error})`);
|
|
6308
|
+
return result.kind === "missing" ? {} : result.value;
|
|
6309
|
+
}
|
|
6310
|
+
function createSecretAwareSettings(raw, opts) {
|
|
6311
|
+
const chains = /* @__PURE__ */ new Map();
|
|
6312
|
+
const serialize = (key, fn) => {
|
|
6313
|
+
const next = (chains.get(key) ?? Promise.resolve()).then(fn, fn);
|
|
6314
|
+
const tail = next.catch(() => void 0);
|
|
6315
|
+
chains.set(key, tail);
|
|
6316
|
+
tail.then(() => {
|
|
6317
|
+
if (chains.get(key) === tail) chains.delete(key);
|
|
6318
|
+
});
|
|
6319
|
+
return next;
|
|
6320
|
+
};
|
|
6321
|
+
const write = async (chainKey, tree, scope, patch, readStored, rawWrite) => {
|
|
6322
|
+
if (!touchesTree(tree, patch)) return rawWrite(patch);
|
|
6323
|
+
return serialize(chainKey, async () => {
|
|
6324
|
+
const stored = await readStored();
|
|
6325
|
+
const result = await transformSecretWrite({
|
|
6326
|
+
tree,
|
|
6327
|
+
secrets: opts.secrets,
|
|
6328
|
+
patch,
|
|
6329
|
+
stored,
|
|
6330
|
+
...scope !== void 0 ? { scope } : {},
|
|
6331
|
+
operatorWrite: opts.isOperatorWrite?.() === true
|
|
6332
|
+
});
|
|
6333
|
+
if (Object.keys(result.patch).length > 0) await rawWrite(result.patch);
|
|
6334
|
+
const { orphaned } = await result.afterWrite();
|
|
6335
|
+
if (orphaned.length > 0) opts.onOrphaned(orphaned);
|
|
6336
|
+
});
|
|
6337
|
+
};
|
|
6338
|
+
const wrapped = {
|
|
6339
|
+
writeAddonStore: (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p)),
|
|
6340
|
+
writeDeviceStore: (deviceId, patch) => write(`device:${deviceId}`, opts.deviceTree(), {
|
|
6341
|
+
kind: "device",
|
|
6342
|
+
deviceId
|
|
6343
|
+
}, patch, () => raw.readDeviceStore(deviceId), (p) => raw.writeDeviceStore(deviceId, p))
|
|
6344
|
+
};
|
|
6345
|
+
return new Proxy(raw, { get(target, prop, receiver) {
|
|
6346
|
+
if (prop === "writeAddonStore") return wrapped.writeAddonStore;
|
|
6347
|
+
if (prop === "writeDeviceStore") return wrapped.writeDeviceStore;
|
|
6348
|
+
const value = Reflect.get(target, prop, receiver);
|
|
6349
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
6350
|
+
} });
|
|
6351
|
+
}
|
|
6352
|
+
/** The context the addon sees: identical, except that its settings writes are secret-aware. */
|
|
6353
|
+
function withSecretAwareSettings(context, opts) {
|
|
6354
|
+
const raw = context.settings;
|
|
6355
|
+
if (raw === void 0) return context;
|
|
6356
|
+
const settings = createSecretAwareSettings(raw, opts);
|
|
6357
|
+
return new Proxy(context, { get(target, prop, receiver) {
|
|
6358
|
+
if (prop === "settings") return settings;
|
|
6359
|
+
return Reflect.get(target, prop, receiver);
|
|
6360
|
+
} });
|
|
6361
|
+
}
|
|
6362
|
+
var LEAF = { kind: "leaf" };
|
|
6363
|
+
var DEFAULT_ITEM_ID_KEY = "id";
|
|
6364
|
+
function collectFields(fields, out) {
|
|
6365
|
+
for (const field of fields) {
|
|
6366
|
+
if (field.type === "group") {
|
|
6367
|
+
collectFields(field.fields, out);
|
|
6368
|
+
continue;
|
|
6369
|
+
}
|
|
6370
|
+
if (field.type === "sub-tabs") {
|
|
6371
|
+
for (const tab of field.tabs) collectFields(tab.fields, out);
|
|
6372
|
+
continue;
|
|
6373
|
+
}
|
|
6374
|
+
if (field.type === "editable-array") {
|
|
6375
|
+
const item = /* @__PURE__ */ new Map();
|
|
6376
|
+
for (const itemField of field.itemFields) if ("key" in itemField && isKeychainStoredField(itemField)) item.set(itemField.key, LEAF);
|
|
6377
|
+
if (item.size > 0) out.set(field.key, {
|
|
6378
|
+
kind: "array",
|
|
6379
|
+
idKey: field.itemIdKey ?? DEFAULT_ITEM_ID_KEY,
|
|
6380
|
+
item
|
|
6381
|
+
});
|
|
6382
|
+
continue;
|
|
6383
|
+
}
|
|
6384
|
+
if (!("key" in field) || typeof field.key !== "string") continue;
|
|
6385
|
+
if (isKeychainStoredField(field)) out.set(field.key, LEAF);
|
|
6386
|
+
}
|
|
6387
|
+
}
|
|
6388
|
+
/** The secret tree a settings schema declares. */
|
|
6389
|
+
function secretTreeFromSchema(schema) {
|
|
6390
|
+
const out = /* @__PURE__ */ new Map();
|
|
6391
|
+
if (schema === null) return out;
|
|
6392
|
+
for (const section of schema.sections) collectFields(section.fields, out);
|
|
6393
|
+
return out;
|
|
6394
|
+
}
|
|
6395
|
+
/** Parse `a.b[id].c` into segments; throws on a malformed path (a declaration bug). */
|
|
6396
|
+
function parseSecretStatePath(path) {
|
|
6397
|
+
const segments = [];
|
|
6398
|
+
for (const raw of path.split(".")) {
|
|
6399
|
+
const m = /^([^[\]]+)(?:\[([^[\]]+)\])?$/.exec(raw);
|
|
6400
|
+
if (m === null || m[1] === void 0) throw new Error(`secretStatePaths: malformed path "${path}"`);
|
|
6401
|
+
segments.push(m[2] !== void 0 ? {
|
|
6402
|
+
key: m[1],
|
|
6403
|
+
idKey: m[2]
|
|
6404
|
+
} : { key: m[1] });
|
|
6405
|
+
}
|
|
6406
|
+
if (segments.length === 0) throw new Error(`secretStatePaths: empty path`);
|
|
6407
|
+
if (segments[segments.length - 1]?.idKey !== void 0) throw new Error(`secretStatePaths: "${path}" ends on an array — name the member that is secret`);
|
|
6408
|
+
return segments;
|
|
6409
|
+
}
|
|
6410
|
+
function insert(into, segments) {
|
|
6411
|
+
const [head, ...rest] = segments;
|
|
6412
|
+
if (head === void 0) return;
|
|
6413
|
+
if (rest.length === 0) {
|
|
6414
|
+
into.set(head.key, LEAF);
|
|
6415
|
+
return;
|
|
6416
|
+
}
|
|
6417
|
+
const existing = into.get(head.key);
|
|
6418
|
+
if (head.idKey !== void 0) {
|
|
6419
|
+
const item = new Map(existing?.kind === "array" ? existing.item : []);
|
|
6420
|
+
insert(item, rest);
|
|
6421
|
+
into.set(head.key, {
|
|
6422
|
+
kind: "array",
|
|
6423
|
+
idKey: head.idKey,
|
|
6424
|
+
item
|
|
6425
|
+
});
|
|
6426
|
+
return;
|
|
6427
|
+
}
|
|
6428
|
+
const children = new Map(existing?.kind === "object" ? existing.children : []);
|
|
6429
|
+
insert(children, rest);
|
|
6430
|
+
into.set(head.key, {
|
|
6431
|
+
kind: "object",
|
|
6432
|
+
children
|
|
6433
|
+
});
|
|
6434
|
+
}
|
|
6435
|
+
/** Add hidden-state paths (`secretStatePaths`) to a schema-derived tree. */
|
|
6436
|
+
function mergeSecretStatePaths(tree, paths) {
|
|
6437
|
+
if (paths.length === 0) return tree;
|
|
6438
|
+
const out = new Map(tree);
|
|
6439
|
+
for (const path of paths) insert(out, parseSecretStatePath(path));
|
|
6440
|
+
return out;
|
|
6441
|
+
}
|
|
6442
|
+
/** First retry of a secret the keychain could not serve; doubles to {@link SECRET_RETRY_MAX_MS}. */
|
|
6443
|
+
var SECRET_RETRY_FIRST_MS = 5e3;
|
|
6444
|
+
var SECRET_RETRY_MAX_MS = 5 * 6e4;
|
|
6445
|
+
/** Coalesces a burst of `keychain.changed` events into one re-resolve. */
|
|
6446
|
+
var SECRET_CHANGE_DEBOUNCE_MS = 250;
|
|
5911
6447
|
/**
|
|
5912
6448
|
* Base class for CamStack addons. Eliminates settings boilerplate:
|
|
5913
6449
|
*
|
|
@@ -5977,6 +6513,25 @@ var BaseAddon = class {
|
|
|
5977
6513
|
settingsStoreReady = false;
|
|
5978
6514
|
/** Default config values. Provided via constructor. */
|
|
5979
6515
|
defaults;
|
|
6516
|
+
/**
|
|
6517
|
+
* Hidden-state paths that hold secrets (D787) — values the addon writes
|
|
6518
|
+
* itself (`updateGlobalSettings`, `state()`) that no form field declares.
|
|
6519
|
+
* Stored in the keychain exactly like a `password` field. Syntax:
|
|
6520
|
+
* `'snapshotSigningKey'`, `'identity.pincode'`, `'tokens[userId].accessToken'`
|
|
6521
|
+
* (`key[<id field>]` addresses array items by id, never by index).
|
|
6522
|
+
*/
|
|
6523
|
+
secretStatePaths = [];
|
|
6524
|
+
_addonSecretTree = null;
|
|
6525
|
+
_deviceSecretTree = null;
|
|
6526
|
+
/** Refs the last resolved config pointed at — a change to one re-resolves. */
|
|
6527
|
+
_configSecretRefs = /* @__PURE__ */ new Set();
|
|
6528
|
+
_unresolvedSecrets = [];
|
|
6529
|
+
_secretRetryTimer = null;
|
|
6530
|
+
_secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
|
|
6531
|
+
_secretChangeTimer = null;
|
|
6532
|
+
_secretChangeUnsub = null;
|
|
6533
|
+
/** >0 while an OPERATOR's settings write is being applied. */
|
|
6534
|
+
_operatorWriteDepth = 0;
|
|
5980
6535
|
constructor(defaults) {
|
|
5981
6536
|
this.defaults = defaults;
|
|
5982
6537
|
this._config = { ...defaults };
|
|
@@ -6012,8 +6567,18 @@ var BaseAddon = class {
|
|
|
6012
6567
|
return this._config;
|
|
6013
6568
|
}
|
|
6014
6569
|
async initialize(context) {
|
|
6015
|
-
|
|
6570
|
+
const secrets = context.secrets;
|
|
6571
|
+
this._ctx = secrets !== void 0 ? withSecretAwareSettings(context, {
|
|
6572
|
+
secrets,
|
|
6573
|
+
addonTree: () => this.addonSecretTree(),
|
|
6574
|
+
deviceTree: () => this.deviceSecretTree(),
|
|
6575
|
+
onOrphaned: (refs) => context.logger.warn("keychain refs dropped by a settings write could not be deleted", { meta: { refs: [...refs] } }),
|
|
6576
|
+
isOperatorWrite: () => this._operatorWriteDepth > 0
|
|
6577
|
+
}) : context;
|
|
6016
6578
|
await this.resolveConfig();
|
|
6579
|
+
if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
|
|
6580
|
+
if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
|
|
6581
|
+
});
|
|
6017
6582
|
const result = await this.onInitialize();
|
|
6018
6583
|
this.emitLifecycle(EventCategory.AddonStarted);
|
|
6019
6584
|
const normalized = normalizeAddonInitResult(result);
|
|
@@ -6046,6 +6611,12 @@ var BaseAddon = class {
|
|
|
6046
6611
|
*/
|
|
6047
6612
|
async onHubReachable() {}
|
|
6048
6613
|
async shutdown() {
|
|
6614
|
+
this._secretChangeUnsub?.();
|
|
6615
|
+
this._secretChangeUnsub = null;
|
|
6616
|
+
if (this._secretRetryTimer !== null) clearTimeout(this._secretRetryTimer);
|
|
6617
|
+
if (this._secretChangeTimer !== null) clearTimeout(this._secretChangeTimer);
|
|
6618
|
+
this._secretRetryTimer = null;
|
|
6619
|
+
this._secretChangeTimer = null;
|
|
6049
6620
|
this.emitLifecycle(EventCategory.AddonStopped);
|
|
6050
6621
|
if (this.autoEmitReadiness) this.emitReadinessForProviders("down");
|
|
6051
6622
|
await this.onShutdown();
|
|
@@ -6124,7 +6695,7 @@ var BaseAddon = class {
|
|
|
6124
6695
|
return hydrateSchema(schema, overlay ? {
|
|
6125
6696
|
...projected,
|
|
6126
6697
|
...overlay
|
|
6127
|
-
} : projected);
|
|
6698
|
+
} : projected, { inlineSecretsAsViews: true });
|
|
6128
6699
|
}
|
|
6129
6700
|
/**
|
|
6130
6701
|
* The integration-level view of this addon's settings: exactly the sections
|
|
@@ -6173,7 +6744,7 @@ var BaseAddon = class {
|
|
|
6173
6744
|
return hydrateSchema({
|
|
6174
6745
|
...schema,
|
|
6175
6746
|
sections
|
|
6176
|
-
}, projected);
|
|
6747
|
+
}, projected, { inlineSecretsAsViews: true });
|
|
6177
6748
|
}
|
|
6178
6749
|
/**
|
|
6179
6750
|
* The raw addon store PROJECTED onto the target node's bare per-node keys:
|
|
@@ -6227,18 +6798,50 @@ var BaseAddon = class {
|
|
|
6227
6798
|
value: result.value[key]
|
|
6228
6799
|
};
|
|
6229
6800
|
}
|
|
6801
|
+
/**
|
|
6802
|
+
* The OPERATOR's write — a settings form or an admin API call, dispatched by
|
|
6803
|
+
* the kernel. Identical to {@link updateGlobalSettings}, except that a secret
|
|
6804
|
+
* the operator sends is stored as sent even when it equals a pre-keychain
|
|
6805
|
+
* inline value: the operator re-entering a password is a change, an addon
|
|
6806
|
+
* writing back what it read is not (D787).
|
|
6807
|
+
*/
|
|
6808
|
+
async updateGlobalSettingsAsOperator(patch, nodeId) {
|
|
6809
|
+
this._operatorWriteDepth++;
|
|
6810
|
+
try {
|
|
6811
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
6812
|
+
} finally {
|
|
6813
|
+
this._operatorWriteDepth--;
|
|
6814
|
+
}
|
|
6815
|
+
}
|
|
6230
6816
|
async updateGlobalSettings(patch, nodeId) {
|
|
6817
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
6818
|
+
}
|
|
6819
|
+
/**
|
|
6820
|
+
* REMOVE stored secrets — their keychain values and their markers (D787).
|
|
6821
|
+
*
|
|
6822
|
+
* Writing `''` to a secret field KEEPS what is stored (an empty string is
|
|
6823
|
+
* what a defaults fallback writes back, and it must never destroy a
|
|
6824
|
+
* credential), so code that means "forget this token" says so here. Without
|
|
6825
|
+
* a keychain (an older kernel) it writes `''`, as such code always did.
|
|
6826
|
+
*/
|
|
6827
|
+
async clearSecrets(keys, nodeId) {
|
|
6828
|
+
const tree = this.addonSecretTree();
|
|
6829
|
+
const keychain = this._ctx?.secrets !== void 0;
|
|
6830
|
+
const patch = {};
|
|
6831
|
+
for (const key of keys) patch[key] = keychain && tree.has(key) ? SECRET_CLEAR : "";
|
|
6832
|
+
await this.applyGlobalPatch(patch, nodeId);
|
|
6833
|
+
}
|
|
6834
|
+
async applyGlobalPatch(barePatch, nodeId) {
|
|
6231
6835
|
const keys = this.perNodeKeys();
|
|
6232
6836
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
6233
6837
|
const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
6234
|
-
const barePatch = patch;
|
|
6235
6838
|
const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
|
|
6236
6839
|
await this._ctx?.settings?.writeAddonStore(scoped);
|
|
6237
6840
|
if (target !== localNode) return;
|
|
6238
6841
|
await this.resolveConfig();
|
|
6239
6842
|
await this.onConfigChanged();
|
|
6240
6843
|
this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
|
|
6241
|
-
this.maybeAutoRestart(
|
|
6844
|
+
this.maybeAutoRestart(Object.keys(barePatch), this.globalSettingsSchema());
|
|
6242
6845
|
}
|
|
6243
6846
|
/**
|
|
6244
6847
|
* The set of field keys the global settings schema declares `perNode: true`
|
|
@@ -6263,7 +6866,7 @@ var BaseAddon = class {
|
|
|
6263
6866
|
* time to return its response before the addon is torn down and
|
|
6264
6867
|
* re-initialised by `AddonRegistryService.restartAddon`.
|
|
6265
6868
|
*/
|
|
6266
|
-
maybeAutoRestart(
|
|
6869
|
+
maybeAutoRestart(patchKeys, schema) {
|
|
6267
6870
|
if (!schema) return;
|
|
6268
6871
|
const restartKeys = /* @__PURE__ */ new Set();
|
|
6269
6872
|
for (const section of schema.sections) for (const field of section.fields) {
|
|
@@ -6271,13 +6874,13 @@ var BaseAddon = class {
|
|
|
6271
6874
|
if (field.requiresRestart) restartKeys.add(field.key);
|
|
6272
6875
|
}
|
|
6273
6876
|
if (restartKeys.size === 0) return;
|
|
6274
|
-
if (!
|
|
6877
|
+
if (!patchKeys.some((k) => restartKeys.has(k))) return;
|
|
6275
6878
|
const ctx = this._ctx;
|
|
6276
6879
|
if (!ctx) return;
|
|
6277
6880
|
const addonId = ctx.id;
|
|
6278
6881
|
setImmediate(() => {
|
|
6279
6882
|
ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
|
|
6280
|
-
ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields:
|
|
6883
|
+
ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
|
|
6281
6884
|
}).catch((err) => {
|
|
6282
6885
|
ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
6283
6886
|
});
|
|
@@ -6286,7 +6889,7 @@ var BaseAddon = class {
|
|
|
6286
6889
|
async getDeviceSettings(deviceId) {
|
|
6287
6890
|
const schema = this.deviceSettingsSchema();
|
|
6288
6891
|
if (!schema) return { sections: [] };
|
|
6289
|
-
return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {});
|
|
6892
|
+
return hydrateSchema(schema, await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, { inlineSecretsAsViews: true });
|
|
6290
6893
|
}
|
|
6291
6894
|
async updateDeviceSettings(deviceId, patch) {
|
|
6292
6895
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
@@ -6416,7 +7019,7 @@ var BaseAddon = class {
|
|
|
6416
7019
|
* selection at boot (absent scoped key ⇒ the constructor default wins).
|
|
6417
7020
|
*/
|
|
6418
7021
|
async resolveConfig() {
|
|
6419
|
-
const stored = await this.readAddonStoreWithRetry();
|
|
7022
|
+
const stored = await this.resolveStoredSecrets(await this.readAddonStoreWithRetry());
|
|
6420
7023
|
const perNode = this.perNodeKeys();
|
|
6421
7024
|
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
6422
7025
|
const resolved = { ...this.defaults };
|
|
@@ -6441,7 +7044,7 @@ var BaseAddon = class {
|
|
|
6441
7044
|
key,
|
|
6442
7045
|
schema,
|
|
6443
7046
|
fallback,
|
|
6444
|
-
read: () => this.readAddonStoreWithRetry(),
|
|
7047
|
+
read: async () => this.resolveStoredSecrets(await this.readAddonStoreWithRetry()),
|
|
6445
7048
|
write: async (patch) => {
|
|
6446
7049
|
await this._ctx?.settings?.writeAddonStore(patch);
|
|
6447
7050
|
},
|
|
@@ -6458,7 +7061,7 @@ var BaseAddon = class {
|
|
|
6458
7061
|
key,
|
|
6459
7062
|
schema,
|
|
6460
7063
|
fallback,
|
|
6461
|
-
read: async () => await this._ctx?.settings?.readDeviceStore(deviceId) ?? {},
|
|
7064
|
+
read: async () => this.resolveStoredSecrets(await this._ctx?.settings?.readDeviceStore(deviceId) ?? {}, false),
|
|
6462
7065
|
write: async (patch) => {
|
|
6463
7066
|
await this._ctx?.settings?.writeDeviceStore(deviceId, patch);
|
|
6464
7067
|
},
|
|
@@ -6470,6 +7073,70 @@ var BaseAddon = class {
|
|
|
6470
7073
|
} })
|
|
6471
7074
|
});
|
|
6472
7075
|
}
|
|
7076
|
+
/** The addon store's secret tree: schema fields by TYPE, plus `secretStatePaths`. */
|
|
7077
|
+
addonSecretTree() {
|
|
7078
|
+
this._addonSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.globalSettingsSchema()), this.secretStatePaths);
|
|
7079
|
+
return this._addonSecretTree;
|
|
7080
|
+
}
|
|
7081
|
+
deviceSecretTree() {
|
|
7082
|
+
this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
|
|
7083
|
+
return this._deviceSecretTree;
|
|
7084
|
+
}
|
|
7085
|
+
/**
|
|
7086
|
+
* Secrets of this addon's stored config that could not be resolved on the
|
|
7087
|
+
* last read, with why. Non-empty means the addon is running WITHOUT them —
|
|
7088
|
+
* an addon whose function needs one should report itself degraded rather
|
|
7089
|
+
* than start on an empty credential.
|
|
7090
|
+
*/
|
|
7091
|
+
get unresolvedSecrets() {
|
|
7092
|
+
return this._unresolvedSecrets;
|
|
7093
|
+
}
|
|
7094
|
+
/**
|
|
7095
|
+
* Substitute every keychain marker in a stored blob with its value. With no
|
|
7096
|
+
* keychain (no `ctx.secrets`) or no marker, the blob comes back unchanged.
|
|
7097
|
+
* An unresolvable value is LEFT OUT (never `''`), logged by ref — never by
|
|
7098
|
+
* value — and, when the cause can pass, retried with backoff. Nothing is
|
|
7099
|
+
* ever written back from here.
|
|
7100
|
+
*/
|
|
7101
|
+
async resolveStoredSecrets(blob, trackForConfig = true) {
|
|
7102
|
+
const secrets = this._ctx?.secrets;
|
|
7103
|
+
if (secrets === void 0) return blob;
|
|
7104
|
+
const refs = collectSecretMarkerRefs(blob);
|
|
7105
|
+
if (trackForConfig) this._configSecretRefs = new Set(refs);
|
|
7106
|
+
if (refs.length === 0) {
|
|
7107
|
+
if (trackForConfig) this._unresolvedSecrets = [];
|
|
7108
|
+
return blob;
|
|
7109
|
+
}
|
|
7110
|
+
const { value, unresolved } = await resolveSecretMarkers(blob, secrets);
|
|
7111
|
+
if (trackForConfig) {
|
|
7112
|
+
this._unresolvedSecrets = unresolved;
|
|
7113
|
+
if (unresolved.length > 0) {
|
|
7114
|
+
this._ctx?.logger?.error?.("secret unavailable — running without it, will retry", { meta: { secrets: unresolved.map((u) => ({
|
|
7115
|
+
ref: u.ref,
|
|
7116
|
+
reason: u.reason
|
|
7117
|
+
})) } });
|
|
7118
|
+
if (unresolved.some((u) => u.reason !== "missing" && u.reason !== "forbidden")) {
|
|
7119
|
+
this.scheduleSecretReresolve(this._secretRetryDelayMs);
|
|
7120
|
+
this._secretRetryDelayMs = Math.min(this._secretRetryDelayMs * 2, SECRET_RETRY_MAX_MS);
|
|
7121
|
+
}
|
|
7122
|
+
} else this._secretRetryDelayMs = SECRET_RETRY_FIRST_MS;
|
|
7123
|
+
}
|
|
7124
|
+
return value;
|
|
7125
|
+
}
|
|
7126
|
+
/** Re-resolve the config (a keychain-only change, or a retry) and apply it. */
|
|
7127
|
+
scheduleSecretReresolve(delayMs) {
|
|
7128
|
+
const timerOf = delayMs === SECRET_CHANGE_DEBOUNCE_MS ? "_secretChangeTimer" : "_secretRetryTimer";
|
|
7129
|
+
if (this[timerOf] !== null) return;
|
|
7130
|
+
const timer = setTimeout(() => {
|
|
7131
|
+
this[timerOf] = null;
|
|
7132
|
+
if (this._ctx === null) return;
|
|
7133
|
+
this.resolveConfig().then(() => this.onConfigChanged()).catch((err) => {
|
|
7134
|
+
this._ctx?.logger?.error?.("re-resolving secrets failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
7135
|
+
});
|
|
7136
|
+
}, delayMs);
|
|
7137
|
+
timer.unref?.();
|
|
7138
|
+
this[timerOf] = timer;
|
|
7139
|
+
}
|
|
6473
7140
|
/**
|
|
6474
7141
|
* Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
|
|
6475
7142
|
* transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
|
|
@@ -13977,6 +14644,196 @@ id: union([string(), number()]) }), {
|
|
|
13977
14644
|
kind: "mutation",
|
|
13978
14645
|
auth: "admin"
|
|
13979
14646
|
});
|
|
14647
|
+
/**
|
|
14648
|
+
* `keychain` — the hub's encrypted store of secret values (D787).
|
|
14649
|
+
*
|
|
14650
|
+
* Settings blobs never hold a secret: they hold a marker
|
|
14651
|
+
* `{"$secret":"secret://<owner>/<scope>/<fieldPath>","v":1}` and the value
|
|
14652
|
+
* lives here, AES-256-GCM under a data key that a master key wraps. This cap
|
|
14653
|
+
* is the OWNER's door to its own values: every method is owner-checked
|
|
14654
|
+
* against the CALLER, never against anything the caller claims.
|
|
14655
|
+
*
|
|
14656
|
+
* Who the caller is: the transport stamps `callerAddonId` into the args of a
|
|
14657
|
+
* call that crossed a process (the parent `LocalChildRegistry` from the UDS
|
|
14658
|
+
* connection, the agent from its child's connection carried in
|
|
14659
|
+
* `$hub-cap-fwd`'s envelope). A stamp always overwrites; a wire call with no
|
|
14660
|
+
* stamp has its claim stripped. Only a hub in-process caller may state its own
|
|
14661
|
+
* identity — `ctx.secrets` does that with the addon id closed over. This is
|
|
14662
|
+
* identity against BUGS and misrouting, not against a malicious addon (every
|
|
14663
|
+
* runner is the same OS user): see the threat model in
|
|
14664
|
+
* `docs/design/2026-10-08-secrets-keychain.md`.
|
|
14665
|
+
*
|
|
14666
|
+
* `callerAddonId` is deliberately NOT in any input schema: the tRPC router
|
|
14667
|
+
* parses the input, so a session can never supply it, and the internal mount
|
|
14668
|
+
* floors every method to admin anyway (D240).
|
|
14669
|
+
*
|
|
14670
|
+
* Internal: addons reach it through `ctx.secrets`, never directly.
|
|
14671
|
+
*/
|
|
14672
|
+
/** Why a value cannot be served right now. Never folded into "missing". */
|
|
14673
|
+
var KeychainUnavailableReasonSchema = _enum([
|
|
14674
|
+
"key-missing",
|
|
14675
|
+
"wrong-key",
|
|
14676
|
+
"key-file-unreadable",
|
|
14677
|
+
"store-unavailable",
|
|
14678
|
+
"not-initialized",
|
|
14679
|
+
"decrypt-failed"
|
|
14680
|
+
]);
|
|
14681
|
+
var KeychainStateSchema = discriminatedUnion("state", [object({ state: literal("ready") }), object({
|
|
14682
|
+
state: literal("locked"),
|
|
14683
|
+
reason: KeychainUnavailableReasonSchema
|
|
14684
|
+
})]);
|
|
14685
|
+
var KeychainResolveEntrySchema = discriminatedUnion("kind", [
|
|
14686
|
+
object({
|
|
14687
|
+
kind: literal("value"),
|
|
14688
|
+
value: string(),
|
|
14689
|
+
version: number().int()
|
|
14690
|
+
}),
|
|
14691
|
+
object({ kind: literal("missing") }),
|
|
14692
|
+
object({
|
|
14693
|
+
kind: literal("unavailable"),
|
|
14694
|
+
reason: KeychainUnavailableReasonSchema
|
|
14695
|
+
}),
|
|
14696
|
+
object({ kind: literal("forbidden") })
|
|
14697
|
+
]);
|
|
14698
|
+
var KeychainResolveResultSchema = record(string(), KeychainResolveEntrySchema);
|
|
14699
|
+
/** Metadata of one stored value — never the value. */
|
|
14700
|
+
var KeychainSecretMetaSchema = object({
|
|
14701
|
+
ref: string(),
|
|
14702
|
+
owner: string(),
|
|
14703
|
+
/** Formatted scope (`global`, `node/<id>`, `device/<id>`, …). */
|
|
14704
|
+
scope: string(),
|
|
14705
|
+
fieldPath: string(),
|
|
14706
|
+
version: number().int(),
|
|
14707
|
+
createdAt: number(),
|
|
14708
|
+
updatedAt: number(),
|
|
14709
|
+
/** `addon:<id>` | `user:<id>` | `system`. */
|
|
14710
|
+
updatedBy: string(),
|
|
14711
|
+
/** Coarse — written at most once an hour per ref. `null` = never read. */
|
|
14712
|
+
lastReadAt: number().nullable()
|
|
14713
|
+
});
|
|
14714
|
+
var RefListSchema = array(string().min(1)).max(512);
|
|
14715
|
+
method(object({
|
|
14716
|
+
ref: string().min(1),
|
|
14717
|
+
value: string().min(1)
|
|
14718
|
+
}), object({
|
|
14719
|
+
ref: string(),
|
|
14720
|
+
version: number().int()
|
|
14721
|
+
}), {
|
|
14722
|
+
kind: "mutation",
|
|
14723
|
+
auth: "admin"
|
|
14724
|
+
}), method(object({ refs: RefListSchema }), KeychainResolveResultSchema, { auth: "admin" }), method(object({ refs: RefListSchema }), object({ deleted: number().int() }), {
|
|
14725
|
+
kind: "mutation",
|
|
14726
|
+
auth: "admin"
|
|
14727
|
+
}), method(object({}), array(KeychainSecretMetaSchema).readonly(), { auth: "admin" }), method(object({}), KeychainStateSchema, { auth: "admin" });
|
|
14728
|
+
var KeychainKeySourceSchema = object({
|
|
14729
|
+
kind: _enum([
|
|
14730
|
+
"config-file",
|
|
14731
|
+
"previous-config-file",
|
|
14732
|
+
"platform",
|
|
14733
|
+
"default-file"
|
|
14734
|
+
]),
|
|
14735
|
+
/** File sources only — a path is not a secret. */
|
|
14736
|
+
path: string().optional(),
|
|
14737
|
+
/**
|
|
14738
|
+
* True when a whole-volume backup of the data directory carries this key
|
|
14739
|
+
* next to the database it protects (the default file). The page warns.
|
|
14740
|
+
*/
|
|
14741
|
+
sharesBackupWithDatabase: boolean()
|
|
14742
|
+
});
|
|
14743
|
+
var KeychainStatusSchema = object({
|
|
14744
|
+
keychain: KeychainStateSchema,
|
|
14745
|
+
/** The source of the master key in use; `null` while locked. */
|
|
14746
|
+
keySource: KeychainKeySourceSchema.nullable(),
|
|
14747
|
+
/** The source configured to be primary — differs from `keySource` while a rotation is pending. */
|
|
14748
|
+
configuredSource: KeychainKeySourceSchema,
|
|
14749
|
+
/** Short fingerprint of the master key in use (`HMAC(KEK, label)`, 16 hex). */
|
|
14750
|
+
fingerprint: string().nullable(),
|
|
14751
|
+
activeKeyId: string().nullable(),
|
|
14752
|
+
/**
|
|
14753
|
+
* The keychain unlocked with a NON-primary source: the configured primary
|
|
14754
|
+
* key is not the one that wraps the data key yet. `rotateMasterKey` moves it.
|
|
14755
|
+
*/
|
|
14756
|
+
rotationPending: boolean(),
|
|
14757
|
+
/** Wrapped copies of the data key under a previous master key, kept until purged. */
|
|
14758
|
+
retiredWraps: number().int(),
|
|
14759
|
+
recoveryKeyDownloadedAt: number().nullable(),
|
|
14760
|
+
secretCount: number().int()
|
|
14761
|
+
});
|
|
14762
|
+
/**
|
|
14763
|
+
* Whether a stored value is still pointed at by its owner's settings.
|
|
14764
|
+
* `unknown` is a first-class answer: a scope whose blob could not be read is
|
|
14765
|
+
* never reported as an orphan (and never deleted as one).
|
|
14766
|
+
*/
|
|
14767
|
+
var KeychainSecretUsageSchema = _enum([
|
|
14768
|
+
"in-use",
|
|
14769
|
+
"orphan",
|
|
14770
|
+
"unknown"
|
|
14771
|
+
]);
|
|
14772
|
+
var KeychainAdminSecretSchema = KeychainSecretMetaSchema.extend({ usage: KeychainSecretUsageSchema });
|
|
14773
|
+
var KeychainAuditActionSchema = _enum([
|
|
14774
|
+
"put",
|
|
14775
|
+
"delete",
|
|
14776
|
+
"reveal",
|
|
14777
|
+
"rotate-master-key",
|
|
14778
|
+
"purge-retired-keys",
|
|
14779
|
+
"download-recovery-key",
|
|
14780
|
+
"delete-orphans",
|
|
14781
|
+
"reset",
|
|
14782
|
+
"initialize"
|
|
14783
|
+
]);
|
|
14784
|
+
var KeychainAuditEntrySchema = object({
|
|
14785
|
+
id: string(),
|
|
14786
|
+
at: number(),
|
|
14787
|
+
action: KeychainAuditActionSchema,
|
|
14788
|
+
/** `addon:<id>` | `user:<id>` | `system`. */
|
|
14789
|
+
actor: string(),
|
|
14790
|
+
ref: string().nullable(),
|
|
14791
|
+
detail: string().nullable()
|
|
14792
|
+
});
|
|
14793
|
+
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({
|
|
14794
|
+
value: string(),
|
|
14795
|
+
version: number().int()
|
|
14796
|
+
}), {
|
|
14797
|
+
kind: "mutation",
|
|
14798
|
+
auth: "admin",
|
|
14799
|
+
caller: "required"
|
|
14800
|
+
}), method(object({ refs: array(string().min(1)).max(1e3) }), object({
|
|
14801
|
+
deleted: array(string()).readonly(),
|
|
14802
|
+
kept: array(object({
|
|
14803
|
+
ref: string(),
|
|
14804
|
+
usage: KeychainSecretUsageSchema
|
|
14805
|
+
})).readonly()
|
|
14806
|
+
}), {
|
|
14807
|
+
kind: "mutation",
|
|
14808
|
+
auth: "admin",
|
|
14809
|
+
caller: "required"
|
|
14810
|
+
}), method(object({}), object({
|
|
14811
|
+
fingerprint: string(),
|
|
14812
|
+
keySource: KeychainKeySourceSchema
|
|
14813
|
+
}), {
|
|
14814
|
+
kind: "mutation",
|
|
14815
|
+
auth: "admin",
|
|
14816
|
+
caller: "required"
|
|
14817
|
+
}), method(object({}), object({ purged: number().int() }), {
|
|
14818
|
+
kind: "mutation",
|
|
14819
|
+
auth: "admin",
|
|
14820
|
+
caller: "required"
|
|
14821
|
+
}), method(object({}), object({
|
|
14822
|
+
key: string(),
|
|
14823
|
+
fingerprint: string(),
|
|
14824
|
+
keySource: KeychainKeySourceSchema
|
|
14825
|
+
}), {
|
|
14826
|
+
kind: "mutation",
|
|
14827
|
+
auth: "admin",
|
|
14828
|
+
caller: "required"
|
|
14829
|
+
}), method(object({ confirm: literal("RESET KEYCHAIN") }), object({
|
|
14830
|
+
archivedCollection: string().nullable(),
|
|
14831
|
+
archived: number().int()
|
|
14832
|
+
}), {
|
|
14833
|
+
kind: "mutation",
|
|
14834
|
+
auth: "admin",
|
|
14835
|
+
caller: "required"
|
|
14836
|
+
});
|
|
13980
14837
|
method(_void(), object({
|
|
13981
14838
|
id: string(),
|
|
13982
14839
|
name: string(),
|
|
@@ -15014,7 +15871,11 @@ var DeviceRegisterPayloadSchema = object({
|
|
|
15014
15871
|
var DeviceRemovePayloadSchema = object({ deviceId: number() });
|
|
15015
15872
|
var DevicePersistConfigPayloadSchema = object({
|
|
15016
15873
|
deviceId: number(),
|
|
15017
|
-
data: record(string(), unknown())
|
|
15874
|
+
data: record(string(), unknown()),
|
|
15875
|
+
/** The paths the device's schema declares secret (D783), when the caller
|
|
15876
|
+
* knows them — those values are kept in the keychain, not the blob (D787).
|
|
15877
|
+
* Absent: the paths the device last reported at `registerDevice` apply. */
|
|
15878
|
+
secretConfigPaths: array(string()).optional()
|
|
15018
15879
|
});
|
|
15019
15880
|
/** What a migration actually did, per switch. `unreachable` is a first-class
|
|
15020
15881
|
* answer: a camera that could not be asked is not a camera that was silenced. */
|
|
@@ -21993,8 +22854,23 @@ var RetrainMacroClassSchema = _enum([
|
|
|
21993
22854
|
]);
|
|
21994
22855
|
/** A subject to learn, or a phantom to unlearn (taught by OMISSION). */
|
|
21995
22856
|
var RetrainAnnotationKindSchema = _enum(["subject", "model_error"]);
|
|
21996
|
-
/**
|
|
21997
|
-
|
|
22857
|
+
/**
|
|
22858
|
+
* Where a box came from. A machine-sourced box is a DRAFT on the page until
|
|
22859
|
+
* the operator confirms it; once saved it keeps its source as provenance.
|
|
22860
|
+
*
|
|
22861
|
+
* - `operator` — drawn by hand.
|
|
22862
|
+
* - `assist` — proposed by a detector run on the copy (the camera's own
|
|
22863
|
+
* model, or a larger teacher model).
|
|
22864
|
+
* - `pipeline` — the box the live pipeline actually drew on that frame, read
|
|
22865
|
+
* back from the track store (never a re-run).
|
|
22866
|
+
* - `llm` — proposed by a vision-capable LLM profile.
|
|
22867
|
+
*/
|
|
22868
|
+
var RetrainAnnotationSourceSchema = _enum([
|
|
22869
|
+
"operator",
|
|
22870
|
+
"assist",
|
|
22871
|
+
"pipeline",
|
|
22872
|
+
"llm"
|
|
22873
|
+
]);
|
|
21998
22874
|
/** Normalised `[0,1]` rectangle against the FULL frame — the canonical form. */
|
|
21999
22875
|
var RetrainBboxSchema = object({
|
|
22000
22876
|
x: number(),
|
|
@@ -22012,7 +22888,8 @@ var RetrainBboxSchema = object({
|
|
|
22012
22888
|
*/
|
|
22013
22889
|
var RetrainAnnotationSchema = object({
|
|
22014
22890
|
id: string(),
|
|
22015
|
-
|
|
22891
|
+
/** The frame's track. Absent on a recording still, which has none. */
|
|
22892
|
+
trackId: string().optional(),
|
|
22016
22893
|
deviceId: number(),
|
|
22017
22894
|
/** The COPY in retrain storage — never the source track's media key. */
|
|
22018
22895
|
mediaKey: string(),
|
|
@@ -22061,13 +22938,47 @@ var RetrainFrameCandidateSchema = object({
|
|
|
22061
22938
|
* fail, whatever became of the original. */
|
|
22062
22939
|
copied: boolean()
|
|
22063
22940
|
});
|
|
22941
|
+
/**
|
|
22942
|
+
* One box the live pipeline drew on a copied frame — what a correction starts
|
|
22943
|
+
* from. Derived when the frame is listed, from the track store: the subject
|
|
22944
|
+
* box recorded on the source media row when there is one, else the track
|
|
22945
|
+
* position nearest the frame's capture time. Never stored as an annotation
|
|
22946
|
+
* until the operator confirms it.
|
|
22947
|
+
*/
|
|
22948
|
+
var RetrainPipelineBoxSchema = object({
|
|
22949
|
+
/** Normalised `[0,1]` against the full frame. */
|
|
22950
|
+
bbox: RetrainBboxSchema,
|
|
22951
|
+
macroClass: RetrainMacroClassSchema,
|
|
22952
|
+
label: string().optional(),
|
|
22953
|
+
subLabel: string().optional(),
|
|
22954
|
+
/** The detection score of the position used, when it was recorded. */
|
|
22955
|
+
score: number().optional(),
|
|
22956
|
+
/** The root model that produced the track, when it was recorded. */
|
|
22957
|
+
modelId: string().optional(),
|
|
22958
|
+
trackId: string(),
|
|
22959
|
+
/** `subject-box`: recorded on this very frame. `position`: the track's
|
|
22960
|
+
* position nearest the capture time, `deltaMs` away. */
|
|
22961
|
+
basis: _enum(["subject-box", "position"]),
|
|
22962
|
+
deltaMs: number()
|
|
22963
|
+
});
|
|
22964
|
+
/**
|
|
22965
|
+
* Where a retrain frame came from: a TRACK's stored media (copy-on-select),
|
|
22966
|
+
* or the RECORDING at an instant — the frame a model saw nothing in has no
|
|
22967
|
+
* track at all.
|
|
22968
|
+
*/
|
|
22969
|
+
var RetrainFrameOriginSchema = _enum(["track", "recording"]);
|
|
22064
22970
|
/** A frame the dataset OWNS: bytes copied at selection time. */
|
|
22065
22971
|
var RetrainFrameSchema = object({
|
|
22066
22972
|
frameId: string(),
|
|
22067
22973
|
deviceId: number(),
|
|
22068
|
-
|
|
22069
|
-
/**
|
|
22070
|
-
|
|
22974
|
+
origin: RetrainFrameOriginSchema,
|
|
22975
|
+
/** The track it was copied from. Absent on a recording still. */
|
|
22976
|
+
trackId: string().optional(),
|
|
22977
|
+
/** Provenance only. It may already point at nothing — that is expected.
|
|
22978
|
+
* Absent on a recording still. */
|
|
22979
|
+
sourceMediaId: number().int().optional(),
|
|
22980
|
+
/** A recording still: the playhead instant it was taken at. */
|
|
22981
|
+
epochMs: number().optional(),
|
|
22071
22982
|
sourceKind: MediaFileKindEnum,
|
|
22072
22983
|
sizeBytes: number().int(),
|
|
22073
22984
|
width: number().int(),
|
|
@@ -22078,7 +22989,12 @@ var RetrainFrameSchema = object({
|
|
|
22078
22989
|
/** The operator's "every subject in this frame is boxed". Detector
|
|
22079
22990
|
* evaluation keeps only complete frames: an unboxed subject would count as
|
|
22080
22991
|
* a false positive. */
|
|
22081
|
-
complete: boolean()
|
|
22992
|
+
complete: boolean(),
|
|
22993
|
+
/** The boxes the pipeline drew on this frame. Present on list answers;
|
|
22994
|
+
* empty when nothing the track store holds can be placed on it. */
|
|
22995
|
+
pipelineBoxes: array(RetrainPipelineBoxSchema).readonly().optional(),
|
|
22996
|
+
/** The named collections this frame belongs to. Present on list answers. */
|
|
22997
|
+
collectionIds: array(string()).readonly().optional()
|
|
22082
22998
|
});
|
|
22083
22999
|
/** Why a copy-on-select could not be honoured — named, never a silent skip. */
|
|
22084
23000
|
var RetrainCopyRefusalSchema = _enum([
|
|
@@ -22109,6 +23025,8 @@ var RetrainFrameListSchema = object({
|
|
|
22109
23025
|
var RetrainExportFilterSchema = object({
|
|
22110
23026
|
deviceIds: array(number()).optional(),
|
|
22111
23027
|
frameIds: array(string()).max(2e4).optional(),
|
|
23028
|
+
/** Only frames in at least one of these named collections. */
|
|
23029
|
+
collectionIds: array(string()).max(200).optional(),
|
|
22112
23030
|
batchId: string().optional(),
|
|
22113
23031
|
/** Only frames the operator marked complete (all subjects boxed). */
|
|
22114
23032
|
completeOnly: boolean().optional()
|
|
@@ -22173,6 +23091,109 @@ var RetrainAssistResultSchema = discriminatedUnion("kind", [object({
|
|
|
22173
23091
|
reason: string(),
|
|
22174
23092
|
detail: string().optional()
|
|
22175
23093
|
})]);
|
|
23094
|
+
/** A named set over the retrain corpus — membership only, it owns no pixels. */
|
|
23095
|
+
var RetrainCollectionSchema = object({
|
|
23096
|
+
id: string(),
|
|
23097
|
+
name: string(),
|
|
23098
|
+
createdAt: number(),
|
|
23099
|
+
frameCount: number().int()
|
|
23100
|
+
});
|
|
23101
|
+
var RetrainCollectionCreateResultSchema = discriminatedUnion("kind", [object({
|
|
23102
|
+
kind: literal("created"),
|
|
23103
|
+
collection: RetrainCollectionSchema
|
|
23104
|
+
}), object({
|
|
23105
|
+
kind: literal("refused"),
|
|
23106
|
+
reason: _enum(["empty-name", "duplicate-name"])
|
|
23107
|
+
})]);
|
|
23108
|
+
var RetrainCollectionRenameResultSchema = discriminatedUnion("kind", [object({
|
|
23109
|
+
kind: literal("renamed"),
|
|
23110
|
+
collection: RetrainCollectionSchema
|
|
23111
|
+
}), object({
|
|
23112
|
+
kind: literal("refused"),
|
|
23113
|
+
reason: _enum([
|
|
23114
|
+
"empty-name",
|
|
23115
|
+
"duplicate-name",
|
|
23116
|
+
"unknown-collection"
|
|
23117
|
+
])
|
|
23118
|
+
})]);
|
|
23119
|
+
/**
|
|
23120
|
+
* The outcome of adding the frame at a recording instant. Every refusal is
|
|
23121
|
+
* named: `still-unavailable` (not recording, a gap, or an undecodable frame —
|
|
23122
|
+
* `detail` says which), `still-busy` (the recorder is at its decode bound; try
|
|
23123
|
+
* again), `unreadable-image`, `write-failed`, `unknown-collection`.
|
|
23124
|
+
*/
|
|
23125
|
+
var AddRetrainFrameFromRecordingResultSchema = discriminatedUnion("kind", [object({
|
|
23126
|
+
kind: literal("added"),
|
|
23127
|
+
collectionId: string(),
|
|
23128
|
+
frame: RetrainFrameSchema,
|
|
23129
|
+
/** The moment was already in the dataset; nothing was decoded. */
|
|
23130
|
+
reused: boolean()
|
|
23131
|
+
}), object({
|
|
23132
|
+
kind: literal("refused"),
|
|
23133
|
+
reason: _enum([
|
|
23134
|
+
"unknown-collection",
|
|
23135
|
+
"still-unavailable",
|
|
23136
|
+
"still-busy",
|
|
23137
|
+
"unreadable-image",
|
|
23138
|
+
"write-failed"
|
|
23139
|
+
]),
|
|
23140
|
+
detail: string().optional()
|
|
23141
|
+
})]);
|
|
23142
|
+
/** A vision LLM profile the AI assist may use, and where it sends the frame. */
|
|
23143
|
+
var RetrainAssistProfileSchema = object({
|
|
23144
|
+
id: string(),
|
|
23145
|
+
name: string(),
|
|
23146
|
+
model: string(),
|
|
23147
|
+
kind: string(),
|
|
23148
|
+
/** `true` when the frame would leave the house (a cloud vendor, or an
|
|
23149
|
+
* endpoint that is not on the local network). The page confirms each such
|
|
23150
|
+
* run, and the provider refuses one without `allowCloud`. */
|
|
23151
|
+
leavesHouse: boolean()
|
|
23152
|
+
});
|
|
23153
|
+
/** A box the AI assist proposed: a draft, plus the model's own reason. */
|
|
23154
|
+
var RetrainLlmProposalSchema = RetrainAnnotationDraftSchema.extend({ reason: string() });
|
|
23155
|
+
/** What the AI assist said about a box that was already on the canvas. */
|
|
23156
|
+
var RetrainLlmReviewSchema = object({
|
|
23157
|
+
/** The `ref` the page sent the box under. */
|
|
23158
|
+
ref: string(),
|
|
23159
|
+
verdict: _enum([
|
|
23160
|
+
"confirmed",
|
|
23161
|
+
"wrong-class",
|
|
23162
|
+
"not-an-object",
|
|
23163
|
+
"uncertain"
|
|
23164
|
+
]),
|
|
23165
|
+
suggestedClass: RetrainMacroClassSchema.optional(),
|
|
23166
|
+
reason: string()
|
|
23167
|
+
});
|
|
23168
|
+
/**
|
|
23169
|
+
* The AI assist's answer. `proposed` carries drafts (`source: 'llm'`, the
|
|
23170
|
+
* model and its confidence) and reviews; items the model got wrong (a box off
|
|
23171
|
+
* the frame, an unasked class, an unknown ref) are dropped and counted in
|
|
23172
|
+
* `rejected`. A whole answer that is not the schema is `malformed-answer`.
|
|
23173
|
+
*/
|
|
23174
|
+
var RetrainLlmAssistResultSchema = discriminatedUnion("kind", [object({
|
|
23175
|
+
kind: literal("proposed"),
|
|
23176
|
+
profileId: string(),
|
|
23177
|
+
model: string(),
|
|
23178
|
+
/** The frame was sent outside the house for this answer. */
|
|
23179
|
+
leftHouse: boolean(),
|
|
23180
|
+
proposals: array(RetrainLlmProposalSchema).readonly(),
|
|
23181
|
+
reviews: array(RetrainLlmReviewSchema).readonly(),
|
|
23182
|
+
rejected: number().int()
|
|
23183
|
+
}), object({
|
|
23184
|
+
kind: literal("refused"),
|
|
23185
|
+
reason: _enum([
|
|
23186
|
+
"unknown-frame",
|
|
23187
|
+
"unreadable-frame",
|
|
23188
|
+
"unknown-profile",
|
|
23189
|
+
"profile-disabled",
|
|
23190
|
+
"no-vision",
|
|
23191
|
+
"cloud-not-confirmed",
|
|
23192
|
+
"llm-error",
|
|
23193
|
+
"malformed-answer"
|
|
23194
|
+
]),
|
|
23195
|
+
detail: string().optional()
|
|
23196
|
+
})]);
|
|
22176
23197
|
/** The outcome of a lifecycle move owned by the retrain page. */
|
|
22177
23198
|
var RetrainTransitionResultSchema = object({
|
|
22178
23199
|
trackId: string(),
|
|
@@ -22890,7 +23911,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
22890
23911
|
auth: "admin"
|
|
22891
23912
|
}), method(object({
|
|
22892
23913
|
deviceId: number(),
|
|
22893
|
-
trackId: string(),
|
|
23914
|
+
trackId: string().optional(),
|
|
22894
23915
|
frameId: string()
|
|
22895
23916
|
}), object({
|
|
22896
23917
|
removed: boolean(),
|
|
@@ -22907,7 +23928,8 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
22907
23928
|
auth: "admin"
|
|
22908
23929
|
}), method(object({
|
|
22909
23930
|
deviceId: number(),
|
|
22910
|
-
|
|
23931
|
+
/** The frame's track, when it has one — checked against the frame. */
|
|
23932
|
+
trackId: string().optional(),
|
|
22911
23933
|
frameId: string(),
|
|
22912
23934
|
subject: RetrainAssistSubjectSchema,
|
|
22913
23935
|
/** Which node runs it. Absent ⇒ wherever an unowned call lands. */
|
|
@@ -22915,12 +23937,16 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
22915
23937
|
}), RetrainAssistResultSchema, {
|
|
22916
23938
|
kind: "mutation",
|
|
22917
23939
|
auth: "admin"
|
|
22918
|
-
}), method(object({
|
|
23940
|
+
}), method(object({
|
|
23941
|
+
trackId: string().optional(),
|
|
23942
|
+
frameIds: array(string()).max(2e3).optional()
|
|
23943
|
+
}), array(RetrainAnnotationSchema).readonly(), {
|
|
22919
23944
|
kind: "query",
|
|
22920
23945
|
auth: "admin"
|
|
22921
23946
|
}), method(object({
|
|
22922
23947
|
deviceId: number(),
|
|
22923
|
-
|
|
23948
|
+
/** The frame's track, when it has one — checked against the frame. */
|
|
23949
|
+
trackId: string().optional(),
|
|
22924
23950
|
frameId: string(),
|
|
22925
23951
|
annotations: array(RetrainAnnotationDraftSchema)
|
|
22926
23952
|
}), array(RetrainAnnotationSchema).readonly(), {
|
|
@@ -22943,7 +23969,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
22943
23969
|
auth: "admin"
|
|
22944
23970
|
}), method(object({
|
|
22945
23971
|
deviceId: number(),
|
|
22946
|
-
trackId: string(),
|
|
23972
|
+
trackId: string().optional(),
|
|
22947
23973
|
frameId: string(),
|
|
22948
23974
|
complete: boolean()
|
|
22949
23975
|
}), RetrainFrameSchema, {
|
|
@@ -22957,6 +23983,74 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
22957
23983
|
kind: "mutation",
|
|
22958
23984
|
auth: "admin",
|
|
22959
23985
|
timeoutMs: 60 * 6e4
|
|
23986
|
+
}), method(object({}), array(RetrainAssistProfileSchema).readonly(), {
|
|
23987
|
+
kind: "query",
|
|
23988
|
+
auth: "admin"
|
|
23989
|
+
}), method(object({
|
|
23990
|
+
deviceId: number(),
|
|
23991
|
+
trackId: string().optional(),
|
|
23992
|
+
frameId: string(),
|
|
23993
|
+
profileId: string(),
|
|
23994
|
+
classes: array(RetrainMacroClassSchema).min(1),
|
|
23995
|
+
boxes: array(object({
|
|
23996
|
+
ref: string(),
|
|
23997
|
+
bbox: RetrainBboxSchema,
|
|
23998
|
+
macroClass: RetrainMacroClassSchema,
|
|
23999
|
+
label: string().optional()
|
|
24000
|
+
})).max(50),
|
|
24001
|
+
allowCloud: boolean()
|
|
24002
|
+
}), RetrainLlmAssistResultSchema, {
|
|
24003
|
+
kind: "mutation",
|
|
24004
|
+
auth: "admin",
|
|
24005
|
+
timeoutMs: 18e4
|
|
24006
|
+
}), method(object({ name: string().max(120) }), RetrainCollectionCreateResultSchema, {
|
|
24007
|
+
kind: "mutation",
|
|
24008
|
+
auth: "admin"
|
|
24009
|
+
}), method(object({}), array(RetrainCollectionSchema).readonly(), {
|
|
24010
|
+
kind: "query",
|
|
24011
|
+
auth: "admin"
|
|
24012
|
+
}), method(object({
|
|
24013
|
+
id: string(),
|
|
24014
|
+
name: string().max(120)
|
|
24015
|
+
}), RetrainCollectionRenameResultSchema, {
|
|
24016
|
+
kind: "mutation",
|
|
24017
|
+
auth: "admin"
|
|
24018
|
+
}), method(object({ id: string() }), object({
|
|
24019
|
+
deleted: boolean(),
|
|
24020
|
+
removedFrames: number().int()
|
|
24021
|
+
}), {
|
|
24022
|
+
kind: "mutation",
|
|
24023
|
+
auth: "admin"
|
|
24024
|
+
}), method(object({
|
|
24025
|
+
collectionId: string(),
|
|
24026
|
+
deviceId: number(),
|
|
24027
|
+
epochMs: number()
|
|
24028
|
+
}), AddRetrainFrameFromRecordingResultSchema, {
|
|
24029
|
+
kind: "mutation",
|
|
24030
|
+
auth: "admin",
|
|
24031
|
+
timeoutMs: 6e4
|
|
24032
|
+
}), method(object({
|
|
24033
|
+
collectionId: string(),
|
|
24034
|
+
frameIds: array(string()).min(1).max(500)
|
|
24035
|
+
}), object({
|
|
24036
|
+
added: number().int(),
|
|
24037
|
+
alreadyMember: number().int(),
|
|
24038
|
+
unknownFrameIds: array(string()).readonly()
|
|
24039
|
+
}), {
|
|
24040
|
+
kind: "mutation",
|
|
24041
|
+
auth: "admin"
|
|
24042
|
+
}), method(object({
|
|
24043
|
+
collectionId: string(),
|
|
24044
|
+
frameId: string()
|
|
24045
|
+
}), object({
|
|
24046
|
+
removed: boolean(),
|
|
24047
|
+
deletedFrame: boolean()
|
|
24048
|
+
}), {
|
|
24049
|
+
kind: "mutation",
|
|
24050
|
+
auth: "admin"
|
|
24051
|
+
}), method(object({ collectionId: string() }), array(RetrainFrameSchema).readonly(), {
|
|
24052
|
+
kind: "query",
|
|
24053
|
+
auth: "admin"
|
|
22960
24054
|
}), method(object({
|
|
22961
24055
|
/** Which of the three event tables owns the row. */
|
|
22962
24056
|
ownerType: EventOwnerTypeSchema,
|
|
@@ -23580,13 +24674,31 @@ var RecommendationReasonSchema = discriminatedUnion("kind", [
|
|
|
23580
24674
|
object({
|
|
23581
24675
|
kind: literal("no-family-build"),
|
|
23582
24676
|
format: ModelFormatSchema$1
|
|
24677
|
+
}),
|
|
24678
|
+
object({
|
|
24679
|
+
kind: literal("kept-custom-pin"),
|
|
24680
|
+
modelId: string(),
|
|
24681
|
+
deviceKey: string()
|
|
23583
24682
|
})
|
|
23584
24683
|
]);
|
|
24684
|
+
/** Why a device is left exactly as it is, whatever the plan would pick (D786). */
|
|
24685
|
+
var KeptReasonSchema = _enum(["custom-pin"]);
|
|
24686
|
+
/**
|
|
24687
|
+
* Where a choice's latency came from (D791): this node's own benchmark
|
|
24688
|
+
* result, or the hardware-class table. Measured on the node beats the table.
|
|
24689
|
+
*/
|
|
24690
|
+
var LatencySourceSchema = discriminatedUnion("kind", [object({ kind: literal("table") }), object({
|
|
24691
|
+
kind: literal("node-benchmark"),
|
|
24692
|
+
resultId: string(),
|
|
24693
|
+
measuredAtMs: number()
|
|
24694
|
+
})]);
|
|
23585
24695
|
var DeviceModelChoiceSchema = object({
|
|
23586
24696
|
modelId: string(),
|
|
23587
24697
|
p50Ms: number(),
|
|
23588
24698
|
fps: number(),
|
|
23589
24699
|
measured: boolean(),
|
|
24700
|
+
/** Absent on a plan from before D791 — read as the table. */
|
|
24701
|
+
source: LatencySourceSchema.optional(),
|
|
23590
24702
|
/** Parallel sessions at the camera rate with the headroom kept free: ⌊fps × (1 − headroom) / camera fps⌋. */
|
|
23591
24703
|
capacitySessions: number(),
|
|
23592
24704
|
personRecall: number()
|
|
@@ -23597,6 +24709,8 @@ var DeviceRecommendationSchema = object({
|
|
|
23597
24709
|
enabled: boolean(),
|
|
23598
24710
|
available: boolean(),
|
|
23599
24711
|
chosen: DeviceModelChoiceSchema.nullable(),
|
|
24712
|
+
/** Present when the device is kept as is: Apply writes nothing on it. */
|
|
24713
|
+
kept: KeptReasonSchema.optional(),
|
|
23600
24714
|
reasons: array(RecommendationReasonSchema).readonly()
|
|
23601
24715
|
});
|
|
23602
24716
|
var NodeRecommendationSchema = object({
|
|
@@ -23650,6 +24764,17 @@ var AutoTuneWarningSchema = discriminatedUnion("kind", [
|
|
|
23650
24764
|
kind: literal("coral-enabled"),
|
|
23651
24765
|
nodeId: string(),
|
|
23652
24766
|
deviceKey: string()
|
|
24767
|
+
}),
|
|
24768
|
+
object({
|
|
24769
|
+
kind: literal("custom-pin-kept"),
|
|
24770
|
+
nodeId: string(),
|
|
24771
|
+
deviceKey: string().nullable(),
|
|
24772
|
+
deviceId: number().nullable(),
|
|
24773
|
+
modelId: string()
|
|
24774
|
+
}),
|
|
24775
|
+
object({
|
|
24776
|
+
kind: literal("custom-registry-unreadable"),
|
|
24777
|
+
error: string()
|
|
23653
24778
|
})
|
|
23654
24779
|
]);
|
|
23655
24780
|
var AutoTuneOptionsSchema = object({
|
|
@@ -23828,13 +24953,14 @@ var SuggestSharesResultSchema = object({
|
|
|
23828
24953
|
nodes: array(SuggestedNodeShareSchema).readonly()
|
|
23829
24954
|
});
|
|
23830
24955
|
/**
|
|
23831
|
-
* Where the node and device shares come from (D750, D755).
|
|
23832
|
-
* - `
|
|
23833
|
-
*
|
|
23834
|
-
*
|
|
23835
|
-
*
|
|
23836
|
-
*
|
|
23837
|
-
*
|
|
24956
|
+
* Where the node and device shares come from (D750, D755, D791).
|
|
24957
|
+
* - `benchmark` (default since D791) — each node's capacity as its own node
|
|
24958
|
+
* benchmark measured it; a node without fresh results is sized from
|
|
24959
|
+
* `hardware` and says so. Measured on the node beats the table.
|
|
24960
|
+
* - `hardware` — computed from each node's static capacity only (its
|
|
24961
|
+
* accelerators at their Auto tune models, from the latency table).
|
|
24962
|
+
* Both are recomputed whenever a node or device joins, leaves, is switched
|
|
24963
|
+
* on or off, changes model, or a benchmark result is written. No load input.
|
|
23838
24964
|
* - `manual` — the operator's stored sliders.
|
|
23839
24965
|
* Either way a node or device that cannot take sessions gives its share to
|
|
23840
24966
|
* the others in proportion; the stored values are never rewritten for that.
|
|
@@ -23883,6 +25009,362 @@ var EffectiveSharesSchema = object({
|
|
|
23883
25009
|
nodeWeights: record(string(), number()),
|
|
23884
25010
|
deviceWeights: record(string(), record(string(), number()))
|
|
23885
25011
|
});
|
|
25012
|
+
/**
|
|
25013
|
+
* Wire shapes of the node benchmark (D791): the operator's plan, the
|
|
25014
|
+
* preflight the confirmation shows, the run the orchestrator owns, what the
|
|
25015
|
+
* measuring runner reports, and the result rows Auto tune and the automatic
|
|
25016
|
+
* shares read.
|
|
25017
|
+
*
|
|
25018
|
+
* ONE node at a time, owned by the pipeline orchestrator. While a run is
|
|
25019
|
+
* active the cluster is in BENCHMARK MODE for that node: it is not a
|
|
25020
|
+
* detection candidate, camera pins naming it are ignored so its sessions move
|
|
25021
|
+
* elsewhere, and both come back when the mode ends — after a crash or a hub
|
|
25022
|
+
* restart too (a persisted manifest, reconciled against the registry).
|
|
25023
|
+
*
|
|
25024
|
+
* Two measurements, both on the node, driven by its own runner (frames never
|
|
25025
|
+
* cross a process at frame rate, D9):
|
|
25026
|
+
* - `device` — one accelerator × one candidate detector, root only, open
|
|
25027
|
+
* loop: how many streams at the camera rate it carries inside the frame
|
|
25028
|
+
* interval;
|
|
25029
|
+
* - `pipeline` — the chosen detector plus the operator's detail steps
|
|
25030
|
+
* (faces, plates, classifiers, CLIP…), on varied frames from the bench
|
|
25031
|
+
* clip: how many parallel sessions the node carries before latency, drops,
|
|
25032
|
+
* CPU, RAM or the event loop give out.
|
|
25033
|
+
*/
|
|
25034
|
+
/** Defaults and bounds, one place. */
|
|
25035
|
+
var NODE_BENCHMARK_DEFAULTS = {
|
|
25036
|
+
fpsPerStream: 10,
|
|
25037
|
+
budgetMinutes: 45,
|
|
25038
|
+
minBudgetMinutes: 10,
|
|
25039
|
+
maxBudgetMinutes: 120,
|
|
25040
|
+
/** A result older than this no longer beats the table. */
|
|
25041
|
+
staleAfterDays: 30,
|
|
25042
|
+
/** Warm-in per ramp step (not accounted). */
|
|
25043
|
+
settleSec: 5,
|
|
25044
|
+
/** Accounted window per ramp step. */
|
|
25045
|
+
measureSec: 20,
|
|
25046
|
+
/** Longest the drain may take before the run is refused. */
|
|
25047
|
+
drainTimeoutSec: 120,
|
|
25048
|
+
/** Candidate models per device in one run. */
|
|
25049
|
+
maxModelsPerDevice: 6
|
|
25050
|
+
};
|
|
25051
|
+
/** The two measurements a run can make. */
|
|
25052
|
+
var NodeBenchmarkPhaseSchema = _enum(["device", "pipeline"]);
|
|
25053
|
+
var NodeBenchmarkDevicePlanSchema = object({
|
|
25054
|
+
/** `<backend>:<device>` — `openvino:npu`, `coreml:all`, `cpu`. */
|
|
25055
|
+
deviceKey: string().min(1),
|
|
25056
|
+
/**
|
|
25057
|
+
* Root detector candidates for the `device` measurement, in the order
|
|
25058
|
+
* measured. The FIRST is the one the `pipeline` measurement runs.
|
|
25059
|
+
*/
|
|
25060
|
+
modelIds: array(string().min(1)).min(1).max(NODE_BENCHMARK_DEFAULTS.maxModelsPerDevice)
|
|
25061
|
+
});
|
|
25062
|
+
/** What the operator confirmed. */
|
|
25063
|
+
var NodeBenchmarkPlanSchema = object({
|
|
25064
|
+
nodeId: string().min(1),
|
|
25065
|
+
devices: array(NodeBenchmarkDevicePlanSchema).min(1),
|
|
25066
|
+
/** Which measurements run. At least one. */
|
|
25067
|
+
phases: array(NodeBenchmarkPhaseSchema).min(1).default(["device", "pipeline"]),
|
|
25068
|
+
/**
|
|
25069
|
+
* Detail steps (catalog step ids under the root: faces, plates,
|
|
25070
|
+
* classifiers, CLIP…) the `pipeline` measurement enables. The root
|
|
25071
|
+
* detector always runs.
|
|
25072
|
+
*/
|
|
25073
|
+
steps: array(string().min(1)).default([]),
|
|
25074
|
+
/** Offered rate of one stream / session. */
|
|
25075
|
+
fpsPerStream: number().int().min(1).max(30).default(NODE_BENCHMARK_DEFAULTS.fpsPerStream),
|
|
25076
|
+
/** Hard deadline: the mode ends and the cluster is restored when it passes. */
|
|
25077
|
+
budgetMinutes: number().int().min(NODE_BENCHMARK_DEFAULTS.minBudgetMinutes).max(NODE_BENCHMARK_DEFAULTS.maxBudgetMinutes).default(NODE_BENCHMARK_DEFAULTS.budgetMinutes),
|
|
25078
|
+
/** Keep the models the run downloaded (default: delete what was not installed before). */
|
|
25079
|
+
keepDownloadedModels: boolean().default(false),
|
|
25080
|
+
/** Start although the other nodes' capacity does not cover the sessions running now. */
|
|
25081
|
+
acceptInsufficientHeadroom: boolean().default(false)
|
|
25082
|
+
});
|
|
25083
|
+
var NodeBenchmarkRefusalSchema = object({
|
|
25084
|
+
kind: _enum([
|
|
25085
|
+
"benchmark-active",
|
|
25086
|
+
"node-offline",
|
|
25087
|
+
"unknown-device",
|
|
25088
|
+
"no-phase",
|
|
25089
|
+
"insufficient-headroom"
|
|
25090
|
+
]),
|
|
25091
|
+
detail: string(),
|
|
25092
|
+
overridable: boolean()
|
|
25093
|
+
});
|
|
25094
|
+
/** A camera whose detection leaves the node for the run. */
|
|
25095
|
+
var NodeBenchmarkMovingCameraSchema = object({
|
|
25096
|
+
deviceId: number(),
|
|
25097
|
+
/** Placed on the node now (a standing attach or a running session). */
|
|
25098
|
+
placedOnNode: boolean(),
|
|
25099
|
+
/** A node pin naming this node, ignored for the run. */
|
|
25100
|
+
pinnedToNode: boolean()
|
|
25101
|
+
});
|
|
25102
|
+
/** A camera that cannot leave: no other node can obtain its frames. */
|
|
25103
|
+
var NodeBenchmarkStayingCameraSchema = object({
|
|
25104
|
+
deviceId: number(),
|
|
25105
|
+
reason: literal("only-frame-source")
|
|
25106
|
+
});
|
|
25107
|
+
var NodeBenchmarkPreflightSchema = object({
|
|
25108
|
+
nodeId: string(),
|
|
25109
|
+
online: boolean(),
|
|
25110
|
+
moving: array(NodeBenchmarkMovingCameraSchema).readonly(),
|
|
25111
|
+
/** Keep running on the node during the run; the result is flagged contaminated. */
|
|
25112
|
+
staying: array(NodeBenchmarkStayingCameraSchema).readonly(),
|
|
25113
|
+
estimatedDurationMs: number(),
|
|
25114
|
+
/** The run ends and the cluster is restored at the latest after this long. */
|
|
25115
|
+
budgetMs: number(),
|
|
25116
|
+
phases: array(NodeBenchmarkPhaseSchema).readonly(),
|
|
25117
|
+
steps: array(string()).readonly(),
|
|
25118
|
+
devices: array(NodeBenchmarkDevicePlanSchema).readonly(),
|
|
25119
|
+
/** Parallel sessions the cluster runs now, and what the other nodes can carry. */
|
|
25120
|
+
headroom: object({
|
|
25121
|
+
sessionsNow: number(),
|
|
25122
|
+
otherNodesCapacitySessions: number().nullable()
|
|
25123
|
+
}),
|
|
25124
|
+
refusals: array(NodeBenchmarkRefusalSchema).readonly(),
|
|
25125
|
+
canStart: boolean()
|
|
25126
|
+
});
|
|
25127
|
+
/** Where the measuring runner is. */
|
|
25128
|
+
var NodeBenchProgressSchema = object({
|
|
25129
|
+
phase: _enum([
|
|
25130
|
+
"preparing",
|
|
25131
|
+
"device",
|
|
25132
|
+
"pipeline",
|
|
25133
|
+
"cleanup"
|
|
25134
|
+
]),
|
|
25135
|
+
deviceKey: string().nullable(),
|
|
25136
|
+
modelId: string().nullable(),
|
|
25137
|
+
/** Streams (device) or sessions (pipeline) of the step running now. */
|
|
25138
|
+
load: number().nullable(),
|
|
25139
|
+
cellsDone: number(),
|
|
25140
|
+
cellsTotal: number(),
|
|
25141
|
+
message: string()
|
|
25142
|
+
});
|
|
25143
|
+
/** What limited a ramp. `none` = the ramp ran out of steps still passing. */
|
|
25144
|
+
var NodeBenchLimitSchema = _enum([
|
|
25145
|
+
"p95",
|
|
25146
|
+
"drops",
|
|
25147
|
+
"errors",
|
|
25148
|
+
"stall",
|
|
25149
|
+
"cpu",
|
|
25150
|
+
"ram",
|
|
25151
|
+
"none"
|
|
25152
|
+
]);
|
|
25153
|
+
var NodeBenchRampStepSchema = object({
|
|
25154
|
+
load: number(),
|
|
25155
|
+
pass: boolean(),
|
|
25156
|
+
p95Ms: number(),
|
|
25157
|
+
dropRatio: number(),
|
|
25158
|
+
/** Completed frames per second over the accounted window. */
|
|
25159
|
+
fps: number(),
|
|
25160
|
+
cpuPct: number().nullable(),
|
|
25161
|
+
ramFreePct: number().nullable(),
|
|
25162
|
+
failReasons: array(string()).readonly()
|
|
25163
|
+
});
|
|
25164
|
+
var NodeBenchCellSchema = discriminatedUnion("phase", [object({
|
|
25165
|
+
phase: literal("device"),
|
|
25166
|
+
deviceKey: string(),
|
|
25167
|
+
modelId: string(),
|
|
25168
|
+
/** Single-stream latency (the K = 1 step). */
|
|
25169
|
+
p50Ms: number(),
|
|
25170
|
+
p95Ms: number(),
|
|
25171
|
+
p99Ms: number(),
|
|
25172
|
+
/** Frames per second sustained at the last passing step. */
|
|
25173
|
+
fps: number(),
|
|
25174
|
+
/** Streams at the camera rate the device carried inside the frame interval; 0 = not even one. */
|
|
25175
|
+
kMax: number(),
|
|
25176
|
+
limitedBy: NodeBenchLimitSchema,
|
|
25177
|
+
/** First call (model load + warm-up). */
|
|
25178
|
+
warmupMs: number(),
|
|
25179
|
+
ramp: array(NodeBenchRampStepSchema).readonly()
|
|
25180
|
+
}), object({
|
|
25181
|
+
phase: literal("pipeline"),
|
|
25182
|
+
deviceKey: string(),
|
|
25183
|
+
modelId: string(),
|
|
25184
|
+
steps: array(string()).readonly(),
|
|
25185
|
+
/** Parallel sessions at the camera rate the node carried; 0 = not even one. */
|
|
25186
|
+
maxSessions: number(),
|
|
25187
|
+
limitedBy: NodeBenchLimitSchema,
|
|
25188
|
+
/** Detail steps that produced at least one result on the clip — a step that never fired measured nothing. */
|
|
25189
|
+
stepsFired: array(string()).readonly(),
|
|
25190
|
+
warmupMs: number(),
|
|
25191
|
+
ramp: array(NodeBenchRampStepSchema).readonly()
|
|
25192
|
+
})]);
|
|
25193
|
+
/**
|
|
25194
|
+
* What a result was measured ON. A result whose fingerprint no longer matches
|
|
25195
|
+
* the node no longer beats the table.
|
|
25196
|
+
*/
|
|
25197
|
+
var NodeBenchFingerprintSchema = object({
|
|
25198
|
+
pipelineVersion: string().nullable(),
|
|
25199
|
+
cpuModel: string().nullable(),
|
|
25200
|
+
ramGb: number().nullable(),
|
|
25201
|
+
os: string().nullable(),
|
|
25202
|
+
/** Per device: the pool the cells ran on (runtime + tuning). */
|
|
25203
|
+
pools: record(string(), object({
|
|
25204
|
+
runtime: string(),
|
|
25205
|
+
numWorkers: number(),
|
|
25206
|
+
concurrency: number(),
|
|
25207
|
+
batchMode: string()
|
|
25208
|
+
})).default({})
|
|
25209
|
+
});
|
|
25210
|
+
/** The frames the run used. */
|
|
25211
|
+
var NodeBenchClipSchema = object({
|
|
25212
|
+
/** `camstack-bench-v1` or `reference-images` (the fallback when the clip is not reachable). */
|
|
25213
|
+
id: string(),
|
|
25214
|
+
revision: string().nullable(),
|
|
25215
|
+
frames: number(),
|
|
25216
|
+
width: number(),
|
|
25217
|
+
height: number()
|
|
25218
|
+
});
|
|
25219
|
+
var NodeBenchRunnerInputSchema = object({
|
|
25220
|
+
runId: string().min(1),
|
|
25221
|
+
devices: array(NodeBenchmarkDevicePlanSchema).min(1),
|
|
25222
|
+
phases: array(NodeBenchmarkPhaseSchema).min(1),
|
|
25223
|
+
/** The full detail step tree root for the `pipeline` measurement is built on the node from these ids. */
|
|
25224
|
+
steps: array(string()).default([]),
|
|
25225
|
+
fpsPerStream: number().int().min(1).max(30),
|
|
25226
|
+
/** The runner stops on its own past this instant, whatever the hub does. */
|
|
25227
|
+
deadlineAtMs: number(),
|
|
25228
|
+
settleSec: number().min(0).max(60).default(NODE_BENCHMARK_DEFAULTS.settleSec),
|
|
25229
|
+
measureSec: number().min(2).max(300).default(NODE_BENCHMARK_DEFAULTS.measureSec),
|
|
25230
|
+
keepDownloadedModels: boolean().default(false)
|
|
25231
|
+
});
|
|
25232
|
+
var NodeBenchRunnerStateSchema = _enum([
|
|
25233
|
+
"running",
|
|
25234
|
+
"done",
|
|
25235
|
+
"failed",
|
|
25236
|
+
"aborted"
|
|
25237
|
+
]);
|
|
25238
|
+
var NodeBenchRunnerStatusSchema = object({
|
|
25239
|
+
runId: string(),
|
|
25240
|
+
nodeId: string(),
|
|
25241
|
+
state: NodeBenchRunnerStateSchema,
|
|
25242
|
+
progress: NodeBenchProgressSchema.nullable(),
|
|
25243
|
+
/** Every finished cell so far — a run stopped half way keeps what it measured. */
|
|
25244
|
+
cells: array(NodeBenchCellSchema).readonly(),
|
|
25245
|
+
fingerprint: NodeBenchFingerprintSchema.nullable(),
|
|
25246
|
+
clip: NodeBenchClipSchema.nullable(),
|
|
25247
|
+
/** Cameras seen running on the node during the run (they share its pools). */
|
|
25248
|
+
activeCameraIds: array(number()).readonly(),
|
|
25249
|
+
/** Models the run downloaded and then deleted (not installed before). */
|
|
25250
|
+
deletedModels: array(string()).readonly(),
|
|
25251
|
+
error: string().nullable(),
|
|
25252
|
+
startedAtMs: number(),
|
|
25253
|
+
finishedAtMs: number().nullable()
|
|
25254
|
+
});
|
|
25255
|
+
var NodeBenchmarkStateSchema = _enum([
|
|
25256
|
+
"draining",
|
|
25257
|
+
"measuring",
|
|
25258
|
+
"restoring",
|
|
25259
|
+
"done",
|
|
25260
|
+
"failed",
|
|
25261
|
+
"aborted"
|
|
25262
|
+
]);
|
|
25263
|
+
/** Why a run ended. */
|
|
25264
|
+
var NodeBenchmarkEndReasonSchema = _enum([
|
|
25265
|
+
"completed",
|
|
25266
|
+
"operator-abort",
|
|
25267
|
+
"deadline",
|
|
25268
|
+
"node-lost",
|
|
25269
|
+
"runner-lost",
|
|
25270
|
+
"hub-restart",
|
|
25271
|
+
"drain-timeout",
|
|
25272
|
+
"failed"
|
|
25273
|
+
]);
|
|
25274
|
+
var NodeBenchmarkRunSchema = object({
|
|
25275
|
+
runId: string(),
|
|
25276
|
+
nodeId: string(),
|
|
25277
|
+
state: NodeBenchmarkStateSchema,
|
|
25278
|
+
plan: NodeBenchmarkPlanSchema,
|
|
25279
|
+
startedAtMs: number(),
|
|
25280
|
+
deadlineAtMs: number(),
|
|
25281
|
+
finishedAtMs: number().nullable(),
|
|
25282
|
+
endReason: NodeBenchmarkEndReasonSchema.nullable(),
|
|
25283
|
+
error: string().nullable(),
|
|
25284
|
+
/** Cameras moved off the node for the run. */
|
|
25285
|
+
moved: array(number()).readonly(),
|
|
25286
|
+
/** Cameras that stayed (their only frame source is the node). */
|
|
25287
|
+
staying: array(number()).readonly(),
|
|
25288
|
+
/** Something else ran on the node's pools during the run. */
|
|
25289
|
+
contaminated: boolean(),
|
|
25290
|
+
progress: NodeBenchProgressSchema.nullable(),
|
|
25291
|
+
resultIds: array(string()).readonly()
|
|
25292
|
+
});
|
|
25293
|
+
/** `getNodeBenchmarkStatus`: the active run (or the last one), and whether benchmark mode is on. */
|
|
25294
|
+
var NodeBenchmarkStatusSchema = object({
|
|
25295
|
+
/** The node the cluster is in benchmark mode for; null = none. */
|
|
25296
|
+
modeNodeId: string().nullable(),
|
|
25297
|
+
run: NodeBenchmarkRunSchema.nullable()
|
|
25298
|
+
});
|
|
25299
|
+
/**
|
|
25300
|
+
* One stored measurement — the only authority Auto tune and the automatic
|
|
25301
|
+
* shares read measured capacity from. Written by the orchestrator when a run
|
|
25302
|
+
* ends, never by anyone else.
|
|
25303
|
+
*/
|
|
25304
|
+
var NodeBenchmarkResultSchema = object({
|
|
25305
|
+
id: string(),
|
|
25306
|
+
runId: string(),
|
|
25307
|
+
nodeId: string(),
|
|
25308
|
+
cell: NodeBenchCellSchema,
|
|
25309
|
+
fpsPerStream: number(),
|
|
25310
|
+
fingerprint: NodeBenchFingerprintSchema.nullable(),
|
|
25311
|
+
clip: NodeBenchClipSchema.nullable(),
|
|
25312
|
+
/** Other work shared the node's pools (a camera that could not move, or the hub's own duties). */
|
|
25313
|
+
contaminated: boolean(),
|
|
25314
|
+
stayingCameras: array(number()).readonly(),
|
|
25315
|
+
/** The run ended early; the cell itself completed. */
|
|
25316
|
+
partialRun: boolean(),
|
|
25317
|
+
measuredAtMs: number()
|
|
25318
|
+
});
|
|
25319
|
+
var ListNodeBenchmarkResultsInputSchema = object({
|
|
25320
|
+
nodeId: string().optional(),
|
|
25321
|
+
deviceKey: string().optional()
|
|
25322
|
+
});
|
|
25323
|
+
/** A result with its standing today: does it still beat the table? */
|
|
25324
|
+
var NodeBenchmarkResultViewSchema = NodeBenchmarkResultSchema.extend({
|
|
25325
|
+
/** `fresh` beats the table; `stale` falls back to it; `superseded` = a newer row covers the same cell. */
|
|
25326
|
+
standing: _enum([
|
|
25327
|
+
"fresh",
|
|
25328
|
+
"stale",
|
|
25329
|
+
"superseded"
|
|
25330
|
+
]),
|
|
25331
|
+
staleWhy: _enum([
|
|
25332
|
+
"age",
|
|
25333
|
+
"runtime",
|
|
25334
|
+
"pool-tuning"
|
|
25335
|
+
]).nullable()
|
|
25336
|
+
});
|
|
25337
|
+
object({
|
|
25338
|
+
runId: string(),
|
|
25339
|
+
nodeId: string(),
|
|
25340
|
+
startedAtMs: number(),
|
|
25341
|
+
deadlineAtMs: number(),
|
|
25342
|
+
plan: NodeBenchmarkPlanSchema,
|
|
25343
|
+
moved: array(number()).readonly(),
|
|
25344
|
+
staying: array(number()).readonly()
|
|
25345
|
+
});
|
|
25346
|
+
/** Candidate detectors per device, for the plan editor. */
|
|
25347
|
+
var NodeBenchmarkCandidatesSchema = object({
|
|
25348
|
+
nodeId: string(),
|
|
25349
|
+
reachable: boolean(),
|
|
25350
|
+
devices: array(object({
|
|
25351
|
+
deviceKey: string(),
|
|
25352
|
+
enabled: boolean(),
|
|
25353
|
+
available: boolean(),
|
|
25354
|
+
/** Ordered: what Auto tune would pick first, then the rest of the family by accuracy. */
|
|
25355
|
+
suggested: array(string()).readonly(),
|
|
25356
|
+
/** Every root detector the device has a build for. */
|
|
25357
|
+
all: array(string()).readonly(),
|
|
25358
|
+
/** The model the device runs now, when pinned. */
|
|
25359
|
+
currentModelId: string().nullable()
|
|
25360
|
+
})).readonly(),
|
|
25361
|
+
/** Detail steps the node's catalog offers under the root (for the `pipeline` measurement). */
|
|
25362
|
+
steps: array(object({
|
|
25363
|
+
id: string(),
|
|
25364
|
+
name: string(),
|
|
25365
|
+
slot: string()
|
|
25366
|
+
})).readonly()
|
|
25367
|
+
});
|
|
23886
25368
|
object({
|
|
23887
25369
|
activeCameras: number(),
|
|
23888
25370
|
throttledCameras: number(),
|
|
@@ -24971,7 +26453,16 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
|
|
|
24971
26453
|
}), ParkedTrackFrameSchema.nullable()), method(object({
|
|
24972
26454
|
deviceId: number(),
|
|
24973
26455
|
trackId: string()
|
|
24974
|
-
}), object({ released: number().int().nonnegative() }), { kind: "mutation" })
|
|
26456
|
+
}), object({ released: number().int().nonnegative() }), { kind: "mutation" }), method(NodeBenchRunnerInputSchema, object({
|
|
26457
|
+
accepted: literal(true),
|
|
26458
|
+
runId: string()
|
|
26459
|
+
}), {
|
|
26460
|
+
kind: "mutation",
|
|
26461
|
+
auth: "admin"
|
|
26462
|
+
}), method(object({ runId: string() }), NodeBenchRunnerStatusSchema.nullable(), { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
|
|
26463
|
+
kind: "mutation",
|
|
26464
|
+
auth: "admin"
|
|
26465
|
+
});
|
|
24975
26466
|
var CameraPipelineConfigSchema = object({
|
|
24976
26467
|
engine: PipelineEngineChoiceSchema.optional(),
|
|
24977
26468
|
steps: array(PipelineStepInputSchema).readonly(),
|
|
@@ -25610,6 +27101,21 @@ method(object({
|
|
|
25610
27101
|
}), method(PlacementStatsInputSchema, PlacementStatsSchema, { auth: "admin" }), method(SuggestSharesInputSchema, SuggestSharesResultSchema, { auth: "admin" }), method(_void(), EffectiveSharesSchema, { auth: "admin" }), method(SetShareSourceInputSchema, object({ success: literal(true) }), {
|
|
25611
27102
|
kind: "mutation",
|
|
25612
27103
|
auth: "admin"
|
|
27104
|
+
}), method(NodeBenchmarkPlanSchema, NodeBenchmarkPreflightSchema, { auth: "admin" }), method(NodeBenchmarkPlanSchema, discriminatedUnion("kind", [object({
|
|
27105
|
+
kind: literal("started"),
|
|
27106
|
+
runId: string()
|
|
27107
|
+
}), object({
|
|
27108
|
+
kind: literal("refused"),
|
|
27109
|
+
preflight: NodeBenchmarkPreflightSchema
|
|
27110
|
+
})]), {
|
|
27111
|
+
kind: "mutation",
|
|
27112
|
+
auth: "admin"
|
|
27113
|
+
}), method(_void(), NodeBenchmarkStatusSchema, { auth: "admin" }), method(object({ runId: string() }), object({ aborted: boolean() }), {
|
|
27114
|
+
kind: "mutation",
|
|
27115
|
+
auth: "admin"
|
|
27116
|
+
}), method(object({ nodeId: string() }), NodeBenchmarkCandidatesSchema, { auth: "admin" }), method(ListNodeBenchmarkResultsInputSchema, array(NodeBenchmarkResultViewSchema).readonly(), { auth: "admin" }), method(object({ id: string() }), object({ deleted: boolean() }), {
|
|
27117
|
+
kind: "mutation",
|
|
27118
|
+
auth: "admin"
|
|
25613
27119
|
}), method(object({ deviceId: number() }), CameraPipelineSettingsSchema.nullable()), method(object({
|
|
25614
27120
|
deviceId: number(),
|
|
25615
27121
|
addonId: string(),
|
|
@@ -30691,6 +32197,9 @@ var CreateIntegrationInputSchema = object({
|
|
|
30691
32197
|
enabled: boolean().optional(),
|
|
30692
32198
|
info: record(string(), unknown()).optional(),
|
|
30693
32199
|
settings: record(string(), unknown()).optional(),
|
|
32200
|
+
/** Keys of `settings` the form's schema declares secret (by type) — kept in
|
|
32201
|
+
* the keychain, not the table (D787). */
|
|
32202
|
+
secretKeys: array(string()).optional(),
|
|
30694
32203
|
skipRestart: boolean().optional()
|
|
30695
32204
|
});
|
|
30696
32205
|
var UpdateIntegrationInputSchema = object({
|
|
@@ -30714,7 +32223,9 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
|
|
|
30714
32223
|
auth: "admin"
|
|
30715
32224
|
}), method(object({ id: string() }), record(string(), unknown()), { auth: "admin" }), method(object({
|
|
30716
32225
|
id: string(),
|
|
30717
|
-
settings: record(string(), unknown())
|
|
32226
|
+
settings: record(string(), unknown()),
|
|
32227
|
+
/** Keys the form's schema declares secret (by type) — keychain-stored (D787). */
|
|
32228
|
+
secretKeys: array(string()).optional()
|
|
30718
32229
|
}), object({ success: boolean() }), {
|
|
30719
32230
|
kind: "mutation",
|
|
30720
32231
|
auth: "admin"
|
|
@@ -39419,6 +40930,90 @@ Object.freeze({
|
|
|
39419
40930
|
addonId: null,
|
|
39420
40931
|
access: "create"
|
|
39421
40932
|
},
|
|
40933
|
+
"keychain.delete": {
|
|
40934
|
+
capName: "keychain",
|
|
40935
|
+
capScope: "system",
|
|
40936
|
+
addonId: null,
|
|
40937
|
+
access: "delete"
|
|
40938
|
+
},
|
|
40939
|
+
"keychain.getState": {
|
|
40940
|
+
capName: "keychain",
|
|
40941
|
+
capScope: "system",
|
|
40942
|
+
addonId: null,
|
|
40943
|
+
access: "view"
|
|
40944
|
+
},
|
|
40945
|
+
"keychain.listMeta": {
|
|
40946
|
+
capName: "keychain",
|
|
40947
|
+
capScope: "system",
|
|
40948
|
+
addonId: null,
|
|
40949
|
+
access: "view"
|
|
40950
|
+
},
|
|
40951
|
+
"keychain.put": {
|
|
40952
|
+
capName: "keychain",
|
|
40953
|
+
capScope: "system",
|
|
40954
|
+
addonId: null,
|
|
40955
|
+
access: "create"
|
|
40956
|
+
},
|
|
40957
|
+
"keychain.resolve": {
|
|
40958
|
+
capName: "keychain",
|
|
40959
|
+
capScope: "system",
|
|
40960
|
+
addonId: null,
|
|
40961
|
+
access: "view"
|
|
40962
|
+
},
|
|
40963
|
+
"keychainAdmin.deleteOrphans": {
|
|
40964
|
+
capName: "keychain-admin",
|
|
40965
|
+
capScope: "system",
|
|
40966
|
+
addonId: null,
|
|
40967
|
+
access: "delete"
|
|
40968
|
+
},
|
|
40969
|
+
"keychainAdmin.downloadRecoveryKey": {
|
|
40970
|
+
capName: "keychain-admin",
|
|
40971
|
+
capScope: "system",
|
|
40972
|
+
addonId: null,
|
|
40973
|
+
access: "create"
|
|
40974
|
+
},
|
|
40975
|
+
"keychainAdmin.listAudit": {
|
|
40976
|
+
capName: "keychain-admin",
|
|
40977
|
+
capScope: "system",
|
|
40978
|
+
addonId: null,
|
|
40979
|
+
access: "view"
|
|
40980
|
+
},
|
|
40981
|
+
"keychainAdmin.listSecrets": {
|
|
40982
|
+
capName: "keychain-admin",
|
|
40983
|
+
capScope: "system",
|
|
40984
|
+
addonId: null,
|
|
40985
|
+
access: "view"
|
|
40986
|
+
},
|
|
40987
|
+
"keychainAdmin.purgeRetiredKeys": {
|
|
40988
|
+
capName: "keychain-admin",
|
|
40989
|
+
capScope: "system",
|
|
40990
|
+
addonId: null,
|
|
40991
|
+
access: "delete"
|
|
40992
|
+
},
|
|
40993
|
+
"keychainAdmin.resetKeychain": {
|
|
40994
|
+
capName: "keychain-admin",
|
|
40995
|
+
capScope: "system",
|
|
40996
|
+
addonId: null,
|
|
40997
|
+
access: "delete"
|
|
40998
|
+
},
|
|
40999
|
+
"keychainAdmin.reveal": {
|
|
41000
|
+
capName: "keychain-admin",
|
|
41001
|
+
capScope: "system",
|
|
41002
|
+
addonId: null,
|
|
41003
|
+
access: "create"
|
|
41004
|
+
},
|
|
41005
|
+
"keychainAdmin.rotateMasterKey": {
|
|
41006
|
+
capName: "keychain-admin",
|
|
41007
|
+
capScope: "system",
|
|
41008
|
+
addonId: null,
|
|
41009
|
+
access: "create"
|
|
41010
|
+
},
|
|
41011
|
+
"keychainAdmin.status": {
|
|
41012
|
+
capName: "keychain-admin",
|
|
41013
|
+
capScope: "system",
|
|
41014
|
+
addonId: null,
|
|
41015
|
+
access: "view"
|
|
41016
|
+
},
|
|
39422
41017
|
"lawnMowerControl.dock": {
|
|
39423
41018
|
capName: "lawn-mower-control",
|
|
39424
41019
|
capScope: "device",
|
|
@@ -40793,6 +42388,18 @@ Object.freeze({
|
|
|
40793
42388
|
addonId: null,
|
|
40794
42389
|
access: "create"
|
|
40795
42390
|
},
|
|
42391
|
+
"pipelineAnalytics.addRetrainFrameFromRecording": {
|
|
42392
|
+
capName: "pipeline-analytics",
|
|
42393
|
+
capScope: "device",
|
|
42394
|
+
addonId: null,
|
|
42395
|
+
access: "create"
|
|
42396
|
+
},
|
|
42397
|
+
"pipelineAnalytics.addRetrainFramesToCollection": {
|
|
42398
|
+
capName: "pipeline-analytics",
|
|
42399
|
+
capScope: "device",
|
|
42400
|
+
addonId: null,
|
|
42401
|
+
access: "create"
|
|
42402
|
+
},
|
|
40796
42403
|
"pipelineAnalytics.applyDeviceSettingsPatch": {
|
|
40797
42404
|
capName: "pipeline-analytics",
|
|
40798
42405
|
capScope: "device",
|
|
@@ -40841,12 +42448,24 @@ Object.freeze({
|
|
|
40841
42448
|
addonId: null,
|
|
40842
42449
|
access: "view"
|
|
40843
42450
|
},
|
|
42451
|
+
"pipelineAnalytics.createRetrainCollection": {
|
|
42452
|
+
capName: "pipeline-analytics",
|
|
42453
|
+
capScope: "device",
|
|
42454
|
+
addonId: null,
|
|
42455
|
+
access: "create"
|
|
42456
|
+
},
|
|
40844
42457
|
"pipelineAnalytics.deleteDeviceEvents": {
|
|
40845
42458
|
capName: "pipeline-analytics",
|
|
40846
42459
|
capScope: "device",
|
|
40847
42460
|
addonId: null,
|
|
40848
42461
|
access: "delete"
|
|
40849
42462
|
},
|
|
42463
|
+
"pipelineAnalytics.deleteRetrainCollection": {
|
|
42464
|
+
capName: "pipeline-analytics",
|
|
42465
|
+
capScope: "device",
|
|
42466
|
+
addonId: null,
|
|
42467
|
+
access: "delete"
|
|
42468
|
+
},
|
|
40850
42469
|
"pipelineAnalytics.deleteTracks": {
|
|
40851
42470
|
capName: "pipeline-analytics",
|
|
40852
42471
|
capScope: "device",
|
|
@@ -41051,6 +42670,24 @@ Object.freeze({
|
|
|
41051
42670
|
addonId: null,
|
|
41052
42671
|
access: "view"
|
|
41053
42672
|
},
|
|
42673
|
+
"pipelineAnalytics.listRetrainAssistProfiles": {
|
|
42674
|
+
capName: "pipeline-analytics",
|
|
42675
|
+
capScope: "device",
|
|
42676
|
+
addonId: null,
|
|
42677
|
+
access: "view"
|
|
42678
|
+
},
|
|
42679
|
+
"pipelineAnalytics.listRetrainCollectionFrames": {
|
|
42680
|
+
capName: "pipeline-analytics",
|
|
42681
|
+
capScope: "device",
|
|
42682
|
+
addonId: null,
|
|
42683
|
+
access: "view"
|
|
42684
|
+
},
|
|
42685
|
+
"pipelineAnalytics.listRetrainCollections": {
|
|
42686
|
+
capName: "pipeline-analytics",
|
|
42687
|
+
capScope: "device",
|
|
42688
|
+
addonId: null,
|
|
42689
|
+
access: "view"
|
|
42690
|
+
},
|
|
41054
42691
|
"pipelineAnalytics.listRetrainFrames": {
|
|
41055
42692
|
capName: "pipeline-analytics",
|
|
41056
42693
|
capScope: "device",
|
|
@@ -41099,6 +42736,12 @@ Object.freeze({
|
|
|
41099
42736
|
addonId: null,
|
|
41100
42737
|
access: "create"
|
|
41101
42738
|
},
|
|
42739
|
+
"pipelineAnalytics.proposeRetrainAnnotationsWithLlm": {
|
|
42740
|
+
capName: "pipeline-analytics",
|
|
42741
|
+
capScope: "device",
|
|
42742
|
+
addonId: null,
|
|
42743
|
+
access: "create"
|
|
42744
|
+
},
|
|
41102
42745
|
"pipelineAnalytics.pruneEvents": {
|
|
41103
42746
|
capName: "pipeline-analytics",
|
|
41104
42747
|
capScope: "device",
|
|
@@ -41153,6 +42796,18 @@ Object.freeze({
|
|
|
41153
42796
|
addonId: null,
|
|
41154
42797
|
access: "create"
|
|
41155
42798
|
},
|
|
42799
|
+
"pipelineAnalytics.removeRetrainFrameFromCollection": {
|
|
42800
|
+
capName: "pipeline-analytics",
|
|
42801
|
+
capScope: "device",
|
|
42802
|
+
addonId: null,
|
|
42803
|
+
access: "delete"
|
|
42804
|
+
},
|
|
42805
|
+
"pipelineAnalytics.renameRetrainCollection": {
|
|
42806
|
+
capName: "pipeline-analytics",
|
|
42807
|
+
capScope: "device",
|
|
42808
|
+
addonId: null,
|
|
42809
|
+
access: "create"
|
|
42810
|
+
},
|
|
41156
42811
|
"pipelineAnalytics.restageRetrainTrack": {
|
|
41157
42812
|
capName: "pipeline-analytics",
|
|
41158
42813
|
capScope: "device",
|
|
@@ -41441,6 +43096,12 @@ Object.freeze({
|
|
|
41441
43096
|
addonId: null,
|
|
41442
43097
|
access: "view"
|
|
41443
43098
|
},
|
|
43099
|
+
"pipelineOrchestrator.abortNodeBenchmark": {
|
|
43100
|
+
capName: "pipeline-orchestrator",
|
|
43101
|
+
capScope: "system",
|
|
43102
|
+
addonId: null,
|
|
43103
|
+
access: "create"
|
|
43104
|
+
},
|
|
41444
43105
|
"pipelineOrchestrator.applyAutoTune": {
|
|
41445
43106
|
capName: "pipeline-orchestrator",
|
|
41446
43107
|
capScope: "system",
|
|
@@ -41465,6 +43126,12 @@ Object.freeze({
|
|
|
41465
43126
|
addonId: null,
|
|
41466
43127
|
access: "create"
|
|
41467
43128
|
},
|
|
43129
|
+
"pipelineOrchestrator.deleteNodeBenchmarkResult": {
|
|
43130
|
+
capName: "pipeline-orchestrator",
|
|
43131
|
+
capScope: "system",
|
|
43132
|
+
addonId: null,
|
|
43133
|
+
access: "delete"
|
|
43134
|
+
},
|
|
41468
43135
|
"pipelineOrchestrator.getAgentLoad": {
|
|
41469
43136
|
capName: "pipeline-orchestrator",
|
|
41470
43137
|
capScope: "system",
|
|
@@ -41573,6 +43240,24 @@ Object.freeze({
|
|
|
41573
43240
|
addonId: null,
|
|
41574
43241
|
access: "view"
|
|
41575
43242
|
},
|
|
43243
|
+
"pipelineOrchestrator.getNodeBenchmarkCandidates": {
|
|
43244
|
+
capName: "pipeline-orchestrator",
|
|
43245
|
+
capScope: "system",
|
|
43246
|
+
addonId: null,
|
|
43247
|
+
access: "view"
|
|
43248
|
+
},
|
|
43249
|
+
"pipelineOrchestrator.getNodeBenchmarkPreflight": {
|
|
43250
|
+
capName: "pipeline-orchestrator",
|
|
43251
|
+
capScope: "system",
|
|
43252
|
+
addonId: null,
|
|
43253
|
+
access: "view"
|
|
43254
|
+
},
|
|
43255
|
+
"pipelineOrchestrator.getNodeBenchmarkStatus": {
|
|
43256
|
+
capName: "pipeline-orchestrator",
|
|
43257
|
+
capScope: "system",
|
|
43258
|
+
addonId: null,
|
|
43259
|
+
access: "view"
|
|
43260
|
+
},
|
|
41576
43261
|
"pipelineOrchestrator.getNodeInferenceDevices": {
|
|
41577
43262
|
capName: "pipeline-orchestrator",
|
|
41578
43263
|
capScope: "system",
|
|
@@ -41615,6 +43300,12 @@ Object.freeze({
|
|
|
41615
43300
|
addonId: null,
|
|
41616
43301
|
access: "view"
|
|
41617
43302
|
},
|
|
43303
|
+
"pipelineOrchestrator.listNodeBenchmarkResults": {
|
|
43304
|
+
capName: "pipeline-orchestrator",
|
|
43305
|
+
capScope: "system",
|
|
43306
|
+
addonId: null,
|
|
43307
|
+
access: "view"
|
|
43308
|
+
},
|
|
41618
43309
|
"pipelineOrchestrator.pauseForStorageMigration": {
|
|
41619
43310
|
capName: "pipeline-orchestrator",
|
|
41620
43311
|
capScope: "system",
|
|
@@ -41759,6 +43450,12 @@ Object.freeze({
|
|
|
41759
43450
|
addonId: null,
|
|
41760
43451
|
access: "create"
|
|
41761
43452
|
},
|
|
43453
|
+
"pipelineOrchestrator.startNodeBenchmark": {
|
|
43454
|
+
capName: "pipeline-orchestrator",
|
|
43455
|
+
capScope: "system",
|
|
43456
|
+
addonId: null,
|
|
43457
|
+
access: "create"
|
|
43458
|
+
},
|
|
41762
43459
|
"pipelineOrchestrator.suggestShares": {
|
|
41763
43460
|
capName: "pipeline-orchestrator",
|
|
41764
43461
|
capScope: "system",
|
|
@@ -41777,6 +43474,12 @@ Object.freeze({
|
|
|
41777
43474
|
addonId: null,
|
|
41778
43475
|
access: "create"
|
|
41779
43476
|
},
|
|
43477
|
+
"pipelineRunner.abortNodeBench": {
|
|
43478
|
+
capName: "pipeline-runner",
|
|
43479
|
+
capScope: "system",
|
|
43480
|
+
addonId: null,
|
|
43481
|
+
access: "create"
|
|
43482
|
+
},
|
|
41780
43483
|
"pipelineRunner.attachCamera": {
|
|
41781
43484
|
capName: "pipeline-runner",
|
|
41782
43485
|
capScope: "system",
|
|
@@ -41825,6 +43528,12 @@ Object.freeze({
|
|
|
41825
43528
|
addonId: null,
|
|
41826
43529
|
access: "view"
|
|
41827
43530
|
},
|
|
43531
|
+
"pipelineRunner.getNodeBenchStatus": {
|
|
43532
|
+
capName: "pipeline-runner",
|
|
43533
|
+
capScope: "system",
|
|
43534
|
+
addonId: null,
|
|
43535
|
+
access: "view"
|
|
43536
|
+
},
|
|
41828
43537
|
"pipelineRunner.getParkedTrackFrame": {
|
|
41829
43538
|
capName: "pipeline-runner",
|
|
41830
43539
|
capScope: "system",
|
|
@@ -41867,6 +43576,12 @@ Object.freeze({
|
|
|
41867
43576
|
addonId: null,
|
|
41868
43577
|
access: "create"
|
|
41869
43578
|
},
|
|
43579
|
+
"pipelineRunner.startNodeBench": {
|
|
43580
|
+
capName: "pipeline-runner",
|
|
43581
|
+
capScope: "system",
|
|
43582
|
+
addonId: null,
|
|
43583
|
+
access: "create"
|
|
43584
|
+
},
|
|
41870
43585
|
"plateGallery.assignPlate": {
|
|
41871
43586
|
capName: "plate-gallery",
|
|
41872
43587
|
capScope: "system",
|
|
@@ -46796,6 +48511,11 @@ Object.freeze({
|
|
|
46796
48511
|
form: "single",
|
|
46797
48512
|
optional: false
|
|
46798
48513
|
}],
|
|
48514
|
+
"pipelineAnalytics.addRetrainFrameFromRecording": [{
|
|
48515
|
+
name: "deviceId",
|
|
48516
|
+
form: "single",
|
|
48517
|
+
optional: false
|
|
48518
|
+
}],
|
|
46799
48519
|
"pipelineAnalytics.applyDeviceSettingsPatch": [{
|
|
46800
48520
|
name: "deviceId",
|
|
46801
48521
|
form: "single",
|
|
@@ -46986,6 +48706,11 @@ Object.freeze({
|
|
|
46986
48706
|
form: "single",
|
|
46987
48707
|
optional: false
|
|
46988
48708
|
}],
|
|
48709
|
+
"pipelineAnalytics.proposeRetrainAnnotationsWithLlm": [{
|
|
48710
|
+
name: "deviceId",
|
|
48711
|
+
form: "single",
|
|
48712
|
+
optional: false
|
|
48713
|
+
}],
|
|
46989
48714
|
"pipelineAnalytics.pruneEventsBefore": [{
|
|
46990
48715
|
name: "deviceId",
|
|
46991
48716
|
form: "single",
|
|
@@ -49112,7 +50837,7 @@ var AgentUIAddon = class extends BaseAddon {
|
|
|
49112
50837
|
capability: adminUiCapability,
|
|
49113
50838
|
provider: {
|
|
49114
50839
|
getStaticDir: async () => ({ staticDir: path.resolve(__dirname) }),
|
|
49115
|
-
getVersion: async () => ({ version: "1.2.
|
|
50840
|
+
getVersion: async () => ({ version: "1.2.192" })
|
|
49116
50841
|
}
|
|
49117
50842
|
}];
|
|
49118
50843
|
}
|